/**
 * effects 
 */
function Effects(Id){

	//this.Var        = Var;
	this.Id         = Id;
	this.Status     = 1;
	this.Frames     = 15;
	this.Delay      = 80;
	this.Obj = document.getElementById(this.Id);

	/**
	* init status
	* DOM Id, visible or not (0 or 1)
	*/
	this.setStatus = function(Status){
	  
	  this.Status = Status;
	  if (Status == 0){
		this.Obj.style.visibility = 'hidden';
	  }
	  else {
		this._setOpacity(1);
		this.Obj.style.visibility = 'visible';
	  }
	};




	/**
	* fade in step
	* increment
	*/
	this._fadeInStep = function(Nr){

	if (Nr <= this.Frames){
	  this._setOpacity(Nr/this.Frames);
	  Nr ++;
	  var thisObj = this;
	  setTimeout(function () { thisObj._fadeInStep(Nr) }, this.Delay);
	}
	else return true;
	};




	/**
	* effect fade in
	* Frames No., Delay between frames (ms)
	*/
	this.fadeIn   = function(Frames, Delay){

	this.Frames     = Frames||this.Frames;
	this.Delay      = Delay||this.Delay;
	if (this.Status == 0){
		this.setStatus(1);
	}
	this._setOpacity(0);
	var thisObj		= this;
	setTimeout(function () { thisObj._fadeInStep(0) }, this.Delay);
	};




	/**
	* fade out step
	* decrement
	*/
	this._fadeOutStep = function(Nr){

	if (Nr > 0){
	  this._setOpacity(Nr/this.Frames);
	  Nr --;
	  var thisObj		= this;
	  setTimeout(function () { thisObj._fadeOutStep(Nr) }, this.Delay);
	}
	else {
	  this.setStatus(0);
	  return true;
	}
	};




	/**
	* effect fade out
	* Frames No., Delay between frames (ms)
	*/
	this.fadeOut   = function(Frames, Delay){

	this.Frames     = Frames||this.Frames;
	this.Delay      = Delay||this.Delay;
	if (this.Status == 0)
	  this.setStatus(1);
	this._setOpacity(1);
	var thisObj		= this;
	setTimeout(function () { thisObj._fadeOutStep(thisObj.Frames)}, this.Delay);
	};

	/**
	* set opacity
	* value
	*/
	this._setOpacity = function(Val){
	  
	this.Obj.style.filter     = "alpha(opacity="+Val*100+")";
	this.Obj.style.mozOpacity = Val;
	this.Obj.style.opacity    = Val;
	};

}
