var vcGridStylePagination=null;(function($){vcGridStylePagination=function(grid){this.grid=grid;this.settings=grid.settings;this.$el=false;this.$content=false;this.filterValue=null;this.isLoading=false;this.htmlCache=false;this.$loader=$('
');this.$firstSlideItems;this.init();};vcGridStylePagination.prototype.init=function(){_.bindAll(this,'addItems','initCarousel');};vcGridStylePagination.prototype.setIsLoading=function(){this.$loader.show();this.isLoading=true;};vcGridStylePagination.prototype.unsetIsLoading=function(){this.isLoading=false;this.$loader.hide();};vcGridStylePagination.prototype.render=function(){this.$el=this.grid.$el;this.$content=this.$el;this.$content.append(this.$loader);this.setIsLoading();this.grid.ajax({},this.addItems);};vcGridStylePagination.prototype.filter=function(filter){filter=_.isUndefined(filter)||'*'===filter?'':filter;if(this.filterValue==filter){return false;} var $html;if(this.$content.data('owl.vccarousel')){this.$content.off('initialized.owl.vccarousel');this.$content.off('changed.owl.vccarousel');this.$content.data('vcPagination')&&this.$content.data('vcPagination').twbsPagination('destroy');this.$content.data('owl.vccarousel').destroy();} this.$content.empty();$html=$('.vc_grid-item',this.htmlCache);if(''!==filter){$html=$html.filter(filter);} this.filterValue=filter;this.buildSlides($html.addClass('vc_visible-item'));};vcGridStylePagination.prototype.buildSlides=function($html){var i,j,tempArray,chunk=parseInt(this.settings.items_per_page);for(i=0,j=$html.length;i').append($(tempArray)).appendTo(this.$content);} this.$content.find('.vc_pageable-slide-wrapper:first').imagesLoaded(this.initCarousel);};vcGridStylePagination.prototype.addItems=function(html){this.unsetIsLoading();$(html).appendTo(this.$el);if(false===this.htmlCache){this.htmlCache=html;} this.$content=this.$el.find('[data-vc-pageable-content="true"]');this.$content.addClass('owl-carousel vc_grid-owl-theme');this.grid.initFilter();this.filter();window.vc_prettyPhoto();return false;};vcGridStylePagination.prototype.initCarousel=function(){if($.fn.vcOwlCarousel){var that=this,$vcCarousel;$vcCarousel=this.$content.data('owl.vccarousel');$vcCarousel&&$vcCarousel.destroy();this.$content.on('initialized.owl.vccarousel',function(event){if(that.settings.paging_design.indexOf('pagination')>- 1){var $carousel=event.relatedTarget;var items=$carousel.items().length;var $pagination=$('
').addClass('vc_grid-pagination').appendTo(that.$el);$pagination.twbsPagination({totalPages:items,visiblePages:that.settings.visible_pages,onPageClick:function(event,page){$carousel.to(page- 1);},paginationClass:'vc_grid-pagination-list'+' vc_grid-' + that.settings.paging_design +' vc_grid-pagination-color-'+ that.settings.paging_color,nextClass:'vc_grid-next',first:20