(function(){var UA=YAHOO.env.ua, Dom=YAHOO.util.Dom, Event=YAHOO.util.Event, Lang=YAHOO.lang, _DIV="DIV", _HD="hd",_BD="bd", _FT="ft",_LI="LI",_DISABLED="disabled",_MOUSEOVER="mouseover",_MOUSEOUT="mouseout",_MOUSEDOWN="mousedown",_MOUSEUP="mouseup",_CLICK="click",_KEYDOWN="keydown",_KEYUP="keyup",_KEYPRESS="keypress",_CLICK_TO_HIDE="clicktohide",_POSITION="position", _DYNAMIC="dynamic",_SHOW_DELAY="showdelay",_SELECTED="selected",_VISIBLE="visible",_UL="UL",_MENUMANAGER="MenuManager";YAHOO.widget.MenuManager=function(){var m_bInitializedEventHandlers=false,m_oMenus={},m_oVisibleMenus={}, m_oItems={},m_oEventTypes={"click": "clickEvent","mousedown": "mouseDownEvent","mouseup": "mouseUpEvent","mouseover": "mouseOverEvent","mouseout": "mouseOutEvent","keydown": "keyDownEvent","keyup": "keyUpEvent","keypress": "keyPressEvent","focus": "focusEvent","focusin": "focusEvent","blur": "blurEvent","focusout": "blurEvent" },m_oFocusedMenuItem=null;function getMenuRootElement(p_oElement){var oParentNode,returnVal;if (p_oElement && p_oElement.tagName){switch (p_oElement.tagName.toUpperCase()){case _DIV: oParentNode=p_oElement.parentNode;if (( Dom.hasClass(p_oElement, _HD) || Dom.hasClass(p_oElement, _BD) || Dom.hasClass(p_oElement, _FT) ) && oParentNode && oParentNode.tagName && oParentNode.tagName.toUpperCase()==_DIV){returnVal=oParentNode;} else {returnVal=p_oElement;} break; case _LI: returnVal=p_oElement; break; default: oParentNode=p_oElement.parentNode; if (oParentNode){returnVal=getMenuRootElement(oParentNode);}break;}} return returnVal;}function onDOMEvent(p_oEvent){var oTarget=Event.getTarget(p_oEvent),oElement=getMenuRootElement(oTarget),bFireEvent=true,sEventType=p_oEvent.type,sCustomEventType,sTagName,sId,oMenuItem,oMenu; if (oElement){sTagName=oElement.tagName.toUpperCase(); if (sTagName==_LI){sId=oElement.id; if (sId && m_oItems[sId]){oMenuItem=m_oItems[sId];oMenu=oMenuItem.parent;}} else if (sTagName==_DIV){if (oElement.id){oMenu=m_oMenus[oElement.id];}}} if (oMenu){sCustomEventType=m_oEventTypes[sEventType];if (sEventType=="click" && (UA.gecko && oMenu.platform !="mac") && p_oEvent.button > 0){bFireEvent=false;} if (bFireEvent && oMenuItem && !oMenuItem.cfg.getProperty(_DISABLED)){oMenuItem[sCustomEventType].fire(p_oEvent); }if (bFireEvent){oMenu[sCustomEventType].fire(p_oEvent, oMenuItem);}} else if (sEventType==_MOUSEDOWN){for (var i in m_oVisibleMenus){if (Lang.hasOwnProperty(m_oVisibleMenus, i)){oMenu=m_oVisibleMenus[i]; if (oMenu.cfg.getProperty(_CLICK_TO_HIDE) && !(oMenu instanceof YAHOO.widget.MenuBar) && oMenu.cfg.getProperty(_POSITION)==_DYNAMIC){oMenu.hide(); if (UA.ie && oTarget.focus){oTarget.setActive();}} else {if (oMenu.cfg.getProperty(_SHOW_DELAY) > 0){oMenu._cancelShowDelay();}if (oMenu.activeItem){oMenu.activeItem.blur();oMenu.activeItem.cfg.setProperty(_SELECTED, false);oMenu.activeItem=null; }}}}}} function onMenuDestroy(p_sType, p_aArgs, p_oMenu){if (m_oMenus[p_oMenu.id]){this.removeMenu(p_oMenu);}} function onMenuFocus(p_sType, p_aArgs){var oItem=p_aArgs[1]; if (oItem){m_oFocusedMenuItem=oItem;}} function onMenuBlur(p_sType, p_aArgs){m_oFocusedMenuItem=null;} function onMenuVisibleConfigChange(p_sType, p_aArgs){var bVisible=p_aArgs[0], sId=this.id; if (bVisible){m_oVisibleMenus[sId]=this;} else if (m_oVisibleMenus[sId]){ delete m_oVisibleMenus[sId];} } function onItemDestroy(p_sType, p_aArgs){removeItem(this);}function removeItem(p_oMenuItem){var sId=p_oMenuItem.id;if (sId && m_oItems[sId]){if (m_oFocusedMenuItem==p_oMenuItem){m_oFocusedMenuItem=null;}delete m_oItems[sId]; p_oMenuItem.destroyEvent.unsubscribe(onItemDestroy);}} function onItemAdded(p_sType, p_aArgs){var oItem=p_aArgs[0],sId;if (oItem instanceof YAHOO.widget.MenuItem){ sId=oItem.id;if (!m_oItems[sId]){m_oItems[sId]=oItem;oItem.destroyEvent.subscribe(onItemDestroy);}}} return {addMenu: function(p_oMenu){var oDoc; if (p_oMenu instanceof YAHOO.widget.Menu && p_oMenu.id && !m_oMenus[p_oMenu.id]){m_oMenus[p_oMenu.id]=p_oMenu;if (!m_bInitializedEventHandlers){oDoc=document;Event.on(oDoc, _MOUSEOVER, onDOMEvent, this, true);Event.on(oDoc, _MOUSEOUT, onDOMEvent, this, true);Event.on(oDoc, _MOUSEDOWN, onDOMEvent, this, true);Event.on(oDoc, _MOUSEUP, onDOMEvent, this, true);Event.on(oDoc, _CLICK, onDOMEvent, this, true);Event.on(oDoc, _KEYDOWN, onDOMEvent, this, true);Event.on(oDoc, _KEYUP, onDOMEvent, this, true);Event.on(oDoc, _KEYPRESS, onDOMEvent, this, true);Event.onFocus(oDoc, onDOMEvent, this, true);Event.onBlur(oDoc, onDOMEvent, this, true);m_bInitializedEventHandlers=true;} p_oMenu.cfg.subscribeToConfigEvent(_VISIBLE, onMenuVisibleConfigChange); p_oMenu.destroyEvent.subscribe(onMenuDestroy, p_oMenu, this); p_oMenu.itemAddedEvent.subscribe(onItemAdded); p_oMenu.focusEvent.subscribe(onMenuFocus); p_oMenu.blurEvent.subscribe(onMenuBlur);}}, removeMenu: function(p_oMenu){var sId, aItems, i; if (p_oMenu){sId=p_oMenu.id;if ((sId in m_oMenus) && (m_oMenus[sId]==p_oMenu)){aItems=p_oMenu.getItems(); if (aItems && aItems.length > 0){i=aItems.length - 1; do {removeItem(aItems[i]);} while (i--);} delete m_oMenus[sId];if ((sId in m_oVisibleMenus) && (m_oVisibleMenus[sId]==p_oMenu)){delete m_oVisibleMenus[sId];} if (p_oMenu.cfg){ p_oMenu.cfg.unsubscribeFromConfigEvent(_VISIBLE, onMenuVisibleConfigChange);} p_oMenu.destroyEvent.unsubscribe(onMenuDestroy, p_oMenu); p_oMenu.itemAddedEvent.unsubscribe(onItemAdded); p_oMenu.focusEvent.unsubscribe(onMenuFocus); p_oMenu.blurEvent.unsubscribe(onMenuBlur);}}}, hideVisible: function(){var oMenu;for (var i in m_oVisibleMenus){if (Lang.hasOwnProperty(m_oVisibleMenus, i)){oMenu=m_oVisibleMenus[i];if (!(oMenu instanceof YAHOO.widget.MenuBar) && oMenu.cfg.getProperty(_POSITION)==_DYNAMIC){oMenu.hide();}}}}, getVisible: function(){return m_oVisibleMenus;}, getMenus: function(){return m_oMenus;},getMenu: function(p_sId){var returnVal; if (p_sId in m_oMenus){returnVal=m_oMenus[p_sId];} return returnVal;},getMenuItem: function(p_sId){var returnVal;if (p_sId in m_oItems){returnVal=m_oItems[p_sId];}return returnVal;}, getMenuItemGroup: function(p_sId){var oUL=Dom.get(p_sId), aItems, oNode, oItem, sId, returnVal; if (oUL && oUL.tagName && oUL.tagName.toUpperCase()==_UL){oNode=oUL.firstChild; if (oNode){ aItems=[]; do {sId=oNode.id; if (sId){oItem=this.getMenuItem(sId); if (oItem){aItems[aItems.length]=oItem;}}} while ((oNode=oNode.nextSibling));if (aItems.length > 0){returnVal=aItems;}}}return returnVal;}, getFocusedMenuItem: function(){ return m_oFocusedMenuItem;}, getFocusedMenu: function(){var returnVal; if (m_oFocusedMenuItem){returnVal=m_oFocusedMenuItem.parent.getRoot();}return returnVal; },toString: function(){return _MENUMANAGER;}};}();})();(function(){var Lang=YAHOO.lang, _MENU="Menu",_DIV_UPPERCASE="DIV",_DIV_LOWERCASE="div",_ID="id",_SELECT="SELECT",_XY="xy",_Y="y",_UL_UPPERCASE="UL",_UL_LOWERCASE="ul",_FIRST_OF_TYPE="first-of-type",_LI="LI",_OPTGROUP="OPTGROUP",_OPTION="OPTION",_DISABLED="disabled",_NONE="none",_SELECTED="selected",_GROUP_INDEX="groupindex",_INDEX="index",_SUBMENU="submenu",_VISIBLE="visible",_HIDE_DELAY="hidedelay",_POSITION="position",_DYNAMIC="dynamic",_STATIC="static",_DYNAMIC_STATIC=_DYNAMIC + "," + _STATIC,_URL="url",_HASH="#",_TARGET="target",_MAX_HEIGHT="maxheight",_TOP_SCROLLBAR="topscrollbar",_BOTTOM_SCROLLBAR="bottomscrollbar",_UNDERSCORE="_",_TOP_SCROLLBAR_DISABLED=_TOP_SCROLLBAR + _UNDERSCORE + _DISABLED,_BOTTOM_SCROLLBAR_DISABLED=_BOTTOM_SCROLLBAR + _UNDERSCORE + _DISABLED,_MOUSEMOVE="mousemove",_SHOW_DELAY="showdelay",_SUBMENU_HIDE_DELAY="submenuhidedelay",_IFRAME="iframe",_CONSTRAIN_TO_VIEWPORT="constraintoviewport",_PREVENT_CONTEXT_OVERLAP="preventcontextoverlap",_SUBMENU_ALIGNMENT="submenualignment",_AUTO_SUBMENU_DISPLAY="autosubmenudisplay",_CLICK_TO_HIDE="clicktohide",_CONTAINER="container",_SCROLL_INCREMENT="scrollincrement",_MIN_SCROLL_HEIGHT="minscrollheight",_CLASSNAME="classname",_SHADOW="shadow",_KEEP_OPEN="keepopen",_HD="hd",_HAS_TITLE="hastitle",_CONTEXT="context",_EMPTY_STRING="",_MOUSEDOWN="mousedown",_KEYDOWN="keydown",_HEIGHT="height",_WIDTH="width",_PX="px",_EFFECT="effect",_MONITOR_RESIZE="monitorresize",_DISPLAY="display",_BLOCK="block",_VISIBILITY="visibility",_ABSOLUTE="absolute",_ZINDEX="zindex",_YUI_MENU_BODY_SCROLLED="yui-menu-body-scrolled",_NON_BREAKING_SPACE="&#32;",_SPACE=" ",_MOUSEOVER="mouseover",_MOUSEOUT="mouseout",_ITEM_ADDED="itemAdded",_ITEM_REMOVED="itemRemoved",_HIDDEN="hidden", _YUI_MENU_SHADOW="yui-menu-shadow",_YUI_MENU_SHADOW_VISIBLE=_YUI_MENU_SHADOW + "-visible",_YUI_MENU_SHADOW_YUI_MENU_SHADOW_VISIBLE=_YUI_MENU_SHADOW + _SPACE + _YUI_MENU_SHADOW_VISIBLE;YAHOO.widget.Menu=function(p_oElement, p_oConfig){if (p_oConfig){this.parent=p_oConfig.parent;this.lazyLoad=p_oConfig.lazyLoad || p_oConfig.lazyload;this.itemData=p_oConfig.itemData || p_oConfig.itemdata;} YAHOO.widget.Menu.superclass.constructor.call(this, p_oElement, p_oConfig);};function checkPosition(p_sPosition){var returnVal=false;if (Lang.isString(p_sPosition)){returnVal=(_DYNAMIC_STATIC.indexOf((p_sPosition.toLowerCase())) !=-1);}return returnVal;}var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Module=YAHOO.widget.Module,Overlay=YAHOO.widget.Overlay,Menu=YAHOO.widget.Menu,MenuManager=YAHOO.widget.MenuManager,CustomEvent=YAHOO.util.CustomEvent,UA=YAHOO.env.ua,m_oShadowTemplate,bFocusListenerInitialized=false,oFocusedElement,EVENT_TYPES=[["mouseOverEvent", _MOUSEOVER],["mouseOutEvent", _MOUSEOUT],["mouseDownEvent", _MOUSEDOWN],["mouseUpEvent", "mouseup"],["clickEvent", "click"],["keyPressEvent", "keypress"],["keyDownEvent", _KEYDOWN],["keyUpEvent", "keyup"],["focusEvent", "focus"],["blurEvent", "blur"],["itemAddedEvent", _ITEM_ADDED],["itemRemovedEvent", _ITEM_REMOVED]],VISIBLE_CONFIG={ key: _VISIBLE, value: false, validator: Lang.isBoolean}, CONSTRAIN_TO_VIEWPORT_CONFIG={key: _CONSTRAIN_TO_VIEWPORT, value: true, validator: Lang.isBoolean, supercedes: [_IFRAME,"x",_Y,_XY]}, PREVENT_CONTEXT_OVERLAP_CONFIG={key: _PREVENT_CONTEXT_OVERLAP,value: true,validator: Lang.isBoolean, supercedes: [_CONSTRAIN_TO_VIEWPORT]},POSITION_CONFIG={ key: _POSITION, value: _DYNAMIC, validator: checkPosition, supercedes: [_VISIBLE, _IFRAME]}, SUBMENU_ALIGNMENT_CONFIG={ key: _SUBMENU_ALIGNMENT, value: ["tl","tr"]},AUTO_SUBMENU_DISPLAY_CONFIG={ key: _AUTO_SUBMENU_DISPLAY, value: true, validator: Lang.isBoolean,suppressEvent: true}, SHOW_DELAY_CONFIG={ key: _SHOW_DELAY, value: 250, validator: Lang.isNumber, suppressEvent: true}, HIDE_DELAY_CONFIG={ key: _HIDE_DELAY, value: 0, validator: Lang.isNumber, suppressEvent: true}, SUBMENU_HIDE_DELAY_CONFIG={ key: _SUBMENU_HIDE_DELAY, value: 250, validator: Lang.isNumber,suppressEvent: true}, CLICK_TO_HIDE_CONFIG={ key: _CLICK_TO_HIDE, value: true, validator: Lang.isBoolean,suppressEvent: true},CONTAINER_CONFIG={ key: _CONTAINER,suppressEvent: true}, SCROLL_INCREMENT_CONFIG={ key: _SCROLL_INCREMENT, value: 1, validator: Lang.isNumber,supercedes: [_MAX_HEIGHT],suppressEvent: true},MIN_SCROLL_HEIGHT_CONFIG={ key: _MIN_SCROLL_HEIGHT, value: 90, validator: Lang.isNumber,supercedes: [_MAX_HEIGHT],suppressEvent: true}, MAX_HEIGHT_CONFIG={ key: _MAX_HEIGHT, value: 0, validator: Lang.isNumber,supercedes: [_IFRAME],suppressEvent: true}, CLASS_NAME_CONFIG={ key: _CLASSNAME, value: null, validator: Lang.isString,suppressEvent: true}, DISABLED_CONFIG={ key: _DISABLED, value: false, validator: Lang.isBoolean,suppressEvent: true},SHADOW_CONFIG={ key: _SHADOW, value: true, validator: Lang.isBoolean,suppressEvent: true,supercedes: [_VISIBLE]},KEEP_OPEN_CONFIG={key: _KEEP_OPEN, value: false, validator: Lang.isBoolean};function onDocFocus(event){oFocusedElement=Event.getTarget(event);}YAHOO.lang.extend(Menu, Overlay, {CSS_CLASS_NAME: "yuimenu",ITEM_TYPE: null,GROUP_TITLE_TAG_NAME: "h6",OFF_SCREEN_POSITION: "-999em",_useHideDelay: false,_bHandledMouseOverEvent: false,_bHandledMouseOutEvent: false,_aGroupTitleElements: null,_aItemGroups: null,_aListElements: null,_nCurrentMouseX: 0,_bStopMouseEventHandlers: false,_sClassName: null,lazyLoad: false,itemData: null,activeItem: null,parent: null,srcElement: null,init: function(p_oElement, p_oConfig){ this._aItemGroups=[];this._aListElements=[]; this._aGroupTitleElements=[];if (!this.ITEM_TYPE){ this.ITEM_TYPE=YAHOO.widget.MenuItem; } var oElement; if (Lang.isString(p_oElement)){oElement=Dom.get(p_oElement);} else if (p_oElement.tagName){ oElement=p_oElement;} if (oElement && oElement.tagName){ switch(oElement.tagName.toUpperCase()){case _DIV_UPPERCASE: this.srcElement=oElement; if (!oElement.id){oElement.setAttribute(_ID, Dom.generateId());} Menu.superclass.init.call(this, oElement); this.beforeInitEvent.fire(Menu); break; case _SELECT:this.srcElement=oElement; Menu.superclass.init.call(this, Dom.generateId()); this.beforeInitEvent.fire(Menu);break;}}else {Menu.superclass.init.call(this, p_oElement);this.beforeInitEvent.fire(Menu);} if (this.element){Dom.addClass(this.element, this.CSS_CLASS_NAME);this.initEvent.subscribe(this._onInit);this.beforeRenderEvent.subscribe(this._onBeforeRender);this.renderEvent.subscribe(this._onRender);this.beforeShowEvent.subscribe(this._onBeforeShow);this.hideEvent.subscribe(this._onHide);this.showEvent.subscribe(this._onShow);this.beforeHideEvent.subscribe(this._onBeforeHide);this.mouseOverEvent.subscribe(this._onMouseOver);this.mouseOutEvent.subscribe(this._onMouseOut);this.clickEvent.subscribe(this._onClick);this.keyDownEvent.subscribe(this._onKeyDown);this.keyPressEvent.subscribe(this._onKeyPress);this.blurEvent.subscribe(this._onBlur);if (!bFocusListenerInitialized){Event.onFocus(document, onDocFocus);bFocusListenerInitialized=true;}if ((UA.gecko && UA.gecko < 1.9) || UA.webkit){this.cfg.subscribeToConfigEvent(_Y, this._onYChange);} if (p_oConfig){this.cfg.applyConfig(p_oConfig, true); }MenuManager.addMenu(this);this.initEvent.fire(Menu);}},_initSubTree: function(){var oSrcElement=this.srcElement,sSrcElementTagName,nGroup,sGroupTitleTagName,oNode,aListElements,nListElements,i;if (oSrcElement){sSrcElementTagName=(oSrcElement.tagName && oSrcElement.tagName.toUpperCase());if (sSrcElementTagName==_DIV_UPPERCASE){oNode=this.body.firstChild; if (oNode){ nGroup=0; sGroupTitleTagName=this.GROUP_TITLE_TAG_NAME.toUpperCase();do {if (oNode && oNode.tagName){switch (oNode.tagName.toUpperCase()){case sGroupTitleTagName:this._aGroupTitleElements[nGroup]=oNode; break; case _UL_UPPERCASE:this._aListElements[nGroup]=oNode;this._aItemGroups[nGroup]=[];nGroup++;break;}}} while ((oNode=oNode.nextSibling));if (this._aListElements[0]){Dom.addClass(this._aListElements[0], _FIRST_OF_TYPE);}}}oNode=null;if (sSrcElementTagName){switch (sSrcElementTagName){case _DIV_UPPERCASE:aListElements=this._aListElements;nListElements=aListElements.length;if (nListElements > 0){i=nListElements - 1;do {oNode=aListElements[i].firstChild;if (oNode){do {if (oNode && oNode.tagName &&oNode.tagName.toUpperCase()==_LI){this.addItem(new this.ITEM_TYPE(oNode,{ parent: this }), i);}}while ((oNode=oNode.nextSibling));}}while (i--);}break;case _SELECT:oNode=oSrcElement.firstChild;do {if (oNode && oNode.tagName){switch (oNode.tagName.toUpperCase()){case _OPTGROUP:case _OPTION:this.addItem(new this.ITEM_TYPE(oNode,{ parent: this }));break;}}}while ((oNode=oNode.nextSibling));break;}}}},_getFirstEnabledItem: function(){var aItems=this.getItems(),nItems=aItems.length,oItem,returnVal;for(var i=0; i<nItems; i++){oItem=aItems[i];if (oItem && !oItem.cfg.getProperty(_DISABLED) && oItem.element.style.display !=_NONE){returnVal=oItem;break;}}return returnVal;},_addItemToGroup: function(p_nGroupIndex, p_oItem, p_nItemIndex){var oItem,nGroupIndex,aGroup,oGroupItem,bAppend,oNextItemSibling,nItemIndex,returnVal;function getNextItemSibling(p_aArray, p_nStartIndex){return (p_aArray[p_nStartIndex] || getNextItemSibling(p_aArray, (p_nStartIndex+1)));}if (p_oItem instanceof this.ITEM_TYPE){oItem=p_oItem;oItem.parent=this;}else if (Lang.isString(p_oItem)){oItem=new this.ITEM_TYPE(p_oItem, { parent: this });}else if (Lang.isObject(p_oItem)){p_oItem.parent=this;oItem=new this.ITEM_TYPE(p_oItem.text, p_oItem);}if (oItem){if (oItem.cfg.getProperty(_SELECTED)){this.activeItem=oItem;}nGroupIndex=Lang.isNumber(p_nGroupIndex) ? p_nGroupIndex : 0;aGroup=this._getItemGroup(nGroupIndex);if (!aGroup){aGroup=this._createItemGroup(nGroupIndex);}if (Lang.isNumber(p_nItemIndex)){bAppend=(p_nItemIndex >=aGroup.length);if (aGroup[p_nItemIndex]){aGroup.splice(p_nItemIndex, 0, oItem);}else {aGroup[p_nItemIndex]=oItem;}oGroupItem=aGroup[p_nItemIndex];if (oGroupItem){if (bAppend && (!oGroupItem.element.parentNode || oGroupItem.element.parentNode.nodeType==11)){this._aListElements[nGroupIndex].appendChild(oGroupItem.element);}else {oNextItemSibling=getNextItemSibling(aGroup, (p_nItemIndex+1));if (oNextItemSibling && (!oGroupItem.element.parentNode ||oGroupItem.element.parentNode.nodeType==11)){this._aListElements[nGroupIndex].insertBefore(oGroupItem.element, oNextItemSibling.element);}}oGroupItem.parent=this;this._subscribeToItemEvents(oGroupItem);this._configureSubmenu(oGroupItem);this._updateItemProperties(nGroupIndex);this.itemAddedEvent.fire(oGroupItem);this.changeContentEvent.fire();returnVal=oGroupItem;}}else {nItemIndex=aGroup.length;aGroup[nItemIndex]=oItem;oGroupItem=aGroup[nItemIndex];if (oGroupItem){if (!Dom.isAncestor(this._aListElements[nGroupIndex], oGroupItem.element)){this._aListElements[nGroupIndex].appendChild(oGroupItem.element);}oGroupItem.element.setAttribute(_GROUP_INDEX, nGroupIndex);oGroupItem.element.setAttribute(_INDEX, nItemIndex);oGroupItem.parent=this;oGroupItem.index=nItemIndex;oGroupItem.groupIndex=nGroupIndex;this._subscribeToItemEvents(oGroupItem);this._configureSubmenu(oGroupItem);if (nItemIndex===0){Dom.addClass(oGroupItem.element, _FIRST_OF_TYPE);}this.itemAddedEvent.fire(oGroupItem);this.changeContentEvent.fire();returnVal=oGroupItem;}}}return returnVal;},_removeItemFromGroupByIndex: function(p_nGroupIndex, p_nItemIndex){var nGroupIndex=Lang.isNumber(p_nGroupIndex) ? p_nGroupIndex : 0, aGroup=this._getItemGroup(nGroupIndex),aArray,oItem,oUL;if (aGroup){aArray=aGroup.splice(p_nItemIndex, 1);oItem=aArray[0];if (oItem){this._updateItemProperties(nGroupIndex);if (aGroup.length===0){oUL=this._aListElements[nGroupIndex];if (this.body && oUL){this.body.removeChild(oUL);}this._aItemGroups.splice(nGroupIndex, 1);this._aListElements.splice(nGroupIndex, 1);oUL=this._aListElements[0];if (oUL){Dom.addClass(oUL, _FIRST_OF_TYPE);} }this.itemRemovedEvent.fire(oItem);this.changeContentEvent.fire();}}return oItem;},_removeItemFromGroupByValue: function(p_nGroupIndex, p_oItem){var aGroup=this._getItemGroup(p_nGroupIndex),nItems,nItemIndex,returnVal,i;if (aGroup){nItems=aGroup.length;nItemIndex=-1;if (nItems > 0){i=nItems-1;do {if (aGroup[i]==p_oItem){nItemIndex=i;break;}}while (i--);if (nItemIndex > -1){returnVal=this._removeItemFromGroupByIndex(p_nGroupIndex, nItemIndex);}}}return returnVal;},_updateItemProperties: function(p_nGroupIndex){var aGroup=this._getItemGroup(p_nGroupIndex),nItems=aGroup.length,oItem,oLI,i;if (nItems > 0){ i=nItems - 1;do {oItem=aGroup[i];if (oItem){oLI=oItem.element;oItem.index=i;oItem.groupIndex=p_nGroupIndex;oLI.setAttribute(_GROUP_INDEX, p_nGroupIndex);oLI.setAttribute(_INDEX, i);Dom.removeClass(oLI, _FIRST_OF_TYPE);}}while (i--);if (oLI){Dom.addClass(oLI, _FIRST_OF_TYPE);}}},_createItemGroup: function(p_nIndex){var oUL,returnVal;if (!this._aItemGroups[p_nIndex]){this._aItemGroups[p_nIndex]=[];oUL=document.createElement(_UL_LOWERCASE);this._aListElements[p_nIndex]=oUL;returnVal=this._aItemGroups[p_nIndex];}return returnVal;},_getItemGroup: function(p_nIndex){var nIndex=Lang.isNumber(p_nIndex) ? p_nIndex : 0,aGroups=this._aItemGroups,returnVal;if (nIndex in aGroups){returnVal=aGroups[nIndex];}return returnVal;},_configureSubmenu: function(p_oItem){var oSubmenu=p_oItem.cfg.getProperty(_SUBMENU);if (oSubmenu){this.cfg.configChangedEvent.subscribe(this._onParentMenuConfigChange, oSubmenu, true);this.renderEvent.subscribe(this._onParentMenuRender, oSubmenu, true);}},_subscribeToItemEvents: function(p_oItem){p_oItem.destroyEvent.subscribe(this._onMenuItemDestroy, p_oItem, this);p_oItem.cfg.configChangedEvent.subscribe(this._onMenuItemConfigChange, p_oItem, this);},_onVisibleChange: function(p_sType, p_aArgs){var bVisible=p_aArgs[0];if (bVisible){Dom.addClass(this.element, _VISIBLE);}else {Dom.removeClass(this.element, _VISIBLE);}},_cancelHideDelay: function(){var oTimer=this.getRoot()._hideDelayTimer;if (oTimer){oTimer.cancel();}},_execHideDelay: function(){this._cancelHideDelay();var oRoot=this.getRoot();oRoot._hideDelayTimer=Lang.later(oRoot.cfg.getProperty(_HIDE_DELAY), this, function(){if (oRoot.activeItem){if (oRoot.hasFocus()){oRoot.activeItem.focus();}oRoot.clearActiveItem();}if (oRoot==this && !(this instanceof YAHOO.widget.MenuBar) &&this.cfg.getProperty(_POSITION)==_DYNAMIC){this.hide();}});},_cancelShowDelay: function(){var oTimer=this.getRoot()._showDelayTimer;if (oTimer){oTimer.cancel();}},_execSubmenuHideDelay: function(p_oSubmenu, p_nMouseX, p_nHideDelay){p_oSubmenu._submenuHideDelayTimer=Lang.later(50, this, function(){ if (this._nCurrentMouseX > (p_nMouseX + 10)){p_oSubmenu._submenuHideDelayTimer=Lang.later(p_nHideDelay, p_oSubmenu, function(){this.hide();});}else {p_oSubmenu.hide();}});},_disableScrollHeader: function(){if (!this._bHeaderDisabled){Dom.addClass(this.header, _TOP_SCROLLBAR_DISABLED); this._bHeaderDisabled=true;}},_disableScrollFooter: function(){if (!this._bFooterDisabled){Dom.addClass(this.footer, _BOTTOM_SCROLLBAR_DISABLED);this._bFooterDisabled=true;}},_enableScrollHeader: function(){if (this._bHeaderDisabled){Dom.removeClass(this.header, _TOP_SCROLLBAR_DISABLED);this._bHeaderDisabled=false; }},_enableScrollFooter: function(){if (this._bFooterDisabled){Dom.removeClass(this.footer, _BOTTOM_SCROLLBAR_DISABLED);this._bFooterDisabled=false;}},_onMouseOver: function(p_sType, p_aArgs){var oEvent=p_aArgs[0],oItem=p_aArgs[1],oTarget=Event.getTarget(oEvent),oRoot=this.getRoot(),oSubmenuHideDelayTimer=this._submenuHideDelayTimer,oParentMenu,nShowDelay,bShowDelay,oActiveItem,oItemCfg,oSubmenu;var showSubmenu=function(){if (this.parent.cfg.getProperty(_SELECTED)){this.show();}};if (!this._bStopMouseEventHandlers){if (!this._bHandledMouseOverEvent && (oTarget==this.element ||Dom.isAncestor(this.element, oTarget))){if (this._useHideDelay){this._cancelHideDelay();}this._nCurrentMouseX=0;Event.on(this.element, _MOUSEMOVE, this._onMouseMove, this, true);if (!(oItem && Dom.isAncestor(oItem.element, Event.getRelatedTarget(oEvent)))){this.clearActiveItem();}if (this.parent && oSubmenuHideDelayTimer){oSubmenuHideDelayTimer.cancel();this.parent.cfg.setProperty(_SELECTED, true);oParentMenu=this.parent.parent;oParentMenu._bHandledMouseOutEvent=true;oParentMenu._bHandledMouseOverEvent=false;}this._bHandledMouseOverEvent=true;this._bHandledMouseOutEvent=false;}if (oItem && !oItem.handledMouseOverEvent && !oItem.cfg.getProperty(_DISABLED) && (oTarget==oItem.element || Dom.isAncestor(oItem.element, oTarget))){nShowDelay=this.cfg.getProperty(_SHOW_DELAY);bShowDelay=(nShowDelay > 0);if (bShowDelay){this._cancelShowDelay();}oActiveItem=this.activeItem;if (oActiveItem){oActiveItem.cfg.setProperty(_SELECTED, false);}oItemCfg=oItem.cfg;oItemCfg.setProperty(_SELECTED, true);if (this.hasFocus() || oRoot._hasFocus){oItem.focus();oRoot._hasFocus=false;}if (this.cfg.getProperty(_AUTO_SUBMENU_DISPLAY)){oSubmenu=oItemCfg.getProperty(_SUBMENU);if (oSubmenu){if (bShowDelay){oRoot._showDelayTimer=Lang.later(oRoot.cfg.getProperty(_SHOW_DELAY), oSubmenu, showSubmenu);}else {oSubmenu.show();}}}oItem.handledMouseOverEvent=true;oItem.handledMouseOutEvent=false;}}},_onMouseOut: function(p_sType, p_aArgs){var oEvent=p_aArgs[0],oItem=p_aArgs[1],oRelatedTarget=Event.getRelatedTarget(oEvent),bMovingToSubmenu=false,oItemCfg,oSubmenu,nSubmenuHideDelay,nShowDelay;if (!this._bStopMouseEventHandlers){if (oItem && !oItem.cfg.getProperty(_DISABLED)){oItemCfg=oItem.cfg;oSubmenu=oItemCfg.getProperty(_SUBMENU);if (oSubmenu && (oRelatedTarget==oSubmenu.element ||Dom.isAncestor(oSubmenu.element, oRelatedTarget))){bMovingToSubmenu=true;}if (!oItem.handledMouseOutEvent && ((oRelatedTarget !=oItem.element && !Dom.isAncestor(oItem.element, oRelatedTarget)) || bMovingToSubmenu)){if (!bMovingToSubmenu){oItem.cfg.setProperty(_SELECTED, false);if (oSubmenu){nSubmenuHideDelay=this.cfg.getProperty(_SUBMENU_HIDE_DELAY);nShowDelay=this.cfg.getProperty(_SHOW_DELAY);if (!(this instanceof YAHOO.widget.MenuBar) && nSubmenuHideDelay > 0 &&nShowDelay >=nSubmenuHideDelay){this._execSubmenuHideDelay(oSubmenu, Event.getPageX(oEvent),nSubmenuHideDelay);}else {oSubmenu.hide();}}}oItem.handledMouseOutEvent=true;oItem.handledMouseOverEvent=false;}}if (!this._bHandledMouseOutEvent && ((oRelatedTarget !=this.element &&!Dom.isAncestor(this.element, oRelatedTarget)) || bMovingToSubmenu)){if (this._useHideDelay){this._execHideDelay();}Event.removeListener(this.element, _MOUSEMOVE, this._onMouseMove);this._nCurrentMouseX=Event.getPageX(oEvent);this._bHandledMouseOutEvent=true;this._bHandledMouseOverEvent=false;} }},_onMouseMove: function(p_oEvent, p_oMenu){if (!this._bStopMouseEventHandlers){this._nCurrentMouseX=Event.getPageX(p_oEvent);}},_onClick: function(p_sType, p_aArgs){var oEvent=p_aArgs[0],oItem=p_aArgs[1],bInMenuAnchor=false,oSubmenu,oMenu,oRoot,sId,sURL,nHashPos,nLen;var hide=function(){oRoot=this.getRoot();if (oRoot instanceof YAHOO.widget.MenuBar ||oRoot.cfg.getProperty(_POSITION)==_STATIC){oRoot.clearActiveItem();}else {oRoot.hide();}};if (oItem){if (oItem.cfg.getProperty(_DISABLED)){Event.preventDefault(oEvent);hide.call(this);}else {oSubmenu=oItem.cfg.getProperty(_SUBMENU);sURL=oItem.cfg.getProperty(_URL);if (sURL){nHashPos=sURL.indexOf(_HASH);nLen=sURL.length;if (nHashPos !=-1){sURL=sURL.substr(nHashPos, nLen);nLen=sURL.length;if (nLen > 1){sId=sURL.substr(1, nLen);oMenu=YAHOO.widget.MenuManager.getMenu(sId);if (oMenu){bInMenuAnchor=(this.getRoot()===oMenu.getRoot());}}else if (nLen===1){bInMenuAnchor=true;}}}if (bInMenuAnchor && !oItem.cfg.getProperty(_TARGET)){Event.preventDefault(oEvent);if (UA.webkit){oItem.focus();}else {oItem.focusEvent.fire();}}if (!oSubmenu && !this.cfg.getProperty(_KEEP_OPEN)){hide.call(this);}}}},_onKeyDown: function(p_sType, p_aArgs){var oEvent=p_aArgs[0],oItem=p_aArgs[1], oSubmenu,oItemCfg, oParentItem,oRoot,oNextItem,oBody,nBodyScrollTop,nBodyOffsetHeight,aItems, nItems,nNextItemOffsetTop,nScrollTarget,oParentMenu,oFocusedEl;if (this._useHideDelay){this._cancelHideDelay();}function stopMouseEventHandlers(){this._bStopMouseEventHandlers=true;Lang.later(10, this, function(){this._bStopMouseEventHandlers=false;});}if (oItem && !oItem.cfg.getProperty(_DISABLED)){oItemCfg=oItem.cfg;oParentItem=this.parent;switch(oEvent.keyCode){case 38:case 40:oNextItem=(oEvent.keyCode==38) ? oItem.getPreviousEnabledSibling() :oItem.getNextEnabledSibling();if (oNextItem){this.clearActiveItem();oNextItem.cfg.setProperty(_SELECTED, true);oNextItem.focus();if (this.cfg.getProperty(_MAX_HEIGHT) > 0){oBody=this.body;nBodyScrollTop=oBody.scrollTop;nBodyOffsetHeight=oBody.offsetHeight;aItems=this.getItems();nItems=aItems.length - 1;nNextItemOffsetTop=oNextItem.element.offsetTop;if (oEvent.keyCode==40 ){if (nNextItemOffsetTop >=(nBodyOffsetHeight + nBodyScrollTop)){oBody.scrollTop=nNextItemOffsetTop - nBodyOffsetHeight;}else if (nNextItemOffsetTop <=nBodyScrollTop){oBody.scrollTop=0;}if (oNextItem==aItems[nItems]){oBody.scrollTop=oNextItem.element.offsetTop;}}else {if (nNextItemOffsetTop <=nBodyScrollTop){oBody.scrollTop=nNextItemOffsetTop - oNextItem.element.offsetHeight;}else if (nNextItemOffsetTop >=(nBodyScrollTop + nBodyOffsetHeight)){oBody.scrollTop=nNextItemOffsetTop;}if (oNextItem==aItems[0]){oBody.scrollTop=0;}}nBodyScrollTop=oBody.scrollTop;nScrollTarget=oBody.scrollHeight - oBody.offsetHeight;if (nBodyScrollTop===0){this._disableScrollHeader();this._enableScrollFooter();}else if (nBodyScrollTop==nScrollTarget){this._enableScrollHeader();this._disableScrollFooter();}else {this._enableScrollHeader();this._enableScrollFooter();}}}Event.preventDefault(oEvent);stopMouseEventHandlers();break;case 39: oSubmenu=oItemCfg.getProperty(_SUBMENU);if (oSubmenu){if (!oItemCfg.getProperty(_SELECTED)){oItemCfg.setProperty(_SELECTED, true);}oSubmenu.show();oSubmenu.setInitialFocus();oSubmenu.setInitialSelection();}else {oRoot=this.getRoot();if (oRoot instanceof YAHOO.widget.MenuBar){oNextItem=oRoot.activeItem.getNextEnabledSibling();if (oNextItem){oRoot.clearActiveItem();oNextItem.cfg.setProperty(_SELECTED, true);oSubmenu=oNextItem.cfg.getProperty(_SUBMENU);if (oSubmenu){oSubmenu.show();oSubmenu.setInitialFocus();}else {oNextItem.focus();}}}}Event.preventDefault(oEvent);stopMouseEventHandlers();break;case 37: if (oParentItem){oParentMenu=oParentItem.parent;if (oParentMenu instanceof YAHOO.widget.MenuBar){oNextItem=oParentMenu.activeItem.getPreviousEnabledSibling();if (oNextItem){oParentMenu.clearActiveItem();oNextItem.cfg.setProperty(_SELECTED, true);oSubmenu=oNextItem.cfg.getProperty(_SUBMENU);if (oSubmenu){oSubmenu.show();oSubmenu.setInitialFocus();}else {oNextItem.focus();}}}else {this.hide();oParentItem.focus();} }Event.preventDefault(oEvent);stopMouseEventHandlers();break;}}if (oEvent.keyCode==27){if (this.cfg.getProperty(_POSITION)==_DYNAMIC){this.hide();if (this.parent){ this.parent.focus();}else {oFocusedEl=this._focusedElement;if (oFocusedEl && oFocusedEl.focus){try {oFocusedEl.focus();}catch(ex){}}}} else if (this.activeItem){oSubmenu=this.activeItem.cfg.getProperty(_SUBMENU);if (oSubmenu && oSubmenu.cfg.getProperty(_VISIBLE)){oSubmenu.hide();this.activeItem.focus();}else {this.activeItem.blur();this.activeItem.cfg.setProperty(_SELECTED, false); }}Event.preventDefault(oEvent);}},_onKeyPress: function(p_sType, p_aArgs){var oEvent=p_aArgs[0];if (oEvent.keyCode==40 || oEvent.keyCode==38){Event.preventDefault(oEvent);}},_onBlur: function(p_sType, p_aArgs){if (this._hasFocus){this._hasFocus=false;}},_onYChange: function(p_sType, p_aArgs){var oParent=this.parent,nScrollTop,oIFrame,nY;if (oParent){nScrollTop=oParent.parent.body.scrollTop;if (nScrollTop > 0){ nY=(this.cfg.getProperty(_Y) - nScrollTop);Dom.setY(this.element, nY);oIFrame=this.iframe;if (oIFrame){Dom.setY(oIFrame, nY);}this.cfg.setProperty(_Y, nY, true);}}},_onScrollTargetMouseOver: function(p_oEvent, p_oMenu){var oBodyScrollTimer=this._bodyScrollTimer;if (oBodyScrollTimer){oBodyScrollTimer.cancel();}this._cancelHideDelay();var oTarget=Event.getTarget(p_oEvent),oBody=this.body,nScrollIncrement=this.cfg.getProperty(_SCROLL_INCREMENT),nScrollTarget,fnScrollFunction;function scrollBodyDown(){var nScrollTop=oBody.scrollTop;if (nScrollTop < nScrollTarget){oBody.scrollTop=(nScrollTop + nScrollIncrement);this._enableScrollHeader();}else {oBody.scrollTop=nScrollTarget;this._bodyScrollTimer.cancel();this._disableScrollFooter();}}function scrollBodyUp(){var nScrollTop=oBody.scrollTop;if (nScrollTop > 0){oBody.scrollTop=(nScrollTop - nScrollIncrement); this._enableScrollFooter();}else {oBody.scrollTop=0;this._bodyScrollTimer.cancel();this._disableScrollHeader();}}if (Dom.hasClass(oTarget, _HD)){fnScrollFunction=scrollBodyUp;}else {nScrollTarget=oBody.scrollHeight - oBody.offsetHeight;fnScrollFunction=scrollBodyDown;}this._bodyScrollTimer=Lang.later(10, this, fnScrollFunction, null, true);},_onScrollTargetMouseOut: function(p_oEvent, p_oMenu){var oBodyScrollTimer=this._bodyScrollTimer;if (oBodyScrollTimer){oBodyScrollTimer.cancel();}this._cancelHideDelay();},_onInit: function(p_sType, p_aArgs){this.cfg.subscribeToConfigEvent(_VISIBLE, this._onVisibleChange);var bRootMenu=!this.parent,bLazyLoad=this.lazyLoad; if (((bRootMenu && !bLazyLoad) ||(bRootMenu && (this.cfg.getProperty(_VISIBLE) ||this.cfg.getProperty(_POSITION)==_STATIC)) || (!bRootMenu && !bLazyLoad)) && this.getItemGroups().length===0){ if (this.srcElement){this._initSubTree();}if (this.itemData){this.addItems(this.itemData);}}else if (bLazyLoad){this.cfg.fireQueue();}},_onBeforeRender: function(p_sType, p_aArgs){var oEl=this.element,nListElements=this._aListElements.length,bFirstList=true,i=0,oUL,oGroupTitle;if (nListElements > 0){do {oUL=this._aListElements[i];if (oUL){if (bFirstList){Dom.addClass(oUL, _FIRST_OF_TYPE);bFirstList=false;}if (!Dom.isAncestor(oEl, oUL)){this.appendToBody(oUL);}oGroupTitle=this._aGroupTitleElements[i];if (oGroupTitle){if (!Dom.isAncestor(oEl, oGroupTitle)){oUL.parentNode.insertBefore(oGroupTitle, oUL);}Dom.addClass(oUL, _HAS_TITLE); }}i++;}while (i < nListElements);}},_onRender: function(p_sType, p_aArgs){if (this.cfg.getProperty(_POSITION)==_DYNAMIC){if (!this.cfg.getProperty(_VISIBLE)){this.positionOffScreen();}}},_onBeforeShow: function(p_sType, p_aArgs){var nOptions,n,oSrcElement,oContainer=this.cfg.getProperty(_CONTAINER);if (this.lazyLoad && this.getItemGroups().length===0){if (this.srcElement){this._initSubTree();}if (this.itemData){if (this.parent && this.parent.parent &&this.parent.parent.srcElement &&this.parent.parent.srcElement.tagName.toUpperCase()==_SELECT){nOptions=this.itemData.length;for(n=0; n<nOptions; n++){if (this.itemData[n].tagName){this.addItem((new this.ITEM_TYPE(this.itemData[n])));}}}else {this.addItems(this.itemData);}}oSrcElement=this.srcElement;if (oSrcElement){if (oSrcElement.tagName.toUpperCase()==_SELECT){if (Dom.inDocument(oSrcElement)){this.render(oSrcElement.parentNode);}else {this.render(oContainer);}}else {this.render();}}else {if (this.parent){this.render(this.parent.element);}else {this.render(oContainer);}}}var oParent=this.parent,aAlignment;if (!oParent && this.cfg.getProperty(_POSITION)==_DYNAMIC){this.cfg.refireEvent(_XY);}if (oParent){aAlignment=oParent.parent.cfg.getProperty(_SUBMENU_ALIGNMENT);this.cfg.setProperty(_CONTEXT, [oParent.element, aAlignment[0], aAlignment[1]]);this.align();}},getConstrainedY: function(y){var oMenu=this,aContext=oMenu.cfg.getProperty(_CONTEXT),nInitialMaxHeight=oMenu.cfg.getProperty(_MAX_HEIGHT),nMaxHeight,oOverlapPositions={"trbr": true,"tlbl": true,"bltl": true,"brtr": true},bPotentialContextOverlap=(aContext && oOverlapPositions[aContext[1] + aContext[2]]),oMenuEl=oMenu.element,nMenuOffsetHeight=oMenuEl.offsetHeight,nViewportOffset=Overlay.VIEWPORT_OFFSET,viewPortHeight=Dom.getViewportHeight(),scrollY=Dom.getDocumentScrollTop(),bCanConstrain=(oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT) + nViewportOffset < viewPortHeight),nAvailableHeight,oContextEl,nContextElY,nContextElHeight,bFlipped=false,nTopRegionHeight,nBottomRegionHeight,topConstraint=scrollY + nViewportOffset,bottomConstraint=scrollY + viewPortHeight - nMenuOffsetHeight - nViewportOffset,yNew=y;var flipVertical=function(){var nNewY;if ((oMenu.cfg.getProperty(_Y) - scrollY) > nContextElY){nNewY=(nContextElY - nMenuOffsetHeight);}else {nNewY=(nContextElY + nContextElHeight);}oMenu.cfg.setProperty(_Y, (nNewY + scrollY), true);return nNewY;};var getDisplayRegionHeight=function(){if ((oMenu.cfg.getProperty(_Y) - scrollY) > nContextElY){return (nBottomRegionHeight - nViewportOffset);}else {return (nTopRegionHeight - nViewportOffset);}};var alignY=function(){var nNewY;if ((oMenu.cfg.getProperty(_Y) - scrollY) > nContextElY){nNewY=(nContextElY +nContextElHeight);}else {nNewY=(nContextElY - oMenuEl.offsetHeight);}oMenu.cfg.setProperty(_Y, (nNewY + scrollY), true);};var resetMaxHeight=function(){oMenu._setScrollHeight(this.cfg.getProperty(_MAX_HEIGHT));oMenu.hideEvent.unsubscribe(resetMaxHeight);};var setVerticalPosition=function(){var nDisplayRegionHeight=getDisplayRegionHeight(),bMenuHasItems=(oMenu.getItems().length > 0),nMenuMinScrollHeight,fnReturnVal;if (nMenuOffsetHeight > nDisplayRegionHeight){nMenuMinScrollHeight=bMenuHasItems ? oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT) : nMenuOffsetHeight;if ((nDisplayRegionHeight > nMenuMinScrollHeight) && bMenuHasItems){nMaxHeight=nDisplayRegionHeight;}else {nMaxHeight=nInitialMaxHeight;}oMenu._setScrollHeight(nMaxHeight);oMenu.hideEvent.subscribe(resetMaxHeight);alignY();if (nDisplayRegionHeight < nMenuMinScrollHeight){if (bFlipped){flipVertical();}else {flipVertical();bFlipped=true;fnReturnVal=setVerticalPosition();}}}else if (nMaxHeight && (nMaxHeight !==nInitialMaxHeight)){oMenu._setScrollHeight(nInitialMaxHeight);oMenu.hideEvent.subscribe(resetMaxHeight);alignY();}return fnReturnVal;};if (y < topConstraint || y > bottomConstraint){if (bCanConstrain){if (oMenu.cfg.getProperty(_PREVENT_CONTEXT_OVERLAP) && bPotentialContextOverlap){oContextEl=aContext[0];nContextElHeight=oContextEl.offsetHeight;nContextElY=(Dom.getY(oContextEl) - scrollY);nTopRegionHeight=nContextElY;nBottomRegionHeight=(viewPortHeight - (nContextElY + nContextElHeight));setVerticalPosition();yNew=oMenu.cfg.getProperty(_Y);}else if (!(oMenu instanceof YAHOO.widget.MenuBar) &&nMenuOffsetHeight >=viewPortHeight){nAvailableHeight=(viewPortHeight - (nViewportOffset * 2));if (nAvailableHeight > oMenu.cfg.getProperty(_MIN_SCROLL_HEIGHT)){oMenu._setScrollHeight(nAvailableHeight);oMenu.hideEvent.subscribe(resetMaxHeight);alignY();yNew=oMenu.cfg.getProperty(_Y);}}else {if (y < topConstraint){yNew=topConstraint;} else if (y > bottomConstraint){yNew=bottomConstraint;}}}else {yNew=nViewportOffset + scrollY;}}return yNew;},_onHide: function(p_sType, p_aArgs){if (this.cfg.getProperty(_POSITION)===_DYNAMIC){this.positionOffScreen();}},_onShow: function(p_sType, p_aArgs){var oParent=this.parent,oParentMenu,oElement,nOffsetWidth,sWidth;function disableAutoSubmenuDisplay(p_oEvent){var oTarget;if (p_oEvent.type==_MOUSEDOWN || (p_oEvent.type==_KEYDOWN && p_oEvent.keyCode==27)){oTarget=Event.getTarget(p_oEvent);if (oTarget !=oParentMenu.element || !Dom.isAncestor(oParentMenu.element, oTarget)){oParentMenu.cfg.setProperty(_AUTO_SUBMENU_DISPLAY, false);Event.removeListener(document, _MOUSEDOWN, disableAutoSubmenuDisplay);Event.removeListener(document, _KEYDOWN, disableAutoSubmenuDisplay);}}}function onSubmenuHide(p_sType, p_aArgs, p_sWidth){this.cfg.setProperty(_WIDTH, _EMPTY_STRING);this.hideEvent.unsubscribe(onSubmenuHide, p_sWidth);}if (oParent){oParentMenu=oParent.parent;if (!oParentMenu.cfg.getProperty(_AUTO_SUBMENU_DISPLAY) &&(oParentMenu instanceof YAHOO.widget.MenuBar ||oParentMenu.cfg.getProperty(_POSITION)==_STATIC)){oParentMenu.cfg.setProperty(_AUTO_SUBMENU_DISPLAY, true);Event.on(document, _MOUSEDOWN, disableAutoSubmenuDisplay);Event.on(document, _KEYDOWN, disableAutoSubmenuDisplay);}if ((this.cfg.getProperty("x") < oParentMenu.cfg.getProperty("x")) &&(UA.gecko && UA.gecko < 1.9) && !this.cfg.getProperty(_WIDTH)){oElement=this.element;nOffsetWidth=oElement.offsetWidth;oElement.style.width=nOffsetWidth + _PX;sWidth=(nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + _PX;this.cfg.setProperty(_WIDTH, sWidth);this.hideEvent.subscribe(onSubmenuHide, sWidth);}}if (this===this.getRoot() && this.cfg.getProperty(_POSITION)===_DYNAMIC){this._focusedElement=oFocusedElement;this.focus();}},_onBeforeHide: function(p_sType, p_aArgs){var oActiveItem=this.activeItem,oRoot=this.getRoot(),oConfig,oSubmenu;if (oActiveItem){oConfig=oActiveItem.cfg;oConfig.setProperty(_SELECTED, false);oSubmenu=oConfig.getProperty(_SUBMENU);if (oSubmenu){oSubmenu.hide();}}if (UA.ie && this.cfg.getProperty(_POSITION)===_DYNAMIC && this.parent){oRoot._hasFocus=this.hasFocus();}if (oRoot==this){oRoot.blur();}},_onParentMenuConfigChange: function(p_sType, p_aArgs, p_oSubmenu){var sPropertyName=p_aArgs[0][0],oPropertyValue=p_aArgs[0][1];switch(sPropertyName){case _IFRAME:case _CONSTRAIN_TO_VIEWPORT:case _HIDE_DELAY:case _SHOW_DELAY:case _SUBMENU_HIDE_DELAY:case _CLICK_TO_HIDE:case _EFFECT:case _CLASSNAME:case _SCROLL_INCREMENT:case _MAX_HEIGHT:case _MIN_SCROLL_HEIGHT:case _MONITOR_RESIZE:case _SHADOW:case _PREVENT_CONTEXT_OVERLAP:case _KEEP_OPEN:p_oSubmenu.cfg.setProperty(sPropertyName, oPropertyValue);break;case _SUBMENU_ALIGNMENT:if (!(this.parent.parent instanceof YAHOO.widget.MenuBar)){p_oSubmenu.cfg.setProperty(sPropertyName, oPropertyValue);} break;}},_onParentMenuRender: function(p_sType, p_aArgs, p_oSubmenu){var oParentMenu=p_oSubmenu.parent.parent,oParentCfg=oParentMenu.cfg,oConfig={constraintoviewport: oParentCfg.getProperty(_CONSTRAIN_TO_VIEWPORT),xy: [0,0],licktohide: oParentCfg.getProperty(_CLICK_TO_HIDE),effect: oParentCfg.getProperty(_EFFECT),showdelay: oParentCfg.getProperty(_SHOW_DELAY),hidedelay: oParentCfg.getProperty(_HIDE_DELAY),submenuhidedelay: oParentCfg.getProperty(_SUBMENU_HIDE_DELAY),classname: oParentCfg.getProperty(_CLASSNAME),scrollincrement: oParentCfg.getProperty(_SCROLL_INCREMENT),maxheight: oParentCfg.getProperty(_MAX_HEIGHT),minscrollheight: oParentCfg.getProperty(_MIN_SCROLL_HEIGHT),iframe: oParentCfg.getProperty(_IFRAME),shadow: oParentCfg.getProperty(_SHADOW),preventcontextoverlap: oParentCfg.getProperty(_PREVENT_CONTEXT_OVERLAP),monitorresize: oParentCfg.getProperty(_MONITOR_RESIZE),keepopen: oParentCfg.getProperty(_KEEP_OPEN)},oLI;if (!(oParentMenu instanceof YAHOO.widget.MenuBar)){oConfig[_SUBMENU_ALIGNMENT]=oParentCfg.getProperty(_SUBMENU_ALIGNMENT);}p_oSubmenu.cfg.applyConfig(oConfig);if (!this.lazyLoad){oLI=this.parent.element;if (this.element.parentNode==oLI){this.render();}else {this.render(oLI);}}},_onMenuItemDestroy: function(p_sType, p_aArgs, p_oItem){this._removeItemFromGroupByValue(p_oItem.groupIndex, p_oItem);},_onMenuItemConfigChange: function(p_sType, p_aArgs, p_oItem){var sPropertyName=p_aArgs[0][0],oPropertyValue=p_aArgs[0][1],oSubmenu;switch(sPropertyName){case _SELECTED:if (oPropertyValue===true){this.activeItem=p_oItem;}break;case _SUBMENU:oSubmenu=p_aArgs[0][1];if (oSubmenu){this._configureSubmenu(p_oItem);}break;}},configVisible: function(p_sType, p_aArgs, p_oMenu){var bVisible,sDisplay;if (this.cfg.getProperty(_POSITION)==_DYNAMIC){Menu.superclass.configVisible.call(this, p_sType, p_aArgs, p_oMenu);}else {bVisible=p_aArgs[0];sDisplay=Dom.getStyle(this.element, _DISPLAY);Dom.setStyle(this.element, _VISIBILITY, _VISIBLE);if (bVisible){if (sDisplay !=_BLOCK){this.beforeShowEvent.fire();Dom.setStyle(this.element, _DISPLAY, _BLOCK);this.showEvent.fire();}}else {if (sDisplay==_BLOCK){this.beforeHideEvent.fire();Dom.setStyle(this.element, _DISPLAY, _NONE);this.hideEvent.fire();}}}},configPosition: function(p_sType, p_aArgs, p_oMenu){var oElement=this.element,sCSSPosition=p_aArgs[0]==_STATIC ? _STATIC : _ABSOLUTE,oCfg=this.cfg,nZIndex;Dom.setStyle(oElement, _POSITION, sCSSPosition);if (sCSSPosition==_STATIC){Dom.setStyle(oElement, _DISPLAY, _BLOCK);oCfg.setProperty(_VISIBLE, true);}else {Dom.setStyle(oElement, _VISIBILITY, _HIDDEN);}if (sCSSPosition==_ABSOLUTE){nZIndex=oCfg.getProperty(_ZINDEX);if (!nZIndex || nZIndex===0){oCfg.setProperty(_ZINDEX, 1);}}},configIframe: function(p_sType, p_aArgs, p_oMenu){if (this.cfg.getProperty(_POSITION)==_DYNAMIC){Menu.superclass.configIframe.call(this, p_sType, p_aArgs, p_oMenu);}},configHideDelay: function(p_sType, p_aArgs, p_oMenu){var nHideDelay=p_aArgs[0];this._useHideDelay=(nHideDelay > 0);},configContainer: function(p_sType, p_aArgs, p_oMenu){var oElement=p_aArgs[0];if (Lang.isString(oElement)){this.cfg.setProperty(_CONTAINER, Dom.get(oElement), true);}},_clearSetWidthFlag: function(){this._widthSetForScroll=false;this.cfg.unsubscribeFromConfigEvent(_WIDTH, this._clearSetWidthFlag);},_setScrollHeight: function(p_nScrollHeight){var nScrollHeight=p_nScrollHeight,bRefireIFrameAndShadow=false,bSetWidth=false,oElement,oBody,oHeader,oFooter,fnMouseOver,fnMouseOut,nMinScrollHeight,nHeight,nOffsetWidth,sWidth;if (this.getItems().length > 0){oElement=this.element;oBody=this.body;oHeader=this.header;oFooter=this.footer;fnMouseOver=this._onScrollTargetMouseOver;fnMouseOut=this._onScrollTargetMouseOut;nMinScrollHeight=this.cfg.getProperty(_MIN_SCROLL_HEIGHT);if (nScrollHeight > 0 && nScrollHeight < nMinScrollHeight){nScrollHeight=nMinScrollHeight;}Dom.setStyle(oBody, _HEIGHT, _EMPTY_STRING);Dom.removeClass(oBody, _YUI_MENU_BODY_SCROLLED);oBody.scrollTop=0;bSetWidth=((UA.gecko && UA.gecko < 1.9) || UA.ie);if (nScrollHeight > 0 && bSetWidth && !this.cfg.getProperty(_WIDTH)){nOffsetWidth=oElement.offsetWidth;oElement.style.width=nOffsetWidth + _PX;sWidth=(nOffsetWidth - (oElement.offsetWidth - nOffsetWidth)) + _PX;this.cfg.unsubscribeFromConfigEvent(_WIDTH, this._clearSetWidthFlag);this.cfg.setProperty(_WIDTH, sWidth);this._widthSetForScroll=true;this.cfg.subscribeToConfigEvent(_WIDTH, this._clearSetWidthFlag);}if (nScrollHeight > 0 && (!oHeader && !oFooter)){this.setHeader(_NON_BREAKING_SPACE);this.setFooter(_NON_BREAKING_SPACE);oHeader=this.header;oFooter=this.footer;Dom.addClass(oHeader, _TOP_SCROLLBAR);Dom.addClass(oFooter, _BOTTOM_SCROLLBAR);oElement.insertBefore(oHeader, oBody);oElement.appendChild(oFooter);}nHeight=nScrollHeight;if (oHeader && oFooter){nHeight=(nHeight - (oHeader.offsetHeight + oFooter.offsetHeight));}if ((nHeight > 0) && (oBody.offsetHeight > nScrollHeight)){Dom.addClass(oBody, _YUI_MENU_BODY_SCROLLED);Dom.setStyle(oBody, _HEIGHT, (nHeight + _PX));if (!this._hasScrollEventHandlers){Event.on(oHeader, _MOUSEOVER, fnMouseOver, this, true);Event.on(oHeader, _MOUSEOUT, fnMouseOut, this, true);Event.on(oFooter, _MOUSEOVER, fnMouseOver, this, true);Event.on(oFooter, _MOUSEOUT, fnMouseOut, this, true);this._hasScrollEventHandlers=true;}this._disableScrollHeader();this._enableScrollFooter();bRefireIFrameAndShadow=true;}else if (oHeader && oFooter){if (this._widthSetForScroll){this._widthSetForScroll=false;this.cfg.unsubscribeFromConfigEvent(_WIDTH, this._clearSetWidthFlag);this.cfg.setProperty(_WIDTH, _EMPTY_STRING);}this._enableScrollHeader();this._enableScrollFooter();if (this._hasScrollEventHandlers){Event.removeListener(oHeader, _MOUSEOVER, fnMouseOver);Event.removeListener(oHeader, _MOUSEOUT, fnMouseOut);Event.removeListener(oFooter, _MOUSEOVER, fnMouseOver);Event.removeListener(oFooter, _MOUSEOUT, fnMouseOut);this._hasScrollEventHandlers=false;}oElement.removeChild(oHeader);oElement.removeChild(oFooter);this.header=null;this.footer=null;bRefireIFrameAndShadow=true;}if (bRefireIFrameAndShadow){this.cfg.refireEvent(_IFRAME);this.cfg.refireEvent(_SHADOW);}}},_setMaxHeight: function(p_sType, p_aArgs, p_nMaxHeight){this._setScrollHeight(p_nMaxHeight);this.renderEvent.unsubscribe(this._setMaxHeight);},configMaxHeight: function(p_sType, p_aArgs, p_oMenu){var nMaxHeight=p_aArgs[0];if (this.lazyLoad && !this.body && nMaxHeight > 0){this.renderEvent.subscribe(this._setMaxHeight, nMaxHeight, this);}else {this._setScrollHeight(nMaxHeight);}},configClassName: function(p_sType, p_aArgs, p_oMenu){var sClassName=p_aArgs[0];if (this._sClassName){Dom.removeClass(this.element, this._sClassName);}Dom.addClass(this.element, sClassName);this._sClassName=sClassName;},_onItemAdded: function(p_sType, p_aArgs){var oItem=p_aArgs[0];if (oItem){oItem.cfg.setProperty(_DISABLED, true);}},configDisabled: function(p_sType, p_aArgs, p_oMenu){var bDisabled=p_aArgs[0],aItems=this.getItems(),nItems,i;if (Lang.isArray(aItems)){nItems=aItems.length;if (nItems > 0){i=nItems - 1;do {aItems[i].cfg.setProperty(_DISABLED, bDisabled);}while (i--);}if (bDisabled){this.clearActiveItem(true);Dom.addClass(this.element, _DISABLED);this.itemAddedEvent.subscribe(this._onItemAdded);}else {Dom.removeClass(this.element, _DISABLED);this.itemAddedEvent.unsubscribe(this._onItemAdded);}}},configShadow: function(p_sType, p_aArgs, p_oMenu){var sizeShadow=function(){var oElement=this.element,oShadow=this._shadow;if (oShadow && oElement){if (oShadow.style.width && oShadow.style.height){oShadow.style.width=_EMPTY_STRING;oShadow.style.height=_EMPTY_STRING;}oShadow.style.width=(oElement.offsetWidth + 6) + _PX; oShadow.style.height=(oElement.offsetHeight + 1) + _PX;}};var replaceShadow=function(){this.element.appendChild(this._shadow);};var addShadowVisibleClass=function(){Dom.addClass(this._shadow, _YUI_MENU_SHADOW_VISIBLE);};var removeShadowVisibleClass=function(){Dom.removeClass(this._shadow, _YUI_MENU_SHADOW_VISIBLE);};var createShadow=function(){var oShadow=this._shadow, oElement; if (!oShadow){ oElement=this.element; if (!m_oShadowTemplate){ m_oShadowTemplate=document.createElement(_DIV_LOWERCASE); m_oShadowTemplate.className=_YUI_MENU_SHADOW_YUI_MENU_SHADOW_VISIBLE; } oShadow=m_oShadowTemplate.cloneNode(false); oElement.appendChild(oShadow); this._shadow=oShadow; this.beforeShowEvent.subscribe(addShadowVisibleClass); this.beforeHideEvent.subscribe(removeShadowVisibleClass); if (UA.ie){Lang.later(0, this, function(){ sizeShadow.call(this); this.syncIframe();}); this.cfg.subscribeToConfigEvent(_WIDTH, sizeShadow); this.cfg.subscribeToConfigEvent(_HEIGHT, sizeShadow); this.cfg.subscribeToConfigEvent(_MAX_HEIGHT, sizeShadow); this.changeContentEvent.subscribe(sizeShadow); Module.textResizeEvent.subscribe(sizeShadow, this, true); this.destroyEvent.subscribe(function(){ Module.textResizeEvent.unsubscribe(sizeShadow, this); }); } this.cfg.subscribeToConfigEvent(_MAX_HEIGHT, replaceShadow); } }; var onBeforeShow=function(){ if (this._shadow){replaceShadow.call(this);if (UA.ie){sizeShadow.call(this);} } else { createShadow.call(this); } this.beforeShowEvent.unsubscribe(onBeforeShow); };var bShadow=p_aArgs[0]; if (bShadow && this.cfg.getProperty(_POSITION)==_DYNAMIC){ if (this.cfg.getProperty(_VISIBLE)){if (this._shadow){replaceShadow.call(this);if (UA.ie){sizeShadow.call(this);}} else { createShadow.call(this); } } else { this.beforeShowEvent.subscribe(onBeforeShow); } } },initEvents: function(){Menu.superclass.initEvents.call(this);var i=EVENT_TYPES.length - 1,aEventData,oCustomEvent;do {aEventData=EVENT_TYPES[i];oCustomEvent=this.createEvent(aEventData[1]);oCustomEvent.signature=CustomEvent.LIST;this[aEventData[0]]=oCustomEvent;}while (i--);},positionOffScreen: function(){var oIFrame=this.iframe, oElement=this.element, sPos=this.OFF_SCREEN_POSITION; oElement.style.top=_EMPTY_STRING; oElement.style.left=_EMPTY_STRING; if (oIFrame){oIFrame.style.top=sPos;oIFrame.style.left=sPos; }},getRoot: function(){var oItem=this.parent, oParentMenu, returnVal; if (oItem){ oParentMenu=oItem.parent; returnVal=oParentMenu ? oParentMenu.getRoot() : this; } else { returnVal=this; } return returnVal;},toString: function(){var sReturnVal=_MENU, sId=this.id; if (sId){ sReturnVal +=(_SPACE + sId); } return sReturnVal;},setItemGroupTitle: function(p_sGroupTitle, p_nGroupIndex){var nGroupIndex, oTitle, i, nFirstIndex; if (Lang.isString(p_sGroupTitle) && p_sGroupTitle.length > 0){ nGroupIndex=Lang.isNumber(p_nGroupIndex) ? p_nGroupIndex : 0; oTitle=this._aGroupTitleElements[nGroupIndex]; if (oTitle){ oTitle.innerHTML=p_sGroupTitle; } else { oTitle=document.createElement(this.GROUP_TITLE_TAG_NAME); oTitle.innerHTML=p_sGroupTitle; this._aGroupTitleElements[nGroupIndex]=oTitle; } i=this._aGroupTitleElements.length - 1; do { if (this._aGroupTitleElements[i]){ Dom.removeClass(this._aGroupTitleElements[i], _FIRST_OF_TYPE); nFirstIndex=i; } } while (i--); if (nFirstIndex !==null){ Dom.addClass(this._aGroupTitleElements[nFirstIndex], _FIRST_OF_TYPE); } this.changeContentEvent.fire(); }},addItem: function(p_oItem, p_nGroupIndex){return this._addItemToGroup(p_nGroupIndex, p_oItem);},addItems: function(p_aItems, p_nGroupIndex){var nItems, aItems, oItem, i, returnVal; if (Lang.isArray(p_aItems)){ nItems=p_aItems.length; aItems=[]; for(i=0; i<nItems; i++){ oItem=p_aItems[i]; if (oItem){ if (Lang.isArray(oItem)){ aItems[aItems.length]=this.addItems(oItem, i); } else { aItems[aItems.length]=this._addItemToGroup(p_nGroupIndex, oItem); } } } if (aItems.length){ returnVal=aItems; } }return returnVal;},insertItem: function(p_oItem, p_nItemIndex, p_nGroupIndex){ return this._addItemToGroup(p_nGroupIndex, p_oItem, p_nItemIndex);},removeItem: function(p_oObject, p_nGroupIndex){var oItem, returnVal; if (!Lang.isUndefined(p_oObject)){ if (p_oObject instanceof YAHOO.widget.MenuItem){ oItem=this._removeItemFromGroupByValue(p_nGroupIndex, p_oObject); } else if (Lang.isNumber(p_oObject)){ oItem=this._removeItemFromGroupByIndex(p_nGroupIndex, p_oObject); } if (oItem){ oItem.destroy(); returnVal=oItem; } }return returnVal;},getItems: function(){var aGroups=this._aItemGroups, nGroups, returnVal, aItems=[]; if (Lang.isArray(aGroups)){ nGroups=aGroups.length; returnVal=((nGroups==1) ? aGroups[0] : (Array.prototype.concat.apply(aItems, aGroups))); }return returnVal;},getItemGroups: function(){ return this._aItemGroups;},getItem: function(p_nItemIndex, p_nGroupIndex){var aGroup, returnVal; if (Lang.isNumber(p_nItemIndex)){ aGroup=this._getItemGroup(p_nGroupIndex); if (aGroup){ returnVal=aGroup[p_nItemIndex]; } } return returnVal; },getSubmenus: function(){var aItems=this.getItems(), nItems=aItems.length, aSubmenus, oSubmenu, oItem, i; if (nItems > 0){ aSubmenus=[]; for(i=0; i<nItems; i++){ oItem=aItems[i]; if (oItem){ oSubmenu=oItem.cfg.getProperty(_SUBMENU); if (oSubmenu){ aSubmenus[aSubmenus.length]=oSubmenu; } } } } return aSubmenus;},clearContent: function(){var aItems=this.getItems(), nItems=aItems.length, oElement=this.element, oBody=this.body, oHeader=this.header, oFooter=this.footer, oItem, oSubmenu, i; if (nItems > 0){ i=nItems - 1; do { oItem=aItems[i]; if (oItem){ oSubmenu=oItem.cfg.getProperty(_SUBMENU); if (oSubmenu){ this.cfg.configChangedEvent.unsubscribe( this._onParentMenuConfigChange, oSubmenu); this.renderEvent.unsubscribe(this._onParentMenuRender, oSubmenu); } this.removeItem(oItem, oItem.groupIndex); } } while (i--); } if (oHeader){ Event.purgeElement(oHeader); oElement.removeChild(oHeader); } if (oFooter){ Event.purgeElement(oFooter); oElement.removeChild(oFooter); } if (oBody){ Event.purgeElement(oBody); oBody.innerHTML=_EMPTY_STRING; } this.activeItem=null; this._aItemGroups=[]; this._aListElements=[]; this._aGroupTitleElements=[]; this.cfg.setProperty(_WIDTH, null);},destroy: function(){ this.clearContent(); this._aItemGroups=null; this._aListElements=null; this._aGroupTitleElements=null; Menu.superclass.destroy.call(this); },setInitialFocus: function(){var oItem=this._getFirstEnabledItem(); if (oItem){ oItem.focus(); } },setInitialSelection: function(){var oItem=this._getFirstEnabledItem(); if (oItem){ oItem.cfg.setProperty(_SELECTED, true); } },clearActiveItem: function(p_bBlur){ if (this.cfg.getProperty(_SHOW_DELAY) > 0){ this._cancelShowDelay(); } var oActiveItem=this.activeItem, oConfig, oSubmenu; if (oActiveItem){ oConfig=oActiveItem.cfg; if (p_bBlur){ oActiveItem.blur(); this.getRoot()._hasFocus=true; } oConfig.setProperty(_SELECTED, false); oSubmenu=oConfig.getProperty(_SUBMENU); if (oSubmenu){ oSubmenu.hide(); } this.activeItem=null; }},focus: function(){ if (!this.hasFocus()){ this.setInitialFocus(); }},blur: function(){var oItem; if (this.hasFocus()){ oItem=MenuManager.getFocusedMenuItem(); if (oItem){ oItem.blur(); } }},hasFocus: function(){ return (MenuManager.getFocusedMenu()==this.getRoot());},_doItemSubmenuSubscribe: function(p_sType, p_aArgs, p_oObject){var oItem=p_aArgs[0], oSubmenu=oItem.cfg.getProperty(_SUBMENU); if (oSubmenu){ oSubmenu.subscribe.apply(oSubmenu, p_oObject); }},_doSubmenuSubscribe: function(p_sType, p_aArgs, p_oObject){var oSubmenu=this.cfg.getProperty(_SUBMENU); if (oSubmenu){ oSubmenu.subscribe.apply(oSubmenu, p_oObject); }},subscribe: function(){ Menu.superclass.subscribe.apply(this, arguments); Menu.superclass.subscribe.call(this, _ITEM_ADDED, this._doItemSubmenuSubscribe, arguments); var aItems=this.getItems(), nItems, oItem, oSubmenu, i; if (aItems){ nItems=aItems.length; if (nItems > 0){ i=nItems - 1; do { oItem=aItems[i]; oSubmenu=oItem.cfg.getProperty(_SUBMENU); if (oSubmenu){ oSubmenu.subscribe.apply(oSubmenu, arguments); } else { oItem.cfg.subscribeToConfigEvent(_SUBMENU, this._doSubmenuSubscribe, arguments); } } while (i--); } }},unsubscribe: function(){ Menu.superclass.unsubscribe.apply(this, arguments); Menu.superclass.unsubscribe.call(this, _ITEM_ADDED, this._doItemSubmenuSubscribe, arguments); var aItems=this.getItems(), nItems, oItem, oSubmenu, i; if (aItems){ nItems=aItems.length; if (nItems > 0){ i=nItems - 1; do { oItem=aItems[i]; oSubmenu=oItem.cfg.getProperty(_SUBMENU); if (oSubmenu){ oSubmenu.unsubscribe.apply(oSubmenu, arguments); } else { oItem.cfg.unsubscribeFromConfigEvent(_SUBMENU, this._doSubmenuSubscribe, arguments); } } while (i--); } }},initDefaultConfig: function(){ Menu.superclass.initDefaultConfig.call(this); var oConfig=this.cfg; oConfig.addProperty( VISIBLE_CONFIG.key, { handler: this.configVisible, value: VISIBLE_CONFIG.value, validator: VISIBLE_CONFIG.validator } ); oConfig.addProperty( CONSTRAIN_TO_VIEWPORT_CONFIG.key, { handler: this.configConstrainToViewport, value: CONSTRAIN_TO_VIEWPORT_CONFIG.value, validator: CONSTRAIN_TO_VIEWPORT_CONFIG.validator, supercedes: CONSTRAIN_TO_VIEWPORT_CONFIG.supercedes } );oConfig.addProperty(PREVENT_CONTEXT_OVERLAP_CONFIG.key, {value: PREVENT_CONTEXT_OVERLAP_CONFIG.value, validator: PREVENT_CONTEXT_OVERLAP_CONFIG.validator, supercedes: PREVENT_CONTEXT_OVERLAP_CONFIG.supercedes}); oConfig.addProperty( POSITION_CONFIG.key, { handler: this.configPosition, value: POSITION_CONFIG.value, validator: POSITION_CONFIG.validator, supercedes: POSITION_CONFIG.supercedes } ); oConfig.addProperty( SUBMENU_ALIGNMENT_CONFIG.key, { value: SUBMENU_ALIGNMENT_CONFIG.value, suppressEvent: SUBMENU_ALIGNMENT_CONFIG.suppressEvent } );oConfig.addProperty( AUTO_SUBMENU_DISPLAY_CONFIG.key, { value: AUTO_SUBMENU_DISPLAY_CONFIG.value, validator: AUTO_SUBMENU_DISPLAY_CONFIG.validator, suppressEvent: AUTO_SUBMENU_DISPLAY_CONFIG.suppressEvent } );oConfig.addProperty( SHOW_DELAY_CONFIG.key, { value: SHOW_DELAY_CONFIG.value, validator: SHOW_DELAY_CONFIG.validator, suppressEvent: SHOW_DELAY_CONFIG.suppressEvent } );oConfig.addProperty( HIDE_DELAY_CONFIG.key, { handler: this.configHideDelay, value: HIDE_DELAY_CONFIG.value, validator: HIDE_DELAY_CONFIG.validator, suppressEvent: HIDE_DELAY_CONFIG.suppressEvent } );oConfig.addProperty( SUBMENU_HIDE_DELAY_CONFIG.key, { value: SUBMENU_HIDE_DELAY_CONFIG.value, validator: SUBMENU_HIDE_DELAY_CONFIG.validator, suppressEvent: SUBMENU_HIDE_DELAY_CONFIG.suppressEvent } ); oConfig.addProperty( CLICK_TO_HIDE_CONFIG.key, { value: CLICK_TO_HIDE_CONFIG.value, validator: CLICK_TO_HIDE_CONFIG.validator, suppressEvent: CLICK_TO_HIDE_CONFIG.suppressEvent } );oConfig.addProperty( CONTAINER_CONFIG.key, { handler: this.configContainer, value: document.body, suppressEvent: CONTAINER_CONFIG.suppressEvent } ); oConfig.addProperty( SCROLL_INCREMENT_CONFIG.key, { value: SCROLL_INCREMENT_CONFIG.value, validator: SCROLL_INCREMENT_CONFIG.validator, supercedes: SCROLL_INCREMENT_CONFIG.supercedes, suppressEvent: SCROLL_INCREMENT_CONFIG.suppressEvent } ); oConfig.addProperty( MIN_SCROLL_HEIGHT_CONFIG.key, { value: MIN_SCROLL_HEIGHT_CONFIG.value, validator: MIN_SCROLL_HEIGHT_CONFIG.validator, supercedes: MIN_SCROLL_HEIGHT_CONFIG.supercedes, suppressEvent: MIN_SCROLL_HEIGHT_CONFIG.suppressEvent } ); oConfig.addProperty( MAX_HEIGHT_CONFIG.key, { handler: this.configMaxHeight, value: MAX_HEIGHT_CONFIG.value, validator: MAX_HEIGHT_CONFIG.validator, suppressEvent: MAX_HEIGHT_CONFIG.suppressEvent, supercedes: MAX_HEIGHT_CONFIG.supercedes } ); oConfig.addProperty( CLASS_NAME_CONFIG.key, { handler: this.configClassName, value: CLASS_NAME_CONFIG.value, validator: CLASS_NAME_CONFIG.validator, supercedes: CLASS_NAME_CONFIG.supercedes } ); oConfig.addProperty( DISABLED_CONFIG.key, { handler: this.configDisabled, value: DISABLED_CONFIG.value, validator: DISABLED_CONFIG.validator, suppressEvent: DISABLED_CONFIG.suppressEvent } ); oConfig.addProperty( SHADOW_CONFIG.key, { handler: this.configShadow, value: SHADOW_CONFIG.value, validator: SHADOW_CONFIG.validator } ); oConfig.addProperty( KEEP_OPEN_CONFIG.key, { value: KEEP_OPEN_CONFIG.value, validator: KEEP_OPEN_CONFIG.validator } );}}); })();(function(){YAHOO.widget.MenuItem=function(p_oObject, p_oConfig){ if (p_oObject){ if (p_oConfig){ this.parent=p_oConfig.parent; this.value=p_oConfig.value; this.id=p_oConfig.id; } this.init(p_oObject, p_oConfig); }};var Dom=YAHOO.util.Dom, Module=YAHOO.widget.Module, Menu=YAHOO.widget.Menu, MenuItem=YAHOO.widget.MenuItem, CustomEvent=YAHOO.util.CustomEvent, UA=YAHOO.env.ua, Lang=YAHOO.lang,_TEXT="text",_HASH="#",_HYPHEN="-",_HELP_TEXT="helptext",_URL="url",_TARGET="target",_EMPHASIS="emphasis",_STRONG_EMPHASIS="strongemphasis",_CHECKED="checked",_SUBMENU="submenu",_DISABLED="disabled",_SELECTED="selected",_HAS_SUBMENU="hassubmenu",_CHECKED_DISABLED="checked-disabled",_HAS_SUBMENU_DISABLED="hassubmenu-disabled",_HAS_SUBMENU_SELECTED="hassubmenu-selected",_CHECKED_SELECTED="checked-selected",_ONCLICK="onclick",_CLASSNAME="classname",_EMPTY_STRING="",_OPTION="OPTION",_OPTGROUP="OPTGROUP",_LI_UPPERCASE="LI",_HREF="href",_SELECT="SELECT",_DIV="DIV",_START_HELP_TEXT="<em class=\"helptext\">",_START_EM="<em>",_END_EM="</em>",_START_STRONG="<strong>",_END_STRONG="</strong>",_PREVENT_CONTEXT_OVERLAP="preventcontextoverlap",_OBJ="obj",_SCOPE="scope",_NONE="none",_VISIBLE="visible",_SPACE=" ",_MENUITEM="MenuItem",_CLICK="click",_SHOW="show",_HIDE="hide",_LI_LOWERCASE="li",_ANCHOR_TEMPLATE="<a href=\"#\"></a>", EVENT_TYPES=[ ["mouseOverEvent", "mouseover"], ["mouseOutEvent", "mouseout"], ["mouseDownEvent", "mousedown"], ["mouseUpEvent", "mouseup"], ["clickEvent", _CLICK], ["keyPressEvent", "keypress"], ["keyDownEvent", "keydown"], ["keyUpEvent", "keyup"], ["focusEvent", "focus"], ["blurEvent", "blur"], ["destroyEvent", "destroy"] ],TEXT_CONFIG={ key: _TEXT, value: _EMPTY_STRING, validator: Lang.isString, suppressEvent: true }, HELP_TEXT_CONFIG={ key: _HELP_TEXT,supercedes: [_TEXT], suppressEvent: true },URL_CONFIG={ key: _URL, value: _HASH, suppressEvent: true }, TARGET_CONFIG={ key: _TARGET, suppressEvent: true }, EMPHASIS_CONFIG={ key: _EMPHASIS, value: false, validator: Lang.isBoolean, suppressEvent: true, supercedes: [_TEXT]}, STRONG_EMPHASIS_CONFIG={ key: _STRONG_EMPHASIS, value: false, validator: Lang.isBoolean, suppressEvent: true,supercedes: [_TEXT]},CHECKED_CONFIG={ key: _CHECKED, value: false, validator: Lang.isBoolean, suppressEvent: true, supercedes: [_DISABLED, _SELECTED]}, SUBMENU_CONFIG={ key: _SUBMENU,suppressEvent: true,supercedes: [_DISABLED, _SELECTED]},DISABLED_CONFIG={ key: _DISABLED, value: false, validator: Lang.isBoolean, suppressEvent: true,supercedes: [_TEXT, _SELECTED]},SELECTED_CONFIG={ key: _SELECTED, value: false, validator: Lang.isBoolean, suppressEvent: true},ONCLICK_CONFIG={ key: _ONCLICK,suppressEvent: true},CLASS_NAME_CONFIG={ key: _CLASSNAME, value: null, validator: Lang.isString,suppressEvent: true}, KEY_LISTENER_CONFIG={key: "keylistener", value: null, suppressEvent: true},m_oMenuItemTemplate=null, CLASS_NAMES={};var getClassNameForState=function(prefix, state){var oClassNames=CLASS_NAMES[prefix];if (!oClassNames){CLASS_NAMES[prefix]={};oClassNames=CLASS_NAMES[prefix];}var sClassName=oClassNames[state];if (!sClassName){sClassName=prefix + _HYPHEN + state;oClassNames[state]=sClassName;}return sClassName;};var addClassNameForState=function(state){Dom.addClass(this.element, getClassNameForState(this.CSS_CLASS_NAME, state));Dom.addClass(this._oAnchor, getClassNameForState(this.CSS_LABEL_CLASS_NAME, state));};var removeClassNameForState=function(state){Dom.removeClass(this.element, getClassNameForState(this.CSS_CLASS_NAME, state));Dom.removeClass(this._oAnchor, getClassNameForState(this.CSS_LABEL_CLASS_NAME, state));};MenuItem.prototype={ CSS_CLASS_NAME: "yuimenuitem", CSS_LABEL_CLASS_NAME: "yuimenuitemlabel", SUBMENU_TYPE: null, _oAnchor: null, _oHelpTextEM: null, _oSubmenu: null, _oOnclickAttributeValue: null, _sClassName: null,constructor: MenuItem, index: null, groupIndex: null, parent: null, element: null, srcElement: null, value: null,browser: Module.prototype.browser, id: null, init: function(p_oObject, p_oConfig){ if (!this.SUBMENU_TYPE){ this.SUBMENU_TYPE=Menu; } this.cfg=new YAHOO.util.Config(this); this.initDefaultConfig(); var oConfig=this.cfg, sURL=_HASH, oCustomEvent,aEventData, oAnchor, sTarget, sText, sId, i; if (Lang.isString(p_oObject)){ this._createRootNodeStructure(); oConfig.queueProperty(_TEXT, p_oObject); } else if (p_oObject && p_oObject.tagName){ switch(p_oObject.tagName.toUpperCase()){ case _OPTION: this._createRootNodeStructure(); oConfig.queueProperty(_TEXT, p_oObject.text); oConfig.queueProperty(_DISABLED, p_oObject.disabled); this.value=p_oObject.value; this.srcElement=p_oObject; break; case _OPTGROUP: this._createRootNodeStructure(); oConfig.queueProperty(_TEXT, p_oObject.label); oConfig.queueProperty(_DISABLED, p_oObject.disabled); this.srcElement=p_oObject; this._initSubTree(); break; case _LI_UPPERCASE: oAnchor=Dom.getFirstChild(p_oObject); if (oAnchor){ sURL=oAnchor.getAttribute(_HREF, 2); sTarget=oAnchor.getAttribute(_TARGET); sText=oAnchor.innerHTML; } this.srcElement=p_oObject; this.element=p_oObject; this._oAnchor=oAnchor; oConfig.setProperty(_TEXT, sText, true); oConfig.setProperty(_URL, sURL, true); oConfig.setProperty(_TARGET, sTarget, true); this._initSubTree(); break; } } if (this.element){ sId=(this.srcElement || this.element).id; if (!sId){ sId=this.id || Dom.generateId(); this.element.id=sId; } this.id=sId; Dom.addClass(this.element, this.CSS_CLASS_NAME); Dom.addClass(this._oAnchor, this.CSS_LABEL_CLASS_NAME);i=EVENT_TYPES.length - 1;do {aEventData=EVENT_TYPES[i];oCustomEvent=this.createEvent(aEventData[1]);oCustomEvent.signature=CustomEvent.LIST;this[aEventData[0]]=oCustomEvent;}while (i--); if (p_oConfig){ oConfig.applyConfig(p_oConfig); } oConfig.fireQueue(); } }, _createRootNodeStructure: function(){var oElement, oAnchor; if (!m_oMenuItemTemplate){ m_oMenuItemTemplate=document.createElement(_LI_LOWERCASE); m_oMenuItemTemplate.innerHTML=_ANCHOR_TEMPLATE; } oElement=m_oMenuItemTemplate.cloneNode(true); oElement.className=this.CSS_CLASS_NAME; oAnchor=oElement.firstChild; oAnchor.className=this.CSS_LABEL_CLASS_NAME; this.element=oElement; this._oAnchor=oAnchor; }, _initSubTree: function(){var oSrcEl=this.srcElement, oConfig=this.cfg, oNode, aOptions, nOptions, oMenu, n; if (oSrcEl.childNodes.length > 0){ if (this.parent.lazyLoad && this.parent.srcElement && this.parent.srcElement.tagName.toUpperCase()==_SELECT){ oConfig.setProperty( _SUBMENU, { id: Dom.generateId(), itemdata: oSrcEl.childNodes } ); } else { oNode=oSrcEl.firstChild; aOptions=[]; do { if (oNode && oNode.tagName){ switch(oNode.tagName.toUpperCase()){ case _DIV: oConfig.setProperty(_SUBMENU, oNode); break; case _OPTION: aOptions[aOptions.length]=oNode; break; } } } while((oNode=oNode.nextSibling)); nOptions=aOptions.length; if (nOptions > 0){ oMenu=new this.SUBMENU_TYPE(Dom.generateId()); oConfig.setProperty(_SUBMENU, oMenu); for(n=0; n<nOptions; n++){ oMenu.addItem((new oMenu.ITEM_TYPE(aOptions[n]))); } } } } }, configText: function(p_sType, p_aArgs, p_oItem){var sText=p_aArgs[0], oConfig=this.cfg, oAnchor=this._oAnchor, sHelpText=oConfig.getProperty(_HELP_TEXT), sHelpTextHTML=_EMPTY_STRING, sEmphasisStartTag=_EMPTY_STRING, sEmphasisEndTag=_EMPTY_STRING; if (sText){ if (sHelpText){ sHelpTextHTML=_START_HELP_TEXT + sHelpText + _END_EM; } if (oConfig.getProperty(_EMPHASIS)){ sEmphasisStartTag=_START_EM; sEmphasisEndTag=_END_EM; } if (oConfig.getProperty(_STRONG_EMPHASIS)){ sEmphasisStartTag=_START_STRONG; sEmphasisEndTag=_END_STRONG; } oAnchor.innerHTML=(sEmphasisStartTag + sText + sEmphasisEndTag + sHelpTextHTML); } }, configHelpText: function(p_sType, p_aArgs, p_oItem){ this.cfg.refireEvent(_TEXT); }, configURL: function(p_sType, p_aArgs, p_oItem){var sURL=p_aArgs[0]; if (!sURL){ sURL=_HASH; } var oAnchor=this._oAnchor; if (UA.opera){ oAnchor.removeAttribute(_HREF); } oAnchor.setAttribute(_HREF, sURL); }, configTarget: function(p_sType, p_aArgs, p_oItem){var sTarget=p_aArgs[0], oAnchor=this._oAnchor; if (sTarget && sTarget.length > 0){ oAnchor.setAttribute(_TARGET, sTarget); } else { oAnchor.removeAttribute(_TARGET); } }, configEmphasis: function(p_sType, p_aArgs, p_oItem){var bEmphasis=p_aArgs[0], oConfig=this.cfg; if (bEmphasis && oConfig.getProperty(_STRONG_EMPHASIS)){ oConfig.setProperty(_STRONG_EMPHASIS, false); } oConfig.refireEvent(_TEXT); }, configStrongEmphasis: function(p_sType, p_aArgs, p_oItem){var bStrongEmphasis=p_aArgs[0], oConfig=this.cfg; if (bStrongEmphasis && oConfig.getProperty(_EMPHASIS)){ oConfig.setProperty(_EMPHASIS, false); } oConfig.refireEvent(_TEXT); }, configChecked: function(p_sType, p_aArgs, p_oItem){var bChecked=p_aArgs[0], oConfig=this.cfg; if (bChecked){ addClassNameForState.call(this, _CHECKED); } else { removeClassNameForState.call(this, _CHECKED); } oConfig.refireEvent(_TEXT); if (oConfig.getProperty(_DISABLED)){ oConfig.refireEvent(_DISABLED); } if (oConfig.getProperty(_SELECTED)){ oConfig.refireEvent(_SELECTED); } }, configDisabled: function(p_sType, p_aArgs, p_oItem){var bDisabled=p_aArgs[0], oConfig=this.cfg, oSubmenu=oConfig.getProperty(_SUBMENU), bChecked=oConfig.getProperty(_CHECKED); if (bDisabled){ if (oConfig.getProperty(_SELECTED)){ oConfig.setProperty(_SELECTED, false); }addClassNameForState.call(this, _DISABLED); if (oSubmenu){addClassNameForState.call(this, _HAS_SUBMENU_DISABLED); } if (bChecked){addClassNameForState.call(this, _CHECKED_DISABLED); } } else {removeClassNameForState.call(this, _DISABLED); if (oSubmenu){removeClassNameForState.call(this, _HAS_SUBMENU_DISABLED); } if (bChecked){removeClassNameForState.call(this, _CHECKED_DISABLED); } } }, configSelected: function(p_sType, p_aArgs, p_oItem){var oConfig=this.cfg, oAnchor=this._oAnchor, bSelected=p_aArgs[0], bChecked=oConfig.getProperty(_CHECKED), oSubmenu=oConfig.getProperty(_SUBMENU); if (UA.opera){ oAnchor.blur(); } if (bSelected && !oConfig.getProperty(_DISABLED)){addClassNameForState.call(this, _SELECTED); if (oSubmenu){addClassNameForState.call(this, _HAS_SUBMENU_SELECTED); } if (bChecked){addClassNameForState.call(this, _CHECKED_SELECTED); } } else {removeClassNameForState.call(this, _SELECTED); if (oSubmenu){removeClassNameForState.call(this, _HAS_SUBMENU_SELECTED); } if (bChecked){removeClassNameForState.call(this, _CHECKED_SELECTED); } } if (this.hasFocus() && UA.opera){ oAnchor.focus(); } }, _onSubmenuBeforeHide: function(p_sType, p_aArgs){var oItem=this.parent, oMenu; function onHide(){ oItem._oAnchor.blur(); oMenu.beforeHideEvent.unsubscribe(onHide); } if (oItem.hasFocus()){ oMenu=oItem.parent; oMenu.beforeHideEvent.subscribe(onHide); } }, configSubmenu: function(p_sType, p_aArgs, p_oItem){var oSubmenu=p_aArgs[0], oConfig=this.cfg, bLazyLoad=this.parent && this.parent.lazyLoad, oMenu, sSubmenuId, oSubmenuConfig; if (oSubmenu){ if (oSubmenu instanceof Menu){ oMenu=oSubmenu; oMenu.parent=this; oMenu.lazyLoad=bLazyLoad; } else if (Lang.isObject(oSubmenu) && oSubmenu.id && !oSubmenu.nodeType){ sSubmenuId=oSubmenu.id; oSubmenuConfig=oSubmenu; oSubmenuConfig.lazyload=bLazyLoad; oSubmenuConfig.parent=this; oMenu=new this.SUBMENU_TYPE(sSubmenuId, oSubmenuConfig); oConfig.setProperty(_SUBMENU, oMenu, true); } else { oMenu=new this.SUBMENU_TYPE(oSubmenu, { lazyload: bLazyLoad, parent: this }); oConfig.setProperty(_SUBMENU, oMenu, true); } if (oMenu){oMenu.cfg.setProperty(_PREVENT_CONTEXT_OVERLAP, true); addClassNameForState.call(this, _HAS_SUBMENU);if (oConfig.getProperty(_URL)===_HASH){oConfig.setProperty(_URL, (_HASH + oMenu.id));} this._oSubmenu=oMenu; if (UA.opera){ oMenu.beforeHideEvent.subscribe(this._onSubmenuBeforeHide); } } } else {removeClassNameForState.call(this, _HAS_SUBMENU); if (this._oSubmenu){ this._oSubmenu.destroy(); } } if (oConfig.getProperty(_DISABLED)){ oConfig.refireEvent(_DISABLED); } if (oConfig.getProperty(_SELECTED)){ oConfig.refireEvent(_SELECTED); } }, configOnClick: function(p_sType, p_aArgs, p_oItem){var oObject=p_aArgs[0]; if (this._oOnclickAttributeValue && (this._oOnclickAttributeValue !=oObject)){ this.clickEvent.unsubscribe(this._oOnclickAttributeValue.fn, this._oOnclickAttributeValue.obj); this._oOnclickAttributeValue=null; } if (!this._oOnclickAttributeValue && Lang.isObject(oObject) && Lang.isFunction(oObject.fn)){ this.clickEvent.subscribe(oObject.fn, ((_OBJ in oObject) ? oObject.obj : this), ((_SCOPE in oObject) ? oObject.scope : null) ); this._oOnclickAttributeValue=oObject; } }, configClassName: function(p_sType, p_aArgs, p_oItem){var sClassName=p_aArgs[0]; if (this._sClassName){ Dom.removeClass(this.element, this._sClassName); } Dom.addClass(this.element, sClassName); this._sClassName=sClassName; },_dispatchClickEvent: function(){var oMenuItem=this,oAnchor,oEvent;if (!oMenuItem.cfg.getProperty(_DISABLED)){oAnchor=Dom.getFirstChild(oMenuItem.element);if (UA.ie){oAnchor.fireEvent(_ONCLICK);}else {if ((UA.gecko && UA.gecko >=1.9) || UA.opera || UA.webkit){oEvent=document.createEvent("HTMLEvents");oEvent.initEvent(_CLICK, true, true);}else {oEvent=document.createEvent("MouseEvents");oEvent.initMouseEvent(_CLICK, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);}oAnchor.dispatchEvent(oEvent);}}},_createKeyListener: function(type, args, keyData){var oMenuItem=this,oMenu=oMenuItem.parent;var oKeyListener=new YAHOO.util.KeyListener(oMenu.element.ownerDocument, keyData, {fn: oMenuItem._dispatchClickEvent, scope: oMenuItem, correctScope: true });if (oMenu.cfg.getProperty(_VISIBLE)){oKeyListener.enable();}oMenu.subscribe(_SHOW, oKeyListener.enable, null, oKeyListener);oMenu.subscribe(_HIDE, oKeyListener.disable, null, oKeyListener);oMenuItem._keyListener=oKeyListener;oMenu.unsubscribe(_SHOW, oMenuItem._createKeyListener, keyData);}, configKeyListener: function(p_sType, p_aArgs){var oKeyData=p_aArgs[0],oMenuItem=this,oMenu=oMenuItem.parent;if (oMenuItem._keyData){oMenu.unsubscribe(_SHOW, oMenuItem._createKeyListener, oMenuItem._keyData);oMenuItem._keyData=null;}if (oMenuItem._keyListener){oMenu.unsubscribe(_SHOW, oMenuItem._keyListener.enable);oMenu.unsubscribe(_HIDE, oMenuItem._keyListener.disable);oMenuItem._keyListener.disable();oMenuItem._keyListener=null;} if (oKeyData){oMenuItem._keyData=oKeyData;oMenu.subscribe(_SHOW, oMenuItem._createKeyListener, oKeyData, oMenuItem);} },initDefaultConfig : function(){var oConfig=this.cfg; oConfig.addProperty( TEXT_CONFIG.key, { handler: this.configText, value: TEXT_CONFIG.value, validator: TEXT_CONFIG.validator, suppressEvent: TEXT_CONFIG.suppressEvent } ); oConfig.addProperty( HELP_TEXT_CONFIG.key, { handler: this.configHelpText, supercedes: HELP_TEXT_CONFIG.supercedes, suppressEvent: HELP_TEXT_CONFIG.suppressEvent } ); oConfig.addProperty( URL_CONFIG.key, { handler: this.configURL, value: URL_CONFIG.value, suppressEvent: URL_CONFIG.suppressEvent } ); oConfig.addProperty( TARGET_CONFIG.key, { handler: this.configTarget, suppressEvent: TARGET_CONFIG.suppressEvent } ); oConfig.addProperty( EMPHASIS_CONFIG.key, { handler: this.configEmphasis, value: EMPHASIS_CONFIG.value, validator: EMPHASIS_CONFIG.validator, suppressEvent: EMPHASIS_CONFIG.suppressEvent, supercedes: EMPHASIS_CONFIG.supercedes } ); oConfig.addProperty( STRONG_EMPHASIS_CONFIG.key, { handler: this.configStrongEmphasis, value: STRONG_EMPHASIS_CONFIG.value, validator: STRONG_EMPHASIS_CONFIG.validator, suppressEvent: STRONG_EMPHASIS_CONFIG.suppressEvent, supercedes: STRONG_EMPHASIS_CONFIG.supercedes } ); oConfig.addProperty( CHECKED_CONFIG.key, { handler: this.configChecked, value: CHECKED_CONFIG.value, validator: CHECKED_CONFIG.validator, suppressEvent: CHECKED_CONFIG.suppressEvent, supercedes: CHECKED_CONFIG.supercedes } ); oConfig.addProperty( DISABLED_CONFIG.key, { handler: this.configDisabled, value: DISABLED_CONFIG.value, validator: DISABLED_CONFIG.validator, suppressEvent: DISABLED_CONFIG.suppressEvent } ); oConfig.addProperty( SELECTED_CONFIG.key, { handler: this.configSelected, value: SELECTED_CONFIG.value, validator: SELECTED_CONFIG.validator, suppressEvent: SELECTED_CONFIG.suppressEvent } ); oConfig.addProperty( SUBMENU_CONFIG.key, { handler: this.configSubmenu, supercedes: SUBMENU_CONFIG.supercedes, suppressEvent: SUBMENU_CONFIG.suppressEvent } ); oConfig.addProperty( ONCLICK_CONFIG.key, { handler: this.configOnClick, suppressEvent: ONCLICK_CONFIG.suppressEvent } ); oConfig.addProperty( CLASS_NAME_CONFIG.key, { handler: this.configClassName, value: CLASS_NAME_CONFIG.value, validator: CLASS_NAME_CONFIG.validator, suppressEvent: CLASS_NAME_CONFIG.suppressEvent } ); oConfig.addProperty( KEY_LISTENER_CONFIG.key, { handler: this.configKeyListener, value: KEY_LISTENER_CONFIG.value, suppressEvent: KEY_LISTENER_CONFIG.suppressEvent } );},getNextSibling: function(){var isUL=function(el){return (el.nodeName.toLowerCase()==="ul");},menuitemEl=this.element,next=Dom.getNextSibling(menuitemEl),parent,sibling,list;if (!next){parent=menuitemEl.parentNode;sibling=Dom.getNextSiblingBy(parent, isUL);if (sibling){list=sibling;}else {list=Dom.getFirstChildBy(parent.parentNode, isUL);}next=Dom.getFirstChild(list);}return YAHOO.widget.MenuManager.getMenuItem(next.id);},getNextEnabledSibling: function(){var next=this.getNextSibling(); return (next.cfg.getProperty(_DISABLED) || next.element.style.display==_NONE) ? next.getNextEnabledSibling() : next;},getPreviousSibling: function(){var isUL=function(el){return (el.nodeName.toLowerCase()==="ul");},menuitemEl=this.element,next=Dom.getPreviousSibling(menuitemEl),parent,sibling,list;if (!next){parent=menuitemEl.parentNode;sibling=Dom.getPreviousSiblingBy(parent, isUL);if (sibling){list=sibling;}else {list=Dom.getLastChildBy(parent.parentNode, isUL);}next=Dom.getLastChild(list);}return YAHOO.widget.MenuManager.getMenuItem(next.id);},getPreviousEnabledSibling: function(){var next=this.getPreviousSibling(); return (next.cfg.getProperty(_DISABLED) || next.element.style.display==_NONE) ? next.getPreviousEnabledSibling() : next;}, focus: function(){var oParent=this.parent, oAnchor=this._oAnchor, oActiveItem=oParent.activeItem; function setFocus(){ try { if (!(UA.ie && !document.hasFocus())){ if (oActiveItem){oActiveItem.blurEvent.fire();}oAnchor.focus();this.focusEvent.fire(); } } catch(e){ } } if (!this.cfg.getProperty(_DISABLED) && oParent && oParent.cfg.getProperty(_VISIBLE) && this.element.style.display !=_NONE){ Lang.later(0, this, setFocus); } }, blur: function(){var oParent=this.parent; if (!this.cfg.getProperty(_DISABLED) && oParent && oParent.cfg.getProperty(_VISIBLE)){ Lang.later(0, this, function(){ try { this._oAnchor.blur(); this.blurEvent.fire(); } catch (e){ } }, 0); } }, hasFocus: function(){ return (YAHOO.widget.MenuManager.getFocusedMenuItem()==this); }, destroy: function(){var oEl=this.element, oSubmenu, oParentNode, aEventData, i; if (oEl){ oSubmenu=this.cfg.getProperty(_SUBMENU); if (oSubmenu){ oSubmenu.destroy(); } oParentNode=oEl.parentNode; if (oParentNode){ oParentNode.removeChild(oEl); this.destroyEvent.fire(); }i=EVENT_TYPES.length - 1;do {aEventData=EVENT_TYPES[i];this[aEventData[0]].unsubscribeAll();}while (i--); this.cfg.configChangedEvent.unsubscribeAll(); } }, toString: function(){var sReturnVal=_MENUITEM, sId=this.id; if (sId){ sReturnVal +=(_SPACE + sId); } return sReturnVal; }};Lang.augmentProto(MenuItem, YAHOO.util.EventProvider);})();(function(){var _XY="xy",_MOUSEDOWN="mousedown",_CONTEXTMENU="ContextMenu",_SPACE=" ";YAHOO.widget.ContextMenu=function(p_oElement, p_oConfig){ YAHOO.widget.ContextMenu.superclass.constructor.call(this, p_oElement, p_oConfig);};var Event=YAHOO.util.Event,UA=YAHOO.env.ua, ContextMenu=YAHOO.widget.ContextMenu, EVENT_TYPES={ "TRIGGER_CONTEXT_MENU": "triggerContextMenu", "CONTEXT_MENU": (UA.opera ? _MOUSEDOWN : "contextmenu"), "CLICK": "click" }, TRIGGER_CONFIG={ key: "trigger",suppressEvent: true };function position(p_sType, p_aArgs, p_aPos){ this.cfg.setProperty(_XY, p_aPos); this.beforeShowEvent.unsubscribe(position, p_aPos);}YAHOO.lang.extend(ContextMenu, YAHOO.widget.Menu, {_oTrigger: null,_bCancelled: false,contextEventTarget: null,triggerContextMenuEvent: null,init: function(p_oElement, p_oConfig){ ContextMenu.superclass.init.call(this, p_oElement); this.beforeInitEvent.fire(ContextMenu); if (p_oConfig){ this.cfg.applyConfig(p_oConfig, true); } this.initEvent.fire(ContextMenu); },initEvents: function(){ContextMenu.superclass.initEvents.call(this); this.triggerContextMenuEvent=this.createEvent(EVENT_TYPES.TRIGGER_CONTEXT_MENU); this.triggerContextMenuEvent.signature=YAHOO.util.CustomEvent.LIST;},cancel: function(){ this._bCancelled=true;},_removeEventHandlers: function(){var oTrigger=this._oTrigger; if (oTrigger){ Event.removeListener(oTrigger, EVENT_TYPES.CONTEXT_MENU, this._onTriggerContextMenu); if (UA.opera){ Event.removeListener(oTrigger, EVENT_TYPES.CLICK, this._onTriggerClick); } }},_onTriggerClick: function(p_oEvent, p_oMenu){ if (p_oEvent.ctrlKey){ Event.stopEvent(p_oEvent); } },_onTriggerContextMenu: function(p_oEvent, p_oMenu){var aXY; if (!(p_oEvent.type==_MOUSEDOWN && !p_oEvent.ctrlKey)){this.contextEventTarget=Event.getTarget(p_oEvent);this.triggerContextMenuEvent.fire(p_oEvent);if (!this._bCancelled){Event.stopEvent(p_oEvent);YAHOO.widget.MenuManager.hideVisible();aXY=Event.getXY(p_oEvent);if (!YAHOO.util.Dom.inDocument(this.element)){this.beforeShowEvent.subscribe(position, aXY);}else {this.cfg.setProperty(_XY, aXY);}this.show();}this._bCancelled=false; }},toString: function(){var sReturnVal=_CONTEXTMENU, sId=this.id; if (sId){ sReturnVal +=(_SPACE + sId); } return sReturnVal;},initDefaultConfig: function(){ ContextMenu.superclass.initDefaultConfig.call(this); this.cfg.addProperty(TRIGGER_CONFIG.key, { handler: this.configTrigger, suppressEvent: TRIGGER_CONFIG.suppressEvent } );},destroy: function(){ this._removeEventHandlers(); ContextMenu.superclass.destroy.call(this);},configTrigger: function(p_sType, p_aArgs, p_oMenu){var oTrigger=p_aArgs[0]; if (oTrigger){ if (this._oTrigger){ this._removeEventHandlers(); } this._oTrigger=oTrigger; Event.on(oTrigger, EVENT_TYPES.CONTEXT_MENU, this._onTriggerContextMenu, this, true); if (UA.opera){ Event.on(oTrigger, EVENT_TYPES.CLICK, this._onTriggerClick, this, true); } } else { this._removeEventHandlers(); } }});}());YAHOO.widget.ContextMenuItem=YAHOO.widget.MenuItem;(function(){var Lang=YAHOO.lang,_STATIC="static",_DYNAMIC_STATIC="dynamic," + _STATIC,_DISABLED="disabled",_SELECTED="selected",_AUTO_SUBMENU_DISPLAY="autosubmenudisplay",_SUBMENU="submenu",_VISIBLE="visible",_SPACE=" ",_SUBMENU_TOGGLE_REGION="submenutoggleregion",_MENUBAR="MenuBar";YAHOO.widget.MenuBar=function(p_oElement, p_oConfig){ YAHOO.widget.MenuBar.superclass.constructor.call(this, p_oElement, p_oConfig);};function checkPosition(p_sPosition){var returnVal=false; if (Lang.isString(p_sPosition)){ returnVal=(_DYNAMIC_STATIC.indexOf((p_sPosition.toLowerCase())) !=-1); } return returnVal;}var Event=YAHOO.util.Event, MenuBar=YAHOO.widget.MenuBar, POSITION_CONFIG={ key: "position", value: _STATIC, validator: checkPosition, supercedes: [_VISIBLE] }, SUBMENU_ALIGNMENT_CONFIG={ key: "submenualignment", value: ["tl","bl"]},AUTO_SUBMENU_DISPLAY_CONFIG={ key: _AUTO_SUBMENU_DISPLAY, value: false, validator: Lang.isBoolean,suppressEvent: true},SUBMENU_TOGGLE_REGION_CONFIG={key: _SUBMENU_TOGGLE_REGION, value: false, validator: Lang.isBoolean};Lang.extend(MenuBar, YAHOO.widget.Menu, {init: function(p_oElement, p_oConfig){ if(!this.ITEM_TYPE){ this.ITEM_TYPE=YAHOO.widget.MenuBarItem; } MenuBar.superclass.init.call(this, p_oElement); this.beforeInitEvent.fire(MenuBar); if(p_oConfig){ this.cfg.applyConfig(p_oConfig, true); } this.initEvent.fire(MenuBar);},CSS_CLASS_NAME: "yuimenubar",SUBMENU_TOGGLE_REGION_WIDTH: 20,_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar){var oEvent=p_aArgs[0], oItem=p_aArgs[1], oSubmenu, oItemCfg, oNextItem; if(oItem && !oItem.cfg.getProperty(_DISABLED)){ oItemCfg=oItem.cfg; switch(oEvent.keyCode){ case 37:case 39:if(oItem==this.activeItem && !oItemCfg.getProperty(_SELECTED)){ oItemCfg.setProperty(_SELECTED, true); } else { oNextItem=(oEvent.keyCode==37) ? oItem.getPreviousEnabledSibling() : oItem.getNextEnabledSibling(); if(oNextItem){ this.clearActiveItem(); oNextItem.cfg.setProperty(_SELECTED, true); oSubmenu=oNextItem.cfg.getProperty(_SUBMENU);if(oSubmenu){oSubmenu.show();oSubmenu.setInitialFocus();}else {oNextItem.focus(); } } } Event.preventDefault(oEvent); break; case 40:if(this.activeItem !=oItem){ this.clearActiveItem(); oItemCfg.setProperty(_SELECTED, true); oItem.focus(); } oSubmenu=oItemCfg.getProperty(_SUBMENU); if(oSubmenu){ if(oSubmenu.cfg.getProperty(_VISIBLE)){ oSubmenu.setInitialSelection(); oSubmenu.setInitialFocus(); } else { oSubmenu.show(); oSubmenu.setInitialFocus(); } } Event.preventDefault(oEvent); break; } } if(oEvent.keyCode==27 && this.activeItem){oSubmenu=this.activeItem.cfg.getProperty(_SUBMENU); if(oSubmenu && oSubmenu.cfg.getProperty(_VISIBLE)){ oSubmenu.hide(); this.activeItem.focus(); } else { this.activeItem.cfg.setProperty(_SELECTED, false); this.activeItem.blur(); } Event.preventDefault(oEvent); }},_onClick: function(p_sType, p_aArgs, p_oMenuBar){ MenuBar.superclass._onClick.call(this, p_sType, p_aArgs, p_oMenuBar); var oItem=p_aArgs[1], bReturnVal=true, oItemEl, oEvent, oTarget, oActiveItem, oConfig, oSubmenu, nMenuItemX, nToggleRegion;var toggleSubmenuDisplay=function(){if(oSubmenu.cfg.getProperty(_VISIBLE)){oSubmenu.hide();}else {oSubmenu.show(); }}; if(oItem && !oItem.cfg.getProperty(_DISABLED)){ oEvent=p_aArgs[0]; oTarget=Event.getTarget(oEvent); oActiveItem=this.activeItem; oConfig=this.cfg; if(oActiveItem && oActiveItem !=oItem){ this.clearActiveItem(); } oItem.cfg.setProperty(_SELECTED, true); oSubmenu=oItem.cfg.getProperty(_SUBMENU); if(oSubmenu){oItemEl=oItem.element;nMenuItemX=YAHOO.util.Dom.getX(oItemEl);nToggleRegion=nMenuItemX + (oItemEl.offsetWidth - this.SUBMENU_TOGGLE_REGION_WIDTH);if (oConfig.getProperty(_SUBMENU_TOGGLE_REGION)){if (Event.getPageX(oEvent) > nToggleRegion){toggleSubmenuDisplay();Event.preventDefault(oEvent);bReturnVal=false;} }else {toggleSubmenuDisplay(); } } }return bReturnVal;},configSubmenuToggle: function(p_sType, p_aArgs){var bSubmenuToggle=p_aArgs[0];if (bSubmenuToggle){this.cfg.setProperty(_AUTO_SUBMENU_DISPLAY, false);}},toString: function(){var sReturnVal=_MENUBAR, sId=this.id; if(sId){ sReturnVal +=(_SPACE + sId); } return sReturnVal;},initDefaultConfig: function(){ MenuBar.superclass.initDefaultConfig.call(this); var oConfig=this.cfg; oConfig.addProperty( POSITION_CONFIG.key, { handler: this.configPosition, value: POSITION_CONFIG.value, validator: POSITION_CONFIG.validator, supercedes: POSITION_CONFIG.supercedes } ); oConfig.addProperty( SUBMENU_ALIGNMENT_CONFIG.key, { value: SUBMENU_ALIGNMENT_CONFIG.value, suppressEvent: SUBMENU_ALIGNMENT_CONFIG.suppressEvent } );oConfig.addProperty( AUTO_SUBMENU_DISPLAY_CONFIG.key, { value: AUTO_SUBMENU_DISPLAY_CONFIG.value, validator: AUTO_SUBMENU_DISPLAY_CONFIG.validator, suppressEvent: AUTO_SUBMENU_DISPLAY_CONFIG.suppressEvent } );oConfig.addProperty( SUBMENU_TOGGLE_REGION_CONFIG.key, { value: SUBMENU_TOGGLE_REGION_CONFIG.value, validator: SUBMENU_TOGGLE_REGION_CONFIG.validator, handler: this.configSubmenuToggle } );} });}());YAHOO.widget.MenuBarItem=function(p_oObject, p_oConfig){ YAHOO.widget.MenuBarItem.superclass.constructor.call(this, p_oObject, p_oConfig);};YAHOO.lang.extend(YAHOO.widget.MenuBarItem, YAHOO.widget.MenuItem, {init: function(p_oObject, p_oConfig){ if(!this.SUBMENU_TYPE){ this.SUBMENU_TYPE=YAHOO.widget.Menu; } YAHOO.widget.MenuBarItem.superclass.init.call(this, p_oObject); var oConfig=this.cfg; if(p_oConfig){ oConfig.applyConfig(p_oConfig, true); } oConfig.fireQueue();},CSS_CLASS_NAME: "yuimenubaritem",CSS_LABEL_CLASS_NAME: "yuimenubaritemlabel",toString: function(){var sReturnVal="MenuBarItem"; if(this.cfg && this.cfg.getProperty("text")){ sReturnVal +=(": " + this.cfg.getProperty("text")); } return sReturnVal;} });YAHOO.register("menu", YAHOO.widget.Menu, {version: "2.8.2r1", build: "8"});
