// function ltNavMenuHighlite()
// Description: It is used to Highlight the current page link in the Left menu

function menuHighlight() {
	if(document.getElementById("navLinks") && (leftNavHighlight))
	{
		ltNavMenuHighlite();
	}
	//Calling Right nav menu Highlight - Currently being implimented through Server Side Logic 
	/*if(document.getElementById("rightNav"))
	{
		rtNavMenuHighlite();
	}*/

}

function ltNavMenuHighlite(){
		
			//Extracting page name from the "leftNavHighlight" variable and then using Split to identify current page
			
			var hightlightText=(leftNavHighlight.toLowerCase()).replace(/ /g,"-");
			var theseperator;
			var specialChars=new Array("#", "\\*", "~", "\\>", "\\<", "%", "^", "\\?", "$");
			
			if(hightlightText.indexOf('+')>0){
				theseperator="+"
			}
			/* Commented out.Single \ terminated the string. So another \ is used as an escape sequence char. Thus if used it will have to be "\\"
				else if(hightlightText.indexOf('\\')>0){
				theseperator="\\"				
			}
			*/
			
			leftNavId=hightlightText.split(theseperator);
			// Search in the Left Nav Menu Table(id - navLinks) for all link tags.
			anchors=document.getElementById("navLinks").getElementsByTagName("a");		
			
			//Removing special characters from id. 
			for(spchar=0;spchar<specialChars.length;spchar++){
				//alert(specialChars[spchar]);
				for(ancLen=0;ancLen< anchors.length; ancLen++){
				//Switch the anchor id's to lower case.					
					anchors[ancLen].id=(anchors[ancLen].id).replace(eval("/" + specialChars[spchar] + "/g"),"");
				}
			}
			
			for(lnid=0;lnid<leftNavId.length;lnid++){
				if(document.getElementById(leftNavId[lnid])!=null)
				{
				for(ancLen=0;ancLen< anchors.length; ancLen++)
				{
				//Swicth the anchor id's to lower case.
				anchors[ancLen].id=(anchors[ancLen].id).toLowerCase();
				// If Left Menu Link exists then set the style for the menu to be Bold	using class selected
					if(document.getElementById(leftNavId[lnid]).id==anchors[ancLen].id){
							
					anchors[ancLen].className="selected";	
					}
				}
			}			
			}	
			
		}


//Right nav menu Highlight - Currently being implimented through Server Side Logic 
/*
	// function rtNavMenuHighlite()
	// Description: It is used to Highlight the current page link in the Right menu
	function rtNavMenuHighlite(){
		
				//Extracting page title and then using Split to identify current page
				var pageTitle = document.getElementById("pageTitleContainer").getElementsByTagName("span");
				pageTitle=pageTitle[0].id;
				pageTitle=pageTitle.split("_");
				
				// Search in the Right Nav Menu Table(id - rightNav) for all link tags.
				anchors=document.getElementById("rightNav").getElementsByTagName("a");				
				for(i=0;i< anchors.length; i++)
				{
					// If Right Menu Link exists then set the style for the menu to be Bold	using class selectedRightNav
					if(pageTitle[1]==((anchors[i].id).split("_")[1]))
					document.getElementById(anchors[i].id).className="selectedRightNav";
				}

			}
*/

// function arrOnLoad()
// Description: Pushes the menuHighlight in to the array to be executed on pageLoad.
// Author: Sailesh Raghavan
// Dated: April 21, 2006 
if(arrOnLoad){
	arrOnLoad.push("menuHighlight()");
}
