/**
	Get object (For current browser)
**/
function fnGetObj(elementId){
	if (document.getElementById){
		this.obj = document.getElementById(elementId);
	}
	else if (document.all){
		this.obj = document.all[elementId];
	}
	else if (document.layers){
		this.obj = document.layers[elementId];
	}
}
			
/**
	Gets the prefix of a filename to determine the submenu level
**/
function fnGetFilePrefix(p_sUrl) {
	sUrl = p_sUrl;
	
	nUrlLength = sUrl.Length;
	nLastSlashInUrl = sUrl.lastIndexOf('\/');

	sFilename = sUrl.substring(nLastSlashInUrl + 1, nUrlLength);
	sFilePrefix = sFilename.substring(0, 3);
	
	return sFilePrefix;
}

/**
	Walk through all the links in the submenu and compare the href attribute of the element with the URL.
	In case of a match, change the color style to the defined (in the header of this script) color
**/
function fnSetSubmenuColor() {
	sActiveLinkColor = "#FFFFFF";
	sSubMenuParentElementId = "left_Submenu";
	
	objSubmenu = new fnGetObj(sSubMenuParentElementId);
	objSubmenu = objSubmenu.obj;
	
	nSubmenuItems = objSubmenu.firstChild.childNodes.length;			//[submenu DIV]  /  [firstChild = UL]  / [childNodes = LI elements]
	aSubmenuItems = new Array();
	
	for (i = 0; i < nSubmenuItems; i++) {
		aSubmenuItems[i] = objSubmenu.firstChild.childNodes[i].firstChild;
		
		if (fnGetFilePrefix(aSubmenuItems[i].href) == fnGetFilePrefix(location.href)) {
			aSubmenuItems[i].style.color = sActiveLinkColor;
		}
	}
}
