$(function(){(function(){var e=window.History,g=$("title").html(),k=!0;return{init:function(){function l(a){var b={},c;a=("/"+a).split(/[?&]/);for(var d=a.length-1;0<d;d--)b[(c=a[d].split(/[=#]/))[0].toLowerCase()]=1<c.length?decodeURI(c[1]):"";return b}function n(){var a=l(e.getState().hash);$.each(go_params,function(b,c){"undefined"==typeof c.value&&(c.value="");go_params[b].value="undefined"!=typeof a[c.id]&&0<a[c.id].length?a[c.id]:"";""==go_params[b].value&&""!=go_params[b].defaultvalue&&(go_params[b].value=
go_params[b].defaultvalue)});return!0}function p(){console.log("refreshContent");$.getJSON(f(),{pb_skiptemplate:1},function(a){if("undefined"!=typeof a.content&&""!=a.content)return console.log("true"),$("#category-content").html(a.content),$("#mobile-filters-container").html(a.mobilefilters),q(),m(a.available),k&&$("html,body").animate({scrollTop:$("#category-content").offset().top},400),k=!0;console.log("false");e.back();return!1})}function f(){var a="/"+gs_alias,b=a.length;$.each(go_params,function(c,
d){"undefined"!=typeof d.value&&0<d.value.toString().length&&(a+=a.length>b?"&"+d.id+"="+d.value:"?"+d.id+"="+d.value)});return a}function q(){var a=l(e.getState().hash);$(".subfilter label").removeClass("active");$.each(go_params,function(b,c){var d=$("ul[data-container='"+b+"']");a.hasOwnProperty(c.id)&&0<d.length&&(la_activeattributes=a[c.id].split("|"),$.each(la_activeattributes,function(a,c){d.find("li[data-"+b+"='"+c+"']").addClass("active")}))})}function m(a){a=a||go_available;null==a||0==
a.length?$(".subfilter label").removeClass("disabled"):$(".subfilter label").each(function(){el=$(this).parent(".subfilter");dataname=el.data("container");if(!el)return!1;if(0<el.find("input[checked]").length)return 1;v=$(this).data(dataname);"undefined"==typeof a[dataname]?$(this).addClass("disabled"):"undefined"==typeof a[dataname][v]?$(this).addClass("disabled"):$(this).removeClass("disabled")})}if(0==$("#category-content").length)return console.log("here"),!1;$(window).bind("statechange",function(){n();
p()});$(document).on("change",".sort",function(){k=!1;go_params.sort.value=$(this).val();go_params.page.value=1;$(".sort").val($(this).val());e.pushState(go_params,g,f());return!1});$(document).on("change",".pagesize",function(){k=!0;go_params.perpage.value=$(this).val();$(".pagesize").val($(this).val());e.pushState(go_params,g,f());return!1});$(document).on("click",".pagebuttons a",function(){var a=l($(this).attr("href"));go_params.page.value=a[go_params.page.id];e.pushState(go_params,g,f());return!1});
$(".subfilter label").click(function(a){if($(this).hasClass("disabled"))return!1;a=$(this).parent();var b=a.attr("data-container");go_params[b].value="";val=$(this).data(b);$("label[data-"+b+"='"+val+"']").each(function(){checkbox=$(this).prev();checkbox.attr("checked")?checkbox.removeAttr("checked"):checkbox.attr("checked","checked")});$(a).find("input").each(function(a,d){checked=$(this).attr("checked");"undefined"!==typeof checked&&!1!==checked&&(go_params[b].value=""==go_params[b].value?$(this).next().attr("data-"+
b):go_params[b].value+("|"+$(this).next().attr("data-"+b)))});go_params.page.value=1;e.pushState(go_params,g,f());return!1});$(".category-content").click(function(){if(!$(this).hasClass("pricereset")){var a=$(this).parents(".subfilter").find(".subfilter");a.find("input").removeAttr("checked");go_params[a.attr("data-container")].value="";e.pushState(go_params,g,f());return!1}});li_min=$(".range-min:eq(0)").data("val");li_max=$(".range-max:eq(0)").data("val");la_params=l(window.location);la_params.mm?
(la_minmax=la_params.mm.split(","),li_selectedmin=parseInt(la_minmax[0]),li_selectedmax=parseInt(la_minmax[1])):(li_selectedmin=0,li_selectedmax=parseInt(li_max));li_min=parseInt(li_min);li_max=parseInt(li_max);console.log(li_min);console.log(li_max);var h=document.getElementById("slider-handles");noUiSlider.create(h,{start:[li_min,li_max],margin:100,step:1,connect:!0,range:{min:li_min,max:li_max},format:wNumb({decimals:0,thousand:"",mark:"",prefix:"$"})});h.noUiSlider.on("update",function(a){console.log(a);
$("#slider-handles-value-min").html(a[0]);$("#slider-handles-value-max").html(a[1])});h.noUiSlider.on("change",function(a){li_selectedmin=a[0].replace(/[^0-9]/,"");li_selectedmax=a[1].replace(/[^0-9]/,"");go_params.minmax.value=li_selectedmin+","+li_selectedmax;e.pushState(go_params,g,f());return!1});h=document.getElementById("slider-handles1");noUiSlider.create(h,{start:[li_min,li_max],margin:100,step:1,connect:!0,range:{min:li_min,max:li_max},format:wNumb({decimals:0,thousand:"",mark:"",prefix:"$"})});
h.noUiSlider.on("update",function(a){$("#slider-handles1-value-min").html(a[0]);$("#slider-handles1-value-max").html(a[1])});h.noUiSlider.on("change",function(a){li_selectedmin=a[0].replace(/[^0-9]/,"");li_selectedmax=a[1].replace(/[^0-9]/,"");go_params.minmax.value=li_selectedmin+","+li_selectedmax;e.pushState(go_params,g,f());return!1});m();return this}}})().init()});