function popuplogin(a){a.preventDefault();a={};a.r=$(this).data("redirect");loadpopup("popuplogin","/popup-login",a)}function popupsubmitlogin(a){a.preventDefault();a={a:"login"};a.e=$("form.popuploginform input[name=email]").val();a.p=$("form.popuploginform input[name=password]").val();a.r=$("form.popuploginform input[name=redirect]").val();$.get("/process-login",a,function(a){a.success?(liftcurtain(),a.redirect&&(document.location.href=a.redirect)):$(".popupContent .error").html(a.error)})}
function vipsignupform(a){a.preventDefault();a={a:"vipsignup"};a.f=$("form.vipPopForm input[name=firstname]").val();a.l=$("form.vipPopForm input[name=lastname]").val();a.e=$("form.vipPopForm input[name=email]").val();a.p=$("form.vipPopForm input[name=password]").val();a.s=$("form.vipPopForm select[name=branch]").val();a.c=$("form.vipPopForm input[name=agree]:checked").val();console.log(a.c);$.get("/process-login",a,function(a){a.success?($(".error").html(""),liftcurtain(),a.redirect&&(document.location.href=
a.redirect)):$(".vipPopInner .error").html(a.error)})}function popupforgotpassword(a){a.preventDefault();loadpopup("popupforgotpasswordpopup","/popup-forget-password",{})}function resetpassword(a){a.preventDefault();a=$("form.forgetpasswordform input[name=email]").val();$.get("/process-login",{a:"resetpassword",e:a},function(a){$(".error").html(a)})}function popupnotify(a){a.preventDefault();a={};a.i=$(this).data("barcode");loadpopup("popupnotify","/popup-notify",a)}
function popupsubmitnotify(a){a.preventDefault();a={a:"notify"};a.e=$("form.popupnotifyform input[name=email]").val();a.i=$("form.popupnotifyform input[name=barcode]").val();$.get("/process-product",a,function(a){a.success?liftcurtain():$(".error").html(a.error)})}function sharetwitter(){ls_url=$(this).data("link");ls_url="http://twitter.com/share?url="+encodeURIComponent(ls_url);popupwindow(ls_url,"Tweet",600,600)}
function sharefb(){ls_url=$(this).data("link");FB.ui({method:"share",href:ls_url},function(a){})}function sharepinterest(){ls_url=$(this).data("link");ls_url="https://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(ls_url);popupwindow(ls_url,"",600,600)}function sharegoogleplus(){ls_url=$(this).data("link");ls_url="https://plus.google.com/share?url="+encodeURIComponent(ls_url);popupwindow(ls_url,"",600,600)}
function popupwindow(a,c,d,b){return window.open(a,c,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+d+", height="+b+", top="+(window.innerHeight/2-b/2)+", left="+(window.innerWidth/2-d/2))}function enterdraw(a){a.preventDefault();lo_request=$(this).serialize();$.get("/process-draw?a=enterdraw",lo_request,function(a){$(".js-response").html(a.message)})}
function geturlparameter(a){var c=decodeURIComponent(window.location.search.substring(1)).split("&"),d;for(d=0;d<c.length;d++){var b=c[d].split("=");if(b[0]===a)return void 0===b[1]?!0:b[1]}}function gatracking(a){a=$(this).data("layer");if("object"==typeof a){var c=$(this).prop("href");a.eventCallback=function(){document.location=c};dataLayer.push(a);return!1}}function initcategory(){$(window).resize();window.scrollTo(0,0)}
function newslettersignup(a){a.preventDefault();ls_email=$("#newsletter-email").val();$(".newsletter-success").addClass("hidden");$(".newsletter-error").addClass("hidden");$.get("/newsletter-signup",{e:ls_email},function(a){a.success?($(".newsletter-success").removeClass("hidden"),$(".newsletter-signup").addClass("hidden"),dataLayer.push({event:"footerSignup",Email:ls_email})):(console.log(a),$(".newsletter-error").removeClass("hidden"),$(".newsletter-error").html(a.error))})}
function getcookie(a){a+="=";for(var c=document.cookie.split(";"),d=0;d<c.length;d++){for(var b=c[d];" "==b.charAt(0);)b=b.substring(1);if(-1!=b.indexOf(a))return b.substring(a.length,b.length)}return""}function setcookie(a,c,d){var b="";d&&(b=new Date,b.setTime(b.getTime()+864E5*d),b="; expires="+b.toUTCString());document.cookie=a+"="+c+b+"; path=/"}
$(document).ready(function(){"undefined"!=typeof peppercategory&&(peppercategory.postupdate=initcategory);$(document).on("click touchend",".popupclose",liftcurtain);$(document).on("click",".openlogin",popuplogin);$(document).on("click",".popupsubmitlogin",popupsubmitlogin);$(document).on("click",".popupforgotpassword",popupforgotpassword);$(document).on("click",".forgetpasswordbtn",resetpassword);$(document).on("click",".opennotify",popupnotify);$(document).on("click",".popupsubmitnotify",popupsubmitnotify);
$(document).on("click",".sharetwitter",sharetwitter);$(document).on("click",".sharefb",sharefb);$(document).on("click",".sharepinterest",sharepinterest);$(document).on("click",".sharegoogleplus",sharegoogleplus);$(document).on("click",".gatracking",gatracking);$(document).on("submit",".newsletter-signup-form",newslettersignup);$(document).on("submit",".vipPopForm",vipsignupform);switch(ps_page){case "confirmation":pi_orderid=geturlparameter("i"),pi_hash=geturlparameter("h"),lo_request={},lo_request.i=
pi_orderid,lo_request.h=pi_hash,$.get("/process-draw?a=autoenter",lo_request,function(a){a.success&&loadpopup("popupwinnerdraw","/popup-loreal-draw",lo_request)}),$(document).on("submit",".js-enterdraw",enterdraw)}$(document).on("mouseover",".productThumb img.dtTab",function(a){a=$(this).parent().data("front");"no-image"!=$(this).parent().data("front")&&($(this).next(".hoverImg").attr("src",a),$(this).next(".hoverImg").removeClass("j-hide"))});$(document).on("mouseout",".productThumb img.hoverImg",
function(){isMobile.any()||$(this).addClass("j-hide")})});$(window).on("resize",function(){$("body").hasClass("mobile")||($("img[data-src]").each(function(){var a=$(this).data("src");$(this).prop("src",a)}),console.log("loading desktop Image"))}).resize();
$(document).on("click",".filterbtn",function(){var a=$(this).parent().hasClass("price");$("body").hasClass("desktop");var c=function(b){a?(b.children("i").removeClass("ion-chevron-right").addClass("ion-chevron-down"),$(".filterSlider, .filterSliderText").addClass("j-active")):(b.next().addClass("j-active"),b.children("i").removeClass("ion-chevron-right").addClass("ion-chevron-down"))},d=function(b){$(".filterbtn i").removeClass("ion-chevron-down").addClass("ion-chevron-right");a?($(".filterSlider, .filterSliderText").removeClass("j-active"),
console.log("price")):(b.next().removeClass("j-active"),console.log("other"))};$(this).next().hasClass("j-active")?d($(this)):($(".filterSlider, .filterSliderText, .filteropt").removeClass("j-active"),$(".filterbtn i").removeClass().addClass("ion-chevron-right"),c($(this)))});
var showFilters=function(){$("body").hasClass("desktop")||($(".pcFilters").toggleClass("j-visible"),$(".pcFilters").addClass("j-visible"),$(".catbuttons .gobackwrap").addClass("j-show"),$(".catbuttons .refine").addClass("j-hide"))},hideFilters=function(){$("body").hasClass("desktop")||($(".pcFilters").removeClass("j-visible"),$(".catbuttons .gobackwrap").removeClass("j-show"),$(".catbuttons .refine").removeClass("j-hide"))};$(document).on("click",".catfilters .refine",function(){showFilters()});
$(document).on("click",".goback, .filterItem, .filterResetAll, .filterReset",function(){console.log("goback - reset");hideFilters()});var targetSliderEl=".noUi-horizontal .noUi-handle, .noUi-handle-lower, .noUi-handle-upper, .noUi-horizontal, div.noUi-base, .noUi-connect, .noUi-background";$(document).on("mouseup click touchend",targetSliderEl,function(){console.log("touch the noUI");hideFilters()});
$(document).ready(function(){"undefined"!=typeof peppercategory&&(peppercategory.postsliderchange=function(){console.log("changed");hideFilters()})});var rating_slider=document.getElementById("rateslider"),rating_field=document.getElementById("skip-rate");rating_slider&&(noUiSlider.create(rating_slider,{start:3,step:1,range:{min:1,max:5}}),rating_slider.noUiSlider.on("update",function(a,c){rating_field.innerHTML=Math.round(a[c])}));
var isMobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},any:function(){return isMobile.Android()||isMobile.BlackBerry()||isMobile.iOS()||isMobile.Opera()||isMobile.Windows()}};
$(".pageLaybuy .question").on("click",function(a){$(".pageLaybuy .question").not(this).next(".answer").slideUp();$(".pageLaybuy .question").not(this).removeClass("j-qActive");$(this).toggleClass("j-qActive");$(this).next(".answer").slideToggle()});$(function(){"undefined"!==typeof peppercategory&&(peppercategory.preupdate=function(){peppercategory.pagealias=gs_pagealias})});var tag=document.createElement("script");tag.src="https://www.youtube.com/iframe_api";var firstScriptTag=document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);var player;function onYouTubeIframeAPIReady(){player=new YT.Player("videoPlayer",{events:{onReady:onPlayerReady}})}function onPlayerReady(a){$(".homeVideo").length&&($("body").hasClass("desktop")||player.pauseVideo());$(window).on("resize",function(){$(".homeVideo").length&&($("body").hasClass("desktop")||player.pauseVideo())})}
$(document).ready(function(){if($(".homeVideoMp4").length){var a=0,c=setInterval(function(){a=$(".homeVideoMp4 video").get(0).readyState;4==a&&(clearInterval(c),$(".homeVideoMp4 video").get(0).paused?$(".homeVideoPlay").removeClass("j-invisible"):setTimeout(function(){$(".homeVideoPlay").remove()},300))},100);$("body").hasClass("desktop")?$(".homeVideoMp4 video").attr("autoplay",1):$(".homeVideoMp4 video").get(0).pause()}$(document).on("click",".homeVideoMp4",function(){$(".homeVideoMp4 video").get(0).paused?
($(".homeVideoMp4 video").get(0).play(),$(this).find(".homeVideoPlay").remove()):($(".homeVideoMp4 video").get(0).pause(),$(".homeVideoMp4").append('<div class="homeVideoPlay"></div>'))});$(window).on("resize",function(){$(".homeVideoMp4").length&&($("body").hasClass("desktop")?!$(".homeVideoPlay").length&&$(".homeVideoMp4 video").get(0).paused&&$(".homeVideoMp4").append('<div class="homeVideoPlay"></div>'):$(".homeVideoMp4 video").get(0).pause());$(".homeVideo").length&&($("body").hasClass("desktop")||
player.pauseVideo())});""===getcookie("vippopup")&&(setcookie("vippopup",1,7),setTimeout(function(){loadpopup("vipPop","/popup-vip")},1E3))});