menu = {};

function displayMenu(menuId, type){
		
		//	Instantiate a Menu.  The first argument passed to the 
		//	constructor is the id of the element in the DOM that represents 
		//	the root Menu instance.
	    
		if(type == "menu"){
			
	    	menu[menuId] = new YAHOO.widget.Menu(menuId, {position: "static", autosubmenudisplay: true});
	    	menu[menuId].render();
	    	menu[menuId].show();
	    	
		}
	    else{
	   		menu[menuId] = new YAHOO.widget.MenuBar(menuId, {autosubmenudisplay: true});
	   		menu[menuId].render();
	    }
	    
	    return menu[menuId];

}

function checkSelected(menuId){
	
	var href = window.location.href;
	var menuItems = menu[menuId].getItems();
	
	for(x=0; x < menuItems.length; x++){
		
		var attributes = menuItems[x].srcElement.attributes;
		
		for(y=0; y < attributes.length; y++){
			if(attributes[y].name == 'select'){
				var selectValueArr = attributes[y].value.split(",");
				for(z=0; z < selectValueArr.length; z++){
					if(href.indexOf(selectValueArr[z]) > -1)
						menuItems[x].cfg.setProperty("selected", true);
				}
			}
		}
	}
	
}


