var J1616_www_appVersions = {
    famous: "1.0.1",
    music: "1.0.0",
    clock: "1.0.0",
    my1616: "1.0.0",
    jmail: "1.0.0",
    weather: "1.0.0",
    search: "1.0.1",
    stock: "1.0.1",
    memo: "1.0.0",
    layout: "1.0.0",
    news: "1.0.0",
    xingzuo: "1.0.0",
    note: "1.0.0",
    caipiao: "1.0.0"
};
var swfId = J1616.Const.getConst("crossDomainSwfId");
function JAJAX(timeout) {
    this.id = ++arguments.callee.id || (arguments.callee.id = 0);
    this.timeout = timeout;
};
JAJAX.prototype = {
    type: 'GET',
    data: null,
    open: function(url, id, data) {
        if (data) {
            this.type = 'POST';
            this.data = data;
            this.swfInterface = window[swfId] || document[swfId];
            this.swfInterface = this.swfInterface["1"] || this.swfInterface;
        } else { (this.s = document.createElement("script")).setAttribute("type", "text/javascript");
            this.s.src = url + (url.indexOf("?") == -1 ? "?": "&") + "callback=" + "JAJAX_CALLBACK_" + id + "&__=" + new Date().getTime();
        }
        this.url = url;
        return this;
    },
    send: function(fn) {
        var _this = this,
        IE = "\v" == "v";
        var _timer = setTimeout(function() {
            fn('{code:999}');
            clear();
        },
        this.timeout);
        var call = this.type == 'GET' ? 'JAJAX_CALLBACK_' + this.id: 'RUN_JAJAX_CALLBACK';
        window[call] = function(e) {
            clearTimeout(_timer, fn(e), clear());
        };
        if (this.type == 'GET') {
            var h = document.getElementsByTagName('head')[0];
            h.insertBefore(this.s, h.firstChild);
        } else {
            _this.swfInterface.JS_asRequest(_this.url, _this.data);
        }
        function clear() {
            try {
                if (_this.type == 'GET') {
                    _this.s.parentNode.removeChild(_this.s);
                } else {
                    _this.swfInterface.JS_abort();
                }
            } finally {
                _timer = null;
                IE ? window[call] = null: delete window[call];
            }
        }
    }
};
J1616.IO = {
    U: J1616.Util,
    prefix: "J1616_www_",
    req: G_waibu+"Ztool/p/Ajax_value.asp",
    upd: G_waibu+"Ztool/p/Ajax_value.asp",
    cdata: function(k, v) {
        var T = this;
        return typeof v == "undefined" ? T.U.getCookie(k) : T.U.setCookie(k, v, null, null);
    },
    request: function(pos, app, fn) {
		
        if (pos) {
            this.XHR(this.req + "?name=" + app+"&v=1616_jj_1", fn)
        } else {
            var apps = app.split(",");
            var s = "";
            for (var i = 0,
            p; p = apps[i]; i++) {
                s += this.cdata(this.prefix + p) + "|@|";
            }
            s = s.replace(/\|@\|$/, "");
            fn(s);
        }
    },
    save: function(pos, key, val, fn, post) {
		
/*        if (!pos) {
            this.cdata(this.prefix + key, val);
            fn('{code:1}')
        } else {
            if (post) {
                var data = {};
                data[key] = encodeURIComponent(val);
				
                this.XHR(this.upd, fn, data)
            } else this.XHR(this.upd + "?" + key + "=" + encodeURIComponent(val), fn)
        }*/
    },
	save2: function(pos, key, val, fn, post) {
		qTcms.AjaxPost(this.upd , "va=" + escape(val)+"&v=1616_jj_2&p="+new Date().getTime(),function(){})
        //this.XHR(this.upd + "?va=" + escape(val)+"&v=1616_jj_2&p="+new Date().getTime(), fn)
    },
    XHR: function(url, fn, data, timeout) {
        var req = new JAJAX(timeout || 10000);
        req.open(url, req.id, data).send(fn);
    }
};
J1616.www = {
    U: J1616.Util,
    I: J1616.IO,
    ac: {
        i: false,
        n: "游客"
    },
    _ac: function() {
        var re = this.ac;
        if (self !== parent) {
            if (parent.J1616 && parent.J1616.www && parent.J1616.www.ac) re = parent.J1616.www.ac;
        }
        return re;
    },
    root: "http://r.61658.com/",
    pdm: "http://passport" + J1616.Util.getDomain(),
    mdm: "http://my" + J1616.Util.getDomain(),
    cns: ["search", "my1616", "layout", "famous", "music", "clock", "jmail", "weather", "stock", "news", "memo", "note", "xingzuo"],
    cfgs: {},
    js: function(k) {
        var T = this,
        r = T.root,
        l = {
            "function": {
                src: r + "js/function.js",
                version: "1.0.0"
            },
            "jquery_mini": {
                src: r + "js/jquery_mini.js",
                version: "1.0.0"
            },
            "passport_common": {
                src: T.pdm + "/js/common.js",
                version: "1.0.0"
            }
        };
        return l[k];
    },
    config: function(k, v, fn) {
        var ar = arguments;
        if (ar.length == 2 && typeof ar[1] == "function") {
            this.I.request(this._ac().i, ar[0], ar[1]);
        } else if (ar.length == 3 && typeof ar[2] == "function") {
			this.I.save2(this._ac().i, ar[0], ar[1], ar[2], escape(v).length >= 1350);
           // this.I.save(this._ac().i, ar[0], ar[1], ar[2], encodeURIComponent(v).length >= 1350);
        }
    }
};
var gs_d = {
    i: -1,
    kw: '',
    u: '',
    gkw: ''
},
fs_d = [],
google = {
    ac: {
        h: function(a) {
            if (!a.length || a.length < 2 || a[0] != $.trim($('#keyword').val())) return;
            gs_d.gkw = a[0];
            var ih = '',
            _shmh = " onmouseover='this.style.backgroundColor=\"#88C4FF\";gs_d.u=\"\"' onmouseout='this.style.backgroundColor=\"#ECF5FF\"' onclick='shmd(this)'";
            if (fs_d.length == 2 && $.trim(fs_d[0].split('|')[0]) == a[0]) {
                var f1 = fs_d[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'" + _shmh + "><td align=left _u=1 _h='" + f1[4] + "'><p>" + tt + "</p><p style='color:#888;font-size:12px;overflow:hidden;text-overflow:ellipsis;height:14px;white-space:nowrap;width:358px'>" + f1[5] + "</p><p style='color:#090;font-size:12px'>" + f1[4] + "</p></td></tr>";
            }
            var b = a[1];
            if (b.length) for (var j = 0; j < b.length; j++) {
                if (J1616.getType(b[j]) == "array" && b[j].length == 3) {
                    if (b[j][0].indexOf("hao123.") < 0 && b[j][0] != 'hao123' && b[j][0].indexOf("好123") < 0) ih += '<tr' + _shmh + '><td _h="' + b[j][0].replace(/\"/g, '') + '"><a><span>' + b[j][1] + '</span> ' + b[j][0] + '</a></td></tr>';
                }
            }
            $('#kwh').html('<table onmousedown="stopBubble(event)" width="100%" cellpadding=0 cellspacing=1>' + ih + '</table>');
            sh('kwh', ih.length > 0);
        }
    }
};
function has(i, e) {
    var pn = e;
    while (pn) {
        if (pn.id == i) return true;
        pn = pn.parentNode
    }
    return false
}
function euc(s) {
    return encodeURIComponent(s)
}
function duc(s) {
    return decodeURIComponent(s)
}
function dcs(s, i) {
    $("#" + i).remove();
    var js = document.body.appendChild(document.createElement("SCRIPT"));
    js.src = s;
    if (i) js.id = i
}
function s16(a, p) {
    var wp = ["act=" + a];
    for (var i = 0; i < p.length; i += 2) wp.push(p[i] + "=" + euc(p[i + 1]));
   // $('<img />').attr('src', "http://st.1616.net/s.php?" + wp.join("&"));
}
function sh(o, i, s) {
    if (typeof(o) == "string") o = $("#" + o);
    $(o).css("display", i ? (s ? s: "block") : "none");
}
function stopBubble(e) {
    if (e.stopPropagation) e.stopPropagation();
    else e.cancelBubble = true;
}
$.getScriptEx = function(url, fnback, simple, callbackName) {
    var s, c, fn = 'jsonp' + ( + new Date()) + (this.jsonpid = ++this.jsonpid || 0),
    d = document,
    cbk = callbackName || 'callback',
    src = (url.indexOf("?") == -1 ? url + (simple ? "": "?") : url) + (simple ? '': '&' + 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()
    };
};
function getSWF(id) {
    var swf = window[id] || document[id];
    return navigator.userAgent.indexOf('MSIE 9.0') !== -1 ? swf[0] : (swf['1'] || swf);
}
var SWF = getSWF('clockswf');
function outputDate(t) {
    $("#dat_output").html(date(t));
    function date(a) {
        var d = a ? new Date(a) : new Date();
        var ymd = d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日",
        week = ['日', '一', '二', '三', '四', '五', '六'];
        var xz = J1616.Util.getCookie('XZ') || "0";
        return ('<a id=alarm class=clockin href="#"><em id=clockhint></em>[闹钟提醒]</a><a href="http://wannianli.1616.net">' + ymd + "<br>" + lunar(d)[1] + lunar(d)[2] + " 周" + week[d.getDay()] + '</a>');
    }
}
function lunar(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: ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"],
        _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;
            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)];
        }
    }
    return __nongli._lun(t);
}
function set_home(o) {
    J1616.Util.setHome(o, G_WebUrl);
}
function pn(s) {
    var r = has('sites-c', s) ? "名站导航": (has('sites-r', s) ? s.parentNode.parentNode.firstChild.innerHTML: (has('multi-s', s) ? s.parentNode.firstChild.innerHTML: ''));
    if (r == "") r = has('chaxun', s) ? '实用查询': (has('ada', s) ? 'ad': '');
    return r;
}
function add_fav() {
    var a = window.sidebar,
    b = location.href,
    c = "1616上网导航";
    if (document.all) {
        external.addFavorite(b, c)
    } else if (a) {
        a.addPanel(c, b, "")
    }
}
function wwwfirst_cb(d) {
    fs_d = d;
    var k = $.trim($('#keyword').val());
    if (!k) return;
    dcs('http://www.google.cn/complete/search?hl=zh-CN&q=' + euc(k) + '&_=' + Math.random(), 'gsg');
    setTimeout(function() {
        if ($('#kwh tr').length < 1 || k != gs_d.gkw) google.ac.h([k, []]);
    },
    150);
}
function smc(d) {
	
    var k = $.trim($('#keyword').val()),
    h = '',
    _s = " onmouseover='this.style.backgroundColor=\"#88C4FF\";gs_d.u=\"\"' onmouseout='this.style.backgroundColor=\"#ECF5FF\"' onclick='shmd(this)'";
    if (!k || k != d[0].split('|')[0]) return;
    for (var i = 1; i < d.length; i++) {
        h += '<tr' + _s + '><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 onmousedown="stopBubble(event)" width="100%" cellpadding=0 cellspacing=1>' + h + '</table>');
    sh('kwh', h.length > 0);
}
function soTaobao(d) {
    d = d.result;
    var _s = " onmouseover='this.style.backgroundColor=\"#88C4FF\";gs_d.u=\"\"' onmouseout='this.style.backgroundColor=\"#ECF5FF\"' onclick='shmd(this)'";
    var s = '',
    t;
    for (var i = 1; i < d.length; i++) {
        t = d[i][0].replace(/["<>]/g, '');
        s += '<tr' + _s + '><td _h="' + t + '"><a>' + t + '</a></td></tr>';
    }
    $('#kwh').html('<table onmousedown="stopBubble(event)" width="100%" cellpadding=0 cellspacing=1>' + s + '</table>');
    sh('kwh', !!s);
}
window.bdsug = {
	sug: function(a) {
		//window.bdsug.sug({q:"2",p:false,s:["24券","2011最新电影","2012","2144小游戏","2345","2345网址导航","2144","2011qq官方下载正式版免费","2012年春节","2012年日历"]});
		var _s = " onmouseover='this.style.backgroundColor=\"#88C4FF\";gs_d.u=\"\"' onmouseout='this.style.backgroundColor=\"#ECF5FF\"' onclick='shmd(this)'";
		var s = '',
		t;
		for (var i = 0; i < a.s.length; i++) {
			t = a.s[i].replace(/["<>]/g, '');
			s += '<tr' + _s + '><td _h="' + t + '"><a>' + t + '</a></td></tr>';
		}
		$('#kwh').html('<table onmousedown="stopBubble(event)" width="100%" cellpadding=0 cellspacing=1>' + s + '</table>');
		sh('kwh', !!s);
	}
};
window.baidu = {
	sug: function(a) {
		//window.bdsug.sug({q:"2",p:false,s:["24券","2011最新电影","2012","2144小游戏","2345","2345网址导航","2144","2011qq官方下载正式版免费","2012年春节","2012年日历"]});
		var _s = " onmouseover='this.style.backgroundColor=\"#88C4FF\";gs_d.u=\"\"' onmouseout='this.style.backgroundColor=\"#ECF5FF\"' onclick='shmd(this)'";
		var s = '',
		t;
		for (var i = 0; i < a.s.length; i++) {
			t = a.s[i].replace(/["<>]/g, '');
			s += '<tr' + _s + '><td _h="' + t + '"><a>' + t + '</a></td></tr>';
		}
		$('#kwh').html('<table onmousedown="stopBubble(event)" width="100%" cellpadding=0 cellspacing=1>' + s + '</table>');
		sh('kwh', !!s);
	}
};

function hint(e, t) {
    var kwd = $('#keyword'),
    ek = e.keyCode;
    if (!kwd.val().length || ek == 10 || ek == 13 || ek == 27) {
        sh('kwh', 0);
        gs_d.u = "";
        return;
    }
    if (ek == 38 || ek == 40) {
        if ($('#kwh').css('display') == 'none') {
            sh('kwh', 1);
            return
        }
        var trs = $('#kwh table tr');
        if (ek == 38) gs_d.i = (gs_d.i == -1) ? trs.length - 1 : gs_d.i - 1;
        else gs_d.i = (gs_d.i + 1) % trs.length;
        trs.each(function(i) {
            if (i == gs_d.i) {
                $(this).css('backgroundColor', '#88c4ff');
                var cel = $(this.cells[0]);
                kwd.val(cel.attr('_h'));
                gs_d.u = cel.attr('_u') ? cel.attr('_h') : "";
            } else $(this).css('backgroundColor', '#ECF5FF');
        });
        if (gs_d.i == -1) {
            gs_d.u = "";
            kwd.val(gs_d.kw);
        }
    } else {
        gs_d.i = -1;
        gs_d.kw = kwd.val();
        var s = euc($.trim(kwd.val()));
        if (t == 1) {
            dcs('http://nssug.baidu.com/su?prod=mp3&sc=hao123&t=1322054614157&wd=' + s, 'fsg');
        } else if (t == 6) {
            dcs('http://suggest.taobao.com/sug?code=utf-8&callback=soTaobao&q=' + s, 'fsg');
        } else {
            dcs("http://suggestion.baidu.com/su?p=3&cb=window.bdsug.sug&t=" + new Date().getTime() + "&wd=" + s + "&ie=gb2312", 'fsg');
        }
    }
}
function shmd(o) {
    var td = $(o.firstChild);
    if (td.attr('_u')) gs_d.u = td.attr('_h');
    else $('#keyword').val(td.attr('_h'));
    J1616.www.search.do_s();
}
J1616.www.index = {
    W: J1616.www,
    U: J1616.Util,
    C: J1616.Const.getConst,
    I: J1616.IO,
    theme: {
        th: "green",
        ft: 1,
        bg: 1,
        tpg: "1-1",
        lo: 0
    },
    i: 1,
    _apps: [],
    importCfgs: function(json, apps, fn) {
		
        var T = this,
        done = 0,
        all = apps.length;
        if (json.code == 1) {
            T.W.ac = {
                i: true,
                n: json.desc
            };
            for (var i = 0; i < all; i++) {
                T.W.config(apps[i], T.W.cfgs[apps[i]],
                function() {
                    done++;
                    if (fn && typeof(fn) == "function" && done == all) fn();
                });
            }
        }
    },
    p_callback: function(json) {
        var o = $("#passport"),
        h,
        T = this;
        switch (json.code) {
        case 1:
            h = '<a class="jwiUname hot2" href="javascript:User_members()" target="_self">' + json.desc + '</a>，欢迎您！<a class="jwiUname hot2" href="javascript:User_members()" target="_self">用户中心</a><a id=jwiLogout class=hot2>退出</a>';
            T.W.ac = {
                i: true,
                n: json.desc
            };
            break;
        case 0:
            h = "<a id=jwiLogin>登录</a>|<a id=jwiReg>注册</a>";
            T.W.ac = {
                i: false,
                n: "游客"
            };
            break;
        }
        o.html(h);
        T._jwiEvts();
		
        T.W.config(T.W.cns.join(","),
        function(cfgs) {
            if (!cfgs) return;
            cfgs = cfgs.split("|@|");
            for (var i in T.W.cns) T.W.cfgs[T.W.cns[i]] = cfgs[i];
            if (cfgs) {
                for (var k in cfgs) {
                    try {
                        if ((!cfgs[k]) || cfgs[k] === "null") T.W.cfgs[T.W.cns[k]] = J1616.obj2str(J1616.www[T.W.cns[k]].__cfg);
                    } catch(e) {}
                }
            }
            T.i = 0; (function() {
                for (var k in T.W.cns) {
                    var _b = T.W.cns[k],
                    _a = J1616.www[_b];
                    var vers = J1616.str2obj(T.U.getCookie(T.C("cookies")[1]));
                    var v1 = J1616_www_appVersions[_b],
                    v0 = vers && vers[_b] ? vers[_b] : null;
                    if (v0 != v1) {
                        if (typeof(_a["__upgrade"]) == "function") {
                            _a["__upgrade"](function() {
                                fireEvents(_a, _b)
                            },
                            function() {
                                updateVersion(_b, v1)
                            });
                        } else {
                            fireEvents(_a, _b);
                            updateVersion(_b, v1);
                        }
                        T._apps[T._apps.length] = T.W.cns[k];
                    } else {
                        fireEvents(_a, _b)
                    }
                }
                function fireEvents(_a, _b) {
                    try {
                        if (T.W.ac.i && typeof(_a["__login"]) == "function") {
                            _a["__login"]()
                        } else if (typeof(_a["__logout"]) == "function") {
                            _a["__logout"]()
                        }
                    } catch(e) {}
                }
                function updateVersion(_b, v) {
                    J1616_www_appVersions[_b] = v;
                    T.U.setCookie(T.C("cookies")[1], J1616.obj2str(J1616_www_appVersions));
                }
            })();
        });
    },
    p_reg: function() {
        var T = J1616.www.index;
		User_reg();
//        T.U.showWindow({
//            infoType: "normal",
//            title: "注册",
//            height: 320,
//            width: 440,
//            iframe: "passport/i_register.htm",
//            theme: T.theme.dialog,
//            onhide: function() {
//                $('#keyword')[0].focus()
//            }
//        });
        return false
    },
    p_login: function() {
        var T = J1616.www.index;
		User_login();
//        T.U.showWindow({
//            infoType: "normal",
//            title: "登录",
//            height: 320,
//            width: 440,
//            iframe: "passport/i_login.htm",
//            theme: T.theme.dialog,
//            onhide: function() {
//                $('#keyword')[0].focus()
//            }
//        });
        return false
    },
    p_account: function() {
        var T = J1616.www.index;
        T.U.showWindow({
            infoType: "normal",
            title: "我的账户",
            height: 240,
            width: 440,
            iframe: "passport/i_account.htm",
            theme: T.theme.dialog
        });
        return false
    },
    p_logout: function() {
		qTcms.Ajax(G_waibu+"Members/regok.asp?action=out&Back_url=noback&m="+new Date().getTime(),function(d){})	;		
		qTcms.Cookie.set(G_u_Cookies,"");
        var T = J1616.www.index;
        T.U.setCookie("Usecure", "", null, null, T.U.getDomain());
        T.W.ac = {
            i: false,
            n: "游客"
        };
        T.p_callback({
            code: 0,
            desc: ""
        });
        return false
    },
    isLogin: function(callbackName) {
        //$.getScript(this.W.pdm + "/checkLogin.php?ns=" + callbackName);
		if(qTcms.U_GetUid()==0){
			J1616.www.index.p_callback({"code":0,"desc":""});
		}else{
			var uu=qTcms.Cookie.get3(qTcms.Cookie.get(G_u_Cookies),"soojs_u");	
			var uup=qTcms.Cookie.get2("soojsu2");
			if(uup!=null)uu=uup;
			//if(!uu.match(/^[A-Za-z0-9_]+$/gi)){uu="您好"	}
			//J1616.www.index.p_callback({"code":1,"desc":uu});	
			$.getScript(G_waibu+"Ztool/p/Ajax_value.asp?v=1616_jj_3&t="+new Date().getTime());
		}
    },
    stat: function(ev) {
        ev = ev || window.event;
        sh('kwh', 0);
        var s = ev.srcElement || ev.target;
/*        try {
            if (s.tagName == "A") {
                var h = "http://" + location.host;
                if (s.href == "#" || s.href == h + "/#") s.target = "_self";
                if (s.href.match(/^\s?http:\/\//i) && s.href.indexOf(h) < 0) s16(1, ["pn", pn(s), "u", s.href, "t", $(s).text().replace(/ /g, '')]);
            }
        } catch(e) {}*/
        return true;
    },
    _jwiEvts: function() {
        var T = this;
        $("#jwiLogout").live("click", T.p_logout);
        $("#jwiReg").live("click", T.p_reg);
        $("#jwiLogin").live("click", T.p_login);
    },
    _events: function() {
        var T = this;
        document.body.onmousedown = function(event) {
            T.stat(event)
        };
        T._jwiEvts();
    },
    init: function() {
        var T = this;
        try {
            document.execCommand("BackgroundImageCache", false, true)
        } catch(e) {}
        $('#bests li').each(function() {
            $(this).attr('ih', $(this).html())
        });
        T.isLogin("J1616.www.index.p_callback");
        T._events();
    }
};
J1616.www.famous = {
    W: J1616.www,
    I: J1616.www.index,
    l: "#sites-c>li",
    lk: "#sites-c>li>a:nth-child(1)",
    la: "#sites-c a[i]:even",
    ld: "#sites-c a[i]:odd",
    f: 1,
    s: 0,
    __cfg: [],
    _cfg: [],
    curItem: {},
    min: 42,
    max: 48,
    _fc: ["", "zt_red", "zt_green"],
    _events: function() {
        var T = this;
        $("#bc0Btn").click(function() {
            if (T.f) {
                T._crBtn();
            }
            T.f = 0;
            T.s = 1;
            $(T.la).css('display', '');
            $(T.ld).css('display', '');
            sh("bc0Btn", 0);
            sh("bc0Btn_", 1, "inline");
            sh("sites-ct", 1);
            T._bdEvts();
        });
        $("#bc0Btn_").click(function() {
            T._cancel()
        });
        $("#add-site").click(function() {
            T._add();
            return false
        });
        $("#sites-sm>a:eq(0)").live("click", T.I.p_login);
        $("#sites-sm>a:eq(1)").live("click", T.I.p_reg);
        $("#sites-c>li>a:not([i])").live("mouseover",
        function() {
            $(this).css("color", "red")
        }).live("mouseout",
        function() {
            $(this).css("color", "")
        });
        $("#passport a,#sites-t a,#sites-sm a").live("mouseover",
        function() {
            $(this).css("color", "red")
        }).live("mouseout",
        function() {
            $(this).css("color", "")
        });
    },
    _crBtn: function() {
        var T = this;
        $(T.lk).each(function(i) {
            if (!$(this).siblings("a[i]").length) $(this).after("<a i=" + i + " title='修改'></a><a i=" + i + " title='删除'></a>");
        });
    },
    _bdEvts: function() {
        var T = this;
        if (!T.s) return;
        $(T.la).unbind("click").click(T._edit);
        $(T.ld).unbind("click").click(T._del);
        $(T.la).each(function(i) {
            var l = $(this),
            d = $(T.ld).eq(i);
            if (!T.W.ac.i && i < 48) {
                l.attr("class", "sites-b-n");
                d.attr("class", "sites-d-n")
            } else {
                l.attr("class", "sites-b");
                d.attr("class", T.W.ac.i ? "sites-d": "sites-d-n")
            }
        });
        var _l, _i, _a, _d, _ac, _dc;
        if (!T.W.ac.i) {
            _l = $(T.l).slice(48, 48)
        } else {
            _l = $(T.l)
        }
        $(T.l).unbind();
        _l.hover(function() {
            $(this).addClass("bj-on").css("cursor", T.W.ac.i ? "move": "");
            _i = $(this).find(">a:not([i])");
            _a = $(this).find(">a[i]:eq(0)");
            _d = $(this).find(">a[i]:eq(1)");
            _ac = _a.attr("class");
            _dc = _d.attr("class");
            _a.attr("class", "sites-b-on");
            if (T.W.ac.i) _d.attr("class", "sites-d-on");
        },
        function() {
            $(this).removeClass("bj-on").css("cursor", "");
            _a.attr("class", _ac);
            _d.attr("class", _dc);
        });
        $("#sites-c").sortable("destroy");
        if (T.W.ac.i) {
            $("#sites-c").sortable({
                placeholder: 'ui-state-highlight',
                distance: 10,
                zIndex: 2,
                beforeStop: function(e, ui) {
                    ui.helper.removeClass("bj-on").css("cursor", "");
                    ui.helper.find(">a:not([i])").css("color", "");
                    ui.helper.find(">a[i]:eq(0)").attr("class", _ac);
                    ui.helper.find(">a[i]:eq(1)").attr("class", _dc);
                },
                stop: function(e, ui) {
					
                    var c = J1616.obj2str(T._getOrder());
                    T.W.config("famous", c,
                    function(d) {
                        d = J1616.str2obj(d);
                        if (d.code === 1) {
                            T.W.cfgs["famous"] = c;
                            $(T.l).each(function(i) {
                                $(this).find("a[i]").attr("i", i);
                            });
                        }
                    })
                }
            }).disableSelection()
        }
    },
    __logout: function() {
        var T = this;
        T._html();
        T._showTip();
        T._bdEvts();
    },
    __login: function() {
        this.__logout()
    },
    _showTip: function() {
        var T = this,
        tips = ["<a>请先登录</a> 或 <a>免费注册</a>。", "提示：拖动网址可以排序哦！"];
        $("#sites-sm").html(tips[ + T.W.ac.i])
    },
    _edit: function(e) {
        e = e || window.event;
        var T = J1616.www.famous,
        o = e.srcElement || e.target,
        i = o.getAttribute("i"),
        p = $(o).siblings("a:not([i])").eq(0),
        c = J1616.str2obj(T.W.cfgs["famous"]);
		
		kk_y($(o).parent().attr("id"),$(o).parent().children(0).html(),$(o).parent().children(0).attr("href"),$(o).parent().children(0).attr("class"))
		
/*        var h1 = "您未登录，仅可对最后一行网址进行编辑。请先登录：",
        to = "http://www" + T.W.U.getDomain() + "/app/famous_edit_jj.htm",
        title = "自定义网址",
        height = "220";
        T.curItem = {
            id: i,
            data: (c[i].length ? (J1616.getType(c[i][0]) == "array" ? c[i][0] : c[i]) : [p.text(), p[0].href, T._g(p[0].className)])
        };
        if (o.className == "sites-b-on") {
            T.W.U.showWindow({
                infoType: "normal",
                title: "自定义网址",
                height: 220,
                width: 440,
                iframe: "app/famous_edit_jj.htm",
                theme: T.I.theme.dialog
            });
        } else {
            T.W.U.showWindow({
                infoType: "normal",
                title: "登录",
                height: 320,
                width: 440,
                iframe: "passport/i_login.htm?h1=" + euc(h1) + "&to=" + euc(to) + "&title=" + euc(title) + "&height=" + height,
                theme: T.I.theme.dialog
            });
        }*/
        return false
    },
    _del: function(e) {
        e = e || window.event;
        var T = J1616.www.famous,
        o = e.srcElement || e.target,
        i = o.getAttribute("i"),
        c = J1616.str2obj(T.W.cfgs["famous"]),
        cfg;
		if(qTcms.U_GetUid()==0){
			User_login();
			return false;
		}		
/*        if (!T.W.ac.i) {
            var h1 = "您未登录，不能删除网址。请先登录：";
            T.W.U.showWindow({
                infoType: "normal",
                title: "登录",
                height: 320,
                width: 440,
                iframe: "passport/i_login.htm?h1=" + euc(h1),
                theme: T.I.theme.dialog
            });
            return false;
        }*/
        if ($(T.l).length <= T.min) {
            alert("您最少需要保留" + T.min + "个网址");
            return false
        }
        if (!confirm("您确定删除这个网址吗？")) return false;
        $(o).parent().remove();
        cfg = J1616.obj2str(T._getOrder());
		
        T._dh(J1616.str2obj(cfg).length);
        T.W.config("famous", cfg,
        function(d) {
            d = J1616.str2obj(d);
            if (d.code === 1) {
                T.W.cfgs["famous"] = cfg;
                $(T.l).each(function(i) {
                    $(this).find("a[i]").attr("i", i);
                });
            } else {
                alert("删除失败了，请刷新后重试，或给我们反馈意见")
            }
        });
    },
    _add: function() {
        var T = J1616.www.famous;
        if ($(T.l).length >= T.max) {
            alert("您最多只能添加" + T.max + "个网址");
            return false
        }
        var h1 = "您未登录，仅可对最后一行网址进行编辑。请先登录：",
        to = "http://www" + T.W.U.getDomain() + "/app/famous_edit_jj.htm?action=add",
        title = "添加自定义网址",
        height = "220";
        T.curItem = {
            id: $(T.l).length,
            data: ["", "", 0]
        };
		
        if (T.W.ac.i) {
			kk_y_a()
/*            T.W.U.showWindow({
                infoType: "normal",
                title: "添加自定义网址",
                height: 220,
                width: 440,
                iframe: "app/famous_edit_jj.htm?action=add",
                theme: T.I.theme.dialog
            });*/
        } else {
			User_login()	
/*            T.W.U.showWindow({
                infoType: "normal",
                title: "登录",
                height: 320,
                width: 440,
                iframe: "passport/i_login.htm?h1=" + euc(h1) + "&to=" + euc(to) + "&title=" + euc(title) + "&height=" + height,
                theme: T.I.theme.dialog
            });*/
        }
    },
    _append: function(o) {
        var T = this,
        c = J1616.str2obj(T.W.cfgs["famous"]),
        _h = $("<li id="+(c.length+1000)+"><a href=' " + o.data[1] + "' class=" + T._fc[o.data[2]] + ">" + o.data[0] + "</a><a title='修改' i=" + o.id + " class=sites-b></a><a title='删除' i=" + o.id + " class=sites-d></a></li>");
        $("#sites-c").append(_h);
		
        T._dh(c.length);
        T._bdEvts()
    },
    _getOrder: function() {
        var T = this,
        _o = [],
        _i;
        $(T.l).each(function(i) {
            _i = $(this).find("a:not([i])");
            if (_i.length == 1) {
                if (i < T.__cfg.length && _i.text() == T._cfg[i][0] && $.trim(_i[0].href) == T._cfg[i][1] && T._g(_i.attr("class")) == T._cfg[i][2]) _o[i] = []
                else _o[i] = [_i.text(), $.trim(_i[0].href), T._g(_i.attr("class"))];
            } else {
                _o[i] = [];
                _i.each(function(j) {
                    if (i < T.__cfg.length && J1616.getType(T._cfg[i][j]) == "array") {
                        if ($(this).text() == T._cfg[i][j][0] && $.trim(this.href) == T._cfg[i][j][1] && T._g(this.className) == T._cfg[i][j][2]) {} else _o[i][j] = [$(this).text(), $.trim(this.href), T._g(this.className)];
                    } else {
                        _o[i][j] = [$(this).text(), $.trim(this.href), T._g(this.className)];
                    }
                });
            }
        });
        return _o;
    },
    _g: function(c) {
        if (!c) return 0;
        var T = this;
        for (var i = T._fc.length; i--;) {
            if (c === T._fc[i]) return i
        }
    },
    _cancel: function() {
		
        var T = this;
        T.s = 0;
        $(T.la).hide();
        $(T.ld).hide();
        sh("bc0Btn", 1, "inline");
        sh("bc0Btn_", 0);
        sh("sites-ct", 0);
        $("#sites-c>li>a:not([i])").removeAttr("style");
        $(T.l).unbind();
        $("#sites-c").sortable("destroy");
		
		var c = J1616.obj2str(T._getOrder());
		T.W.config("famous", c,
		function(d) {
			d = J1616.str2obj(d);
			if (d.code === 1) {
				T.W.cfgs["famous"] = c;
				$(T.l).each(function(i) {
					$(this).find("a[i]").attr("i", i);
				});
			}
		})		
		
    },
    _html: function() {
        var T = this,
        c = J1616.str2obj(T.W.cfgs["famous"]),
        cl = c ? c.length: 0,
        tll = $(T.l).length;
        if (c && cl > 0 && cl <= T.min) {
            for (var i = T.min - cl; i--;) {
                c.unshift([])
            }
            T.W.cfgs["famous"] = J1616.obj2str(c);
            cl = c.length;
        }
        if (c && cl) {
            for (var i = 0; i < cl; i++) {
                if (i >= tll) {
                    $("#sites-c").append("<li><a></a><a title='修改' i=" + i + " class=sites-b" + (T.s ? "": " style='display:none'") + "></a><a title='删除' i=" + i + " class=sites-d" + (T.s ? "": " style='display:none'") + "></a></li>");
                }
                _(i, $(T.lk))
            }
            $(T.l + ":gt(" + (cl - 1) + ")").remove();
            T._dh(cl);
        }
        function _(j, l) {
            $(l[j]).nextAll("b,a:not([i])").remove();
            if (c[j].length) {
                if (J1616.getType(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 (J1616.getType(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 = J1616.cutStr(cj[0], 12);
                var _b = /^(http|https|ftp):\/\/{1}/i.test(cj[1]) ? cj[1] : "http:\/\/" + cj[1];
                lj.href = ' ' + _b;
                lj.className = T._fc[cj[2] === undefined ? 0 : cj[2]]
            }
            function _n(lj, cj) {
                lj.innerHTML = J1616.cutStr(cj[0], 12);
                lj.href = ' ' + cj[1];
                lj.className = T._fc[cj[2] === undefined ? 0 : cj[2]]
            }
        }
    },
    _dh: function(cl) {
        var _h, unit = 29,
        t = document.all ? 800 : 500;
        if (cl % 6 == 0) _h = (cl / 6) * unit;
        else _h = (parseInt(cl / 6) + 1) * unit;
        $("#sites-c").animate({
            "height": _h
        },
        t);
    },
    init: function() {
        var T = this,
        o;
        $(T.lk).each(function(i) {
            T.__cfg[i] = [];
            o = $(this).nextAll("a:not([i])");
            if (o.length) {
                T._cfg[i] = [[this.innerHTML, this.href, T._g(this.className)], [o.html(), o[0].href, 0]];
            } else T._cfg[i] = [this.innerHTML, this.href, T._g(this.className)];
        });
        T._events();
    }
};
J1616.www.search = {
    cur: null,
    num: 0,
    sr: 0,
    __cfg: [0, 0, 0, 2, 0, 0, 0],
    acc: ["", "", "", "", ""],
    sps: [["百度", 'www.baidu.com/s?tn='+G_lm_baidu+"&wd=","Google", 'www.google.com.hk/cse?cx='+G_lm_google_s+'&q=', "搜搜", 'www.soso.com/q?w=',  "有道", "www.youdao.com/search?q=","狗狗","www.gougou.com/search?search="], ["百度", "mp3.baidu.com/m?ie=gb2312&ct=134217728&word=", "迅雷", "mp3.gougou.com/search?search=", "Google", "www.google.cn/music/search?q=", "搜狗", "mp3.sogou.com/music.so?ie=utf8&query="], ["迅雷", "movie.gougou.com/search?search=", "优酷", "so.youku.com/search_video/q_"], ["迅雷", "video.gougou.com/search?s=", "Google", "www.google.com.hk/search?tbs=vid:1&q=", "百度", "video.baidu.com/v?ie=gb2312&word="], ["百度", "image.baidu.com/i?ie=gb2312&ct=201326592&lm=-1&word=", "Google", "www.google.com.hk/images?q="], ["贴吧", "tieba.baidu.com/f?ie=gb2312&kw=", "来吧", "laiba.tianya.cn/searchGroup.jsp?isFromStock=false&searchType=0&nameOrStockCode="], ["购物", "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="]],
    ifr: ["", "www.520music.com/rank/1616.htm", "www.1616.net/misc/movie.html", "movie.ku6.com/c2010/1616wangdaohang/index.shtml", "", ""],
    events: function() {
		
        var T = this,
        o = false;
        $('#keyword').focus().blur(function() {
            o || setTimeout(function() {
                $('#kwh').hide().empty()
            },
            1);
        });
        $('#kwh').mouseenter(function() {
            o = !o
        }).mouseleave(function() {
            o = !o
        }) 
		$.each($("#s-tl>a"),
        function(i) {
            $(this).click(function() {
                if (T.cur == this) return;
                this.className = "cur";
                T.cur.className = "";
                var _h = [];
                for (var j = 0; j < T.sps[i].length / 2; j++) _h[_h.length] = '<input type=radio name=sp' + (T.__cfg[i] == j ? " checked": "") + ' id=sp' + j + '><label for=sp' + j + '>' + T.sps[i][j * 2] + '</label>';
                $('#sps').html(_h.join(""));
                T.setRadioEvent();
                T.cur = this;
                T.num = i;
                T.sr = T.__cfg[i];
                $("#s-cc").hide();
                T.img(T.sr);
                return false;
            });
        });
        $("#s-btn").unbind("click").click(function() {
            T.do_s();
            return false
        });
        $("#keyword").unbind("keyup").unbind("keypress").keyup(function(e) {
            hint(e || window.event, T.num)
        }).keypress(function(e) {
            e = e || window.event;
            if (e.keyCode == 13) {
                T.do_s();
                return false
            }
        });
    },
    get_img: function(t) {
        if (t.indexOf('s.php') > 0) return 0;
        if (t.indexOf('173fzl') > 0) return 1;
        var fs = ["google", "www.baidu", "gougou", "sogou", "yahoo", "youku", "tianya", "mp3", "zhidao", "image", "tieba", "1616", "video", "taobao"];
        for (var i = 0; i < fs.length; i++) if (t.indexOf(fs[i] + '.') > -1) return i;
        return i;
    },
    get_acc: function(t) {
        var fs = ["google", "sogou", "baidu", "gougou"],
        j = fs.length;
        $.each(fs,
        function(i) {
            if (t.indexOf('.' + this + '.') != -1) {
                j = i;
                return false;
            }
        });
        return j;
    },
    setRadioEvent: function() {
        var T = this;
        $.each($('#sps>input'),
        function(i) {
            $(this).click(function() {
                T.onRadio.call(T, i)
            });
        });
    },
    img: function(i) {
        var T = this,
        t = T.sps[T.num][i * 2 + 1];
        var img = $('#search-l');
        img.attr("href", "http://" + t + T.acc[T.get_acc(t)]);
        if (t.indexOf('.youku.') != -1) img.attr("href", "http://so.youku.com/search/");
        img.find('img').attr("src", G_dirUrl+"images/jjb/images/sp_jj" + T.get_img(t) + ".png");
        if (T.num >= 5) {
            img.attr("href", "http://" + t.substr(0, t.indexOf("/")));
            if (t.indexOf('.taobao.') != -1) img.attr("href", "http://pindao.huoban.taobao.com/channel/channelCode.htm?pid="+G_lm_taobao2);
        }
    },
    onRadio: function(i) {
        var T = this;
        T.sr = T.__cfg[T.num] = i;
        T.img(i);
        $('#sps input').eq(i).attr("checked", true);
        J1616.IO.save(0, "search", J1616.obj2str(T.__cfg),
        function() {});
    },
    do_s: function() {
        $('#kwh').hide();
        var T = this,
        i = T.num,
        _c = T.__cfg,
        ua = navigator.userAgent.toLowerCase();
        var spec = i == 6 && (_c[6] == 0 || _c[6] == 2);
        s16(3, ["st", i + 1, 'sn', $('#sps>input:checked').next().text()]);
        if (gs_d.u != '') {
            s16(5, ["u", gs_d.u]);
            if (/firefox/.test(ua)) {
                setTimeout(function() {
                    submit(gs_d.u, spec)
                },
                300);
            } else {
                submit(gs_d.u, spec);
            }
            gs_d.u = '';
        } else {
            var orig = $("#keyword").val(),
            t = T.sps[i][_c[i] * 2 + 1];
            if (!orig) t = t.replace(/\/f\?/, '/?');
            s16(2, ["kw", orig]);
            var url = "http://" + t + euc(orig) + (spec ? '': T.acc[T.get_acc(t)]);
            if (/firefox/.test(ua)) {
                setTimeout(function() {
                    submit(url, spec);
                },
                500);
            } else {
                submit(url, spec);
            }
        }
        function submit(s, spec) {
            if (!s.length) return;
            else {
                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);
                }
            }
            $("#keyword").attr("disabled", true);
            if (spec) {
                $("#search form").attr("accept-charset", "GB2312");
                if (document.all) document.charset = "GB2312";
            }
            $("#search form").submit();
            if (spec) {
                $("#search form").attr("accept-charset", "gb2312");
                if (document.all) document.charset = "gb2312";
            }
            $("#keyword").removeAttr("disabled");
        }
    },
    __logout: function() {
        var T = this;
        J1616.IO.request(0, "search",
        function(e) {
            T.__cfg = e == 'null' ? T.__cfg: J1616.str2obj(e);
            if (!J1616.www.ac.i) T.__cfg[0] = 0;
            T.events();
            T.setRadioEvent();
            T.onRadio(T.sr = parseInt(T.__cfg[0]));
        });
    },
    __login: function() {
        this.__logout();
    },
    init: function() {
        this.cur = $("#so0")[0];
    }
};
/*J1616.www.weather = {
    city: '北京',
    U: J1616.Util,
    W: J1616.www,
    setCity: function() {
        var ifr = $('#city_set_ifr')[0];
        if (ifr.src == 'about:blank') ifr.src = 'app/weather_setcity.htm';
        ifr.style.display = 'block';
        $('#weather-xs').hide();
    },
    __login: function() {
        this.init()
    },
    __logout: function() {
        this.init()
    },
    setCityDone: function() {
        $('#city_set_ifr').hide();
        $('#weather-xs').show();
    },
    WData_callback: function(dis) {
        var T = this,
        city = this.city = dis ? dis.split('_')[1] : WData[1],
        district = dis ? dis.split('_')[0] : WData[1],
        prov = dis ? dis.split('_')[2] : "北京上海重庆天津".indexOf(WData[3]) == -1 ? WData[3] : '直辖市',
        cookie = district + '_' + city + '_' + prov;
        var __timer = setTimeout(function() {
            $.getScript('http://w.1616.net/chaxun/iptolocal.php',
            function() {
                T.WData_callback()
            });
        },
        8000);
        $.getScriptEx('http://r.61658.com/grab/weather/' + euc(euc(city == district ? district: district + city)) + '.js',
        function() {
            T.w_callback();
            clearTimeout(__timer);
            J1616.www.config('weather', J1616.obj2str(cookie),
            function(e) {
                if (J1616.str2obj(e).code == 1) {
                    J1616.Util.setCookie('city', cookie, null, null, J1616.Util.getDomain());
                }
            });
        },
        true)
    },
    w_callback: function() {
        if (!window.J1616_weather_info) return;
        var info = J1616_weather_info['info']['today'],
        ih = this.city + '&nbsp;<img src="http://r.61658.com/weather/img/s/' + info.图标 [0] + '.png">&nbsp;' + info.气温 + '，&nbsp;&nbsp;' + info.描述 [0];
        $('#weather-xs').html('<a href=http://weather.1616.net>' + ih + '</a><a id=t-w-dz target=_self href="javascript:J1616.www.weather.setCity()">[定制]</a>');
    },
    run: function() {
        this.init()
    },
    init: function() {
        var T = this;
        this.W.config('weather',
        function(district) {
            district = J1616.str2obj(district);
            if (district) T.WData_callback(district);
            else $.getScript('http://w.1616.net/chaxun/iptolocal.php',
            function() {
                T.WData_callback()
            });
        });
    }
};*/
J1616.www.version = {
    init: function() {
        var timer;
        $('#banben-a').mouseover(function() {
            $('#banben-qh').show();
        }).mouseleave(function() {
            timer = setTimeout(function() {
                $('#banben-qh').hide();
            },
            10);
        });
        $('#banben-qh').mouseenter(function() {
            $(this).show();
            clearTimeout(timer);
        }).click(function() {
            $(this).hide();
        }).mouseleave(function() {
            $(this).hide();
        });
        $("#banben-qh>a").click(function() {
/*            var c = J1616.str2obj(( !! J1616.www.cfgs["my1616"]) ? J1616.obj2str({
                th: "green",
                ft: 1,
                bg: 1,
                tpg: "1-1",
                lo: 0,
                m: "jj"
            }) : J1616.www.cfgs["my1616"]),
            _h = $(this).attr("_h");
            c["m"] = _h;
            s16(1, ["pn", "名站导航", "u", "#", "t", $(this).text()]);
            J1616.www.cfgs["my1616"] = J1616.obj2str(c);
            J1616.Util.setCookie("J1616_www_my1616", J1616.obj2str(c));
            $('#banben-a').html($(this).text() + "<em></em>");
            location.href = (_h == "i") ? "/jd/": "/jd/" + _h + ".htm";
            return false*/
        });
    }
};
jQuery.ui || (function(a) {
    a.ui = {
        version: "1.8",
        plugin: {
            add: function(c, d, f) {
                var e = a.ui[c].prototype;
                for (var b in f) {
                    e.plugins[b] = e.plugins[b] || [];
                    e.plugins[b].push([d, f[b]])
                }
            },
            call: function(b, d, c) {
                var f = b.plugins[d];
                if (!f || !b.element[0].parentNode) {
                    return
                }
                for (var e = 0; e < f.length; e++) {
                    if (b.options[f[e][0]]) {
                        f[e][1].apply(b.element, c)
                    }
                }
            }
        },
        contains: function(d, c) {
            return document.compareDocumentPosition ? d.compareDocumentPosition(c) & 16 : d !== c && d.contains(c)
        },
        hasScroll: function(e, c) {
            if (a(e).css("overflow") == "hidden") {
                return false
            }
            var b = (c && c == "left") ? "scrollLeft": "scrollTop",
            d = false;
            if (e[b] > 0) {
                return true
            }
            e[b] = 1;
            d = (e[b] > 0);
            e[b] = 0;
            return d
        },
        isOverAxis: function(c, b, d) {
            return (c > b) && (c < (b + d))
        },
        isOver: function(g, c, f, e, b, d) {
            return a.ui.isOverAxis(g, f, b) && a.ui.isOverAxis(c, e, d)
        },
        keyCode: {
            BACKSPACE: 8,
            CAPS_LOCK: 20,
            COMMA: 188,
            CONTROL: 17,
            DELETE: 46,
            DOWN: 40,
            END: 35,
            ENTER: 13,
            ESCAPE: 27,
            HOME: 36,
            INSERT: 45,
            LEFT: 37,
            NUMPAD_ADD: 107,
            NUMPAD_DECIMAL: 110,
            NUMPAD_DIVIDE: 111,
            NUMPAD_ENTER: 108,
            NUMPAD_MULTIPLY: 106,
            NUMPAD_SUBTRACT: 109,
            PAGE_DOWN: 34,
            PAGE_UP: 33,
            PERIOD: 190,
            RIGHT: 39,
            SHIFT: 16,
            SPACE: 32,
            TAB: 9,
            UP: 38
        }
    };
    a.fn.extend({
        _focus: a.fn.focus,
        focus: function(b, c) {
            return typeof b === "number" ? this.each(function() {
                var d = this;
                setTimeout(function() {
                    a(d).focus(); (c && c.call(d))
                },
                b)
            }) : this._focus.apply(this, arguments)
        },
        enableSelection: function() {
            return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui")
        },
        disableSelection: function() {
            return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui",
            function() {
                return false
            })
        },
        scrollParent: function() {
            var b;
            if ((a.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
                b = this.parents().filter(function() {
                    return (/(relative|absolute|fixed)/).test(a.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(a.curCSS(this, "overflow", 1) + a.curCSS(this, "overflow-y", 1) + a.curCSS(this, "overflow-x", 1))
                }).eq(0)
            } else {
                b = this.parents().filter(function() {
                    return (/(auto|scroll)/).test(a.curCSS(this, "overflow", 1) + a.curCSS(this, "overflow-y", 1) + a.curCSS(this, "overflow-x", 1))
                }).eq(0)
            }
            return (/fixed/).test(this.css("position")) || !b.length ? a(document) : b
        },
        zIndex: function(e) {
            if (e !== undefined) {
                return this.css("zIndex", e)
            }
            if (this.length) {
                var c = a(this[0]),
                b,
                d;
                while (c.length && c[0] !== document) {
                    b = c.css("position");
                    if (b == "absolute" || b == "relative" || b == "fixed") {
                        d = parseInt(c.css("zIndex"));
                        if (!isNaN(d) && d != 0) {
                            return d
                        }
                    }
                    c = c.parent()
                }
            }
            return 0
        }
    });
    a.extend(a.expr[":"], {
        data: function(d, c, b) {
            return !! a.data(d, b[3])
        },
        focusable: function(c) {
            var d = c.nodeName.toLowerCase(),
            b = a.attr(c, "tabindex");
            return (/input|select|textarea|button|object/.test(d) ? !c.disabled: "a" == d || "area" == d ? c.href || !isNaN(b) : !isNaN(b)) && !a(c)["area" == d ? "parents": "closest"](":hidden").length
        },
        tabbable: function(c) {
            var b = a.attr(c, "tabindex");
            return (isNaN(b) || b >= 0) && a(c).is(":focusable")
        }
    })
})(jQuery);; (function(b) {
    var a = b.fn.remove;
    b.fn.remove = function(c, d) {
        return this.each(function() {
            if (!d) {
                if (!c || b.filter(c, [this]).length) {
                    b("*", this).add(this).each(function() {
                        b(this).triggerHandler("remove")
                    })
                }
            }
            return a.call(b(this), c, d)
        })
    };
    b.widget = function(d, f, c) {
        var e = d.split(".")[0],
        h;
        d = d.split(".")[1];
        h = e + "-" + d;
        if (!c) {
            c = f;
            f = b.Widget
        }
        b.expr[":"][h] = function(i) {
            return !! b.data(i, d)
        };
        b[e] = b[e] || {};
        b[e][d] = function(i, j) {
            if (arguments.length) {
                this._createWidget(i, j)
            }
        };
        var g = new f();
        g.options = b.extend({},
        g.options);
        b[e][d].prototype = b.extend(true, g, {
            namespace: e,
            widgetName: d,
            widgetEventPrefix: b[e][d].prototype.widgetEventPrefix || d,
            widgetBaseClass: h
        },
        c);
        b.widget.bridge(d, b[e][d])
    };
    b.widget.bridge = function(d, c) {
        b.fn[d] = function(g) {
            var e = typeof g === "string",
            f = Array.prototype.slice.call(arguments, 1),
            h = this;
            g = !e && f.length ? b.extend.apply(null, [true, g].concat(f)) : g;
            if (e && g.substring(0, 1) === "_") {
                return h
            }
            if (e) {
                this.each(function() {
                    var i = b.data(this, d),
                    j = i && b.isFunction(i[g]) ? i[g].apply(i, f) : i;
                    if (j !== i && j !== undefined) {
                        h = j;
                        return false
                    }
                })
            } else {
                this.each(function() {
                    var i = b.data(this, d);
                    if (i) {
                        if (g) {
                            i.option(g)
                        }
                        i._init()
                    } else {
                        b.data(this, d, new c(g, this))
                    }
                })
            }
            return h
        }
    };
    b.Widget = function(c, d) {
        if (arguments.length) {
            this._createWidget(c, d)
        }
    };
    b.Widget.prototype = {
        widgetName: "widget",
        widgetEventPrefix: "",
        options: {
            disabled: false
        },
        _createWidget: function(d, e) {
            this.element = b(e).data(this.widgetName, this);
            this.options = b.extend(true, {},
            this.options, b.metadata && b.metadata.get(e)[this.widgetName], d);
            var c = this;
            this.element.bind("remove." + this.widgetName,
            function() {
                c.destroy()
            });
            this._create();
            this._init()
        },
        _create: function() {},
        _init: function() {},
        destroy: function() {
            this.element.unbind("." + this.widgetName).removeData(this.widgetName);
            this.widget().unbind("." + this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled")
        },
        widget: function() {
            return this.element
        },
        option: function(e, f) {
            var d = e,
            c = this;
            if (arguments.length === 0) {
                return b.extend({},
                c.options)
            }
            if (typeof e === "string") {
                if (f === undefined) {
                    return this.options[e]
                }
                d = {};
                d[e] = f
            }
            b.each(d,
            function(g, h) {
                c._setOption(g, h)
            });
            return c
        },
        _setOption: function(c, d) {
            this.options[c] = d;
            if (c === "disabled") {
                this.widget()[d ? "addClass": "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", d)
            }
            return this
        },
        enable: function() {
            return this._setOption("disabled", false)
        },
        disable: function() {
            return this._setOption("disabled", true)
        },
        _trigger: function(d, e, f) {
            var h = this.options[d];
            e = b.Event(e);
            e.type = (d === this.widgetEventPrefix ? d: this.widgetEventPrefix + d).toLowerCase();
            f = f || {};
            if (e.originalEvent) {
                for (var c = b.event.props.length,
                g; c;) {
                    g = b.event.props[--c];
                    e[g] = e.originalEvent[g]
                }
            }
            this.element.trigger(e, f);
            return ! (b.isFunction(h) && h.call(this.element[0], e, f) === false || e.isDefaultPrevented())
        }
    }
})(jQuery);
(function(a) {
    a.widget("ui.mouse", {
        options: {
            cancel: ":input,option",
            distance: 1,
            delay: 0
        },
        _mouseInit: function() {
            var b = this;
            this.element.bind("mousedown." + this.widgetName,
            function(c) {
                return b._mouseDown(c)
            }).bind("click." + this.widgetName,
            function(c) {
                if (b._preventClickEvent) {
                    b._preventClickEvent = false;
                    c.stopImmediatePropagation();
                    return false
                }
            });
            this.started = false
        },
        _mouseDestroy: function() {
            this.element.unbind("." + this.widgetName)
        },
        _mouseDown: function(d) {
            d.originalEvent = d.originalEvent || {};
            if (d.originalEvent.mouseHandled) {
                return
            } (this._mouseStarted && this._mouseUp(d));
            this._mouseDownEvent = d;
            var c = this,
            e = (d.which == 1),
            b = (typeof this.options.cancel == "string" ? a(d.target).parents().add(d.target).filter(this.options.cancel).length: false);
            if (!e || b || !this._mouseCapture(d)) {
                return true
            }
            this.mouseDelayMet = !this.options.delay;
            if (!this.mouseDelayMet) {
                this._mouseDelayTimer = setTimeout(function() {
                    c.mouseDelayMet = true
                },
                this.options.delay)
            }
            if (this._mouseDistanceMet(d) && this._mouseDelayMet(d)) {
                this._mouseStarted = (this._mouseStart(d) !== false);
                if (!this._mouseStarted) {
                    d.preventDefault();
                    return true
                }
            }
            this._mouseMoveDelegate = function(f) {
                return c._mouseMove(f)
            };
            this._mouseUpDelegate = function(f) {
                return c._mouseUp(f)
            };
            a(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (a.browser.safari || d.preventDefault());
            d.originalEvent.mouseHandled = true;
            return true
        },
        _mouseMove: function(b) {
            if (a.browser.msie && !b.button) {
                return this._mouseUp(b)
            }
            if (this._mouseStarted) {
                this._mouseDrag(b);
                return b.preventDefault()
            }
            if (this._mouseDistanceMet(b) && this._mouseDelayMet(b)) {
                this._mouseStarted = (this._mouseStart(this._mouseDownEvent, b) !== false); (this._mouseStarted ? this._mouseDrag(b) : this._mouseUp(b))
            }
            return ! this._mouseStarted
        },
        _mouseUp: function(b) {
            a(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
            if (this._mouseStarted) {
                this._mouseStarted = false;
                this._preventClickEvent = (b.target == this._mouseDownEvent.target);
                this._mouseStop(b)
            }
            return false
        },
        _mouseDistanceMet: function(b) {
            return (Math.max(Math.abs(this._mouseDownEvent.pageX - b.pageX), Math.abs(this._mouseDownEvent.pageY - b.pageY)) >= this.options.distance)
        },
        _mouseDelayMet: function(b) {
            return this.mouseDelayMet
        },
        _mouseStart: function(b) {},
        _mouseDrag: function(b) {},
        _mouseStop: function(b) {},
        _mouseCapture: function(b) {
            return true
        }
    })
})(jQuery);
(function(a) {
    a.widget("ui.sortable", a.ui.mouse, {
        widgetEventPrefix: "sort",
        options: {
            appendTo: "parent",
            axis: false,
            connectWith: false,
            containment: false,
            cursor: "auto",
            cursorAt: false,
            dropOnEmpty: true,
            forcePlaceholderSize: false,
            forceHelperSize: false,
            grid: false,
            handle: false,
            helper: "original",
            items: "> *",
            opacity: false,
            placeholder: false,
            revert: false,
            scroll: true,
            scrollSensitivity: 20,
            scrollSpeed: 20,
            scope: "default",
            tolerance: "intersect",
            zIndex: 1000
        },
        _create: function() {
            var b = this.options;
            this.containerCache = {};
            this.element.addClass("ui-sortable");
            this.refresh();
            this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css("float")) : false;
            this.offset = this.element.offset();
            this._mouseInit()
        },
        destroy: function() {
            this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");
            this._mouseDestroy();
            for (var b = this.items.length - 1; b >= 0; b--) {
                this.items[b].item.removeData("sortable-item")
            }
            return this
        },
        _mouseCapture: function(e, f) {
            if (this.reverting) {
                return false
            }
            if (this.options.disabled || this.options.type == "static") {
                return false
            }
            this._refreshItems(e);
            var d = null,
            c = this,
            b = a(e.target).parents().each(function() {
                if (a.data(this, "sortable-item") == c) {
                    d = a(this);
                    return false
                }
            });
            if (a.data(e.target, "sortable-item") == c) {
                d = a(e.target)
            }
            if (!d) {
                return false
            }
            if (this.options.handle && !f) {
                var g = false;
                a(this.options.handle, d).find("*").andSelf().each(function() {
                    if (this == e.target) {
                        g = true
                    }
                });
                if (!g) {
                    return false
                }
            }
            this.currentItem = d;
            this._removeCurrentsFromItems();
            return true
        },
        _mouseStart: function(e, f, b) {
            var g = this.options,
            c = this;
            this.currentContainer = this;
            this.refreshPositions();
            this.helper = this._createHelper(e);
            this._cacheHelperProportions();
            this._cacheMargins();
            this.scrollParent = this.helper.scrollParent();
            this.offset = this.currentItem.offset();
            this.offset = {
                top: this.offset.top - this.margins.top,
                left: this.offset.left - this.margins.left
            };
            this.helper.css("position", "absolute");
            this.cssPosition = this.helper.css("position");
            a.extend(this.offset, {
                click: {
                    left: e.pageX - this.offset.left,
                    top: e.pageY - this.offset.top
                },
                parent: this._getParentOffset(),
                relative: this._getRelativeOffset()
            });
            this.originalPosition = this._generatePosition(e);
            this.originalPageX = e.pageX;
            this.originalPageY = e.pageY; (g.cursorAt && this._adjustOffsetFromHelper(g.cursorAt));
            this.domPosition = {
                prev: this.currentItem.prev()[0],
                parent: this.currentItem.parent()[0]
            };
            if (this.helper[0] != this.currentItem[0]) {
                this.currentItem.hide()
            }
            this._createPlaceholder();
            if (g.containment) {
                this._setContainment()
            }
            if (g.cursor) {
                if (a("body").css("cursor")) {
                    this._storedCursor = a("body").css("cursor")
                }
                a("body").css("cursor", g.cursor)
            }
            if (g.opacity) {
                if (this.helper.css("opacity")) {
                    this._storedOpacity = this.helper.css("opacity")
                }
                this.helper.css("opacity", g.opacity)
            }
            if (g.zIndex) {
                if (this.helper.css("zIndex")) {
                    this._storedZIndex = this.helper.css("zIndex")
                }
                this.helper.css("zIndex", g.zIndex)
            }
            if (this.scrollParent[0] != document && this.scrollParent[0].tagName != "HTML") {
                this.overflowOffset = this.scrollParent.offset()
            }
            this._trigger("start", e, this._uiHash());
            if (!this._preserveHelperProportions) {
                this._cacheHelperProportions()
            }
            if (!b) {
                for (var d = this.containers.length - 1; d >= 0; d--) {
                    this.containers[d]._trigger("activate", e, c._uiHash(this))
                }
            }
            if (a.ui.ddmanager) {
                a.ui.ddmanager.current = this
            }
            if (a.ui.ddmanager && !g.dropBehaviour) {
                a.ui.ddmanager.prepareOffsets(this, e)
            }
            this.dragging = true;
            this.helper.addClass("ui-sortable-helper");
            this._mouseDrag(e);
            return true
        },
        _mouseDrag: function(f) {
            this.position = this._generatePosition(f);
            this.positionAbs = this._convertPositionTo("absolute");
            if (!this.lastPositionAbs) {
                this.lastPositionAbs = this.positionAbs
            }
            if (this.options.scroll) {
                var g = this.options,
                b = false;
                if (this.scrollParent[0] != document && this.scrollParent[0].tagName != "HTML") {
                    if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - f.pageY < g.scrollSensitivity) {
                        this.scrollParent[0].scrollTop = b = this.scrollParent[0].scrollTop + g.scrollSpeed
                    } else {
                        if (f.pageY - this.overflowOffset.top < g.scrollSensitivity) {
                            this.scrollParent[0].scrollTop = b = this.scrollParent[0].scrollTop - g.scrollSpeed
                        }
                    }
                    if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - f.pageX < g.scrollSensitivity) {
                        this.scrollParent[0].scrollLeft = b = this.scrollParent[0].scrollLeft + g.scrollSpeed
                    } else {
                        if (f.pageX - this.overflowOffset.left < g.scrollSensitivity) {
                            this.scrollParent[0].scrollLeft = b = this.scrollParent[0].scrollLeft - g.scrollSpeed
                        }
                    }
                } else {
                    if (f.pageY - a(document).scrollTop() < g.scrollSensitivity) {
                        b = a(document).scrollTop(a(document).scrollTop() - g.scrollSpeed)
                    } else {
                        if (a(window).height() - (f.pageY - a(document).scrollTop()) < g.scrollSensitivity) {
                            b = a(document).scrollTop(a(document).scrollTop() + g.scrollSpeed)
                        }
                    }
                    if (f.pageX - a(document).scrollLeft() < g.scrollSensitivity) {
                        b = a(document).scrollLeft(a(document).scrollLeft() - g.scrollSpeed)
                    } else {
                        if (a(window).width() - (f.pageX - a(document).scrollLeft()) < g.scrollSensitivity) {
                            b = a(document).scrollLeft(a(document).scrollLeft() + g.scrollSpeed)
                        }
                    }
                }
                if (b !== false && a.ui.ddmanager && !g.dropBehaviour) {
                    a.ui.ddmanager.prepareOffsets(this, f)
                }
            }
            this.positionAbs = this._convertPositionTo("absolute");
            if (!this.options.axis || this.options.axis != "y") {
                this.helper[0].style.left = this.position.left + "px"
            }
            if (!this.options.axis || this.options.axis != "x") {
                this.helper[0].style.top = this.position.top + "px"
            }
            for (var d = this.items.length - 1; d >= 0; d--) {
                var e = this.items[d],
                c = e.item[0],
                h = this._intersectsWithPointer(e);
                if (!h) {
                    continue
                }
                if (c != this.currentItem[0] && this.placeholder[h == 1 ? "next": "prev"]()[0] != c && !a.ui.contains(this.placeholder[0], c) && (this.options.type == "semi-dynamic" ? !a.ui.contains(this.element[0], c) : true)) {
                    this.direction = h == 1 ? "down": "up";
                    if (this.options.tolerance == "pointer" || this._intersectsWithSides(e)) {
                        this._rearrange(f, e)
                    } else {
                        break
                    }
                    this._trigger("change", f, this._uiHash());
                    break
                }
            }
            this._contactContainers(f);
            if (a.ui.ddmanager) {
                a.ui.ddmanager.drag(this, f)
            }
            this._trigger("sort", f, this._uiHash());
            this.lastPositionAbs = this.positionAbs;
            return false
        },
        _mouseStop: function(c, d) {
            if (!c) {
                return
            }
            if (a.ui.ddmanager && !this.options.dropBehaviour) {
                a.ui.ddmanager.drop(this, c)
            }
            if (this.options.revert) {
                var b = this;
                var e = b.placeholder.offset();
                b.reverting = true;
                a(this.helper).animate({
                    left: e.left - this.offset.parent.left - b.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
                    top: e.top - this.offset.parent.top - b.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
                },
                parseInt(this.options.revert, 10) || 500,
                function() {
                    b._clear(c)
                })
            } else {
                this._clear(c, d)
            }
            return false
        },
        cancel: function() {
            var b = this;
            if (this.dragging) {
                this._mouseUp();
                if (this.options.helper == "original") {
                    this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")
                } else {
                    this.currentItem.show()
                }
                for (var c = this.containers.length - 1; c >= 0; c--) {
                    this.containers[c]._trigger("deactivate", null, b._uiHash(this));
                    if (this.containers[c].containerCache.over) {
                        this.containers[c]._trigger("out", null, b._uiHash(this));
                        this.containers[c].containerCache.over = 0
                    }
                }
            }
            if (this.placeholder[0].parentNode) {
                this.placeholder[0].parentNode.removeChild(this.placeholder[0])
            }
            if (this.options.helper != "original" && this.helper && this.helper[0].parentNode) {
                this.helper.remove()
            }
            a.extend(this, {
                helper: null,
                dragging: false,
                reverting: false,
                _noFinalSort: null
            });
            if (this.domPosition.prev) {
                a(this.domPosition.prev).after(this.currentItem)
            } else {
                a(this.domPosition.parent).prepend(this.currentItem)
            }
            return this
        },
        serialize: function(d) {
            var b = this._getItemsAsjQuery(d && d.connected);
            var c = [];
            d = d || {};
            a(b).each(function() {
                var e = (a(d.item || this).attr(d.attribute || "id") || "").match(d.expression || (/(.+)[-=_](.+)/));
                if (e) {
                    c.push((d.key || e[1] + "[]") + "=" + (d.key && d.expression ? e[1] : e[2]))
                }
            });
            return c.join("&")
        },
        toArray: function(d) {
            var b = this._getItemsAsjQuery(d && d.connected);
            var c = [];
            d = d || {};
            b.each(function() {
                c.push(a(d.item || this).attr(d.attribute || "id") || "")
            });
            return c
        },
        _intersectsWith: function(m) {
            var e = this.positionAbs.left,
            d = e + this.helperProportions.width,
            k = this.positionAbs.top,
            j = k + this.helperProportions.height;
            var f = m.left,
            c = f + m.width,
            n = m.top,
            i = n + m.height;
            var o = this.offset.click.top,
            h = this.offset.click.left;
            var g = (k + o) > n && (k + o) < i && (e + h) > f && (e + h) < c;
            if (this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? "width": "height"] > m[this.floating ? "width": "height"])) {
                return g
            } else {
                return (f < e + (this.helperProportions.width / 2) && d - (this.helperProportions.width / 2) < c && n < k + (this.helperProportions.height / 2) && j - (this.helperProportions.height / 2) < i)
            }
        },
        _intersectsWithPointer: function(d) {
            var e = a.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, d.top, d.height),
            c = a.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, d.left, d.width),
            g = e && c,
            b = this._getDragVerticalDirection(),
            f = this._getDragHorizontalDirection();
            if (!g) {
                return false
            }
            return this.floating ? (((f && f == "right") || b == "down") ? 2 : 1) : (b && (b == "down" ? 2 : 1))
        },
        _intersectsWithSides: function(e) {
            var c = a.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, e.top + (e.height / 2), e.height),
            d = a.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, e.left + (e.width / 2), e.width),
            b = this._getDragVerticalDirection(),
            f = this._getDragHorizontalDirection();
            if (this.floating && f) {
                return ((f == "right" && d) || (f == "left" && !d))
            } else {
                return b && ((b == "down" && c) || (b == "up" && !c))
            }
        },
        _getDragVerticalDirection: function() {
            var b = this.positionAbs.top - this.lastPositionAbs.top;
            return b != 0 && (b > 0 ? "down": "up")
        },
        _getDragHorizontalDirection: function() {
            var b = this.positionAbs.left - this.lastPositionAbs.left;
            return b != 0 && (b > 0 ? "right": "left")
        },
        refresh: function(b) {
            this._refreshItems(b);
            this.refreshPositions();
            return this
        },
        _connectWith: function() {
            var b = this.options;
            return b.connectWith.constructor == String ? [b.connectWith] : b.connectWith
        },
        _getItemsAsjQuery: function(b) {
            var l = this;
            var g = [];
            var e = [];
            var h = this._connectWith();
            if (h && b) {
                for (var d = h.length - 1; d >= 0; d--) {
                    var k = a(h[d]);
                    for (var c = k.length - 1; c >= 0; c--) {
                        var f = a.data(k[c], "sortable");
                        if (f && f != this && !f.options.disabled) {
                            e.push([a.isFunction(f.options.items) ? f.options.items.call(f.element) : a(f.options.items, f.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), f])
                        }
                    }
                }
            }
            e.push([a.isFunction(this.options.items) ? this.options.items.call(this.element, null, {
                options: this.options,
                item: this.currentItem
            }) : a(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
            for (var d = e.length - 1; d >= 0; d--) {
                e[d][0].each(function() {
                    g.push(this)
                })
            }
            return a(g)
        },
        _removeCurrentsFromItems: function() {
            var d = this.currentItem.find(":data(sortable-item)");
            for (var c = 0; c < this.items.length; c++) {
                for (var b = 0; b < d.length; b++) {
                    if (d[b] == this.items[c].item[0]) {
                        this.items.splice(c, 1)
                    }
                }
            }
        },
        _refreshItems: function(b) {
            this.items = [];
            this.containers = [this];
            var h = this.items;
            var p = this;
            var f = [[a.isFunction(this.options.items) ? this.options.items.call(this.element[0], b, {
                item: this.currentItem
            }) : a(this.options.items, this.element), this]];
            var l = this._connectWith();
            if (l) {
                for (var e = l.length - 1; e >= 0; e--) {
                    var m = a(l[e]);
                    for (var d = m.length - 1; d >= 0; d--) {
                        var g = a.data(m[d], "sortable");
                        if (g && g != this && !g.options.disabled) {
                            f.push([a.isFunction(g.options.items) ? g.options.items.call(g.element[0], b, {
                                item: this.currentItem
                            }) : a(g.options.items, g.element), g]);
                            this.containers.push(g)
                        }
                    }
                }
            }
            for (var e = f.length - 1; e >= 0; e--) {
                var k = f[e][1];
                var c = f[e][0];
                for (var d = 0,
                n = c.length; d < n; d++) {
                    var o = a(c[d]);
                    o.data("sortable-item", k);
                    h.push({
                        item: o,
                        instance: k,
                        width: 0,
                        height: 0,
                        left: 0,
                        top: 0
                    })
                }
            }
        },
        refreshPositions: function(b) {
            if (this.offsetParent && this.helper) {
                this.offset.parent = this._getParentOffset()
            }
            for (var d = this.items.length - 1; d >= 0; d--) {
                var e = this.items[d];
                var c = this.options.toleranceElement ? a(this.options.toleranceElement, e.item) : e.item;
                if (!b) {
                    e.width = c.outerWidth();
                    e.height = c.outerHeight()
                }
                var f = c.offset();
                e.left = f.left;
                e.top = f.top
            }
            if (this.options.custom && this.options.custom.refreshContainers) {
                this.options.custom.refreshContainers.call(this)
            } else {
                for (var d = this.containers.length - 1; d >= 0; d--) {
                    var f = this.containers[d].element.offset();
                    this.containers[d].containerCache.left = f.left;
                    this.containers[d].containerCache.top = f.top;
                    this.containers[d].containerCache.width = this.containers[d].element.outerWidth();
                    this.containers[d].containerCache.height = this.containers[d].element.outerHeight()
                }
            }
            return this
        },
        _createPlaceholder: function(d) {
            var b = d || this,
            e = b.options;
            if (!e.placeholder || e.placeholder.constructor == String) {
                var c = e.placeholder;
                e.placeholder = {
                    element: function() {
                        var f = a(document.createElement(b.currentItem[0].nodeName)).addClass(c || b.currentItem[0].className + " ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];
                        if (!c) {
                            f.style.visibility = "hidden"
                        }
                        return f
                    },
                    update: function(f, g) {
                        if (c && !e.forcePlaceholderSize) {
                            return
                        }
                        if (!g.height()) {
                            g.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10))
                        }
                        if (!g.width()) {
                            g.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10))
                        }
                    }
                }
            }
            b.placeholder = a(e.placeholder.element.call(b.element, b.currentItem));
            b.currentItem.after(b.placeholder);
            e.placeholder.update(b, b.placeholder)
        },
        _contactContainers: function(b) {
            var d = null,
            k = null;
            for (var f = this.containers.length - 1; f >= 0; f--) {
                if (a.ui.contains(this.currentItem[0], this.containers[f].element[0])) {
                    continue
                }
                if (this._intersectsWith(this.containers[f].containerCache)) {
                    if (d && a.ui.contains(this.containers[f].element[0], d.element[0])) {
                        continue
                    }
                    d = this.containers[f];
                    k = f
                } else {
                    if (this.containers[f].containerCache.over) {
                        this.containers[f]._trigger("out", b, this._uiHash(this));
                        this.containers[f].containerCache.over = 0
                    }
                }
            }
            if (!d) {
                return
            }
            if (this.containers.length === 1) {
                this.containers[k]._trigger("over", b, this._uiHash(this));
                this.containers[k].containerCache.over = 1
            } else {
                if (this.currentContainer != this.containers[k]) {
                    var h = 10000;
                    var g = null;
                    var c = this.positionAbs[this.containers[k].floating ? "left": "top"];
                    for (var e = this.items.length - 1; e >= 0; e--) {
                        if (!a.ui.contains(this.containers[k].element[0], this.items[e].item[0])) {
                            continue
                        }
                        var l = this.items[e][this.containers[k].floating ? "left": "top"];
                        if (Math.abs(l - c) < h) {
                            h = Math.abs(l - c);
                            g = this.items[e]
                        }
                    }
                    if (!g && !this.options.dropOnEmpty) {
                        return
                    }
                    this.currentContainer = this.containers[k];
                    g ? this._rearrange(b, g, null, true) : this._rearrange(b, null, this.containers[k].element, true);
                    this._trigger("change", b, this._uiHash());
                    this.containers[k]._trigger("change", b, this._uiHash(this));
                    this.options.placeholder.update(this.currentContainer, this.placeholder);
                    this.containers[k]._trigger("over", b, this._uiHash(this));
                    this.containers[k].containerCache.over = 1
                }
            }
        },
        _createHelper: function(c) {
            var d = this.options;
            var b = a.isFunction(d.helper) ? a(d.helper.apply(this.element[0], [c, this.currentItem])) : (d.helper == "clone" ? this.currentItem.clone() : this.currentItem);
            if (!b.parents("body").length) {
                a(d.appendTo != "parent" ? d.appendTo: this.currentItem[0].parentNode)[0].appendChild(b[0])
            }
            if (b[0] == this.currentItem[0]) {
                this._storedCSS = {
                    width: this.currentItem[0].style.width,
                    height: this.currentItem[0].style.height,
                    position: this.currentItem.css("position"),
                    top: this.currentItem.css("top"),
                    left: this.currentItem.css("left")
                }
            }
            if (b[0].style.width == "" || d.forceHelperSize) {
                b.width(this.currentItem.width())
            }
            if (b[0].style.height == "" || d.forceHelperSize) {
                b.height(this.currentItem.height())
            }
            return b
        },
        _adjustOffsetFromHelper: function(b) {
            if (typeof b == "string") {
                b = b.split(" ")
            }
            if (a.isArray(b)) {
                b = {
                    left: +b[0],
                    top: +b[1] || 0
                }
            }
            if ("left" in b) {
                this.offset.click.left = b.left + this.margins.left
            }
            if ("right" in b) {
                this.offset.click.left = this.helperProportions.width - b.right + this.margins.left
            }
            if ("top" in b) {
                this.offset.click.top = b.top + this.margins.top
            }
            if ("bottom" in b) {
                this.offset.click.top = this.helperProportions.height - b.bottom + this.margins.top
            }
        },
        _getParentOffset: function() {
            this.offsetParent = this.helper.offsetParent();
            var b = this.offsetParent.offset();
            if (this.cssPosition == "absolute" && this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
                b.left += this.scrollParent.scrollLeft();
                b.top += this.scrollParent.scrollTop()
            }
            if ((this.offsetParent[0] == document.body) || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == "html" && a.browser.msie)) {
                b = {
                    top: 0,
                    left: 0
                }
            }
            return {
                top: b.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
                left: b.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
            }
        },
        _getRelativeOffset: function() {
            if (this.cssPosition == "relative") {
                var b = this.currentItem.position();
                return {
                    top: b.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(),
                    left: b.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()
                }
            } else {
                return {
                    top: 0,
                    left: 0
                }
            }
        },
        _cacheMargins: function() {
            this.margins = {
                left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0),
                top: (parseInt(this.currentItem.css("marginTop"), 10) || 0)
            }
        },
        _cacheHelperProportions: function() {
            this.helperProportions = {
                width: this.helper.outerWidth(),
                height: this.helper.outerHeight()
            }
        },
        _setContainment: function() {
            var e = this.options;
            if (e.containment == "parent") {
                e.containment = this.helper[0].parentNode
            }
            if (e.containment == "document" || e.containment == "window") {
                this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, a(e.containment == "document" ? document: window).width() - this.helperProportions.width - this.margins.left, (a(e.containment == "document" ? document: window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]
            }
            if (! (/^(document|window|parent)$/).test(e.containment)) {
                var c = a(e.containment)[0];
                var d = a(e.containment).offset();
                var b = (a(c).css("overflow") != "hidden");
                this.containment = [d.left + (parseInt(a(c).css("borderLeftWidth"), 10) || 0) + (parseInt(a(c).css("paddingLeft"), 10) || 0) - this.margins.left, d.top + (parseInt(a(c).css("borderTopWidth"), 10) || 0) + (parseInt(a(c).css("paddingTop"), 10) || 0) - this.margins.top, d.left + (b ? Math.max(c.scrollWidth, c.offsetWidth) : c.offsetWidth) - (parseInt(a(c).css("borderLeftWidth"), 10) || 0) - (parseInt(a(c).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, d.top + (b ? Math.max(c.scrollHeight, c.offsetHeight) : c.offsetHeight) - (parseInt(a(c).css("borderTopWidth"), 10) || 0) - (parseInt(a(c).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]
            }
        },
        _convertPositionTo: function(f, h) {
            if (!h) {
                h = this.position
            }
            var c = f == "absolute" ? 1 : -1;
            var e = this.options,
            b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent: this.scrollParent,
            g = (/(html|body)/i).test(b[0].tagName);
            return {
                top: (h.top + this.offset.relative.top * c + this.offset.parent.top * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (g ? 0 : b.scrollTop())) * c)),
                left: (h.left + this.offset.relative.left * c + this.offset.parent.left * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : g ? 0 : b.scrollLeft()) * c))
            }
        },
        _generatePosition: function(e) {
            var h = this.options,
            b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent: this.scrollParent,
            i = (/(html|body)/i).test(b[0].tagName);
            if (this.cssPosition == "relative" && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
                this.offset.relative = this._getRelativeOffset()
            }
            var d = e.pageX;
            var c = e.pageY;
            if (this.originalPosition) {
                if (this.containment) {
                    if (e.pageX - this.offset.click.left < this.containment[0]) {
                        d = this.containment[0] + this.offset.click.left
                    }
                    if (e.pageY - this.offset.click.top < this.containment[1]) {
                        c = this.containment[1] + this.offset.click.top
                    }
                    if (e.pageX - this.offset.click.left > this.containment[2]) {
                        d = this.containment[2] + this.offset.click.left
                    }
                    if (e.pageY - this.offset.click.top > this.containment[3]) {
                        c = this.containment[3] + this.offset.click.top
                    }
                }
                if (h.grid) {
                    var g = this.originalPageY + Math.round((c - this.originalPageY) / h.grid[1]) * h.grid[1];
                    c = this.containment ? (!(g - this.offset.click.top < this.containment[1] || g - this.offset.click.top > this.containment[3]) ? g: (!(g - this.offset.click.top < this.containment[1]) ? g - h.grid[1] : g + h.grid[1])) : g;
                    var f = this.originalPageX + Math.round((d - this.originalPageX) / h.grid[0]) * h.grid[0];
                    d = this.containment ? (!(f - this.offset.click.left < this.containment[0] || f - this.offset.click.left > this.containment[2]) ? f: (!(f - this.offset.click.left < this.containment[0]) ? f - h.grid[0] : f + h.grid[0])) : f
                }
            }
            return {
                top: (c - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (i ? 0 : b.scrollTop())))),
                left: (d - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : i ? 0 : b.scrollLeft())))
            }
        },
        _rearrange: function(g, f, c, e) {
            c ? c[0].appendChild(this.placeholder[0]) : f.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == "down" ? f.item[0] : f.item[0].nextSibling));
            this.counter = this.counter ? ++this.counter: 1;
            var d = this,
            b = this.counter;
            window.setTimeout(function() {
                if (b == d.counter) {
                    d.refreshPositions(!e)
                }
            },
            0)
        },
        _clear: function(d, e) {
            this.reverting = false;
            var f = [],
            b = this;
            if (!this._noFinalSort && this.currentItem[0].parentNode) {
                this.placeholder.before(this.currentItem)
            }
            this._noFinalSort = null;
            if (this.helper[0] == this.currentItem[0]) {
                for (var c in this._storedCSS) {
                    if (this._storedCSS[c] == "auto" || this._storedCSS[c] == "static") {
                        this._storedCSS[c] = ""
                    }
                }
                this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")
            } else {
                this.currentItem.show()
            }
            if (this.fromOutside && !e) {
                f.push(function(g) {
                    this._trigger("receive", g, this._uiHash(this.fromOutside))
                })
            }
            if ((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !e) {
                f.push(function(g) {
                    this._trigger("update", g, this._uiHash())
                })
            }
            if (!a.ui.contains(this.element[0], this.currentItem[0])) {
                if (!e) {
                    f.push(function(g) {
                        this._trigger("remove", g, this._uiHash())
                    })
                }
                for (var c = this.containers.length - 1; c >= 0; c--) {
                    if (a.ui.contains(this.containers[c].element[0], this.currentItem[0]) && !e) {
                        f.push((function(g) {
                            return function(h) {
                                g._trigger("receive", h, this._uiHash(this))
                            }
                        }).call(this, this.containers[c]));
                        f.push((function(g) {
                            return function(h) {
                                g._trigger("update", h, this._uiHash(this))
                            }
                        }).call(this, this.containers[c]))
                    }
                }
            }
            for (var c = this.containers.length - 1; c >= 0; c--) {
                if (!e) {
                    f.push((function(g) {
                        return function(h) {
                            g._trigger("deactivate", h, this._uiHash(this))
                        }
                    }).call(this, this.containers[c]))
                }
                if (this.containers[c].containerCache.over) {
                    f.push((function(g) {
                        return function(h) {
                            g._trigger("out", h, this._uiHash(this))
                        }
                    }).call(this, this.containers[c]));
                    this.containers[c].containerCache.over = 0
                }
            }
            if (this._storedCursor) {
                a("body").css("cursor", this._storedCursor)
            }
            if (this._storedOpacity) {
                this.helper.css("opacity", this._storedOpacity)
            }
            if (this._storedZIndex) {
                this.helper.css("zIndex", this._storedZIndex == "auto" ? "": this._storedZIndex)
            }
            this.dragging = false;
            if (this.cancelHelperRemoval) {
                if (!e) {
                    this._trigger("beforeStop", d, this._uiHash());
                    for (var c = 0; c < f.length; c++) {
                        f[c].call(this, d)
                    }
                    this._trigger("stop", d, this._uiHash())
                }
                return false
            }
            if (!e) {
                this._trigger("beforeStop", d, this._uiHash())
            }
            this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
            if (this.helper[0] != this.currentItem[0]) {
                this.helper.remove()
            }
            this.helper = null;
            if (!e) {
                for (var c = 0; c < f.length; c++) {
                    f[c].call(this, d)
                }
                this._trigger("stop", d, this._uiHash())
            }
            this.fromOutside = false;
            return true
        },
        _trigger: function() {
            if (a.Widget.prototype._trigger.apply(this, arguments) === false) {
                this.cancel()
            }
        },
        _uiHash: function(c) {
            var b = c || this;
            return {
                helper: b.helper,
                placeholder: b.placeholder || a([]),
                position: b.position,
                originalPosition: b.originalPosition,
                offset: b.positionAbs,
                item: b.currentItem,
                sender: c ? c.element: null
            }
        }
    });
    a.extend(a.ui.sortable, {
        version: "1.8"
    })
})(jQuery);; (function($) {
    var a = $.ui.mouse.prototype._mouseMove;
    $.ui.mouse.prototype._mouseMove = function(b) {
        if ($.browser.msie && document.documentMode >= 9) {
            b.button = 1
        };
        a.apply(this, [b]);
    }
} (jQuery));


/*$.each(['weather', 'search', 'famous', 'version', 'index'],
function() {
    try {
        J1616.www[this]['init']();
    } catch(e) {
        J1616.Util.console("warn", this + ":" + e.toString())
    }
});*/

$.each(['search','famous','version', 'index'],
function() {
    try {
        J1616.www[this]['init']();
    } catch(e) {
        J1616.Util.console("warn", this + ":" + e.toString())
    }
});
function q$(id){return document.getElementById(id)}
function d_l_out(){
	window.location.reload();
	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";
		}
	})			
}
//名站导航=============
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!=""){
		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()";		
		
	}	
	

}



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
		};	
}






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$("log2").style.display=="none")
		d_ok(1);
	else
		d_ok(0);
	//右上角状态栏
	DvWnd.close();
	window.location.reload();
}


//绑定
var soojs_jj=qTcms.Cookie.get("soojsjj");
if(soojs_jj==null) 
	soojs_jj=0;
else
	if(soojs_jj=="")
		soojs_jj=0
if(soojs_jj!=0&&document.getElementById("p_skin_jinbi")){
	document.getElementById("p_skin_jinbi").innerHTML='<font color="#178517">本机'+G_jifen_jifen_name+'已经绑定</font>';	
}	

function qtcms_visit(evn){
	
	try{
		evn= evn ? evn : window.event;
		var s= (evn.target) ? evn.target : evn.srcElement;
		if(s.tagName == "A"  && s.href.indexOf("http://") == 0 && s.href.indexOf("http://"+location.host) != 0) 
			setVisitCookie(s);
		else if(s.tagName == "FONT"  && s.parentNode.href.indexOf("http://") == 0 && s.parentNode.href.indexOf("http://"+location.host) != 0) 
			setVisitCookie(s);
	}catch(e){}
}
function setVisitCookie(atag){
	if(atag.tagName == "FONT"){
		cookieValue = atag.parentNode.innerHTML.replace(/<\/*[^<>]*>/gi, "") + "|" + atag.parentNode.href;
	}else{
		cookieValue = atag.innerHTML + "|" + atag.href;	
	}
	
    if(!isVisited(cookieValue))
    {
        visitedArr = get360VisitedWeb();
        expire = 1000*3600*24*30;
        if(visitedArr)
        {
			
            visited = '';
            var maxlen = 20;
            var len = visitedArr.length >= maxlen ? maxlen-1 : visitedArr.length;
            for(var i=0; i< len; i++)
            {
                if(visitedArr[i] != '') visited = visited=='' ? visitedArr[i] : visited+"^^"+visitedArr[i];
            }
            setCookie(getVisitedCookieName(), cookieValue+"^^"+visited, expire);
			
        }
        else
        {
            setCookie(getVisitedCookieName(), cookieValue, expire);
			
        }
		
    }
    return ;
}

Array.prototype.in_array=function (e){
    for(var i=0; i<this.length;i++)
    {
        if(this[i] && e == this[i])
        return true;
    }
    return false;
}

function isVisited(cookieValue){
    visitedArr = get360VisitedWeb();
    if(visitedArr) return visitedArr.in_array(cookieValue);
    return false;
}


function getVisitedCookieName(){return "360WebUserVisited";}

function getVisited(){
    return getCookie(getVisitedCookieName());
}

function get360VisitedWeb(){
    visited = getVisited();
    if(!visited) return null;
    visitedArr = visited.split("^^");
    if(visitedArr) return visitedArr;
    return null;
}
function getVisited(){
    return getCookie(getVisitedCookieName());
}
function setCookie(k,v,a){
	var b=encodeURIComponent(v);
	if(!a)a={duration:365};
	if(a&&a.duration){
		var d=new Date();
		d.setTime(d.getTime()+a.duration*24*3600*1000);
		b+=';expires='+d.toGMTString()
	}
	document.cookie=k+'='+b+';'
}
function getCookie(k){
	var c=document.cookie.split("; ");
	for(var i=0;i<c.length;i++){
		var p=c[i].split("=");
		if(k==p[0])
		try{
			return decodeURIComponent(p[1])
		}catch(e){return null}
	}
	return null
}
				 