(function(win, J, undefined) {
    if (win[J] === undefined) win[J] = {};
    J = win[J];
    J.version = "1.1.0"; (function() {
        var initializing = false,
        fnTest = /xyz/.test(function() {
            xyz;
        }) ? /\b_super\b/: /.*/;
        function Class() {}
        Class.extend = function(prop) {
            var _super = this.prototype;
            initializing = true;
            var prototype = new this();
            initializing = false;
            for (var name in prop) {
                prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn) {
                    return function() {
                        var tmp = this._super;
                        this._super = _super[name];
                        var ret = fn.apply(this, arguments);
                        this._super = tmp;
                        return ret;
                    };
                })(name, prop[name]) : prop[name];
            }
            function Klass() {
                if (!initializing && this.init) this.init.apply(this, arguments);
            }
            Klass.prototype = prototype;
            Klass.constructor = Class;
            Klass.extend = arguments.callee;
            return Klass;
        };
        J.Class = Class;
    })();
})(window, "J16");
J16.con = window.J16.con || (function() {
    var Constants = {
        root: "http://i.9533.com/",
        crossDomainSwfId: "clockswf",
        cookies: ["J1616_www_my1616", "J1616_www_appVersions", "", ""],
        preLoadImages: ["/img/loading_big.gif"]
    };
    var tmpObj = {};
    tmpObj.get = function(name) {
        return Constants[name];
    };
    return tmpObj;
})();
J16.util = window.J16.util || {
    console: function(type, message) {
        if (window.console) window.console[type](message);
    },
    getType: function(o) {
        var s = Object.prototype.toString,
        t = {
            'undefined': 'undefined',
            'number': 'number',
            'boolean': 'boolean',
            'string': 'string',
            "[object Function]": "function",
            "[object RegExp]": "regexp",
            "[object Array]": "array",
            "[object Date]": "date",
            "[object Error]": "error"
        };
        return t[typeof o] || t[s.call(o)] || (o ? 'object': 'null');
    },
    getDomain: function() {
        return "." + location.host.split(".").slice( - 2).join(".");
    },
    setHome: function(o, r) {
        o.target = "_self";
        var a = "url(#default#homepage)",
        b = "http://bbs.1616.net/thread-1913-1-4.html";
        try {
            if (document.all && !external.max_version) {
                o.style.behavior = a;
                o.setHomePage(r ? r: "http://www" + this.getDomain());
            } else window.open(b);
        } catch(e) {
            if (document.all) {
                o.style.behavior = a;
                o.setHomePage(r ? r: "http://www" + this.getDomain());
            } else window.open(b);
        }
        return false;
    },
    getQueryString: function(name) {
        var reg = new RegExp("[?&]" + name + "=([^&]*)");
        var r = location.search.match(reg);
        return r ? r[1] : "";
    },
    hitTest: function(elem1, elem2) {
        var pos1 = elem1.getBoundingClientRect(),
        pos2 = elem2.getBoundingClientRect(),
        x1 = pos1.left,
        y1 = pos1.top,
        x2 = pos2.left,
        y2 = pos2.top,
        w1 = elem1.offsetWidth,
        h1 = elem1.offsetHeight,
        w2 = elem2.offsetWidth,
        h2 = elem2.offsetHeight;
        return (x1 < x2 ? x1 + w1 > x2: x1 < x2 + w2) && (y1 < y2 ? y1 + h1 > y2: y1 < y2 + h2);
    },
    mt: (function() {
        function parse(s) {
            var a = [];
            var re_t = /\{\$((?:[^\\}]|\\[\s\S])+)\}/;
            var re_s = /\\([\s\S])/g;
            var esc = function(s) {
                return s.replace(re_s, '$1');
            };
            var re_c = /(?:^|[^\\])(?:\\\\)*$/;
            var t, m, n;
            while (t = re_t.exec(s)) {
                n = (m = t.index) + t[0].length;
                if (re_c.test(s.substr(0, m))) {
                    a.push(esc(s.substr(0, m)));
                    a.push([esc(t[1])]);
                } else a.push(esc(s.substr(0, n)));
                s = s.substr(n);
            }
            return a;
        }
        function show(s, o) {
            var a = parse(s);
            for (var i = 0; i < a.length; i++) if (typeof a[i] == 'object') a[i] = o[a[i]] || '';
            return a.join('');
        }
        function show2(s, o) {
            return s.replace(/\{\$([^}]+)\}/g,
            function(a, b) {
                return o[b] || '';
            });
        }
        return function(template, data, adv) {
            var f = adv ? show: show2;
            if (! (data instanceof Array)) return f(template, data);
            var s = '';
            for (var i = 0; i < data.length; i++) s += f(templet, data[i]);
            return s;
        };
    })(),
    guid: (function() {
        if (typeof document.documentElement.uniqueID !== 'undefined') {
            return function(element) {
                return element.uniqueID;
            };
        }
        var uid = 0;
        return function(element) {
            return element.__uniqueID || (element.__uniqueID = 'uniqueID__' + uid++);
        };
    })()
};
J16.util.cookie = {
    set: function(n, v, e, p, d, s) {
        if (!e) e = 365;
        if (!p) p = '/';
        e = e * 1000 * 60 * 60 * 24;
        var e_date = new Date(new Date().getTime() + (e));
        document.cookie = n + '=' + encodeURIComponent(v) + ((e) ? ';expires=' + e_date.toGMTString() : '') + ((p) ? ';path=' + p: '') + ((d) ? ';domain=' + d: '') + ((s) ? ';secure': '');
    },
    get: function(n) {
        var c = document.cookie.split("; ");
        for (var i = 0; i < c.length; i++) {
            var p = c[i].split("=");
            if (n == p[0]) try {
                return decodeURIComponent(p[1])
            } catch(e) {
                return null
            }
        }
        return null;
    },
    del: function(name, path, domain) {
        document.cookie = name + "=1" + ((path) ? ";path=" + path: "") + ((domain) ? ";domain=" + domain: "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
};
J16.util.json = {
    obj2str: function(o) {
        var r = [];
        if (typeof o == "string") return quote(o);
        if (typeof o == "undefined") return "undefined";
        if (typeof o == "object") {
            if (o === null) return "null";
            else if (!o.sort) {
                for (var i in o) r.push(this.obj2str(i) + ":" + this.obj2str(o[i]));
                r = "{" + r.join() + "}";
            } else {
                for (var i = 0; i < o.length; i++) r.push(this.obj2str(o[i]));
                r = "[" + r.join() + "]";
            }
            return r;
        }
        return o.toString();
        function quote(string) {
            var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
            var meta = {
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"': '\\"',
                '\\': '\\\\'
            };
            escapable.lastIndex = 0;
            return escapable.test(string) ? '"' + string.replace(escapable,
            function(a) {
                var c = meta[a];
                return typeof c === 'string' ? c: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice( - 4);
            }) + '"': '"' + string + '"';
        }
    },
    str2obj: function(str) {
        var undefined;
        try {
            if (str) {
                return eval('(' + str + ')');
            }
        } catch(ex) {}
        return null;
    }
};
J16.util.string = {
    cut: function(s, length, postfix) {
        if (typeof(s) != "string") return s;
        postfix = postfix || "";
        if (!s || !length) {
            return "";
        }
        var len = 0,
        temp = "";
        for (var i = 0; i < s.length; i++) {
            if (s.charCodeAt(i) > 255) {
                len += 2;
            } else {
                len++;
            }
            if (len > length) {
                return temp + postfix;
            }
            temp += s.charAt(i);
        }
        return s;
    }
};
J16.util.array = {
    removeItem: function(array, dx) {
        if (isNaN(dx) || dx > array.length || dx < 0) {
            return false;
        }
        return array.splice(dx, 1);
    }
}; (function(win, undefined) {
    var Dialog = J16.Class.extend({
        options: {
            html: '',
            iframe: '',
            title: '标题',
            isShowLoading: 0,
            width: 200,
            height: 80,
            onshow: function() {},
            onIframeLoaded: function() {},
            onclose: function() {},
            top: -1,
            left: -1,
            opacity: '.5',
            hideType: 'display',
            temp: "<div id='alert1616_main'><table  cellspacing=\"0\"><tr class=\"alert_top\"><td class=\"lt\">&nbsp;</td><td class=\"ct\"><h2 id=\"alert1616_title\"></h2></td><td class=\"rt\">&nbsp;</td></tr><tr class=\"alert_content\"><td class=\"lc\">&nbsp;</td><td class=\"cc\"><div id=\"alert1616_content\"></div></td><td class=\"rc\">&nbsp;</td></tr><tr class=\"alert_bottom\"><td class=\"lb\">&nbsp;</td><td class=\"cb\"></td><td class=\"rb\">&nbsp;</td></tr></table><div id=\"alert1616_closer\" title=\"关闭\"></div></div>"
        },
        init: function(opt) {
            this.setOpt(opt);
        },
        setOpt: function(opt) {
            $.extend(this.options, opt)
        },
        runOnce: function(inner) {
            var op = this.options.opacity;
            $('<div id="alert1616_cover" style="opacity:' + op + '; filter:alpha(opacity=' + (op * 100) + ');"></div>').appendTo($('body'));
            $(inner).appendTo($('body'));
            this.destroy(1);
        },
        render: function() {
            var opt = this.options;
            if (opt.iframe != '') {
                var loading = opt.isShowLoading ? "<img style='position:absolute;top:50%;margin-top:-40px;left:50%; margin-left:-40px;' src='http://r.9533.com/iplatform/img/loading2.gif'/>": "";
                $('#alert1616_content').html(loading + "<iframe frameborder='0' scrolling='no' style='height:100%; width:100%;' src=\"" + opt.iframe + "\"></iframe>");
            } else {
                $('#alert1616_content').html(opt.html);
            }
            $('#alert1616_title').html(opt.title);
            $('#alert1616_content').height(opt.height).width(opt.width);
        },
        _setCoverWH: function() {
            $("#alert1616_cover").css({
                height: "100%",
                width: "100%"
            })
        },
        _setPos: function(opt) {
            var _h = win.innerHeight || document.documentElement.clientHeight;
            var _w = document.documentElement.offsetWidth;
            this.posRecord = document.all && navigator.userAgent.indexOf('MSIE 6') != -1 ? {
                left: opt.left == -1 ? (_w - opt.width - 28) / 2 + document.documentElement.scrollLeft: opt.left,
                top: opt.top == -1 ? (_h - opt.height - 36) / 2 + document.documentElement.scrollTop: opt.top,
                zIndex: 10000
            }: {
                left: opt.left == -1 ? (_w - opt.width - (document.all ? 28 : 12)) / 2 : opt.left,
                top: opt.top == -1 ? (_h - opt.height - (document.all ? 36 : 54)) / 2 : opt.top,
                zIndex: 10000
            };
            $('#alert1616_main').css(this.posRecord);
        },
        bindEvents: function() {
            var opt = this.options,
            _this = this;
            $("#alert1616_closer").unbind("click").click(function() {
                _this.destroy()
            });
            if (opt.iframe != '') {
                $('#alert1616_content iframe').unbind("load").bind('load',
                function() {
                    $('#alert1616_content img').hide();
                    var _win = $(this)[0].contentWindow;
                    opt.onIframeLoaded && opt.onIframeLoaded.call(_win);
                    var link = _win.document.links,
                    len = link.length;
                    setTimeout(function() {
                        for (var i = 0; i < len; i++) {
                            if (link[i].className.toLowerCase().indexOf('alert1616') != -1) {
                                document.all ? link[i].attachEvent("onclick", setEvent) : link[i].addEventListener("click", setEvent, false);
                            }
                        }
                    },
                    10);
                })
            }
            function setEvent(e) {
                $('#alert1616_content img').show();
                var e = e || win.event;
                var tar = e.target || e.srcElement,
                t = tar.getAttribute("title"),
                h = tar.getAttribute("_height"),
                w = tar.getAttribute("_width");
                t && $('#alert1616_title').html(t);
                h && $('#alert1616_content').height(h);
                w && $('#alert1616_content').width(w);
            }
            if (navigator.userAgent.indexOf('MSIE 6') != -1) {
                $(win).unbind("scroll").scroll(function() {
                    _this._setPos(opt)
                });
            }
            $(win).unbind("resize").resize(function() {
                _this._setPos(opt);
                _this._setCoverWH();
            });
        },
        show: function(opt) {
            if (!$('#alertstyle')[0]) {
                var link = document.createElement('link');
                link.setAttribute('rel', 'stylesheet');
                link.setAttribute('type', 'text/css');
                link.id = 'alertstyle';
                link.href = 'http://r.9533.com/iplatform/img/tc.css';
                $('head')[0].appendChild(link);
            }
            if (opt) this.setOpt(opt);
            if (!$('#alert1616_cover')[0]) {
                this.runOnce(this.options.temp);
            }
            this.render();
            this.display();
            this.bindEvents();
        },
        display: function() {
            this._setPos(this.options);
            $('#alert1616_main').show();
            $('#alert1616_cover').show();
            this.options.onshow.call(this);
        },
        destroy: function(notRunClose) {
            if (this.options.hideType != 'display') {
                $('#alert1616_main').css({
                    top: '-999px'
                });
            } else {
                $('#alert1616_main').hide();
            }
            $('#alert1616_cover').hide();
            notRunClose || this.options.onclose.call(this);
        }
    });
    J16.util.dialog = win.J16.util.dialog || {
        show: function(opt) {
            var d = arguments.callee.Al || (arguments.callee.Al = new Dialog());
            opt ? d.show(opt) : d.display();
            if (!J16.util.dialog.hide) {
                J16.util.dialog.hide = function(b) {
                    d.destroy(b)
                }
            }
        }
    }
})(window);
J16.util.lunar = function(t) {
    var __nongli = {
        L: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0],
        Jq: [[19, 19, 19, 21, 23, 24, 27, 29, 1, 1, 30, 30], [29, 30, 30, 2, 4, 6, 8, 10, 11, 12, 12, 11], [12, 11, 12, 13, 14, 17, 18, 20, 22, 22, 23, 22], [23, 23, 23, 24, 26, 27, 30, 2, 3, 3, 4, 4], [4, 4, 4, 6, 7, 8, 11, 12, 14, 15, 14, 15], [14, 15, 15, 17, 18, 20, 22, 23, 25, 25, 26, 25], [26, 25, 27, 27, 29, 2, 3, 4, 6, 6, 7, 6], [7, 7, 8, 8, 11, 12, 14, 16, 17, 17, 17, 18], [17, 17, 18, 20, 21, 23, 26, 27, 29, 29, 28, 28], [28, 28, 28, 1, 2, 5, 7, 8, 10, 10, 10, 10], [10, 9, 9, 11, 13, 15, 17, 19, 20, 21, 21, 21], [21, 21, 21, 22, 24, 26, 27, 1, 1, 2, 2]],
        G: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"],
        Z: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"],
        M: ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"],
        TM: "0|gd4|wrn|1d98|1tuh|2akm|2rfn|38g9|3plp|46vz|4o9k|55px|5n73|64o5|6m37|73fd|7kna|81qe|8io7|8zgq|9g4b|9wnk|ad3g|ath2|".split('|'),
        TN: "小寒|大寒|立春|雨水|惊蛰|春分|清明|谷雨|立夏|小满|芒种|夏至|小暑|大暑|立秋|处暑|bailu|秋分|寒露|霜降|立冬|小雪|大雪|冬至".split('|'),
        _GT: function(y, m, d) {
            var T = this,
            _tm = T.TM,
            _tn = T.TN;
            for (var i = 24; i--;) _tm[i] = parseInt(_tm[i], 36);
            function term(y, n) {
                var d = new Date((31556925974.7 * (y - 1900) + T.TM[n] * 60000) + Date.UTC(1900, 0, 6, 2, 5));
                return {
                    m: d.getUTCMonth(),
                    d: d.getUTCDate()
                }
            };
            for (var i = T.TN.length,
            x; i--;) {
                x = term(y, i);
                if (x.m == m - 1 && x.d == d) return T.TN[i];
            };
            return '';
        },
        _ZG: function(n) {
            return (this.G[n % 10] + this.Z[n % 12]);
        },
        _Y: function(y) {
            var i, sum = 348;
            for (i = 0x8000; i > 0x8; i >>= 1) {
                sum += (this.L[y - 1900] & i) ? 1 : 0;
            }
            return (sum + this._D(y));
        },
        _D: function(y) {
            if (this._M(y)) {
                return ((this.L[y - 1900] & 0x10000) ? 30 : 29);
            } else {
                return (0);
            }
        },
        _M: function(y) {
            return (this.L[y - 1900] & 0xf);
        },
        _mD: function(y, m) {
            return ((this.L[y - 1900] & (0x10000 >> m)) ? 30 : 29);
        },
        _lun: function(t) {
            var i, leap = 0,
            temp = 0,
            T = this,
            ofs = Math.floor((t.getTime() + 2206425600000) / 86400000);
            var dayCyl = ofs + 40,
            monCyl = 14;
            var _yy = t.getFullYear(),
            _mm = t.getMonth() + 1,
            _dd = t.getDate();
            for (i = 1900; i < 2050 && ofs > 0; i++) {
                temp = T._Y(i);
                ofs -= temp;
                monCyl += 12;
            }
            if (ofs < 0) {
                ofs += temp;
                i--;
                monCyl -= 12;
            }
            year = i;
            yearCyl = i - 1864;
            leap = T._M(i);
            isLeap = false;
            for (i = 1; i < 13 && ofs > 0; i++) {
                if (leap > 0 && i == (leap + 1) && isLeap == false) {--i;
                    isLeap = true;
                    temp = T._D(year);
                } else {
                    temp = T._mD(year, i);
                }
                if (isLeap == true && i == (leap + 1)) isLeap = false;
                ofs -= temp;
                if (isLeap == false) monCyl++;
            }
            if (ofs == 0 && leap > 0 && i == leap + 1) {
                if (isLeap) {
                    isLeap = false;
                } else {
                    isLeap = true; --i; --monCyl;
                }
            }
            if (ofs < 0) ofs += temp; --i; --monCyl;
            day = ofs + 1,
            month = i;
            var tday = (day < 11) ? "初": ((day < 20) ? "十": ((day < 30) ? "廿": "卅"));
            if (day % 10 != 0 || day == 10) tday += "一二三四五六七八九十".charAt((day - 1) % 10);
            var _k = (day == 1) ? (month + 1) : month,
            k = T.Jq[(year - 1999) % 12][_k],
            l = T.Jq[(year - 1999) % 12][_k + 1],
            _m = (k - l);
            if (_m < 0) _m = -_m;
            if ((day >= k && parseInt(_m) < 20) || day == 1) monCyl += 1;
            return [year, T.M[_k - 1] + "月", tday, isLeap, T._ZG(yearCyl), T._ZG(monCyl), T._ZG(dayCyl), T._GT(_yy, _mm, _dd)];
        }
    }
    return __nongli._lun(t);
};
J16.io = window.J16.io || {};
J16.io.proxyUrl = "http://api.1616.net/proxy.htm";
J16.io.set = function(url, data, fn, callbackName) {
    var CALLBACK = {};
    window.addEventListener ? window.addEventListener('message', callback, false) : window.attachEvent('onmessage', callback);
    function callback(e) {
        e = e.data || e;
        e = e.split('$$$');
        CALLBACK[e[1]](e[0]);
        destroyProxy(e[1]);
    };
    function destroyProxy(id) {
        var div = document.getElementById(id),
        ifr = div.firstChild;
        div.innerHTML = '';
        div.parentNode.removeChild(div);
        delete CALLBACK[id];
    };
    function createProxy(src, id) {
        var div = document.createElement('DIV');
        div.style.display = 'none';
        div.id = id;
        div.innerHTML = '<iframe src="' + src + '"></iframe>';
        document.body.appendChild(div);
        return div.firstChild;
    }
    function post(func, params, fn) {
        var RID = '$' + ( + new Date),
        ifr = createProxy(J16.io.proxyUrl, RID);
        CALLBACK[RID] = fn || new Function;
        params = params.concat(RID).concat(func).join('$$$');
        ifr.addEventListener ? ifr.onload = loaded: ifr.attachEvent('onload', loaded);
        ifr.contentWindow.postMessage || (ifr.contentWindow.opener = {
            data: params,
            callback: CALLBACK[RID]
        });
        function loaded() {
            ifr.contentWindow.postMessage && ifr.contentWindow.postMessage(params, '*');
        }
    } (data.replace(/[^\x00-\xff]/g, "xx").length > 1350) ? post('__send', [url, data], fn) : J16.io.get(url + (/\?/.test(url) ? '&': '?') + data, fn, callbackName, false);
};
J16.io.get = function(url, fnback, callbackName, isSimple) {
    var s, c, fn = 'jsonp' + ( + new Date()) + (this.jsonpid = ++this.jsonpid || 0),
    d = document,
    cbk = callbackName || 'callback',
    src = (url.indexOf("?") == -1 ? url + (isSimple ? "": "?") : url) + (isSimple ? '': '&' + cbk + '=' + fn),
    h = d.getElementsByTagName("head")[0]; (s = d.createElement("script")).setAttribute("type", "text/javascript");
    s.src = src;
    h.insertBefore(s, h.firstChild);
    window[fn] = function() {
        fnback && fnback.apply(null, arguments);
        c = 1
    };
    function done() {
        s.parentNode.removeChild(s);
        c || fnback && fnback()
    }
    s.onload = s.onreadystatechange = function() {
        s.readyState ? s.readyState.toLowerCase() == 'loaded' && (s.onreadystatechange = null, done()) : done()
    };
};
void
function(win, undefined) {
    var LazyLoad = (function(win, doc) {
        var env, head, pending = {},
        pollCount = 0,
        queue = {
            css: [],
            js: []
        },
        styleSheets = doc.styleSheets;
        function createNode(name, attrs) {
            var node = doc.createElement(name),
            attr;
            for (attr in attrs) {
                if (attrs.hasOwnProperty(attr)) {
                    node.setAttribute(attr, attrs[attr]);
                }
            }
            return node;
        }
        function finish(type) {
            var p = pending[type],
            callback,
            urls;
            if (p) {
                callback = p.callback;
                urls = p.urls;
                urls.shift();
                pollCount = 0;
                if (!urls.length) {
                    if (callback) {
                        callback.call(p.context, p.obj);
                    }
                    pending[type] = null;
                    if (queue[type].length) {
                        load(type);
                    }
                }
            }
        }
        function getEnv() {
            if (env) {
                return;
            }
            var ua = navigator.userAgent;
            env = {
                async: doc.createElement('script').async === true
            }; (env.webkit = /AppleWebKit\//.test(ua)) || (env.ie = /MSIE/.test(ua)) || (env.opera = /Opera/.test(ua)) || (env.gecko = /Gecko\//.test(ua)) || (env.unknown = true);
        }
        function load(type, urls, callback, obj, context) {
            var _finish = function() {
                finish(type);
            },
            isCSS = type === 'css',
            i,
            len,
            node,
            p,
            pendingUrls,
            url;
            getEnv();
            if (urls) {
                urls = typeof urls === 'string' ? [urls] : urls.concat();
                if (isCSS || env.async || env.gecko || env.opera) {
                    queue[type].push({
                        urls: urls,
                        callback: callback,
                        obj: obj,
                        context: context
                    });
                } else {
                    for (i = 0, len = urls.length; i < len; ++i) {
                        queue[type].push({
                            urls: [urls[i]],
                            callback: i === len - 1 ? callback: null,
                            obj: obj,
                            context: context
                        });
                    }
                }
            }
            if (pending[type] || !(p = pending[type] = queue[type].shift())) {
                return;
            }
            head || (head = doc.head || doc.getElementsByTagName('head')[0]);
            pendingUrls = p.urls;
            for (i = 0, len = pendingUrls.length; i < len; ++i) {
                url = pendingUrls[i];
                if (isCSS) {
                    node = createNode('link', {
                        charset: 'utf-8',
                        'class': 'lazyload',
                        href: url,
                        rel: 'stylesheet',
                        type: 'text/css'
                    });
                } else {
                    node = createNode('script', {
                        charset: 'utf-8',
                        'class': 'lazyload',
                        src: url
                    });
                    node.async = false;
                }
                if (env.ie) {
                    node.onreadystatechange = function() {
                        var readyState = this.readyState;
                        if (readyState === 'loaded' || readyState === 'complete') {
                            this.onreadystatechange = null;
                            _finish();
                        }
                    };
                } else if (isCSS && (env.gecko || env.webkit)) {
                    if (env.webkit) {
                        p.urls[i] = node.href;
                        poll();
                    } else {
                        setTimeout(_finish, 50 * len);
                    }
                } else {
                    node.onload = node.onerror = _finish;
                }
                head.appendChild(node);
            }
        }
        function poll() {
            var css = pending.css,
            i;
            if (!css) {
                return;
            }
            i = styleSheets.length;
            while (i && --i) {
                if (styleSheets[i].href === css.urls[0]) {
                    finish('css');
                    break;
                }
            }
            pollCount += 1;
            if (css) {
                if (pollCount < 200) {
                    setTimeout(poll, 50);
                } else {
                    finish('css');
                }
            }
        }
        return {
            css: function(urls, callback, obj, context) {
                load('css', urls, callback, obj, context);
            },
            js: function(urls, callback, obj, context) {
                load('js', urls, callback, obj, context);
            }
        };
    })(win, win.document);
    var jsUrls = [];
    if (typeof(J16) === "undefined") {
        jsUrls.push("http://r.9533.com/js/J16.js");
        jsUrls.push("http://r.9533.com/js/J16.util.js");
        jsUrls.push("http://r.9533.com/js/J16.io.js");
    } else {
        if (J16.util === undefined) jsUrls.push("http://r.9533.com/js/J16.util.js");
        if (J16.io === undefined) jsUrls.push("http://r.9533.com/js/J16.io.js");
    }
    if (jsUrls.length) LazyLoad.js(jsUrls,
    function() {;
        core()
    })
    else core();
    function core() {
        if (win !== parent && parent.J16 && parent.J16.i) {
            J16.i = parent.J16.i;
        } else {
            J16.i = win.J16.i || {};
            J16.i.User = J16.Class.extend({
                init: function(id, name, level, email, mobile, isLogined) {
                    var self = this;
                    self.id = id;
                    self.name = name;
                    self.level = level;
                    self.email = email;
                    self.mobile = mobile;
                    self.isLogined = isLogined;
                },
                id: 0,
                name: "匿名",
                level: "访客",
                email: "anonymous@1616.net",
                mobile: "13800000000",
                visitorId: "",
                isLogined: false
            });
            J16.i.App = J16.Class.extend({
                cfg: null,
                id: "appId",
                name: "",
                isActive: false,
                isIframe: false,
                isNeedLogin: false,
                stickAble: false,
                events: function() {},
                render: function() {},
                init: function() {
                    this.render();
                    this.events();
                },
                destroy: function() {},
                onNotify: function(eventType, d) {}
            });
            J16.i.EventType = {};
            J16.i.core = function() {
                var cookie = J16.util.cookie,
                apps = {},
                observers = {},
                isLogined = !!cookie.get("Usecure") && cookie.get("Usecure") != "undefined",
                userName = cookie.get("Uname"),
                visitorId = cookie.get("Uvisitor");
                var J16_i_CFG = {};
                if (isLogined) {
                    var J16_i_USER = new J16.i.User("10002", userName, "VIP会员", "ligang@1616.net", "13811111111", true);
                    var getUrl = "http://api.1616.net/get2.php?app=";
                    var setUrl = "http://api.1616.net/update.php";
                } else {
                    var J16_i_USER = new J16.i.User();
                    J16_i_USER.visitorId = visitorId;
                    var getUrl = "http://api.1616.net/visitor_get2.php?visitor_id=" + visitorId + "&app=";
                    var setUrl = "http://api.1616.net/visitor_update.php";
                }
                function listen(scope, appId, eventType, handler) {
                    var gt = J16.util.getType,
                    et = J16.i.EventType,
                    as = null;
                    if (gt(eventType) == "array") {
                        for (var i = 0,
                        l = eventType.length; i < l; i++) {
                            _(eventType[i])
                        }
                    } else {
                        _(eventType)
                    }
                    function _(eventType) {
                        as = eventType.split("_");
                        _listen(scope, appId, as[0] + "_" + as[1], handler);
                        if (gt(et[as[0]]) === "undefined") et[as[0]] = {};
                        et[as[0]][as[1]] = as[2];
                    }
                    function _listen(scope, appId, eventStr, handler) {
                        var d = observers,
                        l = 0;
                        handler = handler ||
                        function() {};
                        if (typeof d[appId] === "undefined") {
                            d[appId] = {};
                        }
                        d[appId]["__SCOPE__"] = scope;
                        d[appId][eventStr] = handler;
                    }
                }
                function unListen(appId, eventType) {
                    var d = observers,
                    et = J16.i.EventType,
                    as = eventType.split("_");
                    if (typeof d[appId] !== "undefined") {
                        delete d[appId][as[0] + "_" + as[1]];
                        delete et[as[0]][as[1]];
                    }
                }
                function notify(appId, eventType, data) {
                    var as = eventType.split("_"),
                    eventStr = as[0] + "_" + as[1],
                    d = {
                        "sender": appId,
                        "data": data
                    };
                    J16.util.console("info", "eventType:" + eventType + " d:" + J16.util.json.obj2str(d));
                    for (var k in observers) {
                        if (observers[k].hasOwnProperty(eventStr)) {
                            try {
                                observers[k][eventStr].call(observers[k]["__SCOPE__"], eventType, d);
                            } catch(e) {
                                J16.util.console("warn", "模块:" + appId + ",事件:" + eventType + "，位置:J16.i.core.notify(),详情:" + e.message)
                            }
                        }
                    }
                }
                function ve(eventName) {
                    var re = false;
                    re = /^[A-Z-]+$/.test(eventName);
                    if (!re) J16.util.console("error", "listen：参数事件名“" + eventName + "”格式不对，只允许大写英文字母和短横线；范例：EVENT-ACTION");
                    return re;
                }
                function getCfg(appId, callback, isRefresh) {
                    if (J16_i_CFG[appId] && !!!isRefresh) {
                        callback({
                            code: 1,
                            desc: J16_i_CFG[appId]
                        });
                    } else {
                        J16.io.get(getUrl + appId,
                        function(d) {
                            var data = J16.util.json.str2obj(d.desc);
                            if (data == null) data = apps[appId].instance.cfg;
                            callback({
                                code: d.code,
                                desc: data
                            })
                        });
                    }
                }
                function setCfg(appId, config, callback) {
                    J16_i_CFG[appId] = config;
                    var data = {
                        app: appId,
                        key: "",
                        value: J16.util.json.obj2str(config),
                        visitor_id: J16_i_USER.visitorId
                    };
                    J16.io.set(setUrl, $.param(data),
                    function(d) {
                        callback({
                            code: d,
                            desc: ""
                        })
                    });
                }
                function getUser() {
                    var j = J16.util.json;
                    return j.str2obj(j.obj2str(J16_i_USER));
                }
                function s16(a, p) {
                    function createImg(src) {
                        var img = $('<img />').attr('src', src);
                        setTimeout(function() {
                            img = null;
                        },
                        100);
                    };
                    var wp = ["act=" + a, "log=" + ( + isLogined), "uid=" + (isLogined ? J16_i_USER.name: visitorId)];
                    for (var i = 0; i < p.length; i += 2) {
                        wp.push(p[i] + "=" + encodeURIComponent(p[i + 1]));
                    }
                    createImg("http://st.1616.net/s.php?" + wp.join("&"));
                }
                J16.i.CoreW = J16.Class.extend({
                    appId: null,
                    init: function(appId) {
                        this.appId = appId;
                    },
                    et: function(appId, eventName, desc) {
                        if (ve(eventName)) return appId + "_" + eventName + (desc ? "_" + desc.replace(/_/g, "-") : "");
                        else return null;
                    },
                    listen: function(eventType, handler, scope) {
                        listen(scope, this.appId, eventType, handler);
                    },
                    unListen: function(eventType) {
                        unListen(this.appId, eventType)
                    },
                    notify: function(eventType, data) {
                        notify(this.appId, eventType, data);
                    },
                    chkp: function(eventType, callback) {
                        var d = 0;
                        if (typeof(callback) == "function") {
                            callback(d);
                        } else return d;
                    },
                    getCfg: function(callback, isRefresh) {
                        return getCfg(this.appId, callback, isRefresh);
                    },
                    setCfg: function(config, callback) {
                        setCfg(this.appId, config, callback);
                    },
                    getUser: function() {
                        return getUser();
                    },
                    newApp: function() {
                        return new J16.i.App();
                    },
                    s16: function(url, title, channel1, channel2) {
                        s16(18, ["an", this.appId, "atn", channel1, "ain", channel2, "url", url, "un", title])
                    }
                });
                return {
                    register: function(appId, creator) {
                        apps[appId] = {
                            creator: creator,
                            instance: null
                        };
                    },
                    regAndStart: function(appId, creator) {
                        this.register(appId, creator);
                        this.start(appId)
                    },
                    start: function(appId) {
                        var d = apps[appId];
                        d.instance = d.creator(new J16.i.CoreW(appId));
                        d.instance.id = appId;
                        if (d.instance.name == "") d.instance.name = appId;
                        d.instance.init();
                    },
                    stop: function(appId) {
                        var d = apps[appId];
                        if (d.instance) {
                            d.instance.destroy();
                            d.instance = null;
                        }
                        observers[appId] = null;
                    },
                    startAll: function() {
                        for (var appId in apps) {
                            if (apps.hasOwnProperty(appId)) {
                                this.start(appId);
                            }
                        }
                    },
                    stopAll: function() {
                        for (var appId in apps) {
                            if (apps.hasOwnProperty(appId)) {
                                this.stop(appId);
                            }
                        }
                    }
                }
            } ();
        }
    }
} (window);
J16.i.core.regAndStart("menu",
function(coreW) {
    var app = coreW.newApp();
    app.cfg = "";
    app.init = function() {
        var T = this;
        coreW.listen([coreW.et(T.id, "OPEN-APP", "点击首页左侧菜单打开APP"), coreW.et(T.id, "UPDATE-STICK", "www首页左侧菜单更新进度信息"), coreW.et(T.id, "UPDATE-HEIGHT", "更新右侧Iframe的高度"), coreW.et(T.id, "GOT-CONFIG-ERROR", "获取APP配置失败时做出提示")], T.onNotify, T);
        T.height = $('#l').height() + 4;
        T.events();
    };
    app.events = function() {
        var T = this;
    };
    app.onNotify = function(eventType, d) {
        var T = this;
        switch (eventType) {
        case coreW.et(T.id, "OPEN-APP") : break;
        case coreW.et(T.id, "UPDATE-STICK") : break;
        case coreW.et(T.id, "UPDATE-HEIGHT") : void
            function() {
                $("#loading").hide();
                var $loader = $('#app_loader_' + d.sender);
                $loader.find('iframe').andSelf().removeAttr("style");
                var menuHeight = T.height;
                var iframeHeight = $loader.find("iframe")[0].contentWindow.document.documentElement.scrollHeight;
                var h = Math.max(menuHeight, iframeHeight);
                $loader.find('iframe').andSelf().height(h);
            } ();
            break;
        case coreW.et(T.id, "GOT-CONFIG-ERROR") : $("#app_loader_" + d.sender).html("<div class=appcfgloaderror>数据读取失败，请<a href='javascript:location.reload();' target=_self>点击这里</a>重试或按F5键刷新。如还无法解决，<a href='http://www.1616.net/jd/misc/advice.htm?app=" + d.sender + "' target=_self>请与我们联系</a>。</div>");
            break;
        }
    };
    return app;
});
void
function() {
    var U = J16.util;
    euc = encodeURIComponent;
    setCookie = U.cookie.set;
    getCookie = U.cookie.get;
    str2obj = U.json.str2obj;
    obj2str = U.json.obj2str;
    $type = U.getType;
    set_home = U.setHome;
    showWindow = function(opt) {
        U.dialog.show(opt);
        hideWindow = U.dialog.hide;
    };
    getDomain = U.getDomain;
    showLoginWindow = function(title, showFn, closeFn) {
        showWindow({
            iframe: '/passport/i_login.htm' + (title ? "?h1=" + euc(title) : ""),
            width: 440,
            height: 320,
            title: '登录',
            onshow: showFn || $.noop,
            onclose: closeFn || $.noop
        });
    };
    showRegisterWindow = function() {
        $(function() {
            showWindow({
                iframe: '/passport/i_register.htm',
                width: 440,
                height: 320,
                title: '注册',
                onIframeLoaded: function() {}
            });
        })
    };
    document.all && document.execCommand('BackgroundImageCache', false, true);
} ();
var JBase = J16.Class.extend({
    __active: 0,
    __iframeMode: 1,
    __needLogin: 0,
    __keepAlive: 1,
    __stickAble: 0,
    __name: '',
    __cfg: {
        __version: '1.0.0'
    },
    __login: function() {},
    __logout: function() {},
    __todo: function() {},
    __upgrade: function(runFrame) {
        runFrame()
    },
    __updateCfg: function(fnback) {
        var runTime = 0,
        recalled, T = this,
        name = this.__name,
        requestConfig = function() {
            J.isLogin ? J16.io.get('http://api.1616.net/get2.php?app=' + name, setCfg) : J16.io.get('http://api.1616.net/visitor_get2.php?visitor_id=' + J.user + '&app=' + name, setCfg);
        };
        function setCfg(d) {
            switch (d.code) {
            case 1:
                var e = str2obj(d.desc);;
                if (e != null) {
                    if (e == "") e = {
                        __version: '1.0.0'
                    };
                    T.__cfg = e;
                }
                checkUpgrade();
                break;
            case 0:
                $("#app_loader_" + name).html("<div class=appcfgloaderror>数据读取失败，请<a href='javascript:location.reload();' target=_self>点击这里</a>重试或按F5键刷新。如还无法解决，<a href='http://www.1616.net/jd/misc/advice.htm?app=" + name + "' target=_self>请与我们联系</a>。</div>") break;
            }
        }
        requestConfig();
        function checkUpgrade() {
            fnback.call(T);
        }
    },
    __simpleSave: function(key, fn) {
        var a0 = arguments[0],
        key = $type(a0) == 'string' ? a0: '',
        fn = arguments[1] ? arguments[1] : a0;
        if (key && this.__cfg[key] == undefined || $type(fn) != 'function') return;
        var T = this,
        cfg = key == '' ? obj2str(this.__cfg) : obj2str(this.__cfg[key]),
        hash = {
            app: this.__name,
            key: key,
            value: cfg
        };
        if (J.isLogin) {
            J16.io.set('http://api.1616.net/update.php', $.param(hash), fn);
        } else {
            hash.visitor_id = J.user;
            J16.io.set('http://api.1616.net/visitor_update.php', $.param(hash), fn);
        }
    },
    init: function(opt) {
        $.extend(this, opt);
    }
});
var Main = J16.Class.extend({
    user: J16_INF.user,
    isLogin: J16_INF.ac,
    apps: {},
    __eventQ: {
        logAction: null
    },
    activeAppName: 'www',
    init: function() {
        this.__eventQ.logAction = this.isLogin ? '__login': '__logout';
    },
    add: function(name, app, win) {
        var T = this;
        app.__name = name;
        app.__active = 1;
        var menu = $('#app_' + name);
        app.__iframeMode = menu.attr('mode');
        app.__version = menu.attr('ver');
        var realApp = this.apps[name] = new JBase(app);
        if (realApp.__beforeInit) {
            realApp.__beforeInit();
        }
        realApp.__updateCfg(function() {
            realApp.init();
            if (menu.attr('todo') !== undefined) {
                realApp.__todo(menu.attr('todo'));
            }
            $('#loading').hide();
            realApp.__updateHeight && realApp.__updateHeight();
            var ev = T.__eventQ;
            for (var p in ev) ev[p] == null || realApp[ev[p]]();
        });
        app = null;
        if (realApp.__iframeMode == 1) {
            if (win && $type(win) == 'object') {
                realApp.__updateHeight = function(height) {
                    var d = win.document;
                    if (!this.originalHeight || height === true) {
                        d.body.style.height = '';
                        height = this.originalHeight = d.body.offsetHeight;
                    }
                    height = height || this.originalHeight;
                    var menuHeight = $('#l').height() + 4;
                    var _height = Math.max(height, menuHeight);
                    d.body.style.height = _height + 'px';
                    $('#app_loader_' + name).find('iframe').andSelf().height(_height + 4);
                };
                win.getIns = getIns;
                window.stat && window.stat.init(win.document, name);
                $(win.document).mousedown(function() {
                    $('#weather-f').hide();
                })
            }
            if (realApp.__stickAble) {
                realApp.__updateStick = function(inner, display) {
                    $('#app_' + name + ' .sk').attr('stick', 1).html(inner);
                };
                realApp.__hideStick = function() {
                    $('#app_' + name + ' .sk').attr('stick', 0).hide();
                };
            }
            if (realApp.__needLogin && !this.isLogin) {}
        }
    },
    load: function(appName) {
        var app = this.apps[appName],
        T = this;
        if (this.activeAppName == appName) return;
        this.unload(this.activeAppName);
        this.activeAppName = appName;
        var endWith = appName == 'www' ? 'index': appName;
        location.hash = endWith;
        if (app && app.__active) {
            var loader = $('#app_loader_' + appName);
            if (appName != 'www') {
                if (navigator.userAgent.indexOf('Firefox') !== -1) {
                    if (loader.data('height')) {
                        loader.css('height', loader.data('height'));
                    }
                } else {
                    loader.css({
                        position: 'relative',
                        left: 0,
                        top: 0
                    });
                }
            } else {
                loader.show();
            }
            $('#loading').hide();
        } else {
            var m = $('#app_' + appName),
            customSrc = m.attr('appurl'),
            _h = m.attr('_h');
            var appDir = customSrc || 'http://apps.1616.net/' + appName + '/';
            if ($('#app_' + appName).attr('mode') == 1) {
                var template = "<div class='iframe_loader' id='app_loader_" + appName + "'><iframe frameborder='0' src='" + appDir + "' width='100%' height='" + (_h || "100%") + "' scrolling='no' allowtransparency='true'></iframe></div>";
                $('#r').append(template);
            } else {
                $.get(appDir,
                function(e) {
                    $('<div id="app_loader_' + appName + '" class="iframe_loader">' + e + '</div>').appendTo($('#r'));
                });
            }
            $('#loading').show();
        }
    },
    unload: function(appName) {
        var app = this.apps[appName],
        loader = $('#app_loader_' + appName);
        if (!app) {
            loader[0].innerHTML = '';
            loader.remove();
            return;
        };
        if (app.__onUnload) {
            app.__onUnload();
        }
        if (app.__keepAlive) {
            if (appName != 'www') {
                if (navigator.userAgent.indexOf('Firefox') !== -1) {
                    var _height = loader.height();
                    loader.data('height', _height).css({
                        height: 0
                    });
                } else {
                    loader.css({
                        position: 'absolute',
                        left: 0,
                        top: -9999
                    });
                }
            } else {
                loader.hide();
            }
            if (app.__stickAble) {
                app.__showStick && app.__showStick();
            }
        } else {
            loader.remove();
            app.__active = 0;
            if (app.__iframeMode) {
                delete this.apps[appName];
            }
        }
    },
    dispatch: function(eventType, params) {
        if (eventType == '__login' || eventType == '__logout') {
            var hash = location.hash;
            var has = false;
            $('#nav>li').each(function(k, v) {
                if (v.id.indexOf(hash.slice(1)) > 0) has = true;
            });
            if (eventType == '__login' && hash.indexOf('manager') != -1) {
                has = true;
            }
            hash = has ? hash: '#index';
            location.href = location.href.replace(/net.*/, eventType == '__login' ? 'net/' + J.user + '/' + hash: 'net/' + hash);
        } else {
            $.each(this.apps,
            function(k, v) {
                v[eventType] && v[eventType].apply(v, (params || []))
            });
        }
    }
});
var www = {
    $APP: {},
    __iframeMode: 0,
    __cfg: {},
    runInitAuto: true,
    concat: function(GUID, app) {
        app.autoInit = arguments.length == 2;
        this.$APP[GUID] = app;
    },
    events: function() {
        $('#login').click(function() {
            showLoginWindow();
            return false;
        });
        $('#logout').click(function() {
            var dm = getDomain();
            setCookie('Usecure', '', null, null, dm);
            J.dispatch('__logout');
            return false;
        });
        $('#uname').click(function() {
            showWindow({
                iframe: '/passport/i_account.htm',
                width: 440,
                height: 280,
                title: '我的帐户'
            });
            return false;
        });
        $('#mhome,a.sethome').click(function() {
            set_home(this, "http://" + window.location.host);
            return false;
        });
    },
    __beforeInit: function() {
        var T = this;
        $.each(this.$APP,
        function(name, app) {
            app.getCfg = function() {
                return T.__cfg[name]
            };
            app.setCfg = function(cfg) {
                return T.__cfg[name] = cfg
            };
            app.__save = function(cfg, fn) {
                app.setCfg(cfg);
                T.__simpleSave(name, fn);
            };
            T.__cfg[name] = app.__cfg == undefined ? null: app.__cfg;
            if (J16_INF.www != null && J16_INF['www'][name] === null) {
                J16_INF['www'][name] = app.__cfg;
            }
        });
        if (J16_INF.www != null) {
            $.extend(this.__cfg, J16_INF.www);
        }
    },
    __updateCfg: function(callbackFn) {
        callbackFn.call(this);
    },
    get: function(name) {
        return this.$APP[name];
    },
    call: function(fnName) {
        $.each(this.$APP,
        function(k, v) {
            if ((fnName === 'init' && v.autoInit) || fnName !== 'init') fnName in v && v[fnName]();
        });
    },
    __login: function() {
        this.call('__login');
    },
    __logout: function() {
        this.call('__logout');
    },
    __upgrade: function() {
        this.call('__upgrade');
    },
    init: function() {
        this.call('init');
        this.events();
    }
};
www.concat('menu', {
    linkTo: function() {
        var apps = [];
        $('#nav>li').each(function() {
            apps.push(this.id.replace('app_', '?'));
        });
        if (location.search != '') {
            var search = location.search.split('&')[0];
            if ($.inArray(search, apps) !== -1) {
                location.href = location.href.replace('?', '#');
            }
        }
        var h = location.hash.match(/#([^&]*)&?(.*)?/);
        if (h != null) {
            if (h[2]) {
                $('#app_' + h[1]).attr('todo', h[2]);
                $('#app_' + h[1]).trigger('click');
            } else {
                if (h[1].indexOf('un') === 0) {} else {
                    var h1 = h[1].toLowerCase(),
                    showResolveWindow = function() {
                        $(function() {
                            showWindow({
                                iframe: '/passport/i_findpassword.htm',
                                width: 440,
                                height: 320,
                                title: '找回密码',
                                onIframeLoaded: function() {}
                            })
                        });
                    };
                    h1 === 'reg' ? showRegisterWindow() : h1 === 'ret' ? showResolveWindow() : $('#app_' + h1).trigger('click');
                }
            }
        }
    },
    moveUp: function(id) {
        var menuBar = $('#app_' + id);
        menuBar.after(menuBar.prev());
        this.check();
    },
    moveDown: function(id) {
        var menuBar = $('#app_' + id);
        menuBar.before(menuBar.next());
        this.check();
    },
    add: function(option) {
        if ($('#nav > li[appid=' + option.appid + ']').length) return;
        function Template(temp, data) {
            return temp.replace(/@\{(.*?)\}/g,
            function($0, $1, $2, $3, D) {
                var A = $1.split('.'),
                F = A.slice(1).join('.'),
                D = D || data;
                return F ? arguments.callee($0, F, $2, $3, D[A[0]]) : D[$1] || $0;
            });
        }
        var temp = '<li appurl="@{appurl}" ver="@{ver}" mode="@{mode}" appid="@{appid}" id="app_@{id}"><a target="_self" href="#@{id}"><em class="ni-home" style="background-position:0 -' + (option.appid * 22 - 22) + 'px"></em>@{name}</a>{STICK}</li>';
        if (!option.appurl) {
            temp = temp.replace(' appurl="@{appurl}"', '');
        }
        temp = option.stickable ? temp.replace('{STICK}', '<div class="sk_wrap"><div class="sk" stick="0"><!--此处stick--></div></div>') : '';
        $(Template(temp, option)).appendTo('#nav');
        this.check();
    },
    del: function(id) {
        $('#app_' + id).remove();
        this.check();
    },
    check: function(i) {
        this.i = i || this.i;
        var T = this;
        if ($('#nav>li').length <= this.i) $('#showMore').hide();
        else $('#showMore').show();
        $('#nav>li').each(function(k, v) {
            if (k >= T.i) $(this).hide();
            else $(this).show();
        });
        this.hideLis = $('#nav>li:hidden');
        if ($('#showMore').attr('state') == '收起') {
            $('#showMore').click();
        }
    },
    _getTip: function(appName, appId, desc) {
        $('#tishi').remove();
        var h = [];
        h[h.length] = '<div id="tishi" style="width:192px">';
        h[h.length] = '<div class="tishiarrow_l"></div>';
        h[h.length] = '<div class="tishib1"></div>';
        h[h.length] = '<div class="tishib2"></div>';
        h[h.length] = '<div class="tishic">';
        h[h.length] = '<p style="font-weight: bold; padding-bottom: 4px">您还未添加该应用</p><p>' + desc + '</p>';
        h[h.length] = '<a href="#">添加应用</a><a style="margin-left: 96px" href="#">关闭</a></div>';
        h[h.length] = '<div class="tishib2"></div>';
        h[h.length] = '<div class="tishib1"></div>';
        h[h.length] = '</div>';
        $("#" + appName).find(">a").after(h.join(''));
        var $as = $("#tishi a");
        $as.eq(0).click(function() {
            $.getScript('/add_app.php?appId=' + appId,
            function(d) {
                if (d == 1) {
                    $("#" + appName).attr('newflag', '0');
                    $("#tishi .tishic").html("<span style='color:green'>添加成功</span>");
                    setTimeout(function() {
                        $("#tishi").fadeOut(500,
                        function() {
                            $('#tishi').remove()
                        })
                    },
                    1000);
                } else alert("添加失败，请重试")
            });
            return false
        });
        $as.eq(1).click(function() {
            $("#tishi").remove();
            return false
        })
    },
    init: function() {
        var T = this;
        this.i = J16_INF.appMenuDisplayNum;
        $('#nav').delegate('li', 'click',
        function() {
            if (!$('#loading')[0]) {
                $('<div id="loading" style="display: none;">页面加载中<img src="http://r.9533.com/iplatform/img/loading.gif"></div>').appendTo('#r');
            }
            if ($('#tishi')) {
                $('#tishi').remove();
            }
            var tabs = $('#nav>li');
            var i = tabs.index(this),
            sk = tabs.removeClass('cur').find('div.sk');
            sk.each(function() {
                $(this).attr('stick') == 1 ? $(this).show() : $(this).hide();
            });
            tabs.eq(i).addClass('cur').find('div.sk').hide();
            var newAppFlag = $(this).attr('newflag');
            if (newAppFlag == 1 && J.isLogin) {
                T._getTip($(this).attr("id"), $(this).attr('appid'), $(this).attr("desc"));
            }
            J.load($(this).attr('id').replace('app_', ''));
			
            return false;
        });
        $('#app_manager').click(function() {
            $('#nav>li').removeClass('cur');
            if (J16_INF.ac) J.load('manager')
            else {
                showLoginWindow('请登录后再使用该功能！',
                function() {
                    location.hash = '#manager';
                },
                function() {
                    location.hash = '#index';
                });
            }
            this.blur();
            return false;
        });
        $('#nav a,#showMore').focus(function() {
            this.blur()
        });
        $('#showMore').click(function() {
            var attr = $(this).attr('state') || '更多';
            if (attr === '更多') {
                T.hideLis.fadeIn();
                $(this).html('<em class="jt02"></em>收起').attr('state', '收起');
                updateHeight();
            } else {
                T.hideLis.fadeOut(updateHeight);
                $(this).html('<em class="jt01"></em>更多').attr('state', '更多');
                updateHeight();
            }
            return false;
        });
        this.check();
        this.linkTo();
        function updateHeight() {
            try {
                getIns(J.activeAppName).__updateHeight();
            } catch(e) {}
        }
    }
});
www.concat('theme', {
    hasLoaded: false,
    events: function() {
        var face = $('#face'),
        tip = face.find('span:first'),
        T = this,
        running = 0,
        tipped = J16.util.cookie.get('tipped');
        face.toggle(function() {
            if (running) return;
            running = 1;
            T.loadHtml(function() {
                $('#theme_layer').slideDown(function() {
                    face.html('<em></em>收起');
                    running = 0;
                });
            });
            J16.util.cookie.set('tipped', '1');
            tip.fadeOut();
        },
        function() {
            if (running) return;
            running = 1;
            $('#theme_layer').slideUp(function() {
                face.html('<em></em>换肤');
                running = 0;
            });
        }).focus(function() {
            this.blur()
        });
        tipped || (tip.show(), setTimeout(function() {
            tip.fadeOut();
        },
        5000))
    },
    loadHtml: function(fn) {
        if (this.hasLoaded) return fn();
        var T = this;
        $.get('/plugins/theme.htm', '',
        function(e) {
            var bg = e.indexOf('<div');
            var nd = e.indexOf('<script', bg);
            var html = e.substring(bg, nd);
            var css = e.substr(0, bg);
            var js = e.substr(nd);
            $('#theme_layer').html(html);
            $('head').append(css).append(js);
            T.hasLoaded = true;
            setTimeout(fn, 100);
        })
    },
    init: function() {
        this.events();
    }
});
www.concat('logo', {
    __cfg: {
        icon: 'img/logo.png'
    },
    init: function() {
        this.events();
    },
    events: function() {
        $('#logoset').click(function() {
            showWindow({
                title: '自定义Logo',
                width: 560,
                height: 400,
                iframe: 'http://img.1616.net/'
            });
            return false;
        });
    }
});
www.concat('layout', {
    __cfg: [[], ["fun", "life", "economy", "tech"]],
    _setOrder: function(order, i) {
        var T = this,
        doms = [];
        if ($type(order) != "array") return;
        if (order.join("") == T._getOrder(i).join("")) return;
        for (var k in order) {
            doms.push($("#" + order[k]).clone(true));
            $("#" + order[k]).remove();
        }
        for (var dom in doms) {
            if (dom == 0) {
                T._setArrowCss(doms[dom], "up-n", "down");
            } else if (dom == doms.length - 1) {
                T._setArrowCss(doms[dom], "up", "down-n");
            } else {
                T._setArrowCss(doms[dom], "up", "down");
            }
            if (!i) {
                $("div.l").append(doms[dom]);
            } else {
                $("#sites-r").append(doms[dom]);
            }
        }
    },
    _getOrder: function(i) {
        var re = [],
        $doms = i == 0 ? $("div.l>div.app") : $("#sites-r>div.wrap-fl");
        $doms.each(function() {
            re.push($(this).attr("id"));
        });
        return re;
    },
    _bindEvents: function() {
        var T = this,
        n = "layout",
        app = getIns("www");
        $("a.up").live("click",
        function() {
            var oldDom = $(this).parents(".app,.wrap-fl"),
            prev = oldDom.prev(".app,.wrap-fl");
            if (prev.length) {
                var dom = oldDom.clone(true);
                T._swap(dom, prev);
                prev.before(dom);
                oldDom.remove();
                _fn1();
            }
        });
        $("a.down").live("click",
        function() {
            var oldDom = $(this).parents(".app,.wrap-fl"),
            next = oldDom.next(".app,.wrap-fl");
            if (next.length) {
                var dom = dom = oldDom.clone(true);
                T._swap(dom, next);
                next.after(dom);
                oldDom.remove();
                _fn1();
            }
        });
        function _fn1(cfg) {
            var cfg = T.getCfg();
            cfg[1] = T._getOrder(1);
            T.__save(cfg,
            function(e) {
                if (e !== 1) {}
            });
        }
    },
    _swap: function(appA, appB) {
        var As = appA.find(".up,.up-n,.down,.down-n"),
        Bs = appB.find(".up,.up-n,.down,.down-n"),
        cssA = [],
        cssB = [];
        As.each(function() {
            cssA.push($(this).attr("class"));
        });
        Bs.each(function() {
            cssB.push($(this).attr("class"));
        });
        As.each(function(i) {
            $(this).attr("class", cssB[i]);
        });
        Bs.each(function(i) {
            $(this).attr("class", cssA[i]);
        });
    },
    _setArrowCss: function(app, a, b) {
        var As = app.find(".up,.up-n,.down,.down-n");
        $(As[0]).attr("class", a);
        $(As[1]).attr("class", b);
    },
    __login: function(app) {
        var c = this.getCfg();
        if (!c) return;
        this._setOrder(c[1], 1);
    },
    __logout: function(app) {
        this.__login(app)
    },
    init: function() {
        this._bindEvents();
    }
}); (function() {
    var version_prefix = "http://www.1616.net/jd/";
    var version_cookieName = 'J1616_www_my1616';
    var version_cookieValue = {
        th: "green",
        ft: 1,
        bg: 1,
        tpg: "1-1",
        lo: 0,
        m: null
    };
    var cookie = J16.util.cookie;
    www.concat('version', {
        init: function() {
            this.events();
        },
        events: function() {
            $('#banben-a').mouseover(function() {
                $(this).addClass('banben-a-on');
                $('#banben-qh').show();
            }).mouseleave(function(e) {
                e = e.relatedTarget || e.toElement;
                if (e == $('#banben-qh')[0] || $.contains($('#banben-qh')[0], e)) {
                    return;
                }
                $('#banben-qh').hide();
                $(this).removeClass('banben-a-on');
            }).click(function() {
                return false;
            });
            $('#banben-qh').mouseleave(function(e) {
                $(this).hide();
                $('#banben-a').removeClass('banben-a-on');
            });
            $("#banben-qh a").click(function() {
                if ($(this).attr("_k") == '0') return false;
                version_cookieValue.m = $(this).attr("_h");
                var d = cookie.get(version_cookieName),
                cookieValue = version_cookieValue;
                if (d = str2obj(d)) {
                    cookieValue = d;
                    cookieValue.m = version_cookieValue.m;
                }
                cookie.set(version_cookieName, obj2str(cookieValue));
                location.href = (version_prefix + version_cookieValue.m + ".htm");
                return false;
            });
        }
    });
})();
www.concat('mail', {
    init: function() {
        this.events();
    },
    change: function() {
        var e = $('#mailselect'),
        v = e.val();
        var hash = {
            'qq': 'http://mail.qq.com',
            'hotmail': 'http://login.live.com/',
            'sogou': 'http://mail.sogou.com/',
            '139': 'http://mail.139.com/',
            'gmail': 'http://mail.google.com/',
            '188': 'http://www.188.com/'
        };
        if (v in hash) {
            window.open(hash[v]);
            e[0].selectedIndex = e.data('lastSelected') || 0;
        } else {
            e.data('lastSelected', e[0].selectedIndex);
        }
        this.setS16(v);
    },
    setS16: function(v) {
        if (v == '') {
            $('#subbtn').removeAttr('s16');
        } else {
            $('#subbtn').attr('s16', '#act=1&t=mail&v=' + v);
        }
    },
    check: function(o) {
        var a = o.mailuser,
        b = o.mailselect,
        c = o.mailpwd,
        cookie;
        if (!b.value) {
            b.focus();
            return false;
        }
        var u = $.trim(a.value),
        p = $.trim(c.value);
        if (!u) {
            a.select();
            return false;
        }
        if (!p) {
            c.select();
            return false;
        }
        switch (b.value) {
        case "163":
            o.action = "http://reg.163.com/login.jsp?style=1&type=1&url=http://entry.mail.163.com/coremail/fcg/ntesdoor2?style=1&lightweight%3D1%26verifycookie%3D1%26";
            o.username.value = u;
            o.password.value = p;
            break;
        case "126":
            o.action = "https://reg.163.com/logins.jsp?type=1&product=mail126&url=http://entry.mail.126.com/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26style%3D-1";
            o.username.value = u + "@126.com";
            o.password.value = p;
            break;
        case "yeah":
            o.action = "http://reg.163.com/logins.jsp?type=1&product=mailyeah&url=http://entry.mail.yeah.net/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26style%3D-1";
            o.username.value = u + "@yeah.net";
            o.password.value = p;
            break;
        case "sohu":
            o.action = "http://passport.sohu.com/login.jsp";
            o.url.value = "";
            o.UserName.value = u;
            o.Password.value = p;
            o.id.value = u;
            o.username.value = u;
            o.password.value = p;
            o.m.value = u;
            o.passwd.value = p;
            o.mpass.value = p;
            o.loginid.value = u + "@sohu.com";
            o.fl.value = "1";
            o.vr.value = "1|1";
            o.appid.value = "1000";
            o.ru.value = "http://login.mail.sohu.com/servlet/LoginServlet";
            o.eru.value = "http://login.mail.sohu.com/login.jsp";
            o.ct.value = "1173080990";
            o.sg.value = "5082635c77272088ae7241ccdf7cf062";
            break;
        case "yahoo":
            o.action = "https://edit.bjs.yahoo.com/config/login";
            o.login.value = u;
            o.passwd.value = p;
            break;
        case "yahoocn":
            o.action = "https://edit.bjs.yahoo.com/config/login";
            o.login.value = u + "@yahoo.cn";
            o.passwd.value = p;
            break;
        case "tom":
            o.action = "http://bjweb.163.net/cgi/163/login_pro.cgi";
            o.user.value = u;
            o.pass.value = p;
            break;
        case "21cn":
            o.action = "http://passport.21cn.com/maillogin.jsp";
            o.LoginName.value = u;
            o.passwd.value = p;
            o.domainname.value = "21cn.com";
            o.UserName.value = u + "@21cn.com";
            break;
        case "sina":
            o.action = "http://mail.sina.com.cn/cgi-bin/login.cgi";
            o.u.value = u;
            o.psw.value = p;
            break;
        case "chinaren":
            o.action = "http://passport.sohu.com/login.jsp";
            o.loginid.value = u + "@chinaren.com";
            o.passwd.value = p;
            o.fl.value = "1";
            o.vr.value = "1|1";
            o.appid.value = "1005";
            o.ru.value = "http://profile.chinaren.com/urs/setcookie.jsp?burl=http://alumni.chinaren.com/";
            o.ct.value = "1174378209";
            o.sg.value = "84ff7b2e1d8f3dc46c6d17bb83fe72bd";
            break;
        case "tianya":
            o.action = "http://passport.tianya.cn/login";
            o.vwriter.value = u;
            o.vpassword.value = p;
            break;
        case "baidu":
            o.action = "https://passport.baidu.com/?login";
            o.username.value = u;
            o.password.value = p;
            break;
        case "xiaonei":
            o.action = "http://www.renren.com/PLogin.do";
            o.email.value = u;
            o.password.value = p;
            break;
        case "51com":
            o.action = "http://passport.51.com/login.5p";
            o.passport_51_user.value = u;
            o.passport_51_password.value = p;
            o.gourl.value = "http%3A%2F%2Fmy.51.com%2Fwebim%2Findex.php";
            break;
        }
        cookie = euc(u) + '$' + euc(b.value);
        if ($('#mailchk').is(':checked')) {
            cookie += '$' + menc(p);
        }
        setCookie('J1616_www_jmail', cookie);
        c.value = '';
        return true;
    },
    events: function() {
        var T = this,
        cookie;
        $(document).mousedown(function(e) {
            var mf = $('#mail-f'),
            m = $('#mail')[0];
            if (mf.css('display') == 'none') return;
            if (! ($.contains(mf[0], e.target) || m == e.target || $.contains(m, e.target))) {
                mf.hide();
            }
        });
        $('#mail').click(function() {
            if ($('#mail-f').css('display') != 'none') {
                $('#mail-f').hide();
                return false;
            }
            cookie = getCookie('J1616_www_jmail');
            if (cookie) {
                cookie = cookie.replace(/^"|"$/g, '');
                var a;
                if (cookie.indexOf('@') == -1) {
                    a = cookie.split('$');
                    for (var i = 0; i < a.length; i++) a[i] = decodeURIComponent(a[i]);
                } else {
                    a = cookie.split('@');
                }
                $('#mailuser').val(a[0]);
                $('#mailselect').val(a[1]);
                T.setS16(a[1]);
                if (a[2]) $('#mailpwd').val(mdec(a[2]));
                else $('#mailchk')[0].checked = false;
                $('#mailselect').data('lastSelected', $('#mailselect')[0].selectedIndex);
            }
            $('#mail-f').show();
            return false;
        });
        $('#mailselect').change(function() {
            T.change();
        });
        $('#mail-c').submit(function() {
            return T.check(this) && ($('#mail-f').hide() || true);
        });
        $('#cz').click(function() {
            $('#mail-f').hide();
            return false;
        });
    }
});
function menc(s) {
    var r = '';
    for (var i = 0; i < s.length; i++) r += ('0' + (s.charCodeAt(i) ^ 15).toString(16)).slice( - 2);
    return r;
}
function mdec(s) {
    s = s.replace(/[^0-9a-z]/gi, '');
    var r = '';
    for (var i = 0; i < s.length; i += 2) r += String.fromCharCode(parseInt(s.substr(i, 2), 16) ^ 15);
    return r;
}
www.concat('famous', {
    l: "#bc0List>li",
    lk: "#bc0List>li>a:nth-child(1)",
    la: "#bc0List a[i]",
    f: 1,
    s: 0,
    _cfg: [],
    __cfg: [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
    _fc: ["", "hot2", "hot"],
    curItem: {},
    _events: function() {
        var T = this;
        $("#bc0Btn").click(function() {
            if (T.f) {
                T._crBtn();
            }
            T.f = 0;
            T.s = 1;
            $(T.la).css('display', '');
            $('#bc0Btn').hide();
            $('#bc0Btn_').show() $('#fs').hide();
            T.fs_clear();
            T._bdEvts();
        });
        $("#bc0Btn_").click(function() {
            T._cancel();
            $('#fs').show();
        });
        $("#fs-kw").keyup(function() {
            T.fs_input()
        });
    },
    fs_input: function() {
        var q = $.trim($('#fs-kw').val());
        if (q.length) $.getScript("http://so.1616.net/qsearch/?q=" + euc(q) + "&n=0,42&ns=getIns('www').get('famous').");
        else this.fs_clear()
    },
    fs_clear: function() {
        $("#bc0List_").hide();
        $("#bc0List").show();
        $('#fs-kw').val('');
    },
    qsearch_cb: function(r) {
        var kw = r.shift().split("|");
        kw.pop();
        kw = kw.join('|');
        if (kw != $.trim($('#fs-kw').val())) return;
        $("#bc0List_").show();
        $("#bc0List").hide();
        var lis = $('#bests li');
        for (var i = 0; i < 42; i++) if (i < r.length) {
            var x = r[i],
            l = lis[i],
            ih;
            if (x[0] > -1 && x[1] > -1 && x[2] == "name") ih = x[3].substr(0, x[0]) + "<span class=hot2>" + x[3].substr(x[0], x[1] - x[0] + 1) + "</span>" + x[3].substr(x[1] + 1);
            else ih = x[3];
            l.innerHTML = "<a href=" + x[4] + " title=" + x[3] + ">" + ih + "</a>";
        } else lis[i].innerHTML = '';
    },
    _crBtn: function() {
        var T = this;
        $(T.l).each(function(i) {
            if (!$(this).siblings("a[i]").length) $(this).append($("<A />").attr("i", i).html("[编辑]"))
        });
    },
    _bdEvts: function() {
        var T = this;
        if (!T.s) return;
        $(T.la).click(function() {
            T._edit(this);
            return false
        });
        $(T.la).each(function(i) {
            var l = $(this);
            if (!J.isLogin && i < 36) l.attr("class", "mybests-n");
            else l.attr("class", "mybests-e").attr("href", "#");
        });
    },
    __logout: function(app) {
        this._html();
        this._bdEvts();
    },
    __login: function(app) {
        this.__logout(app)
    },
    _edit: function(o) {
        var app = getIns("www"),
        T = this,
        i = o.getAttribute("i"),
        p = $(o).siblings("a:not([i])").eq(0),
        c = T.getCfg();
        var h1 = "您未登录，仅可对最后一行网址进行编辑。请先登录：",
        to = "http://www" + getDomain() + "/app/famous_edit.htm",
        title = "自定义网址",
        height = "220";
        if (!c[i]) c[i] = [];
        var ci = i < c.length ? c[i] : T._cfg[i];
        T.curItem = {
            id: i,
            data: (ci.length ? ($type(c[i][0]) == "array" ? c[i][0] : c[i]) : [p.text(), p[0].href, T._g(p[0].className)])
        };
        if (o.className == "mybests-e") {
            showWindow({
                infoType: "normal",
                title: "自定义网址",
                height: 220,
                width: 440,
                iframe: "/plugins/famous_edit.htm"
            });
        } else {
            showWindow({
                infoType: "normal",
                title: "登录",
                height: 320,
                width: 440,
                iframe: "/passport/i_login.htm?h1=" + euc(h1) + "&to=" + euc(to) + "&title=" + euc(title) + "&height=" + height
            });
        }
    },
    _cancel: function() {
        var T = this;
        T.s = 0;
        $(T.la).hide();
        $('#bc0Btn').show();
        $("#bc0Btn_").hide();
    },
    _html: function() {
        var T = this,
        app = getIns("www"),
        c = this.getCfg(),
        cl = c ? c.length: 0,
        tll = $(T.l).length,
        $tlk = $(T.lk);
        try {
            if (c && cl) {
                for (var x = cl; x--;) {
                    if (c[x] === undefined) c[x] = [];
                }
                app.__cfg["famous"] = c;
            }
            if (c && cl > 0 && cl <= tll) {
                for (var i = tll - cl; i--;) {
                    c.unshift([])
                }
                app.__cfg["famous"] = c;
            }
            if (c && cl) {
                for (var i = tll; i--;) {
                    _(i, $tlk)
                }
            }
        } catch(e) {}
        function _(j, l) {
            $(l[j]).nextAll("b,a:not([i])").remove();
            if (c[j].length) {
                if ($type(c[j][0]) == "array") {
                    _m(l[j], c[j][0]);
                    _(l[j]);
                    _m($(l[j]).nextAll("a:not([i])")[0], c[j][1])
                } else {
                    _m(l[j], c[j])
                }
            } else {
                if ($type(T._cfg[j][0]) == "array") {
                    _n(l[j], T._cfg[j][0]);
                    _(l[j]);
                    _n($(l[j]).nextAll("a:not([i])")[0], T._cfg[j][1]);
                } else {
                    _n(l[j], T._cfg[j])
                }
            }
            function _(lj) {
                $(lj).after("<b>•</b><a></a>");
            }
            function _m(lj, cj) {
                lj.innerHTML = cutStr(cj[0], 12);
                var _b = /^(http|https|ftp):\/\/{1}/i.test(cj[1]) ? cj[1] : "http:\/\/" + $.trim(cj[1]);
                lj.href = ' ' + _b;
                lj.className = T._fc[cj[2] === undefined ? 0 : cj[2]]
            }
            function cutStr(s, length, postfix) {
                if (typeof(s) != "string") return s;
                postfix = postfix ? postfix: "";
                if (!s || !length) {
                    return "";
                }
                var len = 0,
                temp = "";
                for (var i = 0; i < s.length; i++) {
                    if (s.charCodeAt(i) > 255) {
                        len += 2;
                    } else {
                        len++;
                    }
                    if (len > length) {
                        return temp + postfix;
                    }
                    temp += s.charAt(i);
                }
                if (s.length > length) {
                    return s.substr(0, length) + postfix;
                } else {
                    return s;
                }
            }
            function _n(lj, cj) {
                lj.innerHTML = cutStr(cj[0], 12);
                lj.href = ' ' + cj[1];
                lj.className = T._fc[cj[2] === undefined ? 0 : cj[2]]
            }
        }
    },
    _g: function(c) {
        if (!c) return 0;
        var T = this;
        for (var i = 0; i < T._fc.length; i++) {
            if (c === T._fc[i]) return i
        }
    },
    init: function() {
        var T = this,
        o, app = getIns("www").get("famous");
        app.__cfg = this.getCfg();
        $(T.lk).each(function(i) {
            o = $(this).nextAll("a:not([i])");
            if (o.length) {
                app._cfg[i] = [[this.innerHTML, this.href, T._g(this.className)], [o.html(), o[0].href, 0]];
            } else {
                app._cfg[i] = [this.innerHTML, this.href, T._g(this.className)];
            }
        });
        T._events();
    }
});
www.concat('search', {
    __cfg: [0, 0, 0, 2, 0, 0, 0],
    searchUrl: '',
    endWith: {
        '百度': '',
        'Google': '',
        '迅雷': '&id=1018524',
        '搜狗': '&pid=AQ9DA'
    },
    options: {
        '网页': {
            type: ['Google', '搜搜', '百度', '集成'],
            icon: [1, 0, 3],
            url: ['www.google.com.hk/search?q={K}&client=aff-1616dh&channel=1616', 'www.soso.com/q?ie=utf-8&cid=union.s.wh&unc=i400017&soso_u_sub=3&w={K}', 'www.baidu.com/s?ie=utf-8&wd={K}', 's.1616.net/?kw={K}'],
            select: 0
        },
        'MP3': {
            type: ['百度', '迅雷', 'Google', '搜狗'],
            icon: [0, 4, 1, 2],
            url: ['mp3.baidu.com/m?ie=utf-8&ct=134217728&word={K}', 'mp3.gougou.com/search?search={K}', 'www.google.cn/music/search?q={K}', 'mp3.sogou.com/music.so?ie=utf8&query={K}'],
            select: 0
        },
        '影视': {
            type: ['迅雷', '优酷'],
            icon: [4, 5],
            url: ['movie.gougou.com/search?search={K}', 'so.youku.com/search_video/q_{K}'],
            select: 0
        },
        '视频': {
            type: ['迅雷', 'Google', '百度'],
            icon: [4, 1, 0],
            url: ['video.gougou.com/search?s={K}', 'www.google.com.hk/search?q={K}&tbs=vid:1', 'video.baidu.com/v?ie=utf-8&word={K}'],
            select: 2
        },
        '图片': {
            type: ['百度', 'Google'],
            icon: [0, 1],
            url: ['image.baidu.com/i?ie=utf-8&ct=201326592&lm=-1&word={K}', 'www.google.com.hk/images?q={K}'],
            select: 0
        },
        '贴吧': {
            type: ['贴吧', '来吧'],
            icon: [0, 6],
            url: ['tieba.baidu.com/f?ie=utf-8&kw={K}', 'laiba.tianya.cn/searchGroup.jsp?isFromStock=false&searchType=0&nameOrStockCode={K}'],
            select: 0
        },
        '淘宝': {
            type: ['购物'],
            icon: [7],
            url: ['search8.taobao.com/browse/search_auction.htm?pid=mm_14072075_0_0&commend=all&search_type=auction&user_action=initiative&f=D9_5_1&at_topsearch=1&sort=&spercent=0&q={K}'],
            select: 0
        }
    },
    cur: function() {
        return $('#s-tl>.s-cur')
    },
    makeOptions: function(cfg, name) {
        if (name == '淘宝') {
            $('#sps').html('<a href="http://s.click.taobao.com/t_9?p=mm_14072075_2301441_8925197&l=http%3A%2F%2Fmall.taobao.com%2F">淘宝商城</a><a href="http://pindao.huoban.taobao.com/channel/onSale.htm?pid=mm_14072075_2301441_8925197">淘宝促销</a><a href="http://pindao.huoban.taobao.com/channel/lady.htm?pid=mm_14072075_2301441_8925197&mode=86">正品女装</a><a href="http://pindao.huoban.taobao.com/channel/beauty.htm?pid=mm_14072075_2301441_8925197&mode=86">护肤美容</a><a href="http://pindao.huoban.taobao.com/channel/digital.htm?pid=mm_14072075_2301441_8925197&mode=86">数码热卖</a>');
            return;
        }
        var htm = '',
        T = this;
        $.each(cfg.type,
        function(k, v) {
            htm += '<input type="radio" id="sp' + k + '" name="sp"><label for="sp' + k + '">' + v + '</label>'
        });
        $('#sps').html(htm);
    },
    mkSearchUrl: function(name) {
        var cfg = this.options[name],
        i = parseInt(cfg['select']);
        $('#sps input[type=radio]').eq(i).attr('checked', true);
        if (name === '网页' && i === 2) {
            cfg['select'] = 0;
            this.save();
        }
        if (cfg.url.length >= i + 1) {
            this.searchUrl = cfg.url[i] + (this.endWith[cfg.type[i]] || '');
        } else {
            this.searchUrl = cfg.url[0] + (this.endWith[cfg.type[0]] || '');
        }
        if (this.searchUrl.indexOf('taobao') != -1) {
            this.searchUrl = 'www.1616.net/s.php?type=taobao&q={K}'
        }
        if (this.searchUrl.indexOf('zhidao') != -1) {
            this.searchUrl = 'www.1616.net/s.php?type=zhidao&q={K}'
        }
    },
    save: function() {
        var cfg = this.__cfg = [];
        $.each(this.options,
        function(k, v) {
            cfg.push(~~v.select)
        });
        if (!J.isLogin) {
            cfg[0] = 0;
            setCookie('J1616_www_search', '[' + cfg.toString() + ']');
        } else {
            this.__save(cfg,
            function() {})
        }
    },
    fetch: function() {
        var opt = this.options,
        i = 0;
        var cfg = J.isLogin ? this.getCfg() : eval('(' + getCookie('J1616_www_search') + ')');
        if (cfg) {
            for (var p in opt) {
                opt[p]['select'] = cfg[i++]
            }
        }
        if (opt.网页.select >= 2) opt.网页.select = 0;
    },
    doSearch: function(v) {
        $('#kwh').hide();
        var timer;
        void
        function() {
            if ($('#kwh').css('display') == 'none') clearTimeout(timer);
            timer = setTimeout(arguments.callee, 100);
        } ();
        var t = this.searchUrl;
        if (!v) t = t.replace(/\/f\?/, '/?');
        var url = 'http://' + t.replace('{K}', euc(v));
        var ua = navigator.userAgent.toLowerCase();
        if (window.stat) {
            var st = this.cur().index() + 1;
            st = st == 7 ? 8 : st;
            stat.s16(3, ["st", st, 'sn', $('#sps input:checked[type=radio]').next("label").text()]);
            stat.s16(2, ['kw', v]);
        }
        if ($("#kwh td[_u=1]").length == 1 && $("#keyword").attr("_s") == 0) {
            if (/firefox/.test(ua)) {
                setTimeout(function() {
                    window.open(v);
                },
                500);
            } else {
                window.open(v);
            }
            $("#keyword").attr("_s", "-1")
        } else {
            if (/firefox/.test(ua)) {
                setTimeout(function() {
                    submit(url);
                },
                500);
            } else {
                submit(url);
            }
        }
        function submit(s) {
            if (!s.length) return;
            if (s.indexOf("?") == -1) {
                $("#search form").attr("action", s);
                $("#search_hidden").html("");
            } else {
                $("#search form").attr("action", s.substr(0, s.indexOf("?")));
                s = s.substr(s.indexOf("?") + 1);
                if (!s.length) return;
                s = s.split("&");
                var l = s.length,
                tmpArr, fields = "";
                for (var i = 0; i < l; i++) {
                    tmpArr = s[i].split("=");
                    fields += "<input type='hidden' name='" + tmpArr[0] + "' value='" + decodeURIComponent(tmpArr[1]).replace(/'/g, " ") + "' >";
                }
                $("#search_hidden").html(fields);
            }
            $("input[type=radio][name=sp]").attr("disabled", true);
            $("#keyword").attr("disabled", true);
            $("#search form").submit();
            $("input[type=radio][name=sp]").removeAttr("disabled");
            $("#keyword").removeAttr("disabled");
        }
    },
    init: function() {
        var T = this,
        lasttr = null,
        soMp3 = false;
        this.fetch();
        var curConfig, curName, kc;
        $('#s-tl>a').click(function() {
            if ($(this) === T.cur()) return;
            T.cur().removeClass('s-cur');
            $(this).addClass('s-cur');
            var name = $.trim($(this).html());
            soMp3 = name.toUpperCase() == 'MP3';
            curConfig = T.options[name];
            curName = name;
            T.makeOptions(T.options[name], name);
            T.mkSearchUrl(name);
        }).eq(0).click();
        $('#sps').delegate('input[type=radio]', 'click',
        function() {
            curConfig.select = $(this).attr('id').replace('sp', '');
            T.mkSearchUrl(curName);
            T.save();
        });
        $('#keyword').attr('_s', -1).focus().keyup(function(e) {
            kc = e.keyCode;
            if (!document.all && window.QQWebIME && window.QQWebIME.IS_OPEN) return;
            if ($.inArray(kc, [37, 38, 39, 40, 32]) != -1) {
                if (kc == 40 || kc == 38) {
                    var j = parseInt($(this).attr('_s')),
                    a = kc == 40 ? 1 : -1,
                    s = j + a,
                    len = $('#kwh>table tr').length;
                    s = s < -1 ? len - 1 : s > len - 1 ? -1 : s;
                    $(this).attr('_s', s);
                    var tr = $('#kwh>table tr').eq(s);
                    if (s != -1) {
                        tr.mouseover();
                        $(this).val(tr.find('td').attr('_h'));
                        lasttr && lasttr.mouseout();
                        lasttr = tr;
                    } else {
                        lasttr && lasttr.mouseout();
                        $(this).val(T.val);
                    }
                }
                return;
            }
            T.val = $.trim($(this).val());
            if (T.val == '') {
                $('#kwh').hide();
            } else {
                if (soMp3) $.getScript('http://suggest.mp3cn.net/song/?call=soMp3CallBack&type=songname&n=0,10&q=' + euc(T.val));
                else $.getScript('http://so.1616.net/wwwfirst/?q=' + euc(T.val));
            }
            $(this).attr('_s', -1);
        }).keypress(function(e) {
            if (e.keyCode == 13) {
                T.doSearch($.trim($(this).val()));
                return false;
            }
        });
        $('body').click(function() {
            $('#kwh').hide();
        });
        $('#s-btn').click(function() {
            T.doSearch($.trim($('#keyword').val()));
            return false;
        });
        window.wwwfirst_cb = function(data) {
            T.firstData = data;
            $('body').append("<script src='http://suggestion.baidu.com/su?p=3&cb=window.bdsug.sug&t=" + new Date().getTime() + "&wd=" + euc(T.val) + "&ie=utf-8'></script>");
        };
        window.bdsug = {
            sug: function(a) {
                if (!a || a.q != T.val || kc === 13) return;
                var ih = '';
                if (T.firstData.length == 2 && $.trim(T.firstData[0].split('|')[0]) == a.q) {
                    var f1 = T.firstData[1],
                    tt = f1[3];
                    if (f1[0] > -1) {
                        tt = f1[3].substr(0, f1[0]) + "<span class=kw-hi>" + f1[3].substr(f1[0], f1[1] - f1[0] + 1) + "</span>" + f1[3].substr(f1[1] + 1);
                    }
                    ih = "<tr style='cursor:hand'><td align=left _u=1 _h='" + f1[4] + "'><p>" + tt + "</p><p style='color:#888;height:16px;overflow:hidden' id='_detail'>" + f1[5] + "</p><p style='color:#090;'>" + f1[4] + "</p></td></tr>";
                }
                var b = a.s;
                if (b.length) for (var j = 0; j < b.length; j++) {
                    if (b[j].indexOf("hao123.") < 0 && b[j] != 'hao123' && b[j].indexOf("好123") < 0) ih += '<tr><td _h="' + b[j].replace(/\"/g, '') + '"><a>' + b[j] + '</a></td></tr>';
                }
                $('#kwh').html('<iframe frameborder="0"></iframe><table width="100%" cellpadding=0 cellspacing=1>' + ih + '</table>');
                $('#kwh')[['show', 'hide'][ + (ih.length == 0)]]();
                $('#kwh').find('iframe').height($('#kwh').height());
                bind();
            }
        };
        window.soMp3CallBack = function(d) {
            var k = $.trim($('#keyword').val());
            if (!k || k != d[0].split('|')[0]) return;
            var h = '';
            for (var i = 1; i < d.length; i++) {
                h += '<tr><td _h="' + d[i][4].replace(/\"/g, '') + ' ' + d[i][7].replace(/\"/g, '') + '"><a><span>' + d[i][7] + '</span> ' + d[i][4] + '</a></td></tr>';
            }
            $('#kwh').html('<table width="100%" cellpadding=0 cellspacing=1>' + h + '</table>');
            $('#kwh')[['show', 'hide'][ + (h.length == 0)]]();
            bind();
        }
        function bind() {
            $('#kwh tr').mouseover(function() {
                $(this).css('backgroundColor', '#88C4FF');
            }).mouseout(function() {
                $(this).css('backgroundColor', '#ECF5FF');
                lasttr = $(this);
            }).click(function() {
                var h = $(this).find('td').attr('_h');
                var u = $(this).find('td').attr('_u');
                var ua = navigator.userAgent.toLowerCase();
                if (u == 1) {
                    $("#keyword").attr("_s", 0);
                    window.stat && window.stat.s16(5, ['u', h]);
                }
                T.doSearch(h);
            })
        }
    }
});
var stat = (new
function() {
    this.createImg = function(src) {
        var img = $('<img />').attr('src', src);
        setTimeout(function() {
            delete img
        },
        100);
    };
    this.s16 = function(a, p) {
        var wp = ["act=" + a, "log=" + ( + J.isLogin), "uid=" + J16_INF.user];
        for (var i = 0; i < p.length; i += 2) {
            wp.push(p[i] + "=" + euc(p[i + 1]));
        }
        this.createImg("http://st.1616.net/s.php?" + wp.join("&"));
    };
    this.init = function(wrap, appname) {
        var T = this;
        $(wrap).mousedown(function(e) {
            e = e.target;
            var getAct = function(dom) {
                var attr = dom.getAttribute('s16');
                if (attr === null && dom.parentNode && dom.parentNode != (wrap.body || wrap)) {
                    attr = getAct(dom.parentNode);
                }
                return attr;
            };
            var atr = e.getAttribute && e.getAttribute('s16');
            if (atr && atr.match(/^#/)) {
                T.createImg("http://st.1616.net/s.php?" + atr.replace('#', ''));
                return;
            }
            if (e.tagName == 'FONT' || e.tagName == 'IMG') e = e.parentNode;
            if (e.tagName == 'A') {
                var pn = getAct(e);
                if (!appname) {
                    var appid = e.parentNode.getAttribute('appid');
                    if (appid !== null) {
                        T.s16(12, ['app', e.parentNode.id.replace('app_', ''), 'appid', appid, 'referer', __REFERER__]);
                    }
                    if (pn !== null) {
                        T.s16(1, ['pn', pn, 'u', e.href, 't', $(e).text().replace(/ /g, '')]);
                    }
                } else {}
            }
        });
        return this;
    };
}).init(document);
$(window).load(function() {
    $("<link id='alertstyle' rel='stylesheet' href='http://r.9533.com/iplatform/img/tc.css' />").appendTo($('head'));
});
var J = new Main();
function getIns(name) {
    return J.apps[name] || null;
}
function testSpeed(url, debug) {
    if (Math.random() < .1 || debug) {
        var time = +new Date;
        var domain = url.match(/http:\/\/(.*?)\//)[1];
        $('<img />').attr('src', url).load(function() {
            time = ( + new Date) - time;
            $.getScript('http://st.1616.net/get_clientinfo.php?lt=' + time + '&cip=&dm=' + domain);
        });
    }
}
testSpeed('http://r.9533.com/iplatform/img/speed_test.gif');
testSpeed('http://www.1616.net/jd/img/speed_test.gif');
testSpeed('http://i.9533.com/img/speed_test.gif');
var Weather = {
    init: function() {
        this.events();
    },
    _getWeather: function(city, dis) {
        var weatherFile = city == dis ? city: city + dis;
        $.get('/grab/weather/' + euc(euc(weatherFile)) + '.htm',
        function(html) {
            $('#weather_sl')[0].innerHTML = html;
            $('#wt_head')[0].innerHTML = dis + '7日天气';
        });
    },
    events: function() {
        $('#wt-city').live('click',
        function() {
            var ifr = $('#ifweather');
            if (ifr.attr('src') == 'about:blank') {
                ifr.attr('src', 'about:blank');
                ifr.attr('src', '/plugins/set_city.htm');
            }
            ifr.show();
            return false;
        });
    }
};
www.concat('weather', Weather);
var lunar = J16.util.lunar;
var Timer = J16.Class.extend({
    showDate: function(d) {
        var self = this,
        h = [d.getFullYear() + '年' + (d.getMonth() + 1) + '月' + d.getDate() + '日', lunar(d)[1] + lunar(d)[2], '星期' + '日一二三四五六'.charAt(d.getDay())].join('&nbsp;&nbsp;');
        $('#clock_date').html(h);
    }
});
var Clock = J16.Class.extend({
    init: function() {
        this.hmbg = ['0px -290px', '0px 0px', '-1px -33px', '-1px -65px', '-1px -96px', '-1px -129px', '-3px -161px', '-2px -192px', '-2px -225px', '0px -257px'];
        this.scbg = ['-9px -610px', '-9px -322px', '-9px -354px', '-10px -386px', '-9px -418px', '-10px -450px', '-9px -482px', '-11px -514px', '-9px -546px', '-10px -578px'];
        $('#sl_clock_num').click(function(e) {
            new Alarm().showWindow();
            return false;
        });
        this.runClock();
    },
    format: function(s) {
        return ('0' + s).slice( - 2).split('');
    },
    changeTime: function(s) {
        for (var i = 0,
        len = s.length; i < len; i++) {
            $('#' + s[i][0]).css('backgroundPosition', s[i][1]);
        }
    },
    runClock: function() {
        var self = this,
        f = self.format,
        b = self.hmbg,
        c = self.scbg,
        it = document.createElement('img'),
        t = __TIME__ * 1000,
        d = new Date();
        d.setTime(t);
        it.onload = function() {
            it.loaded = 1;
            $('#sl_clock').css('background', 'url(' + it.src + ') no-repeat');
        };
        it.onerror = function() {
            it.loaded = 1;
        };
        var count = 0;
        var diff = ( + d) - t; (function() {
            if (++count > 60 * 10) {
                t = ( + new Date) - diff;
                count = 0;
            } else {
                t += 1000;
            }
            d.setTime(t);
            var _h = d.getHours() - 0,
            _m = d.getMinutes() - 0,
            _s = d.getSeconds() - 0,
            h = f(_h),
            m = f(_m),
            s = f(_s),
            cl = '';
            self.changeTime([['d0', b[h[0]]], ['d1', b[h[1]]], ['d2', b[m[0]]], ['d3', b[m[1]]], ['d4', c[s[0]]], ['d5', c[s[1]]]]); (_h + _m + _s == 0) && new Timer().showDate(d);
            if (lunar(d)[7]) {
                it.loaded || (it.src = 'http://r.9533.com/style/others/jieqi_myhome/' + lunar(d)[7] + '.png');
            } else {
                var sl = $('#sl_clock');
                var curImg = ['l', 'm', 'a', 'n'][Math.floor(_h / 6)];
                var curBg = 'http://r.9533.com/iplatform/img/clockbg_' + curImg + '.png?1';
                if (sl.data('ci') != curImg) {
                    sl[0].style.cssText = '';
                    sl.css('background', 'url(' + curBg + ') no-repeat');
                    sl.data('ci', curImg);
                }
            }
            window.Notice && Notice.check(d);
            setTimeout(arguments.callee, 1000);
        })();
    }
});
var Alarm = J16.Class.extend({
    init: function() {
        this.events();
        this.checkAlarm();
    },
    showWindow: function() {
        showWindow({
            title: '设置闹钟',
            height: 400,
            width: 455,
            iframe: '/plugins/clock.htm',
            opacity: 0,
            onclose: function() {
                $($('#alert1616_content iframe')[0].contentWindow.$('bgs')).remove();
            }
        });
    },
    events: function() {
        var self = this;
        $('#alarm, #c_wrap').click(function() {
            self.showWindow();
            return false;
        });
    },
    checkAlarm: function() { (function() {
            var al = getCookie('alert'),
            next_alert = null,
            next_content = '';
            if (al) {
                var alf = al.split('$'),
                d = new Date(),
                today = [d.getFullYear(), d.getMonth(), d.getDay()].join("-"),
                now = d.getHours() * 60 + d.getMinutes();
                for (var i = 0; i < alf.length; i++) {
                    var alt = alf[i].split("|"),
                    hm = alt[0].split(':'),
                    _n = parseInt(hm[0]) * 60 + parseInt(hm[1]);
                    if (alt[3] == 'undone') {
                        alt[3] = alt[4] = "";
                    }
                    if (_n <= now && alt[4] != today) {
                        al = '';
                        for (var j = 0; j < alf.length; j++) if (i == j) {
                            if (alt[3] != '') {
                                alt[4] = today;
                                al += (al.length ? "$": "") + alt.join("|");
                            }
                        } else al += (al.length ? "$": "") + alf[j];
                        if (al.length) setCookie('alert', al);
                        else setCookie('alert', '', -1);
                        var bgs = $('<bgsound />').attr('src', '/mid/' + alt[1] + '.mid');
                        $('body').append(bgs);
                        hm[0] = hm[0].length == 1 ? "0" + hm[0] : hm[0];
                        hm[1] = hm[1].length == 1 ? "0" + hm[1] : hm[1];
                        alert((_n != now ? "过期闹钟": "闹钟提醒") + "：“" + hm[0] + ":" + hm[1] + " " + ((alt[2].length) ? alt[2] : "您设置的闹钟时间已到!") + "”");
                        bgs.remove();
                        break;
                    }
                }
                var near = 9999,
                alf = al.split('$');
                for (var i = 0; i < alf.length; i++) {
                    var hm = alf[i].split("|")[0].split(":"),
                    con = alf[i].split("|")[2];
                    var t = parseInt(hm[0]) * 60 + parseInt(hm[1]);
                    if (t <= now) t += 1440;
                    if (t < near) {
                        near = t;
                        next_alert = hm[0] + ':' + ('00' + hm[1]).slice( - 2);
                        next_content = next_alert + ' ' + con;
                    }
                }
            }
            if (next_alert) $('#clockhint').attr("title", '您的下次闹钟提醒时间：' + next_alert);
            $('#c_con').text(next_content === '' ? '您还没有设置闹钟': next_content);
            setTimeout(arguments.callee, 1000);
        })();
    }
});
new Timer().showDate(new Date(__TIME__ * 1000));
var clock = new Clock();
new Alarm();
var Notice = {
    remindObj: null,
    remindArr: null,
    turn: 6000,
    timer: null,
    timer2: null,
    init: function() {
        if (!J16_INF.notice_remind) return;
        this.remindObj = J16_INF.notice_remind;
    },
    display: function(arr) {
        var html = [],
        _this = this;
        $.each(arr,
        function(i, v) {
            html.push('<div>' + this._content + '</div>');
        });
        function randomsort(a, b) {
            return Math.random() > .5 ? -1 : 1;
        }
        html.sort(randomsort);
        $('#best-sc-r').empty().html(html.join(''));
        clearTimeout(this.timer);
        this.timer = setTimeout(function() {
            _this._scrollV($('#best-sc-r'));
        },
        this.turn);
    },
    check: function(date) {
        this.filter(date, this.remindObj);
        var miniute = date.getMinutes();
        if (miniute == 0 || miniute == 30 || !arguments.callee.hasRun) {
            if (miniute == 0 || miniute == 30) {
                var second = date.getSeconds();
                if (second == 59) {
                    this.display(this._getArrNow(date));
                }
            } else {
                arguments.callee.hasRun = true;
                this.display(this._getArrNow(date));
            }
        }
    },
    filter: function(date) {
        if (this.remindArr) return;
        var arr = [],
        _day = date.getDay(),
        now = Date.parse([date.getMonth() + 1, date.getDate(), date.getFullYear()].join('/'));
        $.each(this.remindObj,
        function() {
            if (this._date.indexOf('-') == -1) {
                if (this._date.indexOf(_day) !== -1) arr.push(this);
            } else {
                var d = this._date.replace(/(\d\d\d\d)-(\d\d)-(\d\d)/g, "$2/$3/$1").split(',');
                d[0] = Date.parse(d[0]);
                d[1] = Date.parse(d[1]);
                if (d[0] <= now && now <= d[1]) {
                    arr.push(this);
                }
            }
        });
        this.remindArr = arr;
    },
    _getArrNow: function(date) {
        var hour = date.getHours() + ':' + date.getMinutes(),
        array = [],
        count = function(str) {
            str = str.split(':');
            return parseInt(str[0] * 60) + parseInt(str[1]);
        };
        $.each(this.remindArr,
        function() {
            var time = this._time.split(',');
            var t1 = count(time[0]),
            t2 = count(time[1]),
            h = count(hour);
            if (t1 <= h && h < t2) {
                array.push(this);
            }
        });
        return array;
    },
    _scrollV: function(wrap) {
        var _this = this,
        interval = this.turn;
        clearTimeout(_this.timer2);
        function run() {
            clearTimeout(_this.timer2);
            _this.timer2 = setTimeout(run, interval);
            var divs = wrap[0].getElementsByTagName('div'),
            div = divs[0];
            if (divs.length == 1) return;
            var rand = Math.round(Math.random() * divs.length);
            var nextOne = divs[rand];
            if (rand > 1) $(div).after(nextOne);
            $(div).slideUp(function() {
                $(this).appendTo(wrap).show()
            });
        }
        wrap.hover(function() {
            clearTimeout(_this.timer2);
        },
        function() {
            _this.timer2 = setTimeout(run, interval);
        });
        run();
    }
}
Notice.init();
var onLine = function() {
    var url = 'http://www.1616.net/online_count.php',
    urlmap = {
        "新闻": 'news',
        "网盘": 'disk',
        "音乐": 'music',
        "记事本": 'notebook',
        "备忘录": 'memo',
        "团购": 'tuangou',
        "电台": 'radio',
        "影视": 'video'
    },
    pad = function(a, b) {
        return Math.random() * Math.abs(b - a);
    },
    turn = 6000,
    timer;
    return {
        init: function() {
            var _this = this;
            $(function() {
                J16.io.get(url,
                function(e) {
                    _this.parse(e);
                });
            });
        },
        parse: function(data) {
            var html = '<div class="setnavb"></div>';
            for (var p in data) {
                var str = '<a href="http://www.1616.net/?{URL}" target="_self">此刻，1616网友中<br>{NUM}人在用{APP}</a>';
                str = str.replace('{NUM}', Math.ceil(data[p])).replace('{APP}', p).replace('{URL}', urlmap[p]);
                html += str;
            }
            html += '<div class="setnavb"></div>';
            html = html.replace('用新闻', '看新闻').replace('用音乐', '听音乐').replace('用电台', '听电台').replace('用影视', '看影视') $('#app_onlinenum').html(html).children('a').hide().eq(0).show();
            this.run();
        },
        run: function() {
            function show() {
                clearTimeout(timer);
                timer = setTimeout(show, turn);
                $('#app_onlinenum>a').eq(0).fadeOut(function() {
                    $(this).next().fadeIn();
                    $('#app_onlinenum>div:last').before(this);
                });
            }
            $('#app_onlinenum').mouseenter(function() {
                clearTimeout(timer);
            }).mouseleave(function() {
                timer = setTimeout(show, turn);
            });
            setTimeout(show, turn);
        }
    }
} ();
onLine.init();
var appnews = {
    init: function() {
        var links = $('#news_sl>h3>span>a');
        var lists = $('ul.slbox>li');
        var _timer;
        links.mouseover(function() {
            var i = parseInt(this.innerHTML - 1),
            _this = this;
            _timer = setTimeout(function() {
                links.removeClass('news_sl_on') _this.className = 'news_sl_on'lists.hide();
                for (var j = i * 3; j < i * 3 + 3; j++) {
                    lists.eq(j).show();
                }
            },
            300)
        }).mouseout(function() {
            clearTimeout(_timer);
        }).click(function() {
            return false;
        })
    }
};
appnews.init();