function pngfix(c) {
    if (window.XMLHttpRequest) {
        return
    }
    var b = "display:inline-block; " + c.style.cssText;
    var a = '<span class="' + c.className + '" title="' + c.title + '" style="width:' + c.clientWidth + "px; height:" + c.clientHeight + "px;" + b + ";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + c.src + "', sizingMethod='crop');\"></span>";
    c.outerHTML = a
}
var $ = function(a) {
    return document.getElementById(a)
};
var TPL = '	<div class="skin16w"><dl><dt class="skin16h" id="heading"><a hidefocus="true" unselectable="on" onclick="Weather.Set();return false;"  href="javascript:void(0)">更换城市</a><span  style="cursor:pointer; color:#155091" id="citySwitcher"><a href="http://www.weather.com.cn/weather/#{cityid}.shtml" target="_blank" class="nomall">#{city}</a></span></dt></dl><div class="skin16i"> <img id="property5" alt="" src="images/b1.gif" /> </div><ul class="skin16l"><li id="property1">#{wz1}</li><li><a style="color:#1757A8;cursor:pointer;float:right;line-height:24px;margin-right:20px" id="property4" target="_blank" href="http://www.weather.com.cn/weather/#{cityid}.shtml">更多</a><span class="skin16c2" id="property2">#{today1}</span><span class="skin16c3" id="property3">#{today2}</span></li></ul><div class="skin16float-panel" id="property9"><strong>风&nbsp;&nbsp;&nbsp;&nbsp;力</strong>：fsdfhsdfsdf<br /><strong>紫外线</strong>：短裤<br /><strong>穿&nbsp;&nbsp;&nbsp;&nbsp;衣</strong>：棉衫等清凉夏季服装。</div></div>';
var TPLv ='	<div class="skin16w"><dl><dt class="skin16h" id="heading"><a hidefocus="true" unselectable="on" onclick="Weather.Set();return false;"  href="javascript:void(0)">\u66F4\u6362\u57CE\u5E02</a><span  style="cursor:pointer; color:#155091" id="citySwitcher"><a href="http://www.weather.com.cn/weather/101010100.shtml" target="_blank" class="nomall">\u5317\u4EAC</a></span></dt></dl><div class="skin16i"> <img id="property5" alt="" src="images/b1.gif" /> </div><ul class="skin16l"><li id="property1">\u591A\u4E91\u8F6C\u6674</li><li><a style="color:#1757A8;cursor:pointer;float:right;line-height:24px;margin-right:20px" id="property4" target="_blank" href="http://www.weather.com.cn/weather/101010100.shtml">\u66F4\u591A</a><span class="skin16c2" id="property2">17\u2103</span><span class="skin16c3" id="property3">~12\u2103</span></li></ul><div class="skin16float-panel" id="property9"><strong>\u98CE&nbsp;&nbsp;&nbsp;&nbsp;\u529B</strong>\uFF1Afsdfhsdfsdf<br /><strong>\u7D2B\u5916\u7EBF</strong>\uFF1A\u77ED\u88E4<br /><strong>\u7A7F&nbsp;&nbsp;&nbsp;&nbsp;\u8863</strong>\uFF1A\u68C9\u886B\u7B49\u6E05\u51C9\u590F\u5B63\u670D\u88C5\u3002</div></div>';
var Ylmf = {
    Cookies: {
        set: function(b, d, a, e, c) {
            if (typeof a == "undefined") {
                a = new Date(new Date().getTime() + 1000 * 3600 * 24 * 365)
            }
            document.cookie = b + "=" + escape(d) + ((a) ? "; expires=" + a.toGMTString() : "") + ((e) ? "; path=" + e: "; path=/") + ((c) ? ";domain=" + c: "")
        },
        get: function(b) {
            var a = document.cookie.match(new RegExp("(^| )" + b + "=([^;]*)(;|$)"));
            if (a != null) {
                return unescape(a[2])
            }
            return null
        },
        clear: function(a, c, b) {
            if (this.get(a)) {
                document.cookie = a + "=" + ((c) ? "; path=" + c: "; path=/") + ((b) ? "; domain=" + b: "") + ";expires=Fri, 02-Jan-1970 00:00:00 GMT"
            }
        }
    },
    format: function(g, c) {
        if (arguments.length > 1) {
            var i = Ylmf.format,
            f = /([.*+?^=!:${}()|[\]\/\\])/g,
            b = (i.left_delimiter || "{").replace(f, "\\$1"),
            d = (i.right_delimiter || "}").replace(f, "\\$1"),
            j = i._r1 || (i._r1 = new RegExp("#" + b + "([^" + b + d + "]+)" + d, "g")),
            h = i._r2 || (i._r2 = new RegExp("#" + b + "(\\d+)" + d, "g"));
			
            if (typeof(c) == "object") {
                return g.replace(j,
                function(l, k) {
                    var m = c[k];
                    if (typeof m == "function") {
                        m = m(k)
                    }
                    return typeof(m) == "undefined" ? "": m
                })
            } else {
                if (typeof(c) != "undefined") {
                    var a = Array.prototype.slice.call(arguments, 1),
                    e = a.length;
                    return g.replace(h,
                    function(k, l) {
                        l = parseInt(l, 10);
                        return (l >= e) ? k: a[l]
                    })
                }
            }
        }
        return g
    },
    getProId: function(b) {
        var c;
        for (var d = 0,
        a = CityArr.length; d < a; ++d) {
            if (CityArr[d][0] == b && parseInt(CityArr[d][2]) < 900) {
                c = CityArr[d][2]
            }
        }
        return c
    },
    getCityId: function(b, d) {
        if (!b) {
            return false
        }
        var e;
        for (var c = 0,
        a = CityArr.length; c < a; ++c) {
            if (CityArr[c][1] == b && CityArr[c][0] == d) {
                e = CityArr[c][2]
            }
        }
        return e
    },
    getCitys: function(c) {
        if (!c) {
            return false
        }
        var b = [];
        for (var d = 0,
        a = CityArr.length; d < a; ++d) {
            if (CityArr[d][1] == c) {
                b.push(CityArr[d])
            }
        }
        return b
    },
    getSelectValue: function(b) {
        var a = b.selectedIndex,
        c, d;
        if (a > -1) {
            c = b.options[a];
            d = c.innerHTML.split(" ")[1];
            return d
        }
        return null
    },
    ScriptLoader: {
        Add: function(c) {
            if (!c || !c.src) {
                return
            }
            var b = document.getElementsByTagName("head")[0],
            a = document.createElement("script");
            a.onload = a.onreadystatechange = function() {
                if (a && a.readyState && a.readyState != "loaded" && a.readyState != "complete") {
                    return
                }
                a.onload = a.onreadystatechange = a.onerror = null;
                a.Src = "";
                if (!document.all) {
                    a.parentNode.removeChild(a)
                }
                a = null
            };
            a.src = c.src;
            a.charset = c.charset || "gb2312";
            b.insertBefore(a, b.firstChild)
        }
    }
};
var W = document.getElementById("weather");
var Weather = {
    CityCookieName: "citydata",
    WeatherCookieName: "weather",
    DefaultCity: ["109", "101010100", "101010100", "\u5317\u4EAC", "\u5317\u4EAC"],
    StatIPQueue: [],
    StatGetQueue: [],
    ShowStatus: function(c) {
        if (!c) {
            return
        }
        var b = TPL;
        var d;
        switch (c) {
        case 100:
            d = '\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/" target="_blank">\u5FEB\u901F\u67E5\u770B</a>';
            break;
        case 101:
            d = "\u5224\u65AD\u57CE\u5E02\u5931\u8D25\uFF0C\u9ED8\u8BA4\u4E3A\u5317\u4EAC\uFF0C\u8BF7\u624B\u52A8\u8BBE\u7F6E\u3002";
            break;
        case 102:
			d=TPLv;
            break;
        case 404:
            d = TPLv;
            break;
        case 500:
            d = '\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:
            var a = arguments[1];
            d = Ylmf.format(b, {
                cityid: a[3],
                city: a[0],
                today: a[1],
				today1: a[1].split("~")[0],
				today2: "~"+a[1].split("~")[1],
                tomorrow: a[2],
				Acquired:a[6],
                img1: a[4],
                img2: a[5],
				img3: a[7],
				wz1: a[8],
				wz2: a[9],
				wz3: a[10]
            });
            break
        }
		if(c==200){
			parent.qTcms_weather_City.loading(a[3]); 
				
		}		
        W.innerHTML = d
    },
    Ip2City: function(c) {
        this.ShowStatus(100);
        Ylmf.ScriptLoader.Add({
            src: "http://api.114la.com/ip",
            charset: "gb2312"
        });
        var a = this;
        if (typeof b != "undefined") {
            window.clearTimeout(b)
        }
        var b = window.setTimeout(function() {
            Ylmf.Cookies.clear(this.CityCookieName);
            c && c(a.DefaultCity)
        },
        3000);
        window.ILData_callback = function() {
            if (typeof(ILData) != "undefined") {
                if (typeof b != "undefined") {
                    window.clearTimeout(b)
                }
                if (ILData[2] && ILData[3]) {
                    var d = Ylmf.getProId(ILData[2]);
                    var f = Ylmf.getCityId(d, ILData[3]);
                    var e = [d, f, f, ILData[2], ILData[3]];
                    Ylmf.Cookies.set(a.CityCookieName, e);
                    c && c(e)
                }
            }
        }
    },
    Get: function(e) {
        if (!e) {
            return
        }
        var b = e.slice(3, 7);
        var f = this.ShowStatus;
        var d = this;
        f(102);
        if (typeof a != "undefined") {
            window.clearTimeout(a)
        }
        var a = window.setTimeout(function() {
            f(500);
            Ylmf.Cookies.clear(this.CityCookieName)
        },
        5000);
        var c = "http://weather.api.114la.com/" + b + "/" + e + ".txt";
        c += "?" + parseInt(Math.random() * 99);
        if (!Ylmf.Cookies.get(this.WeatherCookieName)) {}
        Ylmf.ScriptLoader.Add({
            src: c.toString(),
            charset: "utf-8"
        });
        window.Ylmf.getWeather = function(h) {
            window.clearTimeout(a);
            if (typeof(h) == "object" && typeof(h) != "undefined" && typeof(h.weatherinfo) != "undefined" && h.weatherinfo != false) {
                var i = [h.weatherinfo.temp1,h.weatherinfo.temp2,h.weatherinfo.temp3];
                var g = [h.weatherinfo.city, i[0], i[1], e, h.weatherinfo.img1, h.weatherinfo.img3,i[2],h.weatherinfo.img5,h.weatherinfo.weather1,h.weatherinfo.weather2,h.weatherinfo.weather3];
                if (g) {
                    Weather.ShowStatus(200, g);
                    Ylmf.Cookies.set(d.WeatherCookieName, 1)
                }
            } else {
                if (h.weatherinfo == false) {
                    Weather.ShowStatus(404)
                }
            }
        }
    },
    Init: function() {
        var c = this.CityCookieName;
        var b = this;
        if (Ylmf.Cookies.get(this.CityCookieName)) {
            var a = Ylmf.Cookies.get(this.CityCookieName).split(",");
            if (!a[2]) {
                Ylmf.Cookies.clear(this.CityCookieName);
                b.Init()
            }
            this.Get(a[2])
        } else {
            this.Ip2City(function(d) {
                var e = Ylmf.Cookies.get(b.CityCookieName);
                if (e) {
                    e = e.split(",");
                    b.Get(e[2])
                } else {
                    b.Get(d[2])
                }
            })
        }
    },
    getAreas: function(c, b) {
        var a = c.slice(3, 7);
        Ylmf.ScriptLoader.Add({
            /*src: "http://weather.api.114la.com/" + a + "/" + a + ".txt",*/
			src: "txt/"  + "/" + a + ".txt",
            charset: "gb2312"
        });
        Ylmf.getAreaCity = function(d) {
            if (typeof(d) == "object" && typeof(d.result) != "undefined" && typeof(d.result[0][0]) != "undefined") {
                b(d.result)
            }
        }
    },
    initCitys: function(b) {
        if (!b) {
            return
        }
        $("w_city").innerHTML = "";
        for (var d = 0,
        a = CityArr.length; d < a; ++d) {
            var c = CityArr[d];
            if (c[1] == b) {
                var e = document.createElement("option");
                e.value = c[2];
                e.innerHTML = c[3] + "&nbsp;" + c[0];
                $("w_city").appendChild(e)
            }
        }
        $("w_city").selectedIndex = 0
    },
    initAreaCitys: function(b, a) {
        $("l_city").innerHTML = "";
        this.getAreas(b,
        function(g) {
			
            for (var e = 0,c = g.length; e < c; ++e) {
                var d = g[e];
                var f = document.createElement("option");
                if (d[0] == b) {
                    f.selected = true
                }
                f.value = d[0];
                f.innerHTML = d[2] + "&nbsp;" + d[1];
                $("l_city").appendChild(f)
            }
            if (a) {
                a()
            }
        })
    },
    Set: function() {
        W.style.display = "none";
        $("setCityBox").style.display = "";
        var a = Ylmf.Cookies.get(this.CityCookieName);
        if (a) {
            a = a.split(",")
        } else {
            a = this.DefaultCity
			
        }
        $("w_pro").value = a[0];
        this.initCitys(a[0]);
        $("w_city").value = a[1];
        this.initAreaCitys(a[2])
    },
    cp: function(a) {
        this.initCitys(a);
        $("w_city").selectedIndex = 0;
        this.cc($("w_city").value)
    },
    cc: function(a) {
        this.initAreaCitys(a,
        function() {})
    },
    custom: function() {
        var a = Ylmf.Cookies.get(this.CityCookieName);
        if (a) {
            a = a.split(",")
        } else {
            a = this.DefaultCity
        }
        var b = [$("w_pro").value, $("w_city").value, $("l_city").value ? $("l_city").value: $("w_city").value, Ylmf.getSelectValue($("w_pro")), Ylmf.getSelectValue($("w_city"))];
        if (a[2] != b[2]) {
            this.Get(b[2]);
            Ylmf.Cookies.set(this.CityCookieName, b)
        }
        $("setCityBox").style.display = "none";
        W.style.display = ""
    },
    autoLoad: function() {
        Ylmf.Cookies.clear(this.CityCookieName);
        Ylmf.Cookies.clear(this.WeatherCookieName);
        window.location.reload()
    }
};
Weather.Init();