// JavaScript Document

function RegisterNavOn(){
	var args = RegisterNavOn.arguments;
	
	var ul = document.getElementById('MenuBar1');
	if(!ul){ return; }
	var li_list;
	var li;
	var liName = "li";
	
	for(arg = 0; arg < args.length; arg++ ){
		var li_list = ul.childNodes;
		if(!li_list){ return; }
		
		var childCount = 0;
		for(liCount = 0; liCount < li_list.length; liCount++){
			if(li_list[liCount].nodeName && li_list[liCount].nodeName.toLowerCase() == "li"){
				childCount++;
				if(childCount == args[arg]){
					for(aCount = 0; aCount < li_list[liCount].childNodes.length; aCount++){
						if(li_list[liCount].childNodes[aCount].nodeName && li_list[liCount].childNodes[aCount].nodeName.toLowerCase() == "a"){
							li_list[liCount].childNodes[aCount].className += li_list[liCount].childNodes[aCount].className?' navOn':'navOn';
						}
					}
					
					li = li_list[liCount];
					if(!li) { return; }
					var foundNextGeneration = false;
					for(ulCount = 0; ulCount < li.childNodes.length; ulCount++){
						if(li.childNodes[ulCount].nodeName && li.childNodes[ulCount].nodeName.toLowerCase() == "ul"){
							ul = li.childNodes[ulCount];
							foundNextGeneration = true;
							break;
						}
					}
					if(!foundNextGeneration) { return; }
					break;
				}
			}
		}		
	}
}

function RegisterNavOnById(liId){
	if(document.getElementById(liId) != null){
		RegisterNavOnByLiNode(document.getElementById(liId));
	}
	return;
}

function RegisterNavOnByLiNode(liNode){
	for(aCount = 0; aCount < liNode.childNodes.length; aCount++){
		if(liNode.childNodes[aCount].nodeName && liNode.childNodes[aCount].nodeName.toLowerCase() == "a"){
			liNode.childNodes[aCount].className += liNode.childNodes[aCount].className ? ' navOn' : 'navOn';
		}
	}
	if(liNode.parentNode.parentNode.nodeName.toLowerCase() == "li") {
		RegisterNavOnByLiNode(liNode.parentNode.parentNode);
	}
}