var http_requestdoLogin = false;
var URL
function makeRequestdoLogin(URL, alertFunction) {
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
        http_requestdoLogin = new XMLHttpRequest()
    } else if (window.ActiveXObject) { // IE
        try {
            http_requestdoLogin = new ActiveXObject("Msxml2.XMLHTTP")
        } catch (e) {
            try {
                http_requestdoLogin = new ActiveXObject("Microsoft.XMLHTTP")
            } catch (e) {}
        }
    }
    if (!http_requestdoLogin) {
        alert('Giving up :( Cannot create an XMLHTTP instance')
        return false
    }
    http_requestdoLogin.onreadystatechange = function() {alertFunction(http_requestdoLogin)}
    http_requestdoLogin.open('GET', URL, true)
    http_requestdoLogin.send(null)
    return true
}

var alertContentsLogin = function (http_local_requestdoLogin) {
    if ( (http_local_requestdoLogin.readyState == 4)||(http_local_requestdoLogin.readyState=="complete") ) {
        if (http_local_requestdoLogin.status == 200) {
    		document.getElementById('do_login').innerHTML = http_local_requestdoLogin.responseText
        } else {
            alert('There was a problem with the request: '+URL+', '+http_local_requestdoLogin.status)
    	}
    }
}
function doLogin() {
	var theliste_doLogin = document.getElementById('do_login'); // the UL
	
	// switch UL with a loading div
	theliste_doLogin.innerHTML = '<div class="loading"></div>';
	x = makeRequestdoLogin('ajax_login.php', alertContentsLogin)
	// On return, call alertContent() to display returned value
}