  var menDelay;
  var arrMenus = new Array();
  
  function initPage(){
    var cntMenus = 0;
	mvHtml("catNav","");
	mvHtml("nav","");
	var cntLi = 0;
	var arrTempAs = document.getElementById("nav").getElementsByTagName("a");
    for(i=0;i<arrTempAs.length;i++){ 
	  if(arrTempAs[i].parentNode.getElementsByTagName("ul")[0] != undefined){
	    arrMenus[cntMenus] = arrTempAs[i].parentNode.getElementsByTagName("ul")[0];
	    cntMenus++;
	    arrTempAs[i].onmouseover = function(){
		  hideMenus();
		 
		  var ulX = getLeft(this)-50;
		  var ulY = getTop(this)+75;
		  this.parentNode.getElementsByTagName("ul")[0].style.left = ulX+"px";
		  this.parentNode.getElementsByTagName("ul")[0].style.top = ulY+"px";
		  this.parentNode.getElementsByTagName("ul")[0].style.display = "block";
		  menDelay = setTimeout('hideMenus()', 2000);
	    }
	  }else if(arrTempAs[i].parentNode.tagName.toLowerCase() == 'td'){
	    arrTempAs[i].onmouseover = function(){
		    hideMenus();
	    }
	  }else if(arrTempAs[i].parentNode.tagName.toLowerCase() == 'li'){
		cntLi++;
		arrTempAs[i].onmouseover = function(){
		  clearTimeout(menDelay);
		  menDelay = setTimeout('hideMenus()', 2000);
	    }
	  }
	}
	var liW = Math.floor(648/cntLi);
	for(i=0;i<arrTempAs.length;i++){
		if(arrTempAs[i].parentNode.tagName.toLowerCase() == 'li'){
			arrTempAs[i].parentNode.style.width = liW+"px";
		}
	}
  }

  function hideMenus(){
  	clearTimeout(menDelay);
	for(i=0;i<arrMenus.length;i++){
		arrMenus[i].style.display = "none";
	}
  }
  
  function mvHtml(strId, strHtml){
    if(strHtml.length == 0){
	  strHtml = document.getElementById(strId+"Bot").innerHTML;
	}
	if(strHtml.length == 0){
		document.getElementById(strId).style.display = "none";
	}else{
		document.getElementById(strId+"Bot").innerHTML = "";
		document.getElementById(strId).innerHTML = strHtml;
	}
  }
  
  function getLeft(obj){
	var intLeft = 0;
	if(obj.offsetParent){
	  while(obj.offsetParent){
		intLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	  }
	}else if (obj.x){ 
	  intLeft += obj.x;
	}
	return intLeft;
  }
	
  function getTop(obj){
	var intTop = 0;
	if(obj.offsetParent){
	  while(obj.offsetParent){
		intTop += obj.offsetTop;
		obj = obj.offsetParent;
	  }
	}else{
	  intTop += obj.y;
	}
	return intTop;
  }
  function clearField(strId){
	  document.getElementById(strId).value = "";
	  document.getElementById(strId).style.color = "#000000";
  }
  function chkField(strId){
	if(document.getElementById(strId).value.length == 0){  
	  document.getElementById(strId).style.color = "#999999";
	  if(strId == "Email") {
	    document.getElementById(strId).value = "Email Address";
	  }else if (strId == "Col1"){
		document.getElementById(strId).value = "First Name";  
	  }else if (strId == "Col2"){
		document.getElementById(strId).value = "Last Name";  
	  }
	}
  }