﻿function PageTracking(nameOfPage) {
    var XmlHttp;
    XmlHttp = GetXmlHttp();

    if (XmlHttp) {
        if ((XmlHttp.readyState == 4) || (XmlHttp.readyState == 0)) {
            XmlHttp.open('GET', "BrowserCloseTracking.aspx?Page=" + nameOfPage, true);
            XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            XmlHttp.send(null);
        }
    }
}



function GetXmlHttp() {   /*This function is responsible for creating an HttpRequest object  
                based on the browser that the user is currently using. */
    var xmlHttp = null;
    try {   //Mozilla, Opera, Safari etc. 
        xmlHttp = XMLHttpRequest();
    } catch (e) {   //Internet Explorer uses ActiveX objects to make Ajax calls. 
        //the following are valid versions, here we will loop through  
        //the versions and attempt to create the ActiveX that matches the browser. 
        var versionIds = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0",
                         "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0",
                         "Msxml2.XMLHTTP.2.6", "Microsoft.XMLHTTP.1.0",
                         "Microsoft.XMLHTTP.1", "Microsoft.XMLHTTP"];
        for (var i = 0; i < versionIds.length && xmlHttp == null; i++) {
            xmlHttp = CreateXmlHttp(versionIds[i]);
        }
    }
    return xmlHttp;
}




function CreateXmlHttp(id) {   /*Creates an ActiveX object used by Internet Explorer that will make Ajax calls*/
    var xmlHttp = null;
    try {
        xmlHttp = new ActiveXObject(id);
    } catch (e) { }
    return xmlHttp;
} 
  
    
  
  

