var tdAnimationScroll={};
(function(){tdAnimationScroll={items:[],rAFIndex:0,animation_running:!1,item:function(){this.percent_value=0;this.animation_callback=null;this.jqueryObj="";this.wrapper_jquery_obj=void 0;this.top_marker_jquery_obj="";this.full_height=0;this.offset_bottom_top=this.offset_top="";this.properties={};this.computed_item_properties={};this.computation_stopped=this._is_initialized=this.top_is_out=this.redraw=!1;this.add_item_property=function(a,c,e,f,d,b){if(!(c>=e))if(void 0===this.properties[a])this.properties[a]={computed_value:"",
settings:[]},0!==c&&(this.properties[a].settings[this.properties[a].settings.length]={start_percent:0,end_percent:c,start_value:f,end_value:f,easing:""}),this.properties[a].settings[this.properties[a].settings.length]={start_percent:c,end_percent:e,start_value:f,end_value:d,easing:b},this.properties[a].settings[this.properties[a].settings.length]={start_percent:e,end_percent:100,start_value:d,end_value:d,easing:""};else{var g=this.properties[a].settings[this.properties[a].settings.length-1];g.start_percent!==
c?(this.properties[a].settings[this.properties[a].settings.length-1]={start_percent:g.start_percent,end_percent:c,start_value:g.end_value,end_value:g.end_value,easing:""},this.properties[a].settings[this.properties[a].settings.length]={start_percent:c,end_percent:e,start_value:f,end_value:d,easing:b}):this.properties[a].settings[this.properties[a].settings.length-1]={start_percent:c,end_percent:e,start_value:f,end_value:d,easing:b};100!==e&&(this.properties[a].settings[this.properties[a].settings.length]=
{start_percent:e,end_percent:100,start_value:d,end_value:d,easing:""})}};this.remove_item_property=function(a){if(void 0===this.properties[a])return!1;delete this.properties[a];return!0}},init:function(){tdAnimationScroll.items=[]},add_item:function(a){if(a.constructor===tdAnimationScroll.item&&"undefined"!==typeof a.jqueryObj){var c=a.jqueryObj.prev();c.length&&c.hasClass("td_marker_animation")||(tdAnimationScroll.items.push(a),tdAnimationScroll._initialize_item(a))}},_initialize_item:function(a){if(!0!==
a._is_initialized&&(a.full_height=void 0===a.wrapper_jquery_obj?a.jqueryObj.outerHeight(!0):a.wrapper_jquery_obj.height(),0!==a.full_height)){var c=jQuery('<div class="td_marker_animation" style="height: 0; width: 0">');c.insertBefore(a.jqueryObj);a.top_marker_jquery_obj=c;a.offset_top=a.top_marker_jquery_obj.offset().top;a.offset_bottom_top=a.offset_top+a.full_height;a.top_is_out=tdEvents.window_pageYOffset>a.offset_top;a._is_initialized=!0}},reinitialize_all_items:function(a){for(var c=tdAnimationScroll.items.length-
1;0<=c;c--)tdAnimationScroll.reinitialize_item(tdAnimationScroll.items[c],a)},reinitialize_item:function(a,c){if(!1!==a._is_initialized){a._is_initialized=!1;a.offset_top=a.top_marker_jquery_obj.offset().top;if(!0===c&&(a.full_height=void 0===a.wrapper_jquery_obj?a.jqueryObj.outerHeight(!0):a.wrapper_jquery_obj.height(),0===a.full_height))return;a.offset_bottom_top=a.offset_top+a.full_height;a._is_initialized=!0}},_compute_item_properties:function(a){var c={},e;for(e in a.properties)if(!0===a.properties.hasOwnProperty(e)){var f=
a.properties[e];var d;for(d=0;d<f.settings.length;d++){var b=f.settings[d];if(b.start_percent<=a.percent_value&&a.percent_value<b.end_percent||a.percent_value===b.end_percent&&100===a.percent_value){if(b.start_value===b.end_value)b=b.start_value;else if(d=(a.percent_value-b.start_percent)/(b.end_percent-b.start_percent)*(b.end_value-b.start_value),void 0===b.easing||""===b.easing)b=b.start_value+d;else{var g=Math.abs(b.start_value-b.end_value)/1E3;b=b.start_value<b.end_value?b.start_value+1E3*jQuery.easing[b.easing](null,
d,0,g,b.end_value-b.start_value):b.start_value-1E3*jQuery.easing[b.easing](null,-d,0,g,b.start_value-b.end_value)}f.computed_value!==b&&(f.computed_value=b,c[e]=b,a.redraw=!0);break}}}a.computed_item_properties=c},compute_item:function(a){if(!1!==a._is_initialized){var c=0;tdEvents.window_pageYOffset+tdEvents.window_innerHeight>=a.offset_top&&(c=tdEvents.window_pageYOffset>a.offset_bottom_top?100:100*(tdEvents.window_pageYOffset+tdEvents.window_innerHeight-a.offset_top)/(tdEvents.window_innerHeight+
a.full_height));a.percent_value!==c&&(a.percent_value=c,tdAnimationScroll._compute_item_properties(a));a.top_is_out=tdEvents.window_pageYOffset>a.offset_top}},compute_all_items:function(){!1===tdAnimationScroll.animation_running&&(tdAnimationScroll.rAFIndex=window.requestAnimationFrame(tdAnimationScroll._animate_all_items));tdAnimationScroll.animation_running=!0},_animate_all_items:function(){for(var a=0;a<tdAnimationScroll.items.length;a++)!1===tdAnimationScroll.items[a].computation_stopped&&tdAnimationScroll.compute_item(tdAnimationScroll.items[a]);
for(a=0;a<tdAnimationScroll.items.length;a++)!0===tdAnimationScroll.items[a].redraw&&tdAnimationScroll.items[a].animation_callback();tdAnimationScroll.animation_running=!1},td_events_resize:function(){0!==tdAnimationScroll.items.length&&(tdAnimationScroll.reinitialize_all_items(!1),tdAnimationScroll.compute_all_items())},log:function(a){}};tdAnimationScroll.init()})();
