startList = function() {
//if (document.getElementById) {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
	// Make the second level nav work
	var childLIs = node.getElementsByTagName("LI");
	for(z=0; z < childLIs.length; ++z){
		childLIs[z].onmouseover=function(){
			this.className+=" over";
			//dropStep(this);
		}
		childLIs[z].onmouseout=function() {
		  this.className=this.className.replace(" over", "");
		}
	}
	
  node.onmouseover=function() {
	this.className+=" over";
	//dropStep(this);
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

function dropStep(element){
	var currentNode = element;
	while (currentNode.id != "nav"){
		currentNode.className=currentNode.className.replace(" on", "");
		currentNode.className+=" on";
		currentNode = currentNode.parentNode;
		//alert(currentNode.innerHTML);
	}
	document.title="t: "+element.parentNode.parentNode.parentNode.id;
}
function unDropStep(element){
	var currentNode = element;
	while (currentNode.id != "nav"){
		currentNode.className=currentNode.className.replace(" on", "");
		currentNode = currentNode.parentNode;
	}
	document.title="t: "+element.parentNode.parentNode.parentNode.id;
}


window.onload=onLoadNew;

function onLoadNew(){
	startList();
	//resizeShadow();
}

function resizeShadow(){
	var content = document.getElementById("content_placeholder").offsetHeight;
	var navLeft = document.getElementById("navigation_left").offsetHeight;
	var footer = document.getElementById("footer").offsetHeight;
	document.getElementById("content2").style.height = content + "px";
}

//show or hide checkout bubble tips on select fields
function checkoutTip(strTip,strAction,strControl){
	if(strAction == 'hide'){
		document.getElementById(strControl).parentNode.removeChild(document.getElementById("cartTip"));
	}else if(strAction == 'show'){
		var objTips = new Object;
		objTips["promo"] =	"<p>After entering a discount code or free shipping code, the savings amount will appear above the subtotal when you click \"apply.\"</p><p>You can NOT apply Free Standard Shipping codes to other types of shipping.</p>"
		objTips["address1"] = "<p>If paying with credit card, the billing address must match what the credit card company has on file.</p>"
		objTips["zip"] = "<p>If the County/State box appears locked, hit Tab or Enter after completing your Zip Code.</p>"
		objTips["city"] = "<p>Don't see your town or township? Just select \"Other\" and a blank field will appear. Then enter your city or township name.</p>"
		objTips["email1"] = "<p>We need your email address to send you order confirmation and notification of shipment emails.</p>"
		objTips["email2"] = "<p>Please re-enter email address exactly. This will help eliminate typos or inconsistencies.</p>"
		objTips["ccname"] = "<p>Enter name exactly as it appears on the card.</p>"
		objTips["ccnumber"] = "<p>Enter the card number with NO dashes or spaces.</p>"
		
		var divTip = document.createElement("div")
		divTip.id = "cartTip"
		divTip.className = "cart_tip"
		
		var divTipTop = document.createElement("div")
		divTipTop.className = "cart_tip_top"
		divTipTop.innerHTML = "&nbsp;"
		
		var divTipContent = document.createElement("div")
		divTipContent.className = "cart_tip_content"
		divTipContent.innerHTML = "Tip: " + objTips[strTip]

		var divTipBottom = document.createElement("div")
		divTipBottom.className = "cart_tip_bottom"
		divTipBottom.innerHTML = "&nbsp;"
		
		divTip.appendChild(divTipTop)
		divTip.appendChild(divTipContent)
		divTip.appendChild(divTipBottom)
		
		//document.getElementById(strControl).parentNode.appendChild(divTip)
		document.getElementById(strControl).parentNode.insertBefore(divTip,document.getElementById(strControl).nextSibling)
	}
}

function layerWindow(strURL){
	if(document.getElementById("layer_window") == null){
		//Layer Doesn't Exist - Create
		divLayer = document.createElement("div");
		divLayer.id = "layer_window";

		aClose = document.createElement("a");
		aClose.innerHTML = "&nbsp;";
		aClose.onclick = function(){
			document.body.removeChild(document.getElementById("layer_window"));
		}

		ifContent = document.createElement("iframe");
		ifContent.id = "ilayer_content";
		ifContent.src = strURL.indexOf("master=nothing") > 0 ? strURL.replace("master=nothing","master=blank") : strURL + "?master=blank";
		
		divBG = document.createElement("div");
		divBG.id = "layer_bg";
		
		divContent = document.createElement("div");
		divContent.id = "layer_content";
		divContent.appendChild(aClose);
		divContent.appendChild(ifContent);
		
		divLayer.appendChild(divContent);
		divLayer.appendChild(divBG);
		
		document.body.appendChild(divLayer);
		
		divLayer.style.left = (document.body.offsetWidth - divLayer.offsetWidth) / 2 + "px";
		divLayer.style.top = (document.getElementById("content").offsetHeight - divLayer.offsetHeight) / 2 + "px";
	}else{
		//Layer Already Exists - New iFrame src?
		var objFrame = document.getElementById("ilayer_content");
		if(objFrame != null && objFrame.src.indexOf(strURL) < 0){
			objFrame.src = strURL.indexOf("master=nothing") > 0 ? strURL.replace("master=nothing","master=blank") : strURL + "?master=blank";
		}
	}
}