function Attiva(id,s1,s2){
var el=document.getElementById(id);
el.style.display="none";
var c=document.createElement("div");
var link=document.createElement("a");
link.href="#";
link.appendChild(document.createTextNode(s1));
link.onclick=function(){
    link.firstChild.nodeValue = (link.firstChild.nodeValue==s1) ? s2 : s1;
    el.style.display=(el.style.display=="none") ? "block" : "none";
    }
c.appendChild(link);
el.parentNode.insertBefore(c,el);
}




//---------------------------------------------------------------------------------------
function login () {
	var user = document.getElementById('username-field').value;
	var pass = document.getElementById('password-field').value;

	carica('accesso/login.php?u='+user+'&p='+pass,'login_panel_block');
	setTimeout("location.reload(true)", 1500);

}

function recupera () {
	var mail = document.getElementById('email-field').value;
	mail = mail.replace('@', '%40');
	carica('accesso/recupera.php?e='+mail,'login_panel_block');
	setTimeout("location.reload(true)", 2500);

}

function carica(url,div){
	nome_div=div;
	loadurl(url);
 
}
function loadurl(dest) { 
 
try { 
        // Moz supports XMLHttpRequest. IE uses ActiveX. 
        // browser detction is bad. object detection works for any browser 
        xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP"); 
} catch (e) { 
        // browser doesn't support ajax. handle however you want 
} 
 
// the xmlhttp object triggers an event everytime the status changes 
// triggered() function handles the events 
xmlhttp.onreadystatechange = triggered; 
 
// open takes in the HTTP method and url. 
xmlhttp.open("GET", dest); 
 
// send the request. if this is a POST request we would have 
// sent post variables: send("name=aleem&gender=male) 
// Moz is fine with just send(); but 
// IE expects a value here, hence we do send(null); 
xmlhttp.send(null); 
} 
 
function triggered() { 
// if the readyState code is 4 (Completed) 
// and http status is 200 (OK) we go ahead and get the responseText 
// other readyState codes: 
// 0=Uninitialised 1=Loading 2=Loaded 3=Interactive 
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) { 
        // xmlhttp.responseText object contains the response. 
        var R = document.getElementById(nome_div);
			R.innerHTML = xmlhttp.responseText;
} 
} 
