﻿
var loadingHtml = "<div class=\"loadImg\"><img src=\"Parametric/images/moreLoader.gif\" alt=\"Loading...\" border=\"0\"></div>";
var subMenuHiddenHtml = "<div class=\"loadImg\"><img style=\"display:none\" src=\"Parametric/images/moreLoader.gif\" alt=\"Loading...\" border=\"0\"></div>";

var xmlhttp;

function InitXmlHttpRequest() {

    xmlhttp = null;
    if (window.XMLHttpRequest) {
        // code for all new browsers
        xmlhttp = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        // code for IE5 and IE6
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
}

function crossfilter(url) {
    window.location.href = url;

    //document.getElementById(strDivName).style.display = "block";
}

function downmenu() {
    //window.location.hash = '#bottom';
}

function ShowSubMenu(strDivName) {
    document.getElementById(strDivName).style.visibility = "visible";    
}

function more_mouseover(strDivName) {
    //document.getElementById(strDivName).innerHTML = subMenuHiddenHtml;
    document.getElementById(strDivName).style.visibility = "hidden";
}

function GetAsynchronousData(url, strDivName, chkLoader) {

    //Place Loading HTML
    document.getElementById(strDivName).innerHTML = loadingHtml;
    document.getElementById(strDivName).style.visibility = "visible";
    
    if (chkLoader) {
        if (document.getElementById(strDivName).innerHTML.indexOf('Parametric/images/moreLoader.gif') < 0) {
            return;
        }
    }

    InitXmlHttpRequest();

    var handleStateChanged = function() {
        if (xmlhttp.readyState == 4) {  // 4 = "loaded"
            if (xmlhttp.status == 200) { // 200 = OK
                try {
                    //alert("message from server : " + xmlhttp.responseText);
                    document.getElementById(strDivName).innerHTML = xmlhttp.responseText;
                }
                catch (e) {
                }
            }
            else {
                //alert("Problem retrieving XML data");
            }
        }
    };

    if (xmlhttp != null) {
        xmlhttp.onreadystatechange = handleStateChanged;
        xmlhttp.open("GET", url, true);
        xmlhttp.send(null);
    }
    else {
        //alert("Your browser does not support XMLHTTP.");
    }
}



function GetAsynchronousDataByCategory(url, strDivName, chkLoader) {
    //Place Loading HTML
    document.getElementById(strDivName).innerHTML = loadingHtml;
    document.getElementById(strDivName).style.visibility = "visible";
    
    if (chkLoader) {
        if (document.getElementById(strDivName).innerHTML.indexOf('Parametric/images/moreLoader.gif') < 0) {
            return;
        }
    }
    
    InitXmlHttpRequest();

    var handleStateChanged = function() {
        if (xmlhttp.readyState == 4) {  // 4 = "loaded"
            if (xmlhttp.status == 200) { // 200 = OK
                try {
                    //alert("message from server : " + xmlhttp.responseText);
                    document.getElementById(strDivName).innerHTML = xmlhttp.responseText;
                }
                catch (e) {
                }
            }
            else {
                //alert("Problem retrieving XML data");
            }
        }
    };

    if (xmlhttp != null) {
        xmlhttp.onreadystatechange = handleStateChanged;
        xmlhttp.open("GET", url, true);
        xmlhttp.send(null);
    }
    else {
        //alert("Your browser does not support XMLHTTP.");
    }
}

