sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		// hide previous siblings background image
		if (sfEls[i].parentNode.id == "nav") {
			// implemented try catch to fix errors on international pages
			try {
				if (sfEls[i].firstChild.id == "selected" && sfEls[i].firstChild.className != "first") {
					var oNode = sfEls[i].previousSibling;
					if (oNode) {
						// Ignore whitespace - Firefox
						while(oNode != null && oNode.nodeType != 1){
							oNode = oNode.previousSibling;
						}
						oNode.firstChild.className = "borderOff";
					}
				}
			} catch (e) { }
		}
		sfEls[i].onmouseover=function() {
			handleLevelOneRoll(this, "on");
			if (window.attachEvent)
			{
				this.className+=" sfhover";
			}
		}
		sfEls[i].onmouseout=function() {
			handleLevelOneRoll(this, "off");
			if (window.attachEvent)
			{
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}

function handleLevelOneRoll(oListElement, sState)
{
	var oLevelOne = oListElement;
	var sBackgroundColor = (sState == "on") ? "#fff" : "";
	
	// hide previous list items background
	if (getAncestry(oLevelOne, 1).id == "nav") {
		var oNode = oLevelOne.previousSibling;
		// Ignore whitespace - Firefox
		while(oNode != null && oNode.nodeType != 1){
			oNode = oNode.previousSibling;
		}
		if (oNode != null) {
			if (sState == "on" && oNode.firstChild.id != "selected") {
				oNode.firstChild.className = "borderOff";
			} else if (oNode.firstChild.id != "selected" && oLevelOne.firstChild.id != "selected") {
				oNode.firstChild.className = "border";
			}
		}		
	}
	
	while (getAncestry(oLevelOne, 1).id != "nav")
	{
		oLevelOne = getAncestry(oLevelOne, 1);
	}
	
	oLevelOne.style.backgroundColor = sBackgroundColor;
}

addEvent(window, "load", sfHover, false);
