function login()
{
	var uname = loginform.uname.value;
	var pass = loginform.pass.value;
	var data = "uname="+uname+"&pass="+pass;
	createXHR();
	xhr.open("POST","includes/login/processlogin.php",true);
	xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	xhr.send(data);
	xhr.onreadystatechange = dologin;
	
	if (xhr.readyState != 4)
	{
		document.getElementById('status').innerHTML = "Processing login...";
	}
}

function dologin()
{
	if (xhr.readyState == 4)
	{
		var res = xhr.responseText;
		document.getElementById('status').innerHTML = res;
		var arr = res.split("|");
		if (arr[1] == 0)
		{
			document.getElementById('status').innerHTML = arr[0];
		}
		else if (arr[1] == 1)
		{
			document.getElementById('status').innerHTML = "<font color='#507d1e'>Login successful...</font>"
			window.location = arr[0]; 
		}
	}
}
