function getXMLHttpRequest() {
	try{
		return new XMLHttpRequest();
	}catch(e){}
	try{
		return new ActiveXObject('Msxml2.XMLHTTP');
	}catch(e){}
	try{
		return new ActiveXObject('Microsoft.XMLHTTP');
	}catch(e){}
}

function verifica(user,pass) {
	var xmlhttp= new getXMLHttpRequest();
	xmlhttp.onreadystatechange= function() {
		if (xmlhttp.readyState==4) {
			if (xmlhttp.status==200) {
				var risultato=xmlhttp.responseText;
				switch(risultato) {
					case '1': document.getElementById('risultato').style.display='none';
							  document.getElementById('btn_verifica').style.display='none';
							  document.getElementById('accedi').style.display='inline';
							  break;
					case '0': document.getElementById('risultato').style.display='';
							  document.getElementById('risultato').innerHTML="<font color='red'><b>Username e/o Password errati!</b></font>";
							  break;
				}
			}
		}
	}
	params="username="+user+"&password="+pass;
	xmlhttp.open("POST","verifica_accessi.asp",true);
//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(params);
}