(function(){var g=YAHOO.util.Event,C=YAHOO.util.Dom,F=YAHOO.lang,O=YAHOO.env.ua,Q=YAHOO.widget.ContextMenu,T=YAHOO.widget.Menu.prototype,W=T.initDefaultConfig,J,L="aria-",I="haspopup",d="role",U="presentation",G="menuitem",V="href",M="submenu",h="menu",e="menubar",E="labelledby",Y="focus",S="blur",B="itemAdded",R="usearia",P="trigger";var c=function(i,j){i.setAttribute(d,j);};var a=function(i,k,j){i.setAttribute((L+k),j);};var Z=function(i){if(i.nodeType===1){a(i,I,true);}};var K=function(i){if(i.nodeType===1){i.removeAttribute(L+I);}};var D=function(j){var i=g.getTarget(j);if(C.isAncestor(this.element,i)){if(J){J.tabIndex=-1;}J=i;J.tabIndex=0;}else{if(J&&this.getItems().length>0){J.tabIndex=-1;J=C.getFirstChild(this.getItem(0).element);J.tabIndex=0;}}};var N=function(m,k){var j=k[0],n=k[1],i=g.getTarget(j),l=g.getCharCode(j);if(n&&l===13){if(O.ie){i.fireEvent("onclick");}else{j=document.createEvent("HTMLEvents");j.initEvent("click",true,true);i.dispatchEvent(j);}}};var b=function(k,j){var i=j[0];if(i){Z(C.getFirstChild(this.element));}};var f=function(k){var i=k.element;c(i.parentNode,U);c(i,U);var j=C.getFirstChild(i);c(j,G);j.tabIndex=-1;j.removeAttribute(V);if(k.cfg.getProperty(M)){Z(j);}else{k.cfg.subscribeToConfigEvent(M,b);}};var H=function(j,i){f(i[0]);};T.configUseARIA=function(r,q){var s=q[0],j=this.parent,l=this.element,u=(this instanceof YAHOO.widget.MenuBar)?e:h,k,p,t,n,m,o;if(s){c(l,u);if(j){m=C.generateId(C.getFirstChild(j.element));a(l,E,m);}k=this.getItems();p=k.length;if(p>0){o=p-1;do{t=k[o];f(t);o=o-1;}while((o>-1));if(this.getRoot()===this){J=C.getFirstChild(this.getItem(0).element);J.tabIndex=0;}}if(this===this.getRoot()){g.onFocus(document,D,null,this);}this.subscribe(B,H);this.subscribe("keypress",N);}};var X={};var A=function(){var j=this.element.id,i=this.cfg.getProperty(P),l=X[j],k;if(l){if(F.isString(l)){k=C.get(l);if(k){K(k);}}else{if(l.nodeType===1){K(l);}else{if(l.length){C.batch(l,K);}}}}if(i){if(F.isString(i)){k=C.get(i);if(k){Z(k);}}else{if(i.nodeType===1){Z(i);}else{if(i.length){C.batch(i,Z);}}}X[j]=i;}};Q.prototype.configUseARIA=function(j,i){Q.superclass.configUseARIA.apply(this,arguments);A.call(this);this.cfg.subscribeToConfigEvent(P,A);};}());