var valfields = new Array();
var cnt = 0;

//valfields[cnt++] = new valobj("Division", "Division", "text", isBlank, radio_isBlank);
valfields[cnt++] = new valobj("ProductCategory", "Topic", "text", isBlank, isText);
valfields[cnt++] = new valobj("Comments", "Comments", "text", isBlank, isText);
valfields[cnt++] = new valobj("Fname", "First Name", "text", isBlank, isText);
valfields[cnt++] = new valobj("Lname", "Last Name", "text", isBlank, isText);
valfields[cnt++] = new valobj("PostalCode", "Postal Code", "text", isBlank, isText);
valfields[cnt++] = new valobj("Telephone", "Telephone", "text", isBlank, isPhoneNum);
valfields[cnt++] = new valobj("Email", "Email", "text", isBlank, isValidEmail);


/*	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)
{
	if (form.CountryCode.value == "USA") {
		isUSState(form.State.value);
		//isValidZIPCode(form.Zip.value);
	}

	if (document.getElementById("division_studio").checked){
		if (isBlank(form.StudioState.value)){
			alert("If you have a comment about a studio, you must select the state in which the studio resides, then pick a studio.");
			form.StudioState.focus();
			return false;
		}
		else if (form.StudioNumberMissing.value == 1){
			alert("If you have a comment about a studio, you must select the state in which the studio resides, then pick a studio number.");
			form.StudioState.options[0].selected = true;
			form.StudioState.focus();
			return false;
		} 
		else if (radio_isBlank(form.StudioNumber)){
			alert("If you have a comment about a studio, you must select a studio in the state you specified.");
			form.StudioState.focus();
			return false;
		}
	}
	
	else if (document.getElementById("division_church").checked && (isBlank(form.ChurchName.value) || isBlank(form.ChurchCityState.value))){
		alert("If you have a comment related to a Church sitting, you must enter the church name, city and state.");
		if (isBlank(form.ChurchName.value)) form.ChurchName.focus();
		else form.ChurchCityState.focus();
		return false;
	}
	
	if (document.getElementById("feedback_check").checked) {
		if (radio_isBlank(form.question_1)) {
			alert("You must provide an answer for Feedback Question 1.");
			return false;
		} else if (radio_isBlank(form.question_2)) {
			alert("You must provide an answer for Feedback Question 2.");
			return false;
		} else if (radio_isBlank(form.question_3)) {
			alert("You must provide an answer for Feedback Question 3.");
			return false;
		} else if (radio_isBlank(form.question_4)) {
			alert("You must provide an answer for Feedback Question 4.");
			return false;
		} else if (radio_isBlank(form.question_5)) {
			alert("You must provide an answer for Feedback Question 5.");
			return false;
		} else if (radio_isBlank(form.question_6)) {
			alert("You must provide an answer for Feedback Question 6.");
			return false;
		} else if (radio_isBlank(form.question_7)) {
			alert("You must provide an answer for Feedback Question 7.");
			return false;
		} 		
	}

	return true;
}
