(function(){if(typeof Spry=="undefined"||!Spry.Utils||!Spry.$$){alert("Error loading page. Please refresh.\nError:SpryDOMEffects.js requires SpryDOMUtils.js");return}if(!Spry.Effect){Spry.Effect={}}Spry.Effect.Animator=function(b){Spry.Effect.Animator.Notifier.call(this);this.animatorID=Spry.Effect.Animator.nextID++;this.dropFrames=true;this.fps=60;this.duration=500;this.timer=0;this.startTime=0;this.currentFrame=0;this.easeFunc=Spry.Effect.Animator.defaultEaseFunc;this.stopped=false;Spry.Effect.Animator.copyProps(this,b);this.interval=1000/this.fps;this.numFrames=(this.duration/1000)*this.fps;if(this.onComplete){var a=this;this.addObserver({onAnimationComplete:function(){a.onComplete()}})}};Spry.Effect.Animator.nextID=1;Spry.Effect.Animator.copyProps=function(b,a){if(a){for(prop in a){b[prop]=a[prop]}}return b};Spry.Effect.Animator.getElement=function(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push(Spry.Effect.Animator.getElement(arguments[a]))}return d}if(typeof b=="string"){b=document.getElementById(b)}return b};Spry.Effect.Animator.defaultEaseFunc=function(d,b,a,c){d/=c;return b+((2-d)*d*a)};Spry.Effect.Animator.Notifier=function(){this.observers=[];this.suppressNotifications=0};Spry.Effect.Animator.Notifier.prototype.addObserver=function(b){if(!b){return}var a=this.observers.length;for(var c=0;c<a;c++){if(this.observers[c]==b){return}}this.observers[a]=b};Spry.Effect.Animator.Notifier.prototype.removeObserver=function(a){if(!a){return}for(var b=0;b<this.observers.length;b++){if(this.observers[b]==a){this.observers.splice(b,1);break}}};Spry.Effect.Animator.Notifier.prototype.notifyObservers=function(b,d){if(!b){return}if(!this.suppressNotifications){var a=this.observers.length;for(var c=0;c<a;c++){var e=this.observers[c];if(e){if(typeof e=="function"){e(b,this,d)}else{if(e[b]){e[b](this,d)}}}}}};Spry.Effect.Animator.Notifier.prototype.enableNotifications=function(){if(--this.suppressNotifications<0){this.suppressNotifications=0;Spry.Debug.reportError("Unbalanced enableNotifications() call!\n")}};Spry.Effect.Animator.Notifier.prototype.disableNotifications=function(){++this.suppressNotifications};Spry.Effect.Animator.prototype=new Spry.Effect.Animator.Notifier;Spry.Effect.Animator.prototype.constructor=Spry.Effect.Animator;Spry.Effect.Animator.prototype.start=function(){this.stopped=false;this.currentFrame=0;this.startTime=(new Date()).getTime();this.notifyObservers("onAnimationStart");var a=this;this.timer=setTimeout(function(){a.onStepAnimation()},this.interval)};Spry.Effect.Animator.prototype.stop=function(){if(this.timer){clearTimeout(this.timer)}this.timer=0;this.stopped=true;this.notifyObservers("onAnimationStopped")};Spry.Effect.Animator.prototype.onStepAnimation=function(){var b={};if(this.dropFrames){b.duration=this.duration;b.elapsed=((new Date).getTime())-this.startTime;if(b.elapsed>b.duration){b.elapsed=b.duration}}else{b.duration=this.numFrames;b.elapsed=++this.currentFrame}b.easingConst=this.easeFunc(b.elapsed,0,1,b.duration);this.notifyObservers("onPreDraw",b);this.draw(b.elapsed,b.duration,b.easingConst);this.notifyObservers("onPostDraw",b);if(!this.stopped){if(b.elapsed<b.duration){var a=this;this.timer=setTimeout(function(){a.onStepAnimation()},this.interval)}else{this.stop();this.notifyObservers("onAnimationComplete")}}};Spry.Effect.Animator.prototype.draw=function(a,c,b){debug.log("elapsed: "+a+" -- duration: "+c+" -- easingConst: "+b)};Spry.Effect.CSSAnimator=function(b,c,a){this.animationSets=[];Spry.Effect.Animator.call(this,a);this.add(b,c)};Spry.Effect.CSSAnimator.prototype=new Spry.Effect.Animator();Spry.Effect.CSSAnimator.prototype.constructor=Spry.Effect.CSSAnimator;Spry.Effect.CSSAnimator.prototype.add=function(a,d){a=Spry.$$(a);if(a.length<1){return}var h={elements:a,cssProps:[]};this.animationSets.push(h);var f=Spry.Utils.styleStringToObject(d);for(var b in f){var e=new Object;var j=f[b];e.value=new Number(j.replace(/[^-\d\.]+/g,""));e.units=j.replace(/[-\d+\.]/g,"");f[b]=e}for(var g=0;g<a.length;g++){var e=h.cssProps[g]=new Object;for(var b in f){var c=Spry.Effect.CSSAnimator.stylePropFuncs[b];if(!c){c=Spry.Effect.CSSAnimator.stylePropFuncs["default"]}e[b]=new Object;e[b].from=new Number(c.get(a[g],b).replace(/[^-\d\.]+/g,""));e[b].to=f[b].value;e[b].distance=e[b].to-e[b].from;e[b].units=f[b].units}}};Spry.Effect.CSSAnimator.prototype.start=function(){for(var j=0;j<this.animationSets.length;j++){var f=this.animationSets[j];var a=f.elements;var c=f.cssProps;for(var e=0;e<a.length;e++){var h=a[e];var g=h.spryCSSAnimatorProps;if(!g){g=h.spryCSSAnimatorProps=new Object}var d=c[e];for(var b in d){g[b]=this.animatorID}}}return Spry.Effect.Animator.prototype.start.call(this)};Spry.Effect.CSSAnimator.prototype.stop=function(){for(var j=0;j<this.animationSets.length;j++){var f=this.animationSets[j];var a=f.elements;var c=f.cssProps;for(var e=0;e<a.length;e++){var h=a[e];var d=c[e];var g=h.spryCSSAnimatorProps;for(var b in d){if(g[b]==this.animatorID){delete g[b]}}}}return Spry.Effect.Animator.prototype.stop.call(this)};Spry.Effect.CSSAnimator.prototype.draw=function(l,d,h){for(var n=0;n<this.animationSets.length;n++){var j=this.animationSets[n];var a=j.elements;var e=j.cssProps;for(var g=0;g<a.length;g++){var m=a[g];var k=m.spryCSSAnimatorProps;var f=e[g];for(var b in f){if(k[b]==this.animatorID){var c=Spry.Effect.CSSAnimator.stylePropFuncs[b];if(!c){c=Spry.Effect.CSSAnimator.stylePropFuncs["default"]}if(l>d){c.set(m,b,f[b].to+f[b].units)}else{c.set(m,b,f[b].from+(f[b].distance*h)+f[b].units)}}}}}};Spry.Effect.CSSAnimator.stylePropFuncs={};Spry.Effect.CSSAnimator.stylePropFuncs["default"]={get:function(a,b){return a.style[b]},set:function(a,c,b){a.style[c]=b}};Spry.Effect.CSSAnimator.stylePropFuncs.opacity={get:function(b,d){var c=1;if(b.style.opacity){c=b.style.opacity}else{if(b.style.filter){var a=b.style.filter.replace(/.*alpha\(opacity=(\d+)\).*/,"$1");if(a){c=parseInt(a)/100}}}return c+""},set:function(a,c,b){a.style.opacity=""+b;a.style.filter="alpha(opacity="+(b*100)+")"}};Spry.$$.Results.defaultEaseFunc=function(d,b,a,c){d/=c;return b+((2-d)*d*a)};Spry.$$.Results.animatePropertyTo=function(f,h,j){var a={interval:10,duration:1000,onComplete:null,transition:Spry.$$.Results.defaultEaseFunc};Spry.Effect.Animator.copyProps(a,j);var e=[];for(var d=0;d<this.length;d++){var c=e[d]=new Object;c.ele=this[d];c.from=c.ele[f];c.distance=h-c.from}var b=(new Date).getTime();var g=function(){var k=((new Date).getTime())-b;if(k>a.duration){for(var l=0;l<e.length;l++){e[l].ele[f]=h}if(a.onComplete){a.onComplete()}}else{for(var l=0;l<e.length;l++){var m=e[l];m.ele[f]=a.transition(k,m.from,m.distance,a.duration)}setTimeout(g,a.interval)}};setTimeout(g,a.interval);return this};Spry.$$.Results.animateStyleTo=function(d,c){var b=new Spry.Effect.CSSAnimator(this,d,c);b.start();return this}})();
