/*Email部分*/
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/',
			'189': 'http://mail.189.cn/'
        };
        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":
			  window.open("http://reg.163.com/CheckUser.jsp?url=http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&username="+u+"&password="+p);	
			  return false;
/*//            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":
			  window.open("http://reg.163.com/CheckUser.jsp?url=http://entry.mail.126.com/cgi/ntesdoor?hid=10010102&lightweight=1&verifycookie=1&language=0&style=-1&product=mail126&type=1&username="+u+"@126.com"+"&password="+p);
			  return false;			  
/*//            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":
			  window.open("http://reg.163.com/CheckUser.jsp?url=http://entry.mail.yeah.net/coremail/fcg/ntesdoor2?lightweight=1&username="+u+"@yeah.net"+"&password="+p);
			  return false;
/*//            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;
        });
    }
});

/*换肤部分*/
www.concat('theme', {
    hasLoaded: false,
    events: function() {
		/*爱摆网增加：www.i8dh.com*/
		var theme_c=J16.util.cookie.get('qttheme');
		if(theme_c!=null){
			$('#theme_css').attr('href', theme_c ? ''+G_dirUrl+'images/iplatform/theme/' + theme_c + '/css.css': 'about:blank');
		}else{
			if(gobal_pifu!="")
				$('#theme_css').attr('href', ''+G_dirUrl+'images/iplatform/theme/'+gobal_pifu+'/css.css');	
		}
        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(G_waibu+G_JIN_TAI_PageOne+'_sys_theme.html', '',
        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);
			html=html.replace("{nextpage}","下一页").replace("{prepage}","上一页").replace("{page}","页").replace("{submit}","确定").replace("{skintype}","皮肤分类：").replace("{quxiao}","取消").replace("{moren}","恢复默认")
            $('#theme_layer').html(html);
            $('head').append(css).append(js);
            T.hasLoaded = true;
            setTimeout(fn, 100);
        })
    },
    init: function() {
        this.events();
    }
});

/*闹钟部分*/
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 = G_dirUrl+'images/jieqi_myhome/' + lunar(d)[7] + '.png');
            } else {
                var sl = $('#sl_clock');
                var curImg = ['l', 'm', 'a', 'n'][Math.floor(_h / 6)];
                var curBg = G_dirUrl+'images/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: my_nz,
            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', G_dirUrl+'images/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();


/*名站导航部分*/
www.concat('search', {
    __cfg: [0, 0, 0, 2, 0, 0, 0,0],
    searchUrl: '',
    endWith: {
        '百度': '',
        'Google': '',
        '迅雷': '&id='+G_lm_xunlei,
        '搜狗': ''
    },
    options: {
        '网页': {
            type: ['百度','Google','搜狗','搜搜','有道','狗狗','站内'],
            icon: [1, 0, 3],
            url: [ 'www.baidu.com/s?wd={K}&tn='+G_lm_baidu,'www.google.com.hk/cse?q={K}&cx='+G_lm_google_s+'','www.sogou.com/sogou?query={K}&pid='+G_lm_sogou_s,'www.soso.com/q?w={K}','www.youdao.com/search?q={K}','www.gougou.com/search?search={K}',G_waibu+'search.asp?key={K}'],
            select: 0
        },
        'MP3': {
            type: ['百度', '迅雷', 'Google', '搜狗'],
            icon: [0, 4, 1, 2],
            url: ['mp3.baidu.com/m?ie=gb2312&ct=134217728&word={K}', 'mp3.gougou.com/search?search={K}', 'www.google.cn/music/search?q={K}&ie=gbk', 'mp3.sogou.com/music.so?ie=gbk&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=gb2312&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=gb2312&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='+G_lm_taobao2+'&commend=all&search_type=auction&user_action=initiative&f=D9_5_1&at_topsearch=1&sort=&spercent=0&q={K}'],
            select: 0
        },
        "地图": {
            type: ["Google", "百度", "搜狗"],
            icon: [1, 0, 2],
            url: ["ditu.google.cn/maps?q={K}", "map.baidu.com/?newmap=1&ie=gb2312&s=s%26wd%3D{K}", "map.sogou.com/?search-radio=on&lq={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='+G_lm_taobao2+'&l=http%3A%2F%2Fmall.taobao.com%2F">淘宝商城</a><a href="http://pindao.huoban.taobao.com/channel/onSale.htm?pid='+G_lm_taobao2+'">淘宝促销</a><a href="http://pindao.huoban.taobao.com/channel/lady.htm?pid='+G_lm_taobao2+'&mode=86">正品女装</a><a href="http://pindao.huoban.taobao.com/channel/beauty.htm?pid='+G_lm_taobao2+'&mode=86">护肤美容</a><a href="http://pindao.huoban.taobao.com/channel/digital.htm?pid='+G_lm_taobao2+'&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\?/, '/?');
		if(t.indexOf("search.asp")==-1){
        	var url = 'http://' + t.replace('{K}', euc(v));
		}else{
			var url = 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));*/
				
               www_second_cb(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=gb2312'></script>");
        };
        function www_second_cb(data) {
			T.firstData = data+"|0";
            $('body').append("<script src='http://suggestion.baidu.com/su?p=3&cb=window.bdsug.sug&t=" + new Date().getTime() + "&wd=" + data + "&ie=gb2312'></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);
            })
        }
    }
});





/*我的网址 2011.05.12爱摆网修改*/
function q$(id){return document.getElementById(id)}

/*滚动新闻 2011.05.23*/
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();

//新功能---移动显示子类
void function($) {
    var tmid_show = 0;
    var tmid_hide = 0;
    var timeout_show = 300;
    var timeout_hide = 250;
    var dataCache = {};
    var xhr, cura;
    var divid = 'sites-ab';
    function htmlEncode(s) {
        return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
    }
	function UnicodeToAscii(v) { 
		var pstr="";
		var code = v.match(/&#(\d+);/g);
		if (code == null) { 
			return ""; 
		}
		for (var i=0; i<code.length; i++)
		pstr += String.fromCharCode(code[i].replace(/[&#;]/g, ''));
		return pstr;
	}
    var mouseon = false;
    function keepShow() {
        clearTimeout(tmid_hide);
    }
    function _show(a, data) {
        clearTimeout(tmid_hide);
        var h = $(cura = a).parents('h2');
        hide(1);
        var s = '<div id=' + divid + ' style="display:none" s16="网址推荐"><div class=sites-ab-em></div><ul>';
        for (var i = 0; i < 11; i++) s += '<li><a href="' + data[i].url + '">' + data[i].name + '</a></li>';
        s += '<li><a href="' + htmlEncode(a.href) + '" class="sites-ab-more" target=_self>更多</a></li>';
        h.after(s + '</ul><div class="site-ab-b"></div></div>');
        var d = h.next().fadeIn(150);
        d.mouseover(keepShow).mouseout(delayHide);
        a.style.color = 'red';
        var aa = $(a);
        var left = aa.position().left;		
        var width = aa.width();
        d.find('div').eq(0).css({
            margin: '0',
            marginLeft: left + (width / 2)
        });
    }
    function show(a) {
        var h = $(a).parents('h2');
//        var s = /\w+(?=\.\w+$)/.exec(a.href);
//        if (!s) s = /\w+(?=\.)/.exec(a.href);		
//        if (s) s = s[0];
//        else return;
        var s = a.getAttribute("qtid");
        if(!s)return;				
        if (dataCache[s]) {
            _show(a, dataCache[s]);
        } else {
            //var url = 'http://www.1616.net/jd/t/' + s + '.json';
			var url=G_waibu+G_JIN_TAI_PageOne+"_type2"+s+".js";
			//url="/new/s/e_type22.js"
			//var url=G_dirUrl+"images/layout/js_bak/nba.js"
            xhr = $.get(url,
            function(r) {
                try {
                    _show(a, dataCache[s] = eval('0,' + r));
                } catch(e) {}
            });
        }
    }
    function hide(b) {
        var d = $('#' + divid);
        if (d.length) b ? d.remove() : d.fadeOut(100);
        if (cura) cura.style.color = '';
    }
    function abortShow() {
        if (xhr && xhr.readyState != 4) xhr.abort();
        delayHide();
    }
    function delayHide() {
        clearTimeout(tmid_hide);
        tmid_hide = setTimeout(hide, timeout_hide);
    }
    function Show(a) {
        return function() {
            show(a);
        };
    }
    $('#sites-r').find('h2 em a').mouseover(function() {
        tmid_show = setTimeout(Show(this), timeout_show);
    }).mouseout(function() {
        clearTimeout(tmid_show);
        abortShow();
    });
} ($);	



void function() {
    var lunar = J16.util.lunar;
    function $id(s) {
        return document.getElementById(s);
    }
    var timeDiff = +new Date - parent.__TIME__ * 1000;
    function showDate(d) {
        var lu = lunar(d);
        var s = [(d.getMonth() + 1) + '月' + d.getDate() + '日', '周' + '日一二三四五六'.charAt(d.getDay()), lu[1] + lu[2]].join('&nbsp;&nbsp;');
        $id('clock_date2').innerHTML = s;
    }
    function showTime() {
        var d = new Date;
        d.setTime(d.getTime() - timeDiff);
        var s1 = ('0' + d.getHours()).slice( - 2);
        var s2 = ('0' + d.getMinutes()).slice( - 2);
        var el = $id('clock_time2');
        el.innerHTML = s1 + ':' + s2;
        setTimeout(function() {
            el.innerHTML = s1 + ' ' + s2;
        },
        500);
        setTimeout(showTime, 1000);
    }
    showDate(new Date);
    showTime();
    $id('divclock').style.display = '';
} ();


//用户退出
function d_l_out(){
	
	qTcms.Ajax(G_waibu+"Members/regok.asp?action=out&Back_url=noback&m="+new Date().getTime(),function(d){
		var c=d.responseText;
		if(c!=""){

			f_bc0List_2();
			if(q$("bc0Btn").style.display=="none")
			f_bc0List2();
			
			q$("log1").style.display=document.getElementById("log2").style.display="none";
			q$("log1").style.display="block";
		}
	})	
	qTcms.Cookie.set(G_u_Cookies,"")
	window.location.reload();
}
//名站导航=============
function qTcms_p_callback(json){
		var uu=json.desc;
        switch (json.code) {
        case 1:
			if(!uu.match(/^[A-Za-z0-9_\u4E00-\u9fa5]+$/gi)){uu="您好"	}
            q$("p_skin_login_2").innerHTML=""+uu+",";
            break;
        case 0:
            break;
        }		
}
var d_pkstr="";
function d_ok(n){
	//n=0.只需要登陆 n=1。需要切换到编辑
	var uu=qTcms.Cookie.get3(qTcms.Cookie.get(G_u_Cookies),"soojs_u");
	if(uu!=""){
		var uup=qTcms.Cookie.get2("soojsu2");
		
		if(uup!=null)uu=uup;
		if(!uu.match(/^[A-Za-z0-9_\u4E00-\u9fa5]+$/gi)){uu="您好"	}
		q$("log1").style.display=document.getElementById("log2").style.display="none";
		q$("log2").style.display="";
		q$("p_skin_login_2").innerHTML=""+uu+",";
		q$("p_skin_login_2").href="javascript:User_members()";
		q$("p_skin_reg_2").innerHTML="退出";
		q$("p_skin_reg_2").href="javascript:d_l_out()";		
		$.getScript(G_waibu+"Ztool/p/Ajax_value.asp?v=1616_jj_4&t="+new Date().getTime());
	}	
	
	qTcms.AjaxPost(G_waibu+"Ztool/p/Ajax_value.asp","v=mingzhan3_2&m="+new Date().getTime(),function(d){
		var c=d.responseText;
		if(c!=""){
			var mkstr=q$("bc0List");
			var cc=""
			var ca=c.split("{|}");
			var ccc="";
			var kki=0;
			for (var i=0;i<ca.length-1;i++){
				if(i<36){
					var c1=ca[i];
					var c_1_a=c1.split("##");
					var c_href=c_1_a[0];
					var c_name=c_1_a[1];
					var c_color=c_1_a[2];
					var c_id=parseInt(500+i);	
					if(i==0&&c_name=="自定义网址"){
						ccc="1"	
					}else{
						if(c_href!=""&&c_name!=""){
							var c_str='<li id="'+c_id+'"><a href="'+c_href+'" id="h_'+c_id+'" class="'+c_color+'">'+c_name+'</a></li>';
							cc+=c_str;
							kki++;
						}
					}
				}
			}
			
			var vi=0,vstr="";
//			for(var mi=kki;mi<48;mi++){
//				c_id=parseInt(500+mi);
//				c_href=mkstr.getElementsByTagName("li")[vi].href;
//				c_name=mkstr.getElementsByTagName("li")[vi].innerHTML;
//				vstr+='<li id="'+c_id+'"><a href="'+c_href+'" id="h_'+c_id+'">'+c_name+'</a></li>';
//				vi++;
//			}
//			cc=vstr+cc;
			if(cc!=""&&ccc!="1"){
				cc2='<li id="li_gu"><a href="http://www.baidu.com/" class="" id="li_a">百度</a><b>·</b><a href="http://tieba.baidu.com/index.html" class="" id="li_a">贴吧</a></li>'
				cc2+='<li id="li_gu"><a href="http://www.sina.com.cn/" class="" id="li_a">新浪</a><b>·</b><a href="http://weibo.com/" class="" id="li_a">微博</a></li>'
				cc2+='<li id="li_gu"><a href="http://www.qq.com/" class="" id="li_a">腾讯</a><b>·</b><a href="http://qzone.qq.com/" class="" id="li_a">空间</a></li>'
				cc2+='<li id="li_gu"><a href="http://www.163.com/" class="" id="li_a">网易</a><b>·</b><a href="http://email.163.com/" class="" id="li_a">邮箱</a></li>'
				cc2+='<li id="li_gu"><a href="http://www.sohu.com/" class="" id="li_a">搜狐</a><b>·</b><a href="http://tv.sohu.com/" class="" id="li_a">视频</a></li>'
				cc2+='<li id="li_gu"><a href="http://www.yahoo.com.cn/" class="" id="li_a">雅虎</a><b>·</b><a href="http://mail.cn.yahoo.com/" class="" id="li_a">邮箱</a></li>'
				cc=cc2+cc
				q$("bc0List").innerHTML=cc;
			}
			d_pkstr="1";
		}
		if(n=="1"){
			f_bc0List();				
		}			
	});

}



var soojs_id=qTcms.Cookie.get3(qTcms.Cookie.get(G_u_Cookies),"soojs_id");
if(soojs_id==null) 
	soojs_id=0;
else
	if(soojs_id=="")
		soojs_id=0
	else
		d_ok(0)


if(soojs_id>0){
	var qtcms_login={
			isLogin:true
		}
}else{
	var qtcms_login={
			isLogin:false
		};	
}

if(soojs_id>0){
	//if(document.domain.indexOf("145.com")==-1) window.location.href="&#104;&#116;&#116;&#112;&#58;&#47;&#47;&#100;&#104;&#46;&#113;&#116;&#99;&#109;&#115;&#46;&#110;&#101;&#116;";
	/*左侧菜单是否显示*/
	qTcms.AjaxPost(G_dirUrl+"images/manager/Ajax_value.asp","callback=cbgetaddedlist&m="+new Date().getTime(),function(d){
		var c=d.responseText;
		if(c!=""){
			pstr='<li id="app_www" appid="5" mode="1" ver="1.0.1" class="nav-t cur"><a href="#index" target="_self"><em class="ni-home" style="background-position:0px -88px;"></em>首页<b></b></a></li>';
			c_a=c.split(",");
			var tabs = $('#nav>li');
			tabs.each(function() {
				if($(this).attr("id")!="app_www"){
					sFlag=true	;
					for(var k=0;k<c_a.length;k++){
						if(parseInt($(this).attr("appid"))==parseInt(c_a[k])){
							sFlag=false;	
						}
					}
					if(sFlag){
						$(this).remove(); 
					}
				}
			});		
	//		qTcms.Dom.get("app_www").style.display="";
	//		for(j=0;j<c_a.length;j++){
	//			var m1=c_a[j];
	//			if(m1=="12"){
	//				pstr+='<li id="app_tools" appid="12" mode="1" ver="1.0.0" newflag="0" desc="常用查询工具大全。含手机号码归属地、列车时刻、交通违章、IP地址、机票酒店预订等。"><a href="#tools" target="_self"><em class=ni-home style="background-position:0px -242px;"></em>工具箱<b></b></a></li>';		
	//			}else if(m1=="8"){
	//				pstr+='<li id="app_news" appid="8" mode="1" ver="1.0.0" newflag="0" desc="国内外新闻要闻，实时更新。"><a href="#news" target="_self"><em class=ni-home style="background-position:0px -154px;"></em>新闻<b></b></a></li>';		
	//			}else if(m1=="3"){
	//				pstr+='<li id="app_favorite" appid="3" mode="1" ver="1.0.0" newflag="0" desc="在线网络收藏夹，无论身在何处，都能轻松使用。" appurl="'+G_waibu+'app_favorite/"><a href="#favorite" target="_self"><em class=ni-home style="background-position:0px -44px;"></em>收藏夹<b></b></a></li>';		
	//			}else if(m1=="13"){
	//				pstr+='<li id="app_tuangou" appid="13" mode="1" ver="1.0.0" newflag="0" desc="团团团！团购网址导航，今天你团了吗？"><a href="#tuangou" target="_self"><em class=ni-home style="background-position:0px -264px;"></em>团购&nbsp;&nbsp;<sup>New!</sup><b></b></a></li>';		
	//			}else if(m1=="10"){
	//				pstr+='<li id="app_stock" appid="10" mode="1" ver="1.0.0" newflag="0" desc="实时股票、基金行情。可自定义股票、基金，并查看当前价格。"><a href="#stock" target="_self"><em class=ni-home style="background-position:0px -198px;"></em>股票<b></b></a></li>';		
	//			}else if(m1=="18"){
	//				pstr+='<li id="app_radio" appid="18" mode="1" ver="1.0.0" newflag="0" desc="网上最大最全的广播电台，600多个在线广播任你听!"><a href="#radio" target="_self"><em class=ni-home style="background-position:0px -374px;"></em>电台<b></b></a></li>';		
	//			}else if(m1=="9"){
	//				pstr+='<li id="app_notebook2" appid="9" mode="1" ver="1.0.0" newflag="0" desc="在线记事本。赶快抛弃便签纸吧，体验在线记事给您带来的便捷与高效。"><a href="#notebook2" target="_self"><em class=ni-home style="background-position:0px -176px;"></em>记事本<b></b></a></li>';		
	//			}else if(m1=="16"){
	//				pstr+='<li id="app_caipiao" appid="16" mode="1" ver="1.0.0" newflag="0" desc="彩票开奖信息及在线购买彩票。"><a href="#caipiao" target="_self"><em class=ni-home style="background-position:0px -330px;"></em>彩票<b></b></a></li>';		
	//			}else if(m1=="14"){
	//				pstr+='<li id="app_softwares" appid="14" mode="1" ver="1.0.0" newflag="0" desc="电脑装机必备软件、智能手机常用软件推荐。" _h="158"><a href="#softwares" target="_self"><em class=ni-home style="background-position:0px -286px;"></em>软件<b></b></a></li>';		
	//			}
	//		}
	//		if(pstr!=''){
	//			//qTcms.Dom.get("nav").innerHTML=pstr;	
	//		}
		}		
	});
}



//已登录
function kk_y(id,m1,m2){
	var mm1,mm2,mm3
	mm1=q$("h_"+id).innerHTML;
	mm2=q$("h_"+id).href;
	mm3=q$("h_"+id).className
	DvWnd.open("自定义网址",qtCms_m1+"?id="+id+"&m1="+escape(mm1)+"&m2="+escape(mm2)+"&m3="+escape(mm3),400,200,1)	
}
function f_bc0List(){
	var list3 = q$("bc0List").getElementsByTagName("li");
	for(var ii=0;ii<list3.length;ii++){
		if(list3[ii].id!="li_gu"){
			var s1=	list3[ii].innerHTML;
			var s1_id="h_"+list3[ii].id;
			var m1=q$(s1_id).innerHTML;
			var m2=q$(s1_id).href;
			list3[ii].innerHTML=s1+"<a class=\"mybests-e\" onclick=\"kk_y("+list3[ii].id+",'"+m1+"','"+m2+"')\">[编辑]</a>";
		}
	}		
	var uu=qTcms.Cookie.get3(qTcms.Cookie.get(G_u_Cookies),"soojs_u");
	var s2="";
}
//未登录
function kk_n(){
	User_login();
}
function f_bc0List2(){
	var list3 = q$("bc0List").getElementsByTagName("li");
	for(var ii=0;ii<list3.length;ii++){
		if(list3[ii].id!="li_gu"){
			var s1=	list3[ii].innerHTML;
			list3[ii].innerHTML=s1+'<a class=mybests-n onclick="kk_n()">[编辑]</a>';
		}
	}		
}

//原始的，去掉编辑,未登录
function f_bc0List_2(){
	var list3 = q$("bc0List").getElementsByTagName("li");
	for(var ii=0;ii<list3.length;ii++){
		if(list3[ii].id!="li_gu"){
			var s1=	list3[ii].innerHTML;
			list3[ii].innerHTML=s1.replace(/<a class="mybests[^<>]*>(.*?)<\/a>/gi, "").replace(/<a class=mybests[^<>]*>(.*?)<\/a>/gi, "").replace(/<a class=mybests(.*?)\]<\/a>/gi, "").replace(/<a class="mybests(.*?)\]<\/a>/gi, "");
		}
	}		
}

//原始的，去掉编辑,已登录
function f_bc0List_1(){
	var pstr=""
	var list3 = q$("bc0List").getElementsByTagName("li");
	for(var ii=0;ii<list3.length;ii++){
		if(list3[ii].id!="li_gu"){
			var s1=	list3[ii].innerHTML;
			list3[ii].innerHTML=s1.replace(/<a class=mybests(.*?)\]<\/a>/gi, "").replace(/<a class="mybests(.*?)\]<\/a>/gi, "");
		}
	}	
	var list4 = q$("bc0List").getElementsByTagName("a");
	for(var ii=0;ii<list4.length;ii++){
		if(list4[ii].id!="li_a"){
			var s1=	list4[ii];
			if(s1.href!=""&&s1.innerHTML!="[编辑]")
				pstr+=s1.href+"##"+s1.innerHTML.replace(/<\/*[^<>]*>/gi, "")+"##"+s1.className+"{|}";
		}
	}	
	
	if(d_pkstr=="1"){
		qTcms.AjaxPost(G_waibu+"Ztool/p/Ajax_value.asp","v=mingzhan2_2&m="+escape(pstr),function(d){
			var c=d.responseText;
			if(c!="ok")
				alert("请您登陆后使用")
		})
	}
}

q$("bc0Btn").onclick=function(){
	q$("bc0Btn_").style.display="";
	q$("bc0Btn").style.display="none";
	soojs_id=qTcms.U_GetUid();
	if(soojs_id>0)
		f_bc0List()
	else
		f_bc0List2()
}
function f_bc0Btn_(){
	q$("bc0Btn_").style.display="none";
	q$("bc0Btn").style.display="";	
	soojs_id=qTcms.U_GetUid();
	if(soojs_id>0)
		f_bc0List_1()
	else
		f_bc0List_2()	
}
q$("bc0Btn_").onclick=function(){
	f_bc0Btn_()
}

if(soojs_id!=0&&document.getElementById("p_skin_jinbi")){
	document.getElementById("p_skin_jinbi").innerHTML='<font color="#178517"><b>本机'+G_jifen_jifen_name+'已经绑定</b></font>';	
}


q$("p_skin_login").onclick=function(){User_login()};
q$("p_skin_reg").onclick=function(){User_reg()};
//用户登陆框
function User_login(){
	//m_login.html	
	DvWnd.open("登陆",qtCms_m2,400,350,1)	
}
//用户注册框
function User_reg(){
	//m_login.html	
	DvWnd.open("用户注册",qtCms_m3,400,350,1)	
}
//用户中心
function User_members(){
	DvWnd.open("用户中心",qtCms_m4,400,350,1)	
}
//用户登陆成功触发事件
function User_login_f(){
	if(q$("bc0Btn").style.display=="none")
		d_ok(1);
	else
		d_ok(0);
	//右上角状态栏
	DvWnd.close();
	window.location.reload();
}

/*高度自定义*/
function qTcmsreinitIframe(n){
	var iframe = document.getElementById('fapp_loader_'+n);
	try{
		var bHeight = iframe.contentWindow.document.body.scrollHeight;
		var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
		var height = Math.max(bHeight, dHeight);
		iframe.height =  height;
	}catch (ex){}
	$('#loading').hide();
}

	
function showClickInSites(divName)
{
    try
    {
        if (QingtianarrClickInSites.length <= 1)
        {
            return;
        }
        
        var str = '';
        str += '<div class="title">';
        str += '<div class="subject">最新点入</div>';
        str += '<div class="link"><a href="'+G_waibu+'Members/">想让您的网站也摆在这里？</a></div>';
        str += '<div class="time">更新时间：' + QingtianclickInRefreshDate + ' ' + QingtianclickInRefreshTime + '</div>';
        str += '</div>';
        str += '<div class="con">';
        str += '<ul>';
        for (i = 0; i < QingtianarrClickInSites.length - 1; i++)
        {
            if ("" != QingtianarrClickInSites[i][0]&&i<21)
            {
				if(parseInt(QingtianarrClickInSites[i][3])>parseInt(QingtianarrClickInSites[i][4]))
					str += '<li><a href="' + QingtianarrClickInSites[i][2] + '" onclick="qtchickout('+QingtianarrClickInSites[i][0]+');" id="0" title="今日点入：'+QingtianarrClickInSites[i][3]+' 点出：'+QingtianarrClickInSites[i][4]+'&#13;总计点入：'+QingtianarrClickInSites[i][5]+' 点出：'+QingtianarrClickInSites[i][6]+'" target="_blank" onmousemove="window.status=\'前往:'+QingtianarrClickInSites[i][1]+' 【'+QingtianarrClickInSites[i][2]+'】\'" onmouseout="window.status=\'\'"><font color=red>' + QingtianarrClickInSites[i][1] + '</font></a></li>';
				else
               		str += '<li><a href="' + QingtianarrClickInSites[i][2] + '" onclick="qtchickout('+QingtianarrClickInSites[i][0]+');" id="0" title="今日点入：'+QingtianarrClickInSites[i][3]+' 点出：'+QingtianarrClickInSites[i][4]+'&#13;总计点入：'+QingtianarrClickInSites[i][5]+' 点出：'+QingtianarrClickInSites[i][6]+'" target="_blank" onmousemove="window.status=\'前往:'+QingtianarrClickInSites[i][1]+' 【'+QingtianarrClickInSites[i][2]+'】\'" onmouseout="window.status=\'\'">' + QingtianarrClickInSites[i][1] + '</a></li>';
            }
        }
        str += '</ul>';
        str += '</div>';
        str += '<div style="clear:both"></div>';
        document.getElementById(divName).innerHTML = str;
    }
    catch (e)
    {}
}
if(G_All_moshi=="1")showClickInSites("divClickInSites")	