//***************************************************************************
// *                                                                        *
// *      JAVASCRIPT  HIGHLIGHTER FOR NAVIGATION                            *
// *                                                                        * 
//***************************************************************************
 
function extractPageName(hrefString)
{
 var myString = _removehttp(hrefString);
 return myString.toLowerCase();
}


function _removehttp (str) 
{
	re1 = /http:\/\/.*?\//g;
	re2 = /.*(STAGING|(WORKAREA|EDITION)\/[^\/]+)\//;
  var a1= str.replace(re1, "");
  return a1.replace(re2,"");
}

function setActiveMenu(arr, crtPage)
{
	for(var i=0; i < arr.length; i++)
		if(extractPageName(arr[i].href) == crtPage)
		{ 
		    if ((typeof(navFormat) != "undefined") && (navFormat === 'css')) {
		        var myEm = document.createElement('em');
		        var text = document.createTextNode(arr[i].firstChild.data);
		        myEm.appendChild(text);
		        arr[i].replaceChild(myEm, arr[i].firstChild);
			arr[i].className = "selected";
		    } else {
			arr[i].className = "enabled selected";
		    }

		}
}

function setPage()
{
	if(document.location.href) 
		hrefString = document.location.href;
	else
		hrefString = document.location;

	if (document.getElementById("navigation")!=null) 
		setActiveMenu(document.getElementById("navigation").getElementsByTagName("a"), extractPageName(hrefString));

}


