﻿// JScript File

function HideProductMenus() {
    return;
    for (i = 1; i <= ParentCount; i++)
    {
        try
        {
            document.getElementById("ProductMenu" + i).style.visibility = "hidden";
            //document.getElementById("ParentMenu" + i).style.backgroundColor = "#FFFFFF";
            document.getElementById("ParentLink" + i).className = "menu-parent-off";
        }
        catch (err)
        {
        }
     }
     
    showhidesearchdivs("visible");
}

function HideSiteLinks1Menus()
{
    for (i = 1; i <= SiteLinks1ParentCount; i++)
    {
        try
        {
            document.getElementById("SiteLinks1SubMenu" + i).style.visibility = "hidden";
            document.getElementById("SiteLinks1ParentMenu" + i).style.backgroundColor = "#FFFFFF";
            document.getElementById("SiteLinks1ParentLink" + i).className = "top-nav";
        }
        catch (err)
        {
        }
     }
     
    showhidesearchdivs("visible");
}

function showover(ID, ParentID, LinkID)
{
    cleartimeouts();
    HideProductMenus();
    HideSiteLinks1Menus();
    document.getElementById(ID).style.visibility = "visible";
    //document.getElementById(ParentID).style.backgroundColor = "#483d8b";
    document.getElementById(LinkID).className = "menu-parent-on";
    
    showhidesearchdivs("hidden");
     
}

function showoversitelinks(ID, ParentID, LinkID)
{       
    HideProductMenus();
    HideSiteLinks1Menus();
    document.getElementById(ID).style.visibility = "visible";
    //document.getElementById(ParentID).style.backgroundColor = "#483d8b";
    document.getElementById(LinkID).className = "sitelink1-parent-on";
    
    showhidesearchdivs("hidden");

}

function hideover()
{
    HideProductMenus();
    HideSiteLinks1Menus();
}

function cleartimeouts()
{
    //clearTimeout(overclose1);
    //for (i = 1; i <= ParentCount; i++)
    //{
    //    eval("clearTimeout(productoverclose" + i + ");");
    //}
    
    for (i = 1; i <= SiteLinks1ParentCount; i++)
    {
        eval("clearTimeout(sitelinkoverclose" + i + ");");
    }
}

function showhidesearchdivs(visibility)
{
    if (Sys.Browser.name == "Microsoft Internet Explorer" && Sys.Browser.version < 7)
    {
         try
         {
            document.getElementById("divSearchPage").style.visibility = visibility;
         }
         catch (err)
         {
         }
         
         try
         {
            document.getElementById("divUARTSearch").style.visibility = visibility;
         }
         catch (err)
         {
         }
         
         try
         {
            document.getElementById("divCrossRefSearch").style.visibility = visibility;
         }
         catch (err)
         {
         }
    }

}

function EndRequestHandler(sender, args) {
//if (args.get_error() == undefined)
    if ($get(PostCallBack).value != "") {
        if (typeof newWidth == "undefined") //if not set by sidemenu
            newWidth = 592; 
        if ($get(PostCallBack).value.indexOf("_") != -1) {
            // if ie6
            if (typeof document.body.style.maxHeight == "undefined") {
                var mp = document.getElementById("ctl00_ContentPlaceHolder1_pnShowAllCols");
                if (mp != null) {
                    mp.childNodes[1].style.top = 15 + document.documentElement.scrollTop + "px";
                    mp.childNodes[1].style.left = (document.body.offsetWidth/2) - 500 + "px";

                    mp.childNodes[2].style.top = 20 + document.documentElement.scrollTop + "px";
                    mp.childNodes[2].style.left = (document.body.offsetWidth/2) - 500 + "px";
                }
            }

            ScrollTableAbsoluteSize(document.getElementById("scrollTable" + $get(PostCallBack).value), 907, 509);
            ScrollTableAbsoluteSize(document.getElementById("scrollTable" + $get(PostCallBack).value.replace("_1", "")), newWidth, 350);
        }
        else {
            ScrollTableAbsoluteSize(document.getElementById("scrollTable" + $get(PostCallBack).value), newWidth, 350);
        }
    }
    //try { alert($get(PostCallBack).value) } catch(err) {};

   //try { ScrollTableAbsoluteSize(document.getElementById("scrollTable" + $get(PostCallBack).value),600,350); } catch(err) { }
//else
   //alert("There was an error" + args.get_error().message);
}

function load() {
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}

function SetCulture(Culture)
{
    WsCulturePreference.SetCulture(Culture, CultureOnSucceeded, CultureOnTimeOut, CultureOnError);
}

function CultureOnSucceeded(Result)
{
    //Reload page
    window.location.reload();
}

function CultureOnTimeOut(Result)
{

}

function CultureOnError(Result)
{

}

function Search(obj)
{
    window.location = "/Search/Search.aspx?Keywords=" + $get(obj).value;
}

function PrintPage(Url)
{
    window.open(Url, "", "width=600, height=500, toolbars=no, resizable=yes, scrollbars=yes");
}
