/*
 * Called on NewSearch page to initialize controls during page load
 */
function on_load ( value )
{
  changeSearchScenario(value);
}


/*
 * 1)
 *   If search date type is open dates, then build URL for BestFareFinder.
 * 2)
 *   If not open date search:
 *   Called when form is submitted to ensure the onblur function, if focus is on a field
 *   that has an onblur handler defined, has time to process before the form is submitted.
 */
function doSubmit ( jid )
{
  var form           = document.AirSearchForm;
  // set/clear the Navigator Filters
  if ( form.airlineSearchPref )
  {
    var value = document.AirSearchForm.airlineSearchPref.value;
    copyAirlinePref( value );
    setFilterStops();
  }

  // handle prefill date fields
  if ( form.leavingDate4 )
  {
    if ( form.leavingDate4.value == 'mm/dd/yyyy' ||
         form.leavingDate4.value == 'dd/mm/yyyy'  )
    {
      form.leavingDate4.value = '';
    }
  }
  if ( form.leavingDate3 )
  {
    if ( form.leavingDate3.value == 'mm/dd/yyyy' ||
         form.leavingDate3.value == 'dd/mm/yyyy'  )
    {
      form.leavingDate3.value = '';
    }
  }
  if ( form.leavingDate2 )
  {
    if ( form.leavingDate2.value == 'mm/dd/yyyy' ||
         form.leavingDate2.value == 'dd/mm/yyyy'  )
    {
      form.leavingDate2.value = '';
    }
  }
  if ( form.leavingDate1 )
  {
    if ( form.leavingDate1.value == 'mm/dd/yyyy' ||
         form.leavingDate1.value == 'dd/mm/yyyy'  )
    {
      form.leavingDate1.value = '';
    }
  }
  if ( form.flightType && form.flightType[0].checked )
  {
    if ( form.dateTypeSelect && form.dateTypeSelect[0].checked )
    {
      if ( form.leavingDate.value == '' )
      {
        copyLeavingDate( form.leavingDateExact.value );
      }
      if ( form.returningDate.value == '' )
      {
        copyReturningDate( form.returningDateExact.value );
      }
    }
    else if ( form.dateTypeSelect && form.dateTypeSelect[1].checked )
    {
      if ( form.leavingDate.value == '' )
      {
        copyLeavingDate( form.leavingDatePlusMinus.value );
      }
      if ( form.returningDate.value == '' )
      {
        copyReturningDate( form.returningDatePlusMinus.value );
      }
    }
  }
  // setup the returningDate...
  // For OneWay, the returningDate should be the same as the leavingDate
  if ( form.flightType && form.flightType[1].checked == true )
  {
    form.returningDate.value = form.leavingDate.value;
  }
  else // for multicity, the returningDate should be the last depart date

  if ( form.flightType && form.flightType[2].checked == true )
  {
    var lastDepartDate = form.leavingDate4.value;

    if ( lastDepartDate != '' )
    {
      form.returningDate.value = lastDepartDate;
    }
    else
    {
      lastDepartDate = form.leavingDate3.value;

      if ( lastDepartDate != '' )
      {
        form.returningDate.value = lastDepartDate;
      }
      else
      {
        lastDepartDate = form.leavingDate2.value;

        if ( lastDepartDate != '' )
        {
          form.returningDate.value = lastDepartDate;
        }
        else
        {
          lastDepartDate = form.leavingDate1.value;

          if ( lastDepartDate != '' )
          {
            form.returningDate.value = lastDepartDate;
          }
        }
      }
    }
  }
  // add parameters to the URL for Open Dates
  if ( ( form.dateTypeSelect  ) &&  ( form.dateTypeSelect[2] )  )
    {
      if ( form.dateTypeSelect[2].checked  )
  {
    form.action = "/flights/FlexibleDatesAction.do";
    if ( jid )
    {
      form.action = form.action + ";jsessionid=" + jid;
    }
    form.submit();
  }
  else
  {
    setTimeout( 'document.AirSearchForm.submit( )', 10 );
  }
    }
    else
    {
      setTimeout( 'document.AirSearchForm.submit( )', 10 );
    }
}

/*
 * Called when when focus leaves one of the fields below to ensure all of these fields
 * contain the same value.
 */
function copyLeavingFrom( value )
{
  document.AirSearchForm.leavingFrom.           value = value;
  document.AirSearchForm.leavingFrom1.          value = value;
}

/*
 * Called when when focus leaves one of the fields below to ensure all of these fields
 * contain the same value.
 */
function copyGoingTo( value )
{
  document.AirSearchForm.goingTo.               value = value;
  document.AirSearchForm.goingTo1.              value = value;
}

/*
 * Called when focus leaves the airlineSearchPref field to copy the value to
 * the filterAirline field
 */
function copyAirlinePref( value )
{
  if ( document.AirSearchForm.airlineSearchPref.value != 'searchAll' )
  {
    document.AirSearchForm.filterAirline.value = value;
  }
  else
  {
    document.AirSearchForm.filterAirline.value = "";
  }
}

/*
 * Called when maxConnections is changed
 */
function setFilterStops()
{
  if ( document.AirSearchForm.maxConnections.checked )
  {
    document.AirSearchForm.filterStops.value = "0";
  }
  else
  {
    document.AirSearchForm.filterStops.value = "";
  }
}

/*
 * Called when when focus leaves one of the fields below to ensure all of these fields
 * contain the same value.
 */
function copyLeavingDate( value )
{
  document.AirSearchForm.leavingDate.           value = value;
  document.AirSearchForm.leavingDate1.          value = value;
  document.AirSearchForm.leavingDateDepart.     value = value;
  document.AirSearchForm.leavingDateExact.      value = value;
  document.AirSearchForm.leavingDatePlusMinus.  value = value;
}

/*
 * Called when when focus leaves one of the fields below to ensure all of these fields
 * contain the same value.
 */
function copyLeavingTime( value )
{
  document.AirSearchForm.dateLeavingTime.       value = value;
  document.AirSearchForm.leavingTimeDepart.     value = value;
  document.AirSearchForm.leavingTime1.          value = value;
}

/*
 * Called when when focus leaves one of the fields below to ensure all of these fields
 * contain the same value.
 */
function copyReturningDate( value )
{
  document.AirSearchForm.returningDate.         value = value;
  document.AirSearchForm.returningDateExact.    value = value;
  document.AirSearchForm.returningDatePlusMinus.value = value;
}

/*
 * Called when when focus leaves one of the fields below to ensure all of these fields
 * contain the same value.
 */
function copyReturningTime( value )
{
  document.AirSearchForm.dateReturningTime.     value = value;
  document.AirSearchForm.leavingTime2.          value = value;
}

function redirectToTotalTrip( )
{
  document.AirSearchForm.action = "/trips/InitialSearch.do?fromFlights=true";
  document.AirSearchForm.submit( );
}

/*
 *  Called when the user selects a control that changes the appearance
 *  of the Search Page.
 *
 *  These controls are:
 *    Flight Types:    RoundTrip, OneWay, MultiCity radio buttons
 *    Cross-Sell:      Air Only, Air + Hotel radio buttons
 *    Nearby Airports: Nearby Airportcheckbox
 *    Dates:           Exact Dates, PlusMinus Dates, Open Dates
 *
 *  This method will determine which scenario should be setup.
 */
function changeSearchScenario( value )
{
  // setup nextAction as non-CrossSell
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  // if Round Trip is selected...
  if ( document.AirSearchForm.flightType[0].checked == true )
  {
    // if Exact Dates selected...
    if ( document.AirSearchForm.dateTypeSelect[0].checked == true )
    {
      // if CrossSell is selected
      if ( document.AirSearchForm.tripType[1].checked == true )
      {
        setupSearchScenario2();
      }
      else // if NearbyAirport is selected
      if ( document.AirSearchForm.nearbyAirports.checked == true )
      {
        setupSearchScenario3();
      }
      else // CrossSell and Nearby Airport are NOT selected
      {
        setupSearchScenario1(value);
      }
    }
    else // if PlusMinus dates selected
    if ( document.AirSearchForm.dateTypeSelect[1].checked == true )
    {
      setupSearchScenario4();
    }
    else if ( document.AirSearchForm.dateTypeSelect[2] && document.AirSearchForm.dateTypeSelect[2].checked == true )
    {
      setupSearchScenario5();
    }
    else
    {
      alert( 'no Date Option selected for RoundTrip' );
    }

  }
  else // if OneWay selected
  if ( document.AirSearchForm.flightType[1].checked == true )
  {
    // if PlusMinus date is selected, then select Exact Date instead
    if ( document.AirSearchForm.dateTypeSelect[1].checked == true )
    {
      document.AirSearchForm.dateTypeSelect[1].checked = false;
      document.AirSearchForm.dateTypeSelect[0].checked = true;
    }

    // if Exact Dates selected...
    if ( document.AirSearchForm.dateTypeSelect[0].checked == true )
    {
      setupSearchScenario6();
    }
    else if ( document.AirSearchForm.dateTypeSelect[2] && document.AirSearchForm.dateTypeSelect[2].checked == true )
    {
      setupSearchScenario7();
    }
    else
    {
      alert( 'no Date Option selected for OneWay' );
    }
  }
  else // MultiCity selected
  if ( document.AirSearchForm.flightType[2].checked == true )
  {
    setupSearchScenario8();
  }
  else
  {
    alert( 'no Flight Type selected' );
  }
}


/*
 * Setup Search Scenario 1
 *   RoundTrip      selected
 *   CrossSell      not selected
 *   Nearby Airport not selected
 *   Exact Dates    selected
 */
function setupSearchScenario1(value)
{
  //alert( 'in setupSearchScenario1' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!1" );

  // hide/show the cross sell fields
  if (value == 1)
  {
    noneBlock( "crossSellForm!0" );
  }
  else
  {
    noneBlock( "crossSellForm!1" );
  }

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!1" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!1" );
  noneBlock( "idExactLi!1" );
  noneBlock( "idFlexibleLi!1" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!1" );


  // hide/show the date fields
  noneBlock( "idExactDates!1" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!0" );
 
  noneBlock( "oneWayForm!0" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!1" );              // COS/FareType
  noneBlock( "tfConnections!1" );
  noneBlock( "idFareTypeLabel!4" );
  noneBlock( "idFareTypeValue!4" );
  setVisibility( "idClassOfServiceLabel!1" );
  setVisibility( "idClassOfServiceValue!1" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&SelectRadioFont" );
  cssSwitch( "oneWayRadio&NSelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&formBold" );
  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesNSelectRadioBG");


  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&SelectRadioFont" );
  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&NSelectRadioFont");


  // set the background for the date options
  cssSwitch( "tfDateFlexibility&selectedBG" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';


  setButtonText( );
}


/*
 * Setup Search Scenario 2
 *   RoundTrip      selected
 *   CrossSell      selected
 *   Nearby Airport not selected
 *   Exact Dates    selected
 */
function setupSearchScenario2()
{
  //alert( 'in setupSearchScenario2' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!1" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!1" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!0" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!0" );
  noneBlock( "idExactLi!0" );
  noneBlock( "idFlexibleLi!0" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!0" );


  // hide/show the date fields
  noneBlock( "idExactDates!1" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!0" );
  noneBlock( "oneWayForm!0" );       // exact dates for oneway


  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!0" ); // all Preferences
  noneBlock( "tfMore!0" );              // COS/FareType
  noneBlock( "tfConnections!0" );
  setVisibility( "idClassOfServiceLabel!0" );
  setVisibility( "idClassOfServiceValue!0" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&SelectRadioFont" );
  cssSwitch( "oneWayRadio&NSelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&" );
  cssSwitch( "idAirPlusHotel&formBold" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesNSelectRadioBG");


  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&SelectRadioFont" );
  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&NSelectRadioFont");

 
  // set the background for the date options
  cssSwitch( "tfDateFlexibility&" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airPlusHotel&breadcrumbStart=1';

  setButtonText( );
}

/*
 * Setup Search Scenario 3
 *   RoundTrip      selected
 *   CrossSell      not selected
 *   Nearby Airport selected
 *   Exact Dates    selected
 */
function setupSearchScenario3()
{
  //alert( 'in setupSearchScenario3' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!1" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!0" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!1" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!0" );
  noneBlock( "idExactLi!0" );
  noneBlock( "idFlexibleLi!0" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!0" );


  // hide/show the date fields
  noneBlock( "idExactDates!1" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!0" );
  
  noneBlock( "oneWayForm!0" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!1" );              // COS/FareType
  noneBlock( "tfConnections!0" );
  noneBlock( "idFareTypeLabel!4" );
  noneBlock( "idFareTypeValue!4" );
  setVisibility( "idClassOfServiceLabel!0" );
  setVisibility( "idClassOfServiceValue!0" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&SelectRadioFont" );
  cssSwitch( "oneWayRadio&NSelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&formBold" );
  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesNSelectRadioBG");


  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&SelectRadioFont" );
  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&NSelectRadioFont");


  // set the background for the date options
  cssSwitch( "tfDateFlexibility&" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  setButtonText( );
}

/*
 * Setup Search Scenario 4
 *   RoundTrip         selected
 *   Plus/Minus Dates  selected
 */
function setupSearchScenario4()
{
  //alert( 'in setupSearchScenario4' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!0" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!0" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!0" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!1" );
  noneBlock( "idExactLi!1" );
  noneBlock( "idFlexibleLi!1" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!1" );


  // hide/show the date fields
  noneBlock( "idExactDates!0" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!1" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!0" );
  noneBlock( "oneWayForm!0" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!1" );              // COS/FareType
  noneBlock( "tfConnections!0" );
  noneBlock( "idFareTypeLabel!4" );
  noneBlock( "idFareTypeValue!4" );
  setVisibility( "idClassOfServiceLabel!0" );
  setVisibility( "idClassOfServiceValue!0" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&SelectRadioFont" );
  cssSwitch( "oneWayRadio&NSelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&formBold" );
  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesNSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesNSelectRadioBG");


  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&NSelectRadioFont" );
  cssSwitch( "idFlexibleRadio&SelectRadioFont" );
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&NSelectRadioFont");


  // set the background for the date options
  cssSwitch( "tfDateFlexibility&selectedBG" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  setButtonText( );
}


/*
 * Setup Search Scenario 5
 *   RoundTrip      selected
 *   Open Dates     selected
 */
function setupSearchScenario5()
{
  //alert( 'in setupSearchScenario5' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!0" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!0" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!0" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!1" );
  noneBlock( "idExactLi!1" );
  noneBlock( "idFlexibleLi!1" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!1" );

  // hide/show the date fields
  noneBlock( "idExactDates!0" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!1" );
  noneBlock( "oneWayForm!0" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!0" );              // COS/FareType
  noneBlock( "tfConnections!0" );
  noneBlock( "idFareTypeLabel!0" );
  noneBlock( "idFareTypeValue!0" );
  setVisibility( "idClassOfServiceLabel!0" );
  setVisibility( "idClassOfServiceValue!0" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&SelectRadioFont" );
  cssSwitch( "oneWayRadio&NSelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&formBold" );
  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesNSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesSelectRadioBG");

  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&NSelectRadioFont" );
  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&SelectRadioFont");

  // set the background for the date options
  cssSwitch( "tfDateFlexibility&selectedBG" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  setButtonText( );
}

/*
 * Setup Search Scenario 6
 *   OneWay         selected
 *   Exact Dates    selected
 */
function setupSearchScenario6()
{
  //alert( 'in setupSearchScenario6' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!0" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!0" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!0" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!1" );
  noneBlock( "idExactLi!1" );
  noneBlock( "idFlexibleLi!0" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!1" );


  // hide/show the date fields
  noneBlock( "idExactDates!0" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!0" );
  noneBlock( "oneWayForm!1" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!1" );              // COS/FareType
  noneBlock( "tfConnections!1" );
  noneBlock( "idFareTypeLabel!4" );
  noneBlock( "idFareTypeValue!4" );
  setVisibility( "idClassOfServiceLabel!1" );
  setVisibility( "idClassOfServiceValue!1" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&NSelectRadioFont" );
  cssSwitch( "oneWayRadio&SelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&formBold" );
  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesNSelectRadioBG");


  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&SelectRadioFont" );
  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&NSelectRadioFont");

  // set the background for the date options
  cssSwitch( "tfDateFlexibility&selectedBG" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  setButtonText( );
}

/*
 * Setup Search Scenario 7
 *   OneWay         selected
 *   Open Dates     selected
 */
function setupSearchScenario7()
{
  //alert( 'in setupSearchScenario7' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!1" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!0" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!0" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!0" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!0" );

  // hide/show the date options Section
  noneBlock( "tfDF!1" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!1" );
  noneBlock( "idExactLi!1" );
  noneBlock( "idFlexibleLi!0" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!1" );


  // hide/show the date fields
  noneBlock( "idExactDates!0" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!1" );
  
  noneBlock( "oneWayForm!0" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!0" );              // COS/FareType
  noneBlock( "tfConnections!0" );
  noneBlock( "idFareTypeLabel!0" );
  noneBlock( "idFareTypeValue!0" );
  setVisibility( "idClassOfServiceLabel!0" );
  setVisibility( "idClassOfServiceValue!0" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&NSelectRadioFont" );
  cssSwitch( "oneWayRadio&SelectRadioFont" );
  cssSwitch( "multiCityRadio&NSelectRadioFont" );

  // set the font for the cross sell fields
  cssSwitch( "idAirOnly&formBold" );
  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
  cssSwitch( "idExactLi&datesNSelectRadioBG" );
  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
  if( document.getElementById( "idOpenLi" ) )cssSwitch( "idOpenLi&datesSelectRadioBG");

  // set the font for the date radio buttons
  cssSwitch( "idExactRadio&NSelectRadioFont" );
  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
   
  if( document.getElementById( "idOpenRadio" ) )cssSwitch( "idOpenRadio&SelectRadioFont");


  // set the background for the date options
  cssSwitch( "tfDateFlexibility&selectedBG" );


  // set the section numbers
  fltrObj( "step4|4" );
  fltrObj( "step5|5" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  setButtonText( );
}

/*
 * Setup Search Scenario 8
 *   MultiCity      selected
 */
function setupSearchScenario8()
{
  //alert( 'in setupSearchScenario8' );

  // show/hide the appropriate Origin/Destination fields
  noneBlock( "roundtripForm!0" );     // oneway and roundtrip origin/destination
  noneBlock( "multiCityForm!1" );     // multicity origin/destination

  // the nearbyAirportPanel contains the nearby checkbox and crosssell radios
  noneBlock( "nearbyAirportPanel!0" );

  // hide/show the cross sell fields
  noneBlock( "crossSellForm!0" );

  // hide/show the nearby airport fields
  noneBlock( "nearbyAirportForm!0" );

  // hide/show the date options Section
  noneBlock( "tfDF!0" );

  // hide/show the date radio buttons
  noneBlock( "idRadioContainer!1" );
  noneBlock( "idExactLi!1" );
  noneBlock( "idFlexibleLi!1" );
  if( document.getElementById( "idOpenLi" ) )noneBlock( "idOpenLi!1" );


  // hide/show the date fields
  noneBlock( "idExactDates!0" );     // exact dates for roundtrip
  noneBlock( "idPlusMinusDates!0" ); // plus minus dates for roundtrip
  if( document.getElementById( "idFlexibleDates" ) )noneBlock( "idFlexibleDates!0" );
 
  noneBlock( "oneWayForm!0" );       // exact dates for oneway

  // hide/show the Preference Option fields
  noneBlock( "idAdditionalOptions!1" ); // all Preferences
  noneBlock( "tfMore!1" );              // COS/FareType
  noneBlock( "tfConnections!1" );
  noneBlock( "idFareTypeLabel!4" );
  noneBlock( "idFareTypeValue!4" );
  setVisibility( "idClassOfServiceLabel!1" );
  setVisibility( "idClassOfServiceValue!1" );


  // set the font for the flight type buttons
  cssSwitch( "roundtripRadio&NSelectRadioFont" );
  cssSwitch( "oneWayRadio&NSelectRadioFont" );
  cssSwitch( "multiCityRadio&SelectRadioFont" );

  // set the font for the cross sell fields
//  cssSwitch( "idAirOnly&formBold" );
//  cssSwitch( "idAirPlusHotel&" );

  // set the background for the date radio buttons
//  cssSwitch( "idExactLi&datesSelectRadioBG" );
//  cssSwitch( "idFlexibleLi&datesNSelectRadioBG" );
//  cssSwitch( "idOpenLi&datesNSelectRadioBG");

  // set the font for the date radio buttons
//  cssSwitch( "idExactRadio&SelectRadioFont" );
//  cssSwitch( "idFlexibleRadio&NSelectRadioFont" );
//  cssSwitch( "idOpenRadio&NSelectRadioFont");

  // set the background for the date options
//  cssSwitch( "tfDateFlexibility&selectedBG" );


  // set the section numbers
  fltrObj( "step4|3" );
  fltrObj( "step5|4" );


  // set nextAction value
  document.AirSearchForm.nextAction.value = 'airOnly&breadcrumbStart=1';

  setButtonText( );
}

