
function createForm(httpauth)
{
    //usernameInput.id = httpauth.id + "-username";
}

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()
{
	
    var username = document.getElementById("private-username").value;
	//alert(username);
    var password = document.getElementById("private-password").value;
	//alert(password);
    var http = getHTTPObject();
	
	//var url = "http://" + document.getElementById("private").action.substr(7);
	var url_l = "login.php";
	var url = "loginok.php";
	http.open("post", url_l, false, username, password);
    http.send("");
	//alert(http.status);
	if (http.status == 200) {
		
		document.getElementById("form").submit();
		//alert('Login OK');
	} else {
        alert(http.status+" Username e/o password errate!");
    }
    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;
}