function removeAllSelectOptions(SelectCtrl) {
	//while (SelectCtrl.options.length>0) {
	//	SelectCtrl.options.remove(0);
	//}
	SelectCtrl.options.length = 0;
}


function init_selections(SelectCityCtrl, SelectHotelCtrl, cvi, cdi, hvi, hdi, city2hotels, sel_city_opt, sel_hotel_opt) {
	
	removeAllSelectOptions(SelectCityCtrl);
	removeAllSelectOptions(SelectHotelCtrl);

	if (sel_city_opt) {
		var city_option=document.createElement("OPTION");
		SelectCityCtrl.options.add(city_option);
		city_option.value='';
		city_option.text='----- Select City -----';
	}

	for(var city=0; city<city2hotels.length; city++) {
		city_hotels_pair=city2hotels[city];
		var city_option=document.createElement("OPTION");
		SelectCityCtrl.options.add(city_option);
		city_option.value=city_hotels_pair[0][cvi];
		city_option.text=city_hotels_pair[0][cdi];
	}

	if (sel_hotel_opt) {
		var hotel_option=document.createElement("OPTION");
		SelectHotelCtrl.options.add(hotel_option);
		hotel_option.value='';
		hotel_option.text='----- Select Hotel -----';
		SelectHotelCtrl.options[0].selected = true;
	}
}	
			
function FillCitysHotels(SelectCityCtrl, SelectHotelCtrl, cvi, cdi, hvi, hdi, city2hotels, sel_city_opt, sel_hotel_opt) {

	city_index=SelectCityCtrl.selectedIndex;
	if (sel_city_opt) {
		city_index--;
	}

	removeAllSelectOptions(SelectHotelCtrl);

	if (sel_hotel_opt) {
		var hotel_option=document.createElement("OPTION");
		SelectHotelCtrl.options.add(hotel_option);
		hotel_option.value='';
		hotel_option.text='----- Select Hotel -----';
		SelectHotelCtrl.options[0].selected = true;
	}

	if (city_index<0)  {
		return;
	}

	hotels_array=city2hotels[city_index][1];

	for(var hotel=0; hotel<hotels_array.length; hotel++) {
		var hotel_option=document.createElement("OPTION");
		SelectHotelCtrl.options.add(hotel_option);
		hotel_option.text=hotels_array[hotel][hdi];
		hotel_option.value=hotels_array[hotel][hvi];
	}
	
	SelectHotelCtrl.options[0].selected = true;
}
