$(document).ready(function(){$("#send").click(function(){if(contact.checkForm())contact.sendMail();return false;});$("#contactForm").validate();});var contact={checkForm:function(){return $("#contactForm").valid();},sendMail:function(){var xhr=this.getXhr();xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){var resp=eval('('+xhr.responseText+')');var str="";if(resp.errors.length>0){for(var i=0;i<resp.errors.length;i++){str+=resp.errors[i]+"\n";}$("#status").effect("shake",{times:2},100);}else if(resp.ok){str=resp.ok;}$("#status").html(str);setTimeout(function(){$("#status").fadeOut(600);},resp.ok?2000:4000);xhr=null;}}};try{var data="nom="+$("#nomExp").val();data+="&prenom="+$("#prenomExp").val();data+="&societe="+$("#societeExp").val();data+="&from="+$("#fromExp").val();data+="&object="+$("#objectExp").val();data+="&message="+$("#messageExp").val();xhr.open("POST","mail.php",true);xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhr.send(data);$("#status").html("Transfert en cours...").show();}catch(e){alert(e);}},getXhr:function(){var xhr=null;if(window.ActiveXObject){if(window.XMLHttpRequest)xhr=new XMLHttpRequest();else{try{xhr=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){xhr=new ActiveXObject("Microsoft.XMLHTTP");}}}else if(window.XMLHttpRequest)xhr=new XMLHttpRequest();else{alert("Votre navigateur ne supporte pas les objets XMLHttpRequest...");}return xhr;}};