function pngfix(b){if(!window.XMLHttpRequest)b.outerHTML='<span class="'+b.className+'" title="'+b.title+'" style="width:'+b.clientWidth+"px; height:"+b.clientHeight+"px;"+("display:inline-block; "+b.style.cssText)+";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.src+"', sizingMethod='crop');\"></span>"}
var $=function(b){return document.getElementById(b)},TPL='<a href="http://www.weather.com.cn/weather/101200801.shtml#{cityid}" title="\u70b9\u51fb\u67e5\u770b\u672a\u6765\u51e0\u5929\u5929\u6c14\u9884\u62a5" target="_blank"><strong>#{city}</strong>&nbsp;<strong>\u4eca\u5929</strong>&nbsp;<img align="absmiddle" onload="pngfix(this)" class="i" src="images/i/#{img1}.png" />&nbsp;#{today}&nbsp;&nbsp;<strong>\u660e\u5929</strong>&nbsp;<img align="absmiddle" onload="pngfix(this)" src="images/i/#{img2}.png" class="i" />&nbsp;#{tomorrow}</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="Weather.set();return false;" target="_self">[\u9009\u62e9\u57ce\u5e02]</a>',Ylmf=
{Cookies:{set:function(b,c,a,d,e){typeof a=="undefined"&&(a=new Date((new Date).getTime()+31536E6));document.cookie=b+"="+escape(c)+(a?"; expires="+a.toGMTString():"")+(d?"; path="+d:"; path=/")+(e?";domain="+e:"")},get:function(b){b=document.cookie.match(RegExp("(^| )"+b+"=([^;]*)(;|$)"));if(b!=null)return unescape(b[2]);return null},clear:function(b,c,a){if(this.get(b))document.cookie=b+"="+(c?"; path="+c:"; path=/")+(a?"; domain="+a:"")+";expires=Fri, 02-Jan-1970 00:00:00 GMT"}},format:function(b,
c){if(arguments.length>1){var a=Ylmf.format,d=/([.*+?^=!:${}()|[\]\/\\])/g,e=(a.left_delimiter||"{").replace(d,"\\$1"),f=(a.right_delimiter||"}").replace(d,"\\$1"),d=a._r1||(a._r1=RegExp("#"+e+"([^"+e+f+"]+)"+f,"g")),a=a._r2||(a._r2=RegExp("#"+e+"(\\d+)"+f,"g"));if(typeof c=="object")return b.replace(d,function(b,a){var d=c[a];typeof d=="function"&&(d=d(a));return typeof d=="undefined"?"":d});else if(typeof c!="undefined"){var g=Array.prototype.slice.call(arguments,1),h=g.length;return b.replace(a,
function(b,a){a=parseInt(a,10);return a>=h?b:g[a]})}}return b},getProId:function(b){for(var c,a=0,d=CityArr.length;a<d;++a)CityArr[a][0]==b&&parseInt(CityArr[a][2])<900&&(c=CityArr[a][2]);return c},getCityId:function(b,c){if(!b)return!1;for(var a,d=0,e=CityArr.length;d<e;++d)CityArr[d][1]==b&&CityArr[d][0]==c&&(a=CityArr[d][2]);return a},getCitys:function(b){if(!b)return!1;for(var c=[],a=0,d=CityArr.length;a<d;++a)CityArr[a][1]==b&&c.push(CityArr[a]);return c},getSelectValue:function(b){var c=b.selectedIndex;
if(c>-1)return b=b.options[c],b=b.innerHTML.split(" ")[1];return null},ScriptLoader:{Add:function(b){if(b&&b.src){var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.onload=a.onreadystatechange=function(){if(!a||!a.readyState||!(a.readyState!="loaded"&&a.readyState!="complete"))a.onload=a.onreadystatechange=a.onerror=null,a.Src="",document.all||a.parentNode.removeChild(a),a=null};a.src=b.src;a.charset=b.charset||"gb2312";c.insertBefore(a,c.firstChild)}}}},W=document.getElementById("weather"),
Weather={CityCookieName:"citydata",WeatherCookieName:"weather",DefaultCity:["109","101010100","101010100","\u5317\u4eac","\u5317\u4eac"],StatIPQueue:[],StatGetQueue:[],ShowStatus:function(b,c){if(b){var a;switch(b){case 100:a='\u6b63\u5728\u5224\u65ad\u57ce\u5e02\uff0c\u8bf7\u7a0d\u540e...&nbsp; <a href="javascript:void(0);" onclick="Weather.Set();return false;" target="_self">[\u624b\u52a8\u8bbe\u7f6e]</a> <a href="http://www.weather.com.cn/weather/101200801.shtml" target="_blank">\u5feb\u901f\u67e5\u770b</a>';break;
case 101:a="\u5224\u65ad\u57ce\u5e02\u5931\u8d25\uff0c\u9ed8\u8ba4\u4e3a\u5317\u4eac\uff0c\u8bf7\u624b\u52a8\u8bbe\u7f6e\u3002";break;case 102:a='\u6b63\u5728\u83b7\u53d6\u5929\u6c14\u6570\u636e\uff0c\u8bf7\u7a0d\u5019... <a href="http://www.weather.com.cn/weather/101200801.shtml" target="_blank">\u5feb\u901f\u67e5\u770b</a>';break;case 404:a='\u5f88\u62b1\u6b49\uff0c\u6682\u65e0\u8be5\u57ce\u5e02\u5929\u6c14\u6570\u636e\u3002<a href="javascript:void(0);" onclick="Weather.Set();return false;" target="_self">[\u9009\u62e9\u5176\u5b83\u57ce\u5e02]</a>';
break;case 500:a='\u670d\u52a1\u5668\u9519\u8bef\u6216\u672c\u5730\u7f51\u7edc\u8fc7\u6162\u3002<a href="###" onclick="window.location.reload();">[\u70b9\u51fb\u91cd\u8bd5]</a>';break;case 200:a=["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"];var d=new Date,e=d.getDay(),d=d.getDay()==6?0:e+1;a=Ylmf.format('<div id="forecast_content" style="display: block;"><div class="box-weather_city"><div class="change-city"><a id="changeCity" title="修改城市" href="javascript:void(0);" onclick="Weather.Set();return false;" target="_self"><span class="cityName">#{city}</span><span class="city_edit"></span></a></div><a title="最近7日天气详情" href="http://www.weather.com.cn/weather/#{cityid}.shtml#7d" target="_blank">七日天气</a></div><div class="box-weather_info"><a href="http://www.weather.com.cn/weather/#{cityid}.shtml" title="#{today}" target="_blank"><div class="box-weather_info_item"><div class="box-weather_info_item_icon"><img src="images/i/#{img1}.png" class="png"></div><p class="weather_day">今天</p><p>#{today}</p></div></a><a href="http://www.weather.com.cn/weather/#{cityid}.shtml" title="#{tomorrow}" target="_blank"><div class="box-weather_info_item"><div class="box-weather_info_item_icon"><img src="images/i/#{img2}.png" class="png"></div><p class="weather_day">明天</p><p>#{tomorrow}&nbsp;</p></div></a></div></div></div>',
{cityid:c[3],city:c[0],today:c[1],tomorrow:c[2],img1:c[4],img2:c[5],week1:a[e],week2:a[d]})}W.innerHTML=a}},Ip2City:function(b){this.ShowStatus(100);Ylmf.ScriptLoader.Add({src:"http://open.haoyer.com/ip/",charset:"gb2312"});var c=this;typeof a!="undefined"&&window.clearTimeout(a);var a=window.setTimeout(function(){Ylmf.Cookies.clear(this.CityCookieName);b&&b(c.DefaultCity)},3E3);window.ILData_callback=function(){if(typeof ILData!="undefined"&&(typeof a!="undefined"&&window.clearTimeout(a),ILData[2]&&
ILData[3])){var d=Ylmf.getProId(ILData[2]),e=Ylmf.getCityId(d,ILData[3]),d=[d,e,e,ILData[2],ILData[3]];Ylmf.Cookies.set(c.CityCookieName,d);b&&b(d)}}},Get:function(b){if(b){var c=b.slice(3,7),a=this.ShowStatus,d=this;a(102);typeof e!="undefined"&&window.clearTimeout(e);var e=window.setTimeout(function(){a(500);Ylmf.Cookies.clear(this.CityCookieName)},5E3),c="http://weather.api.114la.com/"+c+"/"+b+".txt";c+="?"+parseInt(Math.random()*99);Ylmf.Cookies.get(this.WeatherCookieName);Ylmf.ScriptLoader.Add({src:c.toString(),
charset:"utf-8"});window.Ylmf.getWeather=function(a){window.clearTimeout(e);if(typeof a=="object"&&typeof a!="undefined"&&typeof a.weatherinfo!="undefined"&&a.weatherinfo!=!1){var c=[a.weatherinfo.temp1,a.weatherinfo.temp2];Weather.ShowStatus(200,[a.weatherinfo.city,c[0],c[1],b,a.weatherinfo.img1,a.weatherinfo.img3]);Ylmf.Cookies.set(d.WeatherCookieName,1)}else a.weatherinfo==!1&&Weather.ShowStatus(404)}}},Init:function(){var b=this;if(Ylmf.Cookies.get(this.CityCookieName)){var c=Ylmf.Cookies.get(this.CityCookieName).split(",");
c[2]||(Ylmf.Cookies.clear(this.CityCookieName),b.Init());this.Get(c[2])}else this.Ip2City(function(a){var c=Ylmf.Cookies.get(b.CityCookieName);c?(c=c.split(","),b.Get(c[2])):b.Get(a[2])})},getAreas:function(b,c){var a=b.slice(3,7);Ylmf.ScriptLoader.Add({src:"http://weather.api.114la.com/"+a+"/"+a+".txt",charset:"utf-8"});Ylmf.getAreaCity=function(a){typeof a=="object"&&typeof a.result!="undefined"&&typeof a.result[0][0]!="undefined"&&c(a.result)}},initCitys:function(b){if(b){$("w_city").innerHTML=
"";for(var c=0,a=CityArr.length;c<a;++c){var d=CityArr[c];if(d[1]==b){var e=document.createElement("option");e.value=d[2];e.innerHTML=d[3]+"&nbsp;"+d[0];$("w_city").appendChild(e)}}$("w_city").selectedIndex=0}},initAreaCitys:function(b,c){$("l_city").innerHTML="";this.getAreas(b,function(a){for(var d=0,e=a.length;d<e;++d){var f=a[d],g=document.createElement("option");if(f[0]==b)g.selected=!0;g.value=f[0];g.innerHTML=f[2]+"&nbsp;"+f[1];$("l_city").appendChild(g)}c&&c()})},Set:function(){W.style.display=
"none";$("setCityBox").style.display="";var b=Ylmf.Cookies.get(this.CityCookieName),b=b?b.split(","):this.DefaultCity;$("w_pro").value=b[0];this.initCitys(b[0]);$("w_city").value=b[1];this.initAreaCitys(b[2])},cp:function(b){this.initCitys(b);$("w_city").selectedIndex=0;this.cc($("w_city").value)},cc:function(b){this.initAreaCitys(b,function(){})},custom:function(){var b=Ylmf.Cookies.get(this.CityCookieName),b=b?b.split(","):this.DefaultCity,c=[$("w_pro").value,$("w_city").value,$("l_city").value?
$("l_city").value:$("w_city").value,Ylmf.getSelectValue($("w_pro")),Ylmf.getSelectValue($("w_city"))];b[2]!=c[2]&&(this.Get(c[2]),Ylmf.Cookies.set(this.CityCookieName,c));$("setCityBox").style.display="none";W.style.display=""},autoLoad:function(){Ylmf.Cookies.clear(this.CityCookieName);Ylmf.Cookies.clear(this.WeatherCookieName);window.location.reload()}};Weather.Init();
