<!-- ////////////////////////////////////////////////////////////////////////////////////
//////
//////		W-fade									 	
//////		Fading text-box application for web pages 	 	
//////		Version: 1.0/080101c							 	
//////		29-3-01 0:29:07								 	
//////		-----------------------------------------------------------------------   	
//////		© MD 2001 									 	
//////		Manual & latest update:	http://www.welkweb.com/scripts/js/w-fade  	
//////		This script may be used freely as long as this text is left intact	
//////
//////////////////////////////////////////////////////////////////////////////////////////

// global const/vars

myAlt="<a href=http://www.tantien.com>www.tantien.com</a>";
instanceNumber=0;
step=1;

// browser:
hd = new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f');
nn=(document.layers 
	&& navigator.appName.indexOf('Netscape') != -1 
		&& navigator.userAgent.indexOf('Opera') == -1 
?1:0);
ie=(document.all 
	&& navigator.userAgent.indexOf('MSIE') != -1 
		&& navigator.userAgent.indexOf('Opera') == -1 
?1:0);
nl=(!nn && !ie ? 1 : 0);

cont=new Array();
cont[0]=	"Estenem l'art de Chi arreu del mon";
cont[1]=	"Si vols mes informacio de l'escola";
cont[2]=	"Visita la nostra principal a";
cont[3]=	"<a class='script' href='http://www.tantien.com'>www.tantien.com</a>";


function Wfade()
	{
	// creates layer
	
	// create instanceName
	instanceNumber+=2;
	var layerName="layer_"+(instanceNumber-1);
	var ilayerName="ilayer_"+instanceNumber;

	// eval function parameters
	for(this.t=0;this.t<Wfade.arguments.length;this.t++)
		{
		eval("this."+arguments[this.t]);
		};

	// internally set variables
	this.name		=layerName;
	this.iname		=ilayerName;
	this.sig1Count	=15;
	this.sig2Count	=15;
	this.colPart		="ff";
	this.col		="";
	this.direction	=1;
	this.contentCounter	=0;

	// user set variables
	this.sleep		=this.sleep*1000	|| 1000;
	this.show 		=this.show*1000	|| 3000;
	this.width		=this.width		|| 500;
	this.height		=this.height		|| 60;
	this.fontFace		=this.fontFace	|| "elephant,Arial Black";
	this.fontSize		=this.fontSize	|| 3;
	this.fontAlign	=this.fontAlign	|| "center";
	this.alt		=this.alt		|| myAlt;
	this.border=(typeof(this.border)!='solid' ? this.border : 1);
	this.content=(this.contentArray?this.contentArray:(typeof(content)!='undefined'?content:cont));

	// methods
	this.runFader=runFader;
	
	// create layer
	// no-layar browser
	if(nl)
		{
		document.write("<table height="+(this.height-5)+" cellpadding=1 cellspacing=0 border="+this.border+" 	width="+this.width+"><tr><td height="+(this.height-5)+" valign=middle align="+this.fontAlign+"><font 	face='"+this.fontFace+"' size="+this.fontSize+"  color="+this.col+">"+this.alt+"</font></td></tr></table>");
		}

	if(ie)
		{
		document.write("<span id="+this.name);
		document.write(" style=position:relative;vertical-align:middle;");
		document.write("width:"+this.width+";></span>");
		}

	else if(nn)
		{
		document.write("<table cellpadding=1 cellspacing=0  width="+this.width+"><tr><td valign=middle> 		<ilayer style=position:relative; height="+this.height+" id="+this.iname+" 		width="+this.width+"px>");
	       document.write("<layer  height="+this.height+" name="+this.name+" width="+this.width+"px>");
		document.write("&nbsp;</layer></ilayer></td></tr></table>");
		}
	}

function runFader()
	{
	// 20 tps determines the appropriate HEX code for that instance and updates layer contents

	// no-layer browser
	if(nl){return};

	if(runFader.arguments[0]){ob=eval(runFader.arguments[0])}else{ob=this};
	ob.colPart=hd[Math.round(ob.sig1Count)].toString();
	ob.colPart+=hd[Math.round(ob.sig2Count)].toString();
	ob.col=ob.colPart;
	ob.col+=ob.colPart;
	ob.col+=ob.colPart;
	
	// update layer content
	if (nn)
		{
		document[ob.iname].document[ob.name].document.open();
		document[ob.iname].document[ob.name].document.write("<table height="+(ob.height-5)+" 		cellpadding=1	cellspacing=0 border="+ob.border+" width="+ob.width+"><tr><td 		height="+(ob.height-5)+" valign=middle align="+ob.fontAlign+"><font face='"+ob.fontFace+"' 		size="+ob.fontSize+" 		color="+ob.col+">"+ob.content[ob.contentCounter]+"</font></td></tr></table>");
		document[ob.iname].document[ob.name].document.close();
		}

	else if(ie)
		{
		document.all[ob.name].innerHTML="<table border=0 style='border:"+ob.border+"px solid 		black' cellpladding=1 cellspacing=0 width="+ob.width+"><tr><td height="+ob.height+" valign=middle 		align="+ob.fontAlign+"><font face='"+ob.fontFace+"' size="+ob.fontSize+" 		color="+ob.col+">"+ob.content[ob.contentCounter]+"</font></td></tr></table>";
		}

	// determine new HEX code
	ob.sig1Count+=(step*ob.direction);
	if(ob.sig1Count>15)
	   {
	   ob.direction=-1;
	   ob.sig1Count=15;
	   ob.rFT=setTimeout("runFader(ob)",ob.sleep);
	   ob.contentCounter++;
	   if(ob.contentCounter==ob.content.length)
	      {
	      ob.contentCounter=0;
	      }
	   return;
	   }

	if(ob.sig1Count<0)
		{
		ob.direction=1;
		ob.sig1Count=0;
		ob.rFT=setTimeout("runFader(ob)",ob.show);
		return;
		}
	ob.rFT=setTimeout("runFader(ob)",40);
	}
//-->	



