//yui YAHOO.example.onWindowLoad = function(p_oEvent) { // Hides submenus of the root Menubar instance function hideSubmenus() { if(oMenuBar.activeItem) { var oSubmenu = oMenuBar.activeItem.cfg.getProperty("submenu"); if(oSubmenu) { oSubmenu.hide(); } } } // Cancels the call to "hideSubmenus" function cancelTimer() { if(nTimeoutId) { window.clearTimeout(nTimeoutId); } } // "mouseout" event handler for each submenu of the menubar function onSubmenuMouseOut(p_sType, p_aArguments, p_oMenu) { cancelTimer(); nTimeoutId = window.setTimeout(hideSubmenus, 750); } // "mouseover" handler for each item in the menubar function onMenuBarItemMouseOver(p_sType, p_aArguments, p_oMenuItem) { var oActiveItem = this.parent.activeItem; // Hide any other submenus that might be visible if(oActiveItem && oActiveItem != this) { this.parent.clearActiveItem(); } // Select and focus the current MenuItem instance this.cfg.setProperty("selected", true); this.focus(); // Show the submenu for this instance var oSubmenu = this.cfg.getProperty("submenu"); if(oSubmenu) { oSubmenu.show(); } } // "mouseout" handler for each item in the menubar function onMenuBarItemMouseOut(p_sType, p_aArguments, p_oMenuItem) { this.cfg.setProperty("selected", false); var oSubmenu = this.cfg.getProperty("submenu"); if(oSubmenu) { var oDOMEvent = p_aArguments[0], oRelatedTarget = YAHOO.util.Event.getRelatedTarget(oDOMEvent); if( !( oRelatedTarget == oSubmenu.element || this._oDom.isAncestor(oSubmenu.element, oRelatedTarget) ) ) { oSubmenu.hide(); } } } // "beforeshow" handler for each submenu of the menubar function onMenuBeforeShow(p_sType, p_sArgs) { // Check if the menu has any items. If not, add them if(this.getItemGroups().length == 0) { var aItemsData = this.itemsData, nItems = aItemsData.length, oItemData, oItemConfig, oSubmenu; for(var i=0; i