﻿function $(id) { return document.getElementById(id); }
var Lposition = {};
Lposition.cursor = function (evt) {
    var ml = evt ? document.body.scrollLeft : document.documentElement.scrollLeft;
    var mt = evt ? document.body.scrollTop : document.documentElement.scrollTop;
    evt = evt ? evt : (window.event ? window.event : null);
    var x = evt.x != undefined ? evt.x : evt.pageX;
    var y = evt.y != undefined ? evt.y : evt.pageY;
    return { 'x': x + ml, 'y': y + mt };
};
Lposition.cursorY = function (evt) {
    evt = evt ? evt : (window.event ? window.event : null);
    var y = evt.y != undefined ? evt.y + (document.body.scrollTop || document.documentElement.scrollTop) : evt.pageY;
    return y;
};
Lposition.offset = function (o, o2, div, topAlign) {
    var oo = o;
    var x = 0, y = 0, x2 = 0, y2 = 0;
    do { x += o.offsetLeft || 0; y += o.offsetTop || 0; o = o.offsetParent; } while (o);
    if (o2) {
        var w = o2.clientWidth;
        var h = o2.clientHeight;
        var dw = document.body.clientWidth;
        x2 = ((x + w > dw) ? dw - w : x);
        if (topAlign) {
            y2 = (y - h < 1) ? 0 : y - h;
        } else {
            y2 = y + oo.clientHeight;
        }
    } else {
        x2 = x;
        y2 = y;
    }
    if (div) {
        div.style.left = x2 + 'px';
        div.style.top = y2 + 'px';
    }
    return { "x": x, "y": y, 'x2': x2, 'y2': y2 };
};
var Ltransparent = { _o: null, _count: 0, _index: 0, _out: 0 };
Ltransparent.begin = function (o, count) {
    if (count) {
        clearTimeout(Ltransparent._out);
        Ltransparent._o = o;
        Ltransparent._count = count;
        Ltransparent._index = 1;
        o.style.visibility = 'visible';
    } else {
        o = Ltransparent._o;
    }
    if (document.all) {
        o.style.filter = 'alpha(opacity=' + Ltransparent._index + ')';
    } else {
        o.style.opacity = Ltransparent._index * 0.01;
    }
    Ltransparent._index += 4;
    if (Ltransparent._index < Ltransparent._count) {
        Ltransparent._out = setTimeout(Ltransparent.begin, 10);
    }
};
Ltransparent.end = function () {
    var o = Ltransparent._o;
    if (document.all) {
        o.style.filter = 'alpha(opacity=' + Ltransparent._index + ')';
    } else {
        o.style.opacity = Ltransparent._index * 0.01;
    }
    Ltransparent._index -= 10;
    if (Ltransparent._index > 0) {
        Ltransparent._out = setTimeout(Ltransparent.end, 10);
    } else {
        o.style.visibility = 'hidden';
    }
};

var Lbase = { _gcIndex: 0 };
Lbase.keys = function (obj) {
    var arr = [];
    for (var key in obj) {
        arr.push(key);
    }
    arr.sort();
    return arr;
};
Lbase.printInfo = function (obj) {
    var arr = [];
    for (var key in obj) {
        arr.push(key + ' = ' + obj[key]);
    }
    alert(arr.join('\n'));
};
Lbase.gc = function () {
    if (document.all && Lbase._gcIndex++ > 10) {
        CollectGarbage();
        Lbase._gcIndex = 0;
    }
};
Lbase.createJsFile = function (name, uri, skip, isAppend) {
    var o = $(name);
    if (o) {
        if (skip) { return; }
        o.parentNode.removeChild(o);
    }
    o = document.createElement("script");
    o.type = "text/javascript";
    o.id = name;
    o.src = uri;
    if (isAppend) {
        document.body.appendChild(o);
    } else {
        document.getElementsByTagName('head')[0].appendChild(o);
    }
};
Lbase.version = function (name) { return window.navigator.userAgent.indexOf(name || 'MSIE 6') != -1; };
Lbase.versionIe67 = function () { return document.all && (Lbase.version() || Lbase.version('MSIE 7')); };
Lbase.verie = function (index) { return (navigator.appName == "Microsoft Internet Explorer" && navigator.userAgent.indexOf('MSIE ' + index) != -1); };
Lbase.event = function (o, name, call) {
    if (window.attachEvent) {
        o.attachEvent(name, call);
        return;
    }
    if (window.addEventListener) {
        o.addEventListener(name.substr(2), call, false);
        return;
    }
    o[name] = call;
};
Lbase.removeEvent = function (o, name, call) {
    if (window.detachEvent) {
        o.detachEvent(name, call);
        return;
    }
    if (window.removeEventListener) {
        o.removeEventListener(name, call, false);
        return;
    }
    o[name] = null;
};
Lbase._ie6 = Lbase.verie(6);
Lbase._ie8 = Lbase.verie(8);
var Lsearch = {};
Lsearch.getPar = function (name, uri) {
    if (!uri) { uri = location.href.toLowerCase(); }
    uri = uri.split('#')[0];
    uri = uri.split('?')[1]; if (!uri) { return ''; }
    uri = uri.split('&'); if (!uri) { return ''; }
    name = name.toLowerCase();
    for (var i = 0, l = uri.length; i < l; i++) {
        if (uri[i].length < 2) { continue; }
        var arr = uri[i].split('=');
        if (arr[0].length < 1) { continue; }
        if (arr[0] != name) { continue; }
        return arr[1];
    }
    return '';
};
var Lxml = {};
Lxml.getNode = function (node) { return document.all ? node.text : node.textContent; };
Lxml.setNode = function (node, value) { if (document.all) { node.text = value; } else { node.textContent = value; } };
Lxml.xml = function (uri) {
    var doc, rootnode;
    var hash = {};
    this.xml = function () { if (document.all) { return doc.xml; } else { return (new XMLSerializer()).serializeToString(doc); } };
    this.doc = function () { return doc; };
    this.setnode = function (name, value) {
        var node = hash[name];
        if (!node) {
            node = doc.createElement(name);
            rootnode.appendChild(node);
            hash[name] = node;
        }
        Lxml.setNode(node, value);
    };
    this.getnode = function (name) { var node = hash[name]; if (!node) { return ''; } return Lxml.getNode(node); };
    this.geturi = function () { return Lxml.getNode(rootnode.childNodes[0]); };
    this.seturi = function (uri) { Lxml.setNode(rootnode.childNodes[0], uri); };
    this.getdoc = function () { return doc; };

    if (window.ActiveXObject) { doc = new ActiveXObject("MSXML.DOMDocument"); } else { doc = document.implementation.createDocument("", "", null); }
    rootnode = doc.createElement('root');
    doc.appendChild(rootnode);
    var urinode = doc.createElement('uri');
    rootnode.appendChild(urinode);
    Lxml.setNode(urinode, uri);
};
var Lad = { _ads: {}, _listAd: [], _txtAdPar: {}, _isBind: false };
Lad.append = function (id, type, uri, html, style) {
    var arr = Lad._ads[id];
    if (!arr) { Lad._ads[id] = arr = []; }
    arr.push({ 'uri': uri, 'html': html, 'type': type, 'style': style });
};
Lad.parameter = function (par) {
    var arr = Lad._ads[par.id];
    if (!arr) { Lad._ads[par.id] = arr = []; }
    arr._count = par.count;
    arr._skippar = par.txtList;
    arr._fly = par.fly;
    arr._style = par.style;
};
Lad.analy = function (ad, type, style) {
    var txt = '';
    var obj = type ? document.createElement(type) : null;
    style = ad.style || style;
    switch (ad.type) {
        case 'txt': case 'img':
            txt = ad.type == 'txt' ? ad.html : '<img src="' + ad.html + '" ' + (style ? 'style="' + style + '"' : '') + ' />';
            if (obj) {
                var str = '<a target="_blank" ';
                if (ad.uri) {
                    str += 'href="' + ad.uri + '"';
                }
                str += '>' + txt + '</a>';
                txt = str;
            } else {
                obj = document.createElement('a');
                if (ad.uri) { obj.href = ad.uri; }
                obj.target = '_blank';
                if (style) {
                    obj.setAttribute('style', style);
                }
            }
            obj.innerHTML = txt;
            break;
        case 'swf':
            txt = '<embed src="' + ad.uri + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent" ' + (style ? 'style="' + style + '"' : '') + '></embed>';
            if (!obj) { obj = document.createElement('span'); }
            obj.innerHTML = txt;
            break;
    }
    return obj;
};
Lad.load = function () {
    var objAd = Lad._ads;
    var divId = null;
    function append(obj, index) {
        if (index == 0) { obj.className = 'first'; }
        divId.appendChild(obj);
    }
    var adcount = 0;
    for (var id in objAd) {
        adcount++;
        if (typeof objAd[id] != 'object') { continue; }
        divId = $(id);
        if (!divId) { continue; }
        var arr = objAd[id];
        if (arr._skippar) {
            Lad.txtInit(arr, id);
            continue;
        }
        delete Lad._ads[id];
        divId.innerHTML = '';
        var nodeName = divId.nodeName;
        var index = 0;
        var type = '';
        switch (nodeName) {
            case 'UL': case 'OL':
                type = 'li'; break;
            case 'TR':
                type = 'td'; break;
            case 'DL':
                type = 'dd'; break;
        }
        for (var i = 0, l = arr.length; i < l; i++) {
            var ad = arr[i];
            var obj = Lad.analy(ad, type, arr._style);
            if (!obj) { continue; }
            append(obj, index++);
        }
        var count = arr._count;
        if (!count && !l) { divId.style.display = 'none'; }
        if (!count || index >= count || !Lad._defaultTxt) { continue; }
        var nullAd = { 'uri': null, 'html': Lad._defaultTxt, 'type': 'txt' };
        for (i = index; i < count; i++) {
            var obj = Lad.analy(nullAd, type, arr._style);
            if (!obj) { continue; }
            append(obj, i);
        }
    }
    if (!adcount) {
        Lsys.newTimeout('reloadAd', setTimeout(Lad.load, 1000)); //广告有可能加载慢
        return;
    }
    Lbf.adFixed();
};
Lad.txtInit = function (arr, tableId) {
    var par = arr._skippar.split(',');
    var xad = Lad._txtAdPar;
    xad.tableId = tableId;
    xad.start = parseInt(par[0]) || 0;
    xad.count = arr._count || arr.length;
    xad.skip = parseInt(par[1]) || 1;
    xad.lastrow = parseInt(par[2]) || 10;
    xad.arr = arr;
    Lad._isBind = true;
};
Lad.txtList = function () {
    if (!Lsys.isLoadTxtAd || Lmatch.history) {
        return;
    }
    var xad = Lad._txtAdPar;
    var tbody = $(xad.tableId);
    if (!tbody) { return; }
    var arr = xad.arr;
    var start = xad.start;
    var skip = xad.skip;
    var lastrow = xad.lastrow;
    var count = xad.count;
    var adNull = { 'uri': '', 'html': Lad._defaultTxt, 'type': 'txt' };
    var rows = tbody.getElementsByTagName(Lsys.rowTag);
    var rowLength = rows.length;
    var index = 0;
    Lad._listAd = [];

    function getRowIndex() {
        var tr;
        var x = 0;
        for (x = index; x < rowLength; x++) {
            tr = rows[x];
            index++;
            if (!tr || !tr.id || tr._hide || tr._fliphide) {
                continue;
            }
            break;
        }
        index--;
    }
    var adIndex = 0;
    var adLength = 0;
    var tb;
    var istbody = Lsys.rowTag == 'tbody';
    function ctr() {
        getRowIndex();
        var td = document.createElement('td'); //tr.insertCell(0);
        var tr = document.createElement(Lsys.rowTag);
        if (istbody) {
            var tr2 = document.createElement('tr'); //tbody.insertRow(j2);
            tr2.appendChild(td);
            tr.appendChild(tr2);
        } else {
            tr.appendChild(td);
        }
        td.colSpan = Lsys.colspan;
        var ad = arr[adIndex] || adNull;
        td.className = 'txtad';
        td.innerHTML = '<span class="txtadClose" >x</span>' + Lad.analy(ad, 'td').innerHTML;
        td.childNodes[0].onclick = Lad.txtCloseClick;
        tb = rows[index] ? rows[index].nextSibling : null;
        if (tb) {
            tbody.insertBefore(tr, tb);
        } else {
            tbody.appendChild(tr);
        }
        Lad._listAd.push(tr);
        adIndex++;
        adLength++;
        rowLength++;
        index++;
    }
    while (adLength < count) {
        ctr(rowLength);
    }
};
Lad.txtListClose = function () {
    var ads = Lad._listAd;
    var tr;
    for (var i = 0, l = ads.length; i < l; i++) {
        tr = ads[i];
        if (tr && tr.parentNode) {
            tr.parentNode.removeChild(tr);
        }
    }
    Lad._listAd = [];
};
Lad.txtCloseClick = function () {
    Lad.txtListClose();
    Lbf._stopAd = true;
};
Lad.txtListBind = function () {
    if (Lbf._stopAd || Lsys.matchType == 1 || Lmatch.history) {
        //广告被关闭与精简版不需要显示广告
        //Lbf.dataRefBgClass();
        return;
    }
    if (!Lad._isBind) {
        Lsys.newTimeout('txtListBind', setTimeout(Lad.txtListBind, 1000));
        return;
    }
    Lad.txtListClose();
    Lad.txtList();
};
Lad.convertHistory = function () {
    Lad._defaultTxt = '<div>广告联系： 13560322979 </div>';
    var id, count, type;
    var arr;
    var n;
    var obj = null;
    for (var i = 0, l = adpath.length; i < l; i++) {
        arr = adpath[i];
        if (!arr || arr.length < 1) { continue; }
        n = adname[i].split(',');
        id = n[0];
        count = n[1];
        type = n[2] || 'img';
        if (type == 'tbody') {
            type = 'txt';
            Lad.parameter({ 'id': id, 'count': count, 'txtList': n[4] + ',' + n[5] + ',' + n[6] });
        } else {
            Lad.parameter({ 'id': id, 'count': count });

        }
        for (var i0 = 0, l0 = arr.length; i0 < l0; i0++) {
            n = arr[i0].split(',');
            Lad.append(id, type, n[0], n[1]);
        }
    }
};
var Lajax = { _initId: null, _index: 0, _hashXml: {}, _hashName: {} };
Lajax._arrXmlHttp = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
Lajax.onChange = function () {
    if (this.readyState == 4) {
        if (this.status == 200 && this.responseText && this.responseText != ' ') {
            this._call(this.responseText, this._par);
        }
        delete Lajax._hashName[this._name];
        Lbase.gc();
    }
};
Lajax.initialize = function (name, call, par) {
    var ajax = null;
    var isNew = false;
    switch (Lajax._initId) {
        case -100:
            break;
        case -2:
            ajax = new window.XMLHttpRequest();
            isNew = true;
            break;
        case null:
            var id = null;
            if (window.XMLHttpRequest) {
                ajax = new window.XMLHttpRequest();
                isNew = true;
                id = -2;
            } else {
                id = -100;
                var arr = Lajax._arrXmlHttp;
                for (var i = 0, l = arr.length; i < l; i++) {
                    try {
                        ajax = new ActiveXObject(arr[i]);
                        id = i; break;
                    } catch (e) { }
                }
            }
            Lajax._initId = id;
            break;
        default:
            ajax = new ActiveXObject(Lajax._arrXmlHttp[Lajax._initId]);
            break;
    }
    if (ajax && call) {
        if (isNew) {
            ajax._call = call;
            ajax._par = par;
            ajax._name = name;
            ajax.onreadystatechange = Lajax.onChange;
        } else {
            ajax.onreadystatechange = Lajax._hashXml[name] = function () {
                if (ajax.readyState == 4) {
                    if (ajax.status == 200 && ajax.responseText && ajax.responseText != ' ') {
                        call(ajax.responseText, par);
                    }
                    ajax = null;
                    Lajax.delXml(name);
                }
            };
        }
    }
    return ajax;
};
Lajax.delXml = function (name) {
    delete Lajax._hashXml[name];
    delete Lajax._hashName[name];
    Lbase.gc();
};
Lajax.formatUri = function (uri) {
    return uri + (uri.indexOf('?') == -1 ? '?' : '&') + 'sendmethod=ajax';
};
Lajax.send = function (name, call, uri, par) {
    if (Lajax._hashName[name]) { return; }
    var ajax = Lajax._hashName[name] = Lajax.initialize(name, call, par || Lsys.area);
    ajax.open('GET', uri, !Lbase._ie); //第三个参数设成 false ，则是同步方式打开的，就是必须等待这个完成之后，才会继续后面的语句。
    ajax.send(null);
    ajax = null;
};
Lajax.xmlSend = function (xml) {
    var ajax = Lajax.initialize();
    var uri = Lajax.formatUri(xml.geturi());
    ajax.open('POST', uri, true);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
    ajax.setRequestHeader("If-Modified-Since", "0");
    ajax.send(xml.getdoc());
};
var Lcookie = {
    set: function (name, value, day, hour, minute, path) {
        var expires = new Date();
        if (typeof (day) == "number") { expires.setDate(expires.getDate() + day); }
        if (typeof (hour) == "number") { expires.setHours(expires.getHours() + hour); }
        if (typeof (minute) == "number") { expires.setMinutes(expires.getMinutes() + minute); }
        document.cookie = name + "=" + escape(value) + ";" + (day || hour || minute ? " expires=" + expires.toGMTString() : "") + ((path == null) ? "" : "; path=" + path);
    },
    get: function (name, dv) {
        var arr = document.cookie.split("; ");
        var l = arr.length;
        for (var i = 0; i < l; i++) { var kv = arr[i].split("="); if (name == kv[0]) { return unescape(kv[1]); } }
        return dv;
    },
    remove: function (name) { document.cookie = name + "=; expires=Fri, 31 Dec 1000 23:59:59 GMT;"; },
    keys: function (name, isInt) {
        var objKey = {};
        var cookie = Lcookie.get(name, null);
        if (!cookie) { return objKey; }
        var arr = cookie.split(';');
        for (var i = 0, l = arr.length; i < l; i++) {
            var d = arr[i].split('=');
            objKey[d[0]] = isInt ? parseInt(d[1] || 0) : (d[1] || '');
        }
        return objKey;
    },
    value: function (objs, name, dv) {
        var v = objs[name];
        if (v == undefined) { return dv; }
        switch (typeof dv) {
            case 'number':
                return parseFloat(v);
            case 'boolean':
                return v != '';
            default:
                return v;
        }
    }
};

/*  ------ODDS------  */
var Lmatch = { date: '', otherinfo: '', history: false, _match: {}, _data: [], _odds: {}, _pk: [], _country: {}, noMatch: false };
Lsys.begin = false;
Lsys.cid = 1;
Lsys.cid2 = 1;
Lsys.plc = 1;
Lsys.iorpoint = 2;
Lsys.iorshow = 100;
Lsys.oddtype = 'H';
Lsys.netmode = false;
Lsys.oddschangefile = '';
Lsys.name = '';
Lsys.currentMenu = '';
Lsys.stop = false;
Lsys.matchType = 0;
Lsys.uid = null;
Lsys.hashOut = {};
Lsys.colspan = 11;
Lsys.linkArea = 'b2';
Lsys.area = '';
Lsys.isOpenZd = false;
Lsys.txtA = '大';
Lsys.txtB = '小';
Lsys.arrPath = ['pl_bf_ds_8bo_', 'pl_bf_ds_ch_8bo_', 'pl_bf_zd_ch_8bo_'];
Lsys.domainAspx = 'read.aspx?name='; //动态读取 
Lsys.domainJs = 'oddsjs/{0}.js'; //静态读取
Lsys.pathPlInit = ''; //SB赔率 初盘数据
Lsys.pathPlDs = ''; //SB赔率 单式变化数据
Lsys.pathPlZd = ''; //SB赔率 走地变化数据
Lsys.oddsgoalfile = ''; //进球变化
Lsys.oddschangefile = 'pl_ds_ch_8bo_1'; //变化
Lsys.oddschangefile2 = '';
Lsys.oddsfile = 'pl_ds_8bo_1';
Lsys.isConvert = true; //赔率是否转换
Lsys.writeLog = false;
Lsys.refInter = 2000; //刷新间隔
Lsys.title = '僅供各地合法彩票購買參考';
Lsys.matchKey = 0; // 1足球，1篮球
Lsys.xmlLog = new Lxml.xml('newlog.aspx');
Lsys.statusNum = 14;
Lsys.uriInfo = '';
Lsys.uriPl = '';
Lsys.error = [];
Lsys.visibleMatchCount = 0;
Lsys.matchCount = 0;
Lsys.firstTime = false;
Lsys.rowTag = 'tbody';
Lsys.isLoadTxtAd = false;
Lsys.printerror = function () {
    if (Lsys.error.length > 0) {
        alert('数据源有错误：\n\n' + Lsys.error.join('\n'));
    }
};
Lsys.txtToDate = function (ks2) {
    var t = ks2.split(",");
    var date = new Date(t[0], t[1], t[2], t[3], t[4], t[5]);
    return date;
};
Lsys.killError = function () {
    return true;
};
Lsys.pageReload = function () {
    location.reload();
};
Lsys.delTimeout = function (name) {
    var obj = Lsys.hashOut[name];
    if (obj) {
        window.clearTimeout(obj.id);
    }
    delete Lsys.hashOut[name];
};
Lsys.newTimeout = function (name, id) {
    Lsys.delTimeout(name);
    Lsys.hashOut[name] = { 'id': id, 'area': Lsys.area };
};
Lsys.endTimeout = function (name) {
    delete Lsys.hashOut[name];
};
Lsys.clearLog = function () {
    Lsys._log.innerHTML = '';
};
Lsys.newLog = function (msg) {
    if (!Lsys.writeLog) {
        Lsys.xmlLog.setnode('content', '（' + Lsys.name + '）' + msg);
        Lajax.xmlSend(Lsys.xmlLog);
        return;
    }
    var log = Lsys._log;
    if (!log) {
        log = Lsys._log = document.createElement('div');
        log.id = 'wLog';
        log.ondblclick = Lsys.clearLog;
        document.body.appendChild(log);
    }
    var div = document.createElement('div');
    div.innerHTML = msg;
    log.appendChild(div);
};
Lsys.initTimeout = function () {
    Lsys.stop = true;
    Lbf._loadmatchcount = 0;
    var obj;
    for (var key in Lsys.hashOut) {
        obj = Lsys.hashOut[key];
        if (obj.area != Lsys.area) {
            window.clearTimeout(obj.id);
        }
    }
    Lsys.uid = null;
    Lsys.uidInit();
};
Lsys.click = function () {
    var a = this;
    Lbf.resetXml();
    Lsys.load(a._name);
    Lsys.initTimeout();
    Lsys.loadData();
    if (Lsys.currentMenu) {
        Lsys.currentMenu.className = '';
    }
    if (Lsys._selMenuSpan && (!a._zcspan || Lsys._selMenuSpan != a._zcspan)) {
        Lsys._selMenuSpan.className = 'iszc';
    }
    Lsys.currentMenu = a;
    if (a._zcspan) {
        Lsys._selMenuSpan = a._zcspan;
        a._zcspan.className = 'iszcsel';
    }
    a.className = 'sel';
    a.blur();
    /*if(a._isInit){
    var ls = Lbf._menus.linkMenu;
    var a = ls[Lsys.matchKey]._firstLink;
    Lbf.reloadStatus();
    if(a){
    a.className = 'sel';
    Lsys.currentMenu = a;
    }
    }*/
};
Lsys.setTitle = function (txt) {
    document.title = '综合足彩指数比较 - 以下数据仅供足球彩票购买参考对比'; //txt || (Lsys.title + ' - ' + Lsys.name);
    if (txt == undefined) {
        setTimeout(Lsys.setTitle, 800);
    }
};
Lsys.tryEval = function (txt) {
    try {
        eval(txt);
    } catch (ex) {
        var errors = [];
        var arr = txt.split(/\r\n/gi);
        var txt = '';
        for (var i = 0, l = arr.length; i < l; i++) {
            txt = arr[i];
            if (!txt) { continue; }
            try {
                eval(txt);
            } catch (ex) {
                errors.push('第' + i + '行（' + ex + '）：' + txt);
            }
        }
        if (errors.length > 0) {
            Lsys.error = errors;
            Lsys.newLog(errors.join('\n'));
        }
    }
    return true;
};
Lsys.formatUri = function (name) {
    var url = '';
    if (Lpar.mode == 0) {
        url = Lsys.domainAspx + name + '&con=' + Lsys.uid;
    } else {
        url = Lsys.domainJs.replace('{0}', name) + '?index=' + Math.random();
    }
    return url;
};
Lsys.init = function () {
    var area = location.href.split('#')[1] || Lpar.defaultArea;
    var span;
    function bindMenu(wMenu, isInit) {
        var as = wMenu.getElementsByTagName('a');
        var a;
        for (var i = 0, l = as.length; i < l; i++) {
            a = as[i];
            if (a.target) { continue; }
            a._name = a.href.split('#')[1] || '';
            a._isInit = isInit;
            a.onclick = Lsys.click;
            if (a._name == area) { a.className = 'sel'; Lsys.currentMenu = a; }
            span = a.parentNode;
            if (span.className == 'iszc') {
                a._zcspan = span;
                if (a._name == area) {
                    Lsys._selMenuSpan = span;
                }
            }
        }
    }
    bindMenu($('wLinkType'), true);
    bindMenu($('wSysMenu'));
    if (Lsys._selMenuSpan) {
        Lsys._selMenuSpan.className = 'iszcsel';
    }
    Lsys.load(area);
};
Lsys.loadData = function () {
    if (Lsys.uid == null) {
        Lsys.newTimeout('loadData', setTimeout(Lsys.loadData, 100));
        return;
    }
    Lbf.loadmatchinfo(true);
};
Lbf.reloadmatchinfo = function () {
    //重新加载赛事
    if (Lsys.stop) { return; }
    Lbf.loadmatchinfo();
};
Lsys.loadUid = function (txt) {
    Lsys.uid = parseInt(txt);
};
Lsys.uidInit = function () {
    if (Lpar.mode == 0) {
        var url = Lsys.formatUri('&action=con');
        Lajax.send('uidInit', Lsys.loadUid, url);
    } else {
        Lsys.loadUid(1);
    }
};
Lsys.poplayerMouseUp = function (e) {
    if (!e) { e = window.event; }
    if (e.button == 2) { this.onmouseout = null; }
};
Lsys.pageFlip = function (count, index) {
    var pr = Lpar.pageRecord;
    var pagecount = Lpar.pageCount = parseInt((count / pr)) + (count % pr ? 1 : 0);
    if (index > pagecount) { index = pagecount; }
    Lpar.pageIndex = index;
    var h = [];
    h.push('<div class="wdFlipPage">共' + pagecount + '页（' + count + '场赛事）');
    for (var i = 1; i <= pagecount; i++) {
        h.push('<a onclick="Lbf.flip(' + i + ')" ' + (i == index ? 'class="sel"' : '') + '>' + i + '</a>');
    }
    h.push('</div>');
    return { pindex: index, txt: h.join('') };
};
Lsys.uidInit();

var Lvar = { sound: 1 };
Lvar.matchkey = { pm1: '', pm2: '', bfid: 0, rq1: 0, rq2: 0, dx1: 0, dx2: 0, bzz: 0, bzh: 0, bzk: 0, hRq1: 0, hRq2: 0, hDx1: 0, hDx2: 0, hBzz: 0, hBzh: 0, hBzk: 0 };
var Ldata = {};
Ldata.area = { 1: 'b2', 2: 'b3', 14: 'b6' };
Ldata.com = [[1, '皇冠'], [100, '皇冠精简'], [101, '印尼'], [102, '马来'], [2, '澳门'], [14, '盈禾']];
Ldata.comvisible = [];

var Lchange = {};
Lchange.decpoint = function (tmpior, show) {
    //去正負號做小數第幾位捨去,進來的值是小數值
    var x = tmpior < 0 ? -1 : 1;
    tmpior = (Math.floor(Math.abs(tmpior) * show + 1 / show)) / show;
    return (tmpior * x);
};
Lchange.otherIor = function (d, x1, x2) {
    if (!d[x1] && !d[x2]) {
        return;
    }
    var ior = [];
    var iorH = d[x1] || 0;
    var iorC = d[x2] || 0;
    if (iorH < 3) { iorH *= 1000; }
    if (iorC < 3) { iorC *= 1000; }
    switch (Lsys.oddtype) {
        case "H": /*香港變盤(輸水盤)*/
            ior = Lchange.hkIor(iorH, iorC); break;
        case "M": /*馬來盤*/
            ior = Lchange.maIor(iorH, iorC); break;
        case "I": /*印尼盤*/
            ior = Lchange.indIor(iorH, iorC); break;
        case "E": /*歐洲盤*/
            ior = get_EU_ior(iorH, iorC); break;
        default: /*香港盤*/
            ior[0] = iorH;
            ior[1] = iorC;
    }
    ior[0] /= 1000;
    ior[1] /= 1000;
    ior[0] = Lchange.decpoint(ior[0], Lsys.iorshow);
    ior[1] = Lchange.decpoint(ior[1], Lsys.iorshow);
    d[x1] = ior[0];
    d[x2] = ior[1];
};
Lchange.hkIor = function (hr, cr) {/*換算成輸水盤賠率*/
    if (hr <= 1000 && cr <= 1000) { return [hr, cr]; }
    var lowRatio, nowRatio, highRatio;
    var nowType = "";
    var line = 2000 - (hr + cr);
    if (hr > cr) {
        lowRatio = cr;
        nowType = "C";
    } else {
        lowRatio = hr;
        nowType = "H";
    }
    if (((2000 - line) - lowRatio) > 1000) {
        nowRatio = (lowRatio + line) * (-1); /*對盤馬來盤*/
    } else {
        nowRatio = (2000 - line) - lowRatio; /*對盤香港盤*/
    }
    if (nowRatio < 0) {
        highRatio = Math.floor(Math.abs(1000 / nowRatio) * 1000);
    } else {
        highRatio = (2000 - line - nowRatio);
    }
    if (nowType == "H") {
        return [lowRatio, highRatio];
    } else {
        return [highRatio, lowRatio];
    }
};
Lchange.maIor = function (hr, cr) {/*換算成馬來盤賠率*/
    if ((hr <= 1000 && cr <= 1000)) { return [hr, cr]; }
    var lowRatio, highRatio;
    var nowType = "";
    var line = 2000 - (hr + cr);
    if (hr > cr) {
        lowRatio = cr;
        nowType = "C";
    } else {
        lowRatio = hr;
        nowType = "H";
    }
    highRatio = (lowRatio + line) * (-1);
    if (nowType == "H") {
        return [lowRatio, highRatio];
    } else {
        return [highRatio, lowRatio];
    }
};
Lchange.indIor = function (hr, cr) {/*換算成印尼盤賠率*/
    var arr = Lchange.hkIor(hr, cr);
    hr = arr[0];
    cr = arr[1];
    hr /= 1000;
    cr /= 1000;
    if (hr < 1) { hr = (-1) / hr; }
    if (cr < 1) { cr = (-1) / cr; }
    return [hr * 1000, cr * 1000];
};
Lchange.convertOdds = function (d) {
    if (!Lsys.isConvert || d._ior) { return; }
    //数据还没有转换
    var x = ['rq1', 'rq2', 'hRq1', 'hRq2', 'dx1', 'dx2', 'hDx1', 'hDx2', 'zdRq1', 'zdRq2', 'zdhRq1', 'zdhRq2', 'zdDx1', 'zdDx2', 'zdhDx1', 'zdhDx2'];
    for (var i = 0, l = x.length; i < l; i++) {
        if (d['ior_' + x[i]]) { continue; }
        Lchange.otherIor(d, x[i], x[++i]);
    }
    d._ior = true;
};
Lchange.initObject = function (d) {
    var ms = Lvar.matchkey;
    var x, v;
    for (var key in ms) {
        x = d[key];
        if (x == undefined) {
            v = ms[key];
            d[key] = v == undefined ? '' : v;
        } else if (typeof x == 'number') {
            d[key] = Lbf.printf(x);
        }
    }
};
Lbf._arrrqpk = '无开盘,平手,平/半,半球,半/一,一球,一/球半,球半,球半/二,二球,二/二球半,二球半,二球半/三,三球,三/三球半,三球半,三球半/四,四球,四/四球半,四球半,四球半/五,五球,五/五球半,五球半,五球半/六,六球,六/六球半,六球半,六球半/七,七球,七/七球半,七球半,七球半/八,八球,八/八球半,八球半,八球半/九,九球,九/九球半,九球半,九球半/十,十球,十球/十球半,十球半,十球半/十一,十一球,十一/十一球半,十一球半,十一球半/十二,十二球,十二/十二球半,十二球半,十二球半/十三,十三球,十三/十三球半,十三球半,十三球半/十四,十四球,十四/十四球半,十四球半,十四球半/十五,十五球,十五/十五球半,十五球半,十五球半/十六,十六球,十六/十六球半,十六球半,十六球半/十七,十七球,十七/十七球半,十七球半,十七球半/十八,十八球,十八/十八球半,十八球半,十八球半/十九,十九球,十九/十九球半,十九球半,十九球半/二十,二十球,'.split(',');
if (!Lbf._rqpk) {
    Lbf._rqpk = ',0,0/0.5,0.5,0.5/1,1,1/1.5,1.5,1.5/2,2,2/2.5,2.5,2.5/3,3,3/3.5,3.5,3.5/4,4,4/4.5,4.5,4.5/5,5,5/5.5,5.5,5.5/6,6,6/6.5,6.5,6.5/7,7,7/7.5,7.5,7.5/8,8,8/8.5,8.5,8.5/9,9,9/9.5,9.5,9.5/10,10,10/10.5,10.5,10.5/11,11,,,,,,<span class="red">*</span>0,<span class="red">*</span>0/0.5,<span class="red">*</span>0.5,<span class="red">*</span>0.5/1,<span class="red">*</span>1,<span class="red">*</span>1/1.5,<span class="red">*</span>1.5,<span class="red">*</span>1.5/2,<span class="red">*</span>2,<span class="red">*</span>2/2.5,<span class="red">*</span>2.5,<span class="red">*</span>2.5/3,<span class="red">*</span>3,<span class="red">*</span>3/3.5,<span class="red">*</span>3.5,<span class="red">*</span>3.5/4,<span class="red">*</span>4,<span class="red">*</span>4/4.5,<span class="red">*</span>4.5,<span class="red">*</span>4.5/5,<span class="red">*</span>5,<span class="red">*</span>5/5.5,<span class="red">*</span>5.5,<span class="red">*</span>5.5/6,<span class="red">*</span>6,<span class="red">*</span>6/6.5,<span class="red">*</span>6.5,<span class="red">*</span>6.5/7,<span class="red">*</span>7,<span class="red">*</span>7/7.5,<span class="red">*</span>7.5,<span class="red">*</span>7.5/8,<span class="red">*</span>8,<span class="red">*</span>8/8.5,<span class="red">*</span>8.5,<span class="red">*</span>8.5/9,<span class="red">*</span>9,<span class="red">*</span>9/9.5,<span class="red">*</span>9.5,<span class="red">*</span>9.5/10,<span class="red">*</span>10,<span class="red">*</span>10/10.5,<span class="red">*</span>10.5,<span class="red">*</span>10.5/11,<span class="red">*</span>11,'.split(',');
}

Lbf._dxpk = ',0/0.5,0.5,0.5/1,1,1/1.5,1.5,1.5/2,2,2/2.5,2.5,2.5/3,3,3/3.5,3.5,3.5/4,4,4/4.5,4.5,4.5/5,5,5/5.5,5.5,5.5/6,6,6/6.5,6.5,6.5/7,7,7/7.5,7.5,7.5/8,8,8/8.5,8.5,8.5/9,9,9/9.5,9.5,9.5/10,10,10/10.5,10.5,10.5/11,11,11/11.5,11.5,11.5/12,12,12/12.5,12.5,12.5/13,13,13/13.5,13.5,13.5/14,14,14/14.5,14.5,14.5/16,16,16/16.5,16.5,16.5/17,17,17/17.5,17.5,17.5/18,18,18/18.5,18.5,18.5/19,19,19/19.5,19.5,19.5/20,20,20/20.5,20.5,20.5/21,21,21/21.5,21.5,21.5/22,22,22/22.5,22.5,22.5/23,23,23/23.5,23.5,23.5/24,24,24/24.5,24.5,24.5/25,25,25/25.5,25.5,25.5/26,26,26/26.5,26.5,26.5/27,27,27/27.5,27.5,27.5/28,28,28/28.5,28.5,28.5/29,29,29/29.5,29.5,29.5/30,30,30/30.5,30.5,30.5/31,31,31/31.5,31.5,31.5/32,32,32/32.5,32.5,32.5/33,33,33/33.5,33.5,33.5/34,34,34/34.5,34.5,34.5/35,35,35/35.5,35.5,35.5/36,36,36/36.5,36.5,36.5,36.5/37,37,37/37.5,37.5,37.5/38,38,38/38.5,38.5,38.5/40,40,40/40.5,40.5,40.5/41,41,41/41.5,41.5,41.5/42,42,42/42.5,42.5,42.5/43,43,43/43.5,43.5,43.5/44,44,44/44.5,44.5,44.5/45,45,45/45.5,45.5,45.5/46,46,46/46.5,46.5,46.5/47'.split(',');

Lbf.playDefaulgSound = function (temp, isPlay) {
    var sound = $('defaultSound');
    if (isPlay) {
        clearTimeout(Lbf._out_defaultSound);
        Lbf._out_defaultSound = setTimeout(Lbf.playDefaulgSound, 3000);
        sound.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='36' height='14' id='image1'><param name='movie' value='/i/f/bet.swf?rnd=" + Math.random() + "'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
        Lsys.setTitle();
    } else {
        sound.innerHTML = '';
    }
};
Lbf.playGoalSound = function (temp, isPlay) {
    var sound = $('goalSound');
    if (isPlay) {
        clearTimeout(Lbf._out_goalSound);
        Lbf._out_goalSound = setTimeout(Lbf.playGoalSound, 3000);
        sound.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='36' height='14' id='image1'><param name='movie' value='/i/f/bf.swf?rnd=" + Math.random() + "'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
        Lsys.setTitle();
    } else {
        sound.innerHTML = '';
    }
};
Lbf.playRedSound = function (temp, isPlay) {
    var sound = $('redSound');
    if (isPlay) {
        clearTimeout(Lbf._out_redSound);
        Lbf._out_redSound = setTimeout(Lbf.playRedSound, 3000);
        sound.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='36' height='14' id='image1'><param name='movie' value='/i/f/red.swf?rnd=" + Math.random() + "'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
        Lsys.setTitle();
    } else {
        sound.innerHTML = '';
    }
};
Lbf._cookiepm = 1;
Lbf._objPlClass = {};
Lbf._hashhide = {};
Lbf._hashtr = {};
Lbf._cookiehideids = '';
Lbf._tbody = null;
Lbf._arrstatus = [];
Lbf._outIndex = 0;
Lbf._trTag = 'tbody';
Lbf._arr_smtj = [, 0, , 46]; //加几分钟
Lbf._arr_smtd1 = [, 45, , 90]; //大于几分钟
Lbf._arr_smtd2 = ",45+,,90+".split(','); //大于几分钟等于几分钟
Lbf._arr_smtd3 = [, 1, , 46]; //小于几分钟等于几分钟
Lbf._arridIndex = {};
Lbf.printf = function (vals, point) {
    //小數點位數
    if (vals == undefined || vals == '') { return '' }
    vals = vals.toString();
    point = point || Lsys.iorpoint;
    var cmd = vals.split(".");
    if (cmd.length > 1) {
        for (var i = 0, l = (point - cmd[1].length); i < l; i++) {
            vals += "0";
        }
    } else {
        vals += ".";
        for (var i = 0; i < point; i++) {
            vals += "0";
        }
    }
    return vals;
};
Lbf.loadMatchMenu = function () {
    var menu = $('wMatchMenu');
    var coms = Ldata.com;
    var vis = Ldata.comvisible;
    var arr = [];
    var d = [];
    for (var i = 0, l = coms.length; i < l; i++) {
        if (!vis[i]) { continue; }
        d = coms[i];
        arr.push('<a href="?c=' + d[0] + '" class="sel">' + d[1] + '</a> ');
    }
    menu.innerHTML = arr.join('');
};
Lbf.trySet = function (id, value) {
    var obj = $(id);
    if (!obj) { return; }
    obj.innerHTML = value;
};
Lbf.load = function () {
    Lbf.reloadStatus();
    Lsys.init();
};
Lbf.setSwitchInfo = function (prec1, prec2, txt) {
    var info = Lbf._switchInfo;
    if (!info) {
        info = Lbf._switchInfo = { panel: $('wSwitchInfo'), text: $('wsiText'), prec: $('wsiPrec'), prec1: 0, prec2: 0, hide: true };
    }
    if (info.hide) {
        Ltransparent.begin(info.panel, 98);
        info.hide = false;
    }
    if (txt) { info.text.innerHTML = txt; }
    info.prec.innerHTML = prec1 + '%';
    if (prec1 == 100) {
        info.hide = true;
        Lsys.newTimeout('hidePrec', setTimeout(Ltransparent.end, 70));
    } else if (prec2 > prec1) {
        info.prec1 = prec1;
        info.prec2 = prec2;
        Lsys.newTimeout('setPrec', setTimeout(Lbf.setSwitchPrec, 70));
    }
};
Lbf.setSwitchPrec = function () {
    var info = Lbf._switchInfo;
    info.prec.innerHTML = ++info.prec1 + '%';
    if (info.prec1 < info.prec2) {
        Lsys.newTimeout('setPrec', setTimeout(Lbf.setSwitchPrec, 70));
    }
};
Lbf.formatPk = function (pk, type) {
    var arr;
    if (typeof type == 'object') {
        arr = type;
    } else {
        arr = type == 'rq' ? Lbf._arrrqpk : Lbf._arrdxpk;
    }
    if (pk < 0) {
        return '<span class="red">受</span>' + arr[parseInt(pk.toString().substr(1))];
    } else {
        return arr[pk];
    }
};

Lbf.formatForumUri = function (txt) {
    return txt.replace(/{bbsuri}/gi, Lpar.uriBbs);
};
Lbf.setLogin = function () {
    Lbf._wLogin = $('matchselect');
    if (!Lbf._wLogin) { return; }
    var txt = '';
    txt += '<form id="wLoginForm" action="{bbsuri}dragon/ajax.aspx?action=login" method="post" target="hideframe"><input type="hidden" value="' + Lpar.uriLive + 'ajax.aspx?action=login&id={0}&name={1}&key={2}" name="loginpath" /><table border="0" cellpadding="0" cellspacing="1"><tr><td>用户名：</td><td><input type="text" class="loginTxt" name="username" maxlength="20" /></td><td> 密码：</td><td><input type="password" class="loginTxt" name="password" /></td><td><input type="submit" value="登录" class="loginBt" /></td><td class="tGray">';
    txt += '<a href="{bbsuri}register.aspx" target="_blank">注册</a><span class="sfont">|</span><a href="{bbsuri}" target="_blank">进入社区</a></td></tr></table>';
    txt += '</form>';
    Lbase.createJsFile('wLoginStatus', Lbf.formatForumUri('{bbsuri}dragon/ajax.aspx?action=loginstatus'), true, true);
    Lbf._wLogin.innerHTML = Lbf.formatForumUri(txt);
};

Lbf.setLoginOk = function (id, name, userkey) {
    if (!Lbf._wLogin) { return; }
    var arr = [];
    arr.push('<div id="wLoginStatus">欢迎<a href="{bbsuri}usercp.aspx"  target="_blank"><b>' + name + '</b></a><span class="sfont" style="position:relative;">');
    arr.push('<ul styles="visiblity:hidden;" id="wForumMenu" onmouseover="this.style.visibility=\'visible\'" onmouseout="this.style.visibility=\'hidden\'">');
    arr.push('<li><a href="{bbsuri}userinfo-' + id + '.aspx"  target="_blank">我的主页</a></li>');
    arr.push('<li><a href="{bbsuri}mytopics.aspx" target="_blank">我的主题</a></li>');
    arr.push('<li><a href="{bbsuri}myposts.aspx" target="_blank">我的帖子</a></li>');
    arr.push('<li><a href="{bbsuri}search.aspx?posterid=current&amp;type=digest" target="_blank">我的精华</a></li>');
    arr.push('<li><a href="{bbsuri}myattachment.aspx" target="_blank">我的附件</a></li>');
    arr.push('<li><a href="{bbsuri}usercpsubscribe.aspx" target="_blank">我的收藏</a></li>');
    arr.push('</ul>');
    arr.push('|</span><a id="aForumEdit" onmouseover="$(\'wForumMenu\').style.visibility=\'visible\'" href="{bbsuri}userinfo-' + id + '.aspx" target="_blank">我的主页</a><span class="sfont">|</span><a href="{bbsuri}usercpprofile.aspx" target="_blank">个人设置</a><span class="sfont">|</span><a href="{bbsuri}" target="_blank">进入社区</a><span class="sfont">|</span><a onclick="Lbf.setLogin();" href="{bbsuri}/dragon/ajax.aspx?action=logout&userkey=' + userkey + '" target="hideframe">安全退出</a></div>');
    Lbf._wLogin.innerHTML = Lbf.formatForumUri(arr.join(''));
};
Lbf.initMatchMenu = function () {
    if (Lmatch.history) { return; }
    var lt = Lbf._menus.linkType;
    var lm = Lbf._menus.linkMenu;
    if (lt._index != Lsys.matchKey) {
        lt[lt._index].className = '';
        lt[Lsys.matchKey].className = 'sel';
        if (lm.length > 0) {
            lm[lt._index].style.display = 'none';
            lm[Lsys.matchKey].style.display = 'block';
        }
        lt._index = Lsys.matchKey;
    }
};

Lbf.initZdKeyName = function (iszd) {
    if (!iszd) { return null; }
    return { 'bzz': 'zdBzz', 'bzk': 'zdBzk', 'bzh': 'zdBzh', 'rqs': 'zdrqS', 'rqpk': 'zdRqpk', 'rq1': 'zdRq1', 'rq2': 'zdRq2', 'dx1': 'zdDx1', 'dx2': 'zdDx2', 'dxpk': 'zdDxpk', 'bzs': 'zdbzS', 'hRqs': 'zdhrqS', 'hRqpk': 'zdhRqpk', 'hRq1': 'zdhRq1', 'hRq2': 'zdhRq2', 'hBzs': 'zdhbzS', 'hBzz': 'zdhBzz', 'hBzh': 'zdhBzh', 'hBzk': 'zdhBzk', 'dxs': 'zddxS', 'hDxs': 'zdhdxS', 'hDx1': 'zdhDx1', 'hDx2': 'zdhDx2', 'hDxpk': 'zdhDxpk' };
};


Lbf.bindDataTags = function (tr) {
    var span, key;
    var objs = {};
    function append(spans) {
        for (var i = 0, l = spans.length; i < l; i++) {
            span = spans[i];
            key = span.getAttribute('_key');
            if (!key) { continue; }
            objs[key] = span;
        }
    }
    append(tr.getElementsByTagName('span'));
    append(tr.getElementsByTagName('td'));
    append(tr.getElementsByTagName('div'));
    append(tr.getElementsByTagName('a'));
    append(tr.getElementsByTagName('b'));
    return objs;
};
Lbf.loadcomplute = function () {
    Lbf._tbody = $('wMyData');
    var rows = Lbf._tbody.getElementsByTagName(Lsys.rowTag);
    var tr;
    var d;
    var isAddSkip = Lsys.matchType == 3 ? 1 : 0;
    var aid = Lbf._arridIndex;
    var index = 0;
    for (var i = 0, l = rows.length; i < l; i++) {
        tr = rows[i];
        if (!tr.id) {
            if (tr.getAttribute('_name')) {
                tr._islsname = true;
            }
            if (tr.getAttribute('_skip')) {
                tr._skip = true;
            }
            continue;
        }
        d = tr._data = Lmatch._data[aid[index++]];
        tr._tags = Lbf.bindDataTags(tr);
        tr._match = Lmatch._match[d.lsid];
        Lbf._hashtr[tr.id] = tr;
    }
    var poplayer = Lbf._poplayer = $('fpoplayer');
    poplayer.onmouseover = Lbf.poplayershow;
    poplayer.onmouseout = Lbf.poplayerhide;
    poplayer.onmouseup = Lsys.poplayerMouseUp;
    if (!document.onmouseover) { document.onmouseover = Lbf.showpop; }
    Lbf.loadmatch(); //加载联赛列表
    Lbase.event(window, 'onscroll', Lbf.adFixed);
    Lbase.event(window, 'onresize', Lbf.adFixed);
    Lsys.newTimeout('Lad_load', setTimeout(Lad.load, 500)); //加载所有广告
    if (Lsys.matchType == 102) {
        Lbf.updateTime();
        Lbf._outUpdateTime = setInterval(Lbf.updateTime, 3000);
    } else {
        clearInterval(Lbf._outUpdateTime);
    }
    Lbf.ssort(); //球队排名
    Lbf.setSwitchInfo(100, 0, Lsys.name + '加载完成'); //setTimeBreak;
    Lsys.stop = false;
};
Lbf.flip = function (index) {
    index = index || Lpar.pageIndex;
    if (Lsys.matchCount < 1) { return; }
    var count = Lsys.visibleMatchCount;
    var pf = Lsys.pageFlip(count, index);
    var wflip = $('wFlip');
    if (wflip) { wflip.innerHTML = pf.txt; }
    index = pf.pindex;
    Lad.txtListClose()
    var rows = Lbf._tbody.getElementsByTagName(Lsys.rowTag);
    var tr, d, prevLsid, lstr;
    var k = 0, x = 0;
    var istrue = false;
    var start = (index - 1) * Lpar.pageRecord;
    var l = rows.length;
    function getLstr(index) {
        var tr;
        for (var i = index - 1; i > -1; i--) {
            tr = rows[i];
            if (tr._islsname) { return tr; }
        }
        return null;
    }
    for (var i = 0; i < l; i++) {
        tr = rows[i];
        if (!tr.id || tr._hide) {
            if (!tr._skip) {
                tr.style.display = 'none';
            }
            continue;
        }
        k++;
        istrue = false;
        if (k > start) {
            x++;
            if (x < Lpar.pageRecord) {
                istrue = true;
            }
        }
        tr.style.display = istrue ? '' : 'none';
        tr._fliphide = !istrue;
        if (istrue) {
            d = tr._data;
            if (prevLsid != d.lsid) {
                prevLsid = d.lsid;
                lstr = getLstr(i);
                if (lstr) {
                    lstr.style.display = '';
                }
            }
        }
    }
    if (index < 2) {
        Lad.txtListBind();
    }
    window.scrollTo(0, 0);
};

Lbf.waitReload = function (test) {
    if (test && Lmatch._data.length > 0) {
        return;
    }
    Lmatch.noMatch = true;
    Lsys.newTimeout('noMatchReload', setTimeout(Lbf.loadmatchinfo, 3000));
};
Lbf.reloadStatus = function () {
    var arr = Lbf._arrstatus;
    arr[0] = ",推遲,推迟,Defer".split(",");
    arr[1] = ",中斷,中断,Halt".split(",");
    arr[2] = ",腰斬,腰斩,Halt".split(",");
    arr[3] = ",<font color=green>待定</font>,<font color=green>待定</font>,<font color=green>Wait</font>".split(",");
    arr[13] = ",<b>完</b>,<b>完</b>,<b>Ft</b>".split(",");
    arr[14] = ",未,未,W".split(",");
    arr[15] = ",上,上,Part1".split(",");
    arr[16] = ",<font color=blue>中</font>,<font color=blue>中</font>,<font color=blue>Half</font>".split(",");
    arr[17] = ",下,下,Part2".split(",");
};
Lbf.closecal = function () {
    try { if (calendar.isopen) { calendar.hide(); }; } catch (ex) { }
};
Lbf.getMinKey = function (obj) {
    var min, minKey;
    var kv;
    for (var key in obj) {
        kv = obj[key];
        if (kv < min || min == undefined) {
            min = kv;
            minKey = key;
        }
    }
    if (!minKey) { return null; }
    delete obj[minKey];
    return minKey;
};
Lbf.resetPlColor = function () {
    var str = Lbf.getMinKey(Lbf._objPlClass);
    if (!str) { return; }
    Lsys.endTimeout('resetPlClass' + str);
    var arr = str.split('.');
    var id = arr[0];
    var tr = Lbf._hashtr[id];
    if (!tr) { return; }
    var sp = tr._tags;
    if (!sp) { return; }
    var css = arr[2];
    arr = arr[1].split(',');
    for (var i = 0, l = arr.length; i < l; i++) {
        sp[arr[i]].className = css;
    }
};
Lbf._objDsZd = {
    2: [true, 'rq1', 'rq2', 'rqpk'], //赔率变化
    5: [true, 'hRq1', 'hRq2', 'hRqpk'], //上半让球
    14: [false, 'bzz', 'bzk', 'bzh'], //标准
    18: [false, 'hBzz', 'hBzk', 'hBzh'], //上半标准
    8: [true, 'dx1', 'dx2', 'dxpk'], //大小
    11: [true, 'hDx1', 'hDx2', 'hDxpk'], //上半大小

    3: [true, 'zdRq1', 'zdRq2', 'zdRqpk', 'zdrqS', 'gq_gqrq'], //让球
    6: [true, 'zdhRq1', 'zdhRq2', 'zdhRqpk', 'zdhrqS'], //上半让球走地
    19: [false, 'zdBzz', 'zdBzk', 'zdBzh', 'zdbzS', 'gq_gqop'], //标准
    20: [false, 'zdhBzz', 'zdhBzk', 'zdhBzh', 'zdhbzS'], //走地上半标准
    9: [true, 'zdDx1', 'zdDx2', 'zdDxpk', 'zddxS', 'gq_gqdx'], //大小
    12: [true, 'zdhDx1', 'zdhDx2', 'zdhDxpk', 'zdhdxS'], //上半大小走地

    16: [undefined, 'dsd', 'dss']
};
Lbf.updatetime_get = function (key, dt) {
    var str = '';
    var x = parseInt((new Date() - dt - Lsys.time) / 60000) + Lbf._arr_smtj[key];
    if (x > Lbf._arr_smtd1[key]) {
        str = Lbf._arr_smtd2[key];
    } else if (x < Lbf._arr_smtd3[key]) {
        str = Lbf._arr_smtd3[key];
    } else {
        str = x;
    }
    return str + "'";
}
Lbf.updateTime = function () {
    var sp;
    var tr, key;
    var htr = Lbf._hashtr;
    for (var id in htr) {
        tr = htr[id];
        d = tr._data;
        key = d.status || 0;
        if (key != 1 && key != 3) {
            continue;
        }
        sp = tr._tags;
        sp['time'].innerHTML = Lbf.updatetime_get(key, d.ks2time);
    }
};
Lbf.shidecount = function (count) {
    if (Lmatch.history) {
        Lad.txtListBind();
        return;
    }
    Lsys.visibleMatchCount = Lsys.matchCount - count;
    Lbf.flip();
    $("hiddencount").innerHTML = Lbf._hidecount = count;
    var s = Lbase.keys(Lbf._hashhide).join(",") || '';
    Lcookie.set('Lbf_hideid', s);
    Lbf._cookiehideids = s;
    Lad.txtListBind();
};
Lbf.hidemorematch = function () {
    //隐藏赛事
    var d = Lbf._cookiehideids.split(',');
    var k = 0, count = d.length;
    var tr, tr2, id;
    if (count < 1) { return; }
    for (var i = 0; i < count; i++) {
        id = d[i];
        if (!id) { continue; }
        tr = Lbf._hashtr[id];
        if (!tr) {
            continue;
        }
        Lbf._hashhide[tr.id] = null;
        tr._hide = true;
        tr.style.display = 'none';
        tr2 = Lbf.trMore(tr);
        if (tr2) { tr2.style.display = 'none'; }
        k++;
    }
    Lbf.shidecount(k);
};
Lbf.trMore = function (tr, create) {
    return null;
};
Lbf.hidematchName = function (id) {

};
Lbf.removeMatch = function (tr) {
    var tbody = tr.parentNode;
    var tr2 = Lbf.trMore(tr);
    var id = tr.id;
    tbody.removeChild(tr);
    tr2 && (tbody.removeChild(tr2));
    delete Lbf._hashtr[id];
    delete Lbf._hashhide[id];
};
Lbf.hidematch = function (o, level) {
    //隐藏单一赛事
    var tr;
    if (level != undefined) {
        tr = o;
        for (var i = 0; i < level; i++) {
            tr = tr.parentNode;
        }
    } else {
        tr = o.parentNode.parentNode.parentNode;
    }
    tr.style.display = 'none';
    tr._hide = true;
    var tr2 = Lbf.trMore(tr);
    if (tr2) { tr2.style.display = 'none'; }
    Lbf._hashhide[tr.id] = null;
    Lbf.shidecount(++Lbf._hidecount);
};
Lbf.showallmatch = function () {
    //显示全部赛事
    if (Lsys.stop) { return; }
    var arrck = ['wdlTable'];
    for (var j = 0, l = arrck.length; j < l; j++) {
        var cks = $(arrck[j]);
        if (!cks) { continue; }
        cks = cks.getElementsByTagName("input");
        for (var i = 0, l2 = cks.length; i < l2; i++) { cks[i].checked = true; }
    }
    var isot = true; // Lbf.isOtherInfo();
    var tr, tr2;
    var rows = Lbf._tbody.getElementsByTagName(Lsys.rowTag); ;
    for (var i = 0, l = rows.length; i < l; i++) {
        tr = rows[i];
        if (!tr.id) { continue; }
        tr.style.display = '';
        tr._hide = false;
    }
    Lbf._hashhide = {};
    Lbf.shidecount(0);
};
Lbf.loadmatch = function () {
    if (Lmatch.history) { return; }
    //加载联赛列表
    var x;
    var arr = [];
    var k = 1;
    var type = Lbf._cookielan == 3 ? 3 : 3;
    var i = 0;
    var match = Lmatch._match;
    var d;
    arr.push('<table cellpadding="0" cellspacing="4" class="tableList" id="wdlTable" ondblclick="Lsys.printerror()"><tbody id="dleague">'); //dleague
    for (var key in match) {
        x = k % type;
        d = match[key];
        if (x == 1) { arr.push('<tr>'); }
        arr.push('<td><input type="checkbox" value="' + key + '" checked="checked" /></td><td><div style="background-color:' + d.bgcolor + ';"');
        arr.push('>&nbsp;</div></td><td>' + d.name + '</td>');
        if (x == 0) { arr.push('</tr>'); }
        k++;
        i++;
    }
    if ((i - 1) % type != 0) {
        x = type - ((i - 1) % type);
        for (var j = 1; j < x; j++) {
            arr.push('<td colspan="3">&nbsp;</td>');
        }
        arr.push('</tr>');
    }
    arr.push('</tbody></table>');
    var div = $("MyLeague");
    div.innerHTML = arr.join("");
    var ins = div.getElementsByTagName('input');
    var ck;
    for (var i = 0, l = ins.length; i < l; i++) {
        ck = ins[i];
        ck.onclick = Lbf.matchselect;
    }
};
Lbf.unselbyxid = function (xid, par) {
    var arr = $(xid).getElementsByTagName("input");
    var k = 0, count = 0;
    var ck;
    var hash = {};
    var d;
    var isot = Lbf.isOtherInfo();
    for (var i = 0, l = arr.length; i < l; i++) {
        ck = arr[i];
        if (ck.checked) {
            hash[par.action + ck.value] = 1;
            count++;
        }
        ck.checked = !ck.checked;
    }
    var tr, tr2;
    var id, vi;
    var rows = Lbf._tbody.getElementsByTagName(Lsys.rowTag); ;
    var isall = count == arr.length;
    if (isall) { vi = ck.checked ? '' : 'none'; }
    Lbf._hashhide = {};
    for (var i = 0, l = rows.length; i < l; i++) {
        tr = rows[i];
        if (!tr.id) { continue; }
        tr2 = Lbf.trMore(tr);
        if (tr2) { i++; }
        d = tr._data;
        if (!isall) {
            vi = hash[par.action + Lbf.filterTr(par, d, tr)] ? 'none' : '';
        }
        tr.style.display = vi;
        if (vi) {
            k++;
            Lbf._hashhide[tr.id] = null;
            if (tr2) { tr2.style.display = vi; }
            tr._hide = true;
        } else {
            if (isot && d._more) { if (tr2) { tr2.style.display = vi; } }
            tr._hide = false;
        }
    }
    Lbf.shidecount(k);
};
Lbf.isOtherInfo = function () {
    return true;
};
Lbf.unselbymatch = function () {
    //按联赛反选
    Lbf.unselbyxid("wdlTable", { action: 'lsid', type: 0 });
};
Lbf.selectbyxid = function (ck, key, par) {
    var tr, tr2;
    var isot = Lbf.isOtherInfo();
    var vi = ck.checked ? '' : 'none';
    var k = Lbf._hidecount;
    var rows = Lbf._tbody.getElementsByTagName(Lsys.rowTag); ;
    var d, v;
    for (var i = 0, l = rows.length; i < l; i++) {
        tr = rows[i];
        if (!tr.id) { continue; }
        if (Lbf.trMore(tr)) { i++; }
        d = tr._data;
        if (Lbf.filterTr(par, d, tr) != key) { continue; }
        tr.style.display = vi;
        tr2 = Lbf.trMore(tr);
        if (vi) {
            k++;
            Lbf._hashhide[tr.id] = null;
            if (tr2) { tr2.style.display = vi; }
            tr._hide = true;
        } else {
            k--;
            delete Lbf._hashhide[tr.id];
            if (isot && d._more) { if (tr2) { tr2.style.display = vi; } }
            tr._hide = false;
        }
    }
    Lbf.shidecount(k);
};
Lbf.matchselect = function () {
    //联赛选择
    Lbf.selectbyxid(this, this.value, { action: 'lsid', type: 0 });
};
Lbf.filterTr = function (par, d, tr) {
    var dv;
    switch (par.type) {
        case 1:
            dv = tr._match[par.action];
            break;
        default:
            dv = d[par.action];
            break;
    }
    if (dv == undefined) { dv = par.dv; }
    return dv;
};
Lbf._plIsLoad = false;
Lbf._loadmatchcount = 0;
Lbf._first = true;
Lbf.play2 = function () {
    if (!Lbf._plIsLoad) {
        //必须两个都装载完毕
        return;
    }
    if (Lbf._loadmatchcount > 1 && Lmatch._data.length < 1) {
        //没有数据
        Lbf.waitReload();
        return;
    }
    Lbf._plIsLoad = false;
    Lbf.setSwitchInfo(80, 95); //setPrecBreak   
    if (!Lmatch.history) {
        var match = Lmatch._match;
        var arr = [];
        var objCountry = Lmatch._country = {};
        var index = 0;
        var countryid = 0;
        for (var key in match) {
            arr = match[key];
            countryid = arr[5];
            objCountry[countryid] = arr[2];
            if (arr[1].substr(0, 1) != '#') { arr[1] = '#' + arr[1]; }
            match[key] = { id: key, name: arr[0], bgcolor: arr[1], countryId: countryid, link: arr[3] == 1, type: arr[4], _rowindex: arr[6] };
        }
    }
    Lbf.initOdds();
    Lsys.newTimeout('render_hide', setTimeout(Lbf.hidemorematch, 500));
    clearInterval(Lbf._outLoadMatchChange);
    if (Lsys.oddsgoalfile) {
        Lbf._outLoadMatchChange = setInterval(Lbf.loadMatchChange, 6000);
    }
    if (!Lbf._first) {
        return;
    }
    Lbf._first = false;
    setInterval(Lbf.loadOddsChange, 3000);
};

Lbf.poplayershow = function () {
    Lsys.delTimeout('poptid');
    Lbf._poplayer.style.visibility = "visible";
};
Lbf.poplayerhide = function () {
    Lsys.newTimeout('poptid', setTimeout(Lbf.poplayerclose, 200));
};
Lbf.poplayerclose = function () {
    Lbf._poplayer.style.visibility = "hidden";
};
Lbf.showpop = function (e) {
    var o;
    if (e) { o = e.target; } else { e = window.event; o = e.srcElement; }
    if (!o.init) {
        var alt = o.getAttribute('myalt');
        if (alt) { o.pop = alt; o.removeAttribute('myalt'); }
        o.init = true;
    }
    if (o.pop != Lbf._spop) {
        Lbf._spop = o.pop;
        if (Lbf._spop) {
            Lbf.poplayershow();
            var mos = Lposition.cursor(e);
            var cus = Lposition.offset(o);
            var player = Lbf._poplayer;
            player.innerHTML = Lbf._spop.replace(/\^br/g, "<br />");
            player.style.left = (mos.x - player.clientWidth / 2) + "px";
            player.style.top = (cus.y - player.clientHeight) + 'px';
            player.pop = Lbf._spop;
        } else {
            Lbf.poplayerhide();
        }
    } else if (o.pop) {
        Lsys.delTimeout('poptid');
    }
};
Lbf.resetXml = function () {
    Lajax.delXml('matchChange')
    var arr = Lsys.oddschangefile.split(',');
    for (var i = 0, l = arr.length; i < l; i++) {
        Lajax.delXml('oddsChange' + i);
    }
};
Lbf.loadMatchChange = function () {
    if (Lsys.stop || Lmatch.noMatch || !Lsys.oddsgoalfile) { return; }
    var name = 'matchChange';
    var uri = Lsys.formatUri(Lsys.oddsgoalfile);
    Lajax.send(name, Lbf.updateMatch, uri);
};
Lbf.loadOddsChange = function () {
    if (Lsys.stop || Lmatch.noMatch) { return; }
    var arr = Lsys.oddschangefile.split(',');
    var uri;
    for (var i = 0, l = arr.length; i < l; i++) {
        uri = Lsys.formatUri(arr[i]);
        Lajax.send('oddsChange' + i, Lbf.updatePl, uri);
    }
};
Lbf.loadPlInitCall = function (txt) {
    if (Lsys.tryEval(txt)) {
        Lbf._plIsLoad = true;
        Lbf.play2();
    } else {
        //Lsys.newLog('加载初盘数据源错误');
        //重新加载
        Lsys.newTimeout('loadPlInitCall', setTimeout(Lbf.loadPlInit, 100));
    }
};
Lbf.loadPlInit = function () {
    //加载初盘数据
    var name = 'wJsMatchOdds';
    var uri = Lsys.formatUri(Lsys.oddsfile);
    Lajax.send(name, Lbf.loadPlInitCall, uri);
};
Lbf.loadmatchinfo = function (isHand) {
    if (isHand == true) {
        Lbf.setSwitchInfo(1, 80); //setTimeBreak
    }
    Lbf._loadmatchcount++;
    Lbf.loadPlInit();
    Lbf._reload = false;
};
Lbf.slanguage = function (n) {
    //切换语言
    if (Lbf._cookielan == n) { return; }
    $('lan_' + Lbf._cookielan).checked = false;
    $('alan_' + Lbf._cookielan).className = "";
    $('lan_' + n).checked = true;
    $('alan_' + n).className = "red";
    Lbf._cookielan = n;
    Lbf.cookieNumberSet('lan', n);
    var txt = '';
    switch (n) {
        case 1: txt = '繁体'; break;
        case 2: txt = '简体'; break;
        case 3: txt = 'English'; break;
    }
    Lsys.initTimeout();
    Lbf.setSwitchInfo(0, 0, '正在加载' + Lsys.name + '（' + txt + '）...');
    Lsys.loadData();
};
Lbf.tablestyle = function (name, skip) {
    $('wLive').className = name;
    if (skip) { return; }
    Lbf.cookieNumberSet('#ts', name);
    Lbf._tableStyle = name;
};
Lbf.fontsize = function (name, skip) {
    if (Lmatch.history) { return; }
    if (name == 'small') {
        $('tfont_small_2').checked = $('tfont_small').checked = true;
    } else {
        $('tfont_big_2').checked = $('tfont_big').checked = true;
    }
    $('dm').className = 'ma ' + name;
    if (skip) { return; }
    Lbf.cookieNumberSet('#fs', name);
};

Lbf.play = function () {
    Lsys.begin = true;
    var cookie = Lbf._cookieNumber = Lcookie.keys('Lbf_number');
    Lbf._cookiepki = Lcookie.value(cookie, 'pk', 1); //让球盘口 =1 中文,=2数字
    Lbf._cookielan = Lcookie.value(cookie, 'lan', 1); //语言 =1 简体,=2繁体,=3 英文
    Lbf._cookiepm = Lcookie.value(cookie, 'pm', 1); //排名 =0 不开启,=1开启
    Lbf._cookiesound = Lcookie.value(cookie, 'sound', 0); //声音
    Lbf._cookierqs = Lcookie.value(cookie, 'rqs', 1); // 入球声音
    Lbf._ckCredSound = Lcookie.value(cookie, 'hps', 1); //红牌声音
    Lbf._cookiehideids = Lcookie.get('Lbf_hideid', ''); //隐藏赛事
    var name = '';
    name = Lcookie.value(cookie, '#ps', ''); if (name) { Lbf.pageStyle(name, true); }
    name = Lcookie.value(cookie, '#fs', 'small'); if (name) { Lbf.fontsize(name, true); }
    name = Lbf._tableStyle = Lcookie.value(cookie, '#ts', 'dtable'); if (name) { Lbf.tablestyle(name, true); var obj = $('tstyle_' + name); if (obj) { obj.checked = true; } }

    $('qdpm2').checked = $('wQdpm').checked = Lbf._cookiepm == 1;
    $('wRqs').checked = $('wRqs2').checked = Lbf._cookierqs == 1;
    $('wHps').checked = Lbf._ckCredSound == 1;
    $('wRqw').checked = Lbf._cookierqw == 1;
    $('wHpw').checked = Lbf._ckCredWindow == 1;
    $('selsound').options[Lbf._cookiesound].selected = true;
    $('lan_' + Lbf._cookielan).checked = true;
    $('alan_' + Lbf._cookielan).className = "red";
    if (Lbf._cookiepki == 1) { $('pkfg0').checked = true; $ } else { ('pkfg1').checked = true; }
    if (!document.onmouseover) { document.onmouseover = Lbf.showpop; }
    //Lsys.newTimeout('didTestweb',setTimeout(Lnet.test,100));
    window.onbeforeunload = function () {
        Lcookie.remove('Lbf_hideid');
    };

    if (document.all) {
        Lbf.appendElement(Lbf.getSwf('checkonline.swf'));
        Lsys.setTitle();
        setInterval("_countJs = _countFlash;", Lsys.refInter);
    }
    Lbf.setLogin();

    //Lad.convertHistory();
    Lbf.load();
    Lsys.loadData();
    setTimeout(Lbf.loadCount, 3000);
};
Lbf.getSwf = function (fn) {
    return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="25" height="16"><param name="movie" value="' + fn + '"><param name="quality" value="height"><param name="wmode" value="transparent" /><embed src="' + fn + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="22" height="16"></embed></object>';
};
Lbf.appendElement = function (html) {
    var hdiv = Lbf._hdiv;
    if (!hdiv) { hdiv = Lbf._hdiv = $('wFlyDiv'); }
    var div = document.createElement('div');
    div.innerHTML = html;
    hdiv.appendChild(div);
};

Lbf.cookieNumberSet = function (name, value) {
    var arr = [];
    var cookie = Lbf._cookieNumber;
    cookie[name] = value;
    for (var key in cookie) {
        arr.push(key + '=' + cookie[key]);
    }
    Lcookie.set('Lbf_number', arr.join(';'), 1000);
};
Lbf.ssort = function () {/*开启排名*/
    if (Lmatch.history) { return; }
    var on = Lbf._cookiepm == 0;
    var visible = on ? "none" : "";
    var v = Lbf._tbody.getElementsByTagName("code");
    for (var i = 0, l = v.length; i < l; i++) {
        v[i].style.display = visible;
    }
};
Lbf.sortClick = function (o) {
    Lbf._cookiepm = Lbf._cookiepm == 1 ? 0 : 1;
    Lbf.cookieNumberSet('pm', Lbf._cookiepm);
    Lbf.ssort();
};
Lbf.sinsound = function (o) {
    //更改入球声音
    Lbf.cookieNumberSet('rqs', Lbf._cookierqs = o.checked ? 1 : 0);
    $('wRqs').checked = $('wRqs2').checked = Lbf._cookierqs == 1;
};
Lbf.loadCount = function () {
    var mycount = $('wCount');
    if (!mycount) { return; }
    function yesinit() {
        function y_gVal(iz) { var endstr = document.cookie.indexOf(";", iz); if (endstr == -1) endstr = document.cookie.length; return document.cookie.substring(iz, endstr); }
        function y_g(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; var j; while (i < clen) { j = i + alen; if (document.cookie.substring(i, j) == arg) return y_gVal(j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; }
        function cc_k() { var y_e = new Date(); var y_t = 93312000; var yesvisitor = 1000 * 36000; var yesctime = y_e.getTime(); y_e.setTime(y_e.getTime() + y_t); var yesiz = document.cookie.indexOf("cck_lasttime"); if (yesiz == -1) { document.cookie = "cck_lasttime=" + yesctime + "; expires=" + y_e.toGMTString() + "; path=/"; document.cookie = "cck_count=0; expires=" + y_e.toGMTString() + "; path=/"; return 0; } else { var y_c1 = y_g("cck_lasttime"); var y_c2 = y_g("cck_count"); var y_c1 = parseInt(y_c1); y_c2 = parseInt(y_c2); var y_c3 = yesctime - y_c1; if (y_c3 > yesvisitor) { y_c2 = y_c2 + 1; document.cookie = "cck_lasttime=" + yesctime + "; expires=" + y_e.toGMTString() + "; path=/"; document.cookie = "cck_count=" + y_c2 + "; expires=" + y_e.toGMTString() + "; path=/"; } return y_c2; } }
        var yesdata = '&refe=' + escape(document.referrer) + '&location=' + escape(document.location) + '&color=' + screen.colorDepth + 'x&resolution=' + screen.width + 'x' + screen.height + '&returning=' + cc_k() + '&language=' + navigator.systemLanguage + '&ua=' + escape(navigator.userAgent);
        var span = document.createElement('div'); mycount.appendChild(span);
        span.innerHTML = '<img src="http://count1.51yes.com/sa.aspx?id=' + (window._COUNTID || '13551779') + yesdata + '" border=0 width=0 height=0 />';
    }
    yesinit();
};

Lbf.adFixed = function () {
    Lsys.newTimeout('outAdFixed', setTimeout(Lbf.adFixedScroll, 100));
};
Lbf.adFixedScroll = function () {
    var ad = Lbf._wAdFixed;
    if (!ad) {
        ad = Lbf._wAdFixed = {};
        ad.top = $('wAdFixed');
        ad.bottom = $('wAdFlyBottomBox');
        ad.flyRight = $('wAdFlyRight');
        ad.bottom._h = 380 + 10;
    }
    var top = document.body.scrollTop; // || document.documentElement.scrollTop;
    if (!document.all) {
        var css = (top > 642) ? 'adFixed2' : 'adFixed';
        if (ad.top.className != css) {
            ad.top.className = css;
        }
        return;
    }
    var toph = window._toph || 566;
    var y = top > toph ? top : toph;
    if (y != ad.top._y) {
        ad.top.style.top = y + 'px';
        ad.top._y = y;
    }
    y = top + document.body.clientHeight - ad.bottom._h;
    if (y != ad.bottom._y) {
        ad.bottom.style.top = y + 'px';
        ad.bottom._y = y;
    }
    var w = document.body.clientWidth;
    if (w != ad.flyRight._w) {
        ad.flyRight.style.left = (w - ad.flyRight.clientWidth - 1) + 'px';
        ad.flyRight._w = w;
    }
};
Lbf.winOpen = function (url) {
    window.open(url);
};
Lbf.win_panlu = function (id) {
    Lbf.winOpen('http://info.8bo.com/matchinfo.html?id=' + id + '&area=a4');
};
Lbf.win_analysis = function (id) {
    Lbf.winOpen('http://info.8bo.com/matchinfo.html?id=' + id + '&area=a2');
};
Lbf.win_zs = function (id) {
    Lbf.winOpen('http://info.8bo.com/matchinfo.html?id=' + id + '&area=a3');
};
Lbf.win_asia = function (id) {
    Lbf.winOpen('http://info.8bo.com/matchinfo.html?id=' + id + '&area=c2');
};
Lbf.win_op = function (id, f) {
    Lbf.winOpen('http://info.8bo.com/matchinfo.html?id=' + id + '&area=c1');
};
Lbf.win_bd = function (id) {
    Lbf.winOpen('bdlist.aspx?id=' + id + '&companyid=' + Lsys.cid + '&typeid=1');
};
Lbf.win_rqs = function (id) {
    Lbf.winOpen('rqslist.asp?id=' + id + '&companyid=' + Lsys.cid);
};
Lbf.win_ol = function (id, typeid) {
    var url = 'oddslist.aspx';
    if (Lsys.isOpenZd) {
        typeid += 2;
        url = 'oddszdlist.aspx';
    }
    Lbf.winOpen(url + '?id=' + id + '&companyid=' + Lsys.cid + '&typeid=' + typeid + '&ot=' + Lsys.oddtype);
};
Lbf.win_ol_old = function (id, typeid) {
    if (window._aomenyl) {
        Lbf.winOpen('/vip/oddslist.aspx?id=' + id + '&companyid=' + Lsys.cid + '&typeid=' + typeid + '&ot=' + Lsys.oddtype);
    } else {
        Lbf.win_ol(id, typeid);
    }
};
Lbf.win_bqc = function (id) { Lbf.winOpen('bqclist.aspx?id=' + id + '&companyid=' + Lsys.cid); };

Lbf.closefbox = function (obj) {
    while (obj) {
        if (obj.className.indexOf('fbox') != -1) {
            obj.style.display = 'none';
            break;
        }
        obj = obj.parentNode;
    }
    Lbf.closecal();
};
Lbf.openfbox = function (name, yadd, y) {
    var obj = $(name); if (!obj) { return; }
    if (Lbf._currentfobx && obj != Lbf._currentfobx) {
        Lbf._currentfobx.style.display = 'none';
    }
    Lbf._currentfobx = obj;
    obj.style.display = 'block';
    if (y) { obj.style.top = yadd + (y + obj.clientHeight) + 'px'; }
    Lbf.closecal();
};
Lbf.netsel = function (disp) {
    var box = Lbf._wNetSelBox;
    if (!box) { box = Lbf._wNetSelBox = $('wNetSelBox'); }
    box.style.visibility = disp ? 'visible' : 'hidden';
};

/*tt browser*/
var _countJs = 0;
var _countFlash = 0;
function checkpageonline() {
    var k = ++_countFlash - _countJs;
    //document.title = k + ',' + (k > 1);
    if (Lsys.begin && k > 2) {
        Lbf.loadOddsChange();
        Lbf.loadMatchChange();
        Lbf.waitReload(true);
    }
}
/*   ------------兼容------------     */
function showMenu(id) {
    var obj = document.getElementById(id);
    if (!obj)
        return;
    if (obj.style.display != 'block')
        obj.style.display = 'block';
    else
        obj.style.display = 'none';
}
