//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
var MENU_BGCOLOR = "#339933";
// var MENU_BGCOLOR = "#FF6600";
var MENU_HILIGHT = "#C1F6C1";
var MENU_HILIGHT = "#FFCC99";
var MENU_SELECTED = "#00CC00";
var MENU_SELECTED = "#FF6600";
var MENU_NS_LINKCOLOR = "#333333";
var MENU_SELECTED_CLASSNAME = "topMenuSelected";
var SIDEMENU_ARROW_SRC = "/global/images/nav_side_arrow.gif";
var SIDEMENU_BLANK_SRC = "/global/images/blank.gif";
var BCS_PREFIX = "bcs-";
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// Code that is executed as the JS file loads
//-----------------------------------------------------------------------------
var g_sSection = 'home';
if(document.contextual){
	var d = document;
	d.contextual(d.tags.div, d.tags.div, d.tags.a).color = MENU_NS_LINKCOLOR;
}
with(window.location){
	var sPath = pathname.substr(1);
	var index = sPath.indexOf('/');
	if(index >= 0) {
		g_sSection = sPath.substr(0, index);
	} 
}//end with
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// Rollover code for the side menus (shows the arrow)
//-----------------------------------------------------------------------------
function styleMenus(){
	var a, href;
	if(document.getElementsByTagName){
		a = document.getElementsByTagName("div");
	} else if(document.all){
		a = document.all.tags("div");
	} else if(document.layers){
		a = document.layers;
	} else {
		a = new Array();
	}
	for(var i=0; i<a.length; i++){
		if(!a[i].id.indexOf(BCS_PREFIX)) {
			if(a[i].style){
				a[i].style.backgroundColor = MENU_BGCOLOR;
				//check for current section
				if(g_sSection != 'home' && (a[i].id == (BCS_PREFIX + g_sSection)))
				{
					
					a[i].style.backgroundColor = MENU_SELECTED;

					if(a[i].getElementsByTagName){
						href = a[i].getElementsByTagName("a");
						if(href.length){ 
							href = href[0];
						} else { 
							href = null;
						}
					} else if(a[i].children){
						//pre ie5, i.e. ie4
						href = a[i].children[0];
					} else {
						href = null;
					}
					if(href != null){
						href.className = MENU_SELECTED_CLASSNAME;
					}
				}
			} else {
				a[i].bgColor = MENU_BGCOLOR;
			}//fi
		}//fi
	}//a.length
}
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Rollover code for the side menus (shows the arrow)
//-----------------------------------------------------------------------------
function sideMenuItem_over(sName){
	if(document.images){
		document.images[sName].src = SIDEMENU_ARROW_SRC;
	}
}
	
function sideMenuItem_out(sName){
	if(document.images){
		document.images[sName].src = SIDEMENU_BLANK_SRC;
	}
}
//-----------------------------------------------------------------------------

	
//-----------------------------------------------------------------------------
// Rollover code for the top menu
//-----------------------------------------------------------------------------
function topMenuItem_over(sId){
	if(sId != (BCS_PREFIX + g_sSection) || g_sSection == "home"){
		var o = getStyleObject(sId);
		o.backgroundColor = o.bgColor = MENU_HILIGHT;
	} 
}


function topMenuItem_out(sId){
	if(sId != (BCS_PREFIX + g_sSection) || g_sSection == "home"){
		var o = getStyleObject(sId);
		o.backgroundColor = o.bgColor = MENU_BGCOLOR;
	} 
}
//-----------------------------------------------------------------------------
	
//-----------------------------------------------------------------------------
// Helper functions
//-----------------------------------------------------------------------------
function getStyleObject(sId){
	if(document.getElementById){
		return( document.getElementById(sId).style );
	} else if(document.all){
		return( document.all[sId].style );
	} else {
		return( document.layers[sId] );
	}
}
//-----------------------------------------------------------------------------

