function createXMLHttp() {
    if (typeof XMLHttpRequest != "undefined") {
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
      var aVersions = [ "MSXML2.XMLHttp.5.0",
        "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
        "MSXML2.XMLHttp","Microsoft.XMLHttp"
      ];

      for (var i = 0; i < aVersions.length; i++) {
        try {
            var oXmlHttp = new ActiveXObject(aVersions[i]);
            return oXmlHttp;
        } catch (oError) {/*Do nothing*/}
      }
    }
    throw new Error("XMLHttp object could be created.");
}

//Populate an element with the response from a URL (must be within same domain - due to access restrictions)
function ajaxGetContent(elementId, url, append)
{
    var oXmlHttp = createXMLHttp(); //Create a XMLHttp object
    
    oXmlHttp.onreadystatechange = function () //do this when the status changes
    {
        if (oXmlHttp.readyState == 4) //response is complete
        {
            if (append==false) document.getElementById(elementId).innerHTML ="";
            if (oXmlHttp.status == 200) //response status is success
                document.getElementById(elementId).innerHTML +=oXmlHttp.responseText;
            else 
                document.getElementById(elementId).innerHTML += '<b>Error:</b>'+oXmlHttp.status+' ['+oXmlHttp.statusText+']<br /><b>Url:</b>'+url;
        }
    };
    
    oXmlHttp.open("GET", url, true); // open(HTTP_REQUEST_TYPE, URL, ASYNC_REQUEST)
    oXmlHttp.send(null);    
}

//Populate an element with the response from a URL (must be within same domain - due to access restrictions)
function ajaxRun(url)
{
    var oXmlHttp = createXMLHttp(); //Create a XMLHttp object
    
    oXmlHttp.onreadystatechange = function () //do this when the status changes
    {
        if (oXmlHttp.readyState == 4) //response is complete
        {
            if (oXmlHttp.status == 200){ //response status is success
                eval(oXmlHttp.responseText);
				}
            else 
                alert('Error: '+oXmlHttp.status+' ['+oXmlHttp.statusText+']\nUrl: '+url);
        }
    };
    
    oXmlHttp.open("GET", url, true); // open(HTTP_REQUEST_TYPE, URL, ASYNC_REQUEST)
    oXmlHttp.send(null);    
}