// JavaScript Document
// JavaScript Document
/* validation of the classifieds form */
// Create new main array. Good for empty text fields
var txt_name = new Array() 
// Form field names is listed first followed by a descriptive name to be show in the js pop up if left blank
txt_name[0] = new Array("EVENT_DATE","Event Date") 
txt_name[1] = new Array("EVENT_TIME","Event Time") 
txt_name[2] = new Array("EVENT_TITLE","Event Title")
txt_name[3] = new Array("EVENT_CATEGORY","Event Category")
txt_name[4] = new Array("EVENT_ADDRESS","Event Address")
txt_name[5] = new Array("EVENT_TOWN","Event Town")
txt_name[6] = new Array("DESCRIPTION","Event Description")
txt_name[7] = new Array("CONTACT_INFORMATION","Contact Information")
txt_name[8] = new Array("PRIVATE_CONTACT","Private Contact Information")
txt_name[9] = new Array("ADMISSION_CHARGE","Admission Charge (if there is not a charge, type FREE)")

// check for blank text fields
function missing_content(){
	// check the regular text fields for empty content
	var j;
	var error_ct=0; // a counter variable for the errors;
	var missing_empty = "";

	for (j=0; j<txt_name.length; j++){
		if (document.calendar[txt_name[j][0]].value == "") {
			missing_empty+= txt_name[j][1] + "\n";
		}
	}
	return missing_empty;
}

function validation(){
	var missing = "";

	missing = missing_content();


// FINALE: is anything missing?
	if (missing != ""){
		missing_hdr = "The Following Errors Have Occurred:\n";
		alert (missing_hdr + missing);
		return false;
	} else {	
		return true;
	}
}
