function getIMG(str){
	var i=0,j=0;
	var b;
	var img='';
	b=str.indexOf('雨')>=0||str.indexOf('雾')>=0||str.indexOf('雪')>=0||str.indexOf('雹')>=0||str.indexOf('晴')>=0|| str.indexOf('沙')>=0||str.indexOf('尘')>=0||str.indexOf('阴')>=0 ||str.indexOf('云')>=0 ;
	if(b && str.length!=0){
		i=str.indexOf('转');
		if(i>=0){
			if(i==0){
				str=str.substring(1);
			}
			else{
				str=str.substring(0,i);
			}
		}
		j=str.length;
		if(str.indexOf('雨')>=0){
			img='rain.png';
		}
		if(str.indexOf('雪')>=0){
			img='snow.png';
		}
		if(str.indexOf('雹')>=0){
			img='hail.png';
		}
		if(str.indexOf('雾')>=0){
			img='fog.png';
		}
		if(str.indexOf('大')>=0){
			img='d'+img;
		}else if(str.indexOf('阵雨')>=0){
			img='shower.png';
		}else if(str.indexOf('晴')>=0){
			img='sun.png';
		}else if(str.indexOf('阴')>=0){
			img='overcast.png';
		}else if(str.indexOf('沙')>=0||str.indexOf('尘')>=0){
			img='raise.png';
		}else if(str.indexOf('云')>=0){
			img='cloudy.png';
		}else if(str.indexOf('雨')>=0&&str.indexOf('雪')>=0){
			img='yx.png';
		}else if(!b){
			img='overcast.png;'
		}
	}else{
		img='overcast.png';
	}
	return img;
 }
function getWeatherInfo(s){
	var city=encodeURI(s);;
	var rqurl='http://admin.mapabc.com/weather/weather.jhtml?cityname='+city+'&mr='+Math.random();
	var mAjaxRequest=new MAjaxRequest();
	var m=new myfunc();
	mAjaxRequest.setResponseHandler(m.hello,m);
	mAjaxRequest.sendRequest(rqurl);
}
function myfunc(){
	this.v1='p';
}
myfunc.prototype.hello=function(data){
	var jsonStr=eval(data);
	var w='';
	var inf=jsonStr;
	if(inf==''){
		document.getElementById('weather_info').innerHTML='';
	}else{
		var city=inf.split('=')[0];
		var weather=inf.split('=')[1];
		var t_type=weather.split(';');
		var today=new Date();
		var tomorrow=new Date(today.getTime()+24*60*60*1000);
		var dDate=today.getDate();
		var dMonth=today.getMonth()+1;
		var tDate=tomorrow.getDate();
		var tMonth=tomorrow.getMonth()+1;
		var richu='';
		if(t_type[7]==''||t_type[7]==' '||t_type[7]==null||t_type[8]==''||t_type[8]==' '||t_type[8]==null){}
		else{
			//suntime='日出：'+t_type[7]+' 日落：'+t_type[8];
			suntime='';
		}
		w=city+' '+dMonth+'月'+dDate+'日 - '+tMonth+'月'+tDate+"日 <span style='width:14px;height:14px;'><img src='sp_image/"+getIMG(t_type[3])+"' /></span> &nbsp;&nbsp;" + t_type[3] + " "+t_type[4] + " " + t_type[6] + " " + suntime;	
		document.getElementById('weather_info').innerHTML=w;
	}
} 