<!--
function phoneCheck(phoneNo) {
/************************************************
DESCRIPTION: Validates that a string contains valid
  US phone pattern.
  Ex. (999) 999-9999 or (999)999-9999

PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid, otherwise false.
*************************************************/
  var regEx = /^\(?[1-9]\d{2}\)?\s?\-?\d{3}\-?\d{4}$/;

  //check for valid us phone with or without space between
  //area code
  return regEx.test(phoneNo);
}

function checkCommentForm(form) {
	var alertText = '';
	firstErrorField = '';
	
	if (!form.name.value) {
		alertText += "Please enter your name.\n";
		checkFirstErrorField('name');
	}
	if (!form.email.value) {
		alertText += "Please enter your email address.\n";
		checkFirstErrorField('email');
	}
	else if (!emailCheck(form.email.value)) {
		alertText += "Please enter a valid email address.\n";
		checkFirstErrorField('email');
	}
	if (!form.town.value) {
		alertText += "Please enter your town.\n";
		checkFirstErrorField('town');
	}
	if (!form.phone.value) {
		alertText += "Please enter a phone number where we can reach you.\n";
		checkFirstErrorField('phone');
	}
	else if (!phoneCheck(form.phone.value)) {
		alertText += "Please enter a valid phone number.\n";
		checkFirstErrorField('phone');
	}
	if (!form.comment.value) {
		alertText += "Please enter your comment.\n";
		checkFirstErrorField('comment');
	}
	if (!form.captchaCode.value) {
		alertText += "To help prevent spam posts, please type the characters you see in the graphic.";
		checkFirstErrorField('captchaCode');
	}
	else if (form.captchaCode.value != captcha) {
		alertText += "The security code you typed in is incorrect.";
		checkFirstErrorField('captchaCode');
	}
	if (alertText != '') {
		alert(alertText);
		form[firstErrorField].focus();
		form[firstErrorField].select();
		return false;
	}
	else {
		form.submit();
	}
}
//-->