function switchMenu(obj) { var el = document.getElementById(obj); if ( el.style.display != 'none' ) { el.style.display = 'none'; } else { el.style.display = ''; } } function compter(chaine) { var exp=new RegExp("[a-zA-Z0-9éèêëàáâäóòôöíìîïçÉÈÊËÀÁÂÄÒÓÔÖÌÍÎÏÇ-]+","g"); var tabNom=chaine.match(exp); if(tabNom==null) return 0; return tabNom.length; } function verif_formulaire_reco() { if(document.myFormReco.firstname.value == ""){ window.alert('Please fill out all required fields'); document.myFormReco.firstname.focus(); return false; } if(document.myFormReco.lastname.value == ""){ window.alert('Please fill out all required fields'); document.myFormReco.lastname.focus(); return false; } if(document.myFormReco.email.value == ""){ window.alert('Please fill out all required fields'); document.myFormReco.email.focus(); return false; } adresse = document.myFormReco.email.value; var place = adresse.indexOf("@",1); var point = adresse.indexOf(".",place+1); if ((place > -1)&&(adresse.length >2)&&(point > 1)) { } else { window.alert("Please fill out all required fields"); document.myFormReco.email.focus(); return false; } if(document.myFormReco.email2.value == ""){ window.alert('Please fill out all required fields'); document.myFormReco.email2.focus(); return false; } adresse2 = document.myFormReco.email2.value; var place2 = adresse2.indexOf("@",1); var point2 = adresse2.indexOf(".",place+1); if ((place2 > -1)&&(adresse2.length >2)&&(point2 > 1)) { formObjReco.submit();switchMenu('reco'); document.getElementById('ajoutereco').removeAttribute("href"); document.getElementById('ajoutereco2').removeAttribute("href"); document.getElementById('reco').innerHtml=''; } else { window.alert("Please fill out all required fields"); document.myFormReco.email2.focus(); return false; } } function verif_formulaire_comm() { if(document.myFormCommentVideo.pseudo.value == ""){ window.alert('Please fill out all required fields'); document.myFormCommentVideo.pseudo.focus(); return false; } if(document.myFormCommentVideo.pseudo.value.length < 2 ){ window.alert('Please fill out all required fields'); document.myFormCommentVideo.pseudo.focus(); return false; } if(document.myFormCommentVideo.email.value == ""){ window.alert('Please fill out all required fields'); document.myFormCommentVideo.email.focus(); return false; } adresse = document.myFormCommentVideo.email.value; var place = adresse.indexOf("@",1); var point = adresse.indexOf(".",place+1); if ((place > -1)&&(adresse.length >2)&&(point > 1)) { } else { window.alert("Please fill out all required fields"); document.myFormCommentVideo.email.focus(); return false; } if(document.myFormCommentVideo.orthographe.checked == false) { window.alert('Please fill out all required fields'); document.myFormCommentVideo.orthographe.focus(); return false; } if(document.myFormCommentVideo.commentaire.value == ""){ window.alert('Please fill out all required fields'); document.myFormCommentVideo.commentaire.focus(); return false; } var nombreDeMots = compter(document.myFormCommentVideo.commentaire.value) ; if( nombreDeMots < 40) { window.alert(' Your comment must contain at least 40 words\nThe number of words you have typed so far: '+nombreDeMots); document.myFormCommentVideo.commentaire.focus(); return false; } if(document.myFormCommentVideo.commentaire.value.length < 200) { window.alert('Your comment must exceed 200 characters'); document.myFormCommentVideo.commentaire.focus(); return false; } else { formObjCommentVideo.submit();switchMenu('addcomments'); } }