/* 	
	contactFormCheck.js file is included in the contactus.php page. This 
	script just makes sure the user sends the correct information to the server.
*/

function CheckSendEmailForm(frmObj) {
	var returnValue = true;
	var errorMsg = "";
	var nl = "";
	if (frmObj.contact_name.value == "") {
		errorMsg = "Your name";
		nl = "\n";
		returnValue = false;
	}

	if (frmObj.contact_email.value == "") {
		errorMsg += nl + "Email address";
		nl = "\n";
		returnValue = false;
	}
	else {
		if (!checkmail(frmObj.contact_email.value)) {
			errorMsg += nl + "A valid email address";
			nl = "\n";
			returnValue = false;
		}
	}

	if (frmObj.contact_comments.value == "") {
		errorMsg += nl + "Text in your email";
		nl = "\n";
		returnValue = false;
	}

	if (errorMsg) {
		alert("Please Provide the following:\n" + errorMsg);
	}

	return returnValue;
}

function checkmail(email) {
	var emailFormatRE = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	var returnval = emailFormatRE.test(email);
	return returnval;

}