var http;

function login()
{
    var username = document.getElementById("private-username").value;
    var password = document.getElementById("private-password").value;
    if (username=="" || password=="") {
	alert("Incorrect username and/or password.");
	return false;
    }

    var URL="/agents/passwords.php?username="+username+"&password="+password;
    http.open("get", URL, false, username, password);
    http.send("");
    if (http.status == 200) {
        document.location = URL;
        //alert("Correct username and/or password.");

    } else {
        alert("Incorrect username and/or password.");
    }
    return false;
}

function getHTTPObject() {
    if (typeof XMLHttpRequest != 'undefined') {
        return new XMLHttpRequest();
    }
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
    return false;
}

window.onload = function()
{
    http = getHTTPObject();

}
