var xmlhttp

function sendEnquireForm()
{
	//alert("senEnquireForm")
	document.getElementById('submit').src='images/sent1.gif'
	
	url = "includes/enquireProp.php"

	vars = "Name=" + document.getElementById('Name').value
	vars= vars+ "&Tel=" + document.getElementById('Telephone').value
	vars= vars+ "&Email=" + document.getElementById('Email').value
	vars= vars+ "&Comments=" + document.getElementById('Comments').value

	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest()
		xmlhttp.onreadystatechange=contstate_Change
		xmlhttp.open("POST",url,true)
		xmlhttp.setRequestHeader("Method", "POST "+ url +" HTTP/1.1");
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.send(vars)
		//alert("sent MOZ")
		}
	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
		if (xmlhttp)
	    {
	    	xmlhttp.onreadystatechange=contstate_Change
	    	xmlhttp.open("POST",url,true)
	    	xmlhttp.setRequestHeader("Method", "POST "+ url +" HTTP/1.1");
			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	    	xmlhttp.send(vars)
	    	//alert("sent IE")
	    }
	 }
}

function contstate_Change()
{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	{
		// if "OK"
		if (xmlhttp.status==200)
		{
			txt = xmlhttp.responseText
			
			if (txt.indexOf("SUCCESS") != -1)
			{
				alert("Thanks for your enquiry.\n\nWe will contact you as soon as possible.")
			}
			if (txt.indexOf("FAIL") != -1)
			{
				alert("ERROR PHP: Your enquiry was not received due to techncial problems.\n\nPlease try submitting the form again or email us directly.")
			}
			
		}
		else
		{
			alert("ERROR 404: Your enquiry was not received due to techncial problems.\n\nPlease try submitting the form again or email us directly.")
		}
	}
}