function validateForm40001()
{
   var retStr = '';
  /*nili 02/07/2009
   if ((FO.Destination.value == "0") || (FO.Destination.value == "")) retStr += (FO.Destination.em1 + '\n');*/
   if ((FO.Departure.value == "0") || (FO.Departure.value == "")) retStr += (FO.Departure.em1 + '\n');
   if ((FO.Landing.value == "0") || (FO.Landing.value == "")) retStr += (FO.Landing.em1 + '\n');
   if (FO.DateFrom.value.length == 0) retStr += (FO.DateFrom.em1 + '\n');
   if(FO.flightType1.checked) if (FO.DateTo.value.length == 0) retStr += (FO.DateTo.em1 + '\n');
   if (retStr != '')
   {
      alert(retStr);
      return false;
   }
   else if( ! checkFormDates(FO))
   {
      return false;
   }
   enableFrmCombo();
   return true;
}

function enableFrmCombo()
{
   FO.Departure.disabled = false;
   FO.Landing.disabled = false;
}
function changeLanState()
{
   if(FO.Landing.length == 2)
   {
      FO.Landing.selectedIndex = 1;
      if(FO.flightType1.checked)
      {
         setDateTo_Diff(FO.DateFrom, FO.DateTo, FO.Landing.options[1]);
      }
      FO.Landing.disabled = true;
   }
   else
   {
      FO.Landing.disabled = false;
      FO.DateTo.value = '';
   }
}
function enableDateTo(flag)
{
   if (flag)
   {
      if( ! FO.DateTo.value.length)
      {
         if(isValidDate(FO.DateFrom.value)) FO.DateFrom.onkeyup();
      }
      else
      {
         if( ! isValidDate(FO.DateTo.value)) FO.DateFrom.onkeyup();
      }
   }
   FO.DateTo.disabled = ! flag;
}
function changeState()
{
   if(GLOB_flightType.toLowerCase() != "n")
   {
      FO.flightType1.onmousedown();
      FO.flightType1.checked = true;
      FO.flightType1.onclick();
      FO.backFrom.disabled = false;
      FO.DateTo.disabled = false;
      /* Nili 02/07/2009
	FO.flightType2.disabled = (FO.Destination.options[FO.Destination.selectedIndex].oneDir == "1") ? false : true;*/
   }
   else
   {
      FO.flightType2.onmousedown();
      FO.flightType2.checked = true;
      FO.flightType2.onclick();
   }
   GLOB_flightType = "";
   if(FO.Departure.length == 2)
   {
      FO.Departure.selectedIndex = 1;
      FO.Departure.onchange();
      FO.Departure.disabled = true;
   }
   else FO.Departure.disabled = false;
   changeLanState();
}

// Nili 14/07/2009
function Initialize()
{
  if(typeof FO.DateFrom == "object")FO.DateFrom.value = (isValidDate(GLOB_DateFrom)) ? GLOB_DateFrom : parseDateInToCalendarFormat(new Date());
  if(GLOB_Departure.length)
  {
    FO.Departure.value = GLOB_Departure;
    FO.Departure.onchange();
    if(GLOB_Landing.length)
    {
      FO.Landing.value = GLOB_Landing;
      FO.Landing.onchange();
    }
  }
  if(typeof FO.DateTo == "object")FO.DateTo.value = (isValidDate(GLOB_DateTo)) ? GLOB_DateTo : FO.DateTo.value;
  if(FO.flightType2.checked)
  {
    NF = false;
    FO.flightType2.onclick();
  }
}

/* Nili
function Initialize()
{
  if(typeof FO.DateFrom == "object")FO.DateFrom.value = (isValidDate(GLOB_DateFrom)) ? GLOB_DateFrom : parseDateInToCalendarFormat(new Date());
   Nili 02/07/2009
   if (FO.Destination.value != '0' && FO.Destination.value != '')
   {
      FO.Destination.onchange();
      if(GLOB_Departure.length)
      {
         FO.Departure.value = GLOB_Departure;
         FO.Departure.onchange();
         if(GLOB_Landing.length)
         {
            FO.Landing.value = GLOB_Landing;
            FO.Landing.onchange();
         }
      }
   }
   if(typeof FO.DateTo == "object")FO.DateTo.value = (isValidDate(GLOB_DateTo)) ? GLOB_DateTo : FO.DateTo.value;
   FO.Destination.focus();
   if(FO.flightType2.checked)
   {
      NF = false;
      FO.flightType2.onclick();
   }
 }*/

function getLandingByDepart(ob, DepartCODE)
{
   var x = new Array();
   x = (GLOB_ActiveFlightType == 2) ? ADP : LDP;
   ClearCombo(ob);
   if(DepartCODE != "0")
   {
      for(var i = 0; i < x.length; i ++ )
      {
         if(( x[i][1].split('*')[1] == DepartCODE ) && (x[i][2].length > 0))
         {
            var oList = x[i][2].split('^');
            for(var j = 0; j < oList.length; j ++ )
            {
               elem = document.createElement("OPTION");
               elem.value = oList[j].split('*')[1].split('%')[0];
               elem.text = oList[j].split('*')[0];
               if(typeof oList[j].split('*')[1].split('%')[1] == "string")
               elem.dateDiff = oList[j].split('*')[1].split('%')[1];
               ob.add(elem);
            }
            return;
         }
      }
   }
}