// JavaScript Document
if(isNaN(navl2Links)) var navl2Links=0;/*set navl2Links, if it is not already */
var timeouts=0;
var resetTime = 4000; //time, in ms before nav resets to defaultLinks
var defaultLinks;//stores node of default links (what navl2Links refers to)
var currentlyShowing;//remember what is currently showing
var unlCookies = document.cookie;
var dcolor;
var navl2UL;
if(unlCookies.indexOf("contrast=high") != -1) dcolor = "#000000";
else dcolor="#666666";
function showNav()
{
	var navl2;
	var anchors;
	clearTimeout(timeouts);
	if (!checkIt('safari')) resetl1Color();
	navl2 = this.getElementsByTagName('ul');
	anchors = this.getElementsByTagName('a');
	if (!checkIt('safari')) anchors[0].style.color ='#CC0000';
	if((navl2.item(0) != currentlyShowing))
	{
		hideNode(currentlyShowing);
		showNode(navl2.item(0));
	}
}
function resetl1Color() {
	var anchors;
	for (var i = 0; i < elements.length; i++) {
		anchors = elements.item(i).getElementsByTagName('a');
		anchors[0].style.color = dcolor;
	}
}
function navMouseOut()
{
	clearTimeout(timeouts);
	timeouts = setTimeout('showDefault()',resetTime);
}
function showDefault()
{
	if(currentlyShowing != defaultLinks)
	{
		if (!checkIt('safari')) resetl1Color();
		hideNode(currentlyShowing);
		showNode(defaultLinks);
	}
}
function hideNode(node)
{
	if(node)
	{
		node.style.display="none";
		node.style.visibility="hidden";
	}
}
function showNode(node)
{
	if(node)
	{
		currentlyShowing = node;
		node.style.display="block";
		node.style.visibility="visible";
	}
}
function checkIt(string)
{
		var place;
        place = detect.indexOf(string) + 1;
        thestring = string;
        return place;
}
try {
	var detect = navigator.userAgent.toLowerCase();
	var OS,browser,version,total,thestring;
	var i;
	//Select the #navlinks content
	var elements = document.getElementById('navlinks').childNodes;
	//Remove any unneccessary nodes, leaving only the unordered list
	while(document.getElementById('navlinks').firstChild.nodeType != 1) {
		document.getElementById('navlinks').removeChild(document.getElementById('navlinks').firstChild);
	}
	//Now select the real #navlink unordered list
	elements = document.getElementById('navlinks').firstChild.childNodes;
	//Remove any empty child text nodes, so we're left with the list elements
	for (i = 0; i < elements.length; i++) {
		if(!elements.item(i).hasChildNodes())
			document.getElementById('navlinks').firstChild.removeChild(elements.item(i));
	}
	//Set the mouseover mouseout functions for them
	for (i = 0; i < elements.length; i++) {
		elements.item(i).onmouseover = showNav;
		elements.item(i).onmouseout = navMouseOut;
	}
	//Now set the default navline2 links to display (navl2Links).
	navl2UL = elements.item(navl2Links).getElementsByTagName('ul');
	defaultLinks = navl2UL.item(0);
	if(defaultLinks) showNode(defaultLinks);
} catch(error) { }
