var num_field = 1; var nb_field = 0; function verif_mail(email) { var placeHolder = document.getElementById('alertMessagePlaceHolderPassword'); placeHolder.style.display = 'block'; var reg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,3}$/ if (reg.exec(email)!=null) { $.ajax({ type: "POST", url: "/_include/ajax/verif_email.php", data: "email="+email, success: function(retour){ if(parseInt(retour)!=1) { $("#alertMessagePlaceHolderPassword").html(retour); var form = document.getElementById('form_password'); form.style.display = 'none'; } else $("#alertMessagePlaceHolderPassword").html('Email inconnu.'); }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); } else if(email=='') $("#alertMessagePlaceHolderPassword").html("Le champ email est vide"); else $("#alertMessagePlaceHolderPassword").html("Le format de l'email est incorrect"); } function checkEmail(idDiv) { var email = document.getElementById(idDiv); var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!filter.test(email.value)) return false; else return true; } function sendInvite() { var send = true; if((!checkEmail("myemail")) && (send != false)) { alert("Votre email est incorrect"); send = false; } //if((!checkEmail("emailfriend")) && (send != false)) { alert("l\'email de votre ami est incorrect"); send = false; } if(send == true) document.forms.send_to_friend_form.submit(); } function send_to_friend() { var myemail = document.send_to_friend_form.myemail.value; var emailfriend = document.send_to_friend_form.emailfriend.value; var texte = document.send_to_friend_form.message.value; var page = document.send_to_friend_form.page.value; var receiveCopy = document.send_to_friend_form.receiveCopy.value; var data = "myemail=" + myemail + "&emailfriend=" + emailfriend + "&message=" + texte + "&page=" + page + "&receiveCopy=" + receiveCopy; var url = "/ws.php"; $.ajax({ type: "POST", url: url, data: data, success: function(retour){ if (retour != '') { jQuery.facebox(retour); $("#facebox").fadeTo(2000, 1).fadeOut(2000); } }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); } function view_error_send_friend() { wFORMS.showAlertOnError = true; wFORMS.behaviors['validation'].showAlert = function (nbTotalErrors) { var placeHolder = document.getElementById('alertMessagePlaceHolderSendFriend'); placeHolder.innerHTML = wFORMS.arrErrorMsg[8].replace('%%',nbTotalErrors); placeHolder.style.display = 'block'; } } function open_layer(id){ document.getElementById(id).style.display="block"; calque=this.document.createElement('div');calque.id="cache"; this.document.body.appendChild(calque) } function close_layer(id){ document.getElementById(id).style.display="none"; } function addthis(url,titre,parametres){ var expression = /[^*]width=([0-9]*)[^*]/; expression.exec(parametres); var popup_width=RegExp.$1; expression=/[^*]height=([0-9]*)[^*]/; expression.exec(parametres); var popup_height=RegExp.$1; var left=(screen.width-popup_width)/2; var top=(screen.height-popup_height)/2; var params=parametres+',top='+top + ',left='+left; var win=window.open(url,titre,params); } function bookmarksite(title, url){ if (document.all) window.external.AddFavorite(url, title); else if (window.sidebar) window.sidebar.addPanel(title, url, "") } function openFacebox(message) { document.getElementById("infosViaFaceBox").innerHTML=message; if (navigator.appName=="Microsoft Internet Explorer") document.getElementById("linkFacebox").click(); else { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var cb = document.getElementById("linkFacebox"); cb.dispatchEvent(evt); } } function sendFormXml(assureur,xml) { var var_to_send = "action=sendXML&assureur="+assureur+"&xml="+xml; var url_to_send = '/ws.php'; if(window.XMLHttpRequest) p = new XMLHttpRequest(); else if(window.ActiveXObject) p = new ActiveXObject("Microsoft.XMLHTTP"); else return(false); p.open("POST", url_to_send, false); p.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); p.send(var_to_send); if ( p.status == "200") openFacebox('Votre demande de devis a bien été transmise à notre partenaire.

' + assureur + ' prendra contact avec vous très prochainement.
En vous remerciant de votre confiance

L’Equipe Mr Assurance'); else openFacebox('Une erreur s\'est produite lors de l\'envoi de vos invofmations

Veuillez réessayer.'); } function submitformcontact() { var nom = document.formuContact.nom.value; var mail = document.formuContact.mail.value; var message = document.formuContact.message.value; var verif = 0; if(nom == ""){ document.getElementById("nom").style.border = "1px solid red"; verif++; } else document.getElementById("nom").style.border = "1px solid grey"; if(mail == ""){ document.getElementById("mail").style.border = "1px solid red"; verif++; } else document.getElementById("mail").style.border = "1px solid grey"; if(message == ""){ document.getElementById("message").style.border = "1px solid red"; verif++; } else document.getElementById("message").style.border = "1px solid grey"; if(verif > 0){ document.getElementById("retourFormulaire").innerHTML = "
Veuillez renseigner tous les champs.


"; return false; } $.ajax({ type: "GET", url: "http://192.168.0.4/mr-assurance/ws.php", data: "nom="+nom+"&mail="+mail+"&message="+message+"&action=actionFormuContact", success: function(retour){ document.getElementById("retourFormulaire").innerHTML = "
Merci. Votre message a bien été transmis.


"; } } ); return false; }