// JavaScript Document

/* Loops over LI's in the nav bar, setting the "urhere" class on whichever LI's id
matches the className in ul_mainMenu (populated dynamically via CF) */
function initURHere() {
	if (!document.getElementById) return;
	urhereID = document.getElementById("ul_mainMenu");
	if (!urhereID || !urhereID.className.length) return;
	//alert('still here');
	var mnItms = document.getElementById("ul_mainMenu").getElementsByTagName("LI");
	for (var i=0; i<mnItms.length; i++) {
		if (mnItms[i].id.length && mnItms[i].id == urhereID.className) {
			mnItms[i].className+=" urhere";
		}
	}
}

sfHover = function() {
	var sfEls = document.getElementById("ul_mainMenu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			/* Above doesn't work for IE 6. The following does. */
			x = this.getElementsByTagName("UL");
			if (x.length > 0) x[0].style['display'] = 'block';
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			/* Above doesn't work for IE 6. The following does. */
			x = this.getElementsByTagName("UL");
			if (x.length > 0) x[0].style['display'] = 'none';
		}
	}
}

/* The followuing works for IE AND Firefox */
window.onload = function() { 
	initURHere();
}

/* The following only appears to run in IE (and only needs to run in IE) */
if (window.attachEvent) window.attachEvent("onload", sfHover);


