// preload immagini
var myimages=new Array();
function preImg() {
	for (i=0;i<preImg.arguments.length;i++) {
		myimages[i]=new Image();
		myimages[i].src=preImg.arguments[i];
	}
}


// scambio immagini
var urlimg;
var idimg;
function scambioImg(id,url) {
	if(url && id) {
		urlimg = document.getElementById(id).src;
		document.getElementById(id).src = url
		idimg = id;
	} else {
		document.getElementById(idimg).src = urlimg
	}
}



// menu gallerie
function jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

// nuova finestra
function Win(URL,opzioni) { 
	if(opzioni) var winOpzioni=opzioni; else var winOpzioni = 'width=792,height=600,top=0,left=0,scrollbars=yes';
	window.open(URL,'quadro',winOpzioni); 
}

// scrivi in elemento
function def(text) {
	var e = document.getElementById("dixit");
	e.innerHTML = text;
}
// reimposta elemento
function defNull() {
	var e = document.getElementById("dixit");
	e.innerHTML = 'clicca sulle immagini per ingrandirle';
}



// testo progressivo - richiamare con animate()
// la prima parte dello script, con i dati personali, è inserita nelle pagine in cui è usato

if(typeof line == 'object') { // controlla che la prima parte sia stata seguita, quindi sia definito line
	var longestmessage=1
	for (i=2;i<line.length;i++){
		if (line[i].length>line[longestmessage].length)
		longestmessage=i
	}
	
	var tscroller_width=line[longestmessage].length
	lines=line.length-1
	temp=""
	nextchar=-1;
	nextline=1;
}

function animate(){
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines) {
		nextline++;
		nextchar=-1;
		document.getElementById('run').innerHTML=temp;
		temp="";
		setTimeout("nextstep()",timeL)
	} else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
		nextline=1;
		nextchar=-1;
		document.getElementById('run').innerHTML=temp;
		temp="";
		setTimeout("nextstep()",timeR)
	} else {
		nextstep()
	}
}
function nextstep(){
	nextchar++;
	temp+=line[nextline].charAt(nextchar);
	document.getElementById('run').innerHTML=temp
	setTimeout("animate()",timeC)
}
