counter=0;
var text="";
var delay=50;
var currentChar=1;
var destination="[none]";

function type()
{
	if (document.getElementById)
	{
		dest=document.getElementById(destination);
		if (dest)
		{
			dest.innerHTML=text.substr(0, currentChar);
			currentChar++
			if (currentChar>text.length)
			{
				currentChar = 1;
				showtime = setTimeout(change, 50000)
			}	
			else
			{
				setTimeout("type()", delay);
			}
		}
	}
}

function changeWords(){
showtime = window.setTimeout(change, 50000);
}
function change(){
counter++;
if(counter==testo_da_battere.length){
counter = 0;
}
window.clearTimeout(showtime);
dest=document.getElementById('contenitore_testo_da_battere');
dest.innerHtml = ''
startTyping(testo_da_battere[counter], '50', "contenitore_testo_da_battere");
}
function startTyping(textParam, delayParam, destinationParam)
{
	text=textParam;
	delay=delayParam;
	currentChar=1;
	destination=destinationParam;
	type();
}
