// JavaScript Document
function Fader(o){
 this.obj=document.getElementById(o.ID);
 this.ary=o.TextArray;
 this.mS=o.AnimationDuration;
 this.hold=o.Hold;
 this.cnt=0;
 this.fromto=[0,100];
 this.obj.innerHTML=this.ary[0];
 this.srttime=new Date();
 this.animate();
}

Fader.prototype={

 animate:function(){
  var oop=this,ms=new Date().getTime()-this.srttime;
  this.opacity((this.fromto[1]-this.fromto[0])/this.mS*ms+this.fromto[0]);
  if (ms<this.mS){
   setTimeout(function(){oop.animate(); },10);
  }
  else {
   this.opacity(this.fromto[1]);
   this.fromto=this.fromto.reverse();
   if (this.fromto[0]==0){
    this.cnt=++this.cnt%this.ary.length;
    this.obj.innerHTML=this.ary[this.cnt];
   }
   this.dly=setTimeout(function(){ oop.srttime=new Date(); oop.animate(); },this.fromto[0]==0?500:this.hold);
  }
 },

 opacity:function(opc){
  var obj=this.obj;
  obj.style.filter='alpha(opacity='+opc+')';
  obj.style.opacity=obj.style.MozOpacity=obj.style.WebkitOpacity=obj.style.KhtmlOpacity=opc/100-.001;
 }

}
