// Detects if the browser supports Ajax
function browserSupportsAjax()
{
    if (typeof XMLHttpRequest == "undefined" && typeof ActiveXObject == "undefined" && window.createRequest == "undefined")
    {
        return false;
    }
    return true
}

// Detects if the browser can use ActiveX if necessary
function ActiveXEnabledOrUnnecessary ()
{
    if (typeof ActiveXObject != "undefined")
    {
        var xhr = null;
        try{
            xhr=new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try{
                xhr=new ActiveXObject("Microsoft.XMLHTTP");
            }catch (e2){
                try{
                    xhr=new ActiveXObject("Msxml2.XMLHTTP.4.0");
                }catch (e3){
                    xhr=null;
                }
            }
        }
        if (xhr == null)
        {
            return false
        }
    }
    return true;
}
// Detects if Ajax is enabled
function AjaxEnabled()
{
    if (browserSupportsAjax() == true) {
        if (ActiveXEnabledOrUnnecessary() == true) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
