

var Weather=function(){
    function a(i){
    XSAjax.send({url:"http://api.115.com/ip",charset:"gb2312"});
    window.ILData_callback=function(){
    i&&ILData&&ILData!=""?i([ILData[2],ILData[3]]):i([109,101010100,101010100])
     }
  }
function e(i,r){
i=(i||"101010100").slice(3,7);
XSAjax.send({url:"http://weather.api.115.com/"+i+"/"+i+".txt",charset:"utf-8"});
window.Ylmf.getAreaCity=function(c){typeof c=="object"&&typeof c.result!="undefined"&&typeof c.result[0][0]!="undefined"&&r(c.result)}
}
function b(i){
var r=i||"109";$("#w_city").el.innerHTML="";
CityArr.forEach(function(c){c[1]==r&&$("#w_city").create("option",{value:c[2]},function(l){l.innerHTML=c[3]+"&nbsp;"+c[0];this.append(l)})})
}
function g(i,r){
$("#l_city").el.innerHTML="\u9009\u62e9\u5730\u533a";
$("#l_city").el.style.width="80px";
e(i,function(c){c.forEach(function(l){$("#l_city").create("option",{value:l[0]},function(m){m.innerHTML=l[2]+"&nbsp;"+l[1];this.append(m);r&&r()})})})
}
function d(i,r){
var c=i.slice(3,7),l,m=0;
XSAjax.send({before:function(){n.el.innerHTML="\u5929\u6c14\u9884\u62a5\u52a0\u8f7d\u4e2d...";l=setInterval(function(){m++},1E3)},after:function(){if(m==5){l&&clearInterval(l);f()}},url:"http://weather.api.115.com/"+c+"/"+i+".txt",charset:"utf-8"});
window.Ylmf.getWeather=function(o){l&&clearInterval(l);if(typeof o=="object"&&typeof o!="undefined"&&typeof o.weatherinfo!="undefined"&&o.weatherinfo!=false){var v=[o.weatherinfo.temp1+"&nbsp;"+o.weatherinfo.weather1,o.weatherinfo.temp2+"&nbsp;"+o.weatherinfo.weather2];o=[o.weatherinfo.city,v[0],v[1],i];r&&r(o)}else o.weatherinfo==false&&r&&r()}}
function f(){function i(){d(r[2],function(m){if(m)u(m);else n.el.innerHTML="\u5f88\u62b1\u6b49\uff0c\u6682\u65e0\u8be5\u57ce\u5e02\u5929\u6c14\u9884\u62a5\u3002"+k("[\u9009\u62e9\u57ce\u5e02]")})}var r=null;if(Cookie.get("city")){r=Cookie.get("city").split(",");i()}else{a(function(m){var o=getProId(m[0]);m=getCityId(o,m[1]);r=[o,m,m];Cookie.set("city",r)});c&&window.clearTimeout(timeOut);var c=setTimeout(function(){n.el.innerHTML='\u5224\u65ad\u57ce\u5e02\u8d85\u65f6\u3002&nbsp;&nbsp;<a href="javascript:void(0)" target="_parent" onclick="Weather.autoLoad(this)">[\u91cd \u8bd5]</a>&nbsp;'+
k("[\u9009\u62e9\u57ce\u5e02]");Cookie.set("city","109,101010100,101010100");window.clearInterval(l)},5E3),l=setInterval(function(){if(r){window.clearTimeout(c);window.clearInterval(l);i()}},13)}}
function h(){
n.hide();
$("#setCityBox").show();
City=Cookie.get("city").split(",");
$("#w_pro").el.value=City[0];b(City[0]);
$("#w_city").el.value=City[1];
g(City[2],function(){setTimeout(function(){$("#l_city").el.value=City[2]},0)})
}
function j(){
Cookie.clear("city");
n.el.innerHTML="";f();
$("#setCityBox").hide();
n.show()
}
function s(){
if($("#w_city").el.value==""&&$("#l_city").el.value=="")alert("\u8bf7\u9009\u62e9\u60a8\u6240\u5728\u7684\u57ce\u5e02\u3002");
else{
$("#setCityBox").hide();
var i=[$("#w_pro").el.value,$("#w_city").el.value,$("#l_city").el.value==""?$("#w_city").el.value:$("#l_city").el.value];
Cookie.set("city",i);
n.el.innerHTML="";f();
n.show()
}
}
function q(i){
b(i);
$("#w_city").selectedIndex=0;
p($("#w_city").el.value)
}
function p(i){
g(i,function(){})
}
///以下是一行，连续定义
var n=$("#weather"),
k=function(i){return'<a href="javascript:void(0);" onclick="Weather.set();return false;" target="_self">'+i+"</a>"},
t='<a href="http://tool.115.com/?ct=live&ac=weather&city=#{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;#{today}&nbsp;&nbsp;<strong>\u660e\u5929</strong>&nbsp;#{tomorrow}</a>&nbsp;&nbsp;'+k("[\u9009\u62e9\u57ce\u5e02]"),
u=function(i){n.el.innerHTML=format(t,{cityid:i[3],city:i[0],today:i[1],tomorrow:i[2]})};
///以上是一行，连续定义

f();
return{set:h,autoLoad:j,custom:s,cp:q,cc:p}}();(function(){$("#setting-box li a,#style-quick a").on("click",function(a){var e=a.parentNode.id.split("-")[0],b=a.rel;switch(e){case "layout":Skinselector.Set({layout:b});if(Browser.isIE)window.location.reload();else{window.location.href="?rd="+(new Date).getTime();window.location.search=""}break;case "style":Skinselector.Set({style:b});break;case "font":Skinselector.Set({font:b});break;case "bg":$("#bg-item a").setStyle("borderColor","#ccc");a.style.borderColor="red";Skinselector.Set({bg:b});break}});
$("#setting").on("click",function(){$("#setting-box").show();initBgitem()});$("#setting2,#setting-close").on("click",function(){$("#setting-box").hide()});$("#setting-reset").on("click",function(){Skinselector.Reset()});$("#setting-box").on("mouseover",function(){cache.set("HIDE_SETTING_BOX",false)});$("#setting-box").on("mouseout",function(){cache.set("HIDE_SETTING_BOX",true)})})();

