function changeRegion(region_id)
{
	var city_list = $('city_id');
	city_list.length = 0;
	city_list.options[city_list.length] = new Option('-- Ładowanie --', '0', 0);
	city_list.disable();
	
	if (region_id)
	{
		new Ajax.Request('/salary/get-cities', {
			method:'post',
			parameters: {region_id: region_id},
			onSuccess: function(transport){
				cities = transport.responseText.evalJSON(true);
				city_list.length = 0;
				city_list.options[city_list.length] = new Option('-- Wszystkie --', '0', 0);
				
				for (var i = 0; i < cities.length; i++)
				{
					city_list.options[city_list.length] = new Option(cities[i].city_name, cities[i].city_id, 0);	
				}
				
				city_list.enable();
			},
			onFailure: function(){ 
				alert('Something went wrong...') 
			}
		});
	}
	else
	{
		city_list.length = 0;
		city_list.enable();
		city_list.options[city_list.length] = new Option('-- Wszystkie --', '0', 0);
	}
}

function changeCountry(country_id)
{
	var region_list = $('region_id'); 
	region_list.length = 0;
	region_list.options[region_list.length] = new Option('-- Ładowanie --', '0', 0);
	region_list.disable();
	
	new Ajax.Request('/salary/get-regions', {
		method:'post',
		parameters: {country_id: country_id},
		onSuccess: function(transport){
			regions = transport.responseText.evalJSON(true);
			region_list.length = 0;
			region_list.options[region_list.length] = new Option('-- Wszystkie --', '0', 0);
			
			for (var i = 0; i < regions.length; i++)
			{
				region_list.options[region_list.length] = new Option(regions[i].region_name, regions[i].region_id, 0);	
			}
			
			region_list.enable();
		
			changeRegion(false);

		},
		onFailure: function(){ 
			alert('Something went wrong...') 
		}
	});

}
