var tdAjaxLoop={};
(function(){tdAjaxLoop={loopState:{sidebarPosition:"",moduleId:1,currentPage:1,max_num_pages:0,atts:{},ajax_pagination_infinite_stop:0,server_reply_html_data:""},init:function(){jQuery(".td-ajax-loop-infinite").each(function(){var a=new tdInfiniteLoader.item;a.jqueryObj=jQuery(this);a.uid="tdAjaxLoop";a.isVisibleCallback=function(){0!==tdAjaxLoop.loopState.ajax_pagination_infinite_stop&&tdAjaxLoop.loopState.currentPage>=tdAjaxLoop.loopState.ajax_pagination_infinite_stop&&tdAjaxLoop.loopState.currentPage+1<
tdAjaxLoop.loopState.max_num_pages?jQuery(".td-load-more-infinite-wrap").css("display","block").css("visibility","visible"):tdAjaxLoop.infiniteNextPage(!1)};tdInfiniteLoader.addItem(a)});jQuery(".td-load-more-infinite-wrap").on("click",function(a){a.preventDefault();jQuery(".td-load-more-infinite-wrap").css("visibility","hidden");tdAjaxLoop.infiniteNextPage(!0)})},infiniteNextPage:function(a){tdAjaxLoop.loopState.currentPage++;tdAjaxLoop.loopState.server_reply_html_data="";tdAjaxLoop.loopState.currentPage>
tdAjaxLoop.loopState.max_num_pages||(jQuery(".td-ss-main-content").append('<div class="td-loader-gif td-loader-infinite td-loader-animation-start"></div>'),tdLoadingBox.init(tds_theme_color_site_wide,45),setTimeout(function(){jQuery(".td-loader-gif").removeClass("td-loader-animation-start").addClass("td-loader-animation-mid")},50),jQuery.ajax({type:"POST",url:td_ajax_url,cache:!0,data:{action:"td_ajax_loop",loopState:tdAjaxLoop.loopState},success:function(b,c,d){tdAjaxLoop._processAjaxRequest(b,a)},
error:function(a,c,d){}}))},_processAjaxRequest:function(a,b){jQuery(".td-loader-gif").remove();tdLoadingBox.stop();a=jQuery.parseJSON(a);""===a.server_reply_html_data?jQuery(".td-load-more-infinite-wrap").css("visibility","hidden"):(jQuery(".td-ajax-loop-infinite").before(a.server_reply_html_data),parseInt(a.currentPage)>=parseInt(a.max_num_pages)?jQuery(".td-load-more-infinite-wrap").css("visibility","hidden"):!0===b&&jQuery(".td-load-more-infinite-wrap").css("visibility","visible"),setTimeout(function(){tdAnimationStack.check_for_new_items(".td-main-content .td-animation-stack",
tdAnimationStack.SORTED_METHOD.sort_left_to_right,!0,!1)},200),!0!==b&&(setTimeout(function(){tdInfiniteLoader.computeTopDistances();tdInfiniteLoader.enable_is_visible_callback("tdAjaxLoop")},500),setTimeout(function(){tdInfiniteLoader.computeTopDistances()},1E3),setTimeout(function(){tdInfiniteLoader.computeTopDistances()},1500)))}}})();
