//helper function for AJAX
var result;
var xmlhttp;

function GetXmlHttp()
{
    var x = null;
    try
    {
        x = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            x = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {
            x = null;
        }            
    }
    if (!x && typeof XMLHttpRequest != "undefined")
    {
        x = new XMLHttpRequest();            
    }
    return x;
}


//call the AJAX query.
function DoAjaxQuery()
{
//Expects to find a variable called url that contains the url to return
    xmlhttp = GetXmlHttp();

    //If we have a valid xmlhttp object
    if (xmlhttp)
    {
//alert(url);
        xmlhttp.open("GET", url, true); // varAsync = true;
        
        //Set the callback.  This function is called when we 
        xmlhttp.onreadystatechange = function()
        {
            if (xmlhttp.readyState == 4)  //4 is a success
            {
                //Server code creates javascript "on the fly" for us to
                //execute using eval()
                result = xmlhttp.responseText;
               	eval(result);
               
            }
        }
        xmlhttp.send(null);
    }
}

//call the AJAX query.
function SendXmlHttpRequest(url, callback)
{
    xmlhttp = GetXmlHttp();
    if (xmlhttp)
    {
        xmlhttp.open("GET", url, true); 
        xmlhttp.onreadystatechange = callback;
        xmlhttp.send(null);
    }
}

function SendPostXmlHttpRequest(url, callback, postData)
{
    xmlhttp = GetXmlHttp();
    if (xmlhttp)
    {
        xmlhttp.open("POST", url, true); 
        xmlhttp.onreadystatechange = callback;
        xmlhttp.send(postData);
    }
}
function GetQueryStringItem()
    {
        hu = window.location.search.substring(1);
        gy = hu.split("&");
        ft = gy[0].split("=");
        return ft[1];
    }

