
				


				var time_variable;
 
				function getXMLObject()  //XML OBJECT
				{
  				 var xmlHttp = false;
  				 try {
    			 xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
  				 }
  				 catch (e) {
     			try {
      			 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
    			 }
    			 catch (e2) {
  	    		 xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
   				  }
  				 }
  				 if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
   		  		xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
 		  		}
  		 		return xmlHttp;  // Mandatory Statement returning the ajax object created
				}
 
				var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object
	


function ajaxFunction_mail() {
	
	
  				var getdate = new Date();  //Used to prevent caching during ajax call
  				
				if(xmlhttp) { 
				
				var name = document.getElementById("name");
				var email = document.getElementById("email");

				
    		    xmlhttp.open("POST","contact_send.php",true); //calling testing.php using POST method				
    			xmlhttp.onreadystatechange  = handleServerResponse;	
    			xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    			xmlhttp.send("name=" + name.value+"&email=" + email.value); //Posting txtname to PHP File
				
				
				
  				}
				}
	
				function handleServerResponse() {
					
				
					
   				if (xmlhttp.readyState == 4) {
     			if(xmlhttp.status == 200) {
       		
	   			document.getElementById('message').style.display="block";
				
				document.getElementById("message").innerHTML=xmlhttp.responseText; //Update the HTML Form element 
				document.getElementById("name").value='Votre nom';
				document.getElementById("email").value='Votre courriel';
				
				
				
				setTimeout("$('#message').fadeOut()", 5000);
				setTimeout("$('#message').innerHTML=''", 1000); 
				setTimeout("$('#message').fadeIn()", 1000); 
				
     		}
     	else 
		{
        alert("Error during AJAX call. Please try again");
     }
   }
}





function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {ajaxFunction_mail();}
  }
}





function notEmpty(){
	
	
	var name = document.getElementById("name");
	var email = document.getElementById("email");

	
	if(name.value.length == 0 || email.value.length == 0  ){
		alert('Veuillez fournir vos nom et adresse de courriel.');
		elem.focus();
		return false;
	}
	
	
  
  if (validate_email(email,"Adresse courriel invalide.")==false)
    {email.focus();return false;}



}



