AUI.add("aui-overlay-manager",function(D){var J=D.Lang,K=J.isArray,C=J.isBoolean,O=J.isNumber,B=J.isString,M="boundingBox",G="default",N="host",I="OverlayManager",L="group",E="zIndex",H="zIndexBase";var F=D.Component.create({NAME:I.toLowerCase(),ATTRS:{zIndexBase:{value:1000,validator:O,setter:function(A){return parseInt(A,10);}}},EXTENDS:D.Base,prototype:{initializer:function(){var A=this;A._overlays=[];},bringToTop:function(P){var A=this;var R=A._overlays.sort(A.sortByZIndexDesc);var T=R[0];if(T!==P){var S=P.get(E);var Q=T.get(E);P.set(E,Q+1);P.set("focused",true);}},destructor:function(){var A=this;A._overlays=[];},register:function(S){var P=this;var T=P._overlays;if(K(S)){D.Array.each(S,function(W){P.register(W);});}else{var R=P.get(H);var V=P._registered(S);if(!V&&S&&((S instanceof D.Overlay)||(D.Component&&S instanceof D.Component))){var Q=S.get(M);T.push(S);var U=S.get(E)||0;var A=T.length+U+R;S.set(E,A);S.on("focusedChange",P._onFocusedChange,P);Q.on("mousedown",P._onMouseDown,P);}}return T;},remove:function(P){var A=this;var Q=A._overlays;if(Q.length){return D.Array.removeItem(Q,P);}return null;},each:function(Q){var A=this;var P=A._overlays;D.Array.each(P,Q);},showAll:function(){this.each(function(A){A.show();});},hideAll:function(){this.each(function(A){A.hide();});},sortByZIndexDesc:function(P,A){if(!P||!A||!P.hasImpl(D.WidgetStack)||!A.hasImpl(D.WidgetStack)){return 0;}else{var Q=P.get(E);var R=A.get(E);if(Q>R){return -1;}else{if(Q<R){return 1;}else{return 0;}}}},_registered:function(P){var A=this;return D.Array.indexOf(A._overlays,P)!=-1;},_onMouseDown:function(Q){var A=this;var P=D.Widget.getByNode(Q.currentTarget||Q.target);var R=A._registered(P);if(P&&R){A.bringToTop(P);}},_onFocusedChange:function(Q){var A=this;if(Q.newVal){var P=Q.currentTarget||Q.target;var R=A._registered(P);if(P&&R){A.bringToTop(P);}}}}});D.OverlayManager=F;},"1.0.1",{requires:["aui-base","aui-overlay-base","overlay","plugin"]});