var gridVM;$(function(){definition!==undefined&&(gridVM=new Dmp.Platform.Eshop.ProductGrid(definition),gridVM.selectedSortLabel=ko.computed(function(){for(var t,n=0;n<gridVM.Sortables.length;n++)if(t=gridVM.Sortables[n],t.Direction())return $(".customSorter[data-sort-name='"+t.Name+"'][data-sort-dir='"+t.Direction()+"']").text();return sortingLabelRecommended}),gridVM.selectedFilterLabel=ko.computed(function(){for(var t,n=0;n<gridVM.Filters.length;n++)if(t=gridVM.Filters[n],t.Value())return $(".customFilter[data-filter-name='"+t.Name+"']").text();return"vyberte"}),gridVM.OnLoad=function(n,t,i){if(typeof bindCountdown=="function"&&$(".js-countdown").countdown("destroy"),$(".category-css-preloader").hide(),i?($("#product-list .productListData").remove(),$("#product-list .pagination-wrapper").remove(),$("#product-list").append(n)):($("#product-list").html(n),scrollToElement("#js-products-start")),t.UsePager){var r=$("#product-list .productListData").data("totalitems"),u=cast(r,Number);t.Pager.TotalItems(u);t.Pager.Update();t.UseAutoPaging&&$("#product-list-scroll").removeClass("hide")}typeof bindCountdown=="function"&&bindCountdown()},gridVM.CanUseAutoPaging=function(){return gridVM.Pager.Page()<3},ko.applyBindings(gridVM))});$(".customSorter").click(function(n){var i=$(this),u=i.data("sort-name"),r=i.data("sort-dir"),t;if(i.closest(".sort-dropdown-wrapper").find("button").dropdown("toggle"),$(".customSorter").removeClass("active"),i.addClass("active"),$(".category-css-preloader").show(),r==0)gridVM.Sortables[0].Direction(0);else for(t=0;t<gridVM.Sortables.length;t++)if(gridVM.Sortables[t].Name==u){gridVM.Sortables[t].Direction(r);break}return n.preventDefault(),!1});$(".customFilter").click(function(n){var i=$(this),r=i.data("filter-name"),t;for(i.closest(".filter-dropdown-wrapper").find("button").dropdown("toggle"),$(".customFilter").removeClass("active"),$(".category-css-preloader").show(),t=0;t<gridVM.Filters.length;t++)gridVM.Filters[t].Name==r?gridVM.Filters[t].Value()=="1"?(i.removeClass("active"),gridVM.Filters[t].Value("")):(i.addClass("active"),gridVM.Filters[t].Value("1")):gridVM.Filters[t].Value("");return n.preventDefault(),!1});$(document).on("click",".js-appendNextPage",function(){gridVM.Pager.AppendNextPage()})