function checkForm(){
	var hasError = 0;
	var hasError2 = 0;
	var hasError3 = 0;
	var missingFields = "";

	highlightColor = "#6F6119";
	defaultColor = "#144A81";
	thisForm = document.theForm

	var arrFields = new Array("name", "message" );
	var arrTitles = new Array("Name", "Message" );

	for(i=0; i<arrFields.length; i++){
		theField = arrFields[i]
		theTitle = arrTitles[i]
		if(thisForm[theField].value == ""){
			missingFields += theTitle + "\n";
			thisForm[theField].style.background = highlightColor;
			if(hasError == 0){thisForm[theField].focus()}
			hasError = 1;
		}else{
			thisForm[theField].style.background = defaultColor;
		}
	}

	thisEmail = thisForm.email
	mail=thisEmail.value;
	atloc=(mail.indexOf("@"));
	if(mail.length > 0){
		if (atloc==-1) {
			thisEmail.style.background = highlightColor;
			thisEmail.focus();
			hasError2 = 1;
		}else if (mail.indexOf(".",atloc)==-1) {
			thisEmail.style.background = highlightColor;
			thisEmail.focus();
			hasError2 = 1;
		}else if (mail.indexOf(' ') > 0){
			thisEmail.style.background = highlightColor;
			thisEmail.focus();
			hasError3 = 1;
		}
	}


	if(hasError == 1){
		alert('Please complete the following fields:\n' + missingFields)
		return false;
	}else if (hasError2 == 1){
		alert('Please enter a valid e-mail address.')
		return false;
	}else if (hasError3 == 1){
		alert('Please ensure that your email address does not contain spaces.')
		return false;
	}else{
		showTAF();
		return true;
	}

}