function validateEmail(email_address) {
	if (/\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email_address)){
		return true;
	}
	return false;
}

function verifyHuman(formName) {
	document[formName].h_formValidated.value = 'true'
}

function verifyContactForm() {

	var onErrorAlert		= true;
	var onErrorMessage	= true;
	var errorMessages		= new Array();
	var focused					= false;
	var formObj					= document.contactForm;

	if (formObj.Name.value == '') {
		errorMessages.push('Please enter your name');
		if(!focused){
			formObj.Name.focus();
			focused = true;
		}
	}

	if (!validateEmail(formObj.Email_Address.value)) {
		errorMessages.push('Please enter a valid email address');
		if(!focused){
			formObj.Email_Address.focus();
			focused = true;
		}
	}

	if (formObj.Comments.value == '') {
		errorMessages.push('Please enter your comments');
		if(!focused){
			formObj.Comments.focus();
			focused = true;
		}
	}

	if(errorMessages.length != 0){
		if(onErrorAlert){
				alert(errorMessages[0]);
		}
		if(onErrorMessage){
				oErrorDiv = document.getElementById("error_messages");
				oErrorDiv.innerHTML = "There was a problem with the information you supplied:<br />";
				for(var i=0; i<errorMessages.length; i++){
					oErrorDiv.innerHTML += "<li>" + errorMessages[i] + "</li>";
				}
				oErrorDiv.style.display = "block";
		}
		return false;

	} else {
		// copy the recipients email address to the hidden field
		// so that it can be seen in the body of the email
		// as well as in the senders field
		//formObj.Email.value = formObj.h_fromemail.value;
		return true;
	}

}


function brochureForm() {

	var onErrorAlert		= true;
	var onErrorMessage	= true;
	var errorMessages		= new Array();
	var focused					= false;
	var formObj					= document.brochureForm;

	if (formObj.Name.value == '') {
		errorMessages.push('Please enter your name');
		if(!focused){
			formObj.Name.focus();
			focused = true;
		}
	}

	if (!validateEmail(formObj.Email_Address.value)) {
		errorMessages.push('Please enter a valid email address');
		if(!focused){
			formObj.Email_Address.focus();
			focused = true;
		}
	}

	if(errorMessages.length != 0){
		if(onErrorAlert){
				alert(errorMessages[0]);
		}
		if(onErrorMessage){
				oErrorDiv = document.getElementById("error_messages");
				oErrorDiv.innerHTML = "There was a problem with the information you supplied:<br />";
				for(var i=0; i<errorMessages.length; i++){
					oErrorDiv.innerHTML += "<li>" + errorMessages[i] + "</li>";
				}
				oErrorDiv.style.display = "block";
		}
		return false;

	} else {
		return true;
	}

}
