if (typeof MFahimi == 'undefined')
 var MFahimi = {};

MFahimi.autoRotator = function(url) {

 this._itemNumber = 6;
 this._arrow = 0; //right=0 - reverse=1
 this._delay = 7; //in second
 this._isOK = false;
 this._cur = 1;
 this._id = 0;
 this._stopNow = false;
 this.init(); 
}

MFahimi.autoRotator.prototype.init = function() {
  if(dw_scrollObj){
    this._isOK=true;
  }
}

MFahimi.autoRotator.prototype.rotate = function() {
	if(this._isOK && !this._stopNow){
		if ( document.getElementById && !this.sliding ){
			if(this._cur==this._itemNumber && this._arrow==0){
				this._arrow=1;
				//document.getElementById("ar").value="i-"+this._arrow;
			}

			if(this._cur<=1 && this._arrow==1){
				this._arrow=0;
				//document.getElementById("ar").value="i-"+this._arrow;
			}


			cmd="";
			if(this._arrow==0){
				cmd = "dw_scrollObj.scrollBy('wn',-314,0);";
			}else{
				cmd = "dw_scrollObj.scrollBy('wn',314,0);";
			}
			cmd = cmd + " mfAutoRotator.rotate()";
		}else
			cmd = "mfAutoRotator.rotate()";
		this._id = setTimeout(cmd,this._delay*1000);
	}
}

MFahimi.autoRotator.prototype.stop = function() {
  clearTimeout(this._id);
}


MFahimi.autoRotator.prototype.stopNow = function() {
  this._stopNow = true;
}

var mfAutoRotator = new MFahimi.autoRotator();

mfAutoRotator.rotate();