var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}


function checkEnter(e){ //e is event object passed from function invocation
var characterCode; //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's which property
}
else{
e = event;
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
authenticate(); 
return false;
}
else{
return true;
}

}



function authenticate() {

var strun=document.loginform.un.value;
var strpw=document.loginform.pw.value;
var strcookie='false';
if (document.loginform.remember.checked) {
strcookie='true';
}

http.abort();
http.open("GET", "index.php?page=Login&un=" + strun + "&pw=" +strpw + "&cookie=" + strcookie, true);
http.onreadystatechange=function() {

if(http.readyState == 4) {
if (http.responseText=="pass") {
//location.reload(true);
window.location=location.href;
return false;
}
else {
alert('Invalid Username or Password');
return false;
}
}
}
http.send(null);
return boolreturn;


}

