function validateForm( form ) {
    var err_mess = "";
	
	err_mess += isEmpty( form.Contact_Name.value , "Please enter your name." , 0 , "");

	err_mess += checkPhone( form.Contact_Phone.value );

	err_mess += checkEmail( form.Contact_Email.value );

	err_mess += isEmpty( form.Contact_Comment.value , "Please enter a comment." , 0 , "");




// ************************************ DO NOT DELETE ANYTHING BELOW THIS LINE ************************************


if (err_mess != "") {
       alert(err_mess);
       return false;
    }
	return true;
}



// ----------------------------- check an email address ----------------------------- //
function checkEmail(strEmail) {
	var error = "";
	// check the empty string
	if (strEmail == "") {
   		error = "Please enter an email address.\n";
		return error;
	}
	// check the syntax "*@*.ab" or "*@*.abc"
    var filter=/^.+@.+\..{2,3}$/;
    if (!(filter.test(strEmail))) { 
       error = "Please enter a valid email address.\n";
	   return error;
    }
	// check for invald characters
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
    if (strEmail.match(illegalChars)) {
       error = "The email address contains illegal characters.\n";
	   return error;
    }
	return error;    
}
// ----------------------------- check an email address ----------------------------- //


// ----------------------------- check an phone number ----------------------------- //
function checkPhone(strPhone) {
	var error = "";
	// check for the empty string
	if (strPhone == "") {
   		error = "Please enter a phone number.\n";
		return error;
	}
	// check for all numbers after stripping string
	var stripped = strPhone.replace(/[\(\)\.\-\ ]/g, ''); 
    if (isNaN(parseInt(stripped))) {
       error = "Please enter a valid phone number.\n";
	   return error;
    }
	// check for the proper length of 10 or 11 digits
    if (!(stripped.length == 10 || stripped.length == 11)) {
		error = "The phone number is the wrong length. Please include the area code.\n";
		return error;
    } 
	return error;
}
// ----------------------------- check an phone number ----------------------------- //

// ----------------------------- check a password and it's retype ----------------------------- //
function checkPasswords(intPassNum , strPassword1 , strPassword2 , intMinChars) {
	var error = "";
	// if there are two occurrences of the password, check for the empty strings
	if (intPassNum == 2) {
		if ((strPassword1 == "") && (strPassword2 == "")) {
   			error = "Please enter a password and then retype it.\n";
			return error;
		}
	}
	// check for the empty string
	if (strPassword1 == "") {
   		error = "Please enter a password.\n";
		return error;
	}
	// check for the minimum number of characters
    if (strPassword1.length < intMinChars) {
       error = "The password is too short.\n";
	   return error;
    }
	// if there are two occurrences of the password, check for the 2nd empty dtring
	if (intPassNum == 2) {
		if (strPassword2 == "") {
   			error = "Please retype the password.\n";
			return error;
		}
	}
	// if there are two occurrences of the password,
	if (intPassNum == 2) {
    	if (strPassword1 != strPassword2) {
       		error = "The passwords don't match.\n";
	   		return error;
    	}
	}
	return error;    
}   
// ----------------------------- check a password and it's retype ----------------------------- //

// ----------------------------- check a text element for an empty string ----------------------------- //

function isEmpty(strText , strMessage , intMinChars , strMinMessage) {
	var error = "";
	// check for the empty string
  	if (strText == "") {
     	error = strMessage.concat("\n");
		return error;
  	}
	// check for minimum number of characters
	if (intMinChars != 0) {
		if (strText.length < intMinChars) {
			error = strMinMessage.concat("\n");
			return error;
		}
	}
	return error;	  
}

// ----------------------------- check a text element for an empty string ----------------------------- //

// ----------------------------- check a time ----------------------------- //
function checkTime(strTime) {
	var error = "";
	//check for the empty string
	if (strTime == "") {
   		error = "Please enter a time.\n";
		return error;
	}
	// check for all numbers after stripping string
	var stripped = strTime.replace(/[\:\(\)\.\-\ ]/g, ''); 
    if (isNaN(parseInt(stripped))) {
       error = "Please enter a valid time.\n";
	   return error;
    }
	// check for a ":"
	if (strTime.search(/:/) == -1) {
		error = "Please enter a valid time.\n";
		return error;
	}
	// check for "1-12" : "00-59" and that the minute is in a double character format (00-59)
	var hour;
	var minute;
	hour = strTime.substr(0,strTime.search(/:/));
	minute = strTime.substr(strTime.search(/:/)+1,2);
	if ( parseInt(hour) > 12 || parseInt(hour) < 1 || parseInt(minute) > 59 || parseInt(minute) < 0 || minute.length != 2) {		
		error = "Please enter a valid time.\n";
		return error;
    } 
	return error;
}
// ----------------------------- check a time ----------------------------- //

// ----------------------------- check a zipcode ----------------------------- //
function checkZipcode(strZipcode) {
	var error = "";
	var valid = "0123456789-";
	var hyphencount = 0;
	//check for the empty string
	if (strZipcode == "") {
   		error = "Please enter a zip code.\n";
		return error;
	}
	if (strZipcode.length!=5 && strZipcode.length!=10) {
		error = "Please enter a 5 digit or 5 digit+4 zip code.\n";
		return error;
	}
	for (var i=0; i < strZipcode.length; i++) {
		temp = "" + strZipcode.substring(i, i+1);
		if (temp == "-") hyphencount++;
			if (valid.indexOf(temp) == "-1") {
				error = "The zip code contains illegal characters.\n";
				return error;
			}
			if ((hyphencount > 1) || ((strZipcode.length==10) && ""+strZipcode.charAt(5)!="-")) {
				error = "Please enter a 5 digit or 5 digit+4 zip code.\n";
				return error;
   			}
		}
	return error;
}
// ----------------------------- check a zipcode ----------------------------- //

// ----------------------------- check a radio button or group of ----------------------------- //
function checkRadioORCheckbox(intRadio , strMessage) {
	var error = "";
	// check for a null value
   	if (!(intRadio)) {
       error = strMessage.concat("\n");
    }
	return error;
}
// ----------------------------- check a radio button or group of ----------------------------- //

// ----------------------------- check a drop down list ----------------------------- //
function checkDropdown(intDropdown , strMessage) {
	var error = "";
	// check for a null value
    if (intDropdown == 0) {
    	error = strMessage.concat("\n");
    }    
	return error;
}
// ----------------------------- check a drop down list ----------------------------- //

