//send ajax request
function sendAjaxRequest(urlquery, elementname, handlername) {

    var ajaxHttp; //ajax http object
    var bMozilla = false; //is mozzila
        
    //supports activex
    if (window.ActiveXObject)
    {
        ajaxHttp = new ActiveXObject("Microsoft.XMLHTTP");
        if (ajaxHttp ==  null) { ajaxHttp = new ActiveXObject ("Msxml2.XMLHTTP"); }
    }
    else if (window.XMLHttpRequest)
    {
        ajaxHttp = new XMLHttpRequest(); bMozilla = true;
    }
    else
    {
        //http request not supported
        //alert("The XMLHttpRequest nor ActiveXObject object could not be created.");
    }
    
    //prevent caching
    if (urlquery.indexOf("?") > -1) 
    urlquery += "&"; 
    else urlquery += "?";
    urlquery += "timestamp=" + new Date().getTime();
                    
    //handle server response
    ajaxHttp.onreadystatechange = function() {
        if (ajaxHttp.readyState == 4) {
            if (ajaxHttp.status == 200) //response OK
            {
                //set response text by elementname
                if (elementname != "") document.getElementById(elementname).innerHTML = ajaxHttp.responseText;

                //set response text by handlername
                if (handlername != "") eval(handlername + "(ajaxHttp.responseText)");
            }
        }
    }
    
    // open
    ajaxHttp.open("GET", urlquery, true); //asynchronous
    ajaxHttp.send(null); // send
}



