// Clear the specified dropdown list
function ClearList(List)
{
	var ListOptions = List.options;

	for (Index = ListOptions.length; Index >= 0; Index --)
		ListOptions[Index] = null;
}

// Add an item to the given list
function AddItemToList(list, text, value, selected)
{
	var ListOptions = list.options;
	var NextItemIndex;
	
	if (ListOptions.length < 0)
		NextItemIndex = 0;
	else
		NextItemIndex = ListOptions.length;
	
	ListOptions[NextItemIndex] = new Option(text, value);
	ListOptions[NextItemIndex].selected = selected;
}

// Adds the wait message to the given list
function AddWaitMessage(list)
{
	ClearList(list);
	
	AddItemToList(list, "Please wait..");
}

function PopulateCityDropDown()
{
	ClearList(makeDropDown);
	
	AddItemToList(makeDropDown, "Select City", "", true);
	
	for (var i = 0; i < CityArray.length; i++)
	{
	  AddItemToList(makeDropDown, CityArray[i], i, false);
	}
}

function PopulateHotelDropDown(makeIndex) 
{
  if (makeIndex > -1)
  {
    AddWaitMessage(modelDropDown);
    
    ClearList(modelDropDown);
    
    AddItemToList(modelDropDown, "---Select Hotel---", "NA", true);
    
    var modelsArray = HotelArray[makeIndex];
    
    for (var i = 0; i < modelsArray.length; i++)
    {
      AddItemToList(modelDropDown, modelsArray[i], modelsArray[i], false);
     }
   }

}

PopulateCityDropDown();
