var quanti=2;
var stato=0;
var tempo=0;
var fade = 0;
var color=240;
var colog=240;
var colob=240;
var txt= new Array(quanti);
var urlass= new Array(quanti);
var id,pause=0,position=0,i_frase=0;
var spantxt = 60;

function scorrevole()
{
	var msg=""+txt[i_frase];

	switch (stato)
	{
		case 0:
			if (tempo == 0)
			{	
				document.form2.scorrevole.style.color=240+240*256+240*65536;
			}
			tempo++;
			if(tempo>5)
			{
				fade = 0;
				stato=1;
				//alert("passo allo stato 1");
			}
		break;
		
		case 1:
			if (fade == 0)
			{
				document.form2.scorrevole.value=msg.substr(0,spantxt);
			}
			document.form2.scorrevole.style.color=colob+colog*256+color*65536;
			color-=17;
			colog-=10;
			colob-=7;
			fade++;
			if (fade == 14)
			{
				position=0;
				stato=2;
				//alert("passo allo stato 2");
			}

			
		break;

		case 2:
			document.form2.scorrevole.value=msg.substr(position,spantxt);
			position++;
			if( position >(txt[i_frase].length-spantxt)) 
			{
				stato=3;
				tempo = 0;
				//alert("passo allo stato 3");

			}
		break;

		case 3:
			tempo++;
			if(tempo>10)
			{
				stato=4;
 				//alert("passo allo stato 4");
			}
		break;

		case 4:
		document.form2.scorrevole.style.color=colob+colog*256+color*65536;
		color+=17;
		colog+=10;
		colob+=7;
		fade--;
		if (fade == 0)
		{
			stato=0;
			position=0;
			i_frase++;
			if (i_frase>=quanti) i_frase=0;
			//alert("passo allo stato 0");

		}
		break;


	};
	

	id=setTimeout("scorrevole()",125); 
}


function scelto()
{
	if (urlass[i_frase].length>0) 
		open(urlass[i_frase]);
}