// JavaScript Document





// The user is asked how he/she heard about A&T (TV, web, etc).  This array

// contains phrases to be used in error message if the user provides conflicting responses 

// to this question/

var publicity_Type_msg = new Array();

publicity_Type_msg["TV"]="on television.";

publicity_Type_msg["newspaper"]="in the newspaper.";

publicity_Type_msg["school"]="in school.";

publicity_Type_msg["radio"]="on the radio.";

publicity_Type_msg["mail"]="from a mailing.";

publicity_Type_msg["family"]="from your family.";

publicity_Type_msg["alumnus"]="from an alumnus of A&T.";

publicity_Type_msg["web"]="on the web.";

publicity_Type_msg["other"]="from a source that is not identified on this form.";







function Validate_UnivDay_Registration (univday_registration) {

 

 	var valid_so_far;



	with (univday_registration) {

		

		// Ensure that the user entered his/her name.



		if (reqd_value_missing (lname, "", "Please enter your last name.") )

			return (false);

			

		if (reqd_value_missing (fname, "", "Please enter your first name.") )

			return (false);

		

		valid_so_far = validate_phone_number (areacode, exchange, extension);

		if (!valid_so_far)

			return (false);

					

		if (reqd_value_missing (email, "", "Please enter your email address.") )

			return (false);

		if (reqd_value_missing (addr, "", "Please enter your street address.") )

			return (false);		

		if (reqd_value_missing (city, "", "Please enter the name of the city where you live.") )

			return (false);

		

		if (reqd_value_missing (state, 0, "Please select the name of the state where you live.") )

			return (false);

		

		if (reqd_value_missing (zip_code, "", "Please enter your zip code.") )

			return (false);



		if (reqd_value_missing (num_attendees, "", "Including yourself, please enter the number of people who will attend University Day Academic Expo.") )

			return (false);
		

		if (reqd_value_missing (expected_entry_semester, 0, "Please select the semester that you expect to begin your studies at A&T.") )

			return (false);



		if (reqd_value_missing (expected_entry_year, 0, "Please select the year that you expect to begin your studies at A&T.") )

			return (false);				

			

		// Ensure that the user indicated how he/she heard about A&T.

		if (reqd_radio_value_missing (publicity_Type, "Please indicate how you heard about A&T.") )

			return (false);

	

		publicity_Type_selected = get_selected_radio_button_value (publicity_Type);



		// VALIDATE ENTRY OF "OTHER"

		// If the user entered a value of "other", indicate that he/she indicates in the "other"

		// text box how he/she heard about A&T.

		if (publicity_Type_selected == "other") 

			if (reqd_value_missing (publicity_Type_other_details, "", "Please indicate how you heard about A&T.") )

				return (false);

		

		// If the user did not enter a value of "other", ensure that he/she did not enter a value	

		// in the "other" text box.		

		if (publicity_Type_selected != "other") 

			if (publicity_Type_other_details.value != "") {

				error_msg = "You indicated that you heard about A&T ";

				error_msg = error_msg + publicity_Type_msg[publicity_Type_selected] + "  ";

				error_msg = error_msg + ("Please enter a value in the \'Other\' field only if you heard about A&T in a way that is not displayed on this form.");

				alert (error_msg);

				publicity_Type_other_details.focus();

				return (false);

			} 

		



		// VALIDATE ENTRY OF "WEB"		

		// If the user did not enter a value of "web", ensure that he/she did not enter a value	for the URL text box.		

		if (publicity_Type_selected != "web") 

			if (publicity_Type_website_URL.value != "") {

				error_msg = "You indicated that you heard about A&T ";

				error_msg = error_msg + publicity_Type_msg[publicity_Type_selected] + "  ";

				error_msg = error_msg + ("Please enter a value in the \'Website URL\' field only if you heard about A&T on a website.");

				alert (error_msg);

				publicity_Type_website_URL.focus();

				return (false);

			} 

					

		if (reqd_value_missing (expected_major, 0, "Please select the major that you expect to pursue.  If you have not yet selected a major field of study, select \'Undecided\', which is the last option in the pull-down.") )

			return (false);

							

	} // with registration_form 

	

	return (true);



} // function 
