
function CheckCommentForm() {

	var commenter_name = document.commentform.piv_name.value;

	var email_address = document.commentform.piv_email.value;

	var comment_text = document.commentform.piv_comment.value;

	var captcha = document.commentform.captcha.value;

	var filter=/^.+@.+\..{2,3}$/;

	if(commenter_name == '') {

		alert('Please enter a name.');

		document.commentform.piv_name.focus();

		return false;
	}

	else if((!(filter.test(email_address))) && email_address != '') {

		alert('The email address ' + email_address + ' is invalid.\nPlease enter a valid email address or leave the field blank.');

		document.commentform.piv_email.focus();

		return false;
	}

	else if(comment_text == '') {

		alert('You did not enter any comment text.');

		document.commentform.piv_comment.focus();

		return false;
	}

	else if(captcha == '') {

		alert('Please enter the security code as shown.');

		document.commentform.captcha.focus();

		return false;
	}

	else if(captcha.length != 6) {

		alert('You entered an invalid security code.\nSecurity codes are six characters long.');

		document.commentform.captcha.focus();

		return false;
	}

	return true;
}

