/*
* Asynchronous HTML AND HTTP (AHAH library)
* Author: Griffith Tchen Pan
* Created: 12-Nov-2008
* License: Free at your own risk
*/


function getXMLHTTPreq()
{
    try {
    req = new XMLHttpRequest(); /* Firefox */
    } catch (e){
        try{
        req = new ActiveXObject("Msxml2.XMLHTTP");  /* previous versions of IE7 */
        } catch (e) {
            try {
            req = new ActiveXObject("Microsoft.XMLHTTP"); /* IE7+ */
            } catch (err) {
                req = false;
            }
        }
    }
    return req;
}

var http = getXMLHTTPreq();
function responseAHAH(pageElement)
{
    var output = '';
    if(http.readyState == 4){
        if(http.status == 200){
            output = http.responseText;
            document.getElementById(pageElement).innerHTML = output;
        }
    }
}


/* call this AHAH function for dynamic html content display*/
function callAHAH(url, pageElement, LoadingMessage)
{
    document.getElementById(pageElement).innerHTML = LoadingMessage;
    http.onreadystatechange
        = function(){responseAHAH(pageElement);};
    http.open("GET", url, true);
    http.send(null);
    
}

