﻿function Browser() {
    var ua, s, i;
    this.isIE = false;
    this.isNS = false;
    this.version = null;
    ua = navigator.userAgent;
    s = "MSIE";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isIE = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }

    s = "Netscape6/";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isNS = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }

    // Treat any other "Gecko" browser as NS 6.1.
    s = "Gecko";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isNS = true;
        this.version = 6.1;
        return;
    }
}
var browser = new Browser();
var clockTimeoutID;








//Global Variables
var XmlHttp;
function CreateXmlHttp1() {
    //Creating object of XMLHTTP in IE
    try {
        XmlHttp = new ActiveXObject("Msxml2.XmlHttp");
    }
    catch (e) {
        try {
            XmlHttp = new ActiveXObject("Microsoft.XmlHttp");
        }
        catch (oc) {
            XmlHttp = null;
        }
    }
    //Creating object of XMLHTTP in Mozilla and Safari 
    if (!XmlHttp && typeof XMLHttpRequest != "undefined") {
        XmlHttp = new XMLHttpRequest();
    }
}

var XmlHttp2;
function CreateXmlHttp2() {
    //Creating object of XMLHTTP in IE
    try {
        XmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
        try {
            XmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (oc) {
            XmlHttp2 = null;
        }
    }
    //Creating object of XMLHTTP in Mozilla and Safari 
    if (!XmlHttp2 && typeof XMLHttpRequest != "undefined") {
        XmlHttp2 = new XMLHttpRequest();
    }
}



//For Market commentry
function getMarketNews1(subsecid) {
    
    CreateXmlHttp1();
    // document.body.style.cursor = "progress";
    var MktCom = document.getElementById("Mkt_Commentary1_MarketNews");
    MktCom.innerHTML = "<img src=../images/ajax-loader.gif>";
    var requestUrl = "/clientside/GetMktCommentary.aspx?subsecid=" + subsecid + "&IpTrack=" + window.location.hostname + "&timeStamp=" + new Date().getTime();
   
    if (XmlHttp) {
        XmlHttp.onreadystatechange = function() { getNewsData1(MktCom); };
        XmlHttp.open("GET", requestUrl, true);
        XmlHttp.send(null);

    }
}

function getNewsData1(id) {

    if (XmlHttp.readyState == 4) {

        if (XmlHttp.status == 200) {
            id.innerHTML = XmlHttp.responseText;
        }
        //document.body.style.cursor = "normal";
    }

}
