/*
**     JavaScript Source Code
**     Created by Kalin Ganev
**     <KalinGanev [AT] Gmail (DOT) com>
**     Date Created:  2008-03-30
**     Last Modified: 2010-06-25
*/





function /*boolean*/ prefillAreasSelectBox (int_idCity, str_idMenuArea, str_nameArrayAreas) {
	// Clearing all menu options of areas pull-down menu:
	document.getElementById(str_idMenuArea).options.length = 0;
	// Determining array containing cities and areas by using global array generated dynamically:
	eval('var  arr_areasAndCities = ' + str_nameArrayAreas + ';');
	// Finding index of current city inside the array containing cities and areas:
	for (var i=0; i<arr_areasAndCities.length; i++) {
		if (int_idCity == arr_areasAndCities[i][0]) {
			// Found index of current city inside the array containing cities and areas.
			// Adding a blank option to areas pull-down menu (first option):
			document.getElementById(str_idMenuArea).options[0] = new Option(' ', 0);
			// Determining array containing only areas:
			var  arr_areasOnly = arr_areasAndCities[i][1];
			// Prefilling areas pull-down menu by using the array containing only areas:
			for (var j=0; j<arr_areasOnly.length; j++) {
				document.getElementById(str_idMenuArea).options[j+1]
						= new Option(arr_areasOnly[j][1], arr_areasOnly[j][0]);
			}
			break;
		}
	} // for
}


