// <![CDATA]

// VARIABLES
	var bHighlightSubmenu = true;
	var pageURL = (document.URL.indexOf('#')==-1) ? document.URL : document.URL.substring(0,document.URL.indexOf('#'));

// METHODS
	function showmenu(x) {
		var sm = document.getElementById('submenu_'+x);
		if (sm.style.display=='none') {
			document.getElementById(x+'_btn').src = 'media/images/navigation/'+x+'_down.gif';
			document.getElementById(x+'_arw').src = 'media/images/navigation/'+x+'_down-rt.gif';
			sm.style.display='';
		} else {
			sm.style.display='none';
			document.getElementById(x+'_btn').src = 'media/images/navigation/'+x+'_up.gif';
			document.getElementById(x+'_arw').src = 'media/images/navigation/'+x+'_up-rt.gif';
		}
	}

// PROCESSOR

	// -- if menu variable wasn't hardcoded into the parent page, 
	// -- then we need to extract it from the URL
	if ((typeof menu)=='undefined') {
		var menu = '';
		var fileName = pageURL.substring(pageURL.lastIndexOf('/')+1);
		if (fileName.indexOf('-')>0) { menu = fileName.substring(0,fileName.indexOf('-')); }
		else						 { menu = fileName.substring(0,fileName.indexOf('.')); bHighlightSubmenu=false; }
	}
	
	// -- utilize the var:submenu from the web page to highlight a specific submenu link
	// -- primarily used by pages that are 3rd tier or deeper
	var submenuURL = ((typeof submenu)!='undefined') ? menu+'-'+submenu+'.php' : '^';

	// -- if not on the homepage, highlight submenu link and display the menu
	if (menu!='index')  {
		if (bHighlightSubmenu) {
			links = document.getElementById('submenu_'+menu).getElementsByTagName('a')
			if (links) {
				for(i=0;i<links.length;i++) {
					if ((links[i].href.indexOf(pageURL)>-1) || (links[i].href.indexOf(submenuURL)>-1) ){ 
						links[i].className=menu; 
						i=links.length;
					}
				} //.. for loop
			} //.. links exist
		} //.. show menu
		
		showmenu(menu);

	} //.. menu was selected

// ]]>