// JavaScript Document
function CheckEmailForm () { 

var errorMsg = "";
if (document.emailForm.name.value == ""){
errorMsg += "\n\tYour Name \t- You must enter your name.";
}

//Check for an e-mail address and that it is valid
if ((document.emailForm.email.value == "") || (document.emailForm.email.value.length > 0 && (document.emailForm.email.value.indexOf("@",0) == - 1 || document.emailForm.email.value.indexOf(".",0) == - 1))) { 
errorMsg += "\n\tYour Email \t- There is no valid email address. You must enter a valid email address to send us a message";
}


if (document.emailForm.comments.value == ""){
errorMsg += "\n\tMessage \t- You did not leave a message.";
}

//Check for a Subject

//If there is aproblem with the form then display an error
if (errorMsg != ""){
msg = "______________________________________________________________\n\n";
msg += "You message has not been sent becuase the form in not complete.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg += "______________________________________________________________\n\n";
msg += "The following field(s) need to be corrected: -\n";

errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}

var doEmailForm = confirm("You are about to send us an email, do you wish to continue?");
if (doEmailForm==false) {
	return false;
}
	
return true;
}
