$(document).ready(function(){
	weather_load_weather();
});

// The function to load the information from the server
	function weather_load_weather(){
		weather_show_loading();
		$.ajax({
			url: "index.php?mact=Weather:cntnt01:forecast:0&cntnt01returnid="+returnid+"&showtemplate=false",
			type: "POST",
			success: function(result){
				$('div#weather_wrapper').css('height','auto').html(result);
				setTimeout('weather_load_weather()',120000);
			}
		});
	}
// ----------------------------------------------------

// The function to show the loading
	function weather_show_loading(){
		var main_div = $('div#weather_wrapper');
		main_div.prepend("<div class='overlay'></div><img class='loading' src='modules/Weather/images/loading.gif'/>");
		main_div.children('div.overlay').css('width',main_div.width()+'px')
										.css('height',main_div.height()+'px')
										.fadeTo('slow',0.3);
		var img_loading = main_div.children('img.loading');
		img_loading	.css('margin-left',((main_div.width()/2)-(img_loading.width()/2))+'px')
					.css('margin-right',((main_div.width()/2)-(img_loading.width()/2))+'px')
					.css('margin-top',(main_div.height()/2)-(img_loading.height()/2)+'px');
	}
// --------------------------------

// The function to hide the loading
	function weather_hide_loading(){
		$('div#weather_wrapper div.overlay').remove();
		$('div#weather_wrapper img.loading').remove();
	}
// ---------------------------------
