/*______________
|       ______  |   U I Z E     J A V A S C R I P T     A P I
|     /      /  |   -----------------------------------------
|    /    O /   |    MODULE : Uize.Fade Class (version 1.0.0)
|   /    / /    |    AUTHOR : Chris van Rensburg (http://www.tomkidding.com)
|  /    / /  /| |    ONLINE : http://www.tomkidding.com/uize/uize-js-api
| /____/ /__/_| | COPYRIGHT : (c)2005-2006 Chris van Rensburg
|           |__ |   LICENSE : Distributed under the terms of the GNU General Public License
|_______________|             http://www.gnu.org/licenses/gpl.txt
*/
(function(){var _a=Uize.Fade=Uize.subclass(function(){var _b=this;_b._c=null;_b._d=function(){_b._e()};}),_f=_a.prototype;function _g(){return(new Date()).getTime()}_f._e=function(){var _b=this,_h=Math.min((_g()-_b._i)/_b._j,1);if(_b._k)_h=1-_h;_b.set({_h:_h});if((_b._k?0-_h:_h-1)>=0){_b.fireEvent('Done');}else{_b._c=setTimeout(_b._d,0);}};_f._l=function(){var _b=this;_b._m=_b._n!=0;_b._o=_b._p!=0;_b._q=_b._m||_b._o;
_b._r=typeof _b._s=='number'&&typeof _b._t=='number';_b._u= !_b._r&&typeof _b._s.length=='number'&&_b._s.length===_b._t.length;};_f.stop=function(){var _b=this;if(_b._c){clearTimeout(_b._c);_b._c=null;}};_f.start=function(){var _b=this;_b.stop();_b._i=_g();_b._l();if(_b._q){_b._v=1-_b._n-_b._p;_b._w=2/(2-_b._n-_b._p);if(_b._m)_b._x=_b._w/_b._n;if(_b._o)_b._y= -_b._w/_b._p;}_b.fireEvent('Start');_b._z=_b._h=null;_b._e();};_a.registerProperties({_n:{name:'acceleration',onChange:_f._l},_p:{name:'deceleration',onChange:_f._l},_j:'duration',_t:{name:'endValue',onChange:_f._l},_h:{name:'progress',onChange:function(){var _b=this,_A=_b._h,_z;if(_b._q){function _B(_z,_C,_D){return Math.max(Math.min(_z,_D),_C)}_A=0;if(_b._m){var _E=_B(_b._h,0,_b._n);_A+=(_E*_b._x/2)*_E;}if(_b._v)_A+=_b._w*_B(_b._h-_b._n,0,_b._v);if(_b._o){var _F=_B(_b._h-_b._n-_b._v,0,_b._p);_A+=(_b._w+_F*_b._y/2)*_F;}_A=Math.min(_A,1);}function _G(_H,_I){return _H+(_I-_H)*_A}if(_b._r){_z=_G(_b._s,_b._t);}else if(_b._u){_z=[];
for(var _J=0;_J<_b._s.length;_J++)_z[_J]=_G(_b._s[_J],_b._t[_J]);}_b.set({_z:_z});}},_k:'reverse',_s:{name:'startValue',onChange:_f._l},_z:{name:'value',onChange:function(){this.fireEvent('Advance')}}});_a.set({_n:0,_p:0,_j:2000,_t:100,_h:0,_k:false,_s:0,_z:0});})();