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("公司 | 主队 | 让球 | 客队 | "); html.push("主胜 | 和局 | 客胜 | "); html.push("大球 | 大小 | 小球 | "); 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(" | ![]() | ||||||
" : "");
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 = "
" : "");
}
}
//欧指
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 = "
";
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);