var totalRowWeather, totalRowTraffic;
countWeather = 0;
countTraffic = 0;

$(document).ready(function(){
	if($('.blockWeatherTraffic').length > 0 ){
		initBlockMeteoTransit();
	}
});

function initializeMeteoWeather(){
	$('.blockWeatherTraffic .blockSectionTitle').hide();
	$('.blockWeatherTraffic .blockColWeather').hide();

	$('.blockWeatherTraffic .blockSectionTitle:eq('+ countWeather +')').show();
	$('.blockWeatherTraffic .blockColWeather:eq('+ countWeather +')').show();

	countWeather += 1;
	if(countWeather == totalRowWeather - 1){
		countWeather = 0;
	}
	window.setTimeout('initializeMeteoWeather()',5000);
}

function initializeTransito(){
	$('.blockWeatherTraffic .blockColTraffic').hide();
	$('.blockWeatherTraffic .blockColTraffic:eq('+ countTraffic +')').show();
	countTraffic += 1;
	if(countTraffic == totalRowTraffic - 1){
		countTraffic = 0;
	}
	window.setTimeout('initializeTransito()',5000);
}

function initBlockMeteoTransit(){
	$('.blockWeatherTraffic').empty().load("/frame_meteo_traffic.html", function(){
		totalRowWeather = $('.blockWeatherTraffic .blockSectionTitle').length;
		totalRowTraffic = $('.blockWeatherTraffic .blockColTraffic').length;
		initializeMeteoWeather();
		initializeTransito();
                //alert(totalRowWeather+'\n'+totalRowTraffic)
	});
}
