function validateMailingList() {
	if(document.mailingList.email.value=="") {
		alert("Please enter an Email Address.");
		document.mailingList.email.focus();
		return false;
	}
	if(document.mailingList.email.value.indexOf("@")==-1||document.mailingList.email.value.indexOf(".")==-1||document.mailingList.email.value.indexOf(" ")!=-1||document.mailingList.email.value.length<6) {
		alert("Please enter a valid Email Address.");
		document.mailingList.email.focus();
		return false;
	}
	if(document.mailingList.forename.value=="") {
		alert("Please enter your Forename.");
		document.mailingList.forename.focus();
		return false;
	}
}
function validateEmailForm() {
	if(document.emailList.email.value == "") {
		alert("Please enter an Email Address.");
		document.emailList.email.focus();
		return false;
	}
	if(document.emailList.email.value.indexOf("@") == -1 || document.emailList.email.value.indexOf(".") == -1 || document.emailList.email.value.indexOf(" ") != -1 || document.emailList.email.value.length < 6) {
		alert("Please enter a valid Email Address.");
		document.emailList.email.focus();
		return false;
	}
	if(document.emailList.subject.value=="") {
		alert("Please enter a subject.");
		document.emailList.subject.focus();
		return false;
	}
}
function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest(); //Not IE
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP"); //IE
	} else {
		alert("Your browser doesn't support XmlHttpRequest.  Please upgrade your browser.");
	}
}
//Declare AJAX objects for various jobs			
var receiveReq = getXmlHttpRequestObject();
var contactForm = getXmlHttpRequestObject();
var submitNewsletter = getXmlHttpRequestObject();

//-------------------SUBMIT INITIAL SIGNUP BEGIN------------------------
function submitForm() {
	if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
		var params = "name="+document.mailingList.forename.value+"&email="+document.mailingList.email.value;
		receiveReq.open("POST", 'onsignup.php', true);		
		receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		receiveReq.setRequestHeader("Content-length", params.length);
		receiveReq.setRequestHeader("Connection", "close");		
		receiveReq.onreadystatechange = handleSubmitForm; 
		receiveReq.send(params);
	}			
}
function handleSubmitForm() {
	if (receiveReq.readyState == 4) {
		//Set the contents of our span element to the result of the asyncronous call.
		document.getElementById('change').innerHTML = receiveReq.responseText;
	}
}
//-------------------SUBMIT INITIAL SIGNUP END------------------------
