var xmlHttp

function sendMail()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
Name = document.getElementById("name").value;
Surname = document.getElementById("surname").value;
Company = document.getElementById("company").value;
Phone = document.getElementById("phone").value;
Email = document.getElementById("email").value;
Supplier = document.getElementById("supplier").value;
Other = document.getElementById("other").value;

if(Name && Email && Surname)
{
var url="mailer.php"
url=url+"?Name="+Name
url=url+"&Surname="+Surname
url=url+"&Company="+Company
url=url+"&Phone="+Phone
url=url+"&Email="+Email
url=url+"&Supplier="+Supplier
url=url+"&Other="+Other
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}else{alert("Please fill out all required fields.");}

}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('contactForm').innerHTML=xmlHttp.responseText 
 } 
}

/////////////////////////////////////////////////////
function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
