Image1= new Image(16,16)
Image1.src = "./images/ajax.gif"

function postRequest(strURL){
var xmlHttp;
if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
var xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){ // For Internet Explorer
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('GET', strURL, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 4){
updatepage(xmlHttp.responseText);
}
}
xmlHttp.send(strURL);
}

function updatepage(str) {
if (str=="login") {
document.getElementById("return").innerHTML = "Successful Login!";
window.location = 'main.php';
}
else if (str=="invu") {
document.getElementById("return").innerHTML = "Invalid Username/Password!";
}
else if (str=="susa") {
document.getElementById("return").innerHTML = "Your account is disabled!";
}
else if (str=="error") {
document.getElementById("return").innerHTML = "Error, Please try again.";
}
}

function call_login(){
document.getElementById("return").innerHTML = "<img src='./images/ajax.gif' />";
var username = document.form1.username.value;
var password = document.form1.password.value;
var url = "./login-process.php?username=" + username + "&password=" + password;
postRequest(url);
}