/* 	nav.js - Gives a specified nav item the class name "current".
------------------------------------------------------------------------
	Usage
------------------------------------------------------------------------
   	
   	Each nav item must have the prefix "nav_" followed by a unique name:

		<li id="nav_home">
			<a href="#">home</a>
		</li>
   	
   	Add the onload function to the body element and reference the unique part of the nav id.
   	
		<body onload="highlight('home')">
   	
------------------------------------------------------------------------*/



function highlight(navid) {
	if(document.getElementById){
	// Highlight the nav item for this page
	document.getElementById( 'nav_' + navid ).className = 'current';
	return;
	}
}


/* 	IE hover function for drop down nav
------------------------------------------------------------------------*/

sfHover = function() {
	var sfEls = document.getElementById("primaryNav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			if (this.firstChild.className=="hideLeft") {
				hideSelects('leftSelects', 'hidden');
			}
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			if (this.firstChild.className=="hideLeft") {
				hideSelects('leftSelects', 'visible');
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/* 	hide selects on page
------------------------------------------------------------------------*/		
function hideSelects(formid,action) {
	//possible values for action are 'hidden' and 'visible'
	if (action!='visible'){action='hidden';}
	//iterate through form elements
	jeff = document.getElementById(formid);
	for (var R = 0; R < jeff.length; R++) {
		//check if select element
		if (jeff.elements[R].options) {
			jeff.elements[R].style.visibility = action;
		}
	}
	
}

