	function check_result(div_name,formname,formpassword){
		var xmlhttp;
		if (window.XMLHttpRequest){
			// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}else if (window.ActiveXObject){
			 // code for IE6, IE5
			 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}else{
			 alert("Your browser does not support XMLHTTP!");
		}
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				 var return_info = xmlhttp.responseText;
				 var mydiv = document.getElementById('div_error'); //Fix Bug explorer. First declare variable with VAR

				 if(return_info=='OK_USER'){
				 		mydiv.innerHTML = '<img src="images/loading.gif" />Accesso in corso...';
				 		setTimeout('go_to_private_page(1)', 3000);
				 	}else if(return_info=='OK_ADM'){
				 		mydiv.innerHTML = '<img src="images/loading.gif" />Accesso in corso...';
				 		setTimeout('go_to_private_page(2)', 3000);				 		
				 	}else{
				 		messageObj.close();	
				 		displayMessage('include/login.php?error=1');
				 	}
				 
				
			
				//document.myForm.time.value=xmlhttp.responseText;
			}
		}
		var url = "include/auth_login.php";
		var params = "username="+formname+"&password="+formpassword;
		xmlhttp.open("POST", url, true);

		//for post only
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", params.length);
		xmlhttp.setRequestHeader("Connection", "close");

		//xmlhttp.open("GET",'include/test.php?username=',true);
		//xmlhttp.send(null);
		xmlhttp.send(params);

	}	
	
function go_to_private_page(panel_mode){
	
	if(panel_mode==1) window.location = 'user/index.php'; // Members Area
	else  window.location = 'admin/index.php'; 
}
