 var mylang = document.idForm.mylanguage.value;
 var zona1 = "» Hoteles de Ciudad";
 var zona2 = "» Hoteles de Costa";
 var zona3 = "» Hoteles de Montaña";
 var all_hotels = "TODOS LOS HOTELES";
 if (mylang == "en") {
	 zona1 = "» Urban hotels";
	 zona2 = "» Coast hotels";
	 zona3 = "» Mountain Hotels";
	 all_hotels = "ALL HOTELS";
	 }
  if (mylang == "fr") {
	 zona1 = "» Hôtels Urbains";
	 zona2 = "» Hôtels en bord de mer";
	 zona3 = "» Hôtels à la Montagne";
	 all_hotels = "TOUS LES HÔTELS";
	 }
  if (mylang == "de") {
	 zona1 = "» Stadthotels";
	 zona2 = "» Hotels an der küste";
	 zona3 = "» Hotels in den bergen";
	 all_hotels = "ALLE HOTELS";
	 }	 
  if (mylang == "ca") {
	 zona1 = "» Hotels Urbans";
	 zona2 = "» Hotels de Costa";
	 zona3 = "» Hotels de Muntanya";
	 all_hotels = "TOTS ELS HOTELS";
	 }
	if (mylang == "nl") {
	 zona1 = "» Hotels in Centrum";
	 zona2 = "» Hotels aan de Kust";
	 zona3 = "» Hotels in de Bergen";
	 all_hotels = "ALLE HOTELS";
	 } 
	if (mylang == "ru") {
	 zona1 = "» Oтели в городе";
	 zona2 = "» Oтели на побережье";
	 zona3 = "» Oтели в горах";
	 all_hotels = "ВСЕ ОТЕЛИ";
	 } 
 
 var selector = [[all_hotels, "All", "", ""],
							[zona1 , "All", "", "Hoteles de Ciudad"],
							["»» Barcelona", "All", "Barcelona", "Hoteles de Ciudad"],
							["»»» Evenia ROSSELLO", "ESEVEHTLRosselo", "Barcelona", "Hoteles de Ciudad"],
							["»»» Evenia ROCAFORT", "ESEVEHTLRocafort", "Barcelona", "Hoteles de Ciudad"],
							[zona2 , "All", "", "Hoteles de Costa"],
							["»» Costa Brava- Lloret de Mar", "All", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»»» Evenia OLYMPIC PALACE SPA", "ESEVEHTLOPalace", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»»» Evenia OLYMPIC SUITES SPA", "ESEVEHTLOSuites", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»»» Evenia OLYMPIC GARDEN & SPA", "ESEVEHTLOGarden", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»»» Evenia OLYMPIC PARK & SPA", "ESEVEHTLOPark", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»»» Evenia HAWAI", "ESEVEHTLHawai", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»»» Evenia MONTEVISTA", "ESEVEHTLMontevista", "Costa Brava- Lloret de Mar", "Hoteles de Costa"],
							["»» Almeria- Roquetas de Mar", "ESEVEHTLZorGarden", "Almeria- Roquetas de Mar", "Hoteles de Costa"],
							["»»» Evenia ZORAIDA GARDEN", "ESEVEHTLZorGarden", "Almeria- Roquetas de Mar", "Hoteles de Costa"],
							["»»» Evenia ZORAIDA PARK", "ESEVEHTLZorPark", "Almeria- Roquetas de Mar", "Hoteles de Costa"],
							[zona3 , "All", "", "Hoteles de Montaña"],
							["»» Pirineo Aragones- Cerler", "All", "Pirineo Aragones- Cerler", "Hoteles de Montaña"],
							["»»» Evenia MONTE ALBA", "ESEVEHTLMAlba", "Pirineo Aragones- Cerler", "Hoteles de Montaña"]];
//Build the select			
function BuildHotelSelect() {

	// Empty the hotel select
	document.idForm.HotelList.options.length = 0;
	
	var ct = selector.length;
	for(i = 0; i < ct; i++)
		{
		elt = selector[i];
		if (i==1  || i==5 || i==16) {
		
		}
		
		a_option = new Option(elt[0], i, false, false);
		
		document.idForm.HotelList.options[i] = a_option;
	
		if (i==1 || i==2  || i==5 || i==6 || i==13 || i==16 || i==17 ) { 
		document.idForm.HotelList.options[i].className="grey";}
		
		
		}
}

function SelectCorrectHotel(cname, theform)
{
 	var ct = selector.length;
	var found=0;
	for(i = 0; i < ct; i++)
	 {
	   	if (theform.HotelList.options[i].value == cname)
		 {
			theform.HotelList.options[i].selected=true;
			found=1;
		 }
	 }
	 if (found==0)
	  {theform.HotelList.options[0].selected=true;}

}

				
function SubmitBookingForm(theform) {
		
			var ar_index = parseInt(theform.HotelList.options[theform.HotelList.selectedIndex].value);
			if(ar_index >= 0 && ar_index < selector.length)
				{
				theform.HotelList.options[theform.HotelList.selectedIndex].value = selector[ar_index][1];
				theform.region.value = selector[ar_index][2];
				theform.critere1.value = selector[ar_index][3];
				}
			hhotelFormUpdateHotelnames(theform);
			hhotelDispoprice(theform);

        }
        
function SubmitCancel(theform) {
	// get index of selected element
	var ar_index = theform.HotelList.selectedIndex;
	if(ar_index >= 0 && ar_index < selector.length)
		{
		// get connectNAme associated with selected entry
		var cName = selector[ar_index][1];
		if(cName == null || cName == "" || cName == "All")
			{
			// If no connect name or "All" associated, then display error message and exit
			alert("Please select a hotel first");
			return;
			}
		// call cancel function with connect name and empty language variable
		hhotelcancel(cName, "");
	}				
}

$(document).ready(function() {
	BuildHotelSelect();
	SelectCorrectHotel(hotel_select_index, document.idForm);
});