function checkField2(elem){if(elem.value==''){elem.style.borderColor="red";return false;}
else{elem.style.borderColor="green";return true;}}
function checkEmail2(elem){if(elem.value==''){elem.style.borderColor="red";return false;}else{var re=/^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;if(!re.test(elem.value)){elem.style.borderColor="red";return false;}else{elem.style.borderColor="green";return true;}}}
function checkEmail(elem){if(elem.value==''){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";return false;}else{var re=/^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;if(!re.test(elem.value)){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";return false;}else{elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";return true;}}}
function checkRouge(elem){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";}
function checkField(elem){if(elem.value==''){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";return false;}
else{elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";return true;}}
function checkEgals(emailconfirm,email){if(email.value!=emailconfirm.value||email.value==''||!checkEmail(email)){emailconfirm.style.borderColor="red";email.style.borderColor="red";document.getElementById("label_"+email.name).style.color="red";document.getElementById("label_"+emailconfirm.name).style.color="red";return false;}
else{emailconfirm.style.borderColor="green";email.style.borderColor="green";document.getElementById("label_"+email.name).style.color="black";document.getElementById("label_"+emailconfirm.name).style.color="black";return true;}}
function checkDate(elem){var re=/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/;if(!re.test(elem.value)){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";return false;}else{elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";return true;}}
function checkPhone(elem){var re=/^[0-9]{10}$/;if(!re.test(elem.value)){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";return false;}else{elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";return true;}}
function checkNumerique(elem){var re=/^[0-9]{5}$/;if(!re.test(elem.value)){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";return false;}else{elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";return true;}}
function checkHeuresSouhaitees2(elem){if(document.candidature_spontanee.contratP2[0].checked){elem.style.borderColor="";elem.value="";document.getElementById("label_"+elem.name).style.color="";return false;}
else{return checkNumerique(elem);}}
function checkHeuresSouhaitees(elem){var re=/^[0-9]{2}$/;if(document.candidature_spontanee.contratP2[1].checked&&re.test(elem.value)){elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";return true;}
else if(document.candidature_spontanee.contratP2[0].checked){elem.value="";return false;}
else{return checkNumerique(elem);}}
function checkAlpha(elem){var re=/^[A-Za-z]+$/;if(!re.test(email)){elem.style.borderColor="red";document.getElementById("label_"+elem.name).style.color="red";}else{elem.style.borderColor="green";document.getElementById("label_"+elem.name).style.color="black";}}
function sendMail(items,nomForm){var ValidForm=true;var tabItem=items.split(',');for(i=0;i<tabItem.length;i++){if(tabItem[i]=='rechercheP'){checkField(document.candidature_spontanee["rechercheP"]);if(document.candidature_spontanee[tabItem[i]].selectedIndex==0){ValidForm=false;}}
else{if(!checkField(document.candidature_spontanee[tabItem[i]])){ValidForm=false;}}}
if(!checkDate(document.candidature_spontanee["dateP"]))
ValidForm=false;if((!checkHeuresSouhaitees(document.candidature_spontanee["heureP"])&&!document.candidature_spontanee.contratP2[0].checked)||!checkEmail(document.candidature_spontanee["emailP"])||!checkEgals(document.candidature_spontanee["emailConfP"],document.candidature_spontanee["emailP"])||!checkNumerique(document.candidature_spontanee["cpP"])||!checkPhone(document.candidature_spontanee["telP"])){ValidForm=false;}
if(!document.candidature_spontanee.dispoP[1].checked&&!document.candidature_spontanee.dispoP[0].checked){document.getElementById("label_dispoP").style.color="red";ValidForm=false;}
else{if(document.candidature_spontanee.dispoP[1].checked&&!(document.candidature_spontanee["lundim"].checked||document.candidature_spontanee["mardim"].checked||document.candidature_spontanee["mercredim"].checked||document.candidature_spontanee["jeudim"].checked||document.candidature_spontanee["vendredim"].checked||document.candidature_spontanee["samedim"].checked||document.candidature_spontanee["lundiapm"].checked||document.candidature_spontanee["mardiapm"].checked||document.candidature_spontanee["mercrediapm"].checked||document.candidature_spontanee["jeudiapm"].checked||document.candidature_spontanee["vendrediapm"].checked||document.candidature_spontanee["samediapm"].checked)){document.getElementById("label_dispoP").style.color="red";ValidForm=false;}
else{document.getElementById("label_dispoP").style.color="#000000";}}
nom_fichier=document.candidature_spontanee.cvP.value;nbchar=nom_fichier.length;extension=nom_fichier.substring(nbchar-4,nbchar);extension=extension.toLowerCase();if(extension=='.doc'||extension=='docx'){document.candidature_spontanee.cvP.style.borderColor="green";}
else{document.candidature_spontanee.cvP.style.borderColor="red";ValidForm=false;}
nom_fichier2=document.candidature_spontanee.motivP.value;nbchar=nom_fichier2.length;extension2=nom_fichier2.substring(nbchar-4,nbchar);extension2=extension2.toLowerCase();if(extension2=='.doc'||extension2=='docx'){document.candidature_spontanee.motivP.style.borderColor="green";}
else{document.candidature_spontanee.motivP.style.borderColor="red";ValidForm=false;}
var getCaptcha=1;var start=location.search.indexOf("?captcha=");if(start<0)getCaptcha=0;if(getCaptcha==1){if(goCapcha('index.php?type=35')==0)
ValidForm=false;}
if(ValidForm){document.candidature_spontanee.submit();}}
function sendMailBoutique(items,nomForm){var ValidForm=true;var tabItem=items.split(',');var getCaptcha=1;var start=location.search.indexOf("?captcha=");if(start<0)getCaptcha=0;for(i=0;i<tabItem.length;i++){if(tabItem[i]!='captchaP'||tabItem[i]=='captchaP'&&getCaptcha==1){if(!checkField(document.candidature_spontanee[tabItem[i]])){ValidForm=false;}}}
if(!checkEmail(document.candidature_spontanee["emailP"])||!checkEmail(document.candidature_spontanee["emailConfP"])||!checkEgals(document.candidature_spontanee["emailConfP"],document.candidature_spontanee["emailP"])){ValidForm=false;}
if(getCaptcha==1){if(goCapcha('index.php?type=35')==0)
ValidForm=false;}
if(ValidForm){document.candidature_spontanee.submit();}}
function sendMailReponseOffre(items,nomForm){var ValidForm=true;var tabItem=items.split(',');var getCaptcha=1;var start=location.search.indexOf("?captcha=");if(start<0)getCaptcha=0;for(i=0;i<tabItem.length;i++){if(!checkField(document.reponse_offre[tabItem[i]])){ValidForm=false;}}
if(!checkEmail(document.reponse_offre["emailP"])||!checkEmail(document.reponse_offre["emailConfP"])||!checkEgals(document.reponse_offre["emailConfP"],document.reponse_offre["emailP"])||!checkNumerique(document.reponse_offre["cpP"])||!checkPhone(document.reponse_offre["telP"])){ValidForm=false;}
if(getCaptcha==1){if(goCapcha('index.php?type=35')==0)
ValidForm=false;}
if(ValidForm){document.reponse_offre.submit();}}
function sendMailContactPresse(items,nomForm){var ValidForm=true;var tabItem=items.split(',');var getCaptcha=1;var start=location.search.indexOf("?captcha=");if(start<0)getCaptcha=0;for(i=0;i<tabItem.length;i++){if(!checkField(document.contact_presse[tabItem[i]])){ValidForm=false;}}
if(!checkEmail(document.contact_presse["emailP"])||!checkEgals(document.contact_presse["emailConfP"],document.contact_presse["emailP"])){ValidForm=false;}
if(getCaptcha==1){if(goCapcha('index.php?type=35')==0)
ValidForm=false;}
if(ValidForm){document.contact_presse.submit();}}
function testOption(items,form)
{var tabItem=items.split(',');options=document[form].themeP.options;for(i=0;i<tabItem.length;i++){options[tabItem[i]].style.display="block";}}
function cacherOption(items,form)
{var tabItem=items.split(',');options=document[form].themeP.options;for(i=0;i<tabItem.length;i++){options[tabItem[i]].style.display="none";}}
function BackLayer(id,largeur){dom=document.getElementById&&!document.all;py=100;px=Math.floor(largeur/2);document.getElementById(id).style.top=py+'px';document.getElementById(id).style.marginLeft='-'+px+'px';document.getElementById(id).style.display="block";window.scrollTo(0,0);}
function BackLayer(id,largeur,offres,metier){dom=document.getElementById&&!document.all;document.getElementById('link').value="informations/bhv-recrute/nos-offres-demploi.html?metier"+metier+"&"+offres;py=100;px=Math.floor(largeur/2);document.getElementById(id).style.top=py+'px';document.getElementById(id).style.marginLeft='-'+px+'px';document.getElementById(id).style.display="block";window.scrollTo(0,0);}
function MontreLayer(id,largeur){dom=document.getElementById&&!document.all;py=100;px=Math.floor(largeur/2);document.getElementById(id).style.top=py+'px';document.getElementById(id).style.display="block";window.scrollTo(0,0);}
function MontreLayer_presse(id,largeur){dom=document.getElementById&&!document.all;py=100;px=250;document.getElementById(id).style.top=py+'px';document.getElementById(id).style.marginLeft='-'+px+'px';document.getElementById(id).style.display="block";window.scrollTo(0,0);}
function MontreLayer2(id,largeur){dom=document.getElementById&&!document.all;py=100;px=Math.floor(largeur/2);document.getElementById(id).style.top=py+'px';document.getElementById(id).style.marginLeft='-'+px+'px';document.getElementById(id).style.display="block";window.scrollTo(0,0);}
function cacheCenterPopUp_tipafriend(id){document.getElementById(id).style.display="none";}
var receiveReq=getXmlHttpRequestObject();function getXmlHttpRequestObject(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}else{alert("Your browser doesn't support the XmlHttpRequest object.");}}
function makeRequest(url,param){if(receiveReq.readyState==4||receiveReq.readyState==0){receiveReq.open("POST",url,true);receiveReq.onreadystatechange=updatePage;receiveReq.setRequestHeader("Content-type","application/x-www-form-urlencoded");receiveReq.setRequestHeader("Content-length",param.length);receiveReq.setRequestHeader("Connection","close");receiveReq.send(param);}}
function updatePage(){if(receiveReq.readyState==4){}}
function getParam(theForm,varLink){var url=varLink;var postStr=theForm.captchaP.name+"="+encodeURIComponent(theForm.captchaP.value);makeRequest(url,postStr);}
function getXhr(){var xhr=null;if(window.XMLHttpRequest)
xhr=new XMLHttpRequest();else if(window.ActiveXObject){try{xhr=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){xhr=new ActiveXObject("Microsoft.XMLHTTP");}}
else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");xhr=false;}
return xhr;}
var LINK="";var ETAT=0;function goCapcha(link){LINK=link;var elem=document.getElementById('captchaP');var xhr=getXhr();xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){var leselect=xhr.responseText;var resultat=leselect.split('<');var res2=resultat[0].split('&');var borde=res2[1];var lab=res2[0];if(borde.indexOf('green')!=-1)
ETAT=1;else
ETAT=0;elem.style.borderColor=borde;if(lab.indexOf('black')!=-1)
document.getElementById("label_captchaP").style.color="black";else
document.getElementById("label_captchaP").style.color="red";}}
xhr.open("POST",link,false);sel=document.getElementById('captchaP');capchaNum=sel.value;xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xhr.send("capchaNum="+capchaNum);var leselect=xhr.responseText;var resultat=leselect.split('<');var res2=resultat[0].split('&');var borde=res2[1];var lab=res2[0];if(borde.indexOf('green')!=-1)
ETAT=1;else
ETAT=0;elem.style.borderColor=borde;if(lab.indexOf('black')!=-1)
document.getElementById("label_captchaP").style.color="black";else
document.getElementById("label_captchaP").style.color="red";return ETAT;}
function societe(isSociete){if(isSociete){document.getElementById('label_nomP').innerHTML='Soci&eacute;t&eacute;* :';document.getElementById('label_prenomP').innerHTML='Nom du contact* :';}
else{document.getElementById('label_nomP').innerHTML='Nom* :';document.getElementById('label_prenomP').innerHTML='Pr&eacute;nom* :';}}
function miseEnPageMSG(msgArea){document.getElementById('text').value=msgArea.replace(/\n/g,"<br/>");}
function verifParrainage(){var re=/^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;var aucun_mail=true;var erreur=false;var emails='';document.getElementById('erreur_nom').innerHTML='';var message_parrain=document.getElementById('message_parrain').value;var nom_parrain=document.getElementById('nom_prenom_parrain').value;var uid_parrain=document.getElementById('uid_parrain').value;var url_jeu=document.getElementById('url_jeu').value;if(nom_parrain==''){document.getElementById('erreur_nom').innerHTML='Vous devez saisir un nom et pr&eacute;nom';erreur=true;}
for(var i=1;i<5;i++){document.getElementById('erreur_mail_'+i).innerHTML='';if(document.getElementById('email'+i).value!=''){aucun_mail=false;if(!re.test(document.getElementById('email'+i).value)){document.getElementById('erreur_mail_'+i).innerHTML='Adresse email incorrecte';erreur=true;}
else{emails+=document.getElementById('email'+i).value+', ';}}}
if(aucun_mail){document.getElementById('erreur_mail_1').innerHTML='Saisissez au moins une adresse email ';erreur=true;}
if(!erreur){var stringData='uid_parrain='+uid_parrain+'&nom_parrain='+nom_parrain+'&message_parrain='+message_parrain+'&emails='+emails+'&url_jeu='+url_jeu;var stringUrl='typo3conf/ext/powermail/tipafriend.php';jQuery.ajax({type:"POST",url:stringUrl,data:stringData,success:function(msg){document.getElementById('confirm').innerHTML='<div id="confirmation_parrainage">'+msg+'</div>';},error:""});}}
