/**
* EaselJS
* Visit http://easeljs.com/ for documentation, updates and examples.
*
* Copyright (c) 2011 Grant Skinner
* 
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* 
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
**/
(function(i){Tween=function(b,d){this.initialize(b,d)};var a=Tween.prototype;Tween.NONE=0;Tween.LOOP=1;Tween.REVERSE=2;Tween._tweens=[];Tween.cssSuffixMap={top:"px",left:"px",bottom:"px",right:"px",width:"px",height:"px",opacity:""};Tween.get=function(b,d){return new Tween(b,d)};Tween.tick=function(b,d){for(var a=Tween._tweens,e=a.length-1;e>=0;e--){var f=a[e];if(!d||f.ignoreGlobalPause)f.tick(f._useTicks?1:b)}};Ticker&&Ticker.addListener(Tween,false);Tween.removeTweens=function(b){if(b.tweenjs_count){for(var a=
Tween._tweens,c=a.length-1;c>=0;c--)a[c]._target==b&&a.splice(c,1);b.tweenjs_count=0}};Tween._register=function(b,a){var c=b._target;if(a){if(c)c.tweenjs_count=c.tweenjs_count?c.tweenjs_count+1:1;Tween._tweens.push(b)}else c&&c.tweenjs_count--,c=Tween._tweens.indexOf(b),c!=-1&&Tween._tweens.splice(c,1)};a.ignoreGlobalPause=false;a.loop=false;a.cssSuffixMap=null;a.duration=0;a._paused=false;a._curQueueProps=null;a._initQueueProps=null;a._steps=null;a._actions=null;a._prevPosition=0;a._prevPos=-1;a._prevIndex=
-1;a._target=null;a._css=false;a._useTicks=false;a.initialize=function(b,a){this._target=b;if(a)this._useTicks=a.useTicks,this._css=a.css,this.ignoreGlobalPause=a.ignoreGlobalPause,this.loop=a.loop,a.override&&Tween.removeTweens(b);this._curQueueProps={};this._initQueueProps={};this._steps=[];this._actions=[];this._catalog=[];Tween._register(this,true)};a.wait=function(b){if(b==null||b<=0)return this;var a=this._cloneProps(this._curQueueProps);return this._addStep({d:b,p0:a,e:this._linearEase,p1:a})};
a.to=function(b,a,c){if(isNaN(a)||a<0)a=0;return this._addStep({d:a||0,p0:this._cloneProps(this._curQueueProps),e:c,p1:this._cloneProps(this._appendQueueProps(b))})};a.call=function(b,a,c){return this._addAction({f:b,p:a?a:[this],o:c?c:this._target})};a.set=function(b,a){return this._addAction({f:this._set,o:this,p:[b,a?a:this._target]})};a.play=function(b){return this.call(b.setPaused,[false],b)};a.pause=function(b){b||(b=this);return this.call(b.setPaused,[true],b)};a.setPosition=function(b,a){a==
null&&(a=1);var c=b,e=false;if(c>=this.duration)this.loop?c%=this.duration:(c=this.duration,e=true);if(c==this._prevPos)return e;if(c!=this._prevPos)if(e)this._updateTargetProps(null,1);else if(this._steps.length>0){for(var f=0,g=this._steps.length;f<g;f++)if(this._steps[f].t>c)break;f=this._steps[f-1];this._updateTargetProps(f,(c-f.t)/f.d)}f=this._prevPos;this._prevPos=c;this._prevPosition=b;a!=0&&this._actions.length>0&&(this._useTicks?this._runActions(c,c):a==1&&c<f?(f!=this.duration&&this._runActions(f,
this.duration),this._runActions(0,c,true)):this._runActions(f,c));e&&this.setPaused(true);return e};a.tick=function(b){this._paused||this.setPosition(this._prevPosition+b)};a.setPaused=function(b){if(this._paused!=!!b)this._paused=!!b,Tween._register(this,!b)};a.w=a.wait;a.t=a.to;a.c=a.call;a.s=a.set;a.toString=function(){return"[Tween]"};a.clone=function(){throw"Tween can not be cloned.";};a._updateTargetProps=function(b,a){if(this._css)var c=this.cssSuffixMap||Tween.cssSuffixMap;var e,f,g,h;!b&&
a==1?e=f=this._curQueueProps:(b.e&&(a=b.e(a,0,1,1)),e=b.p0,f=b.p1);for(n in this._initQueueProps){if((g=e[n])==null)e[n]=g=this._initQueueProps[n];if((h=f[n])==null)f[n]=h=g;g==h||a==0||a==1||typeof g!="number"?a==1&&(g=h):g+=(h-g)*a;this._target[n]=c&&c[n]?g+c[n]:g}};a._runActions=function(b,a,c){var e=b,f=a,g=-1,h=this._actions.length,i=1;b>a&&(e=a,f=b,g=h,h=i=-1);for(;(g+=i)!=h;){var a=this._actions[g],j=a.t;(j==f||j>e&&j<f||c&&j==b)&&a.f.apply(a.o,a.p)}};a._appendQueueProps=function(b){if(this._css)var a=
this.cssSuffixMap||Tween.cssSuffixMap;var c,e,f;for(f in b){if(this._initQueueProps[f]==null)if(a&&(c=a[f])!=null){var g=this._target[f],h=g.length-c.length;if((e=g.substr(h))!=c)throw"TweenJS Error: Suffixes do not match. ("+c+":"+e+")";else this._initQueueProps[f]=parseInt(g.substr(0,h))}else this._initQueueProps[f]=this._target[f];this._curQueueProps[f]=b[f]}return this._curQueueProps};a._cloneProps=function(b){var a={},c;for(c in b)a[c]=b[c];return a};a._addStep=function(b){if(b.d>0)this._steps.push(b),
b.t=this.duration,this.duration+=b.d;return this};a._addAction=function(b){b.t=this.duration;this._actions.push(b);return this};a._set=function(b,a){for(var c in b)a[c]=b[c]};i.Tween=Tween})(window);(function(i){Timeline=function(b,a,c){this.initialize(b,a,c)};var a=Timeline.prototype;a.ignoreGlobalPause=false;a.duration=0;a.loop=false;a._paused=true;a._tweens=null;a._labels=null;a._prevPosition=0;a._prevPos=0;a._useTicks=false;a.initialize=function(b,a,c){this._tweens=[];b&&this.addTween.apply(this,b);this.setLabels(a);this.setPaused(false);if(c)this._useTicks=c.useTicks,this.loop=c.loop,this.ignoreGlobalPause=c.ignoreGlobalPause};a.addTween=function(b){var a=arguments.length;if(a>1){for(var c=
0;c<a;c++)this.addTween(arguments[c]);return arguments[0]}else if(a==0)return null;this.removeTween(b);this._tweens.push(b);b.setPaused(true);b._paused=false;if(b.duration>this.duration)this.duration=b.duration;return b};a.removeTween=function(a){var d=arguments.length;if(d>1){for(var c=true,e=0;e<d;e++)c=c&&this.removeTween(arguments[e]);return c}else if(d==0)return false;d=this._tweens.indexOf(a);return d!=-1?(this._tweens.splice(d,1),a.duration>=this.duration&&this.updateDuration(),true):false};
a.addLabel=function(a,d){this._labels[a]=d};a.setLabels=function(a){this._labels=a?a:{}};a.gotoAndPlay=function(a){this.setPaused(false);this._goto(a)};a.gotoAndStop=function(a){this.setPaused(true);this._goto(a)};a.setPosition=function(a){var d=this.loop?a%this.duration:a,c=!this.loop&&a>=this.duration;this._prevPosition=a;this._prevPos=d;for(var a=0,e=this._tweens.length;a<e;a++)if(this._tweens[a].setPosition(d),d!=this._prevPos)return false;c&&this.setPaused(true);return c};a.setPaused=function(a){if(this._paused!=
!!a)this._paused=!!a,Tween._register(this,!a)};a.updateDuration=function(){for(var a=this.duration=0,d=this._tweens.length;a<d;a++)if(tween=this._tweens[a],tween.duration>this.duration)this.duration=tween.duration};a.tick=function(a){this.setPosition(this._prevPosition+a)};a.toString=function(){return"[Timeline]"};a.clone=function(){throw"Timeline can not be cloned.";};a._goto=function(a){var d=parseFloat(a);isNaN(d)&&(d=this._labels[a]);d!=null&&this.setPosition(d)};i.Timeline=Timeline})(window);(function(i){var a=function(){throw"Ease cannot be instantiated.";};a.linear=function(a){return a};a.none=a.linear;a.get=function(a){a<-1&&(a=-1);a>1&&(a=1);return function(d){return a==0?d:a<0?d*(d*-a+1+a):d*((2-d)*a+(1-a))}};a.getPowIn=function(a){return function(d){return Math.pow(d,a)}};a.getPowOut=function(a){return function(d){return 1-Math.pow(1-d,a)}};a.getPowInOut=function(a){return function(d){return(d*=2)<1?0.5*Math.pow(d,a):1-0.5*Math.abs(Math.pow(2-d,a))}};a.quadIn=a.getPowIn(2);a.quadOut=
a.getPowOut(2);a.quadInOut=a.getPowInOut(2);a.cubicIn=a.getPowIn(3);a.cubicOut=a.getPowOut(3);a.cubicInOut=a.getPowInOut(3);a.quartIn=a.getPowIn(4);a.quartOut=a.getPowOut(4);a.quartInOut=a.getPowInOut(4);a.quintIn=a.getPowIn(5);a.quintOut=a.getPowOut(5);a.quintInOut=a.getPowInOut(5);a.sineIn=function(a){return 1-Math.cos(a*Math.PI/2)};a.sineOut=function(a){return Math.sin(a*Math.PI/2)};a.sineInOut=function(a){return-0.5*(Math.cos(Math.PI*a)-1)};a.getBackIn=function(a){return function(d){return d*
d*((a+1)*d-a)}};a.backIn=a.getBackIn(1.7);a.getBackOut=function(a){return function(d){return--d*d*((a+1)*d+a)+1}};a.backOut=a.getBackOut(1.7);a.getBackInOut=function(a){a*=1.525;return function(d){return(d*=2)<1?0.5*d*d*((a+1)*d-a):0.5*((d-=2)*d*((a+1)*d+a)+2)}};a.backInOut=a.getBackInOut(1.7);a.circIn=function(a){return-(Math.sqrt(1-a*a)-1)};a.circOut=function(a){return Math.sqrt(1- --a*a)};a.circInOut=function(a){return(a*=2)<1?-0.5*(Math.sqrt(1-a*a)-1):0.5*(Math.sqrt(1-(a-=2)*a)+1)};a.bounceIn=
function(b){return 1-a.bounceOut(1-b)};a.bounceOut=function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375};a.bounceInOut=function(b){return b<0.5?a.bounceIn(b*2)*0.5:a.bounceOut(b*2-1)*0.5+0.5};a.getElasticIn=function(a,d){var c=Math.PI*2;return function(e){if(e==0||e==1)return e;var f=d/c*Math.asin(1/a);return-(a*Math.pow(2,10*(e-=1))*Math.sin((e-f)*c/d))}};a.elasticIn=a.getElasticIn(1,0.3);a.getElasticOut=
function(a,d){var c=Math.PI*2;return function(e){if(e==0||e==1)return e;var f=d/c*Math.asin(1/a);return a*Math.pow(2,-10*e)*Math.sin((e-f)*c/d)+1}};a.elasticOut=a.getElasticOut(1,0.3);a.getElasticInOut=function(a,d){var c=Math.PI*2;return function(e){var f=d/c*Math.asin(1/a);return(e*=2)<1?-0.5*a*Math.pow(2,10*(e-=1))*Math.sin((e-f)*c/d):a*Math.pow(2,-10*(e-=1))*Math.sin((e-f)*c/d)*0.5+1}};a.elasticInOut=a.getElasticInOut(1,0.3*1.5);i.Ease=a})(window);

