event-min.js revision 5f7ec9435c0f5ff76ce9909a83b5d0ef167767b0
(function(){var GLOBAL_ENV=YUI.Env,C=YUI.config,D=C.doc,POLL_INTERVAL=C.pollInterval||40,_ready=function(e){GLOBAL_ENV._ready();};if(!GLOBAL_ENV._ready){GLOBAL_ENV._ready=function(){if(!GLOBAL_ENV.DOMReady){GLOBAL_ENV.DOMReady=true;if(D.removeEventListener){D.removeEventListener("DOMContentLoaded",_ready,false);}}};
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
if(navigator.userAgent.match(/MSIE/)){if(window!==window.top){document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;_ready();}};}else{GLOBAL_ENV._dri=setInterval(function(){try{document.documentElement.doScroll("left");clearInterval(GLOBAL_ENV._dri);GLOBAL_ENV._dri=null;_ready();}catch(ex){}},POLL_INTERVAL);}}else{D.addEventListener("DOMContentLoaded",_ready,false);}}})();YUI.add("event",function(F){(function(){var I=YUI.Env,G=F.Env.evt.plugins,H=function(){F.fire("domready");};F.mix(G,{domready:{},"event:ready":{on:function(){var J=F.Array(arguments,0,true);J[0]="domready";return F.subscribe.apply(F,J);},detach:function(){var J=F.Array(arguments,0,true);J[0]="domready";return F.unsubscribe.apply(F,J);}}});F.publish("domready",{fireOnce:true});if(I.DOMReady){H();}else{F.before(H,I,"_ready");}})();(function(){var H=F.UA,G={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},I=function(K){if(!K){return null;}try{if(H.webkit&&3==K.nodeType){K=K.parentNode;}}catch(J){}return F.Node.get(K);};F.DOMEventFacade=function(Q,K,J){var M=Q,L=K,N=F.config.doc,R=N.body,S=M.pageX,P=M.pageY,O,T;this.altKey=M.altKey;this.ctrlKey=M.ctrlKey;this.metaKey=M.metaKey;this.shiftKey=M.shiftKey;this.type=M.type;if(!S&&0!==S){S=M.clientX||0;P=M.clientY||0;if(H.ie){S+=Math.max(N.documentElement.scrollLeft,R.scrollLeft);P+=Math.max(N.documentElement.scrollTop,R.scrollTop);}}this._yuifacade=true;this.pageX=S;this.pageY=P;O=M.keyCode||M.charCode||0;if(H.webkit&&(O in G)){O=G[O];}this.keyCode=O;this.charCode=O;this.button=M.which||M.button;this.which=this.button;this.target=I(M.target||M.srcElement);this.currentTarget=I(L);T=M.relatedTarget;if(!T){if(M.type=="mouseout"){T=M.toElement;}else{if(M.type=="mouseover"){T=M.fromElement;}}}this.relatedTarget=I(T);this.stopPropagation=function(){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}if(J){J.stopPropagation();}};this.stopImmediatePropagation=function(){if(M.stopImmediatePropagation){M.stopImmediatePropagation();}else{this.stopPropagation();}if(J){J.stopImmediatePropagation();}};this.preventDefault=function(){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}if(J){J.preventDefault();}};this.halt=function(U){if(U){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){var M=YUI.Env.add,G=YUI.Env.remove,K=function(){YUI.Env.windowLoaded=true;F.Event._load();G(window,"load",K);},J=function(){F.Event._unload();G(window,"unload",J);},N="domready",L="~yui|2|compat~",I=function(P){try{return(P&&typeof P!=="string"&&(P.length&&((!P.size)||(P.size()>1)))&&!P.tagName&&!P.alert&&(P.item||typeof P[0]!=="undefined"));}catch(O){return false;}},H=function(){var Q=false,R=0,P=[],S={},O=null,T={};return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var U=F.Event;if(!U._interval){U._interval=setInterval(F.bind(U._poll,U),U.POLL_INTERVAL);}},onAvailable:function(c,X,b,Z,Y,V){var U=F.Array(c),W;for(W=0;W<U.length;W=W+1){P.push({id:U[W],fn:X,obj:b,override:Z,checkReady:Y,compat:V});}R=this.POLL_RETRYS;setTimeout(F.bind(F.Event._poll,F.Event),0);return new F.EventHandle();},onContentReady:function(Y,V,X,W,U){return this.onAvailable(Y,V,X,W,true,U);},attach:function(W,V,U,X){return F.Event._attach(F.Array(arguments,0,true));},_createWrapper:function(a,Z,U,V,Y){var b=F.stamp(a),X="event:"+b+Z,W;if(false===Y){X+="native";}if(U){X+="capture";}W=S[X];if(!W){W=F.publish(X,{bubbles:false,contextFn:function(){W.nodeRef=W.nodeRef||F.get(W.el);return W.nodeRef;}});W.el=a;W.type=Z;W.fn=function(c){W.fire(F.Event.getEvent(c,a,(V||(false===Y))));};if(a==F.config.win&&Z=="load"){W.fireOnce=true;O=X;}S[X]=W;T[b]=T[b]||{};T[b][X]=W;M(a,Z,W.fn,U);}return W;},_attach:function(a,W){var d=a.slice(1),f,j=F.Event,h,Y,e,U,X=false,Z,b=a[0],c=a[1],V=a[2]||F.config.win,i=W&&W.facade,g=W&&W.capture;if(d[d.length-1]===L){f=true;d.pop();}if(!c||!c.call){return false;}if(I(V)){h=[];F.each(V,function(m,l){a[2]=m;h.push(j._attach(a,W));});return(h.length===1)?h[0]:h;}else{if(F.Lang.isString(V)){if(f){Y=F.DOM.byId(V);}else{Y=F.Selector.query(V);switch(Y.length){case 0:Y=null;break;case 1:Y=Y[0];break;default:a[2]=Y;return j._attach(a,W);}}if(Y){V=Y;}else{return this.onAvailable(V,function(){j._attach(a,W);},j,true,false,f);}}}if(!V){return false;}if(F.Node&&V instanceof F.Node){return V.on.apply(V,a);}e=this._createWrapper(V,b,g,f,i);if(V==F.config.win&&b=="load"){if(YUI.Env.windowLoaded){X=true;}}U=d[2];d[1]=U;d.splice(2,1);Z=e.subscribe.apply(e,d);if(X){e.fire();}return Z;},detach:function(b,d,W,X){var a=F.Array(arguments,0,true),e,Y,Z,c,U,V;if(a[a.length-1]===L){e=true;}if(b&&b.detach){return b.detach();}if(typeof W=="string"){W=(e)?F.DOM.byId(W):F.Selector.query(W);return F.Event.detach.apply(F.Event,a);}else{if(I(W)){c=true;for(Y=0,Z=W.length;Y<Z;++Y){a[2]=W[Y];c=(F.Event.detach.apply(F.Event,a)&&c);}return c;}}if(!b||!d||!d.call){return this.purgeElement(W,false,b);}U="event:"+F.stamp(W)+b;V=S[U];if(V){return V.detach(d);}else{return false;}},getEvent:function(X,V,U){var W=X||window.event;return(U)?W:new F.DOMEventFacade(W,V,S["event:"+F.stamp(V)+X.type]);},generateId:function(U){var V=U.id;if(!V){V=F.stamp(U);U.id=V;}return V;},_isValidCollection:I,_load:function(U){if(!Q){Q=true;if(F.fire){F.fire(N);}F.Event._poll();}},_poll:function(){if(this.locked){return;}if(F.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var Z=!Q,Y,a,V,U,X,W;if(!Z){Z=(R>0);}Y=[];a=function(d,e){var c,b=e.override;
if(e.compat){if(e.override){if(b===true){c=e.obj;}else{c=b;}}else{c=d;}e.fn.call(c,e.obj);}else{c=e.obj||F.get(d);e.fn.apply(c,(F.Lang.isArray(b))?b:[]);}};for(V=0,U=P.length;V<U;++V){X=P[V];if(X&&!X.checkReady){W=(X.compat)?F.DOM.byId(X.id):F.Selector.query(X.id,null,true);if(W){a(W,X);P[V]=null;}else{Y.push(X);}}}for(V=0,U=P.length;V<U;++V){X=P[V];if(X&&X.checkReady){W=(X.compat)?F.DOM.byId(X.id):F.Selector.query(X.id,null,true);if(W){if(Q||(W.get&&W.get("nextSibling"))||W.nextSibling){a(W,X);P[V]=null;}}else{Y.push(X);}}}R=(Y.length===0)?0:R-1;if(Z){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;},purgeElement:function(Z,a,Y){var W=(F.Lang.isString(Z))?F.Selector.query(Z,null,true):Z,V=this.getListeners(W,Y),X,U;if(V){for(X=0,U=V.length;X<U;++X){V[X].detachAll();}}if(a&&W&&W.childNodes){for(X=0,U=W.childNodes.length;X<U;++X){this.purgeElement(W.childNodes[X],a,Y);}}},getListeners:function(Y,X){var Z=F.stamp(Y,true),U=T[Z],W=[],V=(X)?"event:"+Z+X:null;if(!U){return null;}if(V){if(U[V]){W.push(U[V]);}}else{F.each(U,function(b,a){W.push(b);});}return(W.length)?W:null;},_unload:function(V){var U=F.Event;F.each(S,function(X,W){X.detachAll();G(X.el,X.type,X.fn);delete S[W];});G(window,"load",U._load);G(window,"unload",U._unload);},nativeAdd:M,nativeRemove:G};}();F.Event=H;if(F.config.injected||YUI.Env.windowLoaded){K();}else{M(window,"load",K);}if(F.UA.ie){F.on(N,H._poll,H,true);}M(window,"unload",J);H.Custom=F.CustomEvent;H.Subscriber=F.Subscriber;H.Target=F.EventTarget;H.Handle=F.EventHandle;H.Facade=F.EventFacade;H._poll();})();F.Env.evt.plugins.available={on:function(I,H,K,J){var G=arguments.length>4?F.Array(arguments,4,true):[];return F.Event.onAvailable.call(F.Event,K,H,J,G);}};F.Env.evt.plugins.contentready={on:function(I,H,K,J){var G=arguments.length>4?F.Array(arguments,4,true):[];return F.Event.onContentReady.call(F.Event,K,H,J,G);}};(function(){var I=F.Env.evt.plugins,J={capture:true},H=function(){},G=function(L,N){var K=(F.Lang.isString(N))?F.Selector.query(N,null,true):N,M=K&&K.parentNode;if(M){F.Event._attach([L,H,M],J);}};I.focus={on:function(M,L,N){var K=F.Array(arguments,0,true);if(F.UA.ie){K[0]=K[0].replace(/focus/,"focusin");}else{if(F.UA.opera){G(M,N);}}return F.Event._attach(K,J);}};I.blur={on:function(M,L,N){var K=F.Array(arguments,0,true);if(F.UA.ie){K[0]=K[0].replace(/blur/,"focusout");}else{if(F.UA.opera){G(M,N);}}return F.Event._attach(K,J);}};})();F.Env.evt.plugins.key={on:function(J,L,G,P,H){var N=F.Array(arguments,0,true),K,O,M,I;if(!P||P.indexOf(":")==-1){N[0]="keypress";return F.on.apply(F,N);}K=P.split(":");O=K[0];M=(K[1])?K[1].split(/,|\+/):null;I=(F.Lang.isString(G)?G:F.stamp(G))+P;I=I.replace(/,/g,"_");if(!F.getEvent(I)){F.on(J+O,function(U){var V=false,R=false,S,Q,T;for(S=0;S<M.length;S=S+1){Q=M[S];T=parseInt(Q,10);if(F.Lang.isNumber(T)){if(U.charCode===T){V=true;}else{R=true;}}else{if(V||!R){V=(U[Q+"Key"]);R=!V;}}}if(V){F.fire(I,U);}},G);}N.splice(2,2);N[0]=I;return F.on.apply(F,N);}};(function(){var L=F.Lang,J={},I=function(N){try{if(N&&3==N.nodeType){return N.parentNode;}}catch(M){}return N;},H=function(O,U,P){var V=I((U.target||U.srcElement)),Q=J[O],X,R,M,T,N,W,S;for(X in Q){if(Q.hasOwnProperty(X)){R=Q[X];M=F.Selector.query(X,P);T=M.length;if(T>0){S=M.length-1;do{N=M[S];if(N===V||F.DOM.contains(N,V)){if(!W){W=new F.DOMEventFacade(U,P);W.container=W.currentTarget;}W.currentTarget=F.Node.get(N);F.fire(R,W);}}while(S--);}}}},G=function(O,N,M){F.Event._attach([O,function(P){H(N,(P||window.event),M);},M],{facade:false});},K=F.cached(function(M){return M.replace(/[|,:]/g,"~");});F.Env.evt.plugins.delegate={on:function(R,T,O,M,V){if(!V){return false;}var S=(L.isString(O)?O:F.stamp(O)),P="delegate:"+S+M+K(V),N=M+S,U=F.Array(arguments,0,true),Q;if(!(N in J)){if(L.isString(O)){Q=F.Selector.query(O);}else{Q=F.Node.getDOMNode(O);}if(L.isArray(Q)){F.Array.each(Q,function(W){G(M,N,W);});}else{G(M,N,Q);}J[N]={};}J[N][V]=P;U[0]=P;U.splice(2,3);return F.on.apply(F,U);}};})();(function(){var H,G,J="window:resize",I=function(K){if(F.UA.gecko){F.fire(J,K);}else{if(G){G.cancel();}G=F.later(F.config.windowResizeDelay||40,F,function(){F.fire(J,K);});}};F.Env.evt.plugins.windowresize={on:function(M,L){if(!H){H=F.Event._attach(["resize",I]);}var K=F.Array(arguments,0,true);K[0]=J;return F.on.apply(F,K);}};})();var A=F.Lang.isString,C=function(J,G,I,K,H){if(!J.compareTo(G)&&!J.contains(G)){K.container=K.currentTarget;K.currentTarget=J;F.fire(I,K);}},D=function(L,I,H){var G=L.relatedTarget,K=L.currentTarget,J=L.target;if(H){K.queryAll(H).some(function(M){var N;if(M.compareTo(J)||M.contains(J)){C(M,G,I,L,H);N=true;}return N;});}else{C(K,G,I,L);}},E=F.cached(function(G){return G.replace(/[|,:]/g,"~");}),B={on:function(L,K,J,H){var G=(L==="mouseenter")?"mouseover":"mouseout",M=L+":"+(A(J)?J:F.stamp(J))+G,I=F.Array(arguments,0,true),N;if(A(H)){N=H;M=M+E(N);}if(!F.getEvent(M)){F.on(G,function(O){D(O,M,N);},J);}I[0]=M;if(N){I.splice(2,2);}else{I.splice(2,1);}return F.on.apply(F,I);}};F.Env.evt.plugins.mouseenter=B;F.Env.evt.plugins.mouseleave=B;},"@VERSION@",{requires:["event-custom"]});