var lang=$language.split("-"),dataLayer=window.dataLayer||[],productsOnPage=[],promotionsOnPage=[],counter=0;jq(document).ready(function(){function o(){var n=document.querySelector(".product-stage .product-name").textContent;dataLayer.push({event:"uaevent",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"product detail page"})}function i(){if(jq("#product-list .list-items button").eq(counter).length){var n=jq("#product-list .list-items button").eq(counter).attr("data-upc"),t=jq("#ProductPriceApi").val(),r=t.replace("{UPC}",""+n+"");jq("#product-list .list-items button").eq(counter).next("p").remove();jq.ajax({url:"/api/GetProductPrice/",type:"GET",data:{upcCode:n,apiUrl:r},async:!1,dataType:"json",success:function(n){n.Succes&&jq("#product-list .list-items button").eq(counter).after(function(){return"<p style='margin-left: 10px;display:inline-block;'>"+(jq("#ProductPriceApi").attr("data-currency")?jq("#ProductPriceApi").attr("data-currency"):"$")+" "+n.price+"<\/p>"});counter<jq("#product-list .list-items button").length&&(counter++,i())},error:function(n){console.log("getProductListData Error"+n);counter<jq("#product-list .list-items button").length&&(counter++,i())}})}}function v(){if(jq("#productDetailBuyNowBtn").length){var n=jq("#productDetailBuyNowBtn").attr("data-upc"),t=jq("#ProductPriceApi").val(),i=t.replace("{UPC}",""+n+"");jq.ajax({url:i,dataType:"jsonp",async:!0,success:function(n){jq("#productDetailBuyNowBtn").after(function(){return"<p style='margin-left: 10px;display:inline-block;'>"+(jq("#ProductPriceApi").attr("data-currency")?jq("#ProductPriceApi").attr("data-currency"):"$")+" "+n.price+"<\/p>"})},error:function(n){console.log("getProductDetailData Error"+n)}})}}function r(n){var r=[],e="",t,i;if(n!=undefined){for(t=0;t<n.length;t++)f(n[t])==!0&&(i=u(n[t]),h(productsOnPage,i)||(r.push(i),productsOnPage.push(i)));e=jq("#productCurrencyCode",n[0]).text()}typeof LOCA!="undefined"&&LOCA.Dialog.refreshEvents()}function y(n){var t=jq("#sliderproductanalytics #sliderproductName",n).text(),i=jq("#sliderproductanalytics #sliderproducteposition",n).text(),r=jq("#sliderproductanalytics #sliderproducteid",n).text()}function s(){jq(".prdouct-list-container .swiper-container ul.swiper-wrapper li.swiper-slide").length>0&&n(jq(".prdouct-list-container .swiper-container ul.swiper-wrapper li.swiper-slide"));jq(".related-product-container .swiper-container ul.swiper-wrapper li.swiper-slide").length>0&&n(jq(".related-product-container .swiper-container ul.swiper-wrapper li.swiper-slide"));jq(".inner.outline li.column.s-cols-6.cols-4").length>0?n(jq(".inner.outline li.column.s-cols-6.cols-4")):jq("#product-list .list-items li.item").length>0&&n(jq("#product-list .list-items li.item"))}function h(n,t){for(var i=0;i<n.length;i++)if(n[i].id==t.id&&n[i].name==t.name)return!0;return!1}function w(n,t){for(var i=0;i<n.length;i++)if(n[i].name==t.name)return!0;return!1}function n(n){var i=[],u="",t,r;if(n!=undefined){for(t=0;t<n.length;t++)f(n[t])==!0&&(r=d(n[t]),h(productsOnPage,r)||(i.push(r),productsOnPage.push(r)));u=jq("#productCurrencyCode",n[0]).text()}i.length>0&&($country!="it"&&$country!="IT"?dataLayer.push({event:"nievent",event_name:"view_item_list",eventAction:"Product Impressions",eventCategory:"Ecommerce",eventLabel:$pageSection!==""?$pageSection:"none",ecommerce:{currencyCode:u!==""?u:"none",impressions:i}}):dataLayer.push({event:"nievent",event_name:"view_item_list",eventAction:"Product Impressions",eventCategory:"Ecommerce",eventLabel:$pageSection!==""?$pageSection:"none",ecommerce:{currencyCode:"EUR",impressions:i}}));typeof LOCA!="undefined"&&LOCA.Dialog.refreshEvents()}function t(n){dataLayer=dataLayer.filter(function(n){return!n.action});var t=[],i=jq("#productAnalytics #productName",n).text(),r=jq("#productAnalytics #productEAN",n).text(),u=jq("#productAnalytics #productCategory",n).text();$country=="it"||$country=="IT"?(t.push(c(n)),dataLayer.push({event:"productClick",event_name:"select_item",eventAction:"Product Click",eventCategory:"Ecommerce",eventLabel:i.toLowerCase()+"::"+r,product_info:i.toLowerCase()+"::"+r.toLowerCase(),ecommerce:{click:{actionField:{list:$pageSection!==""?$pageSection:"none"},products:t}}})):(t.push(c(n)),dataLayer.push({event:"productClick",event_name:"select_item",eventAction:"Product Click",eventCategory:"Ecommerce",eventLabel:i.toLowerCase()+"::"+r,product_info:i.toLowerCase()+"::"+r.toLowerCase(),ecommerce:{click:{actionField:{list:$pageSection!==""?$pageSection:"none"},products:t}}}))}function c(n){var r=jq("#productAnalytics #productName",n).text().toLowerCase(),u=jq("#productAnalytics #productPrice",n).text(),f=jq("#productAnalytics #productCategory",n).text().toLowerCase(),t=jq("#productAnalytics #productSize",n).text(),e=jq("#productAnalytics #productShade",n).text().toLowerCase(),o=jq("#productAnalytics #productposition",n).text(),i=jq("#productAnalytics #productEAN",n).text(),s=jq("#productAnalytics #productvtochecker",n).text(),h=jq("#rating-tagging",n).text(),c=jq("#review-tagging",n).text(),l;return jq(".productpage").length>0?(jq(".related-product-container").length>0||jq(".prdouct-list-container").length>0)&&(l="none"):l=jq("#productAnalytics #productposition",n).text(),{name:r!==""?r:"none",id:i!==""?i:"none",price:u!==""?u:"none",brand:"LP",category:f!==""?f:"none",position:o!==""?o:"none",variant:t!==" "?t:"none",dimension35:t!==" "?t:"none",dimension38:h!==""?h:"none",dimension48:i!==""?i:"none",dimension36:e!==""?e:"none",dimension49:s!==""?s:"none",dimension59:c!==""?c:"none"}}function l(n){var t,i;t=jq(".block-one").length>0?document.querySelector("#productAnalytics #productName").textContent:document.querySelector(".product-name").textContent;i=[];i.push(u(n));$country=="it"||$country=="IT"?dataLayer.push({event:"nievent",event_name:"view_item",eventAction:"Product Detail",eventLabel:t.toLowerCase()+"::"+$productSku.toLowerCase(),eventCategory:"Ecommerce",product_info:t.toLowerCase()+"::"+$productSku.toLowerCase(),ecommerce:{detail:{actionField:{action:"detail"},products:i}}}):dataLayer.push({event:"nievent",event_name:"view_item",eventAction:"Product Detail",eventCategory:"Ecommerce",eventLabel:t.toLowerCase()+"::"+$productSku.toLowerCase(),product_info:t.toLowerCase()+"::"+$productSku.toLowerCase(),ecommerce:{detail:{actionField:{action:"detail"},products:i}}})}function b(n){[].push(a(n))}function k(n){var u=[],i,t,r;if(n.className.indexOf("separator")<0)for(i=jq("img",n),t=0;t<i.length;t++)f(i[t])&&(r=a(i[t]),w(promotionsOnPage,r)||(u.push(r),promotionsOnPage.push(r)))}function a(n){var t=jq(n).attr("alt");return{name:t}}function u(n){var o=jq("#productAnalytics #productName",n).text().toLowerCase(),s=jq("#productAnalytics #productPrice",n).text(),h=jq("#productAnalytics #productCategory",n).text().toLowerCase(),t=jq("#productAnalytics #productSize",n).text(),c=jq("#productAnalytics #productShade",n).text().toLowerCase(),i=jq("#productAnalytics #productEAN",n).text(),l=jq("#productAnalytics #productvtochecker",n).text(),f,e,b;if(jq(".productpage").length>0)if(jq(".rating-stars-count").length>0)var d=document.querySelector(".rating-stars-count").textContent,k=d.split(" "),f=k[0],g=k[1],e=g.slice(1,-1);else f="none",e="none";if(jq(".popin-retail").length>0){var a=jq("#productAnalytics #productName").length>0?jq("#productAnalytics #productName")[0].innerText:"",v=jq("#productAnalytics #productPrice").length>0?jq("#productAnalytics #productPrice")[0].innerText:"",y=jq("#productAnalytics #productCategory").length>0?jq("#productAnalytics #productCategory")[0].innerText:"",r=jq("#productAnalytics #productSize").length>0?jq("#productAnalytics #productSize")[0].innerText:"",p=jq("#productAnalytics #productShade").length>0?jq("#productAnalytics #productShade")[0].innerText:"",u=jq("#productAnalytics #productEAN").length>0?jq("#productAnalytics #productEAN")[0].innerText:"",w=jq("#productAnalytics #productvtochecker").length>0?jq("#productAnalytics #productvtochecker")[0].innerText:"";b=$country=="it"||$country=="IT"?{name:a!==""?a:"none",id:u!==""?u:"none",price:v!==""?v:"none",brand:"LP",category:y!==""?y:"none",variant:r!==" "?r:"none",dimension35:r!==" "?r:"none",dimension38:f,dimension48:u!==""?u:"none",dimension36:p!==""?p:"none",dimension59:e,dimension49:w!==""?w:"none"}:{name:a!==""?a:"none",id:u!==""?u:"none",price:v!==""?v:"none",brand:"LP",category:y!==""?y:"none",variant:r!==" "?r:"none",dimension35:r!==" "?r:"none",dimension38:f,dimension48:u!==""?u:"none",dimension36:p!==""?p:"none",dimension59:e,dimension49:w!==""?w:"none"}}else b=$country=="it"||$country=="IT"?{name:o!==""?o:"none",id:i!==""?i:"none",price:s!==""?s:"none",brand:"LP",category:h!==""?h:"none",variant:t!==" "?t:"none",dimension35:t!==" "?t:"none",dimension38:f,dimension48:i!==""?i:"none",dimension36:c!==""?c:"none",dimension59:e,dimension49:l!==""?l:"none"}:{name:o!==""?o:"none",id:i!==""?i:"none",price:s!==""?s:"none",brand:"LP",category:h!==""?h:"none",variant:t!==" "?t:"none",dimension35:t!==" "?t:"none",dimension38:f,dimension48:i!==""?i:"none",dimension36:c!==""?c:"none",dimension59:e,dimension49:l!==""?l:"none"};return b}function d(n){var r=jq("#productAnalytics #productName",n).text().toLowerCase(),u=jq("#productAnalytics #productPrice",n).text(),f=jq("#productAnalytics #productCategory",n).text().toLowerCase(),t=jq("#productAnalytics #productSize",n).text(),e=jq("#productAnalytics #productShade",n).text().toLowerCase(),i=jq("#productAnalytics #productEAN",n).text(),o=jq("#productAnalytics #productvtochecker",n).text(),s=jq("#rating-tagging",n).text(),h=jq("#review-tagging",n).text(),c=jq(".related-product-container, .prdouct-list-container").length>0?"none":jq("#productAnalytics #productposition",n).text(),l;return $country=="it"||$country=="IT"?{name:r!==""?r:"none",id:i!==""?i:"none",price:u!==""?u:"none",brand:"LP",category:f!==""?f:"none",position:c!==" "?c:"none",variant:t!==" "?t:"none",list:$pageSection!==""?$pageSection:"none",dimension35:t!==" "?t:"none",dimension38:s!==""?s:"none",dimension48:i!==""?i:"none",dimension36:e!==""?e:"none",dimension59:h!==""?h:"none",dimension49:o!==""?o:"none"}:{name:r!==""?r:"none",id:i!==""?i:"none",price:u!==""?u:"none",brand:"LP",category:f!==""?f:"none",list:$pageSection!==""?$pageSection:"none",variant:t!==" "?t:"none",position:c!==" "?c:"none",dimension35:t!==" "?t:"none",dimension38:s!==""?s:"none",dimension48:i!==""?i:"none",dimension36:e!==""?e:"none",dimension59:h!==""?h:"none",dimension49:o!==""?o:"none"}}function f(n){var t=n.getBoundingClientRect(),i=document.documentElement;return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||i.clientHeight)&&t.right<=(window.innerWidth||i.clientWidth)}var p;jQuery(".dropdown .social li a").on("click",function(){var n=jQuery(this).attr("href"),t=jQuery(this).attr("alt").toLowerCase(),i=$country=="it"||$country=="IT"?"uaevent":"undefined",r;r=typeof $geoIPLocation!="undefined"&&$geoIPLocation!=""?{event:i,geoIPLocation:$geoIPLocation,ecommerce:"undefined",eventCategory:"header",eventAction:"social::"+t,eventLabel:n}:{event:i,ecommerce:"undefined",eventCategory:"header",eventAction:"social::"+t,eventLabel:n};window.dataLayer.push(r)});var e=$country.toLowerCase(),g=e=="br"?"Ecommerce_PLP":"Ecommerce",nt=e=="br"?"Ecommerce_PDP":"e-retailer";jq(".popin-trigger").length>0?jq(".retail .button.alt").bind("click",function(){var n=$productName.toLowerCase(),t=$productSku.toLowerCase(),i;dataLayer.push({event:"uaevent",event_name:"buy_now",ecommerce:"undefined",eventCategory:"Ecommerce",eventAction:"click to buy",eventLabel:n+"::"+t,product_info:n+"::"+t});i=setInterval(function(n){if(jq(".popin").is(":visible")&&jq(".retailers a").length>0){clearInterval(i);dataLayer.push({event:"updatevirtualpath",virtualPageURL:"/e-retailer/buy-online",virtualPageTitle:"pop-in e-retailer buy online"});jq(".retailers a").on("click",function(){var f=[],r;f.push(u(n));var e=document.querySelector("#productAnalytics #productName").textContent.toLowerCase(),i=new URL(jq(this).attr("href")).hostname.split("."),t=jq(this).attr("data-retailer");(t==undefined||t=="")&&(t=i[0].toLowerCase()=="www"?i[1]:i[0]);r=$country=="it"||$country=="IT"?"EUR":jq("#productAnalytics #productCurrencyCode").text();dataLayer.push({event:"addToCart",event_name:"add_to_cart",eventCategory:"Ecommerce",eventAction:"redirection::"+t,eventLabel:e.toLowerCase()+"::"+$productSku.toLowerCase(),product_info:e.toLowerCase()+"::"+$productSku.toLowerCase(),step:"redirection",store_name:t,ecommerce:{currencyCode:r!==""?r:"none",add:{actionField:{action:"add"},products:f}}})})}},500)}):addtoCartwithOutpop();jq(".check_out_str").bind("click",function(){dataLayer.push({event:"uaevent",ecommerce:"undefined",eventCategory:"salon locator",eventAction:$pageSection,eventLabel:"search"})});jq(".text-content a").on("click",function(){var i=jq(".text-content h1").text(),n=jq(".text-content a").text().toLowerCase(),t=jq(".text-content a").attr("href");dataLayer.push({event:"uaevent",event_name:"slider_button_click",ecommerce:"undefined",eventCategory:$pageSection,eventAction:"select::"+i,eventLabel:n+"::"+t,cta_name:n,link_url:t})});jq(".inside-hfn .button").bind("click,",function(){var n=document.title;dataLayer.push({event:"uaevent",ecommerce:"undefined",eventCategory:"event booking",eventAction:"click on register to an event",eventLabel:n})});jq(".editorial a").bind("click",function(){var t=jq(this).attr("href"),i="PSP",n=t.split("/"),r;n.length>4&&(i="PDP");r=n[n.length-1];dataLayer.push({event:"uaevent",ecommerce:"undefined",eventCategory:i+" after concerns",eventAction:"select::"+r,eventLabel:t})});jq('.s-cols-6.cols-4 a:not(".img-block .overlay-btn a"),.aside-content .align-right a').bind("click",function(n){n.preventDefault();var f=window.location.href.toLowerCase(),t=jq(this).attr("href"),r="",u="PSP",i=t.split("/");i.length>4&&(u="PDP",r=i[i.length-1]);dataLayer.push({event:"uaevent",ecommerce:"undefined",eventCategory:u+" after it looks",eventAction:"select::"+r,eventLabel:t});setTimeout(function(){window.location.href=t},500)});jq("[data-cta-promotion]").bind("click",function(){var t=jq(this).attr("href").split("/"),i=t[t.length-1],n=i.split(".");dataLayer.push({event:"uaevent",eventCategory:"download",eventAction:n[n.length-1]=="pdf"?"pdf":"coupon",eventLabel:n[0]})});jq(".sharing a").bind("click",function(){var t=jq(this).data("href"),n;jq(this).hasClass("sharing-fb")?n="Facebook":jq(this).hasClass("sharing-pi")?n="Pinterest":jq(this).hasClass("sharing-tw")&&(n="Twitter");dataLayer.push({event:"socialInt",event_name:"social_interaction",eventCategory:n,eventAction:"share",eventLabel:t,social_network:n.toLowerCase(),social_action:"share"})});jq("#page header a.localize[data-cta-type=salonLocatorLink], #page div.site-main a[data-cta-type=salonLocatorLink]").each(function(){var n=jq(this).attr("href"),t=jq(this).closest("[data-page-section]"),i=t.attr("data-page-section");jq(this).attr("href",n)});jq("#page header a.localize[data-cta-type=salonLocatorLink]").bind("click",function(){jq(this).hasClass("rgtbtn_findASalon")||(typeof $geoIPLocation!="undefined"&&$geoIPLocation!=""?dataLayer.push({event:"uaevent",event_name:"salon_locator",geoIPLocation:$geoIPLocation,ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"header",search_keyword:jq(this).prev("input").val().toLowerCase(),click_area:"header"}):dataLayer.push({event:"uaevent",event_name:"salon_locator",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"header",search_keyword:jq(this).prev("input").val().toLowerCase(),click_area:"header"}))});jq("#locatorFormFt .i-location").bind("click",function(){var t=jq("#zip-salon-ft").val(),n;n=t==""?"none":jq("#zip-salon-ft").val();typeof $geoIPLocation!="undefined"&&$geoIPLocation!=""?dataLayer.push({event:"uaevent",event_name:"salon_locator",geoIPLocation:$geoIPLocation,ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"footer",search_keyword:n,click_area:"footer"}):dataLayer.push({event:"uaevent",event_name:"salon_locator",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"footer",search_keyword:n,click_area:"footer"})});jq(".skew-wrapper .i-locator").bind("click",function(){var n,t;jq(this).parent().parent().parent().hasClass("social-share-content")&&(n=jq(this).prev("input").val().toLowerCase(),t=n==""?"none":jq(this).prev("input").val().toLowerCase(),dataLayer.push({event:"uaevent",event_name:"salon_locator",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"product detail page",search_keyword:t,click_area:"content page"}))});jq(".cp_container .button,#protocol .i-locator").bind("click",function(n){jq(this).parent().parent().parent().hasClass("quote-tag-block")||(n.stopPropagation(),o())});jq(".hairdresser .i-locator").bind("click",function(){o()});jq(".block-one  .button.i-locator").bind("click",function(){var t=jq(this).prev("input").val().toLowerCase(),n;n=t==""?"none":jq(this).prev("input").val().toLowerCase();dataLayer.push({event:"uaevent",event_name:"salon_locator",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"product detail page",search_keyword:n,click_area:"content page"})});jq(".product-reminder .button.i-locator").bind("click",function(){var t=jq(this).prev("input").val().toLowerCase(),n;n=t==""?"none":jq(this).prev("input").val().toLowerCase();dataLayer.push({event:"uaevent",event_name:"salon_locator",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"product detail page",search_keyword:n,click_area:"content page"})});jq(".retail .button.fnd_salon").bind("click",function(){var t=jq(this).prev("input").val().toLowerCase(),n;n=t==""?"none":jq(this).prev("input").val().toLowerCase();dataLayer.push({event:"uaevent",event_name:"salon_locator",ecommerce:"undefined",eventCategory:"salon locator",eventAction:"find a salon",eventLabel:"product detail page",search_keyword:n,click_area:"content page"})});jq(".nav-main .old_mega-menu li a.first").bind("click",function(){var n=jq(this).find(".menuinfo").text().toLowerCase().replace(/\n/g,"").trim();dataLayer.push({event:"uaevent",ecommerce:"undefined",event_name:"menu_click",click_area:"header",eventCategory:"main menu navigation",eventAction:"select::header",eventLabel:n,breadcrumb:n})});jq(".dropdown .column li").bind("click",function(){var t=jq(this).attr("category_two")!==""?jq(this).attr("category_two"):"none",i=jq(this).text(),r=jq(this).closest(".dropdown").parent().find("a.first").find(".menuinfo").text(),n;n=t=="none"?r+"::"+i:r+"::"+t+"::"+i;dataLayer.push({event:"uaevent",event_name:"menu_click",ecommerce:"undefined",eventCategory:"main menu navigation",eventAction:"select::header",eventLabel:n.toLowerCase(),click_area:"header",breadcrumb:n.toLowerCase()})});jq(".site-ft .cols-2 li a").bind("click",function(){var n=jq(this).text();dataLayer.push({event:"uaevent",event_name:"menu_click",ecommerce:"undefined",eventCategory:"main menu navigation",eventAction:"select::footer",eventLabel:n.toLowerCase(),click_area:"footer",breadcrumb:n.toLowerCase()})});jq(".ctt-cta li a").bind("click",function(){var n;n=jQuery(this).hasClass("ios-store")?"Apple Store":"Google Play";dataLayer.push({event:"uaevent",ecommerce:"undefined",eventCategory:"download",eventAction:n,eventLabel:"style my hair"})});jq(".toolbox .stylemyhair").bind("click",function(){var n=jq(this).attr("href");n&&n[0]=="/"&&(n=window.location.origin+n);var t=this.querySelector(".button"),i=t&&t.innerText.length?t.innerText.toLowerCase():"try a new look",r=jq(this).attr("tagDataText").toLowerCase();dataLayer.push({event:"uaevent",event_name:"body_button_click",ecommerce:"undefined",eventCategory:"footer",eventAction:"style my hair",eventLabel:"search",cta_name:i,link_url:n,module_name:r})});jq(".toolbox .magazine").bind("click",function(){var n=jq(this).attr("href");n&&n[0]=="/"&&(n=window.location.origin+n);var t=this.querySelector(".button"),i=t&&t.innerText.length?t.innerText.toLowerCase():"read the magazine",r=jq(this).attr("tagDataText").toLowerCase();dataLayer.push({event:"uaevent",event_name:"body_button_click",ecommerce:"undefined",eventCategory:"footer",eventAction:"magazine",eventLabel:"search",cta_name:i,link_url:n,module_name:r})});jq("#ProductPriceApi").length&&jq("#ProductPriceApi").val().search("{UPC}")!==-1&&(counter=0,i(),v());jq("body .aside-content").length>0&&r();jq("#product-list").length>0&&r(undefined,"PLP");jq("body.productpage").length>0&&r(jq("body.productpage"));jq("#slider .slider-item .content .button").bind("click",function(){y(jq(this).parents(".slider-item"))});jq("body.homepage #slider").length>0&&(p=jq("#slider .slider-item").length>0?jq("#slider .slider-item")[0]:"");jq(".aside-content")&&(s(),jq(".product-content-tag").length>0&&setTimeout(function(){l(jq(".product-content-tag"))},5e3),jq(".block-one").length>0&&setTimeout(function(){l(jq(".block-one"))},5e3));jq(window).scroll(function(){s()});jq(".trigger-list.std-link").bind("click",function(){n(jq("#product-list .list-items li.item"))});jq(".nav-main>ul>li").mouseover(function(){k(this)});jq(".inner.outline li.column.s-cols-6.cols-4").bind("click",function(){t(this)});jq(".catalogue").off().on("click","#product-list .list-items li.item",function(){t(this)});jq(".related-product-container .swiper-container ul.swiper-wrapper li.swiper-slide").bind("click",function(){t(this)});jq(".prdouct-list-container .swiper-container ul.swiper-wrapper li.swiper-slide").bind("click",function(){t(this)});jq(".nav-main>ul>li>.dropdown a").bind("click",function(){var n,t;if(jq("img",this).length>0)for(var f=jq("img",this).attr("alt"),r=jq(".nav-main>ul>li"),i=0,u=!1;r[i].className.indexOf("separator")<0&&!u;){for(n=0,t=jq("img",r[i]);n<t.length&&jq(t[n]).attr("alt")!=f;)n++;n<t.length&&(b(t[n]),u=!0);i++}});jq("#page form[data-cta-type=salonLocator]").each(function(){var n=jq(this).closest("[data-page-section]"),t=n.attr("data-page-section")});jq("#page a[data-cta-type=styleMyHair]").each(function(){var n=jq(this).attr("href"),t=jq(this).closest("[data-page-section]"),i=t.attr("data-page-section");jq(this).attr("href",n)});jq("#page a[data-cta-type=magazine], .nav-main [data-cta-type=magazine] a").each(function(){var n=jq(this).attr("href"),t,i;n!="#"&&n!=""&&(t=jq(this).closest("[data-page-section]"),i=t.attr("data-page-section"),jq(this).attr("href",n))});jq("[data-cta] a").each(function(){var n="locationInPage="+jq(this).closest("[data-page-section]").data("page-section"),t=jq(this).attr("href");n=t.indexOf("?")==-1?"?"+n:"&"+n;jq(this).attr("href",t+n)});jq(".metadetax-banner-btn").bind("click",function(){var n=jq(this).attr("href"),t=jq(".metadetax-banner-btn").find("span").eq(0).text().toLowerCase();dataLayer.push({event:"uaevent",ecommerce:"undefined",event_name:"body_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventAction:"select::banner",eventLabel:t+"::"+n,cta_name:t,link_url:n,module_name:"banner"})});jq(".metadetax-blockone-btn").bind("click",function(){var n=jq(this).attr("href"),t=jq(".metadetax-blockone-btn").find("span").eq(0).text().toLowerCase();dataLayer.push({event:"uaevent",ecommerce:"undefined",event_name:"body_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventAction:"select::bloc1",eventLabel:t+"::"+n,cta_name:t,link_url:n,module_name:"bloc1"})});jq(".metadetax-blocktwo-btn").bind("click",function(){var n=jq(this).attr("href"),t=jq(".metadetax-blocktwo-btn").find("span").eq(0).text().toLowerCase();dataLayer.push({event:"uaevent",ecommerce:"undefined",event_name:"body_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventAction:"select::bloc2",eventLabel:t+"::"+n,cta_name:t,link_url:n,module_name:"bloc2"})});jq(".metadetax-banner-loc-btn").bind("click",function(){dataLayer.push({event:"uaevent",event_name:"salon_locator",eventCategory:"salon locator",eventAction:"access to salon locator",eventLabel:"banner",ecommerce:"undefined"})});jq(".metadetax-blocktwo-loc-btn").bind("click",function(){dataLayer.push({event:"uaevent",event_name:"salon_locator",eventCategory:"salon locator",eventAction:"access to salon locator",eventLabel:"body",ecommerce:"undefined"})});jq(".metadetax-routineone-btn").bind("click",function(){var n=jq(this).attr("href"),t=jq(".metadetax-routineone-btn").find("span").eq(0).text().toLowerCase();dataLayer.push({event:"uaevent",event_name:"body_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventLabel:t+"::"+n,cta_name:t,link_url:n,module_name:"routine",ecommerce:"undefined"})});jq(".metadetax-routinetwo-btn").bind("click",function(){var n=jq(this).attr("href"),t=jq(".metadetax-routinetwo-btn").find("span").eq(0).text().toLowerCase();dataLayer.push({event:"uaevent",event_name:"body_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventLabel:t+"::"+n,cta_name:t,link_url:n,module_name:"routine",ecommerce:"undefined"})});jq(".metadetax-sticky-btn").bind("click",function(){var n=jq(this).attr("href"),t=jq(".metadetax-sticky-btn").find("span").eq(0).text().toLowerCase();dataLayer.push({event:"uaevent",event_name:"footer_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventLabel:t+"::"+n,cta_name:t,link_url:n,eventAction:"select::metal-detox",module_name:"routine",ecommerce:"undefined"})});jq("#metal-detox .item a").bind("click",function(){var t=jq(this).attr("href"),n=jq(this).attr("data-retailer");dataLayer.push({event:"uaevent",event_name:"body_button_click",eventCategory:$pageSection!==""?$pageSection:"content page::branding page",eventAction:"select::"+n,eventLabel:n+"::"+t,cta_name:n,link_url:t,module_name:n,ecommerce:"undefined"})});(jq(".homepage").length>0||jq(".newslettersignuppage").length>0)&&jq(document).ready(function(){var n=new Date;jq("#birthday").datepicker({dateFormat:"M-dd",changeMonth:!0,minDate:new Date(n.getFullYear(),0,1),maxDate:new Date(n.getFullYear(),12,31)});jq("#birthday_page").datepicker({dateFormat:"M-dd",changeMonth:!0,minDate:new Date(n.getFullYear(),0,1),maxDate:new Date(n.getFullYear(),12,31)})});jq(".homenew-banner").length>0&&jq(".ctn_align a").click(function(){var u=jq(this).closest(".ctn_text").find("h2").text().trim().toLowerCase(),f=jq(this).closest(".ctn_text").find("h3").text().trim().toLowerCase(),n=jq(this).attr("href"),t,i,r;t=n&&n.indexOf("https")===-1?window.location.origin+jq(this).attr("href"):jq(this).attr("href");i=jq(this).text().toLowerCase();r={event:"uaevent",event_name:"body_button_click",cta_name:i,link_url:t,ecommerce:"undefined",module_name:u+"&nbsp;"+f};window.dataLayer.push(r)});jq(document).ready(function(){function t(n,t){for(var i=0;i<n.length;i++)if(n[i].country_code===t)return n[i];return null}function i(n,t){var i=jq(n);i.prop("Counter",0).animate({Counter:t},{duration:2e3,easing:"swing",step:function(n){i.text(u(Math.ceil(n)))}})}function u(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g," ")}var n,r;n=$country==="INT"?"World":$country;r=n;jq.get("https://api.loreal.net/global/customer/v1/customer-sku-pubsavings/savings",function(n){var u,r,f,e;if($country!==u?(u="World",r=t(n,u)):r=t(n,u),jq(".numbers").css({animation:"none"}),f=Math.round(r.total_water_savings_td),e=Math.round(r.total_energy_savings_td),f.toString().length<3||e.toString().length<3){jq("#apiData").text("String is too short to split into three parts.");return}var o=f.toString(),s=e.toString(),h=Math.ceil(o.length/3),c=Math.ceil(s.length/3),l=o.slice(0,h),a=o.slice(h,2*h),v=o.slice(2*h),y=s.slice(0,c),p=s.slice(c,2*c),w=s.slice(2*c);r?(jq("#totalWaterSavings").text(l+" "+a+" "+v),jq("#totalWaterUsage").text(y+" "+p+" "+w),i("#totalWaterSavings",f),i("#totalWaterUsage",e)):jq("#apiData").text("Data not found for the desired country.")}).fail(function(){jq("#apiData").text("Error fetching data from the API.")})})})