/*天气预报*/
(function(){
	
	//Init Ajax weather report
	//access customized services
	var contextName = '/eco-city';
	var weatherServiceURL = contextName+'/weather/forecast.jsp';
        
    $.ajax(
		{
			type: 'GET',
			url: weatherServiceURL,
			dataType : 'json',
			success: function(data){
				
				var today = new Date();
//				$('#weather-date').html(today.getFullYear()+"/"+(today.getMonth()+1)+"/"+today.getDate()+"/");
				$('#weather-date').html(today.getFullYear()+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日");
				$('#weather-status').html("天气:"+data.status);
				$('#weather-temp').html(data.temp);
				$.each(data.images, function(){
					
					
					if(this.length)	//whether the image is empty
					//if(this)
					{
						var img = document.createElement('img');
						//$(img).attr('width',30).attr('height', 30);
						$(img).attr('src',contextName+this);
						$('#weather-img-box').append(img);
					}
				});
				
				$('#weather-img').attr('src',data.image);
				$('#weather-box').css('visibility','visible');
				performColumnsLayout();
			},
			error: function(){
				
				//hide the weather-box
				$('#weather-box').css('visibility','hidden');
			}
		});
		
  })();