// JavaScript Document

kk = 0;


function morph_foto(obj, act){
		if (act == 'on') 
			obj.morph('width:120px; height:80px'); 
		else 
			obj.morph('width:90px; height:60px');		
	}

function fadein(path,w,h){
	document.getElementById('anteprima').src = path;
	document.getElementById('anteprima').width = w;
	document.getElementById('anteprima').height = h;
	padding = Math.round((altezza-h)/2) + "px";
//	alert(padding);
	document.getElementById('anteprima').style.paddingTop = padding;
	Effect.Appear('anteprima', {to: 1.0})
}

function apri(path,w,h,i){

		Effect.Appear('anteprima', {duration:0.5, to: 0.0});
		document.getElementById('anteprima').src = '/images/loading.png';
		document.getElementById('anteprima').width = larghezza;
		document.getElementById('anteprima').height = altezza;
		setTimeout("fadein('"+path+"','"+w+"','"+h+"')", 1300);
		kk=i;
		
//		
}

function fadein_home(path,w,h){
	document.getElementById('anteprima').src = path;
	document.getElementById('anteprima').width = w;
	document.getElementById('anteprima').height = h;
//	padding = Math.round((750-h)/2) + "px";
//	alert(padding);
//	document.getElementById('anteprima').style.paddingTop = padding;
	Effect.Appear('anteprima', {to: 1.0})
}

function apri_home(path,w,h,i){
		Effect.Appear('anteprima', {duration:0.5, to: 0.0});
		document.getElementById('anteprima').src = '/images/loading.png';
		document.getElementById('anteprima').width = 1000;
		document.getElementById('anteprima').height = 500;
		setTimeout("fadein_home('"+path+"','"+w+"','"+h+"')", 1300);
		kk=i;
		setTimeout("successivo('"+kk+"')", 5000);
//		
}

function successivo(i){
	i= Number(i);
	i = eval(i+1) % foto.length;
	ar = foto[i].split(",");
	apri(ar[0],ar[1],ar[2],i);
}

function chiamasucc(){
	kk++;
	successivo(kk);
}

// JavaScript Document
	var tm = Number();
	function muove(id, dir){
		obj = document.getElementById(id);
		dh = obj.style.height;
		dh = dh.substr(0, (dh.length-2));		
		h = eval(obj.scrollTop) + eval(dh);
				
		if (dir == 'up') 
			obj.scrollTop += 3;
		else
			obj.scrollTop -= 3;
			
		start_muove(id, dir);
	}
	
	function start_muove(id, dir){		
		tm = setTimeout("muove(\'"+id+"\',\'"+dir+"\')",30);		
	}
	
	function stop_muove(){
		clearTimeout(tm);
	}
	
	function set_menuon(id){
		document.getElementById(id).className = 'voceon';
	}
