/*______________________________________________________________________
|        ______   |
|      /      /   |
|     /    O /    |      ___________________________________________
|    /    / /     |
|   /    / /  /|  |       U I Z E     J A V A S C R I P T     A P I
|  /____/ /__/_|  |      ___________________________________________
|            |__  |
|_________________|
|
|           TITLE : Uize.Fade Object
|         VERSION : 1.0
|            TYPE : Object Definition
|          AUTHOR : Chris van Rensburg (http://www.tomkidding.com)
|       COPYRIGHT : (c)2005 Chris van Rensburg
|     DESCRIPTION : A simple class that just implements fade automation
|        REQUIRES : Uize.js
|_______________________________________________________________________*/
(function(){var _a=Uize.Fade=Uize.subclass(function(){this._b=null;}),_c=_a.prototype;function _d(){return(new Date()).getTime()}_c.advance=function(){var _e=this,_f=Math.min((_d()-_e._g)/_e._h,1);if(_e._i)_f=1-_f;_e.set({_f:_f});if((_e._i?0-_f:_f-1)>=0){
_e.fireEvent('Done');}else{_e._b=setTimeout(_e.objectName+'.advance ()',0);}};_c.stop=function(){var _e=this;if(_e._b!=null){clearTimeout(_e._b);_e._b=null;}};_c.start=function(){var _e=this;_e.stop();_e._g=_d();if(_e._j!=0||_e._k!=0){_e._l=1-_e._j-_e._k;_e._m=2/(2-_e._j-_e._k);if(_e._j!=0)_e._n=_e._m/_e._j;if(_e._k!=0)_e._o= -_e._m/_e._k;}_e.fireEvent('Start');_e._p=_e._f=null;_e.advance();};_a.registerProperties({_j:'acceleration',_k:'deceleration',_h:'duration',_q:'endValue',_f:{name:'progress',onChange:function(){var _e=this,_r=_e._f,_p;if(_e._j!=0||_e._k!=0){function _s(_p,_t,_u){return Math.max(Math.min(_p,_u),_t)}_r=0;if(_e._j!=0){var _v=_s(_e._f,0,_e._j);_r+=(_v*_e._n/2)*_v;}if(_e._l!=0)_r+=_e._m*_s(_e._f-_e._j,0,_e._l);if(_e._k!=0){var _w=_s(_e._f-_e._j-_e._l,0,_e._k);_r+=(_e._m+_w*_e._o/2)*_w;}_r=Math.min(_r,1);}function _x(_y,_z){return _y+(_z-_y)*_r}if(typeof _e._A=='number'&&typeof _e._q=='number'){_p=_x(_e._A,_e._q);}else if(typeof _e._A.length=='number'&&_e._A.length===_e._q.length){_p=[];
for(var _B=0;_B<_e._A.length;_B++)_p[_B]=_x(_e._A[_B],_e._q[_B]);}_e.set({_p:_p});}},_i:'reverse',_A:'startValue',_p:{name:'value',onChange:function(){this.fireEvent('Advance')}}});_a.set({_j:0,_k:0,_h:2000,_q:100,_f:0,_i:false,_A:0,_p:0});})();
