var pageIndex = 1;
function LoadData() {
//获取数据
var oXmlHttp = zXmlHttp.createRequest();
strCompanyId = strCompanyId.replace(/(^\,*)|(\,*$)/g, "");
if(strCompanyId == '1,12,8,3,24')
var DataLink = 'data/oddsData.js';
else
var DataLink = "data/otherData.js?companyID=" + strCompanyId ;
oXmlHttp.open("get", DataLink, false); //strCompanyId
oXmlHttp.send(null);
var data = oXmlHttp.responseText;
var recommends= GetRecommend();
strZuodiList = ",";
matchdata.LeagueList = new _glodds.List();
matchdata.MatchList = new _glodds.List();
matchdata.CompanyList = new _glodds.List();
matchdata.Odds1List = new _glodds.List();
matchdata.Odds2List = new _glodds.List();
matchdata.Odds3List = new _glodds.List();
matchdata.CTypeNum = new Object();
//分隔大数据域
var domains = data.split(_glodds.SplitDomain);
var leagueItem, matchItem, companyItem, nd;
//处理联赛数据域
var leagueDomain = domains[0].split(_glodds.SplitRecord);
matchdata.LeagueNum = leagueDomain.length;
for (var i = 0; i < leagueDomain.length; i++) {
leagueItem = new _glodds.League(leagueDomain[i]);
matchdata.LeagueList.Add(leagueItem.lId, leagueItem);
}
//处理亚指数据域
var oddsDomain = domains[2].split(_glodds.SplitRecord);
for (var i = 0; i < oddsDomain.length; i++) {
oddsItem = new _glodds.OddsAsian(oddsDomain[i]);
matchdata.Odds1List.Add(oddsItem.mId + "_" + oddsItem.cId, oddsItem);
}
//处理欧指数据域
var oddsDomain = domains[3].split(_glodds.SplitRecord);
for (var i = 0; i < oddsDomain.length; i++) {
oddsItem = new _glodds.Odds1x2(oddsDomain[i]);
matchdata.Odds2List.Add(oddsItem.mId + "_" + oddsItem.cId, oddsItem);
}
//处理大小球数据域
var oddsDomain = domains[4].split(_glodds.SplitRecord);
for (var i = 0; i < oddsDomain.length; i++) {
oddsItem = new _glodds.OddsOU(oddsDomain[i]);
matchdata.Odds3List.Add(oddsItem.mId + "_" + oddsItem.cId, oddsItem);
}
//处理日期数据域
var str = "", tmp;
if (matchType != 2 && level != 0) {
var dateDomain = domains[5].split(_glodds.SplitRecord);
for (var i = 0; i < dateDomain.length && i<8; i++) {
tmp = dateDomain[i].split(_glodds.SplitColumn);
tmp = new Date(tmp[0], parseInt(tmp[1]) - 1, tmp[2]);
if (selDate == "") selDate = tmp;
if (selDate.toString() == tmp.toString())
str += "" + _oddsUitl.getDayStr(tmp) + week[tmp.getDay()] + " "
else
str += "" + _oddsUitl.getDayStr(tmp) + week[tmp.getDay()] + " "
}
}
document.getElementById("dateList").innerHTML = str;
//处理比赛数据
var matchDomain = domains[1].split(_glodds.SplitRecord);
matchdata.MatchNum = 0;
var html = new Array();
for (var i = 0; i < matchDomain.length; i++) {
matchItem = new _glodds.Match(matchDomain[i]);
if (matchItem.level > level) continue;
if (level == 0) {
if (matchItem.level == "-1" && matchType == 2 || matchItem.level == "-2" && matchType == 1) continue;
}
else {
if (matchItem.state == "0" && matchType == 2 || matchItem.state != "0" && matchType == 1) continue;
}
if (matchType != 2 && level != 0) {
if ((matchItem.time - selDate) / 60000 / 60 < 8) continue;
if ((matchItem.time - new Date() - difftime) / 60000 / 60 > 4) {
if ((matchItem.time - selDate) / 60000 / 60 >= 32) continue;
}
}
var haveOdds = false;
for (var j = 0; j < SelCompany.length; j++) {
if (matchdata.Odds1List.Get(matchItem.mId + "_" + SelCompany[j]) != null) { haveOdds = true; break; };
if (matchdata.Odds2List.Get(matchItem.mId + "_" + SelCompany[j]) != null) { haveOdds = true; break; };
if (matchdata.Odds3List.Get(matchItem.mId + "_" + SelCompany[j]) != null) { haveOdds = true; break; };
}
if (!haveOdds) continue;
matchdata.MatchNum++;
matchdata.MatchList.Add(matchItem.mId, matchItem);
leagueItem = matchdata.LeagueList.Get(matchItem.lId);
leagueItem.matchNum++;
leagueItem.showNum++;
if (matchItem.level == -1 || matchItem.level == 0)//胜负彩
{
leagueItem.shengfu++;
}
if (matchItem.level == -2 || matchItem.level == 0)//北京单场
{
leagueItem.beidan++;
}
html.push("
");
html.push(" | ");
if (leagueItem.url != "")
html.push("" + leagueItem.getName() + "");
else
html.push(leagueItem.getName());
html.push(" | " + _oddsUitl.getDtStr(matchItem.time) + " |
| ");
html.push("公司 | 主队 | 让球 | 客队 | ");
html.push("主胜 | 和局 | 客胜 | ");
html.push("大球 | 大小 | 小球 | ");
html.push("变化 |
");
html.push("");
html.push("");
html.push("");
html.push(" vs ");
html.push(" | ");
if (matchItem.state == "0")
html.push(" | ");
else {
var state = state_ch[parseInt(matchItem.state) + 14].split(",")[lang];
switch (matchItem.state) {
case "1":
state = Math.floor((new Date() - matchItem.time2 - difftime) / 60000);
if (state > 45) state = "45+"
if (state < 1) state = "1";
state = state + "";
break;
case "3":
state = Math.floor((new Date() - matchItem.time2 - difftime) / 60000) + 46;
if (state > 90) state = "90+";
if (state < 46) state = "46";
state = state + "";
break;
}
html.push("" + matchItem.homeScore + " " + state + " " + matchItem.guestScore + " | ");
}
html.push(" ");
html.push("");
html.push("");
html.push(" | |
");
var haszoudi = false;
for (var j = 0; j < SelCompany.length; j++) {
oddsItem = matchdata.Odds1List.Get(matchItem.mId + "_" + SelCompany[j]);
html.push("");
html.push("" + company[SelCompany[j]] + (oddsItem != null && oddsItem.zoudi == "True" ? "" : "") + " | ");
if (oddsItem != null && oddsItem.zoudi == "True"){
haszoudi = haszoudi || true;
}
if (oddsItem != null) {
if (showFirstOdds) {
html.push("" + oddsItem.homeF + " " + oddsItem.home + " | ");
html.push("" + Goal2GoalCn(oddsItem.goalF) + " " + Goal2GoalCn(oddsItem.goal) + " | ");
html.push("" + oddsItem.awayF + " " + oddsItem.away + " | ");
}
else {
html.push("" + oddsItem.home + " | ");
html.push("" + Goal2GoalCn(oddsItem.goal) + " | ");
html.push("" + oddsItem.away + " | ");
}
}
else
html.push(" | | | ");
oddsItem = matchdata.Odds2List.Get(matchItem.mId + "_" + SelCompany[j]);
if (oddsItem != null) {
if (showFirstOdds) {
html.push("" + oddsItem.hwF + " " + oddsItem.hw + " | ");
html.push("" + oddsItem.stF + " " + oddsItem.st + " | ");
html.push("" + oddsItem.awF + " " + oddsItem.aw + " | ");
}
else {
html.push("" + oddsItem.hw + " | ");
html.push("" + oddsItem.st + " | ");
html.push("" + oddsItem.aw + " | ");
}
}
else
html.push(" | | | ");
oddsItem = matchdata.Odds3List.Get(matchItem.mId + "_" + SelCompany[j]);
if (oddsItem != null) {
if (showFirstOdds) {
html.push("" + oddsItem.overF + " " + oddsItem.over + " | ");
html.push("" + Goal2GoalCn2(oddsItem.goalF) + " " + Goal2GoalCn2(oddsItem.goal) + " | ");
html.push("" + oddsItem.underF + " " + oddsItem.under + " | ");
}
else {
html.push("" + oddsItem.over + " | ");
html.push("" + Goal2GoalCn2(oddsItem.goal) + " | ");
html.push("" + oddsItem.under + " | ");
}
}
else
html.push(" | | | ");
html.push(" |
");
}
html.push("
");
if (haszoudi){
strZuodiList += matchItem.mId + ",";
}
if (matchItem.state == 0)
strNotOpenList += matchItem.mId + ",";
else if (matchItem.state > 0)
strRunList += matchItem.mId + ",";
//if (matchdata.MatchNum <= adinfo1.length) {
// html.push("");
//}
}
if (matchdata.MatchNum == 0) html.push("没有符合要求的比赛,您可以选择查看全部赛事。
");
document.getElementById("odds").innerHTML = html.join("");
var j = 0;
RenderLeaguelist(pageIndex);
//if (oldLevel != -1 && oldLevel != level) document.getElementById("matchType" + oldLevel).className = "";
//if (oldLevel != level) document.getElementById("matchType" + level).className = "selected";
//oldLevel = level;
document.getElementById("scoreLoading").style.display = "none";
if (typeof (showTextAd) !== "undefined")
showTextAd();
}
var xml1 = zXmlHttp.createRequest();
var xmlBf = zXmlHttp.createRequest();
var oldXML = "", oldBfXML = "";
function getxml() {
try {
xml1.open("get", "data/ch_odds.xml?" + Date.parse(new Date()), true);
xml1.onreadystatechange = refresh;
xml1.send(null);
} catch (e) { }
window.setTimeout("getxml()", 6000);
}
function refresh() {
try {
if (xml1.readyState != 4 || (xml1.status != 200 && xml1.status != 0)) return;
if (oldXML == xml1.responseText) return
oldXML = xml1.responseText;
var arr;
var changeIDList = ",";
//亚指
var root = xml1.responseXML.documentElement.childNodes[0];
var playSound = false;
for (i = 0; i < root.childNodes.length; i++) {
arr = root.childNodes[i].childNodes[0].nodeValue.split(","); //matchid,companyid,goal,home,away,close,zoudi
if (strCompanyId.indexOf("," + arr[1] + ",") < 0) continue;
var tr = document.getElementById("odds_" + arr[0] + "_" + arr[1]);
if (tr == null) continue;
oddsItem = matchdata.Odds1List.Get(arr[0] + "_" + arr[1]);
if (oddsItem == null) { //开盘
var tmp = arr[0] + "," + arr[1] + "," + arr[2] + "," + arr[3] + "," + arr[4] + "," + arr[2] + "," + arr[3] + "," + arr[4] + "," + arr[5] + "," + arr[6];
oddsItem = new _glodds.OddsAsian(tmp);
matchdata.Odds1List.Add(oddsItem.mId + "_" + oddsItem.cId, oddsItem);
tr.cells[2].style.backgroundColor = "#eed479";
tr.cells[1].style.backgroundColor = "#eed479";
tr.cells[3].style.backgroundColor = "#eed479";
if (showFirstOdds) {
tr.cells[1].innerHTML = "" + oddsItem.homeF + "
" + oddsItem.home + "
";
tr.cells[2].innerHTML = "" + Goal2GoalCn(oddsItem.goalF) + "
" + Goal2GoalCn(oddsItem.goal) + "
";
tr.cells[3].innerHTML = "" + oddsItem.awayF + "
" + oddsItem.away + "
";
}
else {
tr.cells[1].innerHTML = "" + oddsItem.home + "
";
tr.cells[2].innerHTML = "" + Goal2GoalCn(oddsItem.goal) + "
";
tr.cells[3].innerHTML = "" + oddsItem.away + "
";
}
if (oddsItem.close == "True")
tr.style.backgroundColor = "#ccc";
else
tr.style.backgroundColor = "white";
tr.cells[0].innerHTML = company[arr[1]] + (oddsItem.zoudi == "True" ? "" : "");
if (changeIDList.indexOf("," + arr[0] + "_" + arr[1] + ",") < 0) changeIDList += arr[0] + "_" + arr[1] + ",";
}
if (oddsItem.goal != arr[2] || oddsItem.home != arr[3] || oddsItem.away != arr[4]) {
tr.cells[2].style.backgroundColor = TdBgColor(oddsItem.goal, arr[2]);
tr.cells[1].style.backgroundColor = TdBgColor(oddsItem.home, arr[3]);
tr.cells[3].style.backgroundColor = TdBgColor(oddsItem.away, arr[4]);
oddsItem.goal = arr[2];
oddsItem.home = arr[3];
oddsItem.away = arr[4];
if (showFirstOdds) {
tr.cells[1].innerHTML = "" + oddsItem.homeF + "
" + oddsItem.home + "
";
tr.cells[2].innerHTML = "" + Goal2GoalCn(oddsItem.goalF) + "
" + Goal2GoalCn(oddsItem.goal) + "
";
tr.cells[3].innerHTML = "" + oddsItem.awayF + "
" + oddsItem.away + "
";
}
else {
tr.cells[1].innerHTML = "" + oddsItem.home + "
";
tr.cells[2].innerHTML = "" + Goal2GoalCn(oddsItem.goal) + "
";
tr.cells[3].innerHTML = "" + oddsItem.away + "
";
}
if (changeIDList.indexOf("," + arr[0] + "_" + arr[1] + ",") < 0) changeIDList += arr[0] + "_" + arr[1] + ",";
}
if (oddsItem.close != arr[5]) {
oddsItem.close = arr[5];
if (oddsItem.close == "True")
tr.style.backgroundColor = "#ccc";
else
tr.style.backgroundColor = "white";
}
if (oddsItem.zoudi != arr[6]) {
oddsItem.zoudi = arr[6];
tr.cells[0].innerHTML = company[arr[1]] + (oddsItem.zoudi == "True" ? "" : "");
}
}
//欧指
root = xml1.responseXML.documentElement.childNodes[1];
for (i = 0; i < root.childNodes.length; i++) {
arr = root.childNodes[i].childNodes[0].nodeValue.split(","); //matchid,companyid,hw,st,gw
if ($.inArray(arr[1], SelCompany)<0) continue;
var tr = document.getElementById("odds_" + arr[0] + "_" + arr[1]);
if (tr == null) continue;
oddsItem = matchdata.Odds2List.Get(arr[0] + "_" + arr[1]);
if (oddsItem == null) { //开盘
var tmp = arr[0] + "," + arr[1] + "," + arr[2] + "," + arr[3] + "," + arr[4] + "," + arr[2] + "," + arr[3] + "," + arr[4];
oddsItem = new _glodds.Odds1x2(tmp);
matchdata.Odds2List.Add(oddsItem.mId + "_" + oddsItem.cId, oddsItem);
tr.cells[4].style.backgroundColor = "#eed479"
tr.cells[5].style.backgroundColor = "#eed479"
tr.cells[6].style.backgroundColor = "#eed479"
if (showFirstOdds) {
tr.cells[4].innerHTML = "" + oddsItem.hwF + "
" + oddsItem.hw + "
";
tr.cells[5].innerHTML = "" + oddsItem.stF + "
" + oddsItem.st + "
";
tr.cells[6].innerHTML = "" + oddsItem.awF + "
" + oddsItem.aw + "
";
}
else {
tr.cells[4].innerHTML = "" + oddsItem.hw + "
";
tr.cells[5].innerHTML = "" + oddsItem.st + "
";
tr.cells[6].innerHTML = "" + oddsItem.aw + "
";
}
if (changeIDList.indexOf("," + arr[0] + "_" + arr[1] + ",") < 0) changeIDList += arr[0] + "_" + arr[1] + ",";
}
if (oddsItem.hw != arr[2] || oddsItem.st != arr[3] || oddsItem.gw != arr[4]) {
tr.cells[4].style.backgroundColor = TdBgColor(oddsItem.hw, arr[2]);
tr.cells[5].style.backgroundColor = TdBgColor(oddsItem.st, arr[3]);
tr.cells[6].style.backgroundColor = TdBgColor(oddsItem.aw, arr[4]);
oddsItem.hw = arr[2];
oddsItem.st = arr[3];
oddsItem.aw = arr[4];
if (showFirstOdds) {
tr.cells[4].innerHTML = "" + oddsItem.hwF + "
" + oddsItem.hw + "
";
tr.cells[5].innerHTML = "" + oddsItem.stF + "
" + oddsItem.st + "
";
tr.cells[6].innerHTML = "" + oddsItem.awF + "
" + oddsItem.aw + "
";
}
else {
tr.cells[4].innerHTML = "" + oddsItem.hw + "
";
tr.cells[5].innerHTML = "" + oddsItem.st + "
";
tr.cells[6].innerHTML = "" + oddsItem.aw + "
";
}
if (changeIDList.indexOf("," + arr[0] + "_" + arr[1] + ",") < 0) changeIDList += arr[0] + "_" + arr[1] + ",";
}
}
//大小
root = xml1.responseXML.documentElement.childNodes[2];
for (i = 0; i < root.childNodes.length; i++) {
arr = root.childNodes[i].childNodes[0].nodeValue.split(","); //matchid,companyid,goal,over,under
if ($.inArray(arr[1], SelCompany) < 0) continue;
var tr = document.getElementById("odds_" + arr[0] + "_" + arr[1]);
if (tr == null) continue;
oddsItem = matchdata.Odds3List.Get(arr[0] + "_" + arr[1]);
if (oddsItem == null) { //开盘
var tmp = arr[0] + "," + arr[1] + "," + arr[2] + "," + arr[3] + "," + arr[4] + "," + arr[2] + "," + arr[3] + "," + arr[4];
oddsItem = new _glodds.OddsOU(tmp);
matchdata.Odds3List.Add(oddsItem.mId + "_" + oddsItem.cId, oddsItem);
tr.cells[7].style.backgroundColor = "#eed479";
tr.cells[8].style.backgroundColor = "#eed479";
tr.cells[9].style.backgroundColor = "#eed479";
if (showFirstOdds) {
tr.cells[7].innerHTML = "" + oddsItem.overF + "
" + oddsItem.over + "
";
tr.cells[8].innerHTML = "" + Goal2GoalCn2(oddsItem.goalF) + "
" + Goal2GoalCn2(oddsItem.goal) + "
";
tr.cells[9].innerHTML = "" + oddsItem.underF + "
" + oddsItem.under + "
";
}
else {
tr.cells[7].innerHTML = "" + oddsItem.over + "
";
tr.cells[8].innerHTML = "" + Goal2GoalCn2(oddsItem.goal) + "
";
tr.cells[9].innerHTML = "" + oddsItem.under + "
";
}
if (changeIDList.indexOf("," + arr[0] + "_" + arr[1] + ",") < 0) changeIDList += arr[0] + "_" + arr[1] + ",";
}
if (oddsItem.goal != arr[2] || oddsItem.over != arr[3] || oddsItem.under != arr[4]) {
tr.cells[7].style.backgroundColor = TdBgColor(oddsItem.over, arr[3]);
tr.cells[8].style.backgroundColor = TdBgColor(oddsItem.goal, arr[2]);
tr.cells[9].style.backgroundColor = TdBgColor(oddsItem.under, arr[4]);
oddsItem.goal = arr[2];
oddsItem.over = arr[3];
oddsItem.under = arr[4];
if (showFirstOdds) {
tr.cells[7].innerHTML = "" + oddsItem.overF + "
" + oddsItem.over + "
";
tr.cells[8].innerHTML = "" + Goal2GoalCn2(oddsItem.goalF) + "
" + Goal2GoalCn2(oddsItem.goal) + "
";
tr.cells[9].innerHTML = "" + oddsItem.underF + "
" + oddsItem.under + "
";
}
else {
tr.cells[7].innerHTML = "" + oddsItem.over + "
";
tr.cells[8].innerHTML = "" + Goal2GoalCn2(oddsItem.goal) + "
";
tr.cells[9].innerHTML = "" + oddsItem.under + "
";
}
if (changeIDList.indexOf("," + arr[0] + "_" + arr[1] + ",") < 0) changeIDList += arr[0] + "_" + arr[1] + ",";
}
}
window.setTimeout("colors_water('" + changeIDList + "')", 30000);
if (changeIDList != "," && soundCheck)
audioHelper.play("oddsFlashSound");
} catch (e) { }
}
function colors_water(IDList) {
var A = IDList.split(",");
var tr;
for (var i = 1; i < A.length - 1; i++) {
tr = document.getElementById("odds_" + A[i]);
if (tr == null) continue;
for (var j = 1; j <= 9; j++)
if (j >= 4 && j <= 6)
tr.cells[j].style.backgroundColor = "#F0F4FF";
else
tr.cells[j].style.backgroundColor = "";
}
}
function getbfxml() {
xmlBf.open("get", "/data/change.xml?" + Date.parse(new Date()), true);
xmlBf.onreadystatechange = bfRefresh;
xmlBf.send(null);
window.setTimeout("getbfxml()", 6000);
}
function bfRefresh() {
if (xmlBf.readyState != 4 || (xmlBf.status != 200 && xmlBf.status != 0)) return;
if (oldBfXML == xmlBf.responseText || xmlBf.responseText == "") return
oldBfXML = xmlBf.responseText;
var root = xmlBf.responseXML.documentElement;
var D = new Array();
var matchindex, score1change, score2change, scorechange;
var goTime, hometeam, guestteam, sclassname, score1, score2, tr;
var matchNum = 0;
var notify = document.getElementById("notify").innerHTML;
for (var i = 0; i < root.childNodes.length; i++) {
D = root.childNodes[i].childNodes[0].nodeValue.split("^"); //0:ID,1:state,2:score1,3:score2,4:half1,5:half2,6:card1,7:card2,8:time1,9:time2,10:explain,11:lineup
matchItem = matchdata.MatchList.Get(D[0]);
if (matchItem == null) continue;
score1change = false;
if (matchItem.homeScore != D[2]) {
matchItem.homeScore = D[2];
score1change = true;
document.getElementById("hs_" + matchItem.mId).innerHTML = D[2];
document.getElementById("home_" + matchItem.mId).style.backgroundColor = "red";
}
score2change = false;
if (matchItem.guestScore != D[3]) {
matchItem.guestScore = D[3];
score2change = true;
document.getElementById("gs_" + matchItem.mId).innerHTML = D[3];
document.getElementById("guest_" + matchItem.mId).style.backgroundColor = "red";
}
scorechange = score1change || score2change;
//红牌变化了
if (D[6] != matchItem.h_redcard) {
matchItem.h_redcard = D[6];
if (D[6] == "0")
document.getElementById("redcard1_" + D[0]).innerHTML = "";
else
document.getElementById("redcard1_" + D[0]).innerHTML = " ";
//if (redcard) {
document.getElementById("home_" + matchItem.mId).style.backgroundColor = "#ff8888";
// window.setTimeout("timecolors(" + D[0] +","+ matchindex + ")",12000);
window.setTimeout("bfcolors_water(" + D[0] + ")", 12000);
//}
}
if (D[7] != matchItem.g_redcard) {
matchItem.g_redcard = D[7];
if (D[7] == "0")
document.getElementById("redcard2_" + D[0]).innerHTML = "";
else
document.getElementById("redcard2_" + D[0]).innerHTML = " ";
// if (redcard) {
document.getElementById("guest_" + matchItem.mId).style.backgroundColor = "#ff8888";
// window.setTimeout("timecolors(" + D[0] +","+ matchindex + ")",12000);
window.setTimeout("bfcolors_water(" + D[0] + ")", 12000);
//}
}
//黄牌变化了
if (D[12] != matchItem.h_yellow) {
matchItem.h_yellow = D[12];
if (D[12] == "0")
document.getElementById("yellow1_" + D[0]).innerHTML = "";
else
document.getElementById("yellow1_" + D[0]).innerHTML = " ";
}
if (D[13] != matchItem.g_yellow) {
matchItem.g_yellow = D[13];
if (D[13] == "0")
document.getElementById("yellow2_" + D[0]).innerHTML = "";
else
document.getElementById("yellow2_" + D[0]).innerHTML = " ";
}
//开赛时间
//if(matchItem.time!=D[8]) document.getElementById("mt_"+ matchItem.mId).innerHTML=D[8];
//matchItem.time=D[8];
var t = D[9].split(",");
matchItem.time2 = new Date(t[0], t[1], t[2], t[3], t[4], t[5]);
//状态
if (matchItem.state != D[1]) {
matchItem.state = D[1];
switch (matchItem.state) {
case "0":
document.getElementById("hs_" + matchItem.mId).innerHTML = "";
document.getElementById("time_" + matchItem.mId).innerHTML = "";
document.getElementById("gs_" + matchItem.mId).innerHTML = "";
break;
case "1":
document.getElementById("hs_" + matchItem.mId).innerHTML = D[2];
document.getElementById("gs_" + matchItem.mId).innerHTML = D[3];
goTime = Math.floor((new Date() - matchItem.time2 - difftime) / 60000);
if (goTime > 45) goTime = "45+"
if (goTime < 1) goTime = "1";
document.getElementById("time_" + matchItem.mId).innerHTML = goTime + "";
if (matchType == 1 && level != 0) MoveToBottom(D[0]); //开场隐藏
break;
case "2":
document.getElementById("time_" + matchItem.mId).innerHTML = state_ch[parseInt(D[1]) + 14].split(",")[lang];
break;
case "3":
goTime = Math.floor((new Date() - matchItem.time2 - difftime) / 60000) + 46;
if (goTime > 90) goTime = "90+";
if (goTime < 46) goTime = "46";
document.getElementById("time_" + matchItem.mId).innerHTML = goTime + "";
break;
case "-1":
document.getElementById("time_" + matchItem.mId).innerHTML = state_ch[parseInt(D[1]) + 14].split(",")[lang];
window.setTimeout("MoveToBottom(" + D[0] + ")", 30000);
break;
default:
document.getElementById("time_" + matchItem.mId).innerHTML = state_ch[parseInt(D[1]) + 14].split(",")[lang];
MoveToBottom(D[0]);
break;
}
}
if (scorechange) {
hometeam = matchItem.getT1Name();
score1 = D[2];
score2 = D[3];
guestteam = matchItem.getT2Name();
if (score1change) {
hometeam = "" + matchItem.getT1Name() + "";
score1 = "" + D[2] + "";
}
if (score2change) {
guestteam = "" + matchItem.getT2Name() + "";
score2 = "" + D[3] + "";
}
window.clearTimeout(nofityTimer);
if (notify == "") notify = "入球提示:";
notify += hometeam + " " + score1 + "-" + score2 + " " + guestteam + " ";
nofityTimer = window.setTimeout("clearNotify()", 20000);
window.setTimeout("bfcolors_water('" + matchItem.mId + "')", 30000);
if (soundCheck)
audioHelper.play("flashsound");
}
}
if (notify != "") document.getElementById("notify").innerHTML = notify;
}
function bfcolors_water(ID) {
try {
document.getElementById("home_" + ID).style.backgroundColor = "";
document.getElementById("guest_" + ID).style.backgroundColor = "";
} catch (e) { }
}
function MoveToBottom(id) {
try {
document.getElementById("table_" + id).parentElement.insertAdjacentElement("BeforeEnd", document.getElementById("table_" + id));
for (var i = 1; i <= adinfo1.length; i++) {
document.getElementById("table_" + id).parentElement.childNodes[i * 2].insertAdjacentElement("BeforeBegin", document.getElementById("tr_ad" + i));
}
} catch (e) { }
}
function SelectOK(c) {
var i, j, inputs;
var hh = 0;
var leagueIds = ",";
var IdList = (sclassSelectNum == 1 ? strZuodiList : sclassSelectNum == 2 ? strNotOpenList : sclassSelectNum == 3 ? strRunList : "");
inputs = document.getElementById("league").getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
var obj = inputs[i];
if (obj.type != "checkbox") continue;
if (obj.checked) {
leagueIds += obj.value + ",";
}
}
for (var j = 0; j < matchdata.MatchNum; j++) {
var matchItem = matchdata.MatchList.items[j];
if (leagueIds.indexOf("," + matchItem.lId + ",") > -1 && (IdList.indexOf("," + matchItem.mId + ",") > -1 || IdList == "")) {
document.getElementById("table_" + matchItem.mId).style.display = "";
}
else {
document.getElementById("table_" + matchItem.mId).style.display = "none";
hh++;
}
}
if (!c) {
writeCookie("sclassSelectNum_" + pageIndex, sclassSelectNum);
writeCookie("currentLeague_" + pageIndex, leagueIds);
changeTxtAdLocation();
}
document.getElementById("hiddenCount").innerHTML = hh;
document.getElementById("LeagueDiv").style.visibility = "hidden";
}
function hidematch(id) {
document.getElementById("table_" + id).style.display = "none";
document.getElementById("hiddenCount").innerHTML = parseInt(document.getElementById("hiddenCount").innerHTML) + 1;
changeTxtAdLocation();
}
function changeTxtAdLocation() {
var textAdObj = $(".showTxtAd");
if (textAdObj.length > 0) {
var tableObj = $("#odds>table.b_tab:visible");
var count = tableObj.length;
var arr = [];
$(".showTxtAd").each(function (i, v) {
if (i < count)
$(v).insertAfter($(tableObj[i]));
else $(tableObj[i]).appendTo($("#odds"));
});
}
}
function SetDate(y, m, d) {
selDate = new Date(y, m - 1, d);
//writeCookie("currentLeague_" + pageIndex,"");
LoadData();
}
//function SetLevel(l, m) {
// level = l;
// matchType = m;
// LoadData();
// writeCookie("level", level);
//}
function CheckSoundCheck(value) {
writeCookie("soundCheck", value ? 1 : 0);
soundCheck = value;
}
var soundCheck = (function () {
var s = getCookie("soundCheck");
if (s == null || s == "")
s = 1;
document.getElementById("soundCheck").checked = s = s == 1;
return s;
})();
var showFirstOdds = getCookie("FirstOdds");
function CheckFirstOdds(value) {
if (value == true) {
writeCookie("FirstOdds", 1);
showFirstOdds = 1;
}
else {
writeCookie("FirstOdds", 0)
showFirstOdds = 0;
}
LoadData();
}
if (showFirstOdds == null || showFirstOdds == "" || showFirstOdds == 0) {
var objfirstodds = document.getElementById("firstodds");
showFirstOdds = 0;
}
else if (showFirstOdds == 1) {
document.getElementById("firstodds").checked = true;
showFirstOdds = 1;
}
function SelectCompany() {
var i, inputs;
var j = 0;
SelCompany = new Array();
strCompanyId = ",";
inputs = document.getElementById("companyList").getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox" && inputs[i].checked) {
SelCompany[j++] = inputs[i].value;
strCompanyId += inputs[i].value + ",";
}
}
writeCookie("company", strCompanyId.substring(1, strCompanyId.length - 1));
LoadData();
document.getElementById("divMatchType5").style.visibility = "hidden";
}
function DefaultCompany() {
strCompanyId = "1,12,8,3,24";
SelCompany = strCompanyId.split(",");
strCompanyId = "," + strCompanyId + ",";
writeCookie("company", "");
LoadData();
inputs = document.getElementById("companyList").getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type != "checkbox") continue;
inputs[i].checked = false;
if (strCompanyId.indexOf("," + inputs[i].value + ",") >= 0) inputs[i].checked = true;
}
for (var i = 0; i < SelCompany.length; i++) {
document.getElementById("company" + SelCompany[i]).checked = true;
}
document.getElementById("divMatchType5").style.visibility = "hidden";
}
var strCompanyId = getCookie("company");
if (strCompanyId == null || strCompanyId == "") strCompanyId = "1,12,8,3,24";
var SelCompany = strCompanyId.split(",");
strCompanyId = "," + strCompanyId + ",";
var level = getCookie("level");
if (level == null || level == "") level = "2";
var now = new Date();
if (now.getDay() == 0 || now.getDay() == 6 && now.getHours() > 9) level = "1";
var lang = getCookie("lang");
if (lang == null || lang == "") lang = "1";
window.setTimeout("LoadData()", 50);
document.getElementById("Language" + lang).className = "selected";
for (var i = 0; i < SelCompany.length; i++)
document.getElementById("company" + SelCompany[i]).checked = true;
window.setTimeout("getxml()", 4000);
window.setTimeout("getbfxml()", 4000);
window.setTimeout("setMatchTime()", 30000);
window.setTimeout("LoadData()", 3600 * 1000);