bname=navigator.appName;
bversion=parseInt(navigator.appVersion)

if ((bname=="Netscape" && bversion>=4) || (bname=="Microsoft Internet Explorer" && bversion>=4))
   	window.onload=start
else
	stop();

window.onunload=stop

if (bname=="Netscape"){
	brows=true
	dt=2
} else {
	brows=false
	dt=180
}

var z=0;
var msg=0;
var rgb=0;
var link=false;
var status=true;
var updwn=false;
var message= new Array();
var value=0;
var h=window.innerHeight;
var w=window.innerWidth;
var timer1;
var timer2;
var timer3;
var bgcolor="#FFFFFF"; //Color of background
var color="#000000;";  //Color of the Letters
var anim = false;


function start(){

	message = textanim.data.split(";");
	
	if ((bname=="Netscape" && bversion>=4) || (bname=="Microsoft Internet Explorer" && bversion>=4)){
		link=false;
		updwn=true;
		if (brows)
			res=document.layers['textanim'].top
		else{
			//textanim.style.width=document.body.offsetWidth-25;
			textanim.innerHTML=message[msg]
			res=textanim.style.top
			for (x=0; x<document.all.length; x++)

				if(document.all[x].id=="textanimlink")
					link=true;
		}
	up()
	}
}

function stop(){

	clearTimeout(timer1);
	clearTimeout(timer2);
	clearTimeout(timer3);
}

function resz(){
	h=window.innerHeight;
	w=window.innerWidth;
	if (updwn)
		timer1=setTimeout('up()',1000)
	else
		timer2=setTimeout('down()',1000)
}

function restart(){
	
	if (updwn)
		timer1=setTimeout('up()',dt)
	else
		timer2=setTimeout('down()',dt)
	
}

function up(){

	rgb = "#"+color;

	if (brows){

		document.layers['textanim'].document.linkColor=rgb;
		document.layers['textanim'].document.vlinkColor=rgb;

		if (window.innerHeight!=h || window.innerWidth!=w){
			clearTimeout(timer1);
			resz()
			return;
		} else {

			document.layers['textanim'].document.write('<Pre><P Align="Left">'+message[msg]+'</P></Pre>')
			document.layers['textanim'].document.close();
		}
		
	} else {

		if (document.all("lnk") != null)
			document.all("lnk").style.color=rgb;
		
		if(link)
			textanimlink.style.color=rgb;
	}

	if (z<30){
	    if (anim) {
		    if (brows)
			    document.layers['textanim'].top--
		    else
			textanim.style.posTop--
		}
		
		z++
		timer1=setTimeout('up()',dt)
	} else {
		updwn=false;
		down()
	}
}


function down(){

	rgb = "#"+color;

	if (brows){

		document.layers['textanim'].document.linkColor=rgb;
		document.layers['textanim'].document.vlinkColor=rgb;
		
		if (window.innerHeight!=h || window.innerWidth!=w){
			clearTimeout(timer2);
			resz()
			return;
		} else {
			document.layers['textanim'].document.write('<Pre><P Align="Left">'+message[msg]+'</P></Pre>')
			document.layers['textanim'].document.close();
		}
	
	} else {
	
		if (document.all("lnk") != null)
			document.all("lnk").style.color=rgb;
		
		if(link)
			textanimlink.style.color=rgb;
	}
	
	if (z<58){
	    if (anim) {
		    if (brows)
		    	document.layers['textanim'].top--
		    else
		    	textanim.style.posTop--
		}
		
		z++
		timer2=setTimeout('down()',dt)
	
	} else	{
		
		if (brows){
			document.layers['textanim'].document.write('')
			document.layers['textanim'].document.close();
		} else
			textanim.innerHTML='';
	
		window.clearInterval(timer2);

		if(msg<message.length-1){
			msg++;
			z=0;
			
			if (brows){
				document.layers['textanim'].top=res;
			}
			else
				textanim.style.top=res;
			
			timer3=setTimeout('start()',100);
	
		} else {
			msg=0;
			z=0;
			
			if (brows)
				document.layers['textanim'].top=res;
			else
				textanim.style.top=res;
			
			timer3=setTimeout('start()',100);
		}
	}
}
