7
YUI.add("node-menunav",function(D){var n=D.UA,AO=D.Lang,u=D.later,AK=D.ClassNameManager.getClassName,j=true,AI=false,m=null,P="menu",G="menuitem",AF="hidden",AB="tabIndex",Q="parentNode",W="children",x="offsetHeight",AA="offsetWidth",AM="px",g="id",I=".",E="handledMouseOut",s="handledMouseOver",b="active",AJ="label",d="a",v="mousedown",AN="keydown",z="click",O="",U="first-of-type",l=AK(P),AE=AK(P,AF),a=AK(P,"horizontal"),AG=AK(P,AJ),i=AK(P,AJ,b),Z=AK(P,AJ,(P+"visible")),J=AK(G),A=AK(G,b),h=I+l;var K=function(AR){var AT=AR.previous(),AQ,AS,AP,Y;if(!AT){AQ=AR.get(Q);AP=AQ.get(Q).get(W);if(AP.size()>1){Y=AQ.previous();if(Y){AS=Y.get(W);}else{AS=AP.item(AP.size()-1).get(W);}}else{AS=AQ.get(W);}AT=AS.item(AS.size()-1);}return AT;};var c=function(AR){var AT=AR.next(),AQ,AS,AP,Y;if(!AT){AQ=AR.get(Q);AP=AQ.get(Q).get(W);if(AP.size()>1){Y=AQ.next();if(Y){AS=Y.get(W);}else{AS=AP.item(0).get(W);}}else{AS=AR.get(Q).get(W);}AT=AS.item(0);}return AT;};var R=function(Y,AP){Y.setAttribute("role",AP);};var S=function(Y,AQ,AP){Y.setAttribute(("aria-"+AQ),AP);};var AH=function(Y){R(Y,"presentation");};var AC=function(Y){Y.set(AB,-1);};var M=function(Y){Y.set(AB,0);};var F=function(Y){var AP=AI;if(Y){AP=Y.get("nodeName").toLowerCase()===d;}return AP;};var N=function(Y){return Y.hasClass(J);};var t=function(Y){return Y.hasClass(AG);};var r=function(Y){return Y.hasClass(a);};var o=function(Y){return Y.hasClass(Z);};var q=function(Y){return F(Y)?Y:Y.query(d);};var y=function(AQ,AP,Y){var AR;if(AQ){if(AQ.hasClass(AP)){AR=AQ;}if(!AR&&Y){AR=AQ.ancestor((I+AP));}}return AR;};var L=function(Y){return Y.ancestor(h);};var X=function(AP,Y){return y(AP,l,Y);};var AD=function(AP,Y){var AQ;if(AP){AQ=y(AP,J,Y);}return AQ;};var p=function(AP,Y){var AQ;if(AP){if(Y){AQ=y(AP,AG,Y);}else{AQ=y(AP,AG)||AP.query((I+AG));}}return AQ;};var B=function(AP,Y){var AQ;if(AP){AQ=AD(AP,Y)||p(AP,Y);}return AQ;};var V=function(AR,AQ){var Y,AS,AP;if(AR){Y=N(AR)?AR:AR.get(Q);AS=AQ?K(Y):c(Y);AP=B(AS);}return AP;};var AL=function(Y){return V(Y,true);};var C=function(Y){return B(Y.query("li"));};var f=function(Y){return N(Y)?A:i;};var k=function(AQ){var AP;if(AQ){AP=q(AQ);try{AP.blur();}catch(Y){}}};var w=function(AQ){var AP;if(AQ){AP=q(AQ);try{AP.focus();}catch(Y){}}};var e=function(Y,AP){return Y&&!Y[s]&&(Y===AP||Y.contains(AP));};var H=function(AP,Y){return AP&&!AP[E]&&(AP!==Y&&!AP.contains(Y));};var T=function(AQ){var AP=this,AX=AQ.owner,AV,AW,AU,AR,AT,AS,Y;if(AX){AW=AQ.useARIA;AU=AQ.autoSubmenuDisplay;AR=AQ.mouseOutHideDelay;AP._useARIA=AO.isBoolean(AW)?AW:((n.gecko&&n.gecko>=1.9)||(n.ie&&n.ie>=8));AP._autoSubmenuDisplay=AO.isBoolean(AU)?AU:j;AP._submenuShowDelay=AQ.submenuShowDelay||250;AP._submenuHideDelay=AQ.submenuHideDelay||250;AP._mouseOutHideDelay=AO.isNumber(AR)?AR:750;AT=AX.queryAll(h);if(AT){AT.addClass(AE);}Y=AX.queryAll("ul:"+U);if(Y){Y.addClass(U);}AX.on("mouseover",AP._onMouseOver,AP);AX.on("mouseout",AP._onMouseOut,AP);AX.on("mousemove",AP._onMouseMove,AP);AX.on(v,AP._toggleSubmenuDisplay,AP);AX.on(AN,AP._toggleSubmenuDisplay,AP);AX.on(z,AP._toggleSubmenuDisplay,AP);AX.on("keypress",AP._onKeyPress,AP);AX.on(AN,AP._onKeyDown,AP);AV=AX.get("ownerDocument");AV.on(v,AP._onDocMouseDown,AP);D.on("focus",D.bind(AP._onDocFocus,AP),AV);AP._rootMenu=AX;if(AP._useARIA){AP._applyARIA(AX);AS=C(AX);if(AS){M(q(AS));AP._firstItem=AS;}}}};T.NS="MenuNav";T.SHIM_TEMPLATE_TITLE="Menu Stacking Shim";T.SHIM_TEMPLATE='<iframe frameborder="0" tabindex="-1" class="'+AK("shim")+'" title="'+T.SHIM_TEMPLATE_TITLE+'" src="javascript:false;"></iframe>';T.prototype={_rootMenu:m,_activeItem:m,_activeMenu:m,_hasFocus:AI,_blockMouseEvent:AI,_currentMouseX:0,_movingToSubmenu:AI,_showSubmenuTimer:m,_hideSubmenuTimer:m,_hideAllSubmenusTimer:m,_firstItem:m,_autoSubmenuDisplay:j,_isRoot:function(Y){return this._rootMenu.compareTo(Y);},_getTopmostSubmenu:function(AR){var AQ=this,Y=L(AR),AP;if(!Y){AP=AR;}else{if(AQ._isRoot(Y)){AP=AR;}else{AP=AQ._getTopmostSubmenu(Y);}}return AP;},_clearActiveItem:function(){var AP=this,Y=AP._activeItem;if(Y){Y.removeClass(f(Y));if(AP._useARIA){AC(q(Y));}}AP._activeItem=m;},_setActiveItem:function(AP){var Y=this;if(AP){Y._clearActiveItem();AP.addClass(f(AP));if(Y._useARIA){M(q(AP));}Y._activeItem=AP;}},_focusItem:function(Y){if(Y&&this._hasFocus){u(0,null,w,Y);}},_applyARIA:function(AR){var AQ=this,AV=AQ._isRoot(AR),Y,AU,AT,AP,AX,AS,AW;R(AR,(AV?"menubar":P));if(!AV){Y=AR.previous();AU=Y.query(I+AK(P,"toggle"));if(AU){Y=AU;}AW=Y.get(g);if(!AW){AW=D.guid();Y.set(g,AW);}S(AR,"labelledby",AW);S(AR,AF,j);}AT=AR.queryAll("ul,li");if(AT){AT.each(function(AY){AH(AY);});}AP=AR.queryAll((I+AK(G,"content")));if(AP){AP.each(function(AY){AC(AY);R(AY,G);});}AX=AR.queryAll((I+AG));if(AX){AX.each(function(AY){Y=AY;AU=AY.query((I+AK(P,"toggle")));if(AU){AH(AU);AC(AU);Y=AU.previous();}R(Y,G);S(Y,"haspopup",j);AC(Y);AS=AY.next();if(AS){AQ._applyARIA(AS);}});}},_showMenu:function(AT){var AQ=this,Y=L(AT),AR=AT.get(Q),AP=AR.getXY(),AS;if(AQ._useARIA){S(AT,AF,AI);}if(r(Y)){AP[1]=AP[1]+AR.get(x);}else{AP[0]=AP[0]+AR.get(AA);}AT.setXY(AP);if(n.ie<8){if(n.ie===6&&!AT.hasIFrameShim){AT.appendChild(D.Node.create(T.SHIM_TEMPLATE));AT.hasIFrameShim=j;}AT.setStyles({height:O,width:O});AT.setStyles({height:(AT.get(x)+AM),width:(AT.get(AA)+AM)});}AT.previous().addClass(Z);AT.removeClass(AE);AS=C(AT);AQ._focusItem(AS);},_hideMenu:function(AR,AP){var AQ=this,AS=AR.previous(),Y;AS.removeClass(Z);if(AP){AQ._setActiveItem(AS);AQ._focusItem(AS);}Y=AR.query((I+A));if(Y){Y.removeClass(A);}AR.setStyles({left:O,top:O});AR.addClass(AE);S(AR,AF,j);},_hideAllSubmenus:function(AQ){var AP=this,Y=AQ.queryAll(h);if(Y){Y.each(D.bind(function(AR){AP._hideMenu(AR);},AP));}},_cancelShowSubmenuTimer:function(){var AP=this,Y=AP._showSubmenuTimer;if(Y){Y.cancel();AP._showSubmenuTimer=m;}},_cancelHideSubmenuTimer:function(){var Y=this,AP=Y._hideSubmenuTimer;if(AP){AP.cancel();Y._hideSubmenuTimer=m;}},_onMenuMouseOver:function(AR,AQ){var AP=this,Y=AP._hideAllSubmenusTimer;if(Y){Y.cancel();AP._hideAllSubmenusTimer=m;
8
}AP._cancelHideSubmenuTimer();AP._activeMenu=AR;if(AP._movingToSubmenu&&r(AR)){AP._movingToSubmenu=AI;}},_onMenuMouseOut:function(AV,AT){var AS=this,AQ=AS._activeMenu,AU=AT.relatedTarget,Y=AS._activeItem,AR,AP;if(AQ&&!AQ.contains(AU)){AR=L(AQ);if(AR&&!AR.contains(AU)){if(AS._mouseOutHideDelay>0){AS._cancelShowSubmenuTimer();AS._hideAllSubmenusTimer=u(AS._mouseOutHideDelay,AS,function(){var AW;AQ=AS._activeMenu;AS._hideAllSubmenus(AS._rootMenu);if(AQ){AW=AS._getTopmostSubmenu(AQ);AS._focusItem(AW.previous());}});}}else{if(Y){AP=L(Y);if(!AS._isRoot(AP)){AS._focusItem(AP.previous());}}}}},_onMenuLabelMouseOver:function(AS,AU){var AT=this,AR=AT._activeMenu,Y=AT._isRoot(AR),AQ=(AT._autoSubmenuDisplay&&Y||!Y),AP;AT._setActiveItem(AS);AT._focusItem(AS);if(AQ&&!AT._movingToSubmenu){AT._cancelHideSubmenuTimer();AT._cancelShowSubmenuTimer();if(!o(AS)){AP=AS.next();if(AP){AT._hideAllSubmenus(AR);AT._showSubmenuTimer=u(AT._submenuShowDelay,AT,AT._showMenu,AP);}}}},_onMenuLabelMouseOut:function(AR,AT){var AS=this,Y=AS._isRoot(AS._activeMenu),AQ=(AS._autoSubmenuDisplay&&Y||!Y),AU=AT.relatedTarget,AP=AR.next();AS._clearActiveItem();if(AQ){if(AS._movingToSubmenu&&!AS._showSubmenuTimer&&AP){AS._hideSubmenuTimer=u(AS._submenuHideDelay,AS,AS._hideMenu,AP);}else{if(!AS._movingToSubmenu&&AP&&!AP.contains(AU)&&AU!==AP){AS._cancelShowSubmenuTimer();AS._hideMenu(AP);}}}},_onMenuItemMouseOver:function(AR,AT){var AS=this,AQ=AS._activeMenu,Y=AS._isRoot(AQ),AP=(AS._autoSubmenuDisplay&&Y||!Y);AS._setActiveItem(AR);AS._focusItem(AR);if(AP&&!AS._movingToSubmenu){AS._hideAllSubmenus(AQ);}},_onMenuItemMouseOut:function(Y,AP){this._clearActiveItem();},_onVerticalMenuKeyDown:function(Y){var AP=this,AU=AP._activeMenu,Aa=AP._rootMenu,AQ=Y.target,AS=B(AQ,j),AT=AI,AY=Y.keyCode,AW,AR,AV,AZ,AX;switch(AY){case 37:AR=L(AU);if(AR&&r(AR)){AP._hideMenu(AU);AV=K(AU.get(Q));AX=B(AV);if(AX){if(t(AX)){AW=AX.next();if(AW){AP._showMenu(AW);AP._setActiveItem(C(AW));}else{AP._setActiveItem(AX);w(AX);}}else{AP._setActiveItem(AX);w(AX);}}}else{if(!AP._isRoot(AU)){AP._hideMenu(AU,j);}}AT=j;break;case 39:if(t(AQ)){AW=AQ.next();if(AW){AP._showMenu(AW);AP._setActiveItem(C(AW));}}else{if(r(Aa)){AW=AP._getTopmostSubmenu(AU);AV=c(AW.get(Q));AX=B(AV);AP._hideAllSubmenus(Aa);if(AX){if(t(AX)){AW=AX.next();if(AW){AP._showMenu(AW);AP._setActiveItem(C(AW));}else{AP._setActiveItem(AX);w(AX);}}else{AP._setActiveItem(AX);w(AX);}}}}AT=j;break;case 38:case 40:AP._hideAllSubmenus(AU);AZ=AY===38?AL(AS):V(AS);AP._setActiveItem(AZ);w(AZ);AT=j;break;}if(AT){Y.preventDefault();}},_onHorizontalMenuKeyDown:function(Y){var AP=this,AT=AP._activeMenu,AQ=Y.target,AR=B(AQ,j),AS=AI,AV=Y.keyCode,AW,AU;switch(AV){case 37:case 39:AP._hideAllSubmenus(AT);AW=AV===37?AL(AR):V(AR);AP._setActiveItem(AW);w(AW);AS=j;break;case 40:AP._hideAllSubmenus(AT);if(t(AR)){AU=AR.next();if(AU){AP._showMenu(AU);AP._setActiveItem(C(AU));}AS=j;}break;}if(AS){Y.preventDefault();}},_onMouseMove:function(AP){var Y=this;u(10,Y,function(){Y._currentMouseX=AP.pageX;});},_onMouseOver:function(AS){var AR=this,AP,Y,AU,AQ,AT;if(AR._blockMouseEvent){AR._blockMouseEvent=AI;}else{AP=AS.target;Y=X(AP,j);AU=p(AP,j);AT=AD(AP,j);if(e(Y,AP)){AR._onMenuMouseOver(Y,AS);Y[s]=j;Y[E]=AI;AQ=L(Y);if(AQ){AQ[E]=j;AQ[s]=AI;}}if(e(AU,AP)){AR._onMenuLabelMouseOver(AU,AS);AU[s]=j;AU[E]=AI;}if(e(AT,AP)){AR._onMenuItemMouseOver(AT,AS);AT[s]=j;AT[E]=AI;}}},_onMouseOut:function(AP){var AQ=this,AS=AQ._activeMenu,AX=AI,AR,AT,AV,Y,AU,AW;AQ._movingToSubmenu=(AS&&!r(AS)&&((AP.pageX-5)>AQ._currentMouseX));AR=AP.target;AT=AP.relatedTarget;AV=X(AR,j);Y=p(AR,j);AW=AD(AR,j);if(H(Y,AT)){AQ._onMenuLabelMouseOut(Y,AP);Y[E]=j;Y[s]=AI;}if(H(AW,AT)){AQ._onMenuItemMouseOut(AW,AP);AW[E]=j;AW[s]=AI;}if(Y){AU=Y.next();if(AU&&(AT===AU||AU.contains(AT))){AX=j;}}if(H(AV,AT)||AX){AQ._onMenuMouseOut(AV,AP);AV[E]=j;AV[s]=AI;}},_toggleSubmenuDisplay:function(AQ){var AR=this,AS=AQ.target,AP=p(AS,j),Y=AQ.type,AW,AV,AU,AX,AY,AT;if(AP){AW=F(AS)?AS:AS.ancestor(F);if(AW){AU=AW.getAttribute("href",2);AX=AU.indexOf("#");AY=AU.length;if(AX===0&&AY>1){AT=AU.substr(1,AY);AV=AP.next();if(AV&&(AV.get(g)===AT)){if(Y===v||(Y===AN&&AQ.keyCode===13)){if(n.webkit&&!AR._hasFocus){AR._hasFocus=j;}if(o(AP)){AR._hideMenu(AV);w(AP);}else{AR._hideAllSubmenus(AR._rootMenu);AR._showMenu(AV);}}if(Y===z){AQ.preventDefault();}}}}}},_onKeyPress:function(Y){switch(Y.keyCode){case 37:case 38:case 39:case 40:Y.preventDefault();break;}},_onKeyDown:function(AT){var AS=this,Y=AS._activeItem,AP=AT.target,AR=L(AP),AQ;if(AR){AS._activeMenu=AR;if(r(AR)){AS._onHorizontalMenuKeyDown(AT);}else{AS._onVerticalMenuKeyDown(AT);}if(AT.keyCode===27){if(!AS._isRoot(AR)){AS._hideMenu(AR,j);AT.stopPropagation();AS._blockMouseEvent=n.gecko?j:AI;}else{if(Y){if(t(Y)&&o(Y)){AQ=Y.next();if(AQ){AS._hideMenu(AQ);}}else{k(AP);AS._clearActiveItem();}}}}}},_onDocMouseDown:function(AR){var AQ=this,AP=AQ._rootMenu,Y=AR.target;if(!AP.compareTo(Y)&&!AP.contains(Y)){AQ._hideAllSubmenus(AP);if(n.webkit){AQ._hasFocus=AI;AQ._clearActiveItem();}}},_onDocFocus:function(AS){var AR=this,AP=AR._useARIA,AT=AR._firstItem,Y=AR._activeItem,AQ=AS.target;if(AR._rootMenu.contains(AQ)){if(!AR._hasFocus){AR._hasFocus=j;Y=B(AQ,j);if(Y){AR._setActiveItem(Y);}}}else{AR._clearActiveItem();AR._hasFocus=AI;if(AT&&AP){M(q(AT));}}}};D.namespace("plugin");D.plugin.NodeMenuNav=T;},"3.0.0pr2",{requires:["node","classnamemanager"]});