function verify(form) {
	var msg;
	var empty_fields = "";
	var errors = "";
	var valid_email = /\S+@\S+\.\S+/;

	required = new Array();
	required[0] = new Array("name", "Name", 0);
	required[1] = new Array("email", "Email", 1);
	required[2] = new Array("telephone", "Phone number", 0);

	// Begin Conditional Required Fields
	// End Conditional Required Fields

	for (i=0; i < required.length; i++) {

		var f = required[i][0];
		var l = required[i][1];
		var e = required[i][2];

		if (f == null) { continue; }

		var n = form[f]

		if (!(n)) {
			var bad_field_message = "invalid field: " + f;
			alert(bad_field_message);
			return false;
		}

		if ((n[0] != null) && ((n[0].type == "radio") || (n[0].type == "checkbox"))) {
			var option = 0;
			for (j=0; j < n.length; j++) {
			if (n[j].checked == true) option = 1; }
			if (option == 0) { empty_fields += "\n     " + l; }
		}

		if (((n.type == "radio") || (n.type == "checkbox")) && (n.checked == false)) {
			empty_fields += "\n     " + l;
		}

		if ((n.type == "select") || (n.type == "select-one") || (n.type == "select-multiple")) {
			if ((n.selectedIndex == 0) || (n.selectedIndex == -1)) { empty_fields += "\n     " + l; }
		}

		if ((n.type == "text") || (n.type == "textarea") || (n.type == "password") || (n.type == "hidden")) {
			if ((n.value == null) || (n.value == "")) {
				empty_fields += "\n     " + l;
			}
		}

		if ( (e == "1") && (n.value) && !(valid_email.test(n.value)) ) {
			errors += "The field " + l + " must be a valid E-mail address.\n";
		}

	}

	if (!empty_fields && !errors) {
		return true;
	} else {
		msg = "The form was not submitted because of the following error(s).\n";
		if (empty_fields) { // if there are errors or empty fields, print the alert.
		msg += "The following required field(s) are empty:" + empty_fields + "\n";
		if (errors) msg += "\n"; }
		msg += errors;
		alert(msg);
		if (form.Attendee_First_Name) {form.Attendee_First_Name.focus();}
		return false;
	}
}

function fields_onoff(form, onoff) {
	for (arg_count = 2; arg_count < arguments.length; arg_count++) {
		var f = arguments[arg_count];
		var n = form[f];

		if (!(n)) {
			var bad_field_message = "invalid field: " + f;
			alert(bad_field_message);
			return false;
		}

		if (onoff == 'on') {
			if ((n[0] != null) && ((n[0].type == "radio") || (n[0].type == "checkbox"))) {
				for (j=0; j < n.length; j++) {
					n[j].disabled = false;
				}
			}

			if ((n.type == "radio") || (n.type == "checkbox")) {
				n.disabled = false;
			}

			if ((n.type == "select") || (n.type == "select-one") || (n.type == "select-multiple")) {
				n.disabled = false;
			}

			if ((n.type == "text") || (n.type == "textarea") || (n.type == "password")) {
				n.disabled = false;
			}
		} else if (onoff == 'off') {
			if ((n[0] != null) && ((n[0].type == "radio") || (n[0].type == "checkbox"))) {
				for (j=0; j < n.length; j++) {
					n[j].checked = false;
					n[j].disabled = true;
				}
			}

			if ((n.type == "radio") || (n.type == "checkbox")) {
				n.checked = false;
				n.disabled = true;
			}

			if ((n.type == "select") || (n.type == "select-one") || (n.type == "select-multiple")) {
				n.selectedIndex = 0;
				n.disabled = true;
			}

			if ((n.type == "text") || (n.type == "textarea") || (n.type == "password")) {
				n.value = '';
				n.disabled = true;
			}
		} else {
			var bad_field_message = "invalid on/off argument: " + onoff + ". Should be on or off";
			alert(bad_field_message);
			return false;
		}
	}
}


