function fabCount()
{
  var qsParams = "";
  var bResult = true;
  var obj = document.getElementById("fabDest");
  
  if( obj.value == "R26,R23,R22" )
    qsParams += ( (( qsParams != "" )? "&" : "") + "r=26&r2=23&r3=22" );
  else if( obj.value != 0 )
    qsParams += ( (( qsParams != "" )? "&" : "") + obj.value.replace(/R/, "r=").replace(/C/, "y1=") );

  showMoreCountries();
  
  if( obj.value != 0 ) {
    qsParams += ( (( qsParams != "" )? "&" : "") + "y2=" + document.getElementById("fabCountryID2").value.replace(/C/, "") );
    qsParams += ( (( qsParams != "" )? "&" : "") + "y3=" + document.getElementById("fabCountryID3").value.replace(/C/, "") );
    qsParams += ( (( qsParams != "" )? "&" : "") + "y4=" + document.getElementById("fabCountryID4").value.replace(/C/, "") );
  }

  var valFrom = document.getElementById("fabFromDate").value;
  var valTo = document.getElementById("fabToDate").value;
  
  valFrom = ( valFrom == "" )? 0 : parseInt( valFrom );
  valTo = ( valTo == "" )? 0 : parseInt( valTo );
  bResult = ( !valFrom || !valTo || valTo >= valFrom );

  if( !bResult )
    alert( "Your selections of \"From Date\" and \"To Date\" will not produce any result." );
  else if ( valFrom || valTo ) {
    if( valFrom )
      qsParams += ( (( qsParams != "" )? "&" : "") + "sm=" + valFrom );
  
    if( valTo )
      qsParams += ( (( qsParams != "" )? "&" : "") + "tm=" + valTo );
  }
  
  if( bResult ) {
    valFrom = parseInt( document.getElementById("fabMinDay").value );
    valTo = parseInt( document.getElementById("fabMaxDay").value );
    bResult = ( !valFrom || !valTo || valTo >= valFrom );

    if( !bResult )
      alert( "Your selections of \"Minimum Days\" and \"Maximum Days\" will not produce any result." );
    else if ( valFrom || valTo ) {
      if( valFrom )
        qsParams += ( (( qsParams != "" )? "&" : "") + "md=" + valFrom );
  
      if( valTo )
        qsParams += ( (( qsParams != "" )? "&" : "") + "xd=" + valTo );
    }
  }
  
  if( bResult ) {
    Spry.Utils.updateContent( "fabCount", "/inc/fabinfo.cfm?" + qsParams );

    if ( document.getElementById("fabCountContainer").style.display != "block" )
      document.getElementById("fabCountContainer").style.display = "block";
  }
}

//----------------------------------------------------------------------

function submitFAB( objForm )
{
  var bResult = parseInt( document.getElementById("fabCount").innerHTML ) > 0;

  if( !bResult ) {
    alert( "Unfortunately, there are no Contiki tour departures that match\r" +
           "your selections. Please change your selections and try again." );
  }
  
  return bResult;
}

//----------------------------------------------------------------------

function showMoreCountries()
{
  var obj = document.getElementById("fabDest");
  
  if( obj[obj.selectedIndex].className.match(/multi/i) ) {
    document.getElementById("fabCountryID2").style.display = "block";
    document.getElementById("fabCountryID3").style.display = "block";
    document.getElementById("fabCountryID4").style.display = "block";
  }
  else {
    document.getElementById("fabCountryID2").style.display = "none";
    document.getElementById("fabCountryID3").style.display = "none";
    document.getElementById("fabCountryID4").style.display = "none";

    document.getElementById("fabCountryID2").selectedIndex = 0;
    document.getElementById("fabCountryID3").selectedIndex = 0;
    document.getElementById("fabCountryID4").selectedIndex = 0;
  }
}

//----------------------------------------------------------------------

