/*
 * util-effects.js - JavaScript Effects Library
 * util.js is needed
 * Copyright (c) 2006-2007 Lucas Ferreira (www.lucasferreira.com)
 *
 * Version: 0.9.3
 */
 
var Color={fixhex:function(T){T=T.split("#").join("");if(T.length<6){T="#"+(T+T).substr(0,6);}return T.toUpperCase();},rgb2hex:function(Y,I,T){return "#"+M(Y)+M(I)+M(T);function M(z){if(typeof (z)!="number"||z<0||z>255){return ("–");}var i="0123456789ABCDEF",a=z%16;return i.charAt((z-a)/16)+i.charAt(a);}},hex2rgb:function(I,M){var T={},Y=Color.fixhex(I.toString()).split("#").join("");if(!/^([\dA-Fa-f]{2})([\dA-Fa-f]{2})([\dA-Fa-f]{2})$/.test(Y)){I=I.split("rgb").join("").split("(").join("").split(",");T.r=parseFloat(I[0]);T.g=parseFloat(I[1]);T.b=parseFloat(I[1]);}else{T.r=parseInt("0x"+RegExp.$1);T.g=parseInt("0x"+RegExp.$2);T.b=parseInt("0x"+RegExp.$3);}return M?"rgb("+T.r+", "+T.g+", "+T.b+")":T;}};var effects={fx:{defaultVel:600,move:function(T,Y,I,M){this._baseStyle=effects.getStyle(this,["left","top"]);new Tween(effects._listener(this,this._baseStyle,I),effects._array(this._baseStyle),[(T||this._baseStyle.left),(Y||this._baseStyle.top)],(M||effects.fx.defaultVel));return this;},size:function(T,I,Y,M){this._baseStyle=effects.getStyle(this,["width","height"]);new Tween(effects._listener(this,this._baseStyle,Y),effects._array(this._baseStyle),[(T||this._baseStyle.width),(I||this._baseStyle.height)],(M||effects.fx.defaultVel));return this;},size:function(T,I,Y,M){this._baseStyle=effects.getStyle(this,["width","height"]);new Tween(effects._listener(this,this._baseStyle,Y),effects._array(this._baseStyle),[(T||this._baseStyle.width),(I||this._baseStyle.height)],(M||effects.fx.defaultVel));return this;},opacity:function(I,M,T){return _d(this,effects.fx.run)({"opacity":I},M,T);},run:function(I,M,T){if(typeof I=="string"){I=effects.CSS2Object(I);}this._baseStyle=effects.getStyle(this,effects._array(I,true));new Tween(effects._listener(this,this._baseStyle,M),effects._array(this._baseStyle),effects._array(I,false,true),(T||effects.fx.defaultVel));return this;},yoyo:function(M){var T=this._baseStyle;this._baseStyle=effects.getStyle(this,effects._array(T,true));new Tween(effects._listener(this,T),effects._array(this._baseStyle),effects._array(T),(M||effects.fx.defaultVel));return this;}},colorProps:["background","background-color","color","border-color"],numberProps:["margin-left","margin-top","margin-bottom","margin-right","padding-left","padding-top","padding-bottom","padding-right","left","top","width","height","font-size","border-width"],_array:function(z,Y,M){var T=[];for(var I in z){T.push(Y?I:(M?effects._prepareValue(I,z[I]):z[I]));}return T;},_prepareValue:function(I,T){if(this.colorProps.find(I)>-1){var M=Color.hex2rgb(T);return [M.r,M.g,M.b];}else{return parseFloat(T);}return 0;},_value:function(M,T){if(this.colorProps.find(M)>-1){return typeof T!="string"?(Color.rgb2hex(T[0],T[1],T[2])):T;}else{return (T+"px");}return 0;},_listener:function(I,T,M){return {onTweenUpdate:function(h){var a=this._baseStyle,Y=0;for(var z in a){if(z=="opacity"){Alpha.set(this._target,h[Y]);}else{this._target.style[z.toString().camelize()]=effects._value(z,h[Y]);}Y++;}},onTweenEnd:function(Y){this.onTweenUpdate(Y);if(typeof this._returnFunction!="undefined"&&this._returnFunction&&this._returnFunction!=null){_d(this._target,this._returnFunction)(this._target);}},_returnFunction:M,_baseStyle:T,_target:I};},CSS2Object:function(Y){var I={},Y=Y.split(";");for(var T=0;T<Y.length;T++){var M=Y[T].split(":");I[M[0].toString().trim()]=M[1].toString().trim();}return I;},getStyle:function(Y,I){var T={};for(var M=0;M<I.length;M++){switch(I[M]){case "left":T[I[M]]=Y.getLeft();break;case "top":T[I[M]]=Y.getTop();break;case "width":T[I[M]]=Y.getWidth();break;case "height":T[I[M]]=Y.getHeight();break;case "opacity":T[I[M]]=Alpha.get(Y);break;default:T[I[M]]=effects._prepareValue(I[M],getStyle(Y,I[M])||0);break;}}return T;}};$.extendsDOM=__extends__($.extendsDOM,{fx:effects.fx.run,opacity:effects.fx.opacity,size:effects.fx.size,move:effects.fx.move,yoyo:effects.fx.yoyo});var Alpha={get:function(M){var M=typeof M=="string"?$(M):M;if(M._alpha==undefined){var T=(getStyle(M,"opacity")||100);M._alpha=T<=1?T*100:T;}return M._alpha;},set:function(T,M){var T=typeof T=="string"?$(T):T;T._alpha=M==1?2:M;T.style.filter="alpha(opacity:"+T._alpha+")";T.style.opacity=Math.max(0,Math.min(T._alpha/100,1));T.style.mozOpacity=T.style.opacity;return T._alpha;}};var Tween=function(M,Y,T,I){this.main=function(){if(M==undefined){return false;}this.arrayMode=(typeof Y!="number")?true:false;this.ID=(Tween._static.tweens.length+1);Tween._static.tweens.push(this);if(Tween._static.IntervalUpdate==null||Tween._static.IntervalUpdate==undefined){Tween._static.IntervalUpdate=setInterval(Tween._static.dispatchTween,12);}this.objEvt=__extends__(M,{onTweenStart:function(i){},onTweenUpdate:function(i){}});this.init=Y;this.end=T;this.duration=I;this.initTime=(new Date()).getTime();this.started=false;if(this.duration==0){this.endTween();}};this.easingEquation=function(a,i,h,z){return h/2*(Math.sin(Math.PI*(a/z-0.5))+1)+i;};this.getCurVal=function(z){if(this.arrayMode){var h=new Array();for(var a=0;a<this.init.length;a++){h[a]=this.getEq(z,this.init[a],this.end[a],this.duration);}return h;}else{return this.getEq(z,this.init,this.end,this.duration);}};this.getEq=function(e,w,h,K){if(typeof w=="undefined"){return 0;}if(typeof w=="number"||typeof w=="string"){return this.easingEquation(e,w,h-w,K);}else{for(var L=0,z=[];L<w.length;L++){z[L]=this.easingEquation(e,w[L],h[L]-w[L],K);}return z;}};this.update=function(){var a=(new Date()).getTime()-this.initTime;var i=this.getCurVal(a);if(a>=this.duration){this.endTween();}else{if(this.started==false){this.objEvt.onTweenStart(i);this.started=true;}else{if(this.objEvt.onTweenUpdate!=undefined){this.objEvt.onTweenUpdate(i);}}}};this.endTween=function(){if(this.objEvt.onTweenEnd!=undefined){this.objEvt.onTweenEnd(this.end);}else{this.objEvt.onTweenUpdate(this.end);}Tween._static.removeTweenAt(this.ID);};this.main();};Tween._static={tweens:new Array(),IntervalUpdate:null,dispatchTween:function(){var M=Tween._static.tweens;for(var T in M){if(M[T].update){M[T].update();}}},removeTweenAt:function(T){var I=Tween._static.tweens,T=T-1;if(T>=I.length||T<0||T==undefined){return false;}I.splice(T,1);for(var M=T;M<I.length;M++){I[M].ID--;}if(I.length==0){clearInterval(Tween._static.IntervalUpdate);delete Tween._static.IntervalUpdate;}}};var easing=new Object();easing.Back=function(M,T,i,Y,I){if(I==undefined){I=1.70158;}return i*((M=M/Y-1)*M*((I+1)*M+I)+1)+T;};easing.Bounce=function(M,T,Y,I){if((M/=I)<(1/2.75)){return Y*(7.5625*M*M)+T;}else{if(M<(2/2.75)){return Y*(7.5625*(M-=(1.5/2.75))*M+0.75)+T;}else{if(M<(2.5/2.75)){return Y*(7.5625*(M-=(2.25/2.75))*M+0.9375)+T;}else{return Y*(7.5625*(M-=(2.625/2.75))*M+0.984375)+T;}}}};easing.Elastic=function(I,T,h,z,M,i){if(I==0){return T;}if((I/=z)==1){return T+h;}if(!i){i=z*0.3;}if(!M||M<Math.abs(h)){M=h;var Y=i/4;}else{var Y=i/(2*Math.PI)*Math.asin(h/M);}return (M*Math.pow(2,-10*I)*Math.sin((I*z-Y)*(2*Math.PI)/i)+h+T);};easing.None=function(M,T,Y,I){return Y*M/I+T;};easing.Strong=function(M,T,Y,I){return Y*((M=M/I-1)*M*M*M*M+1)+T;};

