<!--
//Currently this version supports the left menu bar for only one level
var arr_ddl = new Array();

window.onload = function() {
	// this section of the js script determines what page is being viewed.
	// if the current page is the Investment Banking homepage I need to load
	// the rotating tombstone script.
	// this code can not be loaded from the body tag because it interferes with
	// the rollover code for the nav menu.
	// this code can not be loaded for all pages because the loadbanners() & 
	// urlswitch() code is not contained in any other page besides the IB homepage.
	// - bmajino 08/31/2006
	var dir = location.href.substring(0,location.href.lastIndexOf('/')+1);
	var url = location.href.substring(dir.length,location.href.length+1);

	// get anchors from the document only
	var element_nodes = document.getElementsByTagName("a");
	var table_nodes = document.getElementsByTagName("table");			
	var arr_table = new Array();
	var node, id_string, get_id_no;
	var node_table, table_id_string,node_table_id;
	
	for (var i=0;i<	table_nodes.length; i++){
		node_table = table_nodes[i];
		if (node_table.getAttribute("id")){
			arr_table[arr_table.length] = node_table;
		}
	}
	
	for(var j=0; j < element_nodes.length; j++){
		node = element_nodes[j]; 
		// look for specific IDs for NavCat
		if (node.getAttribute("id") ) {	
			var pos = node.getAttribute("id").indexOf("NavCat_Cat");
			if (pos >=0 ){
				id_string = node.getAttribute("id");
				get_id_no = id_string.substring(pos + 10, id_string.length);			
				
				for (var k=0; k< arr_table.length; k++){
					
					node_table = arr_table[k];
					table_id_string =  node_table.getAttribute("id");
					var str = "NavCat_Sub" + get_id_no;
					if (table_id_string.substring( table_id_string.length - str.length, table_id_string.length) == str)
							node_table_id = node_table.getAttribute("id");
				}
				
				InitMenu(node_table_id, id_string);
				
			}
		}		
	}
}

function search_ddl(){
	// look for dropdownlist boxes
	var ddl_nodes = document.getElementsByTagName("select");
	for (var i=0; i < ddl_nodes.length; i++){
		node = ddl_nodes[i];
			arr_ddl[arr_ddl.length]=node;
			var a = findPosition(node);
			node.top_x=a[0];
			node.top_y=a[1];
	}
}

// create menu
function InitMenu(menuID, parentID) {
	
	var menu = document.getElementById(menuID);
   	var menuParent = document.getElementById(parentID).parentNode.parentNode;
    if (menu == null || menuParent == null) return;

    menuParent.onmouseover = function() {
		this.className="Mouse_In";
		search_ddl();
		this.subMenu();
		
    }
    
	menuParent.onmouseout = function() {		
		this.className="Mouse_Out";
		setMenuInvisible(menu);
	}
	
	menu.onmouseover = function() {
		setMenuVisible(menu);
	}

	menu.onmouseout = function() {
		setMenuInvisible(menu);
	}
	
	menuParent.subMenu = function() {
		menu.style.left = this.parentNode.offsetWidth + "px";
		var b = findPosition(this);
		menu.style.top = b[1] + "px";
		var a = findPosition(menu);
        menu.bottom_x = a[0]+menu.offsetWidth;
        menu.bottom_y = a[1]+menu.offsetHeight;
        setMenuVisible(menu);        
	}
} 

function setMenuVisible( objMenu){
	objMenu.style.visibility = "visible";
	for (var i=0; i<arr_ddl.length;i++){
		set_ddl_visibility(false,arr_ddl[i],objMenu);
	}
}

function setMenuInvisible( objMenu){
	objMenu.style.visibility="hidden";
	for (var i=0; i<arr_ddl.length;i++){
		set_ddl_visibility(true,arr_ddl[i],objMenu);
	}
}

// returns the absolute positin of obj
function findPosition( obj ) {
  if( obj.offsetParent ) {
    for( var posX = 0, posY = 0; obj.offsetParent; obj = obj.offsetParent ) {
      posX += obj.offsetLeft;
      posY += obj.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ obj.x, obj.y ];
  }
}

function set_ddl_visibility(visibility,objDDL,objMenu){
	if (objDDL.top_x <= objMenu.bottom_x && objDDL.top_y <= objMenu.bottom_y)
		if (visibility==true)objDDL.style.visibility = "visible";
		else if (visibility==false)objDDL.style.visibility = "hidden";
}

//-->