/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.2.0
build: nightly
*/
YUI.add("transition-native",function(B){var I="-webkit-transition",G="WebkitTransition",C="-webkit-transition-property",F="-webkit-transition-duration",A="-webkit-transition-timing-function",D="-webkit-transition-delay",J="webkitTransitionEnd",K="WebkitTransform",H={},E=function(){this.init.apply(this,arguments);};E._toCamel=function(L){L=L.replace(/-([a-z])/gi,function(N,M){return M.toUpperCase();});return L;};E._toHyphen=function(L){L=L.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g,function(P,O,N,M){var Q="";if(O){Q+="-"+O.toLowerCase();}Q+=N;if(M){Q+="-"+M.toLowerCase();}return Q;});return L;};E._reKeywords=/^(?:node|duration|iterations|easing|delay)$/;E.useNative=false;if(I in B.config.doc.documentElement.style){E.useNative=true;E.supported=true;}B.Node.DOM_EVENTS[J]=1;E.NAME="transition";E.DEFAULT_EASING="ease";E.DEFAULT_DURATION=0.5;E.DEFAULT_DELAY=0;E._nodeAttrs={};E.prototype={constructor:E,init:function(M,L){var N=this;if(!N._running){N._node=M;N._config=L;M._transition=N;N._duration=("duration" in L)?L.duration:N.constructor.DEFAULT_DURATION;N._delay=("delay" in L)?L.delay:N.constructor.DEFAULT_DELAY;N._easing=L.easing||N.constructor.DEFAULT_EASING;N._count=0;N._running=false;N.initAttrs(L);}return N;},addProperty:function(S,N){var Q=this,P=this._node,O=B.stamp(P),M=E._nodeAttrs[O],L,R;if(!M){M=E._nodeAttrs[O]={};}L=M[S];if(N&&N.value!==undefined){R=N.value;}else{if(N!==undefined){R=N;N=H;}}if(typeof R==="function"){R=R.call(P,P);}if(L&&L.transition&&L.transition!==Q){L.transition._count--;}Q._count++;M[S]={value:R,duration:((typeof N.duration!=="undefined")?N.duration:Q._duration)||0.0001,delay:(typeof N.delay!=="undefined")?N.delay:Q._delay,easing:N.easing||Q._easing,transition:Q};},removeProperty:function(N){var M=this,L=E._nodeAttrs[B.stamp(M._node)];if(L&&L[N]){delete L[N];M._count--;}},initAttrs:function(M){var L;if(M.transform&&!M[K]){M[K]=M.transform;delete M.transform;}for(L in M){if(M.hasOwnProperty(L)&&!E._reKeywords.test(L)){this.addProperty(L,M[L]);}}},run:function(M){var L=this;if(!L._running){L._running=true;L._node.fire("transition:start",{type:"transition:start",config:L._config});L._start();L._callback=M;}return L;},_start:function(){this._runNative();},_prepDur:function(L){L=parseFloat(L);return L+"s";},_runNative:function(O){var T=this,P=T._node,W=B.stamp(P),U=P._node,M=U.style,R=getComputedStyle(U),a=E._nodeAttrs[W],N="",b=R[C],Z=C+": ",S=F+": ",Y=A+": ",V=D+": ",Q,X,L;if(b!=="all"){Z+=b+",";S+=R[F]+",";Y+=R[A]+",";V+=R[D]+",";}for(L in a){Q=E._toHyphen(L);X=a[L];if(a.hasOwnProperty(L)&&X.transition===T){if(L in U.style){S+=T._prepDur(X.duration)+",";V+=T._prepDur(X.delay)+",";Y+=(X.easing)+",";Z+=Q+",";N+=Q+": "+X.value+"; ";}else{this.removeProperty(L);}}}Z=Z.replace(/,$/,";");S=S.replace(/,$/,";");Y=Y.replace(/,$/,";");V=V.replace(/,$/,";");if(!P._hasTransitionEnd){T._detach=P.on(J,T._onNativeEnd);P._hasTransitionEnd=true;}M.cssText+=Z+S+Y+V+N;},_end:function(L){var O=this,M=O._node,P=O._callback,N={type:"transition:end",config:O._config,elapsedTime:L};O._running=false;if(P){O._callback=null;setTimeout(function(){P.call(M,N);},1);}M.fire("transition:end",N);},_endNative:function(L){var M=this._node,N=M.getComputedStyle(C);if(typeof N==="string"){N=N.replace(new RegExp("(?:^|,\\s)"+L+",?"),",");N=N.replace(/^,|,$/,"");M.setStyle(G,N);}},_onNativeEnd:function(Q){var N=this,P=B.stamp(N),L=Q._event,M=E._toCamel(L.propertyName),T=L.elapsedTime,S=E._nodeAttrs[P],R=S[M],O=(R)?R.transition:null;if(O){O.removeProperty(M);O._endNative(M);N.fire("transition:propertyEnd",{type:"propertyEnd",propertyName:M,elapsedTime:T});if(O._count<=0){O._end(T);}}},destroy:function(){var L=this;if(L._detach){L._detach.detach();}L._node=null;}};B.Transition=E;B.TransitionNative=E;B.Node.prototype.transition=function(L,N){var M=this._transition;if(M&&!M._running){M.init(this,L);}else{M=new E(this,L);}M.run(N);return this;};B.NodeList.prototype.transition=function(L,M){this.each(function(N){N.transition(L,M);});return this;};},"3.2.0",{requires:["node-base"]});