﻿// JavaScript Document
function switchGlobalDropDown(itemID){
    var item = document.getElementById(itemID).parentNode;
	var childList = item.getElementsByTagName("ul")[0];
	
	// Set display state
	if (childList.style.display == "none")
	{
		childList.style.display = "block";
		// change drop down arrow item.src = ;
	}
	else
	{
		childList.style.display = "none";
		// change drop down arrow item.src = ;
	}
}

// get the first li of the ul element of class name 'OtherLink'
// and adds style and functions for the drop down list IE5 & 6
startList = function() 
{
    if (document.all && document.getElementsByTagName) {
        navRoots = document.getElementsByTagName("UL");
        for (r=0; r<navRoots.length; r++)
        {
            if(navRoots[r].className == "OtherLinkList"/* || navRoots[r].className == "GlobalDropDownMenu"*/)
            {
                for (i=0; i<navRoots[r].childNodes.length; i++) 
                {
                    node = navRoots[r].childNodes[i];
                    if (node.nodeName=="LI") 
                    {
                        node.onmouseover=function() 
                        {
                            this.className+=" over";
                        }
                        node.onmouseout=function() 
                        {
                            this.className=this.className.replace(" over", "");
                        }
                    }
                }
            }
        }
    }
}

if (parseInt(navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE ") + 5, 3)) < 7)
{
    window.onload=startList;
}

// Quick links function
function showQuickLinks(selectedTab, category)
{
    // Show the correct class of links
    quickLinks = document.getElementById("QuickLinksList")
    for(i=0; i<quickLinks.childNodes.length; i++)
    {
        if(quickLinks.childNodes[i].nodeType == 1)
        {
            if(quickLinks.childNodes[i].className == "ql" + category)
            {
                quickLinks.childNodes[i].style.display = "block";
            }
            else
            {
                quickLinks.childNodes[i].style.display = "none";
            }
        }
    }
    // Show the correct tab divider elements
    quickTabs = document.getElementById("QuickTabs")
    // First, display all the dividers and remove all the selected classes
    for(i=0; i<quickTabs.childNodes.length; i++)
    {
        if(quickTabs.childNodes[i].nodeType == 1)
        {
            quickTabs.childNodes[i].style.display = "block";
            if(quickTabs.childNodes[i].className == "Selected")
            {
                quickTabs.childNodes[i].className = "";
            }
        }
    }
    // Update the class of the selected tab and hide its sibling dividers
    selectedTab.className = "Selected";
    var divider = selectedTab.nextSibling;
    while (divider.nodeType != 1)
    {
        divider = divider.nextSibling;
    }
    divider.style.display = "none";
    divider = selectedTab.previousSibling;
    while (divider.nodeType != 1)
    {
        divider = divider.previousSibling;
    }
    divider.style.display = "none";    
}
