
/*-----------------------------
	Utility Function 
-----------------------------*/

function setClock() {
	
	var x=new Date(); h=x.getHours(); m=x.getMinutes();s=x.getSeconds();
	if(s<=9) s="0"+s; if(m<=9) m="0"+m; if(h<=9) h="0"+h; time=h+":"+m+":"+s;
	document.getElementById('clock').innerHTML=time;
	setTimeout("setClock()",1000);
}



function setImage(id,path,text){
	
	document.getElementById(id).src = "/"+path;
	document.getElementById('msgAsta').innerHTML = text;
	text = text.replace(' ','');
	setAHref(text.toLowerCase());
}



function setAHref(ancor){
	
	ancor = ancor.replace(' ','');
	ancor = ancor.toLowerCase();
	
	document.getElementById('href_funziona').setAttribute('href','/comefunziona/#'+ancor);
}



function setMenu(id){
	
	document.getElementById(id).setAttribute((document.all ? 'className' : 'class'), 'menuOn');	
}



function setPswField(){
		
		parentForm = document.getElementById('loggain');
		
		label = document.getElementById('labelPsw');
		label.innerHTML = 'La tua Mail';
		
		inputElement = document.getElementById('password');
		
		try{
			inputElement.removeNode();
		
		}catch(e){
			
			parentForm.removeChild(inputElement);
		}
		
		input = document.createElement('input');
		input.setAttribute('name','posta');
		input.setAttribute('type','text');
		input.setAttribute((document.all ? 'className' : 'class'), 'inputBox');	
		
		button = document.getElementById('button');
		button.setAttribute('value','Invia');
		
		
		parentForm.action = 'php/send_psw.php';
		parentForm.insertBefore(input,button);
}

/*-----------------------------
	CountDown callback
-----------------------------*/

function locRefresh(obj){
	
	loadXMLDoc('/php/sendWin.php?id='+obj,'refreshPage');

}

function refreshPage(){
	location.reload(true);
}

