/**
 * Custom form submission handler; called by submitForm() from forms.js
 *
 * @var myform (form object)
 * @return boolean
 */
function checkSubmit(myform) {
	
	var errorMsg = "";
	var first = myform.form_first.value;
	var last = myform.form_last.value;
	var email = myform.form_email.value;
	var city = myform.form_city.value;
	
	var errorCount = 0;
	
	if (isEmpty(first)) {
		errorCount++;
		errorMsg += "- Include your first name\n";
	}
	if (isEmpty(last)) {
		errorCount++;
		errorMsg += "- Include your last name\n";
	}
	if (isEmpty(email) || !isValidEmail(email)) {
		errorCount++;
		errorMsg += "- Include a valid email address\n";
	}
	if (isEmpty(city)) {
		errorCount++;
		errorMsg += "- Include your city (and state, if in the U.S.)\n";
	}
	
	if (!isEmpty(errorMsg)) {
		if (errorCount > 1) {
			errorTxt = 'these errors';
		} else {
			errorTxt = 'this error';
		}
		alert("Please fix " + errorTxt + " and submit again:\n" + errorMsg);
		return false;
	}
	
	return true;
}
