J1616.Theme = {
    dialog: "green",
    root: "http://i.9533.com/style/",
    updateUrl: "http://my" + J1616.Util.getDomain() + "/update.php",
    getUrl: "http://my" + J1616.Util.getDomain() + "/get.php",
    _theme: {
        th: "green",
        ft: 1,
        bg: 1,
        tpg: "1-1",
        lo: 0,
        m: ""
    },
    update: function(s, fn) {
        if (!s) return false;
        var root = this.root;
        var ist = s.th.indexOf("_") == 0;
        var cfg = $_cfg[s.th] || $_cfg['green'];
        cfg.fn && cfg.fn();
        var sl = cfg.css;
        if (s.th.indexOf('_') != -1) {
            $('div.banner').css("background", "none");
            var _s = J1616.str2obj(J1616.Util.getCookie("J1616_www_my1616")) || this._theme;
            if (_s['s'] == 1 && _s['m'] === undefined) {
                _s['m'] = 'kp';
                delete _s["s"];
                J1616.Util.setCookie("J1616_www_my1616", J1616.obj2str(_s));
            }
            if (location.href.indexOf("kp.htm") != -1) {
                var _ = sl.split(".css");
                sl = _[0] + "_k.css";
            }
        }
        var ft = root + "others/font/_f" + s.ft + ".css" || '';
        var lo = s.lo == 1 ? root + 'others/layout/_index_ltor.css': '';
        c($('#sl'), sl + "?v=" + cfg.ver);
        c($('#ft'), ft);
        c($("#lo"), lo);
        document.body.style.background = ist ? cfg.background: cfg.background + ' url(' + root + 'others/background/bg' + s.bg + '.gif)';
        if (parseInt(s.bg) == 1 && !ist) document.body.style.background = cfg.background;
        this.dialog = cfg.color;
        if (fn) {
            try {
                fn(s);
            } catch(e) {}
        }
        function c(o, t) {
            {
                if (o[0].href.toLocaleLowerCase() == t.toLocaleLowerCase()) return;
                o[0].href = t;
                o[0].readyState && void
                function() {
                    var timeout = 0,
                    timer = setInterval(function() {
                        if (o[0].readyState.match(/loaded|complete/i) || ++timeout == 120) clearInterval(timer, timer = null);
                        else {
                            timeout % 5 == 0 && o.attr('href', t);
                        }
                    },
                    20);
                } ();
            }
        }
    }
}