function getHTTPObject() {
	var xmlhttp = false;
	if (typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	} else {
        /*@cc_on
        @if (@_jscript_version >= 5)
            try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                    xmlhttp = false;
                }
            }
        @end @*/
    }
	return xmlhttp;
}

function login(url)
{
  var username = document.getElementById("txtUser").value;
  var password = document.getElementById("txtPassword").value;
  var http = getHTTPObject();
  var url = "http://" + url;
  http.open("get", url, false, username, password);
  http.send("");
	if (http.status == 200) {
		document.location = url;
	} else {
    alert("Incorrect username and/or password.");
  }
  return false;
}

function logout()
{
    var http = getHTTPObject();
    http.open("get", this.parentNode.action, false, "null", "null");
    http.send("");
    alert("You have been logged out.");
    return false;
}

