$().ready( function() {
	
	comboCidadesWeather();
	weather();

});

var selectEstadosWeather = "#weather_state";
var selectCidadesWeather = "#weather_city";

function weather(){

	$('#weather_city').live("change", function(){

		var uf = $(selectEstadosWeather).val();
		var city = $(selectCidadesWeather).val();

		jQuery.ajax({
			type: "POST",
			url: "modules/widgets/weather-ajax.php",
			data: "weather_state="+uf+"&weather_city="+city+'&language='+tGet['language'],
			success: weatherResponse
		});
	
	});

}

function weatherResponse(response) {
	$('.weather').html(response);
	return false;
}

function comboCidadesWeather() {
							
	$(selectEstadosWeather).live("change", function(){
		
		var uf = $(this).val();
		
		jQuery.ajax({
			type: "POST",
			url: "modules/widgets/weather-ajax-cities.php",
			data: "weather_state="+uf,
			success: comboCidadesWeatherResponse
		});
		
		return false;
	
	});
}

function comboCidadesWeatherResponse(response) {
	$(selectCidadesWeather).html(response);
	$('select').selectmenu();
	return false;
}
