$(document).ready(function(){function i(){let t=[...document.querySelectorAll(".lazy-load")];t.forEach(t=>n(t))}function n(n){n.src.includes("svg+xml")&&(n.src=n.dataset.src)}$("main").on("click tap",".thumb-swap",function(){var n=$(this);$(n.data("target")).attr("src",n.data("image"));n.siblings().removeClass("active");n.addClass("active")});$("main").on("mouseenter",".img-container",function(){var n,t;screen.availWidth>991&&(n=$(this),n.data("hasback")!=undefined&&(t=n.find(".product-image"),n.data("originalimgsrc",t.attr("src")),t.attr("src",n.data("backimgsrc"))))});$("main").on("mouseleave",".img-container",function(){if(screen.availWidth>991){var n=$(this);n.data("hasback")!=undefined&&n.find(".product-image").attr("src",n.data("originalimgsrc"))}});$("body").on("click",".quickview",function(n){n.preventDefault();var i=$(this).data("productid"),r=$(this).data("detailurl"),t=$("#quickview .modal-content");t.html('
Loading product data');$("#quickview").modal("show");$.get("/products/get-product-quickview/"+i,function(n){n.IsError?$("#quickview").modal("hide"):(t.html(n.Data),t.find(".quickview-detail-url").attr("href",r))})});$("body").on("click",".grid-wishlist",function(){var n=$(this),t=n.data("id");$.post("/cart/toggle-wishlist-item",{productId:n.data("id"),productName:n.data("name")},function(t){t.Data.InList===!0?n.addClass("in-wishlist"):n.removeClass("in-wishlist");t.Data.ShowWishlistPopup?($("#first-wishlist-item-title").html(t.Message),$("#first-wishlist-item-scanId").html(t.Data.ScanId),$("#first-wishlist-item-modal").modal("show")):$.sticky(t.Message,{classList:"success",autoclose:2e3});$("#wishlist-count-big").html(t.Data.WishlistCount);$("#wishlist-count-small").html(t.Data.WishlistCount)})});let t=200;window.lazyLoadImages=function(){let i=[...document.querySelectorAll(".lazy-load")];i.forEach(i=>{i.offsetTop50||document.documentElement.scrollTop>50?(a.style.left="0",v.style.left="0"):(a.style.left="-100%",v.style.left="-100%")}function rt(){tt.click()}function ut(){document.body.scrollTop=0;document.documentElement.scrollTop=0}var i,c,l;let s=location.pathname.toLowerCase().indexOf("shoes")>-1;i=5e3;s&&(i=200);$("#slider-range, #slider-range-mobile").slider({range:!0,min:0,max:i,step:10,values:[$("#priceMin").val(),$("#priceMax").val()],slide:function(n,t){o(t.values[0],t.values[1]);$("#priceMin").val(t.values[0]);$("#priceMax").val(t.values[1])},stop:function(){u();n(!0)}});$("#lock-price-slider").val()==="true"&&$("#slider-range, #slider-range-mobile").slider({disabled:!0});o($("#slider-range").slider("values",0),$("#slider-range").slider("values",1));var u=function(){r.val(0)},h=function(n,t){$("#applied-filters").append('
  • '+n.data("name")+'x<\/span><\/li>');e||u()},y=function(n){$('#applied-filters li[data-id="'+n.data("id")+'"]').remove();u()},p=function(){$("#applied-filters li").length>0?$(".applied-filters-container").show():$(".applied-filters-container").hide()},w=function(){$("#applied-filters").html("");$('#search-filters input[type="checkbox"], #search-filters-mobile input[type="checkbox"]').prop("checked","");$("#onSale, #onSale-modal, #in-stock, #in-stock-modal").prop("checked","");$("#search-instructions").fadeIn();var n=$("#slider-range, #slider-range-mobile");n.slider("values",0,0);n.slider("values",1,i);o($("#slider-range, #slider-range-mobile").slider("values",0),$("#slider-range-mobile").slider("values",1));$("#priceMin").val(0);$("#priceMax").val(i);$(".result-count").html("0");$("#product-results").fadeOut().html("")},b=function(){return window.location.href.split("?")[0]},g=function(n){return n.replace(/\w\S*/g,function(n){return n.charAt(0).toUpperCase()+n.substr(1).toLowerCase()})},t=function(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))},k=function(){var n,u,s,v,y,e,c,l;let a=t("page");a.length>0&&(f=!0,r.val(a-1));n=t("pMin");u=t("pMax");(n.length>0||u.length>0)&&(n==""&&(n=0),u==""&&(u=i),$("#priceMin").val(n),$("#priceMax").val(u),s=$("#slider-range, #slider-range-mobile"),s.slider("values",0,n),s.slider("values",1,u),o(n,u));v=t("os");v==="true"&&$("#onSale, #onSale-mobile").prop("checked","checked");y=t("inStock");y==="true"&&$("#in-stock, #in-stock-mobile").prop("checked","checked");e=t("s");e.length>0&&(e==="null"&&(e=0),$("#sort").val(e));c=t("a");c.length>0&&$.each(c.split(","),function(n,t){var i=$("input[data-id="+t+"]");i.length>0&&(i.prop("checked","checked"),h(i,i.data("type")))});l=t("sizes");l.length>0&&$.each(l.split(","),function(n,t){t=t.replace(".","-");var i=$("input.size-input#size-"+t);i.length>0&&(i.prop("checked","checked"),$(".size-square.selection-size-"+t).addClass("on"))})};var n=function(n){var u,h,c,l,a,o;e||f||r.val(0);var s=$("#applied-filters li"),v=$("#sort").val(),t="?priceMin="+$("#priceMin").val()+"&priceMax="+$("#priceMax").val()+"&sort="+v;$("#onSale, #onSale-modal").prop("checked")&&(t+="&onSale=true");$("#in-stock, #in-stock-modal").prop("checked")&&(t+="&inStock=true");s.length!==0&&$.each(s,function(n){t+="&"+$(s[n]).data("type")+"=";t+=$(s[n]).data("id")});u=$("#preSelectedAttributeValue");u.length>0&&(t+="&"+u.data("attributetype")+"="+u.data("attributeid"),t+="&customSortId="+u.data("attributeid"));h=$("#preSelectedAttributeValue2");h.length>0&&(t+="&"+h.data("attributetype")+"="+h.data("attributeid"));c=$("input.size-input:checked");c.length>0&&(t+="&sizes=",$.each(c,function(n){n!==0&&(t+=",");t+=$(c[n]).val()}));l=parseInt(r.val());let i=document.title;if(l>0){let n=l+1,t=document.querySelector("h1").textContent;$(".top-content").remove();let r=t.indexOf("- Page ");document.querySelector("h1").textContent=r>0?t.substring(0,r)+" - Page "+n:t+" - Page "+n;let u=i.indexOf("- Page"),f=i.indexOf(" | ");document.title=u>0?i.substring(0,u)+" - Page "+n+i.substring(f):i.replace(" | "," - Page "+n+" | ")}else document.title=i;t+="&pageIndex="+l;$("#search-instructions").hide();a="/"+d+"/get-paginated-search-results"+t;a+="&ref="+encodeURIComponent(b());o=$("#product-results");r.val()===0&&o.fadeOut();p();$("html, body").animate({scrollTop:0},"slow");o.fadeOut();$.get(a,function(n){n.length>0&&n!=="error"?(o.html(n),HideWishlistBoxUntilProductImageLoaded(),o.fadeIn(),lazyLoadImages()):($(".result-count").html("0 Products"),$("#product-results").fadeOut().html(""))}).done(function(){f&&(f=!1)});n&&nt()},nt=function(){var u,f;let n=b(),t=parseInt(r.val())+1;if(n.indexOf("/search")==-1)if(t>1){let i=n+"?page="+t;history.pushState(null,"Search",i)}else history.pushState(null,"Search",n);else{let r=n="?";t>1&&(r+="page="+t);let e=$("#priceMin").val();e>0&&(r.endsWith("?")||(r+="&"),r+="pMin="+e);let o=$("#priceMax").val();o0&&(r.endsWith("?")||(r+="&"),r+="a=",$.each(u,function(n){n!==0&&(r+=",");r+=$(u[n]).data("id")}));f=$("input.size-input:checked");f.length>0&&(r.endsWith("?")||(r+="&"),r+="sizes=",$.each(f,function(n){n!==0&&(r+=",");r+=$(f[n]).val()}));history.pushState(null,"Search",r)}},r=$("#pageIndex"),f=!1,e=!1,d="search";s&&(d="shoes");c=!0;$(function(){var r,i,u;c&&(r=g(t("q")),r.length>0?(i=$('li.filter-item input[data-name="'+r+'"]'),i.length>0?(i.attr("checked","checked"),h(i,i.data("type")),n(!1)):(u="/search/get-text-search-results/"+r,$.get(u,function(n){var t=$("#product-results");n.length>0&&($("#search-instructions").hide(),f?($(".result-count").html("0"),$("#product-results").fadeOut().html("")):(t.html(n),t.fadeIn()))}))):s?n(!1):!e&&window.location.href.split("?").length>1&&(k(),p(),n(!1)),c=!1,e=!1)});$.trim($("#product-results").html()).length||(l=t("page"),l.length>0&&(e=!0,r.val(l-1),k()),e&&n(!1));$(window).on("popstate",function(){});$("body").on("click",".paging a",function(t){t.preventDefault();var u=$(this),i=u.data("page");i!==undefined&&i!==null&&(r.val(i-1),f=!0,i>1&&$(".cms-content").hide(),n(!0))});$("body").on("click",".size-square",function(){var t=$(this),i=$("#"+t.data("elementid"));i.prop("checked")===!0?(i.prop("checked",""),$(".size-square.selection-"+t.data("elementid")).removeClass("on")):(i.prop("checked","checked"),$(".size-square.selection-"+t.data("elementid")).addClass("on"));u();n(!0)});$("#search-filters").on("click tap",".filter-item input",function(){var t=$(this).data("type");$(this).prop("checked")?(h($(this),t),$("#"+$(this).data("elementid")+"-mobile").prop("checked","checked")):(y($(this),t),$("#"+$(this).data("elementid")+"-mobile").prop("checked",""));n(!0)});$("#search-filters-mobile").on("click tap",".filter-item input",function(){$("#"+$(this).data("elementid")).click()});$("#onSale, #onSale-modal, #in-stock, #in-stock-modal").on("click",function(){u();n(!0)});$("#applied-filters").on("click","li",function(){var t=$(this);$("#"+t.data("elementid")).prop("checked","");y(t);n(!0)});$("body").on("click","#clear-filters",function(n){n.preventDefault();w()});$("body").on("click",".clear-all",function(t){t.preventDefault();w();n(!0)});$("#sort").on("change",function(){u();n(!0);$('#sort-mobile input[value="'+$("#sort").val()+'"]').prop("checked","checked")});$("#sort-mobile input").on("click",function(){$("#sort").val($(this).val());u();n(!0)});$("#onSale-mobile").on("click",function(){$("#onSale").click()});$("#in-stock-mobile").on("click",function(){$("#in-stock").click()});const a=document.getElementById("mobile-ui-topbtn"),v=document.getElementById("mobile-ui-filterBtn"),tt=document.querySelector(".filter-opener");window.addEventListener("scroll",throttleFunc(it,20));a.addEventListener("click",ut);v.addEventListener("click",rt)});!function(n){function t(n,t){if(!(n.originalEvent.touches.length>1)){n.preventDefault();var i=n.originalEvent.changedTouches[0],r=document.createEvent("MouseEvents");r.initMouseEvent(t,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null);n.target.dispatchEvent(r)}}if(n.support.touch="ontouchend"in document,n.support.touch){var r,i=n.ui.mouse.prototype,u=i._mouseInit,f=i._mouseDestroy;i._touchStart=function(n){var i=this;!r&&i._mouseCapture(n.originalEvent.changedTouches[0])&&(r=!0,i._touchMoved=!1,t(n,"mouseover"),t(n,"mousemove"),t(n,"mousedown"))};i._touchMove=function(n){r&&(this._touchMoved=!0,t(n,"mousemove"))};i._touchEnd=function(n){r&&(t(n,"mouseup"),t(n,"mouseout"),this._touchMoved||t(n,"click"),r=!1)};i._mouseInit=function(){var t=this;t.element.bind({touchstart:n.proxy(t,"_touchStart"),touchmove:n.proxy(t,"_touchMove"),touchend:n.proxy(t,"_touchEnd")});u.call(t)};i._mouseDestroy=function(){var t=this;t.element.unbind({touchstart:n.proxy(t,"_touchStart"),touchmove:n.proxy(t,"_touchMove"),touchend:n.proxy(t,"_touchEnd")});f.call(t)}}}(jQuery)