// Ajax Aufruf synchron
function ajax_url_call(url) {
    var xmlHttp = get_httpxmlrequest_object();
    if(xmlHttp){
        doWait(true);
        xmlHttp.open('GET', url, false);
        xmlHttp.send(null);
    }
    doWait(false);
    return xmlHttp;
} // end function ajax_url_call


// Ajax Aufruf-asynchron mit Abfuellung eines DIV-innerHTML
function async_ajax_url_call(url,divID) {
    var xmlHttp = get_httpxmlrequest_object();
    if(xmlHttp){
        doWait(true);
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4) {
            	setInnerHTMLAndExecScript(document.getElementById(divID),xmlHttp.responseText);
            	
            	/*            	
            	document.getElementById(divID).innerHTML = xmlHttp.responseText; */
                doWait(false);
            }
        };
        xmlHttp.send(null);
    }
} // end function ajax_url_call

function setInnerHTMLAndExecScript (element, html) {
	  var newElement = element.cloneNode(false);
	  newElement.innerHTML = html;
	  element.parentNode.replaceChild(newElement, element);
	}



// Ajax funktion
function get_httpxmlrequest_object() {
    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;
} // end function get_httpxmlrequest_object


// Verwandelt den Cursor in eine Sanduhr und wieder zurueck
// je nach dem ob true oder false uebergeben wurde
function doWait(param){
    // Sanduhr
    if(param==true){
        var x = document.getElementsByTagName( "body" )[0];
        x.style.cursor = "wait";
    }
    // Reset
    else{
        var x = document.getElementsByTagName( "body" )[0];
        x.style.cursor = "auto";
    } // end if
} // end function doWait

