function FadeEffect (sId, lLimit, lSpeed) {
   this.sId = sId;
   this.lFadeStep = 20;
   this.lSteps = Math.floor(((lLimit > 100) ? 100 : lLimit)/this.lFadeStep);
   this.lSpeed = lSpeed;
   
   this.fadeTime = function() {
      return ((this.lSteps+1) * this.lSpeed);
   }
   
   this.fadeIn = function () {
      var i;
      
      document.getElementById(this.sId).style.opacity = '0';
      document.getElementById(this.sId).style.filter = 'alpha(opacity=0)';
		document.getElementById(this.sId).style.display = 'block';
		
		for (i=0;i<=this.lSteps;i++) {
			setTimeout('document.getElementById(\''+this.sId+'\').style.opacity = "'+Number(i * this.lFadeStep /100).toString()+'";', i * lSpeed);
			setTimeout('document.getElementById(\''+this.sId+'\').style.filter = "alpha(opacity='+Number(i * this.lFadeStep).toString()+')";', i * lSpeed);
      }
   } 
   
   this.fadeOut = function () {
   var i;

		for (i=this.lSteps;i>=0;i--) {
			setTimeout('document.getElementById(\''+this.sId+'\').style.opacity = "'+Number(i * this.lFadeStep /100).toString()+'";', (this.lSteps-i) * lSpeed);
			setTimeout('document.getElementById(\''+this.sId+'\').style.filter = "alpha(opacity='+Number(i * this.lFadeStep).toString()+')";', (this.lSteps-i) * lSpeed);
      }
      setTimeout('document.getElementById(\''+this.sId+'\').style.display=\'none\';', this.fadeTime());   
   }
}

