startList = function() {
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") {
  node.onmouseover=function() {
  this.className+=" over";
    }
  node.onmouseout=function() {
  this.className=this.className.replace
      (" over", "");
   }
   }
  }
 }
}
window.onload=startList;

// Confirmation dialog
function confirmation(url, message)
{
    if (window.confirm(message)) {
        document.location = url;
    }
}

function showOrHideMailingInputs() 
{    
    if(document.getElementById('newslettercheckbox').checked == true) {
        document.getElementById('firstName').parentNode.parentNode.style.display = '';
        document.getElementById('lastName').parentNode.parentNode.style.display = '';          
    } else {        
        document.getElementById('firstName').parentNode.parentNode.style.display = 'none';
        document.getElementById('lastName').parentNode.parentNode.style.display = 'none';
    }
}

function highlightRow(rowid, thetype)
	{
		if (thetype == 'Delivery')
			{
				
				document.getElementById('delime').value = rowid;
			}
		if (thetype == 'Billing')
			{
				
				document.getElementById('billme').value = rowid;
			}
		// Clear Rows
		var table = document.getElementById("tableBodyMain"); 
		var rows = table.getElementsByTagName("tr");
		for (var i = 0; i < rows.length; i++) { 
			rows[i].style.background = "";
		}
		// HighlightRows
		var myBill = document.getElementById('delime').value;
		var myDeli = document.getElementById('billme').value;
		
		
		document.getElementById('lineup' + myBill).style.background = "#E9E8F7";
		document.getElementById('lineup' + myDeli).style.background = "#E9E8F7";
	}
/*
function highlightRow(rowid, type)
	{
		// Highlight Row
		var table = document.getElementById("tableBodyMain"); 
		var rows = table.getElementsByTagName("tr"); 
		var toggler;
		var myputs;
		
		for (var i = 0; i < rows.length; i++) { 
			
			if (type == "Delivery")
				{
						if (rows[i].getAttribute('id') == rowid)
							{
								rows[i].style.background = "#E9E8F7";
							}
				}
			if (type == "Billing")
				{
						if (rows[i].getAttribute('id') == rowid)
							{
								rows[i].style.background = "#D6EBDA";
							}										
				}
			
			myputs = rows.getElementsByTagName('input');
			toggler = "no";
			alert(myputs.length);
			for (var x = 0; x < myputs.length; x++) 
				{
					if (myputs[i].checked == true) { toggler = "yes"; alert('found one');}
				}
		//	if (toggler == "no") { rows[i].style.background = ""; }

			
		} // end Row Loop

	
	}
	
*/



// Used in all pages to submit a form and optionally set a hidden 
// form varaible called 'navigate' to direct navgiation
function submitForm(formName, navigateValue) {
	if (navigateValue != null && navigateValue != "") {
		document.forms[formName].navigate.value = navigateValue;
	}
    document.forms[formName].submit();
}
