<!--

function ajaxEMail() {

	var url = 'ajaxMail.php';
	var formParams = $('EmailForm').serialize(true);	//object containing all form values

	new Ajax.Request(url, {
  		method: 'post',
  		parameters: formParams,
  		onSuccess: function(transport) {
			if (transport.responseText == 1)	{
				$('emailBox').update("Thank you - Email sent successfully (<a href='CourseContactUs.php' style='color:black; text-decoration:underline;'>send another email</a>)");
			}
			else if (transport.responseText == 2)	{
				$('EmailAddress').className = 'baddata';
				alert("Our server was unable to send an email to your address.  Please check that it is entered correctly");
			}	
			else	{
				document.EmailForm.submit();
			}
  		},
  		onFailure: function(transport) {
			$('emailBox').update("failure: " + transport.responseText);
			document.EmailForm.submit();			
  		}
	});

	return false;	//posts to new URL if false
}

//-->
