/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.2.0PR1
build: nightly
*/
YUI.add("transition-native",function(B){var G="transition:start",J="transition:end",F="transition:propertyEnd",H="-webkit-transition",K="WebkitTransition",C="-webkit-transition-property",E="-webkit-transition-duration",A="-webkit-transition-timing-function",I="webkitTransitionEnd",D=function(){this.init.apply(this,arguments);};D._reKeywords=/^(?:node|duration|iterations|easing)$/;D.useNative=false;if(H in B.config.doc.documentElement.style){D.useNative=true;D.supported=true;}B.Node.DOM_EVENTS[I]=1;D.NAME="transition";D.DEFAULT_EASING="ease-in-out";D.DEFAULT_DURATION=0.5;D.prototype={constructor:D,init:function(M,L){this._node=M;this._config=L;M._transition=this;this.initAttrs(L);this._duration=("duration" in L)?L.duration:this.constructor.DEFAULT_DURATION;this._easing=L.easing||this.constructor.DEFAULT_EASING;this._count=0;this._totalDuration=0;this._running=false;return this;},initAttrs:function(N){var M={},L;for(L in N){if(!D._reKeywords.test(L)){M[L]=N[L];}}if(M.transform&&!M["-webkit-transform"]){M["-webkit-transform"]=M.transform;delete M.transform;}this._attrs=M;},run:function(){var N=this,M=N._attrs,L;if(!N._running){N._running=true;N._start();}return N;},_start:function(){this._runNative();},_prepDur:function(L){L=parseFloat(L);if(L>this._totalDuration){this._totalDuration=L;}return L+"s";},_runNative:function(P){var W={},S=this,M=S._node._node.style,X=S._attrs,Q="",Y=C+": ",V,R=E+": ",U=A+": ",O=S._node,N,L,T;for(T in X){if(X.hasOwnProperty(T)){W[T]=X[T];V=W[T];N=V;S._count++;if(typeof V.value!=="undefined"){N=V.value;}if(typeof N==="function"){N=N.call(O,O);}L=(typeof V.duration!=="undefined")?V.duration:S._duration;R+=S._prepDur(L)+",";U+=(V.easing||S._easing)+",";Y+=T+",";Q+=T+": "+N+"; ";}}Y=Y.replace(/,$/,";");R=R.replace(/,$/,";");U=U.replace(/,$/,";");if(!S._hasEndEvent){O.on(I,this._onNativeEnd,this);}if(S._totalDuration){S._node.fire(G,{type:G,config:S._config});}setTimeout(function(){M.cssText+=Y+R+U+Q;},0);},_onNativeEnd:function(O){var M=O._event,N=this,L=N._node;N._hasEndEvent=true;L.fire(F,{type:F,elapsedTime:M.elapsedTime,propertyName:M.propertyName,config:N._config});N._count--;if(M.elapsedTime>=N._totalDuration&&N._count<=0){L._node.style[K]="";L.fire(J,{type:J,elapsedTime:M.elapsedTime,config:N._config});N._running=false;}},destroy:function(){this.detachAll();this._node=null;}};B.Transition=D;B.TransitionNative=D;B.Node.prototype.transition=function(L){var M=(this._transition)?this._transition.init(this,L):new D(this,L);M.run();return this;};},"3.2.0PR1",{requires:["node-base"]});