$(document).on("mouseenter",".catItemImage .prodImage",function(){if($("body").hasClass("desktop")){var a=$(this).parents(".catItemImage").data("front"),b=$(this).parents(".catItemImage").data("front2x");b=a+" 1x, "+b+" 2x";""!=$(this).parents(".catItemImage").data("front")&&($(this).next(".hoverImage").attr("src",a),$(this).next(".hoverImage").attr("srcset",b),$(this).next(".hoverImage").removeClass("j-hidden"))}});
$(document).on("mouseleave",".catItemImage",function(){$("body").hasClass("desktop")&&$(this).find(".hoverImage").addClass("j-hidden")});
$(document).on("click",".sortContainer span",function(){var a=$(this).closest(".sortContainer").hasClass("j-active"),b=$(this).closest(".sortContainer"),c=$("body").hasClass("desktop")||$(this).closest(".catFooter").length;a?(b.removeClass("j-active"),c?b.find(".sortSelect").hide():b.find(".sortSelect").slideUp()):(removeActive(),b.addClass("j-active"),c?(b.find(".sortSelect").show(),console.log("showwww")):b.find(".sortSelect").slideDown())});$(document).ready(function(){$(".filterGroup").removeClass("j-active")});
$(document).on("click",".filterGroupLabel",function(){var a=$(this).closest(".filterGroup").hasClass("j-active"),b=$(this).closest(".filterGroup"),c=$("body").hasClass("desktop");a?(b.removeClass("j-active"),c?b.find(".filterContent").hide():b.find(".filterContent").slideUp()):(removeActive(),b.addClass("j-active"),c?b.find(".filterContent").show():b.find(".filterContent").slideDown())});
function removeActive(){var a=$("body").hasClass("desktop");$(".filterGroupLabel").removeAttr("style");$(".filterGroup").removeClass("j-active");a?$(".filterContent").hide():$(".filterContent").slideUp();$(".sortContainer span").removeAttr("style");$(".sortContainer").removeClass("j-active");a?$(".sortSelect").hide():$(".sortSelect").slideUp()}$(document).on("click",".catRefine",function(){$("body").hasClass("desktop")||($(this).closest(".catFilters").find(".mobFilters").slideToggle(),$(this).toggleClass("j-active"))});
$(document).ready(function(){packCategoryItems();relocatereset()});function packCategoryItems(){$(".pcItems").imagesLoaded(function(){$(".pcItems").packery({itemSelector:".pcItems > .catItem",percentPosition:!0}).imagesLoaded(function(){$(".pcItems").packery()})})}
$(window).on("scroll",function(){var a=$(window).scrollTop(),b=document.querySelector("header").getBoundingClientRect().height;document.querySelector(".promoStripWrap").getBoundingClientRect();var c=document.querySelector(".breadcrumbs").getBoundingClientRect().height,e=document.getElementById("categorytop").getBoundingClientRect().height,d=document.querySelector(".catFilters").getBoundingClientRect().height,f=document.getElementById("category-header").getBoundingClientRect().height;f+b+e+c+50-d<
a&&!$(".lookbookBannerWrap").length&&$("body").hasClass("desktop")&&($(".catFilters").addClass("j-fixedfilters"),$(".catFilters").css({top:b}),$(".catList").css({"padding-top":d}));f+b+e+c-d<a&&$(".lookbookBannerWrap").length&&$("body").hasClass("desktop")&&($(".catFilters").addClass("j-fixedfilters"),$(".catFilters").css({top:b}),$(".catList").css({"padding-top":d}));f+b+e+c+50-d>a&&!$(".lookbookBannerWrap").length&&$("body").hasClass("desktop")&&($(".catFilters").removeClass("j-fixedfilters"),$(".catFilters").css({top:"auto"}),
$(".catList").css({"padding-top":0}));f+b+e+c-d>a&&$(".lookbookBannerWrap").length&&$("body").hasClass("desktop")&&($(".catFilters").removeClass("j-fixedfilters"),$(".catFilters").css({top:"auto"}),$(".catList").css({"padding-top":0}))});var scrollPos=0,scrollDir="down";window.addEventListener("scroll",function(){scrollDir=document.body.getBoundingClientRect().top>scrollPos?"up":"down";scrollPos=document.body.getBoundingClientRect().top});
$(document).ready(function(){"undefined"!==typeof peppercategory&&(hideemptyfilters(),hidesortingfilters(),$(document).on("click",".sortSelect li",function(){var a=$(this).attr("data-value");peppercategory.update("sort",a)}),$(document).on("click",".viewAllProducts",function(){var a=$(this).data("option");peppercategory.update("setpagesize",a)}),peppercategory.postinit=function(){$(".filterGroup").removeClass("j-active");this.updateselectedsort()},peppercategory.originalupdate=peppercategory.update,
peppercategory.update=function(a,b,c){this.updatespinner();this.currentaction=a;this.currentfiltergroup=null;if("addfilter"==a||"removefilter"==a||"setfilter"==a||"reset"==a)this.currentfiltergroup=b;this.originalupdate(a,b,c)},peppercategory.postupdate=function(a){this.updatespinner(!1);this.updateselectedsort();hideemptyfilters();hidesortingfilters();"undefined"!=typeof this.currentfiltergroup&&null!=this.currentfiltergroup&&showfiltergroup(this.currentfiltergroup);$("#category-header").html(a.categoryheaderhtml);
relocatereset();loopFilterItems();$(".catRefine").removeClass("j-active");$(".mobFilters").slideUp();$(".viewAllProducts").replaceWith(a.viewmorebutton);packCategoryItems()},peppercategory.updateselectedsort=function(){var a=$(".pcFilters .sortSelect li.j-active").text();$(".catFooter .sortContainer span").text(a);relocatereset()},peppercategory.updatespinner=function(a){void 0===a||a?($(".pageLoader").removeClass("j-hidden"),$("body").addClass("j-popuplayer")):($(".pageLoader").addClass("j-hidden"),
$("body").removeClass("j-popuplayer"))},peppercategory.updateselectedsort())});function showfiltergroup(a){$(".filterGroup."+a).addClass("j-active");$(".filterGroup."+a.toLowerCase()).find(".filterContent").show()}function relocatereset(){$(".filterReset").each(function(){var a=$(this).closest(".filterGroup").find(".filterContent");$(this).addClass("j-visible");$(this).appendTo(a)})}
function hideemptyfilters(){$(".filterGroup.size .filterContent .filterList").is(":empty")&&$(".filterGroup.size").remove();$.each(["category","colour","size"],function(a,b){2>$(".filterGroup."+b+" .filterContent .filterList > li").length&&$(".filterGroup."+b).remove()})}function hidesortingfilters(){$(".pcItems .catItem").length||$(".pcSort, .catFooterSort, .viewAllProducts").addClass("j-hidden")}$(document).ready(function(){$("#priceRangeSlider").removeClass("filterContent")});
function lazyLoading(){$(".lazyload").lazyload()}lazyLoading();function loopFilterItems(){$(".filterList").each(function(){6>$(this).find(".filterItem").length&&$(this).addClass("j-onecolumn")})}loopFilterItems();
$("html").on("click",function(a){a.target.closest(".filterGroup")||$(".filterGroup").each(function(){$(this).hasClass("j-active")&&($(this).removeClass("j-active"),$("body").hasClass("desktop")?$(this).find(".filterContent").hide():$(this).find(".filterContent").slideUp())});a.target.closest(".pcFilters")||$(".pcFilters .sortContainer").each(function(){$(this).hasClass("j-active")&&($(this).removeClass("j-active"),$("body").hasClass("desktop")?$(this).find(".sortSelect").hide():$(this).find(".sortSelect").slideUp())});
a.target.closest(".catFooterSort")||$(".catFooterSort .sortContainer").each(function(){$(this).hasClass("j-active")&&($(this).removeClass("j-active"),$("body").hasClass("desktop")?$(this).find(".sortSelect").hide():$(this).find(".sortSelect").slideUp())})});$(document).on("click",".quickview",function(a){a.stopPropagation();a.preventDefault();$(this).data("productid");a=$(this).data("colour");var b=$(this).data("style");po_data={};po_data.i=b;po_data.c=a;loadpopup("quickviewPop","/quickview",po_data)});