var tdAnimationSprite={};
(function(){tdAnimationSprite={items:[],isInRequestAnimation:!1,item:function(){this.blockUid="";this.paused=this._isInitialized=!1;this.automatStart=!0;this.properties=[];this.readyToAnimate=!1;this.nextFrame=1;this.animationSpriteClass=this.jqueryObj=this.interval=void 0;this._currentDirection="right";this._executedLoops=0;this.loops=this.reverse=this.velocity=this.frameWidth=this.frames=this._prop_background_position=void 0;this.animate=function(){this._prop_background_position=-1*this.nextFrame*
this.frameWidth+"px 0";this.readyToAnimate=!0;!0===this.reverse?"right"===this._currentDirection?this.nextFrame===this.frames-1?(this._currentDirection="left",this.nextFrame--):this.nextFrame++:"left"===this._currentDirection&&(0===this.nextFrame?(this._currentDirection="right",this.nextFrame++,this._executedLoops++,0!==this.loops&&this._executedLoops===this.loops&&clearInterval(this.interval)):this.nextFrame--):this.nextFrame===this.frames-1?(this._executedLoops++,0!==this.loops&&this._executedLoops===
this.loops&&clearInterval(this.interval),this.nextFrame=0):this.nextFrame++;!1===tdAnimationSprite.isInRequestAnimation&&(tdAnimationSprite.isInRequestAnimation=!0,window.requestAnimationFrame(tdAnimationSprite.animateAllItems))}},_initializeItem:function(a){if(!0!==a._isInitialized){var b=/(td_animation_sprite\S*)/gi;"undefined"!==typeof a.jqueryObj.attr("class")&&(b=a.jqueryObj.attr("class").match(b),null!==b&&(a.offsetTop=a.jqueryObj.offset().top,a.offsetBottomToTop=a.offsetTop+a.jqueryObj.height(),
a.animationSpriteClass=b[b.length-1],b=a.animationSpriteClass.split("-"),7===b.length&&(a.frames=parseInt(b[1]),a.frameWidth=parseInt(b[2]),a.velocity=parseInt(b[3]),a.loops=parseInt(b[4]),1===parseInt(b[5])?a.reverse=!0:a.reverse=!1,1===parseInt(b[6])?a.automatStart=!0:a.automatStart=!1,a._isInitialized=!0)))}},addItem:function(a){a.constructor===tdAnimationSprite.item&&(tdAnimationSprite.items.push(a),tdAnimationSprite._initializeItem(a),!0===a.automatStart&&tdAnimationSprite.computeItem(a))},deleteItem:function(a){for(var b=
0;b<tdAnimationSprite.items.length;b++)if(tdAnimationSprite.items[b].blockUid===a)return tdAnimationSprite.items.splice(b,1),!0;return!1},computeItem:function(a){1<a.frames&&void 0===a.interval&&(a.interval=setInterval(function(){!1===a.paused&&a.animate()},a.velocity))},recomputeItem:function(a){clearInterval(a.interval);a.interval=void 0;a._isInitialized=!1;tdAnimationSprite._initializeItem(a);tdAnimationSprite.computeItem(a)},stopItem:function(a){a.constructor===tdAnimationSprite.item&&!0===a._isInitialized&&
(clearInterval(a.interval),a.interval=void 0)},startItem:function(a){a.constructor===tdAnimationSprite.item&&!0===a._isInitialized&&(a.paused=!1)},pauseItem:function(a){a.constructor===tdAnimationSprite.item&&!0===a._isInitialized&&(a.paused=!0)},computeAllItems:function(){for(var a=0;a<tdAnimationSprite.items.length;a++)tdAnimationSprite.computeItem(tdAnimationSprite.items[a])},recomputeAllItems:function(){for(var a=0;a<tdAnimationSprite.items.length;a++)tdAnimationSprite.recomputeItem(tdAnimationSprite.items[a])},
stopAllItems:function(){for(var a=0;a<tdAnimationSprite.items.length;a++)tdAnimationSprite.stopItem(tdAnimationSprite.items[a])},pauseAllItems:function(){for(var a=0;a<tdAnimationSprite.items.length;a++)tdAnimationSprite.pauseItem(tdAnimationSprite.items[a])},startAllItems:function(){for(var a=0;a<tdAnimationSprite.items.length;a++)tdAnimationSprite.startItem(tdAnimationSprite.items[a])},animateAllItems:function(){for(var a,b=0;b<tdAnimationSprite.items.length;b++)a=tdAnimationSprite.items[b],!0===
a.readyToAnimate&&(a.jqueryObj.css("background-position",a._prop_background_position),a.readyToAnimate=!1);tdAnimationSprite.isInRequestAnimation=!1}};for(var e=jQuery('span[class^="td_animation_sprite"]'),d=0;d<e.length;d++){var c=new tdAnimationSprite.item;c.jqueryObj=jQuery(e[d]);c.blockUid=c.jqueryObj.data("td-block-uid");tdAnimationSprite.addItem(c)}})();
