var UALCS = {
	commonSubmit:function() {
		UALCS.m_Form.subject.value = UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].subject;
		UALCS.m_Form.toEmail.value = UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].emailTo;
		document.getElementById("vMessageType").value=UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].selectName;

		return true;
	},
	commonValidate: function(){
								var sMP = UALCS.getField("formMileagePlusNumber");
				if(sMP && sMP != "") {
					if(!UALCS.isMpNumber(sMP)) {
						UALCS.setFieldInvalid("formMileagePlusNumber");
						UALCS.addWarning("The Mileage Plus number provided is not valid, please re-enter it.\n");
					}
					else {
						UALCS.setFieldValid("formMileagePlusNumber");
					}
				}
				else {
					UALCS.setFieldValid("formMileagePlusNumber");
				}
				UALCS.checkField("formMileagePlusMembershipLevel", "Membership Level", "select");
				UALCS.checkField("formEmail", "Email Address", "email");

},

	noEmailSubmit:function() {
		UALCS.m_Form.subject.value = UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].subject;
		document.getElementById("vMessageType").value=UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].selectName;
		return true;
	},

	formValid:function() {
		if(UALCS.m_iValidationWarnings == 0)
			return true;
		else
			return false;
	},

	resetValidation: function() {
		UALCS.m_sValidationWarning = "";
		UALCS.m_iValidationWarnings = 0;
	},

	setFieldInvalid:function(fieldName) {
		var eField = null;
		eval("eField=UALCS.m_Form." + fieldName);
		if(eField) {
			eField.className='validationError';
		}
	},

	setFieldValid:function(fieldName) {
		var eField = null;
		eval("eField=UALCS.m_Form." + fieldName);
		if(eField) {
			eField.className = '';
		}
	},

	addWarning: function(sWarning) {
		if(UALCS.m_iValidationWarnings == 0)
			UALCS.m_sValidationWarning = "The following fields are required, please provide them and resubmit.\n";
		UALCS.m_iValidationWarnings++;
		UALCS.m_sValidationWarning += sWarning;
	},

	checkField: function(fieldName, selectName, sType) {
		if(sType == "email") {
			var bGood = false;
			if(!UALCS.isFieldEmpty(fieldName, sType)) {
				if(UALCS.isEmail(UALCS.getField(fieldName, sType))) {
					bGood = true;
				}
			}

			if(!bGood) {
				UALCS.addWarning("The email address provided is not valid, please recheck it and resubmit.\n");
				this.setFieldInvalid(fieldName);
			}
			else {
				this.setFieldValid(fieldName);
			}
		}
		else if(sType == "radio") {
			var sValChk = UALCS.radioValue(fieldName);
			if(!sValChk || sValChk == "") {
				UALCS.addWarning("Please provide " + selectName + ".\n");
				this.setFieldInvalid(fieldName);
			}
			else {
				this.setFieldValid(fieldName);
			}
		}
		else if(sType == "number") {
			if(!UALCS.isNumeric(fieldName, "")) {
				UALCS.addWarning("Please provide a number for " + selectName + ".\n");
				this.setFieldInvalid(fieldName);
			}
			else {
				this.setFieldValid(fieldName);
			}
		}
		else if(sType == "phone") {
			if(!UALCS.isNumeric(fieldName, ".-)(")) {
				UALCS.addWarning("Please check " + selectName + ", it contains invalid characters.\n");
				this.setFieldInvalid(fieldName);
			}
			else {
				this.setFieldValid(fieldName);
			}
		}
		else if(sType == "tenplus") {
			if(!UALCS.isNumeric(fieldName, "")) {
				if(eval(UALCS.getField(fieldName, sType)) <= 10) {
					UALCS.addWarning(selectName + " size minimum is 10.\n");
					this.setFieldInvalid(fieldName);
				}
				else {
					this.setFieldValid(fieldName);
				}
			}
			else {
				this.setFieldValid(fieldName);
			}
		}
		else {
			if(UALCS.isFieldEmpty(fieldName, sType)) {
				UALCS.addWarning("Please provide " + selectName + ".\n");
				eval("UALCS.m_Form." + fieldName + ".className='validationError';");
			}
			else {
				eval("UALCS.m_Form." + fieldName + ".className='';");
			}
		}
	},

	m_aFormSections:[
		{//0
			cssID:"welcomeForm",
			selectName:"Please Select",
			displayName:"Please Select",
			subject:"",
			emailTo:"",
			headerText:"At united.com, we offer an extensive customer service portal designed to answer all your questions, quickly and easily. Before sending an email, please select the <b>Browse tab</b> to review our customer service categories. Still have a question? Use the dropdown menu above to select the department you wish to contact directly.",
			doSubmit:function() {
				return false;
			}
		},
		{//1
			cssID:"baggageForm",
			selectName:"Email Baggage Services",
			displayName:"Email Baggage Services",
			subject:"Web Request for Baggage Services",
			emailTo:"BaggageFormEmail",
			headerText:"",


			doValidation:function(bShowWarning) {
				UALCS.resetValidation();
				UALCS.commonValidate();

				UALCS.checkField("formFirstName", "First Name");
				UALCS.checkField("formLastName", "Last Name");
				UALCS.checkField("formStreetAddress1", "Street Address");
				UALCS.checkField("formCity", "City");
				UALCS.checkField("formState", "State", "select_non_zero");
				UALCS.checkField("formZipCode", "Zip");
				UALCS.checkField("formDateTraveled", "Date traveled");
				UALCS.checkField("formOriginCity", "Origin city");
				UALCS.checkField("formDestinationCity", "Destination city");
				UALCS.checkField("formFiledCity", "City reported at");

				var sSpecificType = "";
				if(UALCS.m_Form.bagFormMissingItems.checked) {
					sSpecificType += "Missing Items "
				}
				if(UALCS.m_Form.bagFormMissingBag.checked) {
					sSpecificType += "Missing Bag "
				}
				if(UALCS.m_Form.bagFormLostArticle.checked) {
					sSpecificType += "Lost Article "
				}
				if(UALCS.m_Form.bagFormDamagedBag.checked) {
					sSpecificType += "Damaged Bag"
				}
				if(sSpecificType == "") {
					UALCS.addWarning("Please select the type of claim.");
				}

				if(!UALCS.formValid()) {
					if(bShowWarning)
						alert(UALCS.m_sValidationWarning);
					return false;
				}
				else {
					return true;
				}
			},

			doSubmit:function() {
				if(this.doValidation(true)) {
					document.getElementById("vEmail").value			= UALCS.m_Form.formEmail.value;
					document.getElementById("vFirstName").value		= UALCS.m_Form.formFirstName.value;
					document.getElementById("vLastName").value		= UALCS.m_Form.formLastName.value;
					document.getElementById("vFullName").value		= UALCS.m_Form.formPrefix.options[UALCS.m_Form.formPrefix.selectedIndex].value + " " + UALCS.m_Form.formFirstName.value + " " + UALCS.m_Form.formLastName.value;
<!--new for XML SHDavis 1/4/08-->
document.getElementById("vSendEmailResponse").value = "Yes";
					document.getElementById("vMileagePlusNumber").value	= UALCS.m_Form.formMileagePlusNumber.value;
					document.getElementById("vMileagePlusMembershipLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].value;
					document.getElementById("vMPLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].text;
					document.getElementById("vStreetAddress1").value	= UALCS.m_Form.formStreetAddress1.value;
					document.getElementById("vStreetAddress2").value	= UALCS.m_Form.formStreetAddress2.value;
					document.getElementById("vCity").value			= UALCS.m_Form.formCity.value;
					document.getElementById("vState").value			= UALCS.m_Form.formState.options[UALCS.m_Form.formState.selectedIndex].value;
					document.getElementById("vZipCode").value		= UALCS.m_Form.formZipCode.value;
					document.getElementById("vCountry").value		= UALCS.m_Form.formCountry.value;
					document.getElementById("vPhone").value			= UALCS.m_Form.formPhoneNumber.value;
					document.getElementById("vPrefix").value			= UALCS.m_Form.formPrefix.options[UALCS.m_Form.formPrefix.selectedIndex].value;

					if(UALCS.m_Form.formMessage.value != null && UALCS.m_Form.formMessage.value != "") {
						var message = UALCS.stripNonUTF8(UALCS.m_Form.formMessage.value);
						//alert("here is message: "+message);
UALCS.m_Form.searchstring.value = message;
UALCS.m_Form.question.value = message;
					}

					document.getElementById("vDateTraveled").value			= UALCS.m_Form.formDateTraveled.value;
					document.getElementById("vFlightNumber").value			= UALCS.m_Form.formFlightNumber.value;
					document.getElementById("vOriginCity").value			= UALCS.m_Form.formOriginCity.value;
					document.getElementById("vDestinationCity").value		= UALCS.m_Form.formDestinationCity.value;
					document.getElementById("vFiledCity").value				= UALCS.m_Form.formFiledCity.value;
					document.getElementById("vReportLocator").value			= UALCS.m_Form.formReportLocator.value;
					UALCS.commonSubmit();



					//adjust the type
					var sSpecificType = "";
					if(UALCS.m_Form.bagFormMissingItems.checked) {
						sSpecificType += "Missing Items "
					}
					if(UALCS.m_Form.bagFormMissingBag.checked) {
						sSpecificType += "Missing Bag "
					}
					if(UALCS.m_Form.bagFormLostArticle.checked) {
						sSpecificType += "Lost Article "
					}
					if(UALCS.m_Form.bagFormDamagedBag.checked) {
						sSpecificType += "Damaged Bag"
					}
					if(sSpecificType != "")
						document.getElementById("vMessageType").value += " : " + sSpecificType;

					return true;
				}
				else {
					return false;
				}
			}
		},
		{//2
			//cssID:"custRelForm",
			cssID:"customerrelationsForm",
			selectName:"Email Customer Relations",
			displayName:"Email Customer Relations",
			subject:"Web Request for Customer Relations",
			emailTo:"CustomerRelationsEmail",
			headerText:'<div class="t9"><p class="t9">At United, we are committed to serving our customers and we value your feedback.  United&#8217;s Customer Relations team focuses on responding to general inquiries, as well as issues related to past travel.<br><br>If your question or concern relates to future travel (questions about your reservation, seat issues, etc.), please contact United Reservations to receive immediate attention. United Reservations can be reached at <nobr>1-800-UNITED-1</nobr> <nobr>(1-800-864-8331)</nobr> from the U.S. and Canada, 24 hours a day, 7 days a week.<br><br> If you are calling from a location outside of the U.S. and Canada, please see <a href="http://www.united.com/page/article/0,1360,50394,00.html">United worldwide contacts</a> for the appropriate contact information.<br><br>For matters other than future travel, please fill in the information below and our Customer Relations team will be happy to assist you. You can expect a reply to your inquiry within 5 business days. To ensure delivery of our reply email, please make sure that emails from United are not blocked by your email account. </p></div><hr style="margin-right: 150px;"/>',
			doValidation:function(bShowWarning) {

				UALCS.resetValidation();
				UALCS.commonValidate();

				UALCS.checkField("formEmailResponse", "response required", "radio");
				UALCS.checkField("formMessageType", "message type", "radio");
				UALCS.checkField("formFirstName", "First Name");
				UALCS.checkField("formLastName", "Last Name");
				UALCS.checkField("formStreetAddress1", "Street Address");
				UALCS.checkField("formCity", "City");
				UALCS.checkField("formState", "State", "select_non_zero");
				UALCS.checkField("formZipCode", "Zip / Postal Code");
				UALCS.checkField("formMessage", "Message");
				if(!UALCS.formValid()) {
					if(bShowWarning)
						alert(UALCS.m_sValidationWarning);
					return false;
				}
				else {
					return true;
				}
			},

			doSubmit:function() {
				if(this.doValidation(true)) {
					document.getElementById("vEmail").value			= UALCS.m_Form.formEmail.value;
					document.getElementById("vFirstName").value		= UALCS.m_Form.formFirstName.value;
					document.getElementById("vLastName").value		= UALCS.m_Form.formLastName.value;
					document.getElementById("vFullName").value		= UALCS.m_Form.formPrefix.options[UALCS.m_Form.formPrefix.selectedIndex].value + " " + UALCS.m_Form.formFirstName.value + " " + UALCS.m_Form.formLastName.value;
					document.getElementById("vMileagePlusNumber").value	= UALCS.m_Form.formMileagePlusNumber.value;
					document.getElementById("vMileagePlusMembershipLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].value;
					document.getElementById("vMPLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].text;
					document.getElementById("vStreetAddress1").value= UALCS.m_Form.formStreetAddress1.value;
					document.getElementById("vStreetAddress2").value	= UALCS.m_Form.formStreetAddress2.value;
					document.getElementById("vCity").value			= UALCS.m_Form.formCity.value;
					document.getElementById("vState").value			= UALCS.m_Form.formState.options[UALCS.m_Form.formState.selectedIndex].value;
					document.getElementById("vZipCode").value		= UALCS.m_Form.formZipCode.value;
					document.getElementById("vCountry").value		= UALCS.m_Form.formCountry.value;
					document.getElementById("vPhone").value			= UALCS.m_Form.formPhoneNumber.value;
					document.getElementById("vPrefix").value		= UALCS.m_Form.formPrefix.options[UALCS.m_Form.formPrefix.selectedIndex].value;

					if(UALCS.m_Form.formMessage.value != null && UALCS.m_Form.formMessage.value != "") {
						var message = UALCS.stripNonUTF8(UALCS.m_Form.formMessage.value);
						//alert("here is message: "+message);
UALCS.m_Form.searchstring.value = message;
UALCS.m_Form.question.value = message;
					}

					document.getElementById("vTicketNumber").value			= UALCS.m_Form.formTicketNumber.value;
					document.getElementById("vDateTraveled").value			= UALCS.m_Form.formDateTraveled.value;
					document.getElementById("vFlightNumber").value			= UALCS.m_Form.formFlightNumber.value;
					document.getElementById("vOriginCity").value			= UALCS.m_Form.formOriginCity.value;
					document.getElementById("vDestinationCity").value		= UALCS.m_Form.formDestinationCity.value;
					document.getElementById("vSendEmailResponse").value	= UALCS.radioValue("formEmailResponse");

					if(UALCS.radioValue("formEmailResponse") == "Yes") {
						if(UALCS.radioValue("formMessageType") == "Complaint") {
							UALCS.m_Form.toEmail.value = "CustomerRelationsComplaintResponder";
						}
						else {
							UALCS.m_Form.toEmail.value = "CustomerRelationsNonComplaintResponder";
						}
					}
					else {
						UALCS.m_Form.toEmail.value = "CustomerRelationsEmail";
					}

					UALCS.noEmailSubmit();
					document.getElementById("vMessageType").value += " " + UALCS.radioValue("formMessageType");
					return true;
				}
				else {
					return false;
				}
			}
		},
		{//3
			cssID:"groupPlusForm",
			selectName:"GroupsPlus request form",
			displayName:"GroupsPlus request form",
			subject:"Web Request regarding GroupPlus",
			emailTo:"GroupPlusEmail",
			headerText:"To request a GroupsPlus contract for 10 or more passengers traveling together on the same flight(s), complete and submit this form.",
			doValidation:function(bShowWarning) {
				UALCS.resetValidation();
				UALCS.commonValidate();

				UALCS.checkField("formFullName", "Contact Name");
				UALCS.checkField("formPhoneNumber", "Phone number");
				UALCS.checkField("formStreetAddress1", "Address");
				UALCS.checkField("formCity", "City");
				UALCS.checkField("formState", "State / Province");
				UALCS.checkField("formZipCode", "Zip / Postal Code");
				UALCS.checkField("formCheckCountry", "Country", "radio");
				UALCS.checkField("formGroupName", "Name of group");
				UALCS.checkField("formDepartureAirport", "Depature airport");
				UALCS.checkField("formDestinationAirport", "Destination airport");
				UALCS.checkField("formDepartureDate", "Departure date");
				UALCS.checkField("formDepartureTime", "Departure time");
				UALCS.checkField("formReturnDate", "Return date");
				UALCS.checkField("formReturnTime", "Return time");
				UALCS.checkField("formClassOfService", "Class of service", "select_non_zero");
				UALCS.checkField("formPassengers", "How many passengers");

				if(!UALCS.formValid()) {
					if(bShowWarning)
						alert(UALCS.m_sValidationWarning);
					return false;
				}
				else {
					return true;
				}
			},

			doSubmit:function() {
				if(this.doValidation(true)) {
					document.getElementById("vEmail").value			= UALCS.m_Form.formEmail.value;
					document.getElementById("vFullName").value		= UALCS.m_Form.formFullName.value;
					document.getElementById("vTitle").value		= UALCS.m_Form.formTitle.value;
					document.getElementById("vOrganization").value		= UALCS.m_Form.formOrganization.value;
					document.getElementById("vPhone").value			= UALCS.m_Form.formPhoneNumber.value;
					document.getElementById("vFaxNumber").value		= UALCS.m_Form.formFaxNumber.value;
					document.getElementById("vStreetAddress1").value		= UALCS.m_Form.formStreetAddress1.value;
					document.getElementById("vStreetAddress2").value		= UALCS.m_Form.formStreetAddress2.value;
					document.getElementById("vCity").value		= UALCS.m_Form.formCity.value;
					document.getElementById("vState").value		= UALCS.m_Form.formState.value;
					document.getElementById("vZipCode").value		= UALCS.m_Form.formZipCode.value;
					document.getElementById("vCountry").value		= UALCS.radioValue("formCheckCountry");
					document.getElementById("vMileagePlusNumber").value		= UALCS.m_Form.formMileagePlusNumber.value;
					document.getElementById("vDeliveryMethod").value		= UALCS.radioValue("formDeliveryMethod");
					document.getElementById("vAgencyName").value		= UALCS.m_Form.formAgencyName.value;
					document.getElementById("vAgencyARC_IATA").value		= UALCS.m_Form.formAgencyARC.value;
					document.getElementById("vGroupName").value		= UALCS.m_Form.formGroupName.value;
					document.getElementById("vOriginCity").value		= UALCS.m_Form.formDepartureAirport.value;
					document.getElementById("vDestinationCity").value		= UALCS.m_Form.formDestinationAirport.value;
					document.getElementById("vDepartureDate").value		= UALCS.m_Form.formDepartureDate.value;
					document.getElementById("vDepartureTime").value		= UALCS.m_Form.formDepartureTime.value;
					document.getElementById("vReturnDate").value		= UALCS.m_Form.formReturnDate.value;
					document.getElementById("vReturnTime").value		= UALCS.m_Form.formReturnTime.value;
					document.getElementById("vClassOfService").value	= UALCS.m_Form.formClassOfService.options[UALCS.m_Form.formClassOfService.selectedIndex].value;
					document.getElementById("vPassengers").value		= UALCS.m_Form.formPassengers.value;

					if(UALCS.m_Form.formMessage.value != null && UALCS.m_Form.formMessage.value != "") {
						var message = UALCS.stripNonUTF8(UALCS.m_Form.formMessage.value);
UALCS.m_Form.question.value = UALCS.m_Form.searchstring.value = message;
					}

					if(UALCS.radioValue("formTicketingTo") == "Inernational") {
						UALCS.m_Form.toEmail.value = "GroupPlusCanada";
					}
					else {
						UALCS.m_Form.toEmail.value = UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].emailTo;
					}
					return UALCS.noEmailSubmit();
				}
				else {
					return false;
				}
			}
		},
		{//4
			cssID:"mpForm",
			selectName:"Email Mileage Plus",
			displayName:"Email Mileage Plus",
			subject:"Web Request for Mileage Plus",
			headerText:'Mileage Plus Customer Service is committed to providing our members with excellent service.  Our dedicated team would be happy to respond to your questions related to the Mileage Plus program, flight and non-flight bonus miles and promotional offers. We also welcome questions on other ways to increase your mileage balance to maximize the benefits of the Mileage Plus program. <div class="t9">Please provide the following information for verification purposes:</div>',
			emailTo:"MileagePlusEmail",

			doValidation:function(bShowWarning) {
				UALCS.resetValidation();
				UALCS.commonValidate();

				UALCS.checkField("formFirstName", "First Name");
				UALCS.checkField("formLastName", "Last Name");
				UALCS.checkField("formMessage", "Message");

				if(!UALCS.formValid()) {
					if(bShowWarning)
						alert(UALCS.m_sValidationWarning);
					return false;
				}
				else {
					return true;
				}
			},

			doSubmit:function() {
				if(this.doValidation(true)) {
					document.getElementById("vEmail").value			= UALCS.m_Form.formEmail.value;
					document.getElementById("vFirstName").value		= UALCS.m_Form.formFirstName.value;
					document.getElementById("vLastName").value		= UALCS.m_Form.formLastName.value;
					document.getElementById("vFullName").value		= UALCS.m_Form.formFirstName.value + " " + UALCS.m_Form.formLastName.value;
					document.getElementById("vSendEmailResponse").value = "Yes";
					document.getElementById("vMileagePlusNumber").value	= UALCS.m_Form.formMileagePlusNumber.value;
					document.getElementById("vMileagePlusMembershipLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].value;
					document.getElementById("vMPLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].text;
					document.getElementById("vZipCode").value 		= UALCS.m_Form.formZipCode.value;

					if(UALCS.m_Form.formMessage.value != null && UALCS.m_Form.formMessage.value != "") {
						var message = UALCS.stripNonUTF8(UALCS.m_Form.formMessage.value);
						//alert("here is message: "+message);
UALCS.m_Form.question.value = UALCS.m_Form.searchstring.value = message;
					}

					var sLevChk = document.getElementById("vMileagePlusMembershipLevel").value;
					if(sLevChk && (sLevChk == "premier_exec" || sLevChk == "1k")) {
						UALCS.m_Form.toEmail.value = "MileagePlusPremier";
						UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].subject = "Web Request for Mileage Plus Premier"
					}
					else {
						UALCS.m_Form.toEmail.value = UALCS.m_aFormSections[UALCS.m_Form.formSel.selectedIndex].emailTo;
					}

					return UALCS.noEmailSubmit();
				}
				else {
					return false;
				}
			}
		},
		{//5
			cssID:"rccForm",
			selectName:"Email Red Carpet Club",
			displayName:"Email Red Carpet Club",
			subject:"Web Request for Red Carpet Club",
			emailTo:"RedCarpetClubEmail",
			headerText:"",
			doValidation:function(bShowWarning) {
				UALCS.resetValidation();
				UALCS.commonValidate();

				UALCS.checkField("formFirstName", "First Name");
				UALCS.checkField("formLastName", "Last Name");
				UALCS.checkField("formZipCode", "Zip / Postal Code");

				if(!UALCS.formValid()) {
					if(bShowWarning)
						alert(UALCS.m_sValidationWarning);
					return false;
					}
					else {
					return true;
					}
			},

			doSubmit:function() {
				if(this.doValidation(true)) {
					document.getElementById("vEmail").value			= UALCS.m_Form.formEmail.value;
					document.getElementById("vFirstName").value		= UALCS.m_Form.formFirstName.value;
					document.getElementById("vLastName").value		= UALCS.m_Form.formLastName.value;
					document.getElementById("vFullName").value		= UALCS.m_Form.formFirstName.value + " " + UALCS.m_Form.formLastName.value;
					document.getElementById("vMileagePlusNumber").value	= UALCS.m_Form.formMileagePlusNumber.value;
					document.getElementById("vMileagePlusMembershipLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].value;
					document.getElementById("vMPLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].text;
					document.getElementById("vZipCode").value			= UALCS.m_Form.formZipCode.value;

					if(UALCS.m_Form.formMessage.value != null && UALCS.m_Form.formMessage.value != "") {
						var message = UALCS.stripNonUTF8(UALCS.m_Form.formMessage.value);
						//alert("here is message: "+message);
						UALCS.m_Form.question.value = UALCS.m_Form.searchstring.value = message;
					}
					return UALCS.commonSubmit();
				}
				else {
					return false;
				}
			}
		},
		{//6
			cssID:"teForm",
			selectName:"Travel enhancements",
			displayName:"Email United",
			subject:"Web Request for Travel enhancements",
			emailTo:"TravelStoreEmail",
			headerText:"",
			doValidation:function(bShowWarning) {
				UALCS.resetValidation();
				UALCS.commonValidate();
//				UALCS.checkField("formEmail", "Email Address", "email");
//				UALCS.checkField("formMileagePlusMembershipLevel", "Membership Level", "select");

				UALCS.checkField("formFirstName", "First Name");
				UALCS.checkField("formLastName", "Last Name");
				UALCS.checkField("formZipCode", "Zip / Postal Code");


				if(!UALCS.formValid()) {
					if(bShowWarning)
						alert(UALCS.m_sValidationWarning);
					return false;
				}
				else {
					return true;
				}
			},

			doSubmit:function() {
				if(this.doValidation(true)) {
					document.getElementById("vEmail").value			= UALCS.m_Form.formEmail.value;
					document.getElementById("vFirstName").value		= UALCS.m_Form.formFirstName.value;
					document.getElementById("vLastName").value		= UALCS.m_Form.formLastName.value;
					document.getElementById("vFullName").value		= UALCS.m_Form.formFirstName.value + " " + UALCS.m_Form.formLastName.value;
					document.getElementById("vMileagePlusNumber").value	= UALCS.m_Form.formMileagePlusNumber.value;
					document.getElementById("vMileagePlusMembershipLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].value;
					document.getElementById("vMPLevel").value= UALCS.m_Form.formMileagePlusMembershipLevel.options[UALCS.m_Form.formMileagePlusMembershipLevel.selectedIndex].text;
					document.getElementById("vZipCode").value			= UALCS.m_Form.formZipCode.value;
					document.getElementById("vReportLocator").value= UALCS.m_Form.formOrderNo.value;

					if(UALCS.m_Form.formMessage.value != null && UALCS.m_Form.formMessage.value != "") {
						var message = UALCS.stripNonUTF8(UALCS.m_Form.formMessage.value);
						//alert("here is message: "+message);
UALCS.m_Form.question.value = UALCS.m_Form.searchstring.value = message;
					}
					return UALCS.commonSubmit();
				}
				else {
					return false;
				}
			}
		}
	],

	olh:function(h){if(window.addEventListener){window.addEventListener("load",h,false);}else if(window.attachEvent){window.attachEvent("onload",h);}else if(window.onload){var oH=window.onload;window.onload=function pB(){oH();h();};}else{window.onload=h;}},
	unescape:function(st){while(st.indexOf('+')>=0){st = st.replace('+',' ');}st=unescape(st);return st;},
	escape:function(st){st=escape(st);st=st.replace('+','%2B');return st;},

	doLoad:function() {
		var iDefault = 0;
//add to form sel list
		$('#formSel').length = 0;
		if(document.tForm){
			$(UALCS.m_aFormSections).each(function(i){
				document.tform.formSel.options[i] = new Option(this.selectName,this.cssID);
			});
		}
	//yank variables from the URL string
		var minNav3 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3)
		var minIE4 = (navigator.appName.indexOf("Microsoft") >= 0 && parseInt(navigator.appVersion) >= 4)
		var minDOM = minNav3 || minIE4   // baseline DOM required for this function
		if (minDOM) {
			var results = new Array()
			var input = unescape(location.search.substr(1))
			if (input) {
				var srchArray = input.split("&")
				var tempArray = new Array()
				for (var i = 0; i < srchArray.length; i++) {
					tempArray = srchArray[i].split("=")
					results[tempArray[0]] = tempArray[1]
				}
			}
		//results['form'] = ' baggageForm.htm';//testing

		//see if 'form' parameter exists
				if (results['form']) {
					
			//strip spaces, representation of spaces and .htm from string
			results['form'] = results['form'].replace(/.htm/,'');
			results['form'] = results['form'].replace(/\s/g,'');
			results['form'] = results['form'].replace(/u0020/g,'');
				
			//sDefault is the value of form parameter
					var sDefault = results['form'];
					
					//loop through sections and see if sDefault exists as one of the forms
					$(UALCS.m_aFormSections).each(function(i){
						if(sDefault == this.cssID || sDefault == this.selectName) {
							iDefault = i; //iDefault is the index assoc with sDefault
			}
					});
		}
		} //end mindom

		//find our form
		var eFormSel = document.getElementById("formSel");
		if(eFormSel) {
			var eForm = eFormSel.parentNode;
			while(eForm && eForm.nodeName.toUpperCase() != "FORM") {
				eForm = eForm.parentNode;
			}
			if(eForm.nodeName.toUpperCase() == "FORM") {
				UALCS.m_Form = eForm;
				//attach on submit handlers here
				UALCS.functionPrevSubmit = eForm.onsubmit;
				eForm.onsubmit=function() {
					if(UALCS.m_aFormSections[eFormSel.selectedIndex].doSubmit()) {
						if(UALCS.functionPrevSubmit)
							return UALCS.functionPrevSubmit();
						else
							return true;
					}
					else {
						return false;
					}
				};
			}
			else {
				UALCS.m_Form = null;
			}

			UALCS.m_SubmitButton = document.getElementById("Submit1");

			if(iDefault == 0)  $("#Submit1").hide();



			eFormSel.selectedIndex = iDefault; //doesn't seem to be wokring in FF2
			document.tform.formSel.selectedIndex = iDefault; //try this format
			eFormSel.onchange = function() {
 				UALCS.selectNewForm(this.selectedIndex);
			};
		}

		UALCS.selectNewForm(iDefault);
		//testing
		//if(isDefined(myCookies['vendorMP'])) {window.status= myCookies['vendorMP']}	
		//results['mbrlvl'] = 6;
		//alert("here is results mbmlvl: "+results['mbrlvl']);
		//if (results['mbrlvl'] ) {
			//if(document.tform.formMileagePlusMembershipLevel){document.tform.formMileagePlusMembershipLevel.selectedIndex = results['mbrlvl']};
			//if(document.tform.bagFormMileagePlusNumber){document.tform.bagFormMileagePlusNumber.selectedIndex = results['mbrlvl']};
			//if(document.tform.custFormMileagePlusNumber){document.tform.custFormMileagePlusNumber.selectedIndex = results['mbrlvl']};
			//if(document.tform.gpFormMileagePlusNumber){document.tform.gpFormMileagePlusNumber.selectedIndex = results['mbrlvl']};
			//if(document.tform.mpFormMileagePlusNumber){document.tform.mpFormMileagePlusNumber.selectedIndex = results['mbrlvl']};
			//if(document.tform.rccFormMileagePlusNumber){document.tform.rccFormMileagePlusNumber.selectedIndex = results['mbrlvl']};
		//}
		if(document.tform && isDefined(myCookies['vendorMP']) && document.tform.bagFormMileagePlusNumber){document.tform.bagFormMileagePlusNumber.value=myCookies['vendorMP']};
		if(document.tform && isDefined(myCookies['vendorMP']) && document.tform.custFormMileagePlusNumber){document.tform.custFormMileagePlusNumber.value=myCookies['vendorMP']};
		if(document.tform && isDefined(myCookies['vendorMP']) && document.tform.mpFormMileagePlusNumber){document.tform.mpFormMileagePlusNumber.value=myCookies['vendorMP']};
		if(document.tform && isDefined(myCookies['vendorMP']) && document.tform.rccFormMileagePlusNumber){document.tform.rccFormMileagePlusNumber.value=myCookies['vendorMP']};
		
	},

	selectNewForm: function(iIndex) {
		//var eSel = document.getElementById(UALCS.m_aFormSections[iIndex].cssID);

		//hide non-used fields and header text
		$(UALCS.m_aFormSections).each(function(){
		$("."+this.cssID).hide();
		});
		$("#headerText, #Submit1").hide();
		//reveal new content
		$(".t1").html(UALCS.m_aFormSections[iIndex].displayName);
		$("#headerText").html(UALCS.m_aFormSections[iIndex].headerText).fadeIn('slow');
		$("."+UALCS.m_aFormSections[iIndex].cssID).fadeIn('slow');
		if(iIndex !=0){$("#Submit1").fadeIn('slow')}

	},

	isFieldEmpty: function(fieldName, sType) {
		var fv = UALCS.getField(fieldName, sType);
		if(fv == null || fv == "" || (sType == "select_non_zero" && fv == "0") ) {
			return true;
		}
		else {
			return false;
		}
	},

	getField: function(fieldName, sType) {
		var sVal = null;
		if(sType == "select" || sType == "select_non_zero") {
			eval("sVal=UALCS.m_Form." + fieldName + ".options[UALCS.m_Form." + fieldName + ".selectedIndex].value;");
		}
		else {
			eval("sVal=UALCS.m_Form." + fieldName + ".value;");
		}
		if(sVal)
			return UALCS.trimString(sVal);
		else
			return null;
	},

	radioValue: function(fieldName) {
		var btn;
		eval("btn=UALCS.m_Form." + fieldName + ";");
    	var cnt = -1;
		for (var i=btn.length-1; i > -1; i--) {
        	if (btn[i].checked) {cnt = i; i = -1;}
		}
		if (cnt > -1) return btn[cnt].value;
		else return null;
	},

	isDigit: function(c) {
    	return((c>="0")&&(c<="9"))
	},

	isNumeric: function(a,addChars) {
    	var i;
		if (a.value.length == 0) {
        	return true;
		}
		for(i=0;i < a.value.length;i++) {
			var c=a.value.charAt(i);
			if (!UALCS.isDigit(c) && !UALCS.isCharInString(c,addChars)) {
            	return false;
			}
		}
		return true;
	},

	isCharInString: function(sc,s) {
    	return(!sc||!s)?false:(s.indexOf(sc)>-1)?true:false;
	},

	isMpNumber: function(MPNO){
		 if(MPNO != null && MPNO.length == 11 && !(MPNO =="00000000000")) {
			var s = MPNO;
			var  w60count1 =0;
			var  w60count2 = 0;
			w60count1 = s.substring(0,1) * 5 + s.substring(1,2) * 4 + s.substring(2,3) * 3 + s.substring(3,4) * 2 + s.substring(4,5) * 7 + s.substring(5,6) * 6 + s.substring(6,7) * 5 + s.substring(7,8) * 4 + s.substring(8,9) * 3 + s.substring(9,10) * 2;
			var w60remainder = w60count1 % 11;
			w60count1 = w60count1/11;
			if (w60remainder != 0) w60count2 = 11 - w60remainder; else w60count2 = 0;
			if (w60count2 == 10) w60count2 = 0;
			if (w60count2 != s.substring(10)) return false; else return true;
		}
		return false;
	},

	isEmail: function(str) {
		if(!str) return false;
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1)  return false;
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
		if (str.indexOf(at,(lat+1))!=-1) return false;
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
		if (str.indexOf(dot,(lat+2))==-1) return false;
		if (str.indexOf(" ")!=-1) return false;
 		return true;
	},
	stripNonUTF8: function(s) {
		//  replace ? with '--'
		s = s.replace(/([\u00EF][\u201A][\u00A7])/g, '--');
		// replace • with  '---'
		s = s.replace(/([\u00E2][\u20AC][\u00A2])/g, '---');
		// replace ’ with "'"
		s = s.replace(/([\u00E2][\u20AC][\u2122])/g, "'");
		//replace any character outside of [space] through tilde with '*'
		s = s.replace(/[^\x20-\x7F]/g, '*');
		return s;
	},
	trimString: function(_data) {
	  return _data.replace(/^\s+|\s+$/g, '');
	}

};

UALCS.olh(UALCS.doLoad);
$(document).ready(function() {
	// call image from ua2go to keep session alive
	var alive = new Image(1,1);
	alive.src = "http://www.ua2go.com/ci/images/c.gif";
													 });
