<script>
   wpj.onReady.push(function () {

      var $filterForm = $('[data-filter="wrapper"]');
      var $filter = $filterForm.categoryFilter().data('wpjCategoryFilter');

      $filter.addItems({
         {block "filter-add-items"}
         'predobjednane': {
            visible: false,
         },
         'hledani': {
            visible: false,
         },
         'sekce': {
            type: jQuery.fn.categoryFilter.ItemCheckboxMultipleSeparate,
         },
         'vyrobce': {
            type: jQuery.fn.categoryFilter.ItemCheckboxMultipleSeparate,
         },




         {if $body.dynamic_filter.price.min < $body.dynamic_filter.price.max}
         '{t}cena{/t}': {
            type: jQuery.fn.categoryFilter.ItemPrice,
            steps: 40,
            unit: '{$currency.symbol}',
            setInputValue: function (value) {
               this._super(arguments);
               if ($('#filter_price_slider_min').length && $('#filter_price_slider_max').length) {
                  $('#filter_price_slider_min').text(parseFloat(((value[0] < this.viewMin) ? this.viewMin : value[0]).toFixed(this.precision)).toLocaleString());
                  $('#filter_price_slider_max').text(parseFloat(value[1].toFixed(this.precision)).toLocaleString());
               }
            },
         },
         {/if}
         {block 'filter-paging'}
         '{t}strana{/t}': {
            type: jQuery.fn.categoryFilter.ItemPaging,
            onPageLoad: function (e, isNext) {
               if (!wpj.domUtils.isInView($filterForm) && !isNext) {
                  wpj.domUtils.scrollTo($filterForm);
               }

               return this._super(arguments)
            },
            visible: false,
            value: {$body.pager.number}
         },
         {/block}
         '{t}zobrazeni{/t}': {
            visible: false,
            visible_hash: false,
            defaultValue: 1,
            type: jQuery.fn.categoryFilter.ItemCheckboxMultiple
         }
         {/block}
      });

      {block 'filter-initialization'}
      $filter.initialize();
      {/block}

      /* add listeners for reload animation */
      $filterForm.on('categoryfilterchange', function () {
         $('body').addClass('filter-reloading');
      });

      $('body').on('crossFaded', '[data-reload="products"]', function () {
         $('body').removeClass('filter-reloading');
      });

      {block 'filter-openers'}
      {if $filter_openers}
      wpj.domUtils.initOpeners();
      {/if}
      {/block}
   });
</script>

<script data-reload="filter-script"></script>
