// JavaScript Document
function validation() {
	var errs = '';
	var first = '';
	if (document.contact.firstname.value.length < 1) {
		errs += '   first name \n';
	}
	if (document.contact.lastname.value.length < 1) {
		errs += '   last name \n';
	} 
	if (document.contact.email.value.length < 1) {
		errs += '   email \n';
	}	
    var emailPat = /^\w+([\'\.\-]\w+)*\@\w+([\'\.\-]\w+)*\.[a-z]{2,4}$/i;
    var matchArray = document.contact.email.value.match(emailPat);
    if (document.contact.email.value.length > 1) {
	    if (matchArray == null) {
	        errs += '   email (must be a valid email address) \n';
        }
    }	
	if (document.contact.comment.value.length < 1) {
		errs += '   comment \n';
	}
	if (errs.length > 3) {
		errs = 'You are missing some required fields.\n\nPlease check: \n' + errs; 
		alert(errs); 
		return false;
	} else {
		return true;
	}
}

