$(document).ready(function(){$(".js-newnav-inter").on("click",function(n){return n.stopPropagation(),n.preventDefault(),ImgToSvg.imgToSvgInit(),$("body").addClass("newnavopen"),!1}),$(".newnav-overlay, .js-newnav-close").on("click",function(n){return n.stopPropagation(),n.preventDefault(),$("body").removeClass("newnavopen").removeClass("newnav2open").removeClass("newnav2bisopen").removeClass("newnav3open"),$(".js-subnav-inter.current").removeClass("current"),$(".js-subnav3-inter.current").removeClass("current"),$(".js-subnav2-inter.current").removeClass("current"),$(".newnav-lev2, .newnav-mp, .newnav-lev3").fadeOut(),!1}),$(".js-subnav2-inter").on("click",function(n){n.stopPropagation(),n.preventDefault()}),$(".js-subnav3-inter").on("click",function(n){n.stopPropagation(),n.preventDefault()}),$(".js-back-1").on("click",function(n){return n.stopPropagation(),n.preventDefault(),$(".js-subnav2-inter.current").removeClass("current"),$(".newnav-lev2, .newnav-mp, .newnav-lev3").fadeOut(),$("body").removeClass("newnav2open").removeClass("newnav2bisopen").removeClass("newnav3open"),!1}),$(".js-back-2").on("click",function(n){return n.stopPropagation(),n.preventDefault(),$(".js-subnav3-inter.current").removeClass("current"),$(".newnav-lev3").fadeOut(),$("body").removeClass("newnav3open"),!1}),$(".newnav-bis-inter").on("click",function(){var n=$(this).closest(".newnav-bis");return n.hasClass("open")?(n.removeClass("open"),n.find(".newnav-bis-i").slideUp(),$(this).attr("aria-expanded","false"),$(this).removeClass("untrackGTM")):(n.addClass("open"),n.find(".newnav-bis-i").slideDown(),$(this).attr("aria-expanded","true"),$(this).addClass("untrackGTM")),!1})}),navigationJS={ajaxLoadGMC3:function(n,e,a,t,i,s){0===$("div#lev3-"+(e+1)+"-"+a).length&&$.ajax({method:"POST",url:"/NavigationGMC3View",data:{parentUniqueId:n,indexCurrentGMC1:e,countCurrentGMC2:a,nameGMC2:t,urlCurrentGMC2:i,langId:s}}).done(function(n){$("#GMC3").append(n),addListenerTrackClass();var t=$("div#lev3-"+(e+1)+"-"+a);"none"===t.css("display")&&(t.delay(250).fadeIn(),t.find(".newnav-content-i").optiscroll({forceScrollbars:!0})),navigationJS.highlightMenu(!1)})},manageSVGIcon:function(){jQuery("img.imgToSvg").each(function(){var n=jQuery(this),e=n.attr("id"),a=n.attr("class"),t=n.attr("src");t&&jQuery.get(t,function(t){var i=jQuery(t).find("svg");void 0!==e&&(i=i.attr("id",e)),void 0!==a&&(i=i.attr("class",a)),i=i.removeAttr("xmlns:a"),n.replaceWith(i)},"xml")})},onClickGMC1:function(n,e,a){0===$("#headerLev2-"+n).length&&navigationJS.displayHeaderGMC2(n),0===$("#listGMC2-"+n).length&&navigationJS.displayContentGMC2(JSON.parse($("#contentCategoryHierarchy").html())[n-1].categoryGMC2,n),0===$("[id^=ms-]").length&&$(".newnav-2bis").find($(".newnav-content")).append('<div class="newnav-content-i optiscroll"><div class="newnav-content-i-2"></div></div>'),0===$("#ms-"+n).length&&navigationJS.displayMarketingSpotCategory(n,JSON.parse($("#contentCategoryHierarchy").html())[n-1].identifierGMC1,e,a),$cible=$("[id$=link-lev2-"+n+"]").attr("href"),$cible2=$("[id$=link-lev2-"+n+"]").attr("data-mp"),$(".js-subnav2-inter.current").removeClass("current"),$(".js-subnav3-inter.current").removeClass("current"),$("[id$=link-lev2-"+n+"]").addClass("current"),$("body").hasClass("newnav2open")?($("body").removeClass("newnav3open").removeClass("newnav2open").removeClass("newnav2bisopen"),$(".newnav-lev2, .newnav-mp, .newnav-lev3").fadeOut(),setTimeout(function(){$("body").addClass("newnav2open"),$($cible).fadeIn(),$("body").addClass("newnav2bisopen"),$($cible2).fadeIn()},250)):($("body").addClass("newnav2open"),$($cible).delay(250).fadeIn(),$("body").addClass("newnav2bisopen"),$($cible2).delay(250).fadeIn()),$("#listGMC2-"+n).closest(".newnav-content-i").optiscroll({forceScrollbars:!0})},onClickGMC2:function(n,e){$cible=$("#lev3-"+n+"-"+e),$(".js-subnav3-inter.current").removeClass("current"),$("#link-lev3-"+n+"-"+e).addClass("current"),$("body").hasClass("newnav3open")?($(".newnav-mp").fadeOut(),$("body").removeClass("newnav3open").removeClass("newnav2bisopen"),$(".newnav-lev3").fadeOut(),setTimeout(function(){$("body").addClass("newnav3open"),$($cible).fadeIn()},250)):($("body").addClass("newnav3open"),$($cible).delay(250).fadeIn())},findCurrentPositionOfCategory:function(n,e,a){var t;if(t=a?$("[name=pageIdentifier]").attr("content"):$(".breadcrumb*").children(":eq("+(n+e)+")").text().trim()){var s=$(".js-subnav"+(n+1)+"-inter"),o=-1;return s.each(function(){$(this).data("label")&&-1!==t.toLowerCase().indexOf($(this).data("label").toLowerCase().trim())&&(o=$(this)[0].hash.split("-").pop())}),-1===o&&$(".js-nosubcat").each(function(){$(this).data("label")&&-1!==t.toLowerCase().indexOf($(this).data("label").toLowerCase().trim())&&(o=$(this).attr("id").split("-").pop())}),o}},highlightGMC3:function(n,e,a){var t=$(".breadcrumb-text:eq("+(3+n)+")").text();t&&$("#lev3-"+e+"-"+a+" .newnav-link").each(function(){$(this)&&$(this).text().trim()===t.trim()&&$(this).addClass("current")})},highlightMenu:function(n,e,a){var t="SearchResultsPage"===$("meta[name=pageName]").attr("content")?1:0,i=this.findCurrentPositionOfCategory(2,t,!1),s=this.findCurrentPositionOfCategory(1,t,!i||-1===i),o="true"===$("#hasNoGMC3").val()&&$("#link-lev3-"+s+"-"+i).data("label")===$(".breadcrumb*").children().last().text().trim();if(s&&-1!==s){if(n&&this.onClickGMC1(s,e,a),n&&!o?$("#link-lev3-"+s+"-"+i).click():n&&$("#link-lev3-"+s+"-"+i).addClass("current"),$("[id$=link-lev2-"+s+"]").attr("id").startsWith("moreGMC1")){var r=$("#moreGMCLink").closest(".newnav-bis");r.addClass("open"),r.find(".newnav-bis-i").slideDown(),$("#moreGMCLink").attr("aria-expanded","true")}t&&n||this.highlightGMC3(t,s,i)}},displayMenu:function(n,e){var a=JSON.parse($("#contentCategoryHierarchy").html()),t=$("#numberOfCategoryToDisplay").val();0===$("#listGMC1").length&&(navigationJS.displayGMC1(a),navigationJS.manageSVGIcon()),0===$("#listMoreGMC1").length&&t<a.length&&navigationJS.displayMoreGMC1(a,t),this.highlightMenu(!0,n,e),""===$("#MS_Below_Menu").html()&&navigationJS.displayMSBelowMenu(n,e),0===$("#listGMC1").closest(".newnav-content-i").length&&($("#listGMC1,.newnav-bis,.newnav-recall,#MS_Below_Menu").wrapAll('<div class="newnav-content-i optiscroll"><div class="newnav-content-i-2"></div></div>'),$("#listGMC1").closest(".newnav-content-i").optiscroll({forceScrollbars:!0}))},displayGMC1:function(n){$('[id^="link-lev2-"]').wrapAll('<ul id="listGMC1" class="newnav-list1"></ul>'),n.forEach(function(n,e){navigationJS.displayIconCategory(n.identifierGMC1,n.nameGMC1,$("#link-lev2-"+(e+1)))})},displayMoreGMC1:function(n,e){$("#moreGMCLink").wrap("<div class='newnav-bis'></div>"),$('a[id^="moreGMC1-link-lev"]').wrapAll("<ul id='listMoreGMC1' class='newnav-list1 newnav-bis-i'></ul>"),$("#listMoreGMC1").insertAfter($("#moreGMCLink")),n.forEach(function(n,a){if(a>=e){var t=$("#moreGMC1-link-lev2-"+(a+1));t.wrap('<li class="newnav-item1"></li>'),navigationJS.displayIconCategory(n.identifierGMC1,n.nameGMC1,t)}})},displayIconCategory:function(n,e,a){""!==$("#pathIconNavigation").val()?a.append('<span class="newnav-svg"><img data-src="'+$("#pathIconNavigation").val()+n+'.svg" onerror="this.style.display=\'none\'" alt="icon navigation of '+e+'" class="imgToSvg"/></span>'+e):a.append(e)},displayMSBelowMenu:function(n,e){$.ajax({method:"POST",url:"/Widgets_701/com.ibm.commerce.store.widgets.EMarketingSpot/EMarketingSpot.jsp",data:{emsName:"MS_Below_Menu",storeId:n,catalogId:e,displayPreference:1,widgetOrientation:"vertical"}}).done(function(n){$("#MS_Below_Menu").append(n)})},displayHeaderGMC2:function(n){var e=$("#link-headerLev2-"+n),a=$("#labelHeaderLinkLev2-"+n).val();e.wrap('<div id="headerLev2-'+n+'" class="newnav-entete"></div>'),e.after('<div class="newnav-link-full">'+a+"</div>")},displayContentGMC2:function(n,e){$('[id^="link-lev3-'+e+'-"]').wrapAll('<div class="newnav-content-i optiscroll"><div class="newnav-content-i-2"><ul id="listGMC2-'+e+'" class="newnav-list"></ul></div></div>'),n.forEach(function(n,a){var t=$("#link-lev3-"+e+"-"+(a+1));t.wrap('<li class="newnav-item"></li>'),t.append(n.nameGMC2)})},displayMarketingSpotCategory:function(n,e,a,t){$.ajax({method:"POST",url:$("#env_jspStoreDir").val()+"/Snippets/Marketing/WebServiceeMarketingSpotDisplay.jsp",data:{emsName:"DepartmentDropdown_Right_"+e,marketingSpotBehavior:0,storeId:a,catalogId:t}}).done(function(e){$(".newnav-2bis").find(".newnav-content-i-2").append('<div class="newnav-mp" id="ms-'+n+'" style="display:block;">'+e+"</div>"),$("#ms-"+n).closest(".newnav-content-i").optiscroll({forceScrollbars:!0})})}};