
function zapi_login() {
	xmlhttp=null
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest()	
	} else if (window.ActiveXObject) {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	
	username = document.getElementById('fu_name').value;
	password = document.getElementById('fu_pwd').value;
	url="?ajax=true";
	xmlhttp.onreadystatechange=login_complete;
	xmlhttp.open("POST",url,true)
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send("ajax=true&perform_login=true&fu_name="+username+"&fu_pwd="+password+"");
}

function login_complete() {
	if (xmlhttp.readyState==4) { 
		if (xmlhttp.status==200){ 	
			if(xmlhttp.responseText == "success") {
				document.getElementById('adminLogin').controls.close();
				location.reload(true)
			} else {
				document.getElementById('adminLogin').controls.close();
				document.getElementById('adminLogin_response').innerHTML = xmlhttp.responseText;
				initiateControls(document.getElementById('adminLogin'),'Login');
			}
		}
	}
}