var sendToAFriendInnerHTML = ""; var sendEcardInnerHTML = ""; function GetObj (name) { return document.getElementById(name); } function checkEmail(email) { // verif validité email par REGEXP var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/ return (reg.exec(email)!=null) } function checkTel(tel) { // verif validité tel par REGEXP var reg = /^[0-9]{10}$/ return (reg.exec(tel)!=null) } function checkInt(str) { // verif validité entier par REGEXP var reg = /^[0-9]+$/ return (reg.exec(str)!=null) } function varFormSender () { this.data = []; this.ch = ""; } varFormSender.prototype.add = function (name,value) { this.ch += name + "=" + value + "&"; this.data[this.data.length] = name; } /* Validation formulaire envoi à un ami */ var sendToAFriend = {}; function sendToAFriendValidate () { sendToAFriend = new varFormSender(); with (document.sendToAFriendForm) { sendToAFriend.add("nom",nom.value); sendToAFriend.add("prenom",prenom.value); sendToAFriend.add("email",email.value); sendToAFriend.add("emailami1",emailami1.value); sendToAFriend.add("emailami2",emailami2.value); sendToAFriend.add("emailami3",emailami3.value); sendToAFriend.add("emailami4",emailami4.value); sendToAFriend.add("emailami5",emailami5.value); sendToAFriend.add("comment",comment.value); if (optin.checked) sendToAFriend.add("optin",optin.value); else sendToAFriend.add("optin",""); sendToAFriend.add("title",title.value); sendToAFriend.add("url",url.value); } sendData("Envoi à un ami","/campaigns/fr_rugby/content/includes/asp/sendToAFriend.asp?"+sendToAFriend.ch.substring(0,sendToAFriend.ch.length-1),"POST"); return false; } function sendToAFriendResult (error) { var tmp = error.split("&"); for (var i=0;i1) { for (var i=0;i 31)) { alert("Le jour de votre date de naissance est invalide."); document.inscription.dateofbirth_dd.focus(); return false; } else if ((!checkInt(dateofbirth_mm) || dateofbirth_mm <= 0 || dateofbirth_mm > 12)) { alert("Le mois de votre date de naissance est invalide."); document.inscription.dateofbirth_mm.focus(); return false; } else if ((!checkInt(dateofbirth_yyyy) || dateofbirth_yyyy <= 1900)) { alert("L'annĂ©e de votre date de naissance est invalide."); document.inscription.dateofbirth_yyyy.focus(); return false; } else if (!checkEmail(email)) { alert("Votre adresse e-mail est invalide."); document.inscription.email.focus(); return false; } else if (postcode_1 != "" && (!checkInt(postcode_1) || postcode_1 <= 0)) { alert("Votre code postal est invalide. VĂ©rifiez que celui-ci est bien composĂ© de 5 chiffres."); document.inscription.postcode_1.focus(); return false; } else if (telephonenumber_1_1 != "" && (!checkTel(telephonenumber_1_1) || telephonenumber_1_1 <= 0)) { alert("Votre numĂ©ro de tĂ©lĂ©phone est invalide. VĂ©rifiez que celui-ci est bien composĂ© de 10 chiffres."); document.inscription.telephonenumber_1_1.focus(); return false; } else { /* On récupère les infos de l'utilisateur avec la méthode loginemail2 */ sendValues = "call=loginemail2&postProcessor="+postProcessor+"&siteID="+siteID+"&username="+email+"&Email="+email+"&Password="+password+"&page=data"; sendData(sendValues,"/scripts/cud/cud2.asp","POST"); dateofbirth_dd = document.inscription.dateofbirth_dd.value; dateofbirth_mm = document.inscription.dateofbirth_mm.value; dateofbirth_yyyy = document.inscription.dateofbirth_yyyy.value; if (document.inscription.acceptmail[0].checked) optin = document.inscription.acceptmail[0].value; else if (document.inscription.acceptmail[1].checked) optin = document.inscription.acceptmail[1].value; else optin = ""; firstname = document.inscription.firstname.value; lastname = document.inscription.lastname.value; if (document.inscription.sex[0].checked) sexe = document.inscription.sex[0].value; else if (document.inscription.sex[1].checked) sexe = document.inscription.sex[1].value; else sexe = ""; address1_1 = document.inscription.address1_1.value; town_1 = document.inscription.town_1.value; postcode_1 = document.inscription.postcode_1.value; telephonenumber_1_1 = document.inscription.telephonenumber_1_1.value; /* On met à jour les infos */ sendValues = "call="+callParam+"&postProcessor="+postProcessor+"&siteID="+siteID; sendValues += "&DateOfBirth_dd="+dateofbirth_dd+"&DateOfBirth_mm="+dateofbirth_mm+"&DateOfBirth_yyyy="+dateofbirth_yyyy; sendValues += "&mailformat="+mailformat+"&acceptmail="+optin+"&language="+langue+"&username="+email+"&email="+email; sendValues += "&password="+password+"&country="+country; sendValues += "&IsPrimaryNumber_1=1&IsPrimaryAddress_1=1&IsPrimaryTelephone_1_1=1&AddressTypeID_1=1"; sendValues += "&hdnAddressID_1="+hdnAddressID_1+"&hdnTelePhoneID_1_1="+hdnTelePhoneID_1_1; sendValues += "&hdnUserTeleCount=1&hdnUserAddressCount=1&hdnMobileContactCount=1"; if (firstname != "") sendValues += "&firstname="+firstname; if (lastname != "") sendValues += "&lastname="+lastname; if (sexe != "") sendValues += "&sex="+sexe; if (address1_1 != "") sendValues += "&address1_1="+address1_1; if (town_1 != "") sendValues += "&town_1="+town_1; if (postcode_1 != "") sendValues += "&postcode_1="+postcode_1; if (telephonenumber_1_1 != "") sendValues += "&telephonenumber_1_1="+telephonenumber_1_1; sendData(sendValues,"/scripts/cud/cud2.asp","POST"); } } else { alert("Veuillez remplir tous les champs obligatoires."); } } else { if(sexe != "" && lastname != "" && firstname != "" && dateofbirth_dd != "" && dateofbirth_mm != "" && dateofbirth_yyyy != "" && email != "" && password != "" && address1_1 != "" && town_1 != "" && postcode_1 != "" && optin != "") { if (!checkInt(dateofbirth_dd) || dateofbirth_dd <= 0 || dateofbirth_dd > 31) { alert("Le jour de votre date de naissance est invalide."); document.inscription.dateofbirth_dd.focus(); return false; } else if (!checkInt(dateofbirth_mm) || dateofbirth_mm <= 0 || dateofbirth_mm > 12) { alert("Le mois de votre date de naissance est invalide."); document.inscription.dateofbirth_mm.focus(); return false; } else if (!checkInt(dateofbirth_yyyy) || dateofbirth_yyyy <= 1900) { alert("L'annĂ©e de votre date de naissance est invalide."); document.inscription.dateofbirth_yyyy.focus(); return false; } else if (!checkEmail(email)) { alert("Votre adresse e-mail est invalide."); document.inscription.email.focus(); return false; } else if (!checkInt(postcode_1) || postcode_1 <= 0) { alert("Votre code postal est invalide. VĂ©rifiez que celui-ci est bien composĂ© de 5 chiffres."); document.inscription.postcode_1.focus(); return false; } else if (telephonenumber_1_1 != "" && (!checkTel(telephonenumber_1_1) || telephonenumber_1_1 <= 0)) { alert("Votre numĂ©ro de tĂ©lĂ©phone est invalide. VĂ©rifiez que celui-ci est bien composĂ© de 10 chiffres."); document.inscription.telephonenumber_1_1.focus(); return false; } else { sendValues = "call="+callParam+"&postProcessor="+postProcessor+"&siteID="+siteID; sendValues += "&DateOfBirth_dd="+dateofbirth_dd+"&DateOfBirth_mm="+dateofbirth_mm+"&DateOfBirth_yyyy="+dateofbirth_yyyy; sendValues += "&mailformat="+mailformat+"&acceptmail="+optin+"&language="+langue+"&email="+email; sendValues += "&password="+password+"&country="+country+"&firstname="+firstname+"&lastname="+lastname; sendValues += "&sex="+sexe+"&address1_1="+address1_1+"&town_1="+town_1+"&postcode_1="+postcode_1; sendValues += "&IsPrimaryNumber_1=1&IsPrimaryAddress_1=1&IsPrimaryTelephone_1_1=1&AddressTypeID_1=1"; sendValues += "&hdnUserTeleCount=1&hdnUserAddressCount=1&hdnMobileContactCount=1"; if (telephonenumber_1_1 != "") sendValues += "&telephonenumber_1_1="+telephonenumber_1_1; if (score != "") sendValues += "&score="+score; if (quest1 != "") sendValues += "&quest1="+quest1; if (quest2 != "") sendValues += "&quest2="+quest2; if (quest3 != "") sendValues += "&quest3="+quest3; sendData(sendValues,"/scripts/cud/cud2.asp","POST"); } } else { alert("Veuillez remplir tous les champs obligatoires."); } } return false; } function changeCall() { if(document.inscription.compte.checked) { document.inscription.call.value = "update2"; GetObj("intituleSexe").innerHTML = "Sexe :"; GetObj("intituleNom").innerHTML = "Nom :"; GetObj("intituleAdresse").innerHTML = "Adresse :"; GetObj("intitulePrenom").innerHTML = "Prénom :"; GetObj("intituleVille").innerHTML = "Ville :"; GetObj("intituleCp").innerHTML = "Code postal :"; } else { document.inscription.call.value = "register2"; GetObj("intituleSexe").innerHTML = "Sexe* :"; GetObj("intituleNom").innerHTML = "Nom* :"; GetObj("intituleAdresse").innerHTML = "Adresse* :"; GetObj("intitulePrenom").innerHTML = "Prénom* :"; GetObj("intituleVille").innerHTML = "Ville* :"; GetObj("intituleDate").innerHTML = "Date de naissance* :"; GetObj("intituleCp").innerHTML = "Code postal* :"; } } /* FORGOTTEN PASSWORD */ function forgottenPass() { callParam = document.password.call.value; postProcessor = document.password.postprocessor.value; email = document.password.email.value; if (email != "") { if (checkEmail(email)) { sendValues = "call="+callParam+"&postProcessor="+postProcessor+"&Email="+email; sendData(sendValues,"/scripts/cud/cud2.asp","POST"); } else { alert("Votre identifiant est invalide."); } } else { alert("Veuillez renseigner votre identifiant."); } return false; } /* COOKIES */ function setDataInCookie(cudID, email, firstname, lastname) { nom = "adidasCookieData-UserId"; document.cookie = nom + "=" + (cudID) + "; path=/"; nom = "adidasCookieData-UserEmail"; document.cookie = nom + "=" + (email) + "; path=/"; nom = "adidasCookieData-UserFirstname"; document.cookie = nom + "=" + (firstname) + "; path=/"; nom = "adidasCookieData-UserLastname"; document.cookie = nom + "=" + (lastname) + "; path=/"; } function emptyCookie(name) { document.cookie = name + "=" + "" + "; path=/"; } /* INSCRIPTION */ function inscParticipation(valid, quest1, quest2, quest3) { sendValues = "valid="+valid+"&quest1="+quest1+"&quest2="+quest2+"&quest3="+quest3; sendData(sendValues,"/campaigns/fr_rugby/content/includes/asp/inscParticipation.asp","POST"); } /* SCORE */ function inscScore(score) { sendValues = "score="+score; sendData(sendValues,"/campaigns/fr_rugby/content/includes/asp/inscScore.asp","POST"); } /* LIVE */ function liveMatch(ref, direct) { sendValues = "ref="+ref; sendData(sendValues,"/campaigns/fr_rugby/content/includes/asp/liveMatch.asp","POST"); if (direct == "Y") setTimeout("liveMatch ('"+ref+"', '"+direct+"');",60000); } /* INSTORE GAME */ function openBon() { window.open("/campaigns/fr_rugby/content/skins/fr/pdf/bon.pdf", "pdf", "width=649, height=822"); } /* GOODIES */ function displayEcard(num) { document.getElementById("visuelEcard").innerHTML = 'E-card séléctionnée'; document.sendEcardForm.ecard.value = num; id = "Ecard"; NameDiv(id); doc.style.visibility = "visible"; } var sendEcard = {}; function sendEcardValidate () { sendEcard = new varFormSender(); with (document.sendEcardForm) { sendEcard.add("nom",nom.value); sendEcard.add("prenom",prenom.value); sendEcard.add("email",email.value); sendEcard.add("emailami1",emailami1.value); sendEcard.add("emailami2",emailami2.value); sendEcard.add("emailami3",emailami3.value); sendEcard.add("emailami4",emailami4.value); sendEcard.add("emailami5",emailami5.value); sendEcard.add("comment",comment.value); if (optin.checked) sendEcard.add("optin",optin.value); else sendEcard.add("optin",""); sendEcard.add("ecard",ecard.value); } sendData("Envoi à un ami","/campaigns/fr_rugby/content/includes/asp/sendEcard.asp?"+sendEcard.ch.substring(0,sendEcard.ch.length-1),"POST"); return false; } function sendEcardResult (error) { var tmp = error.split("&"); for (var i=0;i1) { for (var i=0;i