event-min.js revision 05d0664d1cf00f06b4a25a9bda45012e29efe7ef
(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(self!==self.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-base",function(A){(function(){var C=YUI.Env,B=function(){A.fire("domready");};A.publish("domready",{fireOnce:true});if(C.DOMReady){B();}else{A.before(B,C,"_ready");}})();(function(){var C=A.UA,B={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9,63272:46,63273:36,63275:35},D=function(F){if(!F){return null;}try{if(C.webkit&&3==F.nodeType){F=F.parentNode;}}catch(E){}return A.Node.get(F);};A.DOMEventFacade=function(L,F,E){E=E||{};var H=L,G=F,I=A.config.doc,M=I.body,N=H.pageX,K=H.pageY,J,O;this.altKey=H.altKey;this.ctrlKey=H.ctrlKey;this.metaKey=H.metaKey;this.shiftKey=H.shiftKey;this.type=H.type;this.clientX=H.clientX;this.clientY=H.clientY;if(!N&&0!==N){N=H.clientX||0;K=H.clientY||0;if(C.ie){N+=Math.max(I.documentElement.scrollLeft,M.scrollLeft);K+=Math.max(I.documentElement.scrollTop,M.scrollTop);}}this._yuifacade=true;this._event=H;this.pageX=N;this.pageY=K;J=H.keyCode||H.charCode||0;if(C.webkit&&(J in B)){J=B[J];}this.keyCode=J;this.charCode=J;this.button=H.which||H.button;this.which=this.button;this.target=D(H.target||H.srcElement);this.currentTarget=D(G);O=H.relatedTarget;if(!O){if(H.type=="mouseout"){O=H.toElement;}else{if(H.type=="mouseover"){O=H.fromElement;}}}this.relatedTarget=D(O);if(H.type=="mousewheel"||H.type=="DOMMouseScroll"){this.wheelDelta=(H.detail)?(H.detail*-1):Math.round(H.wheelDelta/80)||((H.wheelDelta<0)?-1:1);}this.stopPropagation=function(){if(H.stopPropagation){H.stopPropagation();}else{H.cancelBubble=true;}E.stopped=1;};this.stopImmediatePropagation=function(){if(H.stopImmediatePropagation){H.stopImmediatePropagation();}else{this.stopPropagation();}E.stopped=2;};this.preventDefault=function(P){if(H.preventDefault){H.preventDefault();}H.returnValue=P||false;E.prevented=1;};this.halt=function(P){if(P){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){A.Env.evt.dom_wrappers={};A.Env.evt.dom_map={};var H=A.Env.evt,J=YUI.Env.add,D=YUI.Env.remove,G=function(){YUI.Env.windowLoaded=true;A.Event._load();D(window,"load",G);},B=function(){A.Event._unload();D(window,"unload",B);},C="domready",E="~yui|2|compat~",F=function(L){try{return((L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&(L.item||typeof L[0]!=="undefined")));}catch(K){return false;}},I=function(){var M=false,N=0,L=[],O=H.dom_wrappers,K=null,P=H.dom_map;return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var Q=A.Event;if(!Q._interval){Q._interval=setInterval(A.bind(Q._poll,Q),Q.POLL_INTERVAL);}},onAvailable:function(X,T,W,V,U,R){var Q=A.Array(X),S;for(S=0;S<Q.length;S=S+1){L.push({id:Q[S],fn:T,obj:W,override:V,checkReady:U,compat:R});}N=this.POLL_RETRYS;setTimeout(A.bind(A.Event._poll,A.Event),0);return new A.EventHandle();},onContentReady:function(U,R,T,S,Q){return this.onAvailable(U,R,T,S,true,Q);},attach:function(T,S,R,Q){return A.Event._attach(A.Array(arguments,0,true));},_createWrapper:function(W,V,Q,R,U){var X=A.stamp(W),T="event:"+X+V,S;if(false===U){T+="native";}if(Q){T+="capture";}S=O[T];if(!S){S=A.publish(T,{silent:true,bubbles:false,contextFn:function(){S.nodeRef=S.nodeRef||A.one(S.el);return S.nodeRef;}});S.el=W;S.type=V;S.fn=function(Y){S.fire(A.Event.getEvent(Y,W,(R||(false===U))));};S.capture=Q;if(W==A.config.win&&V=="load"){S.fireOnce=true;K=T;}O[T]=S;P[X]=P[X]||{};P[X][T]=S;J(W,V,S.fn,Q);}return S;},_attach:function(W,S){var a,e=A.Event,c,U,Z,Q,T=false,V,X=W[0],Y=W[1],R=W[2]||A.config.win,d=S&&S.facade,b=S&&S.capture;if(W[W.length-1]===E){a=true;}if(!Y||!Y.call){return false;}if(F(R)){c=[];A.each(R,function(g,f){W[2]=g;c.push(e._attach(W,S));});return(c.length===1)?c[0]:c;}else{if(A.Lang.isString(R)){if(a){U=A.DOM.byId(R);}else{U=A.Selector.query(R);switch(U.length){case 0:U=null;break;case 1:U=U[0];break;default:W[2]=U;return e._attach(W,S);}}if(U){R=U;}else{return this.onAvailable(R,function(){e._attach(W,S);},e,true,false,a);}}}if(!R){return false;}if(A.Node&&R instanceof A.Node){R=A.Node.getDOMNode(R);}Z=this._createWrapper(R,X,b,a,d);if(R==A.config.win&&X=="load"){if(YUI.Env.windowLoaded){T=true;}}if(a){W.pop();}Q=W[3];V=Z._on(Y,Q,(W.length>4)?W.slice(4):null);if(T){Z.fire();}return V;},detach:function(X,Z,S,T){var W=A.Array(arguments,0,true),a,U,V,Y,Q,R;if(W[W.length-1]===E){a=true;}if(X&&X.detach){return X.detach();}if(typeof S=="string"){S=(a)?A.DOM.byId(S):A.Selector.query(S);return A.Event.detach.apply(A.Event,W);}else{if(F(S)){Y=true;for(U=0,V=S.length;U<V;++U){W[2]=S[U];Y=(A.Event.detach.apply(A.Event,W)&&Y);}return Y;}}if(!X||!Z||!Z.call){return this.purgeElement(S,false,X);}Q="event:"+A.stamp(S)+X;R=O[Q];if(R){return R.detach(Z);}else{return false;}},getEvent:function(T,R,Q){var S=T||window.event;return(Q)?S:new A.DOMEventFacade(S,R,O["event:"+A.stamp(R)+T.type]);},generateId:function(Q){var R=Q.id;if(!R){R=A.stamp(Q);Q.id=R;}return R;},_isValidCollection:F,_load:function(Q){if(!M){M=true;if(A.fire){A.fire(C);}A.Event._poll();}},_poll:function(){if(this.locked){return;}if(A.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var V=!M,U,W,R,Q,T,S;if(!V){V=(N>0);}U=[];W=function(Z,a){var Y,X=a.override;
if(a.compat){if(a.override){if(X===true){Y=a.obj;}else{Y=X;}}else{Y=Z;}a.fn.call(Y,a.obj);}else{Y=a.obj||A.one(Z);a.fn.apply(Y,(A.Lang.isArray(X))?X:[]);}};for(R=0,Q=L.length;R<Q;++R){T=L[R];if(T&&!T.checkReady){S=(T.compat)?A.DOM.byId(T.id):A.Selector.query(T.id,null,true);if(S){W(S,T);L[R]=null;}else{U.push(T);}}}for(R=0,Q=L.length;R<Q;++R){T=L[R];if(T&&T.checkReady){S=(T.compat)?A.DOM.byId(T.id):A.Selector.query(T.id,null,true);if(S){if(M||(S.get&&S.get("nextSibling"))||S.nextSibling){W(S,T);L[R]=null;}}else{U.push(T);}}}N=(U.length===0)?0:N-1;if(V){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;},purgeElement:function(V,W,U){var S=(A.Lang.isString(V))?A.Selector.query(V,null,true):V,R=this.getListeners(S,U),T,Q;if(R){for(T=0,Q=R.length;T<Q;++T){R[T].detachAll();}}if(W&&S&&S.childNodes){for(T=0,Q=S.childNodes.length;T<Q;++T){this.purgeElement(S.childNodes[T],W,U);}}},getListeners:function(U,T){var V=A.stamp(U,true),Q=P[V],S=[],R=(T)?"event:"+V+T:null;if(!Q){return null;}if(R){if(Q[R]){S.push(Q[R]);}}else{A.each(Q,function(X,W){S.push(X);});}return(S.length)?S:null;},_unload:function(R){var Q=A.Event;A.each(O,function(T,S){T.detachAll();D(T.el,T.type,T.fn,T.capture);delete O[S];});D(window,"load",Q._load);},nativeAdd:J,nativeRemove:D};}();A.Event=I;if(A.config.injected||YUI.Env.windowLoaded){G();}else{J(window,"load",G);}if(A.UA.ie){A.on(C,I._poll,I,true);}J(window,"unload",B);I.Custom=A.CustomEvent;I.Subscriber=A.Subscriber;I.Target=A.EventTarget;I.Handle=A.EventHandle;I.Facade=A.EventFacade;I._poll();})();A.Env.evt.plugins.available={on:function(D,C,F,E){var B=arguments.length>4?A.Array(arguments,4,true):[];return A.Event.onAvailable.call(A.Event,F,C,E,B);}};A.Env.evt.plugins.contentready={on:function(D,C,F,E){var B=arguments.length>4?A.Array(arguments,4,true):[];return A.Event.onContentReady.call(A.Event,F,C,E,B);}};},"@VERSION@",{requires:["event-custom-base"]});YUI.add("event-delegate",function(B){var J=B.Event,F=B.Lang,E={},A={mouseenter:"mouseover",mouseleave:"mouseout"},I={focus:J._attachFocus,blur:J._attachBlur},H=function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},D=function(L,Q,N){var R=H((Q.target||Q.srcElement)),O=E[L],U,P,M,T,S;var K=function(Y,V,W){var X;if(!Y||Y===W){X=false;}else{X=B.Selector.test(Y,V)?Y:K(Y.parentNode,V,W);}return X;};for(U in O){if(O.hasOwnProperty(U)){P=O[U];T=O.fn;M=null;if(B.Selector.test(R,U,N)){M=R;}else{if(B.Selector.test(R,((U.replace(/,/gi," *,"))+" *"),N)){M=K(R,U,N);}}if(M){if(!S){S=new B.DOMEventFacade(Q,N);S.container=S.currentTarget;}S.currentTarget=B.Node.get(M);B.publish(P,{contextFn:function(){return S.currentTarget;}});if(T){T(S,P);}else{B.fire(P,S);}}}}},G=function(N,M,L){var O=I[N],K=[N,function(P){D(M,(P||window.event),L);},L];if(O){return O(K,{capture:true,facade:false});}else{return J._attach(K,{facade:false});}},C=B.cached(function(K){return K.replace(/[|,:]/g,"~");});B.Env.evt.plugins.delegate={on:function(P,O,N,K,L){var M=B.Array(arguments,0,true);M.splice(3,1);M[0]=K;return B.delegate.apply(B,M);}};J.delegate=function(R,U,L,X){if(!X){return false;}var O=B.Array(arguments,0,true),N,W;if(F.isString(L)){N=B.Selector.query(L);if(N.length===0){return J.onAvailable(L,function(){J.delegate.apply(J,O);},J,true,false);}}if(J._isValidCollection(N)){W=[];B.each(N,function(Z,Y){O[2]=Z;W.push(J.delegate.apply(J,O));});return(W.length===1)?W[0]:W;}N=B.Node.getDOMNode(L);var S=B.stamp(N),M="delegate:"+S+R+C(X),K=R+S,Q=E[K],T,V,P;if(!Q){Q={};if(A[R]){if(!J._fireMouseEnter){return false;}R=A[R];Q.fn=J._fireMouseEnter;}T=G(R,K,N);B.after(function(Y){if(T.sub==Y){delete E[K];B.detachAll(M);}},T.evt,"_delete");Q.handle=T;E[K]=Q;}P=Q.listeners;Q.listeners=P?(P+1):1;Q[X]=M;O[0]=M;O.splice(2,2);V=B.on.apply(B,O);B.after(function(){Q.listeners=(Q.listeners-1);if(Q.listeners===0){Q.handle.detach();}},V,"detach");return V;};B.delegate=J.delegate;},"@VERSION@",{requires:["event-base"]});YUI.add("event-mousewheel",function(C){var B="DOMMouseScroll",A=function(E){var D=C.Array(E,0,true),F;if(C.UA.gecko){D[0]=B;F=C.config.win;}else{F=C.config.doc;}if(D.length<3){D[2]=F;}else{D.splice(2,0,F);}return D;};C.Env.evt.plugins.mousewheel={on:function(){return C.Event._attach(A(arguments));},detach:function(){return C.Event.detach.apply(C.Event,A(arguments));}};},"@VERSION@",{requires:["event-base"]});YUI.add("event-mouseenter",function(D){D.Event._fireMouseEnter=function(H,F){var E=H.relatedTarget,G=H.currentTarget;if(!G.compareTo(E)&&!G.contains(E)){D.publish(F,{contextFn:function(){return H.currentTarget;}});D.fire(F,H);}};var C=D.Env.evt.plugins,A=D.Lang.isString,B={on:function(I,H,G){var E=(I==="mouseenter")?"mouseover":"mouseout",J=I+":"+(A(G)?G:D.stamp(G))+E,F=D.Array(arguments,0,true);if(!D.getEvent(J)){D.on(E,D.rbind(D.Event._fireMouseEnter,D,J),G);}F[0]=J;F.splice(2,1);return D.on.apply(D,F);}};C.mouseenter=B;C.mouseleave=B;},"@VERSION@",{requires:["event-base"]});YUI.add("event-key",function(A){A.Env.evt.plugins.key={on:function(E,G,B,K,C){var I=A.Array(arguments,0,true),F,J,H,D;F=K&&K.split(":");if(!K||K.indexOf(":")==-1||!F[1]){I[0]="key"+((F&&F[0])||"press");return A.on.apply(A,I);}J=F[0];H=(F[1])?F[1].split(/,|\+/):null;D=(A.Lang.isString(B)?B:A.stamp(B))+K;D=D.replace(/,/g,"_");if(!A.getEvent(D)){A.on(E+J,function(P){var Q=false,M=false,N,L,O;for(N=0;N<H.length;N=N+1){L=H[N];O=parseInt(L,10);if(A.Lang.isNumber(O)){if(P.charCode===O){Q=true;}else{M=true;}}else{if(Q||!M){Q=(P[L+"Key"]);M=!Q;}}}if(Q){A.fire(D,P);}},B);}I.splice(2,2);I[0]=D;return A.on.apply(A,I);}};},"@VERSION@",{requires:["event-base"]});YUI.add("event-focus",function(A){(function(){var D=A.Env.evt.plugins,E={capture:true},C=function(){},B=function(G,I){var F=(A.Lang.isString(I))?A.Selector.query(I,null,true):I,H=F&&F.parentNode;if(H){A.Event._attach([G,C,H],E);}};A.Event._attachFocus=function(H,G){var F=A.Array(H,0,true);if(A.UA.ie){F[0]=F[0].replace(/focus/,"focusin");}else{if(A.UA.opera){B(F[0],F[2]);
}}return A.Event._attach(F,G);};A.Event._attachBlur=function(H,G){var F=A.Array(H,0,true);if(A.UA.ie){F[0]=F[0].replace(/blur/,"focusout");}else{if(A.UA.opera){B(F[0],F[2]);}}return A.Event._attach(F,G);};D.focus={on:function(){return A.Event._attachFocus(arguments,E);}};D.blur={on:function(){return A.Event._attachBlur(arguments,E);}};})();},"@VERSION@",{requires:["event-base"]});YUI.add("event-resize",function(A){(function(){var C,B,E="window:resize",D=function(F){if(A.UA.gecko){A.fire(E,F);}else{if(B){B.cancel();}B=A.later(A.config.windowResizeDelay||40,A,function(){A.fire(E,F);});}};A.Env.evt.plugins.windowresize={on:function(H,G){if(!C){C=A.Event._attach(["resize",D]);}var F=A.Array(arguments,0,true);F[0]=E;return A.on.apply(A,F);}};})();},"@VERSION@",{requires:["event-base"]});YUI.add("event",function(A){},"@VERSION@",{use:["event-base","event-delegate","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize"]});