function updateSelectTo(){

	var idx = document.getElementById('flySearchForm').from.selectedIndex;
	//alert(idx);
	var from = document.getElementById('flySearchForm').from[document.getElementById('flySearchForm').from.selectedIndex].value;
	//alert(from);

	if(cities[from]){
		var toList = document.getElementById('flySearchForm').to;
		var selectedIndexTo = toList.selectedIndex;
		var selectedValue = toList[selectedIndexTo].value;
		//alert(selectedValue);
		while (toList.options.length) {
			toList.remove(0);
		}
		
		toList.options[toList.options.length] = new Option('przelot do', '');	
		newSelectedIndexTo = 0;
		for(i = 0; i < cities[from].length; i++) {
			toList.options[toList.options.length] = new Option(cities[from][i], cities[from][i]);
			if(cities[from][i] == selectedValue){
				//alert(cities[from][i]);
				newSelectedIndexTo = i+1;
			}
		}
		toList.selectedIndex = newSelectedIndexTo;
		

	} else {

		var toList = document.getElementById('flySearchForm').to;
		while (toList.options.length) {
			toList.remove(0);
		}
		
		for(i = 0; i < cities['all'].length; i++) {
			toList.options[toList.options.length] = new Option(cities['all'][i][1], cities['all'][i][0]);
		}
	}
}
