var LastSelectedColor=null;var LastSelectedSize=null;var VariantId;function ProductClick(r){var e=getSrcElement(r);if(r!=null){var l=e.getAttribute("Id");if(l==null){return}if(l.substr(0,12)=="ImageCouleur"){if(e.className!="on"){if(LastSelectedColor==null){var q=getElement_By_Id("SelectedColor");if(q!=null){LastSelectedColor=getElement_By_Id("ImageCouleur"+q.value)}}if(LastSelectedColor!=null){LastSelectedColor.className=""}var t=getElement_By_Id("AStockNotifyLink");if(t!=null){t.href=t.href.toString().replace("&Color="+LastSelectedColor.getAttribute("colorid"),"&Color="+e.getAttribute("colorid"))}LastSelectedColor=e;e.className="on";var g=getElement_By_Id("SelectedProductSize");if(g!=null){g.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}var s=getElement_By_Id("BackUpSelectedProduct");if(s!=null){s.value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"}getElement_By_Id("ViewInfos_BackUpSrc").value=e.src.toString().replace("PI_","");getElement_By_Id("AZoomProduct").href=e.getAttribute("photo01url").replace("PI_","HD_");
for(var j=1;j<9;j++){var c=getElement_By_Id("viewer0Thumb"+(j-1));getElement_By_Id("viewer0Thumb"+(j-1)).src=e.getAttribute("photo0"+j+"url");getElement_By_Id("viewer0Thumb"+(j-1)).setAttribute("BackUpSrc",e.getAttribute("photo0"+j+"url"));getElement_By_Id("viewer0Zoom"+(j-1)).href=e.getAttribute("photo0"+j+"url").replace("PI","HD")}var f=document.getElementsByName("priceAsterix");if(f!=null&&f.length){for(var j=0;j<f.length;j++){if(e.getAttribute("vpPriceMessage")==""){f[j].innerHTML=""}else{f[j].innerHTML="*"}}}var a=getElement_By_Id("vpPriceMessage");if(a!=null){a.innerHTML=e.getAttribute("vpPriceMessage")}VariantId="";SetCouleur(e.getAttribute("couleur"));var b=document.getElementById("ProductPrincipalImage");GetMarKetingFieldsAndProductDistinction(e);for(var h=0;h<5;h++){var d=getElement_By_Id("PictoPromo"+h);if(d!=null){if(e.getAttribute("promopicto")==d.getAttribute("promopicto")){d.style.display="block"}else{d.style.display="none"}}}for(var h=0;h<5;h++){var d=getElement_By_Id("PictoPromoBasket"+h);
if(d!=null){if(e.getAttribute("promopicto")==d.getAttribute("promopicto")){d.style.display="block"}else{d.style.display="none"}}}GetPrice(e)}}else{if(l=="ImagePointure"){if(LastSelectedSize==null){LastSelectedSize=e}LastSelectedSize.parentNode.className="";LastSelectedSize=e;e.parentNode.className="on";var g=getElement_By_Id("SelectedProductSize");if(g!=null){g.innerHTML=e.getAttribute("formatedSize")+" "+EnStockWord}var s=getElement_By_Id("BackUpSelectedProduct");if(s!=null){s.value=e.getAttribute("formatedSize")+" "+EnStockWord}VariantId=e.getAttribute("variantid");if(getElement_By_Id("spanSelectSize")!=null){getElement_By_Id("spanSelectSize").style.display="none"}if(getElement_By_Id("divDetailsPrixPromo").style.display=="inline"&&getElement_By_Id("LabelFromPricePromo")!=null){setinvisible(getElement_By_Id("LabelFromPricePromo"))}else{if(getElement_By_Id("divDetailsPrixNodispo").style.display=="inline"&&getElement_By_Id("LabelFromPriceNoDispo")!=null){setinvisible(getElement_By_Id("LabelFromPriceNoDispo"))
}else{if(getElement_By_Id("divDetailsPrix").style.display=="block"&&getElement_By_Id("LabelFromPrice")!=null){setinvisible(getElement_By_Id("LabelFromPrice"))}}}GetPrice(e)}else{if(l=="ButtonOK"){AddUserBrandMailSubscription(getElement_By_Id("TextBoxEmail").value,getElement_By_Id("NotifyBrand").getAttribute("brandid"),getElement_By_Id("NotifyBrand").getAttribute("brandname"))}else{if(l=="ButtonValidateComment"){if(checkMail(getElement_By_Id("TextBoxEmail").value)&&getElement_By_Id("TextBoxPseudo").value.length!=0&&getElement_By_Id("TextBoxCommentaire").value.length!=0){AddUserComments(getElement_By_Id("TextBoxPseudo").value,getElement_By_Id("TextBoxVille").value,getElement_By_Id("TextBoxAge").value,getElement_By_Id("TextBoxCommentaire").value,getElement_By_Id("TextBoxEmail").value,getElement_By_Id("DropDownListNote").options[getElement_By_Id("DropDownListNote").selectedIndex].value,getElement_By_Id("reference").getAttribute("productId"),getElement_By_Id("CheckBoxNewsLetter").checked.toString(),getElement_By_Id("CheckBoxBitumePartenaires").checked.toString())
}else{alert(getElement_By_Id("errorInComment").value)}}else{if(l.substr(0,7)=="addCart"||l.substr(0,7)=="addToMP"){var p=getElement_By_Id("IsOneVariantAvailable");if(p!=null&&p.value!=""&&VariantId==null){VariantId=p.value;p.value=""}if(e.className==""&&VariantId!=null&&VariantId!=""){if(l.substr(0,7)=="addCart"){updatedHeaderBasket=true;AddProductToBasket(VariantId,1)}else{if(l.substr(0,7)=="addToMP"){var n="0";n=getCookieMultiValue("SarUserContext","srIsAuthen");if(n!="1"){var m="/XMLHttpProxy/CompteLight.aspx?From=mes-preferes&variantid="+VariantId;return hs.htmlExpand(null,{objectType:"iframe",outlineType:"rounded-white",wrapperClassName:"highslide-wrapper drag-header",outlineWhileAnimating:true,width:771,height:516,dimmingOpacity:0.5,align:"center",src:m})}else{addProductToMP(VariantId)}}}}else{if(getElement_By_Id("spanSelectSize")!=null){getElement_By_Id("spanSelectSize").style.display="inline"}}}}}}}}}function ChangeImages(b){var a=document.getElementById("ProductPrincipalImage");
a.setAttribute("colorid",b.getAttribute("colorId"));RefreshOnLoad(a)}function AddUserComments(g,h,j,b,e,f,c,k,d){var a=servicePOST("XMLHttpProxy/ProductService.aspx","Action=SaveUserComments&email="+e+"&pseudo="+g+"&ville="+h+"&age="+j+"&commentaire="+b+"&note="+f+"&productId="+c+"&NewsLetter="+k+"&PartnerNewsLetter="+d,false);if(a.text.indexOf("NOK")!=-1){alert(getElement_By_Id("PbServiceComment").value)}else{alert(getElement_By_Id("CommentOk").value);$S("del",$("divAddComment"),"on");unFold($("SaisieCommentaire"),$("SaisieCommentaire","div",0))}}function AddUserProductMailNotification(a,d,c){var b=servicePOST("XMLHttpProxy/ProductService.aspx","Action=BrandSubscribe&email="+a+"&brandId="+d+"&brandName="+c,false);alert(b.text)}function SetCouleur(b){var d=document.getElementsByName("ImagePointure");var j=0;var a=null;if(d.length){for(i=0;i<d.length;i++){try{d[i].parentNode.className="";if(d[i].getAttribute("color")!=b){setinvisible(d[i].parentNode)}else{j++;a=d[i];setvisible(d[i].parentNode)
}}catch(h){}}}var g=document.getElementsByName("ImagePointureEpuisee");if(g.length){for(i=0;i<g.length;i++){try{g[i].parentNode.className="";if(g[i].getAttribute("color")!=b){setinvisible(g[i].parentNode)}else{j++;a=g[i];setvisible(g[i].parentNode)}}catch(h){}}}if(j==1){VariantId=a.getAttribute("variantId");a.parentNode.className="on";var f=getElement_By_Id("SelectedProductSize");if(f!=null){f.innerHTML=a.getAttribute("formatedSize")+" "+EnStockWord}var c=getElement_By_Id("BackUpSelectedProduct");if(c!=null){c.value=a.getAttribute("formatedSize")+" "+EnStockWord}}if(j==0){document.getElementById("selectsize").style.display="none"}else{document.getElementById("selectsize").style.display="block"}var d=document.getElementsByName("ImageCouleur");if(d.length){for(i=0;i<d.length;i++){try{d[i].setAttribute("backUpCouleur",b)}catch(h){}}}var d=document.getElementsByName("MarketingHTMLContent");if(d.length){for(i=0;i<d.length;i++){try{if(d[i].getAttribute("color")!=b){d[i].style.display="none"}else{d[i].style.display="block"
}}catch(h){}}}}function setvisible(a){a.style.display="inline"}function setinvisible(a){a.style.display="none"}function GetMarKetingFieldsAndProductDistinction(a){var h=false;var l=0;var e=a.getAttribute("marketingField").split(";");for(var d=0;d<5;d++){var c=getElement_By_Id("marketingField"+d);if(c!=null){for(var g=0;g<e.length;g++){if(e[g]!=""){if(c.getAttribute("marketingField")==e[g]){h=true}}}if(h&&l<2){c.style.display="inline";l++}else{c.style.display="none"}h=false}}var f=a.getAttribute("productDistinction").split(";");for(var b=0;b<5;b++){var c=getElement_By_Id("productDistinction"+b);if(c!=null){for(var g=0;g<f.length;g++){if(f[g]!=""){if(c.getAttribute("productDistinction")==f[g]){h=true}}}if(h){c.style.display="block"}else{c.style.display="none"}h=false}}}function GetPrice(f){if(f.getAttribute("disponible")>=1){if(f.getAttribute("isPromo")==1){getElement_By_Id("divDetailsPrixPromo").style.display="block";if(getElement_By_Id("DivIsPromo")!=null){getElement_By_Id("DivIsPromo").style.display="block"
}getElement_By_Id("divDetailsPrix").style.display="none";getElement_By_Id("divDetailsPrixNodispo").style.display="none";getElement_By_Id("Div_Product_NotAvailable_Message").style.display="none";getElement_By_Id("divDetailsGuideTailles").style.display="block";getElement_By_Id("LabelPrixPromo").innerHTML=f.getAttribute("sellingprice");var d=getElement_By_Id("LabelPrixBarre");d.innerHTML=f.getAttribute("refprice");if(f.getAttribute("sellingprice")!=f.getAttribute("refprice")){d.style.display="block"}if(f.getAttribute("Id")!="ImagePointure"){var c=getElement_By_Id("imgPromoBasketAction");if(c!=null){var a=getElement_By_Id("imgPromoBasketAction").src.toString();a=a.substr(a.lastIndexOf("/"),a.length-1);var g=f.getAttribute("promopicto");if(a!="/"&&a.indexOf(".gif")!=-1){g=g.substr(g.lastIndexOf("/"),g.length)}else{a=getElement_By_Id("imgPromoBasketAction").src.toString();if(a.indexOf("V4")==-1){if(a!="http://cache.sarenza.com/"){g="http://cache.sarenza.com/V4/"+g}else{g=a+"V4/"+g}}else{g=a+g
}}if(getElement_By_Id("divIsLuxe")!=null&&getElement_By_Id("divIsLuxe").style.display=="inline"){g=g.replace(".gif","L.gif")}c.src=c.src.replace(a,g);c.alt=f.getAttribute("promocode");c.style.display="block";if(getElement_By_Id("imgFlagPromoProductView")!=null){getElement_By_Id("imgFlagPromoProductView").parentNode.style.display="block";getElement_By_Id("imgFlagPromoProductView").style.display="block";getElement_By_Id("imgFlagPromoProductView").src=getElement_By_Id("imgFlagPromoProductView").src.replace(a.replace(".gif","G.gif"),g.replace(".gif","G.gif"));getElement_By_Id("imgFlagPromoProductView").alt=f.getAttribute("promocode")}}if(f.getAttribute("sellingprice")==f.getAttribute("defaultprice")){getElement_By_Id("LabelFromPricePromo").style.display="none"}else{getElement_By_Id("LabelFromPricePromo").style.display="inline"}}else{getElement_By_Id("LabelFromPricePromo").style.display="none"}}else{getElement_By_Id("divDetailsPrixPromo").style.display="none";if(getElement_By_Id("DivIsPromo")!=null){getElement_By_Id("DivIsPromo").style.display="none"
}getElement_By_Id("divDetailsPrix").style.display="block";getElement_By_Id("divDetailsPrixNodispo").style.display="none";getElement_By_Id("Div_Product_NotAvailable_Message").style.display="none";getElement_By_Id("divDetailsGuideTailles").style.display="block";getElement_By_Id("LabelPrix").innerHTML=f.getAttribute("sellingprice");if(f.getAttribute("Id")!="ImagePointure"){if(f.getAttribute("sellingprice")==f.getAttribute("defaultprice")){getElement_By_Id("LabelFromPrice").style.display="none"}else{getElement_By_Id("LabelFromPrice").style.display="inline"}}else{getElement_By_Id("LabelFromPricePromo").style.display="none"}if(getElement_By_Id("imgFlagPromoProductView")!=null){var e=f.getAttribute("promopicto");if(e==""||e==null){getElement_By_Id("imgFlagPromoProductView").parentNode.style.display="none";getElement_By_Id("imgFlagPromoProductView").style.display="none"}else{e=e.substring(e.lastIndexOf("/"),e.length);var g=getElement_By_Id("imgFlagPromoProductView").src;if(g.indexOf(".gif")==-1){g+="/image.gif"
}var b=g.substring(g.lastIndexOf("/"),g.length);getElement_By_Id("imgFlagPromoProductView").src=g.replace(b,e.replace(".gif","G.gif"))}}}}else{getElement_By_Id("divDetailsPrixPromo").style.display="none";getElement_By_Id("divDetailsPrix").style.display="none";getElement_By_Id("divDetailsPrixNodispo").style.display="block";getElement_By_Id("Div_Product_NotAvailable_Message").style.display="block";getElement_By_Id("divDetailsGuideTailles").style.display="none";if(getElement_By_Id("LabelPrixNodispo")!=null){getElement_By_Id("LabelPrixNodispo").innerHTML=f.getAttribute("sellingprice")}if(f.getAttribute("Id")!="ImagePointure"){if(f.getAttribute("sellingprice")==f.getAttribute("defaultprice")){if(getElement_By_Id("LabelFromPriceNodispo")!=null){getElement_By_Id("LabelFromPriceNodispo").style.display="none"}}else{if(getElement_By_Id("LabelFromPriceNodispo")!=null){getElement_By_Id("LabelFromPriceNodispo").style.display="inline"}}}else{getElement_By_Id("LabelFromPricePromo").style.display="none"
}}}function SetProductSizeViewer(c,a){var d=getElement_By_Id("SelectedProductSize");if(d!=null){if(a){if(c.getAttribute("disponible")>0){d.innerHTML=c.getAttribute("formatedSize")+" "+EnStockWord}else{d.innerHTML=NotEnStockWord}}else{var b=getElement_By_Id("BackUpSelectedProduct");if(b!=null){d.innerHTML=b.value}}}}function SetProductViewer(d,b){if(b){var f=getElement_By_Id("productFlash");if(f!=null){var a=new FlashObject("",d.src.replace("PI_",""),coeffZoom,8,false);a.write("productFlash")}getElement_By_Id("ProductSupplierColor").innerHTML=d.getAttribute("couleur");for(var e=1;e<9;e++){getElement_By_Id("viewer0Thumb"+(e-1)).src=d.getAttribute("photo0"+e+"url")}}else{var f=getElement_By_Id("productFlash");if(f!=null){var c=getElement_By_Id("ViewInfos_BackUpSrc");var a=new FlashObject("",c.value,coeffZoom,8,false);a.write("productFlash")}getElement_By_Id("ProductSupplierColor").innerHTML=d.getAttribute("backUpCouleur");for(var e=1;e<9;e++){getElement_By_Id("viewer0Thumb"+(e-1)).src=getElement_By_Id("viewer0Thumb"+(e-1)).getAttribute("BackUpSrc")
}}}function NewsSubscribe(a,c){var b=getElement_By_Id("mail").value;getElement_By_Id("mail").value="";if(checkMail(b)){result=servicePOST("XMLHttpProxy/ManageNotification.aspx","Action=NewsSubscribe&Mail="+b+"&BrandId="+a+"&BrandName="+c,true);if(result.rtCode!="NOK"){getElement_By_Id("notifySubscribe").style.visibility="visible"}}else{alert("Adresse incorrect");getElement_By_Id("mail").focus()}}function HandleInputMailNotifKeyPress(b,a,c){var d=null;if(b.which){d=b.which}else{if(b.keyCode){d=b.keyCode}}if(13==d){NewsSubscribe(a,c)}return false}function NoticeFriend(c,e,j){var b;var h;var g;var f;var k;var d;var a;a=trim(getElement_By_Id("SelectedColor").value);b=trim(getElement_By_Id("maildestinataire").value);h=trim(getElement_By_Id("namedestinataire").value);g=trim(getElement_By_Id("mailexpediteur").value);f=trim(getElement_By_Id("namexpediteur").value);k=trim(getElement_By_Id("TextResume").value);if(checkMail(b)&&checkMail(g)&&f.length!=0&&h.length!=0){result=servicePOST("XMLHttpProxy/ManageNotification.aspx","Action=FriendAdvice&ProductId="+c+"&ColorId="+a+"&maildestinataire="+b+"&namedestinataire="+h+"&mailexpediteur="+g+"&namexpediteur="+f+"&TextResume="+k+"&BrandName="+j+"&ModelName="+e,true);
getElement_By_Id("notifyAdd").style.visibility="hidden";getElement_By_Id("notifyConfirmation").style.visibility="visible"}else{alert("Erreur de saisie. Verifiez les differents champs obligatoires.")}}function InitDivAddCommentAction(){if($("SaisieCommentaire").offsetHeight>10){$S("del",$("divAddComment"),"on");unFold($("SaisieCommentaire"),$("SaisieCommentaire","div",0))}else{$S("add",$("divAddComment"),"on");fold($("SaisieCommentaire"),$("SaisieCommentaire","div",0))}}function ShowNotification(){getElement_By_Id("notifyAdd").style.visibility="visible"}function HideNotice(){getElement_By_Id("notifyAdd").style.visibility="hidden"}function HideStockNotification(){getElement_By_Id("divNotifyStock").style.display="none"}function ShowStockNotification(){if(LastSelectedColor==null){var a=getElement_By_Id("SelectedColor");if(a!=null){LastSelectedColor=getElement_By_Id("ImageCouleur"+a.value)}}if(LastSelectedColor!=null){getElement_By_Id("txtMailStockNotifUser").value="";getElement_By_Id("txtSizeStockNotifUser").value="";
getElement_By_Id("checkBoxBrandNotifUser").checked=true;getElement_By_Id("divNotifyStock").style.display="block"}}function MainStockNotification(c,a,h){if(LastSelectedColor==null){var g=getElement_By_Id("SelectedColor");if(g!=null){LastSelectedColor=getElement_By_Id("ImageCouleur"+g.value)}}if(LastSelectedColor!=null){var d=trim(getElement_By_Id("txtMailStockNotifUser").value);var b=LastSelectedColor.getAttribute("colorid");var j=trim(getElement_By_Id("txtSizeStockNotifUser").value);var f=getElement_By_Id("checkBoxBrandNotifUser").checked.toString();var e=getElement_By_Id("checkBoxNewsLetterNotifUser").checked.toString();if(checkMail(d)&&ValidateSize(j)&&d!=""){result=servicePOST("XMLHttpProxy/ManageNotification.aspx","Action=StockNotification&ProductId="+c+"&ColorId="+b+"&Mail="+d+"&Size="+j+"&BrandNews="+f+"&BrandName="+h+"&BrandId="+a+"&NewsLetter="+e,true);HideStockNotification();alert("Votre demande est bien prise en compte.")}else{alert("Erreur de saisie. Verifiez les differents champs obligatoires.")
}}}function ValidateSize(b){if(b.Value==""){return false}else{var a=new RegExp("^((0[1-9])|([1-9][0-9])|(0[1-9].5)|([1-9][0-9],5)|(0[1-9],5)|([1-9][0-9].5))+$","gi");return a.test(b)}}function HideConfirm(){getElement_By_Id("notifyConfirmation").style.visibility="hidden"}function hidePIProductColorImage(a){a.parentNode.style.display="none"}function showPIProductColorImage(a){a.parentNode.style.display="block"};