/* Release 5.2 */

if (window.ualhpDate) 
	{}/*do nothing, see else{} statement below, for some reason !window doesnt work*/
else 
	{
		var ff29clientDate = new Date();
		if (ff29clientDate.getMonth()==0){ff29clientmonth="Jan"} if (ff29clientDate.getMonth()==1){ff29clientmonth="Feb"}
		if (ff29clientDate.getMonth()==2){ff29clientmonth="Mar"} if (ff29clientDate.getMonth()==3){ff29clientmonth="Apr"}
		if (ff29clientDate.getMonth()==4){ff29clientmonth="May"} if (ff29clientDate.getMonth()==5){ff29clientmonth="Jun"}
		if (ff29clientDate.getMonth()==6){ff29clientmonth="Jul"} if (ff29clientDate.getMonth()==7){ff29clientmonth="Aug"}
		if (ff29clientDate.getMonth()==8){ff29clientmonth="Sep"} if (ff29clientDate.getMonth()==9){ff29clientmonth="Oct"}
		if (ff29clientDate.getMonth()==10){ff29clientmonth="Nov"} if (ff29clientDate.getMonth()==11){ff29clientmonth="Dec"}
		ualhpDate = "NONE "+ff29clientmonth+" "+ff29makedoubledigit(ff29clientDate.getDate())+" NO:NE:NO NONE "+ff29clientDate.getFullYear();
}
var ualHPdateArray = new Array(); ualHPdateArray = ualhpDate.split(' ');
var ualHPtodaysMonth = ualHPdateArray[1]; var ualHPtodaysDay = ualHPdateArray[2]; var ualHPtodaysYear = ualHPdateArray[5];
if (ualHPtodaysMonth=="Jan"){ualHPtodaysMonth=0;} if (ualHPtodaysMonth=="Feb"){ualHPtodaysMonth=1;}
if (ualHPtodaysMonth=="Mar"){ualHPtodaysMonth=2;} if (ualHPtodaysMonth=="Apr"){ualHPtodaysMonth=3;}
if (ualHPtodaysMonth=="May"){ualHPtodaysMonth=4;} if (ualHPtodaysMonth=="Jun"){ualHPtodaysMonth=5;}
if (ualHPtodaysMonth=="Jul"){ualHPtodaysMonth=6;} if (ualHPtodaysMonth=="Aug"){ualHPtodaysMonth=7;}
if (ualHPtodaysMonth=="Sep"){ualHPtodaysMonth=8;} if (ualHPtodaysMonth=="Oct"){ualHPtodaysMonth=9;}
if (ualHPtodaysMonth=="Nov"){ualHPtodaysMonth=10;} if (ualHPtodaysMonth=="Dec"){ualHPtodaysMonth=11;}
var ualHPyesterday=new Date(ualHPtodaysYear, ualHPtodaysMonth, ualHPtodaysDay);	ualHPyesterday.setDate(ualHPyesterday.getDate()-1);
var ualHPtoday=new Date(ualHPtodaysYear, ualHPtodaysMonth, ualHPtodaysDay);	ualHPtoday.setDate(ualHPtoday.getDate())
var ualHPtomorrow=new Date(ualHPtodaysYear, ualHPtodaysMonth, ualHPtodaysDay);	ualHPtomorrow.setDate(ualHPtomorrow.getDate()+1)	
var ualHPnextWeek=new Date(ualHPtodaysYear, ualHPtodaysMonth, ualHPtodaysDay);	ualHPnextWeek.setDate(ualHPnextWeek.getDate()+14);
var ualHPtwoWeeks=new Date(ualHPtodaysYear, ualHPtodaysMonth, ualHPtodaysDay);	ualHPtwoWeeks.setDate(ualHPtwoWeeks.getDate()+21);
var todaysYear = ualHPtoday.getFullYear(); 				var todaysMonth = ualHPtoday.getMonth(); 				var todaysDate = ualHPtoday.getDate()-1;
var plusFourteenYear = ualHPnextWeek.getFullYear(); 	var plusFourteenMonth = ualHPnextWeek.getMonth(); 	var plusFourteenDate = ualHPnextWeek.getDate()-1;
var plusTwentyoneYear = ualHPtwoWeeks.getFullYear(); 	var plusTwentyoneMonth = ualHPtwoWeeks.getMonth();	var plusTwentyoneDate = ualHPtwoWeeks.getDate()-1;

var ff29FlightStatusOptions = '<option value="'+ff29makedoubledigit(ualHPyesterday.getFullYear())+ff29makedoubledigit((ualHPyesterday.getMonth()+1))+ff29makedoubledigit(ualHPyesterday.getDate())+'">'+ff29makedoubledigit((ualHPyesterday.getMonth()+1))+'/'+ff29makedoubledigit(ualHPyesterday.getDate())+'/'+ff29makedoubledigit(ualHPyesterday.getFullYear())+'</option>\n';
ff29FlightStatusOptions += '<option selected value="'+ff29makedoubledigit(ualHPtoday.getFullYear())+ff29makedoubledigit((ualHPtoday.getMonth()+1))+ff29makedoubledigit(ualHPtoday.getDate())+'">'+ff29makedoubledigit((ualHPtoday.getMonth()+1))+'/'+ff29makedoubledigit(ualHPtoday.getDate())+'/'+ff29makedoubledigit(ualHPtoday.getFullYear())+'</option>\n';
ff29FlightStatusOptions += '<option value="'+ff29makedoubledigit(ualHPtomorrow.getFullYear())+ff29makedoubledigit((ualHPtomorrow.getMonth()+1))+ff29makedoubledigit(ualHPtomorrow.getDate())+'">'+ff29makedoubledigit((ualHPtomorrow.getMonth()+1))+'/'+ff29makedoubledigit(ualHPtomorrow.getDate())+'/'+ff29makedoubledigit(ualHPtomorrow.getFullYear())+'</option>\n';

var writeFFprotocol = "http"; if(document.location.href.indexOf('https://') !=- 1){writeFFprotocol = "https";}



// these vars are for the DHTML calendars
var ff29TodayYearMonth=todaysYear+"-";
if (todaysMonth+1>=10){ff29TodayYearMonth+=(todaysMonth+1)} else {ff29TodayYearMonth+="0"+(todaysMonth+1);}
var ff29TodayCalendarDay=todaysDate+1;

var ff29DepYearMonth=plusFourteenYear+"-";
if (plusFourteenMonth+1>=10){ff29DepYearMonth+=(plusFourteenMonth+1)} else {ff29DepYearMonth+="0"+(plusFourteenMonth+1);}
var ff29DepCalendarDay=plusFourteenDate+1;

var ff29RetYearMonth=plusTwentyoneYear+"-";
if (plusTwentyoneMonth+1>=10){ff29RetYearMonth+=(plusTwentyoneMonth+1)} else {ff29RetYearMonth+="0"+(plusTwentyoneMonth+1);}
var ff29RetCalendarDay=plusTwentyoneDate+1;

// ************************************************************************************************************************
ff29mode=1; // global var of what mode the book travel mode is in (1,2,3,4)
ff29tabs = new Array();
ff29tabs[0]  = new Image(77,25); ff29tabs[0].src = writeFFprotocol+"://www.united.com/ual/asset/tab_BT_on.gif";
ff29tabs[1]  = new Image(77,25); ff29tabs[1].src = writeFFprotocol+"://www.united.com/ual/asset/tab_BT_off.gif";
ff29tabs[2]  = new Image(77,25); ff29tabs[2].src = writeFFprotocol+"://www.united.com/ual/asset/tab_BT_off_roll.gif";
ff29tabs[3]  = new Image(87,25); ff29tabs[3].src = writeFFprotocol+"://www.united.com/ual/asset/tab_CI_on.gif";
ff29tabs[4]  = new Image(87,25); ff29tabs[4].src = writeFFprotocol+"://www.united.com/ual/asset/tab_CI_off.gif";
ff29tabs[5]  = new Image(87,25); ff29tabs[5].src = writeFFprotocol+"://www.united.com/ual/asset/tab_CI2_off.gif";
ff29tabs[6]  = new Image(87,25); ff29tabs[6].src = writeFFprotocol+"://www.united.com/ual/asset/tab_CI_off_roll.gif";
ff29tabs[7]  = new Image(87,25); ff29tabs[7].src = writeFFprotocol+"://www.united.com/ual/asset/tab_CI2_off_roll.gif";
ff29tabs[8]  = new Image(80,25); ff29tabs[8].src = writeFFprotocol+"://www.united.com/ual/asset/tab_FS_off.gif";
ff29tabs[9]  = new Image(80,25); ff29tabs[9].src = writeFFprotocol+"://www.united.com/ual/asset/tab_FS2_off.gif";
ff29tabs[10] = new Image(80,25); ff29tabs[10].src = writeFFprotocol+"://www.united.com/ual/asset/tab_FS_off_roll.gif";
ff29tabs[11] = new Image(80,25); ff29tabs[11].src = writeFFprotocol+"://www.united.com/ual/asset/tab_FS2_off_roll.gif";
ff29tabs[12] = new Image(80,25); ff29tabs[12].src = writeFFprotocol+"://www.united.com/ual/asset/tab_FS_on.gif";
var homePageCheck = false;


function getEl(id){
	return document.getElementById(id);
}

//add event to onload event
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, false);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}
addEvent(window, 'load', ff29init);



/*
// append body tag with onload attribute
// FOR NON-IE
if (!document.all) { document.getElementsByTagName('body')[0].setAttribute('onload', 'ff29init();'); }
// FOR IE 
if (document.all) { window.attachEvent('onload',ff29init); }
*/


function ff29makedoubledigit(digitString)
{
	digitString = digitString.toString();
	if (digitString.length==1) { digitString = "0"+digitString; }
	return digitString;
}

function ff29init()
{
	getEl('flightADTmain').selectedIndex=0;
	if (getEl('wayOne').checked)
		{
			ff29ToggleReturn('wayOne');
		}
	if (getEl('wayRound').checked)
		{
			ff29ToggleReturn('wayRound');
		}
	
	if(getEl('SearchBySCHEDULE')){
		if ( (getEl('SearchBySCHEDULE').checked==false) && (getEl('SearchByPRICE').checked==false) && (getEl('SearchByFLEXDATE').checked==false) )
			{
				getEl('SearchByPRICE').checked=true;
			}
	}
}

function ff29roll(currTab,polarity)
{
	if (currTab==ff29mode){return false;}
	if (currTab==1) {
		if(polarity=="over") {document.images['ff29tab1'].src=ff29tabs[2].src;}
		if(polarity=="out") {document.images['ff29tab1'].src=ff29tabs[1].src;}
		}
	if(currTab==2) {
		if(ff29mode==1) {
			if(polarity=="over") {document.images['ff29tab2'].src=ff29tabs[6].src;}
			if(polarity=="out") {document.images['ff29tab2'].src=ff29tabs[4].src;}
		}
		if(ff29mode==3) {
			if(polarity=="over") {document.images['ff29tab2'].src=ff29tabs[7].src;}
			if(polarity=="out") {document.images['ff29tab2'].src=ff29tabs[5].src;}
			}
		}
	if(currTab==3) {
		if(ff29mode==1) {
			if(polarity=="over") {document.images['ff29tab3'].src=ff29tabs[10].src;}
			if(polarity=="out") {document.images['ff29tab3'].src=ff29tabs[8].src;}
			}
		if(ff29mode==2) {
			if(polarity=="over") {document.images['ff29tab3'].src=ff29tabs[11].src;}
			if(polarity=="out") {document.images['ff29tab3'].src=ff29tabs[9].src;}
			}
		}
}

function ff29click(currTab)
{
	oCalPopD.ShowCal(false);oCalPopR.ShowCal(false);
	ff29mode=currTab;
	if (currTab==1) {
			document.images['ff29tab1'].src=ff29tabs[0].src;
			document.images['ff29tab2'].src=ff29tabs[4].src;
			document.images['ff29tab3'].src=ff29tabs[8].src;
		}
	if (currTab==2) {
			document.images['ff29tab1'].src=ff29tabs[1].src;
			document.images['ff29tab2'].src=ff29tabs[3].src;
			document.images['ff29tab3'].src=ff29tabs[9].src;
		}
	if (currTab==3) {
			document.images['ff29tab1'].src=ff29tabs[1].src;
			document.images['ff29tab2'].src=ff29tabs[5].src;
			document.images['ff29tab3'].src=ff29tabs[12].src;
		}
	for(i=1;i<4;i++)
		{ getEl("ff29pane"+i).style.display="none"; }
		getEl("ff29pane"+ff29mode).style.display="block";
}



var flightschildandseniorvisible = false;
function showChildandSenior()
{
	flightschildandseniorvisible = true;
	getEl("childseniorcompact").style.display = "none";
	getEl("childseniorfull").style.display = "block";
	getEl("flightADT").selectedIndex = getEl("flightADTmain").selectedIndex+1;
}

function showMoreSearch()
{
if (getEl("ff29upprclnoarrowa").style.display != "none")
	{
	getEl("ff29upprclnoarrowa").style.display = "none";
	getEl("ff29upprclnoarrowb").style.display = "inline";
	getEl("ff29upprclnolink").style.display = "none";
	getEl("ff29upprclno").style.display = "block";
	}
	else
	{
	getEl("ff29upprclnoarrowa").style.display = "inline";
	getEl("ff29upprclnoarrowb").style.display = "none";
	getEl("ff29upprclnolink").style.display = "inline";
	getEl("ff29upprclno").style.display = "none";
	}
}

function openAiportLookupWin(url)
{
// START -- FSNE Part 1 Changes for Autosuggest
var shopFrom0Val = getEl("shop_from0").value;
var shopTo0Val = getEl("shop_to0").value;
shopFrom0Val = shopFrom0Val.replace("(","");
shopTo0Val = shopTo0Val.replace("(","");
getEl("shop_from0").value=shopFrom0Val;
getEl("shop_to0").value=shopTo0Val;
//END -- FSNE Part 1 Changes for Autosuggest

var tempurl = document.location.href;
if (tempurl.indexOf('www.united.com')!=-1)
	{
		document.domain = "united.com";
	}
popWin = window.open(url,'popDoc','width=539,height=500,scrollbars=yes,status=yes,resizable=yes,toolbar=no,dependent=yes','AirportLookup');
}

function ff29ToggleReturn(tempId)
{
if (tempId == "wayOne")
	{
		getEl("ff29Ritem").style.display="none";
		getEl("ff29Rlabel").style.display="none";
		if (getEl('SearchByFLEXDATE').checked==true)
		{
		getEl('SearchByPRICE').checked=true;
		}
		getEl("SearchByFLEXDATE").checked=false;
		getEl("SearchByFLEXDATE").disabled=true;

		getEl("SearchByFLEXDATE").style.display=""; // from rel night (Changed from none to blank to show during One-Way)
		getEl("ff29FDlabel").style.display="";  // from rel night (Changed from none to blank to show during One-Way)


	}
	else
	{
		getEl("ff29Ritem").style.display="block";
		getEl("ff29Rlabel").style.display="block";
		if(getEl("serviceclassOB")){
			getEl("serviceclassIB").value = getEl("serviceclassOB").value;
		}
		if(getEl("shop_departtime")){
			getEl("shop_arrivetime").value = getEl("shop_departtime").value;
		} 
		if( getEl("SearchByFLEXDATE").checked==true && getEl("SearchByFLEXDATE").disabled==true)
			{
				getEl("SearchByPRICE").checked=true;
			}
		getEl("SearchByFLEXDATE").disabled=false;
		getEl("SearchByFLEXDATE").style.display="inline";  // from rel night
		getEl("ff29FDlabel").style.display="inline";  // from rel night
	}
}

function ff29searchByUpdate(tempId)
{
if (getEl("SearchByFLEXDATE").disabled==false)
	{
	if (tempId == "SearchByFLEXDATE")
		{
			getEl("wayOne").disabled=true;
			ff29ToggleReturn('wayRound');
		}
		else
		{
			getEl("wayOne").disabled=false;
		}
	}
}


function ff29updateOthers()
{
	currOrig = getEl("shop_from0").value;
	currDest = getEl("shop_to0").value;	
	currOrig = currOrig.replace("(","");
	currDest = currDest.replace("(","");	
	getEl("hotelD").value = currDest;
	getEl("vacationO").value = currOrig;
	getEl("vacationD").value = currDest;
}

function ff29multiCity(){

	var telescopeQuery="";
	telescopeQuery+="https://www.mileageplus.com/awardbooking/award/us/shopInput.do?shop_triptype=multicity&actionType=changeAwardTripType";
	
	var shopFrom0Val = getEl("shop_from0").value;
	var shopTo0Val = getEl("shop_to0").value;
	shopFrom0Val = shopFrom0Val.replace("(","");
	shopTo0Val = shopTo0Val.replace("(","");
	telescopeQuery+="&shop_from0="+shopFrom0Val;
	telescopeQuery+="&shop_to0="+shopTo0Val;
	
	if (getEl("fromnearby1").checked==true) {telescopeQuery+="&shop_fromnearbyairport0=on";}
	if (getEl("tonearby1").checked==true) {telescopeQuery+="&shop_tonearbyairport0=on";}
	telescopeQuery+="&shop_departmonth0="+getEl("shop_departmonth").value; 
	telescopeQuery+="&shop_departday0="+getEl("shop_departday").value;
	telescopeQuery+="&shop_departtime0="+getEl("shop_departtime").value;
	telescopeQuery+="&shop_departmonth1="+getEl("shop_arrivemonth").value;
	telescopeQuery+="&shop_departday1="+getEl("shop_arriveday").value;
	telescopeQuery+="&shop_departtime1="+getEl("shop_arrivetime").value;
	if(getEl("serviceclassOB") && getEl("serviceclassOB").style.display != 'none'){
		telescopeQuery+="&shop_serviceclass="+getEl("serviceclassOB").value;
		if(getEl('wayOne').checked){//oneway - set the inbound value = to outbound per business
			telescopeQuery+="&shop_serviceclass_inbound="+getEl("serviceclassOB").value;
		}else{
			telescopeQuery+="&shop_serviceclass_inbound="+getEl("serviceclassIB").value;
		}
	}else if(getEl("serviceclass")){
		telescopeQuery+="&shop_serviceclass="+getEl("serviceclass").value;
	}
	if (getEl("SearchBySCHEDULE").checked==true) {telescopeQuery+="&shop_viewresults=SCHEDULE";}
	if (getEl("SearchByPRICE").checked==true) {telescopeQuery+="&shop_viewresults=PRICE";}
	if (getEl("flex_date_check").checked) {
		telescopeQuery+="&shop_viewresults=FLEXDATE&flex_date_check=true";
	}else{
		telescopeQuery+="&flex_date_check=false";
	}
	if(getEl("mpnumber")){
		telescopeQuery+="&userId="+getEl("mpnumber").value;
		telescopeQuery+="&password="+getEl("mppassword").value;
		telescopeQuery+="&authType="+"mp";
	}

	if (flightschildandseniorvisible!=true){
		telescopeQuery+="&shop_passenger0="+getEl("flightADTmain").value;
		telescopeQuery+="&shop_passenger1=0-SRC";
		telescopeQuery+="&shop_passenger2=0-CNN";
	}else{
		telescopeQuery+="&shop_passenger0="+getEl("flightADT").value;
		telescopeQuery+="&shop_passenger1="+getEl("flightSRC").value;
		telescopeQuery+="&shop_passenger2="+getEl("flightCNN").value;
	}
	
	if(getEl("affFltSrchOpts") && getEl("affFltSrchOpts").style.display != "none"){ // if flight "more search options is expanded
		//alert('ff29upprclno = ' + "'" + getEl("ff29upprclno").style.display + "'");
		
		telescopeQuery+="&shop_serviceclass="+getEl("serviceclass").value;
		telescopeQuery+="&shop_upgrade="+getEl("upgrade").value;
		telescopeQuery+="&shop_stops="+getEl("stops").options[getEl("stops").selectedIndex].value;
		telescopeQuery+="&shop_promotioncode="+getEl("flightPromocode").value;
		if (getEl("flightIncludeSA").checked==true) {telescopeQuery+="&carrierPref=on";}
	}
	if(getEl("affstops")){ // default settings
		telescopeQuery+="&shop_upgrade=";
		telescopeQuery+="&shop_stops="+getEl("affstops").options[getEl("affstops").selectedIndex].value;
		telescopeQuery+="&shop_promotioncode=";
		telescopeQuery+="&carrierPref=off";
	}

	window.location=telescopeQuery;
}

function ff29popup(wURL){
	window.open(wURL,"ff29","width=550,height=400,top=20,left=20,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes")
}


/*@FILE INFORMATION
----------------------------------------
Author:		United Airlines MileagePlus Team 2010 
File:		mp_classes_1.0.0.css 
Created:	4/12/10 8:23 PM
Updated:	4/12/10 8:23 PM

//Apr 20, 2009 MH - check for aff
// May 21, 2008  TM - PRN 4086
//Oct6 2009 SHD ARP submit to hotel error 
// Modified code so that if element vacAHC is checked, &gsvacationtype is assigned AH02 rather than AHC01.

/*@END--------------------------------*/



var bClickedHotelsOrCars = false;


function travelSearch(tsMode) {
	
	//oCalPopD.ShowCal(false);oCalPopR.ShowCal(false);
	var panel1Labels = new Array("Flights","Hotels","Cars","Vacations")
	for(i=1;i<5;i++)
		{ 
			getEl("ff29pane1sub"+i+"a").style.display="none";
			getEl("ff29pane1sub"+i+"b").style.display="none";
		}

	getEl("ff29pane1sub"+tsMode+"a").style.display="block";
	getEl("ff29pane1sub"+tsMode+"b").style.display="block";

	if (tsMode==1){//flights
	
		getEl("ff29adjacentSearch").innerHTML = "<span id='affAwdFee'>"+affAwardFare+"</span>";
		getEl("dateContainer").style.display="block";
		getEl("ff29Dlabel").innerHTML = "Departing";
		getEl("ff29Rlabel").innerHTML = "Returning";
		getEl("ff29search").style.display="block";
		getEl("ff29adjacentDep").style.display="inline";
		getEl("ff29adjacentRet").style.display="inline";
		if(getEl("cabinOB")){
			getEl("cabinOB").style.display="block";
			getEl("cabinIB").style.display="block";
		}
		if(getEl("flex"))getEl("flex").style.display="block";
		if(getEl("ff29Aftersearchbutton"))getEl("ff29Aftersearchbutton").style.display="none";
		if(getEl("ff29loginpanel"))getEl("ff29loginpanel").style.display="none";
	
		//hiding search type in Flights tab
		if (getEl('aff')) {
			getEl('aff').style.display ='none';
		}
		if (getEl("wayRound")) {
			if (getEl("wayRound").checked == true ){
				getEl("ff29Ritem").style.display="block";
				getEl("ff29Rlabel").style.display="block";
			} else {
				getEl("ff29Ritem").style.display="none";
				getEl("ff29Rlabel").style.display="none";
			}
		}

		if (getEl("hpHotelsPromo")) {
			getEl("hpHotelsPromo").style.display="none";
		}

		//getEl("dateContainer").style.backgroundColor="ffffff";
	
		var defaultText='';

		if(bClickedHotelsOrCars==true) {
			getEl('shop_departtime').style.display="none";
			getEl('shop_departtimeFLIGHT').style.display="inline";
			getEl('shop_departtime').id="shop_departtime1";
			getEl('shop_departtimeFLIGHT').id="shop_departtime";
			getEl('shop_arrivetime').style.display="none";
			getEl('shop_arrivetimeFLIGHT').style.display="inline";
			getEl('shop_arrivetime').id="shop_arrivetime1";
			getEl('shop_arrivetimeFLIGHT').id="shop_arrivetime";
			bClickedHotelsOrCars = false;
		} else {
			getEl('shop_departtime').style.display="inline";
			getEl('shop_arrivetime').style.display="inline";
		}
		
	}else if (tsMode==2) {//hotel
	
		getEl("ff29adjacentSearch").innerHTML ="";
		getEl("dateContainer").style.display="block";
		getEl("ff29Dlabel").innerHTML = "Check-in date";
		getEl("ff29Rlabel").innerHTML = "Check-out date";
		getEl("ff29search").style.display="block";
		getEl("ff29adjacentDep").style.display="block";
		getEl("ff29adjacentRet").style.display="block";
		getEl("ff29Aftersearchbutton").style.display="none";
		getEl("ff29Ritem").style.display="block";
		getEl("ff29Rlabel").style.display="block";
		if(getEl("cabinOB")){
			getEl("cabinOB").style.display="none";
			getEl("cabinIB").style.display="none";
		}
		if(getEl("flex"))getEl("flex").style.display="none";
		if(getEl("ff29loginpanel"))getEl("ff29loginpanel").style.display="none";
		if(getEl("hpHotelsPromo"))getEl("hpHotelsPromo").style.display="none";
	
		var defaultText='';
		if(getEl("hotelD")){
			if(getEl("shop_to0")){
				if(getEl("shop_to0").value==''){
				}else{
					defaultText=getEl("shop_to0").value;
				}
				
			}
			if(getEl("pickupLocation")){
				if(getEl("pickupLocation").value==''){
				}else{
					defaultText=getEl("pickupLocation").value;
				}
			}
			getEl("hotelD").value=defaultText;
		}
		if(getEl('shop_departtime'))getEl('shop_departtime').style.display="none";
		if(getEl('shop_arrivetime'))getEl('shop_arrivetime').style.display="none";
	
	
	}

	if (tsMode==3) {
	
		getEl("ff29adjacentSearch").innerHTML = "";
		getEl("dateContainer").style.display="none"; // hide date picker
		getEl("ff29Dlabel").innerHTML = "&nbsp;";
		getEl("ff29Rlabel").innerHTML = "&nbsp;";
		getEl("ff29search").style.display="none";
		getEl("ff29adjacentDep").style.display="none";
		getEl("ff29adjacentRet").style.display="none";
		getEl("ff29Aftersearchbutton").style.display="none";
		getEl("ff29Ritem").style.display="block";
		getEl("ff29Rlabel").style.display="block";
	
		if (getEl("hpHotelsPromo")) {
			getEl("hpHotelsPromo").style.display="none";
		}
	
	}

	if (tsMode==4) { //car
	
		getEl("ff29adjacentSearch").innerHTML ="";
		getEl("dateContainer").style.display="block";
		getEl("ff29Dlabel").innerHTML = "Pick-up Date";
		getEl("ff29Rlabel").innerHTML = "Drop-off Date";
		getEl("ff29search").style.display="block";
		//getEl("ff29search").style.padding="0px 0px 10px 0px;";
		getEl("ff29adjacentDep").style.display="block";
		getEl("ff29adjacentRet").style.display="block";
		getEl("ff29loginpanel").style.display="none";
		if (getEl("hpHotelsPromo")) {
			getEl("hpHotelsPromo").style.display="none";
		}
		if(getEl("cabinOB")){
			getEl("cabinOB").style.display="none";
			getEl("cabinIB").style.display="none";
		}
		if(getEl("flex"))getEl("flex").style.display="none";
		if(getEl("ff29Aftersearchbutton"))getEl("ff29Aftersearchbutton").style.display="none";
		if(getEl("ff29Ritem"))getEl("ff29Ritem").style.display="block";
		if(getEl("ff29Rlabel"))getEl("ff29Rlabel").style.display="block";
	
		var defaultText='';
		if(getEl("pickupLocation")){
			if(getEl("shop_to0")){
				if(getEl("shop_to0").value==''){
				}else{
					defaultText=getEl("shop_to0").value;
				}
			}
			if(getEl("hotelD")){
				if(getEl("hotelD").value==''){
				}else{
					defaultText=getEl("hotelD").value;
				}
			}
			getEl("pickupLocation").value=defaultText;
		}
		if(bClickedHotelsOrCars==false) {
			getEl('shop_departtime').style.display="none";
			getEl('shop_departtime1').style.display="block";
			getEl('shop_departtime').id="shop_departtimeFLIGHT";
			getEl('shop_departtime1').id="shop_departtime";
			getEl('shop_arrivetime').style.display="none";
			getEl('shop_arrivetime1').style.display="block";
			getEl('shop_arrivetime').id="shop_arrivetimeFLIGHT";
			getEl('shop_arrivetime1').id="shop_arrivetime";
			
			bClickedHotelsOrCars = true;
		} else {
			getEl('shop_departtime').style.display="inline";
			getEl('shop_arrivetime').style.display="inline";
		}
	
	}
	

	if (getEl("ff29pane1controller")) {	
		var ff29controllerstring="";
		ff29controllerstring+='<div class="btTabsPad"><table border="0" cellpadding="0" cellspacing="0">';
		ff29controllerstring+='<tr>';
		for(j=1;j<5;j++)
		{
			if (j!=tsMode){ff29controllerstring+='<td onclick="travelAffSearch('+j+')" id="ff29pane1tab'+j+'"><a href="javascript:travelAffSearch('+j+')"><img src="http://www.united.com/ual/asset/hp30ffbt'+j+'off.gif" border="0"></a></td>';}
			else {ff29controllerstring+='<td onclick="travelAffSearch('+j+')" id="ff29pane1tab'+j+'"><img src="http://www.united.com/ual/asset/hp30ffbt'+j+'on.gif" border="0"></td>';}
		}
		ff29controllerstring+='</tr>';
		ff29controllerstring+='</table></div>';
		//aff	
		if (tsMode==1 && affOn==true) {
			ff29controllerstring+='<table id="aff" width="100%" cellpadding="0" cellspacing="0"><tr><td id="aff1"';
			if (affType==1) {
				ff29controllerstring+=' class="affon">'+affText1+'</td><td id="aff2"><a style="text-decoration:none;" href="javascript:chgAff(2);">'+affText2+'<\/a><\/td><\/tr><\/table>';
			}
			else {
				ff29controllerstring+='><a style="text-decoration:none;" href="javascript:chgAff(1);">'+affText1+'<\/a><\/td><td id="aff2" class="affon">'+affText2+'<\/td><\/tr><\/table>';
			}
		}

		getEl("ff29pane1controller").innerHTML = ff29controllerstring;
	}


	else if (getEl("tabbedHeaderUL")) {// use in planning and booking
		$('#tabbedHeaderUL li').removeClass('current').attr('className','');

		var choosed = tsMode*1 - 1;
		$('#tabbedHeaderUL li').eq(choosed).addClass('current');

		ff29mode = tsMode;
	}
	
	// vs | begin

	for (i=0;i<vsCustomItems.length;i++)
	{
		if(tsMode==1 && vsCustomItems[i][0]=="v_tab1sub1")
		{vsCustomItems[i][1]+=1;}
		if(tsMode==2 && vsCustomItems[i][0]=="v_tab1sub2")
		{vsCustomItems[i][1]+=1;}
		if(tsMode==3 && vsCustomItems[i][0]=="v_tab1sub3")
		{vsCustomItems[i][1]+=1;}
		if(tsMode==4 && vsCustomItems[i][0]=="v_tab1sub4")
		{vsCustomItems[i][1]+=1;}
	}

// vs | end		
}

function ff29AffSubmit(typeOfsearch,linkName){
	if(document.getElementById("serviceclassIB")&& null!=document.getElementById("serviceclassIB").value && ''!=document.getElementById("serviceclassIB").value){
		var mpSwitch = 'on';
	}else{
		var mpSwitch='off';
	}
	var ff29tsMode=1;

	// first find out what ts mode we are in
	
	if (getEl("ff29pane1sub2a")) {
		if ((getEl("ff29pane1sub2a").style.display == "none") && (getEl("ff29pane1sub3a").style.display == "none") && (getEl("ff29pane1sub4a").style.display == "none"))
			{ff29tsMode=1;}
	
		if((getEl("ff29pane1sub1a").style.display == "none") && (getEl("ff29pane1sub3a").style.display == "none") && (getEl("ff29pane1sub4a").style.display == "none"))
			{ff29tsMode=2;}
	
		if((getEl("ff29pane1sub1a").style.display == "none") && (getEl("ff29pane1sub2a").style.display == "none") && (getEl("ff29pane1sub4a").style.display == "none"))
			{ff29tsMode=3;}
	
		if((getEl("ff29pane1sub1a").style.display == "none") && (getEl("ff29pane1sub2a").style.display == "none") && (getEl("ff29pane1sub3a").style.display == "none"))
			{ff29tsMode=4;}
	}
				

	if (ff29tsMode==1){
		if (typeOfsearch=="normal"){
			if (getEl("shop_from0").value == "" && affType !=3){
				alert("Departing location (From) is a required field.")
				return false;
			}

			if (getEl("shop_to0").value == "" && affType !=3){
				alert("Destination location (To) is a required field")
				return false;
			}
			
			if(!checkForDate()){
				return false;
			}

			// query flights and ping site metrics (insight first)

			if (getEl("ff29pane1sub2a")) {
				vsCustomItems[vsCustomItems.length] = new Array("v_affSwitch",vsAffSwitch);
			}
			
			var telescopeQuery="";
			
			if (affType==1) {
				telescopeQuery+="http://travel.united.com/ube/core/"+affCtryCode+"/compactSearch.do?Log=1&switch=true&";
			}
			if (affType==2 && mpSwitch=='on') {
				//telescopeQuery+="http://travel.united.com/ube/award/"+affCtryCode+"/compactSearch.do?Log=1&switch=true&";
				telescopeQuery+="https://www.mileageplus.com/awardbooking/award/"+affCtryCode+"/compactSearch.do?Log=1&switch=true&";
				if(getEl("flex_date_check").checked){
					telescopeQuery+="&flex_date_check=true&shop_viewresults=FLEXDATE";
				}else{
					telescopeQuery+="&flex_date_check=false";
				}
			}else if (affType==2 && mpSwitch=='off') {
				telescopeQuery+="http://travel.united.com/ube/award/"+affCtryCode+"/compactSearch.do?Log=1&switch=true&";
				//telescopeQuery+="http://www.mileageplus.com/awardbooking/award/"+affCtryCode+"/compactSearch.do?Log=1&switch=true&";
			}
			if (affType==3) {
				telescopeQuery+="http://travel.united.com/ube/award/"+affCtryCode+"/awardShop.do?Log=1&switch=true&";  //switch=true will prevent default num of pax from being selected
			}
			
			/*Code added for MP login - FSNE Part 2 - Starts */
			var isMpLogin = false;
			if (getEl("bestPricing").style.display == "block" && (affType==2 || affType==3)){
				
				if((getEl("mpnumber") && getEl("mpnumber").value!="") ||(getEl("mppassword") && getEl("mppassword").value!="")){
				
					var mpNum = getEl("mpnumber").value;
					var pwd = getEl("mppassword").value;			
					if(ValidateUserId3(mpNum,pwd)){
						isMpLogin = true;
						telescopeQuery="https://www.ua2go.com/ci/DoLogin.jsp?return_to=mp_award_ibe_bridge&fwdPath=compactSearch&Log=1&switch=true&";

						if(getEl('remMP1') && getEl('remMP1').checked == true){								
							if(isEmail(mpNum)){
								remEMAIL(mpNum);
								rememberME('E');
							}else{								
								remMP(mpNum);
								rememberME('M');
							}							
							
						}else if(getEl('remMP1') && getEl('remMP1').checked == false){									
							
							deleteCookie("getMP");
							deleteCookie('rememberME');
							deleteCookie('rememberEMAIL');
						}														
					}else {
						return false;
					}
				}
				
			}															
			/*Code added for MP login - FSNE Part 2 - Ends */			
			telescopeQuery+="&submitingShopInputForm=true";
			telescopeQuery+="&shop_flightCount=2";
			telescopeQuery+="&changeLanguage=false";
			if (affType==2 || affType==3) {
				
				telescopeQuery+="&languageRedisplayPage=%2Fjsp%2Fshop%2FAward.jsp";
			}else {
				telescopeQuery+="&languageRedisplayPage=%2Fjsp%2Fshop%2FShop.jsp";
			}
			
			telescopeQuery+="&actionType=search";
			telescopeQuery+="&waiting=true";
			
			if(affType==2 || affType==3){
				
				if (getEl('Saver').checked==true) {
					var awardAffVal='Saver';
				}else {
					var awardAffVal='Standard';
				}
				telescopeQuery+="&award_type="+awardAffVal;
			}
			if (getEl("wayRound")) {
				
				if (getEl("wayRound").checked==true) {telescopeQuery+="&shop_triptype=roundtrip";}
				else if (getEl("wayOne").checked==true) {telescopeQuery+="&shop_triptype=oneway";}
			}else{
			//mp fare-finder
			telescopeQuery+="&shop_triptype=roundtrip";
			}
			var shopFrom0Val = getEl("shop_from0").value;
			var shopTo0Val = getEl("shop_to0").value;
			shopFrom0Val = shopFrom0Val.replace("(","");
			shopTo0Val = shopTo0Val.replace("(","");							
			getEl("shop_from0").value=shopFrom0Val;
			getEl("shop_to0").value=shopTo0Val;

			telescopeQuery+="&shop_from0="+getEl("shop_from0").value;
			
			telescopeQuery+="&shop_to0="+getEl("shop_to0").value;
			
			if (getEl("fromnearby1")) {
				if (getEl("fromnearby1").checked==true) {telescopeQuery+="&shop_fromnearbyairport0=on";}
				if (getEl("tonearby1").checked==true) {telescopeQuery+="&shop_tonearbyairport0=on";}
			}
			
			telescopeQuery+="&shop_departtime0="+getEl("shop_departtime").value;
			telescopeQuery+="&shop_arrivetime0="+getEl("shop_arrivetime").value;
			
			if(!isMpLogin){
				telescopeQuery+="&shop_departmonth0="+getEl("shop_departmonth").value; 
				telescopeQuery+="&shop_departday0="+getEl("shop_departday").value;				
				telescopeQuery+="&shop_arriveday0="+getEl("shop_arriveday").value;
				telescopeQuery+="&shop_arrivemonth0="+getEl("shop_arrivemonth").value;
			}

			if (affType==1){  // revenue
				if (getEl("SearchBySCHEDULE")) {
					if (getEl("SearchBySCHEDULE").checked==true) {telescopeQuery+="&shop_viewresults=SCHEDULE";}
				}
				if (getEl("SearchByPRICE")) {
					if (getEl("SearchByPRICE").checked==true) {telescopeQuery+="&shop_viewresults=PRICE";}
				}
				if (getEl("SearchByFLEXDATE")) {
					if (getEl("SearchByFLEXDATE").checked==true) {telescopeQuery+="&shop_viewresults=FLEXDATE";}
				}
			}

			if (affType==2 || affType==3){  // award search or award more search options
					if(!isMpLogin){
						if (getEl("flex_date_check").checked){
							if (getEl("flex_date_check").checked==true){
								telescopeQuery+="&flex_date_check=true&shop_viewresults=FLEXDATE";
							}else{
								telescopeQuery+="&flex_date_check=false";
							}
						}else{
							telescopeQuery+="&shop_viewresults=SCHEDULE";
						}
					}else{
						if(getEl("flex_date_check").checked){
						telescopeQuery+="&flex_date_check=true&shop_viewresults=FLEXDATE";
						}else{
							telescopeQuery+="&flex_date_check=false";
						}
					}
			}

			if (typeof flightschildandseniorvisible == 'boolean'){
				if (flightschildandseniorvisible!=true){
					telescopeQuery+="&shop_passenger0="+getEl("flightADTmain").value;
					telescopeQuery+="&shop_passenger1=0-SRC";
					telescopeQuery+="&shop_passenger2=0-CNN";
				}else{
					telescopeQuery+="&shop_passenger0="+getEl("flightADT").value;
					telescopeQuery+="&shop_passenger1="+getEl("flightSRC").value;
					telescopeQuery+="&shop_passenger2="+getEl("flightCNN").value;
				}
			}else{
			//mp fare-finder
					telescopeQuery+="&shop_passenger0="+getEl("flightADTmain").value;
					telescopeQuery+="&shop_passenger1=0-SRC";
					telescopeQuery+="&shop_passenger2=0-CNN";
			}
		
			
			//Code added for FSNE Part 2 - starts
					
			if (affType==2 || affType==3){

				if(getEl("serviceclassOB")){
					telescopeQuery+="&shop_serviceclass="+getEl("serviceclassOB").value;
				}else{
					telescopeQuery+="&shop_serviceclass="+getEl("affserviceclass").value;
				}
				if(getEl("serviceclassIB"))telescopeQuery+="&shop_serviceclass_inbound="+getEl("serviceclassIB").value;
				if(getEl("affstops"))telescopeQuery+="&shop_stops="+getEl("affstops").options[getEl("affstops").selectedIndex].value;
				if(getEl("stops"))telescopeQuery+="&shop_stops="+getEl("stops").options[getEl("stops").selectedIndex].value;
			}else {
				telescopeQuery+="&shop_serviceclass=";							
			}
			if (affType==1){
				telescopeQuery+="&shop_promotioncode="+getEl("flightPromocode").value;						
			}	
		
		//Code added for FSNE Part 2 - ends
		if(isMpLogin){
			document.shopInputForm.action = telescopeQuery;
			return true;
		}else{
			window.location=telescopeQuery; //window.location=IF_Flight+telescopeQuery;
			return false;
			}
		}
	}
	if (ff29tsMode==2){
		if (typeOfsearch=="normal"){
			if (getEl("hotelD").value == ""){
				alert("A city or airport code is required to search for a hotel.")
				return false;
			}
		}
			
		//added MP validation 
		
		if(getEl("ff29loginpanel") && getEl("ff29loginpanel").style.display == "block"){
			if(document.shopInputForm.userId.value == 0 && document.shopInputForm.password.value==0){
						
			}else{
					
				if(!ValidateMileageUserId()){
					return false;
				} else {
					document.shopInputForm.action="https://www.ua2go.com/ci/DoLogin.jsp?stamp=NEWCOOKY*itn/ord=NEWREC,itn/air/united"+"&return_to=arp"; 
					return true;
				}
			}
		}
		// query hotels

		var hotelD = getEl("shop_departmonth").value;
		var hotelDsplit = new Array(); hotelDsplit = hotelD.split('-');
		var hotelR = getEl("shop_arrivemonth").value;
		var hotelRsplit = new Array(); hotelRsplit = hotelR.split('-');
		var hotelQueryStr ="https://hotelandcarawards.mileageplus.com/profiles/united_loyalty_process.cfm?origin=http://www.united.com/page/article/0,6722,3831,00.html&search=true";
		

		if ( (typeOfsearch=="nearanattraction") || (typeOfsearch=="nearanaddress")){
			return false;
		}

	
		hotelQueryStr+="&room1=true";
		hotelQueryStr+="&area2="+getEl('hotelD').value;
		hotelQueryStr+="&date1="+hotelDsplit[1]+"%2F"+getEl("shop_departday").value+"%2F"+hotelDsplit[0].substring(2);
		hotelQueryStr+="&date2="+hotelRsplit[1]+"%2F"+getEl("shop_arriveday").value+"%2F"+hotelRsplit[0].substring(2);

	
		if(getEl("rooms")){
			var rooms=getEl("rooms").value;
			hotelQueryStr+="&num_rooms="+rooms;
		}
	
		var adults=parseInt(getEl('hotelADT').value);
		if(adults<1){
			adults=1;
		}						
		hotelQueryStr+="&adults="+adults;
		children=parseInt(getEl('hotelCNN').value);						
		hotelQueryStr+="&children="+children;
				
		window.location.assign(hotelQueryStr);
		return false;

	}

	if (ff29tsMode==3){
			//do nothing, this is the car rental section
			//if necessary a car-quote HTTP GET could be formulated here
	}

	if (ff29tsMode==4){
		if (typeOfsearch=="normal"){
			var pickupLocationVal= getEl('pickupLocation').value;
			if(getEl('pickupLocation').value=='City,state,county or country'){
				pickupLocationVal="";
			}
			if (pickupLocationVal == "" ){
				alert("pickup location is a required field.");
				return false;
			}
		}
		//added MP validation 
		if(getEl("ff29loginpanel").style.display == "block"){
			if(document.shopInputForm.userId.value == 0 && document.shopInputForm.password.value==0){
						
			}else{
				if(!ValidateMileageUserId()){
					return false;
				} else {
					document.shopInputForm.action="https://www.ua2go.com/ci/DoLogin.jsp?stamp=NEWCOOKY*itn/ord=NEWREC,itn/air/united"+"&return_to=arp"; 
					return true;
				}
			}
		}
		

		// query vacations (united vacations)

		var carsD = getEl("shop_departmonth").value;
		var carsDsplit = new Array(); carsDsplit = carsD.split('-');
		var carsR = getEl("shop_arrivemonth").value;
		var carsRsplit = new Array(); carsRsplit = carsR.split('-');
		var carsQueryStr ="";
		var carsQueryStr ="https://hotelandcarawards.mileageplus.com/profiles/united_loyalty_process.cfm?origin=http://www.united.com/page/article/0,6722,3831,00.html&search=true";
		carsQueryStr+="&car1=true";
		carsQueryStr+="&area2="+getEl('pickupLocation').value;
		carsQueryStr+="&date1="+carsDsplit[1]+"%2F"+getEl("shop_departday").value+"%2F"+carsDsplit[0].substring(2);
		carsQueryStr+="&date2="+carsRsplit[1]+"%2F"+getEl("shop_arriveday").value+"%2F"+carsRsplit[0].substring(2);
		carsQueryStr+="&adults=1";//hardcode for now
		
		if(getEl("shop_departtime").value!=''){
			var departtimeVal=getEl("shop_departtime").value;					
			carsQueryStr+="&time1="+departtimeVal;
		}			
		if(getEl("shop_arrivetime").value!=''){
			var arriveVal=getEl("shop_arrivetime").value;		
			carsQueryStr+="&time2="+arriveVal;
		}
		
		window.location.assign(carsQueryStr);
		return false;

	}
}



function chgAff(fltT) {
	vsAffSwitch='T';
	clrErrMsgs();
	/*chgBtn1=getEl('aff1')
	chgBtn2=getEl('aff2')*/
	if (fltT==1){
		//search flts
		affType=1;
		if (affTripType==1){
			ff29ToggleReturn('wayOne');
		}else{
			ff29ToggleReturn('wayRound');
		}
		/*chgBtn1.innerHTML=affText1;
		chgBtn2.innerHTML="<a style='text-decoration:none;' href='javascript:chgAff(2)'>"+affText2+"</a>";
		chgBtn1.className='affon';
		chgBtn2.className='';*/
		getEl('fltTypes').style.display='block';

		//TM - Removed as part of radio button hide
		//getEl('affFltSrch').style.display='block';

		getEl('affAwdSrch').style.display='none';
		getEl('affFltSrch').style.display='block';
		getEl('affChldSen').style.display='block';

		if (getEl('flightSRC').selectedIndex > 0 || getEl('flightCNN').selectedIndex > 0 ){
			getEl('childseniorcompact').style.display='none';
			getEl('childseniorfull').style.display='block';
		}else{
			getEl('childseniorcompact').style.display='block';
			getEl('childseniorfull').style.display='none';
		}
		if (getEl('childseniorfull').style.display=='block'){
			flightschildandseniorvisible = true; // 229
			if(getEl('flightSRC').selectedIndex>0 || getEl('flightCNN').selectedIndex >0 ){ 
				if (((getEl('flightADTmain').selectedIndex+1)-(getEl('flightSRC').selectedIndex+getEl('flightCNN').selectedIndex))>0){
					getEl('flightADT').selectedIndex=((getEl('flightADTmain').selectedIndex+1)-(getEl('flightSRC').selectedIndex+getEl('flightCNN').selectedIndex));
				}else{
					getEl('flightADT').selectedIndex=0;
					if (getEl('srvErr0')){
						errVal=getEl('srvErr0');
						errVal.style.display='block';
						errVal.innerHTML=affPass0Msg;
						errVal.className='err';
					}
					if (getEl('lbl-pass0')){
						getEl('lbl-pass0').className='err';
					}
				}
			}else{
				flightschildandseniorvisible = false; // 229
				if (getEl('flightSRC').selectedIndex>0 || getEl('flightCNN').selectedIndex >0 ){ 
					getEl('flightADTmain').selectedIndex=getEl('flightADT').selectedIndex+1;
				}
			}
		}	

		if (getEl('affMoreText')) {
			getEl('affMoreText').innerHTML = affMore1;
		}

		if(getEl('affFltSrchOpts'))getEl('affFltSrchOpts').style.display='block';
		getEl('affAwdSrchOpts').style.display='none';
		//getEl('affAwdFee').style.display='none';
		getEl('stops').selectedIndex=getEl('affstops').selectedIndex;
	
	}else{//book miles
	
		affType=2;
		flightschildandseniorvisible = false; // 229
		if (getEl('wayOne')) {
			if (getEl('wayOne').checked==true) {
				ff29ToggleReturn('wayRound');
			}
		}	
		/*chgBtn1.innerHTML="<a style='text-decoration:none;' href='javascript:chgAff(1)'>"+affText1+"</a>";
		chgBtn2.innerHTML=affText2;
		chgBtn1.className='';
		chgBtn2.className='affon';*/
		getEl('fltTypes').style.display='block';
		getEl('affFltSrch').style.display='none';
		getEl('affAwdSrch').style.display='none';
		var check10Alert=0;
		if (getEl('flightSRC').selectedIndex>0 || getEl('flightCNN').selectedIndex >0 ){
			if (getEl('flightADT').selectedIndex+getEl('flightSRC').selectedIndex+getEl('flightCNN').selectedIndex-1 >8 ){
				getEl('flightADTmain').selectedIndex=8;
				var check10Alert=1;
			}else{
				getEl('flightADTmain').selectedIndex=(getEl('flightADT').selectedIndex+getEl('flightSRC').selectedIndex+getEl('flightCNN').selectedIndex)-1;
			}
		}else{
			if (getEl('childseniorfull').style.display=='block'){
				if (getEl('flightADTmain').selectedIndex > 0){ // 31
					getEl('flightADTmain').selectedIndex=getEl('flightADT').selectedIndex-1;
				} // 31
			}
		}
		getEl('childseniorcompact').style.display='block';
		getEl('childseniorfull').style.display='none';
		getEl('affChldSen').style.display='block';
		
		if (getEl('affMoreText')) {
			getEl('affMoreText').innerHTML = affMore2;
		}
		
		if(getEl('affFltSrchOpts'))getEl('affFltSrchOpts').style.display='none';
		getEl('affAwdSrchOpts').style.display='block';
		//getEl('affAwdFee').style.display='block';
		getEl('affstops').selectedIndex=getEl('stops').selectedIndex;
		
		if (check10Alert==1) {
		//alert(affPass10Msg);
			
			if (getEl('lbl-pass-adlt')){
				getEl('lbl-pass-adlt').className='err';
			}
			if (getEl('srvErr0')){
				getEl('srvErr0').style.display='block';
			}
			if (getEl('srvErr0')){
				errVal=getEl('srvErr0');
				errVal.innerHTML=affPass10Msg;
				errVal.className='err';
				errVal.style.marginBottom='5px';
			}
			
		}
	}
}

function clrErrMsgs() {
	if (getEl('lbl-pass-adlt')) {
		getEl('lbl-pass-adlt').className='';	
	}
	if (getEl('srvErr0')) {
		getEl('srvErr0').innerHTML='';
		getEl('srvErr0').style.display='none';
	}
	if (getEl('lbl-pass0')) {
		getEl('lbl-pass0').className='ff29generic';
	}
}

function ValidateMileageUserId () {	
	
	var MPNO = document.shopInputForm.userId;
	var id = TrimString(MPNO.value);
	var cr='\n';
	var msg='';
	var isMP = false;
	var valid = true;
	var pwd = TrimString(document.shopInputForm.password.value);
		
	if (id.length == 0) {
	    valid = false;
		msg='MileagePlus # or email address is a required field. ' + cr; 
   	}
   	if (valid) {
   		var isNum = IsUserIdNumeric(MPNO, null);
	    if (isNum) {
		    isMP = true;
			elevenLength(MPNO);
			id = TrimString(MPNO.value);
	   	}
	   	if (isMP) {
	   		valid = isMpNumber(id);
	   		if (!valid) {
				msg='The MileagePlus number you have entered is invalid. Please check the number and resubmit.' + cr;
			}
		}
		else {
		    valid = isEmail(id);
			if (!isMP & !valid) {
	    		msg='The MileagePlus number or the email address you have entered is invalid. Please check the number or email address and resubmit.' + cr; 
	    	}
		}
	}
	if (pwd.length==0) {
		msg+='Password is a required field.' + cr    	
	}
	if (msg) {
        msg='Please Supply the Following:' + cr + cr + msg;
        alert(msg);				
        return false;
    }	
	return true;
}

function startPickupLocationText(){
	
	getEl('pickupLocation').value='City,state,county or country';
	getEl('pickupLocation').style.color='gray';
}
function onBlurPickupLocationText(){
	
	if(getEl('pickupLocation').value==''){
		getEl('pickupLocation').value='City,state,county or country';
		getEl('pickupLocation').style.color='gray';
	}
}
function changePickupLocationColor(){
	
	if(getEl('pickupLocation').value=='City,state,county or country'){
		getEl('pickupLocation').value='';
		getEl('pickupLocation').style.color='black';
	}
}
function showChildAndSeniorForHotel(){
	getEl("hotelAdultCompact").style.display = "none";

	getEl("hotelAdultComplete").style.display = "block";

}



/*Code added for MP remember me option - FSNE Part 2 - Starts*/
function rememberME(mpEmail){
	var today = new Date();
	var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*365*2)
   setCookie("rememberME", mpEmail, expires);
}
/*Code added for MP remember me option - FSNE Part 2 - Ends*/


function validateEml(str){
	re = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]{0,4}[a-zA-Z]$/;
	return (re.test(str));
}


function validateMP(MPNO){
	if (!/^\d{11}$/.test(MPNO) ) {return false;}
	var factor = [5,4,3,2,7,6,5,4,3,2]; var check = 0;
	for (var digit = 0; digit < 10; digit++)
		check += MPNO.charAt(digit) * factor[digit];
	check = (((11 - (check % 11)) % 11) % 10);
	return (check == MPNO.charAt(10));
}

function ValidateUserId3 (mpNum,pwd) {	
	var searchValue = mpNum.replace(/^\s*|\s*$/g,'');
	var msg='';
	if (searchValue.length == 0) {
		msg = 'MileagePlus # or email address is a required field.\n';
	}else 
		if (/^\d{1,11}$/.test(searchValue)) {
			while(searchValue.length < 11) {
				searchValue = "0" + searchValue
			};//pad left with 0 until length 11
			mpNum = searchValue;
			
			if(validateMP(searchValue)) {
			//f.authType.value="mp"; 
			}else{
				msg = 'The MileagePlus number you have entered is invalid. Please check the number and resubmit.\n';
			}//end testing for mpno
		//try to validate for email now
		}else{
			if(validateEml(searchValue)) {
				//f.authType.value="ea";
			}else{
				msg = 'The MileagePlus number or the email address you have entered is invalid. Please check the number or email address and resubmit.\n';
			}
		}
	
	if(pwd.length==0){
		msg+='Password is a required field.\n';   	
	}
	if(msg){
        msg='Please Supply the Following:\n\n' + msg;
        alert(msg);
        return false;
	}

	return true;
}

function toggleview(element1) {   
	element1 = getEl(element1);  
	var gotMPno = null;
	var rememberME = getCookie("rememberME");
																											
	if(rememberME!= undefined && rememberME=="E"){
		gotMPno = getCookie("rememberEMAIL");
																												
	}
	if(rememberME!= undefined && rememberME=="M"){
		gotMPno = getCookie("getMP");
																												
	}
	if(gotMPno != null){ 			
		getEl('mpnumber').value=gotMPno;			
		getEl('remMP1').checked=true;
	
	}	 
	element1.style.display = 'block';   
	var element2 = getEl("mpLogin");   
	element2.style.display = 'none';   
																										  
	return;   
}


	if (getEl("SearchBySCHEDULE")){
		getEl("SearchBySCHEDULE").checked = true;
	
	}																									
	function submitMPFF(){
		if (ff29AffSubmit('normal')){
			getEl('sideform').submit();
		}	
	}

	$(document).ready(function(){
		// initialization
		if(getCookie("homeArpt")){
			getEl('shop_from0').value=getCookie("homeArpt");
			// No vacations button, that's why the below line is commented out
			//getEl("vacationO").value=getCookie("homeArpt"); 
		
		}
	
	
	
		readyAutosuggest();
		if(getCookie("rememberProfile")==null){		
			getEl('loginNowblock').style.display='block';
			if(getEl('bestPricing').style.display=='none'){
				getEl('mpLogin').style.display='block';

			}

		}else {
			getEl('loginNowblock').style.display='none';
		
		}
		var isFltTypesOn=true;
		
		if(isFltTypesOn){
			getEl('fltTypes').style.display='block';
		
		}else{
			getEl('fltTypes').style.display='none';
		
		}
	
	});
	
	shop_depart[0] = (new Date(todaysBimonthDate).zeroTime()).addDays(14);	
  	var shop_arrive0  = (new Date(todaysBimonthDate).zeroTime()).addDays(21);
  	jspPage = false;
 	roundTrip = true;  
  	homePageCheck = false; 
   	flightCount = 1;
 
 
 
$(document).ready(function(){
	$(window).bind('resize', function(){ 
		$('#dp-popup').css('display','none');					
		resizeAutosuggest();
	 
	});
	displayHPdefaultDates();
	$('.date-pick').bind('focus', function(e){
		onFocusCall(this,"pb");
		
	});	
	$(document).bind('keydown', function(event){ 
		handleEscTab(event);
									
	}); 
	$('#dp-popup').bind('click', function(e){
		textboxFocus = true;			
	
	});
	$('.date-pick').bind('click', function(e){
		onClickCal(this);
	
	});
	$('.date-pick').bind('keyup', function(e) {	
		handleEditDate(this);
		
	});	
	$('#link_nav_prev').bind('click', function(e){
		displayPrevMonth();
	
	});
	$('#link_nav_next').bind('click', function(e){
		displayNextMonth();
	
	});
	$('#dp-link-close').bind('click', function(e){			
		closePopUp(dateId); 
	
	});
	$('body').click(function(e){
		if(getEl('dp-popup') && (getEl('dp-popup').style.display == 'block')){
			closeCal(e);
		
		}
		if( getEl('iframe') && (getEl('iframe').style.display == "block" )){
			documentOnclickForAutosuggest();// function inpmenented in autoSuggestSuggestion.js
		
		}
	
	});
	if (globalSwitch == "overview") {
		$('#wayRound').bind('click', function(e) {
			affTripType=2;ff29ToggleReturn('wayRound');
		});
		$('#wayOne').bind('click', function(e) {
			affTripType=1;ff29ToggleReturn('wayOne');setRoundTrip('false');
		});
	}
	
	chgAff(2);
	$('#aff, #ff29loginlink, #ff29loginpanel').hide();
	$('#ff29search, #ff29loginpanel').css('padding-top','0');

	//Tab indexing control for MP FF
	tabIndexMP();
	function tabIndexMP (){
				$(function(){
		 			var tabindex = 80;
		 			$('#ff29pane1 input,#ff29pane1 select,#ff29pane1 a').each(function() {
		 				if (this.type != "hidden" ){ //|| none {|| this.display !="none"
		 					var $input = $(this);
		 					$input.attr("tabindex", tabindex);
		 					tabindex++;
		 				}
		 			});
		 			$('#p1sub1aContent .second a').attr("tabindex", '85');
		 			$('#shop_from0_temp').attr("tabindex", '86');
		 			$('#shop_to0_temp').attr("tabindex", '87');
		 			$('#fromnearby1').attr("tabindex", '88');
		 			$('#tonearby1').attr("tabindex", '89');
		 		});
		 	}

	//Tab indexing control for MP FF -->


});



