
/*	This code below should go near the form being validated or in a page-specific script file. */
var valfields = new Array();
var cnt = 0;

valfields[cnt++] = new valobj("fname", "First Name", "text", isBlank, isText);
valfields[cnt++] = new valobj("lname", "Last Name", "text", isBlank, isText);
valfields[cnt++] = new valobj("contact_title", "Title", "text", isBlank, isText);
valfields[cnt++] = new valobj("email", "Email Address", "text", isBlank, isText);
valfields[cnt++] = new valobj("email2", "Confirm Email Address", "text", isBlank, isText);
valfields[cnt++] = new valobj("contract_id", "Contract Number", "text", null, isAllDigits);
valfields[cnt++] = new valobj("churchname", "Church Name", "text", null, isText);
valfields[cnt++] = new valobj("city", "City", "text", null, isText);
valfields[cnt++] = new valobj("state", "State", "text", null, isUSState);
valfields[cnt++] = new valobj("zip", "Zip Code", "text", null, isValidZIPCode);




/*	Local validation to be done after initial single-field validation. This
	function should be written for pages where one of two fields must be 
	filled, say, or if one field is filled others should be checked. */
function local_validateForm(form)
{
	//alert("status=|"+form["status"].value+"|");
	
	if (form["email"].value != form["email2"].value) {
		form["email"].value = '';
		form["email2"].value = '';
		alert("Email and Email Confirmation did not match. Please try again.");
		form["email"].focus();
		return false;
	}
	
	
	if (isBlank(form["contract_id"])) {
		if (isBlank(form["churchname"]) || isBlank(form["city"]) || isBlank(form["state"]) || isBlank(form["zip"])){
			alert("You must enter either a contract number or the church name, city, state and zip code.");
			form["contract_id"].focus();
			return false;
		}
	}
	
	/*  if (form["status"].value == 3) {
		if (isBlank(form["solution"].value)){
			alert("Something must be entered in the Solution field before you can close a whitecard.");
			form["solution"].focus();
			return false;
		}
	}   */
	
	return true;
}
