function removeZero(str){ValidatorTrim(str);if(str.substr(0,1)==0){str=str.replace("0","");str=removeZero(str)}return str}function hideMe(ele,buttonName){ele.disabled=true;ele.value="Merci de patienter...";return true}function showMe(ele,buttonName){ele.disabled=false;ele.value=buttonName;return true}function validateAddress(ele){buttonName="Recevoir";hideMe(ele,buttonName);var email=document.addressrequest.email.value;var sms=document.addressrequest.phone.value;if(ValidatorTrim(email)==""&&ValidatorTrim(sms)==""){alert("Merci d\u2019entrer votre email ou num\xE9ro de portable pour recevoir les coordonn\xE9es de ce revendeur.");showMe(ele,buttonName);return false}else{if(ValidatorTrim(sms)!=""){sms=replacePhoneValue(sms);if(sms.length<8||sms.length>=15){alert("Merci d\u2019entrer votre email ou num\xE9ro de portable pour recevoir les coordonn\xE9es de ce revendeur.");showMe(ele,buttonName);return false}else{if(!ValidateSplChar(sms)){alert("Merci de renseigner un num\xE9ro de t\xE9l\xE9phone valide.");document.addressrequest.phone.focus();showMe(ele,buttonName);return false}else{if(sms==""){showMe(ele,buttonName);return false}else{document.addressrequest.phone.value=sms}}}}if(ValidatorTrim(email)!=""){if(checkEmail(email)!=""){alert("Merci d\u2019entrer votre email ou num\xE9ro de portable pour recevoir les coordonn\xE9es de ce revendeur.");showMe(ele,buttonName);return false}}}return true}function callbackRequest(ele){buttonName="Rappelez-moi";hideMe(ele,buttonName);var sms=document.callbackrequest.phone.value;sms=replacePhoneValue(sms);if(ValidatorTrim(sms)==""){alert("Merci de renseigner votre num\xE9ro de t\xE9l\xE9phone.");showMe(ele,buttonName);return false}else{if(trim(sms).length<8||trim(sms).length>=20){alert("Merci de renseigner un num\xE9ro de t\xE9l\xE9phone valide.");showMe(ele,buttonName);return false}else{if(!ValidateSplChar(sms)){alert("Merci de renseigner un num\xE9ro de t\xE9l\xE9phone valide.");showMe(ele,buttonName);return false}else{if(sms==""){showMe(ele,buttonName);return false}else{document.callbackrequest.phone.value=sms}}}}return true}var map=null;var geocoder=null;var latsgn=1;var lgsgn=1;var zm=9;var marker=null;function intilazeMap(lattitude,longitude){if(GBrowserIsCompatible()){var map=new GMap2(document.getElementById("map_canvas"),{size:new GSize(430,319)});map.setCenter(new GLatLng(20,-10),16);map.setMapType(G_NORMAL_MAP);map.addControl(new GSmallMapControl);var point=new GLatLng(lattitude,longitude);var baseIcon=new GIcon;baseIcon.iconSize=new GSize(29,31);baseIcon.iconAnchor=new GPoint(9,34);baseIcon.infoWindowAnchor=new GPoint(5,1);var letteredIcon=new GIcon(baseIcon);letteredIcon.image="./images/marker-red-new.png";letteredIcon.shadow="./images/shadow.png";markerOptions={icon:letteredIcon};map.addOverlay(new GMarker(point,markerOptions));map.setCenter(point)}}var initialtab=[1,"sc1"];var initialtabAddrCall=[1,"compSetting1"];if(tabid==2){var initialtabCompSetting=[1,"compSetting2"]}else{var initialtabCompSetting=[1,"compSetting1"]}var previoustab="";function cascadedstyle(el,cssproperty,csspropertyNS){if(el.currentStyle){return el.currentStyle[cssproperty]}else if(window.getComputedStyle){var elstyle=window.getComputedStyle(el,"");return elstyle.getPropertyValue(csspropertyNS)}}function expandcontent(cid,aobject){if(document.getElementById){highlighttab(aobject,cid);detectSourceindex(aobject);if(previoustab!=""){document.getElementById(previoustab).style.display="none"}document.getElementById(cid).style.display="block";previoustab=cid;if(aobject.blur){aobject.blur()}return false}else{return true}}function highlighttab(aobject,cid){if(typeof tabobjlinks=="undefined"){collecttablinks()}for(i=0;i<tabobjlinks.length;i++){tabobjlinks[i].style.backgroundColor=initTabcolor}var themecolor=aobject.getAttribute("theme")?aobject.getAttribute("theme"):initTabpostcolor;aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor;$("#tablist > div").each(function(i){var id=$(this).attr("tagId");if(id!=null&&id!=""){if(id.substr(4)==cid){$(this).attr("class","current")}else{$(this).attr("class","normal")}}})}function collecttablinks(){var tabobj=document.getElementById("tablist");tabobjlinks=tabobj.getElementsByTagName("DIV")}function detectSourceindex(aobject){for(i=0;i<tabobjlinks.length;i++){if(aobject==tabobjlinks[i]){tabsourceindex=i;break}}}function do_onload(msg,pathurl){if(msg=="emailsms"){alert("Un email et SMS avec les coordonn\xE9es et le plan d\u2019acc\xE8s de ce revendeur vous a \xE9t\xE9 transmis. N\u2019h\xE9sitez pas \xE0 prendre contact avec lui, il vous attend !");location.href=pathurl}if(msg=="email"){alert("Un email avec les coordonn\xE9es et le plan d\u2019acc\xE8s de ce revendeur vous a \xE9t\xE9 transmis. N\u2019h\xE9sitez pas \xE0 prendre contact avec lui, il vous attend !");location.href=pathurl}if(msg=="sms"){alert("Un SMS avec les coordonn\xE9es et le plan d\u2019acc\xE8s de ce revendeur vous a \xE9t\xE9 transmis. N\u2019h\xE9sitez pas \xE0 prendre contact avec lui, il vous attend !");location.href=pathurl}if(msg=="phone"){alert("Notre service client va vous rappeler tr\xE8s prochainement!");location.href=pathurl}if(msg=="visitcodesms"){alert("Un SMS contenant votre code visite vous a \xE9t\xE9 envoy\xE9.");location.href=pathurl}if(msg=="errorcreatelead"){alert("Error while validating your request on server-side. Your request has not been executed.");location.href=pathurl}var cookiename=typeof persisttype!="undefined"&&persisttype=="sitewide"?"tabcontent":window.location.pathname;var cookiecheck=window.get_cookie&&get_cookie(cookiename).indexOf("|")!=-1;collecttablinks();initTabcolor=cascadedstyle(tabobjlinks[1],"backgroundColor","background-color");initTabpostcolor=cascadedstyle(tabobjlinks[0],"backgroundColor","background-color");if(typeof enablepersistence!="undefined"&&enablepersistence&&cookiecheck){var cookieparse=get_cookie(cookiename).split("|");var whichtab=cookieparse[0];var tabcontentid=cookieparse[1];expandcontent(tabcontentid,tabobjlinks[whichtab])}else{expandcontent(initialtab[1],tabobjlinks[initialtab[0]-1])}}var previoustabCompSetting="";function expandCompanySetting(setid,aobject){if(document.getElementById){highlighttabCompSetting(setid,aobject);detectSourceindexCompSetting(aobject);if(previoustabCompSetting!=""){document.getElementById(previoustabCompSetting).style.display="none"}document.getElementById(setid).style.display="block";previoustabCompSetting=setid;if(aobject.blur){aobject.blur()}if(setid=="compSetting1"){}else if(setid=="compSetting1"){}return false}else{return true}}function cascadedstyleAddrCall(el,cssproperty,csspropertyNS){if(el.currentStyle){return el.currentStyle[cssproperty]}else if(window.getComputedStyle){var elstyle=window.getComputedStyle(el,"");return elstyle.getPropertyValue(csspropertyNS)}}function highlighttabCompSetting(setid,aobject){if(typeof tabobjlinksCompSetting=="undefined"){collecttablinksCompSetting()}for(i=0;i<tabobjlinksCompSetting.length;i++){}$("#tablistCompSetting > div").each(function(i){var id=$(this).attr("tagId");if(id!=null&&id!=""){$(this).unbind("mouseover").unbind("mouseout");if(id.substr(4)==setid){$(this).attr("class","currenthash");$(this).children(".divin").css("color","#000")}else{$(this).attr("class","noSelecthash");$(this).bind("mouseover",function(){$(this).children(".divin").css("color","#f44500")});$(this).bind("mouseout",function(){$(this).children(".divin").css("color","#000")})}}})}function collecttablinksCompSetting(){var tabobj=document.getElementById("tablistCompSetting");if(tabobj!=null){tabobjlinksCompSetting=tabobj.getElementsByTagName("div")}}function detectSourceindexCompSetting(aobject){for(i=0;i<tabobjlinksCompSetting.length;i++){if(aobject==tabobjlinksCompSetting[i]){tabsourceindex=i;break}}}$(function(){do_onload()});if(window.addEventListener){window.addEventListener("load",do_onloadCompSetting,false)}else if(window.attachEvent){window.attachEvent("onload",do_onloadCompSetting)}else if(document.getElementById){window.onload=do_onloadCompSetting}function cascadedstyleCompSet(el,cssproperty,csspropertyNS){if(el.currentStyle){return el.currentStyle[cssproperty]}else if(window.getComputedStyle){var elstyle=window.getComputedStyle(el,"");return elstyle.getPropertyValue(csspropertyNS)}}function do_onloadCompSetting(){var cookienameCompSetting=typeof persisttype!="undefined"&&persisttype=="sitewide"?"tabcontenmail":"Ctab";var cookiecheckCompSetting=window.get_cookie&&get_cookie(cookienameCompSetting).indexOf("|")!=-1;collecttablinksCompSetting();if(typeof tabobjlinksCompSetting!="undefined"){initTabcolorCompSett=cascadedstyleCompSet(tabobjlinksCompSetting[1],"backgroundColor","background-color");initTabpostcolorSet=cascadedstyleCompSet(tabobjlinksCompSetting[0],"backgroundColor","background-color");if(typeof enablepersistence!="undefined"&&enablepersistence&&cookiecheckCompSetting){var cookieparseCompSetting=get_cookie(cookienameCompSetting).split("|");var whichtab=cookieparseCompSetting[0];var tabcontentidSetting=cookieparseCompSetting[1];expandCompanySetting(tabcontentidSetting,tabobjlinksCompSetting[whichtab])}else{expandCompanySetting(initialtabCompSetting[1],tabobjlinksCompSetting[initialtabCompSetting[0]-1])}}}function cascadedstyle(el,cssproperty,csspropertyNS){if(el.currentStyle){return el.currentStyle[cssproperty]}else if(window.getComputedStyle){var elstyle=window.getComputedStyle(el,"");return elstyle.getPropertyValue(csspropertyNS)}}function validVisitCodeSms(){var sms=document.visitcodeFrm.phone.value;sms=replacePhoneValue(sms);if(!ValidateSplChar(sms)){alert("Votre num\xE9ro de t\xE9l\xE9phone est invalide.");document.visitcodeFrm.phone.focus();return false}if(trim(sms).length<8||trim(sms).length>=20){alert("Votre num\xE9ro de t\xE9l\xE9phone est invalide.");document.visitcodeFrm.phone.focus();return false}if(sms!=""){document.visitcodeFrm.phone.value=sms;document.visitcodeFrm.submit()}else{document.visitcodeFrm.phone.focus();return false}}function validateContactForm(ele){var ele=document.contactForm.envoyer;ele.disabled=true;buttonName="Envoyer ma demande";hideMe(ele,buttonName);var form=document.contactForm;if(ValidatorTrim(form.lastname.value)==""){alert("Merci de renseigner votre nom de famille.");form.lastname.focus();showMe(ele,buttonName);return false}else{if(!isAlphaSpecial(ValidatorTrim(form.lastname.value))){alert("Nom de famille d'Invaid.");form.lastname.focus();showMe(ele,buttonName);return false}}if(ValidatorTrim(form.firstname.value)!=""){if(!isAlphaSpecial(ValidatorTrim(form.firstname.value))){alert("Pr\xE9nom d'Invaid.");form.firstname.focus();showMe(ele,buttonName);return false}}if(ValidatorTrim(form.city.value)==""){alert("Merci de renseigner votre ville.");form.city.focus();showMe(ele,buttonName);return false}else{if(!isAlpha(ValidatorTrim(form.city.value))){alert("Nom d'Invaid de la ville.");form.city.focus();showMe(ele,buttonName);return false}}var postalcode=form.zipcode;if(postalcode.value!=""){var alphanum=/^[0-9a-zA-Z \-]+$/;if(!postalcode.value.match(alphanum)){alert("Merci de renseigner votre code postal");form.zipcode.focus();showMe(ele,buttonName);return false}var postalCodeStr=form.zipcode.value;if(postalCodeStr.length>10){alert("Merci de renseigner votre code postal");form.zipcode.focus();showMe(ele,buttonName);return false}}else{alert("Merci de renseigner votre code postal");form.zipcode.focus();showMe(ele,buttonName);return false}if(checkEmail(form.email.value)!=""){alert("Merci d'entrer une adresse e-mail valide.");form.email.focus();showMe(ele,buttonName);return false}if(ValidatorTrim(form.phone.value)!=""){str=form.phone.value.replace(/ /g,"");str=replacePhoneValue(str);form.phone.value=str;if(trim(str).length<8||trim(str).length>=20){alert("Merci de renseigner un num\xE9ro de t\xE9l\xE9phone valide.");form.phone.focus();showMe(ele,buttonName);return false}else{if(!ValidateSplChar(str)){alert("Merci de renseigner un num\xE9ro de t\xE9l\xE9phone valide.");form.phone.focus();showMe(ele,buttonName);return false}}}if(spamEnabled=="no"){var phone;phone=trim(form.phone.value);phone=replacePhoneValue(phone);form.phone.value=phone;return true}else{if(ValidatorTrim(form.cptchval.value)==""){alert("Veuillez saisir les lettres et/ou chiffres qui apparaissent dans l'image.");form.cptchval.focus();showMe(ele,buttonName);return false}else{var ret=false;$.ajax({type:"POST",url:"captcha.php",data:"type=verify&captchaval="+$("#cptchval").val(),async:false,success:function(data){if(data==1){document.getElementById("invalidcaptcha").innerHTML="";var phone;phone=trim(form.phone.value);phone=replacePhoneValue(phone);form.phone.value=phone;ret=true}else{$("#invalidcaptcha").html(data);loadingimage();showMe(ele,buttonName);ret=false}}});return ret}}}var keysPressed=0;document.onkeyup=logKeys;function logKeys(){keysPressed++;if(document.getElementById("keycode")!=null){document.getElementById("keycode").value=keysPressed}}function replacePhoneValue(val){return val.replace(/[a-zA-Z \#\+\-\.\(\) <>%\$\*\&]+/g,"")}
