// JavaScript Document
function refreshDest(FormEnCours, destination, gateway)
{
		useRuntimeGateway(FormEnCours);
	
        var GateEnCours;
        var indice = 0;
        if (gateway)
        {
                GateEnCours                   = gateway;
                FormEnCours.gateway_dep.value = gateway;
        }
        else
        {
                //alert(FormEnCours.gateway_dep.options[FormEnCours.gateway_dep.selectedIndex].value);
                GateEnCours = FormEnCours.gateway_dep.options[FormEnCours.gateway_dep.selectedIndex].value;
        }
    if (GateEnCours == "") {  FormEnCours.dest_dep.length = 1  }
    else
    {
      var ListeEnCours = eval(GateEnCours);
      FormEnCours.dest_dep.length = 1;
    for (var compteur = 0; compteur < ListeEnCours.length; compteur++)
    {
        indice = compteur + 1;
        //alert(eval('nom_' + ListeEnCours[compteur]));

        FormEnCours.dest_dep.options[indice] = new Option( eval('nom_' + ListeEnCours[compteur]));
        FormEnCours.dest_dep.options[indice].value = ListeEnCours[compteur];

        //alert(FormEnCours.dest_dep.options[compteur].value);
        if ( ListeEnCours[compteur] == destination) { FormEnCours.dest_dep.selectedIndex = indice  }
      }
    }
//alert('option0' +FormEnCours.dest_dep.options[0].text);
}

function RefreshDest34(form)
{
    var no_ville = form.dest_dep.options[form.dest_dep.selectedIndex].value;
//alert(form.dest_dep.options[form.dest_dep.selectedIndex].value);

        self.location="queryforf.cgi?code_ag=myr&alias=MYR&language=en&gateway_dep="+form.gateway_dep.options[form.gateway_dep.selectedIndex].value+"&departure_day="+form.departure_day.options[form.departure_day.selectedIndex].value+"&departure_month="+form.departure_month.options[form.departure_month.selectedIndex].value+"&dest_dep="+no_ville;
 }

//function refreshHotels(FormEnCours, DestEnCours) -ss
function refreshHotels(FormEnCours, DestEnCours, HotelNo) //-SS
{
	if ( DestEnCours == "0" )  { DestEnCours = FormEnCours.dest_dep.value; }

	var ListeEnCours = eval('dest_' + DestEnCours);
	FormEnCours.no_hotel.length = 1;

	for (var compteur = 0; compteur < ListeEnCours.length; compteur++)
    {
			indice = compteur + 1; //-SS
	//    	FormEnCours.no_hotel.options[compteur + 1] = new Option( ListeEnCours[compteur] );
	        FormEnCours.no_hotel.options[compteur + 1] = new Option( eval('hotel_'+ListeEnCours[compteur]) );
        	FormEnCours.no_hotel.options[compteur + 1].value = ListeEnCours[compteur];
			if ( ListeEnCours[compteur] == HotelNo) { FormEnCours.no_hotel.selectedIndex = indice  } //-SS
	}
	refreshDurations(FormEnCours, DestEnCours);
}

function refreshDurations(FormEnCours, DestEnCours)
{
	if ( DestEnCours == "0" )  { DestEnCours = FormEnCours.dest_dep.value; }

	if ( (DestEnCours == 'LAS') || (DestEnCours == 'LAX') || (DestEnCours == 'NAS') || (DestEnCours == 'HAV')  || (DestEnCours == 'CYO') || (DestEnCours == 'VRA'))
	{
		FormEnCours.duration.length = 0;
		FormEnCours.duration.options[0] = new Option( "3 ou 4 jours" );
		FormEnCours.duration.options[0].value = "3";
		FormEnCours.duration.options[1] = new Option( "1 semaine" );
		FormEnCours.duration.options[1].value = "7";
		FormEnCours.duration.options[2] = new Option( "2 semaines" );
		FormEnCours.duration.options[2].value = "14";
	}
	else
	{
		FormEnCours.duration.length = 0;
		FormEnCours.duration.options[0] = new Option( "1 semaine" );
		FormEnCours.duration.options[0].value = "7";
		FormEnCours.duration.options[1] = new Option( "2 semaines" );
		FormEnCours.duration.options[1].value = "14";
	}

}


function refreshStars(FormEnCours, HotelEnCours)
{
    if ( HotelEnCours == "0" )  { HotelEnCours = FormEnCours.no_hotel.value }

      if (HotelEnCours == "")
      {
        FormEnCours.star.length = 1

        FormEnCours.star.options[1] = new Option( "2 étoiles ou mieux" )
        FormEnCours.star.options[1].value = "2"
        FormEnCours.star.options[2] = new Option( "3 étoiles ou mieux" )
        FormEnCours.star.options[2].value = "3"
        FormEnCours.star.options[3] = new Option( "4 étoiles ou mieux" )
        FormEnCours.star.options[3].value = "4"
        FormEnCours.star.options[4] = new Option( "5 étoiles ou mieux" )
        FormEnCours.star.options[4].value = "5"

      }
      else
      {  FormEnCours.star.length = 1  }
}

function useRuntimeGateway(FormEnCours)
{

	if((typeof IsUseRuntimeGateway == 'undefined') == true)
		return;


	if( IsUseRuntimeGateway == true)
	{
		FormEnCours.gateway_dep.length = 0;
		for (var i = 0; i < ArrGatewayTitle.length; i++)
    	{
	        FormEnCours.gateway_dep.options[i ] = new Option(ArrGatewayTitle[i]);
        	FormEnCours.gateway_dep.options[i ].value = ArrGatewayCode[i];
		}
		IsUseRuntimeGateway = false;
	}
}

