	function WhatsThis(codeval,nameval) {
		var msg = '';
		switch (codeval) {
			case 'AI' :
				msg = 'Please include any additional information that may be of help with your request.\n\n' +
					  'Examples:\n\n' +
					  '	* Please include airfare from ___ .\n\n' +
					  '	* Add the ages of kids and seniors.\n\n' +
					  '	* Mention type of cruise cabin or hotel room desired.\n\n' +
					  '	* Do you want meals included?\n\n' +
					  '	* Do you need a rental car or other transportation?\n\n';
		}
		alert(msg);
	}

	function SubmitForm(DoWhat) {
		var msg;
		msg = "";
		msg = ValidateTR(DoWhat);
		if (msg != '') {
			msg = 'The form could not be submitted.\n\n' + msg;
			alert(msg);
		}
		else {
			document.frmTrip.DoWhat.value = DoWhat;
			document.frmTrip.submit();
		}
	
	}
	function ValidEmail(AddrToTest) {
		var ReturnStatus = true;
		function CountInstances(StringToCheck, WordToFind) {
			var substrings = StringToCheck.split(WordToFind);
			return substrings.length - 1;
		}
		
		if ( CountInstances(AddrToTest, '@') > 1 ) {
			ReturnStatus = false;
		}
		if ( CountInstances(AddrToTest, '.') == 0 ) {
			ReturnStatus = false;
		}
		if ( CountInstances(AddrToTest, ',') > 0 ) {
			ReturnStatus = false;
		}
		if ( CountInstances(AddrToTest, ';') > 0 ) {
			ReturnStatus = false;
		}
		if ( CountInstances(AddrToTest, ' ') > 0 ) {
			ReturnStatus = false;
		}

		return ReturnStatus;
	}
	function ValidateMaxOffers()
	{
		if (typeof(objForm.IncludedOffers) != 'undefined')
		{
			var chkcnt = 0;
			for(var i=0; i < objForm.IncludedOffers.length; i++)
			{
				if(objForm.IncludedOffers[i].checked == true)
					chkcnt++
			}
			if(chkcnt > MaxOffersPerReq)
				return "Please select " + MaxOffersPerReq + " or fewer offers to include in the request.\n\n"
			else
				return "";
		}
		else
			return "";
	}
	function ValidateInformation()
	{
		// Validate that an offer has been selected, or that they have added a comment
		if( typeof(function228) != 'undefined')
		{
			var chkcnt = 0;
			if (typeof(objForm.IncludedOffers) != 'undefined')
			{
				for(var i=0; i < objForm.IncludedOffers.length; i++)
				{
					if(objForm.IncludedOffers[i].checked == true)
					{
						chkcnt++
						break
					}
				}
				if( typeof(objForm.IncludedOffers.length) == 'undefined')
				{
					if(objForm.IncludedOffers.checked == true)
						chkcnt++
				}
			}
			if (chkcnt < 1 && objForm.Comments.value == '')
				return 'Please include a trip, or describe your desired travel in the Comments field, so we can help you find the best travel options.\n\n';
		}
		return '';

	}
	function ValidateTR(DoWhat) {
		var msg;
		msg = "";

		switch (DoWhat) {
			case 'login' :
				if (objForm.LookupEmail.value == '') {
					msg += 'Email Address: Please enter your e-mail address';
				}
				break;
			/* simple form - send */
			case 'simplesend' :
				msg += ValidateMaxOffers()
				msg += ValidateInformation()

				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text)
				if (objForm.frmFirstName.value == '') {
					msg += 'First Name: Please enter your first name.\n\n';
				}
					
				if (objForm.frmLastName.value == '') {
					msg += 'Last Name: Please enter your last name.\n\n';
				}
	
				if (objForm.frmEmail.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
				
				if (objForm.frmEmail.value != '') {
					if (ValidEmail(objForm.frmEmail.value) == false ) {
						msg += 'E-mail Address: Please enter a valid e-mail address.\n\n';
					}
				}
				
	/* do we need required field checking on membership field ?
				if (objForm.ProfileValue1.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	*/
				if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
					if ( objForm.ContactType[0].checked == false && objForm.ContactType[1].checked == false ) {
						msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
					}
				}
				else if ( objForm.ContactType.value == '' ) {
					msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
				}
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object' && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}

				if ( typeof(objForm.Departure) != 'undefined' ) {
					if (objForm.Departure.value == '') {
						msg += 'Departure: Please enter your departing city or airport.\n\n';
					}
				}
	
//				if (typeof(objForm.frmState.selectedIndex) != typeof(undefined)) {
				if ( typeof(objForm.frmState) != 'undefined' ) {
					if (typeof(objForm.frmState.selectedIndex) == 'object') {
						if ((objForm.frmState[objForm.frmState.selectedIndex].value == '0') ||
							(objForm.frmState[objForm.frmState.selectedIndex].value == 'null')) {
							msg += 'State: Please select a state.\n\n';
						}
					}
				
				}
	
				if (isNaN(objForm.NumberAdults.value) == true ||
					isNaN(objForm.NumberChildren.value) == true) {
					if (isNaN(objForm.NumberAdults.value) == true) {
						msg += '# of Adults: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
					if (isNaN(objForm.NumberChildren.value) == true) {
						msg += '# of Children: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
				}

				if ( objForm.NumberAdultsRequired.value == 'true' ) {
						if (objForm.NumberAdults.value == '')
							{
							msg += '# of Adults: Please enter the number of adults travelling.\n\n';
							}
					}

				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text);
				var date2 = new Date();
				date2 = new Date(Date.parse(date2) - (1000*60*60*24));
				if (date2 > date1)
						{
						msg += 'Departure Date: Departure Date cannot be before today.\n\n';
						}
				if ( objForm.StartDateRequired.value == 'true' ) 
					{
					if (objForm.StartMonth.selectedIndex == 0 || objForm.StartDay.selectedIndex == 0 || objForm.StartYear.selectedIndex == 0)
						{
						msg += 'Departure Date: Please enter the departure date.\n\n';
						}
					if (objForm.frmNumberOfNights.value == '')
						{
						msg += '# Nights: Please enter the number of nights.\n\n';
						}

					}

	
				if ((( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) && (objForm.NoId.value != 'true') && (objForm.DefaultAgencyId.value == '')) 
				{
					msg += 'Preferred Office: Please select an Office.\n\n';
				}
				else if (( objForm.AgencyId.value != '') && (objForm.AgencyId.value != '0') && (objForm.AgencyId.value != null))
				{
					//don't do anything here.  Everything is okay.  This condition just
					//keeps it from going further if the value appears to be valid
				}
				else if (typeof(objForm.AgencyId.selectedIndex) == 'object')
				{
					if((objForm.AgencyId[objForm.AgencyId.selectedIndex].value == '0') && (objForm.DefaultAgencyId.value == ''))
					{
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				}
				
				var chkcnt = 0;
				if (typeof(objForm.IncludedOffers) != 'undefined')
				{
					if(typeof(objForm.IncludedOffers.length) != 'undefined')
						for(var i=0; i < objForm.IncludedOffers.length; i++)
						{
							if(objForm.IncludedOffers[i].checked == true)
								chkcnt++
						}
					else
						{
						if(objForm.IncludedOffers.checked == true)
							chkcnt = 1;
						}
				}
				if (chkcnt == 0 && objForm.Comments.value == '')
					{
						msg += 'You do not have any prices in your Request.  If you choose not to include offers, you must complete the "Additional Information" section.\n\n';
					}
	

				if (objForm.Comments.value.length > 1000) {
					msg += 'Additional Information: Please limit your comments to 1000 characters or less.\n';
					msg += '\tYou currently have ' + document.frmTrip.Comments.value.length + ' characters in your comments.\n\n';
				}
		
//				if (msg != '') {
//					msg = 'The form could not be submitted.\n\n' + msg;
//					alert(msg);
//				}
	
//				SubmitRequest(msg, DoWhat);
				break;

			/* regular form - send */
			case 'send' :
				msg += ValidateMaxOffers()
				msg += ValidateInformation()
				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text)
				var date2 = new Date(objForm.EndYear.options[objForm.EndYear.selectedIndex].text,objForm.EndMonth.options[objForm.EndMonth.selectedIndex].value - 1,objForm.EndDay.options[objForm.EndDay.selectedIndex].text)
//				if (objForm.ActionType != undefined) {
				if (typeof(objForm.ActionType) == 'object') {
					if (objForm.ActionType[0].checked == false &&
						objForm.ActionType[1].checked == false &&
						objForm.ActionType[2].checked == false &&
						objForm.ActionType[3].checked == false)
					{
						msg += 'Action: Must select an action preference.\n\n';
					}
				}
				if (objForm.DateFlexible[0].checked == false &&
					objForm.DateFlexible[1].checked == false)
				{
					msg += 'These dates are: Must select either "flexible", or "non-flexible".\n\n';
				}
				
/*				if (objForm.ContactType.value != 'undefined') {
					if (objForm.ContactType[0].checked == false && objForm.ContactType[1].checked == false)
					{
						msg += 'Contact me by: Must select either "email", or "phone".\n\n';
					}
				} */
		
				if (date1 > date2) {
					msg += 'The "Start Date" can not be greater than the "End Date".\n\n';
				}
				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text);
				var nowdate = new Date();
				nowdate = new Date(Date.parse(nowdate) - (1000*60*60*24));
				if (nowdate > date1)
						{
						msg += 'Departure Date: Departure Date cannot be before today.\n\n';
						}
	
				if (objForm.Departure.value == '') {
					msg +=	'Please complete the "Departure" information.\n' +
							'Examples: Portland, Oregon\n\t  PDX\n\n';
				}
				if (isNaN(objForm.NumberAdults.value) == true ||
					isNaN(objForm.NumberChildren.value) == true) {
					if (isNaN(objForm.NumberAdults.value) == true) {
						msg += '# of Adults: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
					if (isNaN(objForm.NumberChildren.value) == true) {
						msg += '# of Children: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
				}
				
					if ( objForm.NumberAdultsRequired.value == 'true' ) {
						if (objForm.NumberAdults.value == '')
							{
							msg += '# of Adults: Please enter the number of adults travelling.\n\n';
							}
					}

				
				
				// Validate that the ages of children are included if required
				if(!isNaN(objForm.NumberChildren.value) && objForm.NumberChildren.value > 0 && typeof(function224) != 'undefined')
				{
					if(objForm.ChildAges.value == "")
					{
						if(objForm.NumberChildren.value == 1)
							msg += 'Child\'s Age: Please enter the age of the child specified.\n\n';
						else
							msg += 'Children\'s Ages: Please enter the ages of the children specified.\n\n';

					}

				}
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}
		
				if ( objForm.StartDateRequired.value == 'true' ) {
					if (objForm.StartMonth.selectedIndex == 0 || objForm.StartDay.selectedIndex == 0 || objForm.StartYear.selectedIndex == 0 || objForm.EndMonth.selectedIndex == 0 || objForm.EndDay.selectedIndex == 0 || objForm.EndYear.selectedIndex == 0)
					{
					msg += 'Travel Dates: Please complete the start and end dates.\n\n';
					}
				}

//				if ((objForm.DayPhone.value == '') && (document.frmTrip.ContactType[1].checked)) {
//					msg += 'Phone Number: Please enter a valid phone number.\n\n';
//					objForm.DayPhone.focus();
//				}

				if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
					if ( objForm.ContactType[0].checked == false && objForm.ContactType[1].checked == false ) {
						msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
					}
				}
				else if ( objForm.ContactType.value == '' ) {
					msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
				}
					
				if ((( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) && (objForm.NoId.value != 'true') && (objForm.DefaultAgencyId.value == '')) {
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				else if (( objForm.AgencyId.value != '') && (objForm.AgencyId.value != '0') && (objForm.AgencyId.value != null)) {
					//don't do anything here.  Everything is okay.  This condition just
					//keeps it from going further if the value appears to be valid
				}
				else if ( (typeof(objForm.AgencyId.selectedIndex) == 'number') || (typeof(objForm.AgencyId.selectedIndex) == 'object') )
				{
					if ((objForm.AgencyId[objForm.AgencyId.selectedIndex].value == '0') && (objForm.DefaultAgencyId.value == ''))
					{
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				}


				var chkcnt = 0;
				if (typeof(objForm.IncludedOffers) != 'undefined')
				{
					if(typeof(objForm.IncludedOffers.length) != 'undefined')
						for(var i=0; i < objForm.IncludedOffers.length; i++)
						{
							if(objForm.IncludedOffers[i].checked == true)
								chkcnt++
						}
					else
						{
						if(objForm.IncludedOffers.checked == true)
							chkcnt = 1;
						}
				}
				if (chkcnt == 0 && objForm.Comments.value == '')
					{
						msg += 'You do not have any prices in your Request.  If you choose not to include offers, you must complete the "Additional Information" section.\n\n';
					}

				
				if (objForm.Comments.value.length > 1000) {
					msg += 'Additional Information for Agent: Please limit your comments to 1000 characters or less.\n';
					msg += '\tYou currently have ' + document.frmTrip.Comments.value.length + ' characters in your comments.\n\n';
				}
//				if (msg != '') {
//					msg = 'The form could not be submitted.\n\n' + msg;
//					alert(msg);
//				}
	
//				SubmitRequest(msg, DoWhat);
				break;

			case 'simpleprint' :
				msg += ValidateMaxOffers()

				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text)
				if (objForm.frmFirstName.value == '') {
					msg += 'First Name: Please enter your first name.\n\n';
				}
					
				if (objForm.frmLastName.value == '') {
					msg += 'Last Name: Please enter your last name.\n\n';
				}
	
				if (objForm.frmEmail.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	
	/* do we need required field checking on membership field ?
				if (objForm.ProfileValue1.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	*/
				if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
					if ( objForm.ContactType[0].checked == false && objForm.ContactType[1].checked == false ) {
						msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
					}
				}
				else if ( objForm.ContactType.value == '' ) {
					msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
				}
	
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}

	
//				if ((objForm.DayPhone.value == '') && (document.frmTrip.ContactType[1].checked)) {
//					msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
//					objForm.DayPhone.focus();
//				}
		
				if ( typeof(objForm.Departure) != 'undefined' ) {
					if (objForm.Departure.value == '') {
						msg += 'Departure: Please enter your departing city or airport.\n\n';
					}
				}
	
				if (typeof(objForm.frmState) != 'undefined') {
				if (typeof(objForm.frmState.selectedIndex) == 'object') {
					if ((objForm.frmState[objForm.frmState.selectedIndex].value == '0') ||
						(objForm.frmState[objForm.frmState.selectedIndex].value == 'null')) {
						msg += 'State: Please select a state.\n\n';
					}
				} }
	
				if (isNaN(objForm.NumberAdults.value) == true ||
					isNaN(objForm.NumberChildren.value) == true) {
					if (isNaN(objForm.NumberAdults.value) == true) {
						msg += '# of Adults: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
					if (isNaN(objForm.NumberChildren.value) == true) {
						msg += '# of Children: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
				}


		
				if ((( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) && (objForm.NoId.value != 'true') && (objForm.DefaultAgencyId.value == '')) {
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				else if (( objForm.AgencyId.value != '') && (objForm.AgencyId.value != '0') && (objForm.AgencyId.value != null)) {
					//don't do anything here.  Everything is okay.  This condition just
					//keeps it from going further if the value appears to be valid
				}
				else if (typeof(objForm.AgencyId.selectedIndex) == 'object') {
						if ((objForm.AgencyId[objForm.AgencyId.selectedIndex].value == '0') && (objForm.DefaultAgencyId.value == '')) {
								msg += 'Preferred Office: Please select an Office.\n\n';
							}
					}
		
				if (objForm.Comments.value.length > 1000) {
					msg += 'Additional Information: Please limit your comments to 1000 characters or less.\n';
					msg += '\tYou currently have ' + document.frmTrip.Comments.value.length + ' characters in your comments.\n\n';
				}
		
//				if (msg != '') {
//					
//					//alert(msg);
//				}

//				SubmitRequest(msg, DoWhat);
				break;

			case 'print' :
//				SubmitRequest(msg, DoWhat);
				msg += ValidateMaxOffers();
				break;

			case 'engagement' :

				if (objForm.frmFirstName.value == '') {
					msg += 'First Name: Please enter your first name.\n\n';
				}
					
				if (objForm.frmLastName.value == '') {
					msg += 'Last Name: Please enter your last name.\n\n';
				}
	
				if (objForm.frmEmail.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
				
				if (objForm.frmEmail.value != '') {
					if (ValidEmail(objForm.frmEmail.value) == false ) {
						msg += 'E-mail Address: Please enter a valid e-mail address.\n\n';
					}
				}
				
				if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
					if ( objForm.ContactType[0].checked == false && objForm.ContactType[1].checked == false ) {
						msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
					}
				}
				else if ( objForm.ContactType.value == '' ) {
					msg += 'Contact Method: Please specify how you would like to be contacted.\n\n';
				}
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object' && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}

				break;


			case '' :
//				SubmitRequest(msg, DoWhat);
				break;
		} //switch
//		alert(msg);
		return msg;
	}
	
	function SaveChangesOld(DoWhat) {
		var msg = '';
		var objForm = document.frmTrip;

		switch (DoWhat) {
			/* simple form - send */
			case 'simplesend' :
				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text)
				if (objForm.frmFirstName.value == '') {
					msg += 'First Name: Please enter your first name.\n\n';
				}
					
				if (objForm.frmLastName.value == '') {
					msg += 'Last Name: Please enter your last name.\n\n';
				}
	
				if (objForm.frmEmail.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	
	/* do we need required field checking on membership field ?
				if (objForm.ProfileValue1.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	*/
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}
	
//				if ((objForm.DayPhone.value == '') && (document.frmTrip.ContactType[1].checked)) {
//					msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
//					objForm.DayPhone.focus();
//				}
		
				if (objForm.frmCity.value == '') {
					msg += 'City: Please enter your departing city.\n\n';
				}
	
//				if (typeof(objForm.frmState.selectedIndex) != typeof(undefined)) {
				if (typeof(objForm.frmState.selectedIndex) == 'object') {
					if ((objForm.frmState[objForm.frmState.selectedIndex].value == '0') ||
						(objForm.frmState[objForm.frmState.selectedIndex].value == 'null')) {
						msg += 'State: Please select a state.\n\n';
					}
				}
	
				if (isNaN(objForm.NumberAdults.value) == true ||
					isNaN(objForm.NumberChildren.value) == true) {
					if (isNaN(objForm.NumberAdults.value) == true) {
						msg += '# of Adults: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
					if (isNaN(objForm.NumberChildren.value) == true) {
						msg += '# of Children: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
				}
		
				if ((( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) && (objForm.NoId.value != 'true')) {
	//			if (( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) {
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				else if (( objForm.AgencyId.value != '') && (objForm.AgencyId.value != '0') && (objForm.AgencyId.value != null)) {
					//don't do anything here.  Everything is okay.  This condition just
					//keeps it from going further if the value appears to be valid
				}
//				else if (typeof(objForm.AgencyId.selectedIndex) != typeof(undefined)) {
				else if (typeof(objForm.AgencyId.selectedIndex) == 'object') {
						if (objForm.AgencyId[objForm.AgencyId.selectedIndex].value == '0') {
								msg += 'Preferred Office: Please select an Office.\n\n';
							}
					}
		
				if (objForm.Comments.value.length > 1000) {
					msg += 'Additional Information: Please limit your comments to 1000 characters or less.\n';
					msg += '\tYou currently have ' + document.frmTrip.Comments.value.length + ' characters in your comments.\n\n';
				}
		
				if (msg != '') {
					msg = 'The form could not be submitted.\n\n' + msg;
					alert(msg);
				}
	
				SubmitRequest(msg, DoWhat);
				break;

			/* regular form - send */
			case 'send' :
				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text)
				var date2 = new Date(objForm.EndYear.options[objForm.EndYear.selectedIndex].text,objForm.EndMonth.options[objForm.EndMonth.selectedIndex].value - 1,objForm.EndDay.options[objForm.EndDay.selectedIndex].text)
//				if (objForm.ActionType != undefined) {
				if (typeof(objForm.ActionType) == 'object') {
					if (objForm.ActionType[0].checked == false &&
						objForm.ActionType[1].checked == false &&
						objForm.ActionType[2].checked == false &&
						objForm.ActionType[3].checked == false)
					{
						msg += 'Action: Must select an action preference.\n\n';
					}
				}
					
				if (objForm.DateFlexible[0].checked == false &&
					objForm.DateFlexible[1].checked == false)
				{
					msg += 'These dates are: Must select either "flexible", or "non-flexible".\n\n';
				}
		
				if (date1 > date2) {
					msg += 'The "Start Date" can not be greater than the "End Date".\n\n';
				}
		
				if (objForm.Departure.value == '') {
					msg +=	'Please complete the "Departure" information.\n' +
							'Examples: Portland, Oregon\n\t  PDX\n\n';
				}
				if (isNaN(objForm.NumberAdults.value) == true ||
					isNaN(objForm.NumberChildren.value) == true) {
					if (isNaN(objForm.NumberAdults.value) == true) {
						msg += '# of Adults: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
					if (isNaN(objForm.NumberChildren.value) == true) {
						msg += '# of Children: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
				}
		
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}

//				if ((objForm.DayPhone.value == '') && (document.frmTrip.ContactType[1].checked)) {
//					msg += 'Phone Number: Please enter a valid phone number.\n\n';
//					objForm.DayPhone.focus();
//				}
		
				if ((( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) && (objForm.NoId.value != 'true')) {
	//			if (( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) {
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				else if (( objForm.AgencyId.value != '') && (objForm.AgencyId.value != '0') && (objForm.AgencyId.value != null)) {
					//don't do anything here.  Everything is okay.  This condition just
					//keeps it from going further if the value appears to be valid
				}
//				else if (typeof(objForm.AgencyId.selectedIndex) != typeof(undefined)) {
				else if (typeof(objForm.AgencyId.selectedIndex) == 'object') {
						if (objForm.AgencyId[objForm.AgencyId.selectedIndex].value == '0') {
								msg += 'Preferred Office: Please select an Office.\n\n';
							}
					}
		
				if (objForm.Comments.value.length > 1000) {
					msg += 'Additional Information for Agent: Please limit your comments to 1000 characters or less.\n';
					msg += '\tYou currently have ' + document.frmTrip.Comments.value.length + ' characters in your comments.\n\n';
				}
		
				if (msg != '') {
					msg = 'The form could not be submitted.\n\n' + msg;
					alert(msg);
				}
	
				SubmitRequest(msg, DoWhat);
				break;

			case 'simpleprint' :
				var date1 = new Date(objForm.StartYear.options[objForm.StartYear.selectedIndex].text,objForm.StartMonth.options[objForm.StartMonth.selectedIndex].value - 1,objForm.StartDay.options[objForm.StartDay.selectedIndex].text)
				if (objForm.frmFirstName.value == '') {
					msg += 'First Name: Please enter your first name.\n\n';
				}
					
				if (objForm.frmLastName.value == '') {
					msg += 'Last Name: Please enter your last name.\n\n';
				}
	
				if (objForm.frmEmail.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	
	/* do we need required field checking on membership field ?
				if (objForm.ProfileValue1.value == '') {
					msg += 'E-mail Address: Please enter your e-mail address.\n\n';
				}
	*/
				if ( objForm.DayPhone.value == '' ) {
					if ( typeof(objForm.ContactType.value) != 'object'  && typeof(objForm.ContactType.value) != 'string' ) {
						if ( objForm.DayPhoneRequired.value == 'true' ) {
							msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
							objForm.DayPhone.focus();
						}
						if ( objForm.ContactType[1].checked ) {
							msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
							objForm.DayPhone.focus();
						}
					}
					if ( objForm.ContactType.value == '2' ) {
						msg += 'Phone Number: Please enter a valid contact phone number.\n\n';
						objForm.DayPhone.focus();
					}
				}
	
//				if ((objForm.DayPhone.value == '') && (document.frmTrip.ContactType[1].checked)) {
//					msg += 'Phone Number: Please enter a valid phone number if you wish to be contacted by phone.\n\n';
//					objForm.DayPhone.focus();
//				}
		
				if (objForm.frmCity.value == '') {
					msg += 'City: Please enter your departing city.\n\n';
				}
	
//				if (typeof(objForm.frmState.selectedIndex) != typeof(undefined)) {
				if (typeof(objForm.frmState.selectedIndex) == 'object') {
					if ((objForm.frmState[objForm.frmState.selectedIndex].value == '0') ||
						(objForm.frmState[objForm.frmState.selectedIndex].value == 'null')) {
						msg += 'State: Please select a state.\n\n';
					}
				}
	
				if (isNaN(objForm.NumberAdults.value) == true ||
					isNaN(objForm.NumberChildren.value) == true) {
					if (isNaN(objForm.NumberAdults.value) == true) {
						msg += '# of Adults: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
					if (isNaN(objForm.NumberChildren.value) == true) {
						msg += '# of Children: Please enter a whole number  (alpha characters are not allowed).\n\n';
					}
				}
		
				if ((( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) && (objForm.NoId.value != 'true')) {
	//			if (( objForm.AgencyId.value == '') || (objForm.AgencyId.value == '0')) {
						msg += 'Preferred Office: Please select an Office.\n\n';
					}
				else if (( objForm.AgencyId.value != '') && (objForm.AgencyId.value != '0') && (objForm.AgencyId.value != null)) {
					//don't do anything here.  Everything is okay.  This condition just
					//keeps it from going further if the value appears to be valid
				}
//				else if (typeof(objForm.AgencyId.selectedIndex) != typeof(undefined)) {
				else if (typeof(objForm.AgencyId.selectedIndex) == 'object') {
						if (objForm.AgencyId[objForm.AgencyId.selectedIndex].value == '0') {
								msg += 'Preferred Office: Please select an Office.\n\n';
							}
					}
		
				if (objForm.Comments.value.length > 1000) {
					msg += 'Additional Information: Please limit your comments to 1000 characters or less.\n';
					msg += '\tYou currently have ' + document.frmTrip.Comments.value.length + ' characters in your comments.\n\n';
				}
		
				if (msg != '') {
					msg = 'The form could not be submitted.\n\n' + msg;
					alert(msg);
				}

				SubmitRequest(msg, DoWhat);
				break;

			case 'print' :
				SubmitRequest(msg, DoWhat);
				break;

			case '' :
				SubmitRequest(msg, DoWhat);
				break;
		} //switch
	}
		
	function SubmitRequest(msg, DoWhat) {
		if (msg == '') {
			document.frmTrip.DoWhat.value = DoWhat;
			if ((DoWhat == 'simplesend') || (DoWhat == 'simpleprint') || (DoWhat == 'engagement')) {
				document.frmTrip.target = '';
				document.frmTrip.action = 'TripGenProcess.asp';
				document.frmTrip.submit();
			}
			else {
				if (objForm.CustomerId.value == '') {
					MyProfile(DoWhat);
				}
				else {
					document.frmTrip.target = '';
					document.frmTrip.action = 'TripGenProcess.asp';
					document.frmTrip.submit();
				}
			}
		}
	}
	
	function RemoveOffers() {
		var frmElements = document.frmTrip.elements;
		var chkString = '';
		var url = '';
		var msg = '';

		for (i=0; i < frmElements.length; i++) {
			if ((frmElements[i].name == 'chkDelete') && (frmElements[i].checked)) {
				chkString += frmElements[i].value + ',';
			}
		}

		if (chkString != '') {
			chkString = chkString.substring(0, chkString.length - 1);
			if (confirm('You are about to remove offers: ' + chkString + '  from your \"Trip Request\".\n\nClick "OK" to continue.')) {
				document.frmTrip.act_val.value = 'R';
				document.frmTrip.TripDelete.value = 'YES';
				document.frmTrip.RemoveValue.value = chkString;
				if (objForm.TripId.value != '') {
					SaveChanges('');
				}
				else {
					document.frmTrip.target = '';
					document.frmTrip.action = 'TripGenProcess.asp';
					document.frmTrip.submit();
				}
			}
		}
		else {
			alert('You have not selected any offers to be deleted.');
		}
	}

	function AgencyLocator() {
		//Open the Agency Locator Window
		var parameters = 'width=320,height=300,scrollbars=yes,resizable=yes,top=190,left=230,toolbar=no,menubar=no,status=no,location=no,directories=no';
		window.open('AgencyLocator.asp', 'agency_locator', parameters);
	}

	function AgencyLocator2() {
		//Open the Agency Locator Window
		var parameters = 'width=330,height=620,scrollbars=yes,resizable=yes,top=20,left=230,toolbar=no,menubar=no,status=no,location=no,directories=no';
		window.open('AgencyLocator.asp', 'agency_locator', parameters);
	}

	function MyProfile(DoWhat) {
		//Open window for customer to create profile
		var msg;
		msg = ValidateTR(DoWhat);
		if (msg != '') {
			msg = 'The form could not be submitted.\n\n' + msg;
			alert(msg);
		}
		else {
			var objForm = document.frmTrip;
			if (typeof(objForm.LookupPassword) == 'object') {
				objForm.LookupPassword.value = '';
			}
			var parameters = 'width=650,height=600,scrollbars=yes,resizable=yes,top=75,left=75,toolbar=no,menubar=no,status=yes,location=no,directories=no';
			var window_name = 'window_MyProfile';
			var URL = 'CustomerProfile.asp?ProcessType=TripRequest&DoWhat=' + DoWhat;
			window.open(URL,window_name,parameters);
		}
	}

	function CheckEmail(Protect) {
		var msg = '';

		if (Protect == 'true') {
			if (document.frmTrip.LookupEmail.value == '' || document.frmTrip.LookupPassword.value == '') {
				msg += 'To retrieve your profile, you must enter a valid email address and password.\n\n';
			}
		}
		else {
			if (document.frmTrip.LookupEmail.value == '') {
				msg += 'To retrieve your profile, you must enter a valid email address.\n\n';
			}
		}
		
		if (msg != '') {
			alert(msg);
			document.frmTrip.LookupEmail.focus();
			return false;
		}
		else {
			objForm.action = 'TripPlanner.asp';
//			objForm.target = 'LTONMain';
			return true;
		}
	}

	function AddAges() {
		//Open the Age Adder Window
		var NumberAdults = document.frmTrip.NumberAdults.value;
		var NumberChildren = document.frmTrip.NumberChildren.value;
		var AdultAges = document.frmTrip.AdultAges.value;
		var ChildAges = document.frmTrip.ChildAges.value;
//		var TripId = document.frmTrip.TripId.value;
		var RaiseAlert = false;

		var checkadults = true
		var functionstr224 = "";
		if (typeof(function224) != 'undefined')
		{
			functionstr224 = "&function224=1";
			checkadults = false
		}


		if ( (NumberAdults != '' && checkadults == true) || NumberChildren != '')
		{
			if ( (isNaN(NumberAdults) == false) && (isNaN(NumberChildren) == false) ) {
				var parameters = 'width=350,height=280,scrollbars=yes,resizable=yes,top=190,left=230,toolbar=no,menubar=no,status=no,location=no,directories=no';
				var PageURL = 'AddAges.asp?NumberAdults=' + NumberAdults + '&NumberChildren=' + NumberChildren + '&AdultAges=' + AdultAges + '&ChildAges=' + ChildAges + functionstr224;
				window.open(PageURL,'add_ages',parameters);
			}
			else {
				RaiseAlert = true;
			}
		}
		else {
			RaiseAlert = true;
		}
		
		if (RaiseAlert == true)
		{
			if(checkadults == true)
				alert('Sorry, this function is only available when "# of Adults" or "# of Children" has been filled out\nand the number is a single valid number.');
			else
				alert('Sorry, this function is only available when "# of Children" has been filled out\nand the number is a single valid number.');
		}
	}

	function RequestPassword() {
		if (document.frmTrip.LookupEmail.value == '') {
			alert('You must supply your email address to continue.');
		}
		else {
			var parameters = 'width=350,height=200,scrollbars=yes,resizable=yes,top=190,left=230,toolbar=no,menubar=no,status=no,location=no,directories=no';
			var PageURL = 'RequestPassword.asp?Email=' + document.frmTrip.LookupEmail.value;
			window.open(PageURL,'password_request',parameters);
		}
	}
	
	function PrintPlanner() {
		var parameters;
		var window_name;
		//Open window for printing Trip Request
		parameters = 'width=670,height=400,scrollbars=yes,resizable=yes,top=20,left=20,toolbar=yes,menubar=yes,status=yes,location=no,directories=no';
		window_name = window.open('TripPrint.asp','print_window',parameters);
		//print_window.parent.document.location.href = 'TripPrint.asp';
	}


