eval($import("../../static/js_p_sys/xml.js"));

function showSub(id) {

    var obj = document.getElementById(id);
    obj.style.display = '';
    document.getElementById('link').style.display = "none";
    if (getIEVersion() == '7.0') {
        obj.style.height = 32;
    }
    if (getIEVersion() == '8.0') {
        obj.style.height = 32;
        if (document.documentMode == 8) // IE8 document mode
        {
            obj.style.height = 33 + 'px';
            obj.style.marginTop = -13;
        }
    }
    if (getIEVersion() == undefined) {
        obj.style.height = 34 + 'px';

    }
    
}
function hideSub(id) {
    var obj = document.getElementById(id);
    obj.style.display = 'none';
    document.getElementById('link').style.display = "";

    if (getIEVersion() == '6.0') {
        document.getElementById('link').style.height = 18;
    }
    if (getIEVersion() == '7.0') {
        document.getElementById('link').style.height = 14;
    }
    if (getIEVersion() == '8.0') {

        document.getElementById('link').style.height = 14;
    }
    if (getIEVersion() == undefined) {

        document.getElementById('link').style.height = 16 + 'px';

    }
}
function initSpec() {

    initMenuN();
    if (getIEVersion() == '6.0') {
        document.getElementById('link').style.height = 18;
        document.getElementById('spea').style.width = 875;
    }
    else if (getIEVersion() == '7.0') {
        document.getElementById('link').style.height = 14;
        document.getElementById('spea').style.width = 878;
    }
    else if (getIEVersion() == '8.0') {
        document.getElementById('link').style.height = 14;
        document.getElementById('spea').style.width = 878;
    }
    else if (getIEVersion() == undefined) {
    document.getElementById('link').style.height = 16 + 'px';
       // document.getElementById('link').style.height = 29 + "px";
        document.getElementById('spea').style.width = 878 + 'px';
    }
    else {
        document.getElementById('spea').style.width = 878 + 'px';
    }

}
function getIEVersion() {
    if (navigator.appName == "Microsoft Internet Explorer") {
        var str = navigator.appVersion;
        str = str.split('MSIE ')[1].split(';');
        var ver = str[0] + "";
        return ver;
    }
}


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (document.body.filters)) {
        for (var j = 0; j < document.images.length; j++) {
            var img = document.images[j]
            var imgName = img.src.toUpperCase()
            if (imgName.substring(imgName.length - 8, imgName.length) == 'BT-1.PNG') {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText
                if (img.align == "left") imgStyle = "float:left;" + imgStyle
                if (img.align == "right") imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                img.outerHTML = strNewHTML
                j = j - 1
            }
        }
    }
	var divObj = document.getElementById("link");
	var divTags = divObj.getElementsByTagName("div");
	divTags[2].getElementsByTagName("a")[1].style.color = "Blue";
}


var initMenuN = function() {
    var menuConfig = "../../common/xml/Menu_en_lev3.xml";
    var menuXslt = "../../common/xslt/Menu_lev3.xslt";
    var xlm = new xmlMaster()
    var result = "";
    //alert(result);
    //debugger;
    
    if (document.implementation && document.implementation.createDocument) {

        try {
            xmlDoc = document.implementation.createDocument("", "", null);
            xmlDoc.async = false;
            xmlDoc.load(menuConfig);
        }
        catch (e) {
            var xmlhttp = new window.XMLHttpRequest();
            xmlhttp.open("GET", menuConfig, false);
            xmlhttp.send(null);
            xmlDoc = xmlhttp.responseXML.documentElement;
        }
        try {
            xslDoc = document.implementation.createDocument("", "", null);
            xslDoc.async = false;
            xslDoc.load(menuXslt);
        }
        catch (e) {
            var xmlhttp = new window.XMLHttpRequest();
            xmlhttp.open("GET", menuXslt, false);
            xmlhttp.send(null);
            xslDoc = xmlhttp.responseXML.documentElement;
        }
        try {

            var xsltProcessor = new XSLTProcessor();
            xsltProcessor.importStylesheet(xslDoc);
            result = xsltProcessor.transformToFragment(xmlDoc, document);
            $("MenuReplace").innerHTML = "";
            $("MenuReplace").appendChild(result);
        }
        catch (e) {
            alert("error:003");
        }
    }
    else if (typeof window.ActiveXObject != 'undefined') {
        result = xlm.trans(menuConfig, menuXslt, true, true, false);
        $("MenuReplace").innerHTML = result;
    }
    else {
        alert("Browser unknown!");
    }
}

//intitial the second level right banner content 
var initRightBanner = function() {
    var menuConfig = "../../RightBanner/banner_third_level.xml";
    var menuXslt = "../../RightBanner/rightBanner.xslt";
    var xlm = new xmlMaster()
    var result = "";
    if (document.implementation && document.implementation.createDocument) {
        try {
            xmlDoc = document.implementation.createDocument("", "", null);
            xmlDoc.async = false;
            xmlDoc.load(menuConfig);
        }
        catch (e) {
            var xmlhttp = new window.XMLHttpRequest();
            xmlhttp.open("GET", menuConfig, false);
            xmlhttp.send(null);
            xmlDoc = xmlhttp.responseXML.documentElement;
        }
        try {
            xslDoc = document.implementation.createDocument("", "", null);
            xslDoc.async = false;
            xslDoc.load(menuXslt);
        }
        catch (e) {
            var xmlhttp = new window.XMLHttpRequest();
            xmlhttp.open("GET", menuXslt, false);
            xmlhttp.send(null);
            xslDoc = xmlhttp.responseXML.documentElement;
        }
        try {

            var xsltProcessor = new XSLTProcessor();
            xsltProcessor.importStylesheet(xslDoc);
            result = xsltProcessor.transformToFragment(xmlDoc, document);
            $("container2").innerHTML = "";
            $("container2").appendChild(result);
        }
        catch (e) {
            alert("error:003");
        }
    }
    else if (typeof window.ActiveXObject != 'undefined') {

        var xlm = new xmlMaster()

        result = xlm.trans(menuConfig, menuXslt, true, true, false);
        if (result == null) {
            result = xlm.trans(menuConfig, menuXslt, true, true, false);
        }
        $("container2").innerHTML = result;
    }
    else {
        alert("Browser unknown!");
    }
}


if (window.ActiveXObject) {
    window.attachEvent('onload', correctPNG);
} //Firefox, Mozilla, Opera, etc. 
else if (document.implementation && document.implementation.createDocument) {
    window.addEventListener("load", correctPNG, false);
}