
var public_menu_pointer;

function swap(){
	// Hide Existing Sub menu
	//hideAllSubMenu();
	trackId(this.id);
	
   setTimeout("hideAllSubMenu();swapHelper('" + this.id + "');",100);	

//	this.className="msieFix"
}

function trackId (senderId){
	var ctrl =document.getElementById('txtMenuNode');
	if(ctrl!= null){
		ctrl.value = senderId;
	}
}

function swapHelper(senderId){

	var obj = document.getElementById(senderId);
	obj.className = "msieFix"
}

function swapBack(){
  //  this.className="trigger";
  // Set Time Out
  trackId('');
  setTimeout("hideSubMenu('" + this.id + "');",3000);
 // alert(this.id);

}


function displayDefaultMenu(){
	
	var obj = document.getElementById(public_menu_pointer);
	obj.className = "msieFix";
}


function hideAllSubMenu(){

	if (document.getElementById){	
		var LI = document.getElementsByTagName("li");
		var zLI= LI.length;
			for(var k=0;k<zLI;k++){
				if(LI[k].id){
					//hideSubMenu(LI[k].id);
					
					var sender = document.getElementById(LI[k].id);
					if(sender != null){
						sender.className = "trigger";
					}					
					
				}
			}
	}

}

function hideSubMenu(senderId){
	var ctrl =document.getElementById('txtMenuNode');
	var sender = document.getElementById(senderId);

	
	if(sender != null){
		if(ctrl.value ==""){ // only hide when mouse i
			sender.className = "trigger";
			displayDefaultMenu();
		}
	}
	
	
}

function swapfocus() {
	this.parentNode.parentNode.parentNode.className="msieFix"
}
function swapblur() {
	this.parentNode.parentNode.parentNode.className="trigger"
	
}
function TJK_dropDown(){// v1.0 Copyright (c) 2006 TJKDesign - Thierry Koblentz
	if (document.getElementById){
		
//	var mainUl = document.getElementById('TJK_dropDownMenu');
//	mainUl.onmouseout = swapBack;
	
	var LI = document.getElementsByTagName("li");
	var zLI= LI.length;
		for(var k=0;k<zLI;k++){
			if(LI[k].id){
//			LI[k].firstChild.href="#";
			LI[k].className="trigger";
			}
			if(LI[k].parentNode.parentNode.className=="trigger"){LI[k].firstChild.onfocus=swapfocus;LI[k].firstChild.onblur = swapblur}
			if(LI[k].className=="trigger"){LI[k].onmouseover=swap;LI[k].onmouseout=swapBack}
		}
	}

	if(public_menu_pointer != null){
		displayDefaultMenu();
	}
	
}

window.onload=function(){TJK_dropDown();}