hasMoreLinks = function() {
	var header = document.getElementById("header");
	if (!header)
		return;
	
	var objUL = header.getElementsByTagName("UL");
	for (var g=0; g<objUL.length; g++) {
		if (objUL[g].className == "nav") {
			var objLInav = objUL[g].getElementsByTagName("LI");
			for (var h=0; h<objLInav.length; h++) {
				// TODO: add another test - check to see if ieHover class is there or not
				// when a user clicks on the link on the dropdown menu.
				if (new RegExp('\\b'+ 'hasMore' +'\\b').test(objLInav[h].className)) {
					if (objLInav[h].parentNode.className == 'nav') {
						continue;
					} else {
						objLInav[h].childNodes[0].href = "javascript:void(0)";
					}
				}
			}
		}
	}
}
if (window.addEventListener) // DOM method for binding an event
    window.addEventListener("load", hasMoreLinks, false);
else if (window.attachEvent) // IE exclusive method for binding an event
    window.attachEvent("onload", hasMoreLinks);


ieHover = function() {
	// escapes non IE browsers 
	if(1)//@cc_on;/*
		return;
	//@cc_on*/
	var header = document.getElementById("header");
	if (!header)
		return;
	
	var objUL = header.getElementsByTagName("UL");
	for (var g=0; g<objUL.length; g++) {
		if (objUL[g].className == "nav") {
			var objLInav = objUL[g].getElementsByTagName("LI");
			for (var h=0; h<objLInav.length; h++) {
				objLInav[h].onmouseover=function()
				{this.className+=" ieHover";}
				objLInav[h].onmouseout=function()
				{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
			}
		}
	}
	var objLI = document.getElementById("header").getElementsByTagName("LI");
	for (var i=0; i<objLI.length; i++) {
		if (objLI[i].className == "loginMenu" || objLI[i].className == "cartMenu" ) {
			objLI[i].onmouseover=function()
			{this.className+=" ieHover";}
			objLI[i].onmouseout=function()
			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
		}
	}
	var objBUTTON = document.getElementById("header").getElementsByTagName("INPUT");
	for (var j=0; j<objBUTTON.length; j++) {
		objBUTTON[j].onmouseover=function()
		{this.className+=" ieHover";}
		objBUTTON[j].onmouseout=function()
		{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
	}
	var objFTLI = document.getElementById("footer").getElementsByTagName("LI");
	for (var k=0; k<objFTLI.length; k++) {
		if (objFTLI[k].className == "null") {}
		else if (objFTLI[k].className == "hasMore") {
			objFTLI[k].onmouseover=function()
			{this.className+=" ieHover";}
			objFTLI[k].onmouseout=function()
			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
		}
	}

// Comment this out since we are disabling minicart for now
//setTimeout("doTheHoverHackForIE6()",2000);
}
//function doTheHoverHackForIE6() {
//	var objLI = document.getElementById("shopCart").getElementsByTagName("LI");
//	for (var i=0; i<objLI.length; i++) {
//		if (objLI[i].className == "cartMenu") {
//			objLI[i].onmouseover=function()
//			{this.className+=" ieHover";}
//			objLI[i].onmouseout=function()
//			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
//		}
//	}
//}
if (window.addEventListener) // DOM method for binding an event
    window.addEventListener("load", ieHover, false);
else if (window.attachEvent) // IE exclusive method for binding an event
    window.attachEvent("onload", ieHover);


srHover = function() {
	var search = document.getElementById("search");
	if (!search)
		return;
	
	var srEls = search.getElementsByTagName("BUTTON");
	for (var i=0; i<srEls.length; i++) {
		srEls[i].onmouseover=function()
		{this.className+=" srhover";}
		srEls[i].onmouseout=function()
		{this.className=this.className.replace(new RegExp(" srhover\\b"), "");}
	}
}
if (window.attachEvent) window.attachEvent("onload", srHover);



/*  IE psuedo-class hover support */
ieHovers = function() {
	/*  PDP relatedCategorySearch tabs  */
	var objTab = document.getElementById("page").getElementsByTagName("LI");
	for (var i=0; i<objTab.length; i++) {
		if ("relatedCategorySearch" == objTab[i].parentNode.className) {
			objTab[i].onmouseover=function()
			{this.className+=" ieHover";}
			objTab[i].onmouseout=function()
			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
		}
	}
	/*  PDP additionalInfoTabs rollover text */
	var objInfoTab = document.getElementById("page").getElementsByTagName("LI");
	for (var i=0; i<objInfoTab.length; i++) {
		if ("additionalInfoTabs" == objInfoTab[i].parentNode.parentNode.className) {
			objInfoTab[i].onmouseover=function()
			{this.className+=" ieHover";}
			objInfoTab[i].onmouseout=function()
			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
		}
	}
	/*  PDP Add to Cart submit button*/
	var objButton = document.getElementById("page").getElementsByTagName("BUTTON");
	for (var i=0; i<objButton.length; i++) {
		if ("FORM" == objButton[i].parentNode.parentNode.tagName) {
			objButton[i].onmouseover=function()
			{this.className+=" ieHover";}
			objButton[i].onmouseout=function()
			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
		}
	}
	/*  PDPS sort by drop down menu */
	var objSortMenu = document.getElementById("page").getElementsByTagName("UL");
	for (var i=0; i<objSortMenu.length; i++) {
		if ("resultSort" == objSortMenu[i].parentNode.parentNode.parentNode.className) {
			objSortMenu[i].onmouseover=function()
			{this.className+=" ieHover";}
			objSortMenu[i].onmouseout=function()
			{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
			var objSortLabel = objSortMenu[i].getElementsByTagName("LABEL");
			for (var j=0; j<objSortLabel.length; j++) {
				objSortLabel[j].onmouseover=function()
				{this.className+=" ieHover";}
				objSortLabel[j].onmouseout=function()
				{this.className=this.className.replace(new RegExp(" ieHover\\b"), "");}
				objSortInput = objSortLabel[j].firstChild;
				objSortInput.onclick = function () {showLabel(this)};
				
				/*objSortInput.attachEvent("onclick", showLabel);
				 element.addEventListener('click',doSomething,false); */
				
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", ieHovers);

showLabel = function(objThis) {
	var objThisLI;
	var objThisParent = objThis.parentNode;


	while ("UL" != objThisParent.tagName) {
		if ("LI" == objThisParent.tagName) {
			objThisLI = objThisParent;
		}


		objThisParent = objThisParent.parentNode;
	}
	for (var i=0; i<objThisParent.childNodes.length; i++) {
		if (objThisParent.childNodes[i] != objThisLI) {
			objThisParent.childNodes[i].style.display = "none";
		}
	}
}



rsHover = function() {
	if (!document.getElementById("refineSearch"))
		return;
	var rsEls = document.getElementById("refineSearch").getElementsByTagName("LI");
	for (var i=0; i<rsEls.length; i++) {
		rsEls[i].onmouseover=function()
		{this.className+=" rshover";}
		rsEls[i].onmouseout=function()
		{this.className=this.className.replace(new RegExp(" rshover\\b"), "");}
	}
}
if (window.attachEvent) window.attachEvent("onload", rsHover);


alsoLikeOverviewHover = function() {
	 var ovEls = document.getElementById("page").getElementsByTagName("LI");
	 for (i = 0; i < ovEls.length; i++) {	 
		 if(/\boverview\b/.test(ovEls[i].className)) {
			 ovEls[i].onmouseover = function()
			 {this.className += " overviewhover";}
			ovEls[i].onmouseout = function()
			{this.className = this.className.replace(new RegExp(" overviewhover\\b"), "");}
		}
	}
}

accessoriesOverviewHover = function() {
	var divElems = document.getElementsByTagName("div");
	for (i = 0; i < divElems.length; i++) {
		if ("accessories" == divElems[i].className) {
			var liEls = divElems[i].getElementsByTagName("LI");
			for (j = 0; j < liEls.length; j++) {
				if (liEls[j].className == "overview") {
					liEls[j].onmouseover = function()
					{this.className += " overviewhover";}
					liEls[j].onmouseout = function()
					{this.className = this.className.replace(new RegExp(" overviewhover\\b"), "");}
				}
			}
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", alsoLikeOverviewHover);
if (window.attachEvent) window.attachEvent("onload", accessoriesOverviewHover);