var emailConn = new XHConn();

if (!emailConn)
{
	document.getElementById('emailResult').innerHTML = '<p><h2 class="OperationError">Error</h2></p><p class="OperationError">Your browser does not support AJAX - please <a href="http://www.escort-resort.com/?page=contactus_old">click here</a> to go to the old contact page. Alternatively we recommend updating your browser to a newer version, or use an up to date browser such as <a href="http://www.firefox.com" target="_blank">Firefox</a></p>';
	document.getElementById('sendButton').disabled = true;
	document.getElementById('notes').disabled = true;
	document.getElementById('visitor').disabled = true;
	document.getElementById('visitormail').disabled = true;
}
else
{
	document.getElementById('sendButton').disabled = false;
	document.getElementById('notes').disabled = false;
	document.getElementById('visitor').disabled = false;
	document.getElementById('visitormail').disabled = false;
}

var fnSendResponse = function (oXML) {
	eval(oXML.responseText);
	if (result != false)
	{
	        document.getElementById('emailResult').innerHTML = result;
		document.getElementById('visitor').value = "";
		document.getElementById('visitormail').value = "";
		document.getElementById('notes').value = "";
	}
	else document.getElementById('emailResult').innerHTML = sendError;
	document.getElementById('sendButton').disabled = false;
};

function sendEmail()
{
	if (emailConn)
	{
		document.getElementById('sendButton').disabled = true;
		document.getElementById('emailResult').innerHTML = '<h2 class="OperationWorking">Sending Email...</h2>';
		var formOutput = "ip=" + document.getElementById('ip').value + "&httpref=" + document.getElementById('httpref').value + "&httpagent=" + document.getElementById('httpagent').value + "&attn=" + document.getElementById('attn').value + "&visitor=" + document.getElementById('visitor').value + "&visitormail=" + document.getElementById('visitormail').value + "&notes=" + document.getElementById('notes').value;
		emailConn.connect("sendemailajax.php", "POST", formOutput, fnSendResponse);
	}
}

