// Javascript styles for the sub navigation links on tiresource.com

function hover(listItem) {
	
	if(listItem.className != "active"){
		
		//Loops Thru the LI and finds the DIV node
		var listChildren = listItem.childNodes;
		for( var i=0; i < listChildren.length; i++){
			if(listChildren[i].nodeType == 1 && listChildren[i].tagName.toUpperCase() == "DIV"){
				hoverMid = listChildren[i];
			}
		}
		
		//Loops Thru the DIV and finds the A node
		var divChildren = hoverMid.childNodes;
		for( var i=0; i < divChildren.length; i++){
			if(divChildren[i].nodeType == 1 && divChildren[i].tagName.toUpperCase() == "A"){
				hoverBtm = divChildren[i];
			}
		}
	
		//Top
		listItem.style.backgroundImage = 'url(images/subnav-link-bottom-hover.png)';
		
		//Middle
		hoverMid.style.backgroundImage = "url(images/subnav-link-top-hover.png)";
	
		//Bottom
		hoverBtm.style.backgroundImage = "url(images/subnav-link-bg-hover.png)";
		hoverBtm.style.backgroundRepeat = "no-repeat";
		hoverBtm.style.color = "#fff";
	}
}

function hoverOut(listItem) {
	
	if(listItem.className != "active"){
		
		//Loops Thru the LI and finds the DIV node
		var listChildren = listItem.childNodes;
		for( var i=0; i < listChildren.length; i++){
			if(listChildren[i].nodeType == 1 && listChildren[i].tagName.toUpperCase() == "DIV"){
				hoverMid = listChildren[i];
			}
		}
		
		//Loops Thru the DIV and finds the A node
		var divChildren = hoverMid.childNodes;
		for( var i=0; i < divChildren.length; i++){
			if(divChildren[i].nodeType == 1 && divChildren[i].tagName.toUpperCase() == "A"){
				hoverBtm = divChildren[i];
			}
		}
	
		//Top
		listItem.style.backgroundImage = 'url(images/subnav-link-bottom.png)';
		
		//Middle
		hoverMid.style.backgroundImage = "url(images/subnav-link-top.png)";
	
		//Bottom
		hoverBtm.style.backgroundImage = "url(images/subnav-link-bg.png)";
		hoverBtm.style.backgroundRepeat = "repeat-y";
		hoverBtm.style.color = "#000";
	}
}

function hoverWD(listItem) {
	
	if(listItem.className != "active"){
		
		//Loops Thru the LI and finds the DIV node
		var listChildren = listItem.childNodes;
		for( var i=0; i < listChildren.length; i++){
			if(listChildren[i].nodeType == 1 && listChildren[i].tagName.toUpperCase() == "DIV"){
				hoverMid = listChildren[i];
			}
		}
		
		//Loops Thru the DIV and finds the A node
		var divChildren = hoverMid.childNodes;
		for( var i=0; i < divChildren.length; i++){
			if(divChildren[i].nodeType == 1 && divChildren[i].tagName.toUpperCase() == "A"){
				hoverBtm = divChildren[i];
			}
		}
	
		//Top
		listItem.style.backgroundImage = 'url(images/subnav-link-bottom-hover-wd.png)';
		
		//Middle
		hoverMid.style.backgroundImage = "url(images/subnav-link-top-hover-wd.png)";
	
		//Bottom
		hoverBtm.style.backgroundImage = "url(images/subnav-link-bg-hover-wd.png)";
		hoverBtm.style.backgroundRepeat = "no-repeat";
		hoverBtm.style.color = "#fff";
	}
}

function hoverOutWD(listItem) {
	
	if(listItem.className != "active"){
		
		//Loops Thru the LI and finds the DIV node
		var listChildren = listItem.childNodes;
		for( var i=0; i < listChildren.length; i++){
			if(listChildren[i].nodeType == 1 && listChildren[i].tagName.toUpperCase() == "DIV"){
				hoverMid = listChildren[i];
			}
		}
		
		//Loops Thru the DIV and finds the A node
		var divChildren = hoverMid.childNodes;
		for( var i=0; i < divChildren.length; i++){
			if(divChildren[i].nodeType == 1 && divChildren[i].tagName.toUpperCase() == "A"){
				hoverBtm = divChildren[i];
			}
		}
	
		//Top
		listItem.style.backgroundImage = 'url(images/subnav-link-bottom-wd.png)';
		
		//Middle
		hoverMid.style.backgroundImage = "url(images/subnav-link-top-wd.png)";
	
		//Bottom
		hoverBtm.style.backgroundImage = "url(images/subnav-link-bg-wd.png)";
		hoverBtm.style.backgroundRepeat = "repeat-y";
		hoverBtm.style.color = "#000";
	}
}
