var CompanyName = new Array(13);
CompanyName[3] = "Crown";
CompanyName[1] = "澳彩";
CompanyName[8] = "365";
CompanyName[12] = "易胜博";
CompanyName[4] = "立博";
function getDoMain() {
var arrDoms = location.href.split("/")[2].split(".");
var isNum = /^\d+$/;
if (isNum.test(arrDoms[1]))
return arrDoms[0] + "." + arrDoms[1] + "." + arrDoms[2] + "." + arrDoms[3].split(":")[0];
else
return arrDoms[1] + "." + arrDoms[2];
}
//定义Config
var Config = new Object();
Config.oldOrNew = 1;
Config.acid_v = 3;
Config.atype_v = 1;
Config.scid_v = 0;
Config.stype_v = 1;
Config.acid_hn = 3;
Config.atype_hn = 1;
Config.scid_hn = 0;
Config.stype_hn = 1;
Config.acid_an = 3;
Config.atype_an = 1;
Config.scid_an = 0;
Config.stype_an = 1;
Config.haveLetGoal = 1;
Config.haveTotal = 1;
Config.haveEurope = 0;
Config.isHalf = 0;
Config.getCookie = function () {
var Cookie = getCookie("fAnalyCookie");
if (Cookie == null) Cookie = "";
var Cookie = Cookie.split("^");
if (Cookie.length != 16) writeCookie("fAnalyCookie", null);
else {
this.oldOrNew = parseInt(Cookie[0]);
this.acid_v = parseInt(Cookie[1]);
this.atype_v = parseInt(Cookie[2]);
this.scid_v = parseInt(Cookie[3]);
this.stype_v = parseInt(Cookie[4]);
this.acid_hn = parseInt(Cookie[5]);
this.atype_hn = parseInt(Cookie[6]);
this.scid_hn = parseInt(Cookie[7]);
this.stype_hn = parseInt(Cookie[8]);
this.acid_an = parseInt(Cookie[9]);
this.atype_an = parseInt(Cookie[10]);
this.scid_an = parseInt(Cookie[11]);
this.stype_an = parseInt(Cookie[12]);
this.haveLetGoal = parseInt(Cookie[13]);
this.haveTotal = parseInt(Cookie[14]);
this.haveEurope = parseInt(Cookie[15]);
}
}
Config.setStates = function () {
try {
$("hSelect_v").value = this.acid_v;
$("hType_v").value = this.atype_v;
$("sSelect_v").value = this.scid_v;
$("sType_v").value = this.stype_v;
$("hSelect_hn").value = this.acid_hn;
$("hType_hn").value = this.atype_hn;
$("sSelect_hn").value = this.scid_hn;
$("sType_hn").value = this.stype_hn;
$("hSelect_an").value = this.acid_an;
$("hType_an").value = this.atype_an;
$("sSelect_an").value = this.scid_an;
$("sType_an").value = this.stype_an;
$("checkLet").checked = (this.haveLetGoal == 1);
$("checkEu").checked = (this.haveEurope == 1);
$("checkTotal").checked = (this.haveTotal == 1);
}
catch (e) { }
}
Config.writeCookie = function () {
var value = this.oldOrNew + "^" + this.acid_v + "^" + this.atype_v + "^" + this.scid_v + "^" + this.stype_v + "^" + this.acid_hn + "^" + this.atype_hn + "^" + this.scid_hn + "^" + this.stype_hn + "^" + this.acid_an + "^" + this.atype_an + "^" + this.scid_an + "^" + this.stype_an + "^" + this.haveLetGoal + "^" + this.haveTotal + "^" + this.haveEurope;
writeCookie("fAnalyCookie", value);
}
function $(n) { return document.getElementById(n); }
function $$(n) { return document.getElementsByName(n); }
String.prototype.format = function () {
var val = this.toString();
for (var a = 0, i = 0; a < arguments.length; a++) {
if (arguments[a] instanceof Array) {
for (var j = 0; j < arguments[a].length; j++) {
val = val.replace(new RegExp("\\{" + i++ + "\\}", "g"), arguments[a][j]);
}
} else {
val = val.replace(new RegExp("\\{" + i++ + "\\}", "g"), arguments[a]);
}
}
return val;
};
function GetSclassName(id) {
var retName = "";
for (var i = 0; i < sclassNames.length; i++) {
if (id == sclassNames[i].SclassId) {
if (isBig) { retName = sclassNames[i].big; }
else { retName = sclassNames[i].cn; }
break;
}
}
return retName;
}
function GetTeamName(id, fmt) {
var retName = "";
for (var i = 0; i < teamNames.length; i++) {
if (id == teamNames[i].TeamId) {
if (isBig) { retName = teamNames[i].big; }
else { retName = teamNames[i].cn; }
break;
}
}
if (!!fmt) {
if (fmt.indexOf("$") > -1) {
var fmtArr = fmt.split("$");
return ("" + fmtArr[0] + "").replace(/\{.*\}/g, retName)
}
else {
return fmt.replace(/\{.*\}/g, retName)
}
}
else
return retName;
}
function init_league(id) {
var html = [];
var t = "";
var data = getData(id);
var ra = new Array();
for (var i = 0; i < data.length; i++) {
if (!ra.contains(data[i][1])) {
ra.push(data[i][1]);
html.push(t.format(data[i][1], GetSclassName(data[i][1])))
}
}
$(id + "_l").innerHTML = html.join("");
}
function getData(id) {
var data = [];
switch (id) {
case 'v': data = v_data; break;
case 'hn':
case 'h2':
case 'h': data = h_data; break;
case 'an':
case 'a2':
case 'a': data = a_data; break;
case 'srh': data = sameRound_h; break;
case 'sra': data = sameRound_a; break;
}
return data;
}
function init(id, count) {
if (jQuery("#" + id).length == 0)
return;
var data = getData(id);
var chks = $$(id + "_l");
newdata = [];
for (var i = 0; i < data.length; i++) {
if (["h2","a","h", "a2", "srh", "sra"].indexOf(id) < 0) {
if (id == 'an') {
if ($(id + '_t').checked && data[i][4] == h2h_away) continue;
}
else {
if ($(id + '_t').checked && data[i][6] == h2h_home) continue;
}
}
else {
if (id == 'a2') {
if (data[i][4] == h2h_away) continue;
} else if (id == 'h2') {
if (data[i][6] == h2h_home) continue;
}
}
var f1 = 0;
for (var j = 0; j < chks.length; j++)
if (data[i][1] == chks[j].id.substr(0, chks[j].id.indexOf('_')) && chks[j].checked == false) { f1 = 1; break };
if (f1 == 1) continue;
newdata.push(data[i]);
}
var c = count ? count : newdata.length > 10 ? 10 : newdata.length;
if (id == 'v' || id.indexOf('n') != -1 || ["srh", "sra"].indexOf(id) > -1)
init_vs(id, c);
else
init_vs2(id, c);
if (!count)
init_select(id, c);
}
function s_onchange(id, count) {
init(id.substr(0, id.indexOf('_')), count)
}
function t_onclick(id) {
init(id.substr(0, id.indexOf('_')));
}
function GetSclassUrl(sclassID) {
//return "http://info.nowscore.com/cupmatch_vs/cupmatch_" + sclassID + (isBig ? "_2" : "") + ".htm";
return "/sclassID.html?id=" + sclassID + (isBig ? "&lang=1" : "&lang=0");
}
function init_vs(id, count) {
var sb = [];
var win1, standoff = 0, win = 0, lost = 0, victoryNum = 0, drawNum = 0, lossNum = 0, bigNum = 0, singleNum = 0;
sb.push('
');
if ((newdata.length > 0 && newdata[0].length <= 16) || newdata.length == 0)
sb.push('| 类型 | 日期 | 主场 | 比分(半场) | 客场 | | | 胜负 | 盘路 | 进球数 |
| 主 | 让球 | 客 | 主 | 和 | 客 |
');
else if (newdata[0].length <= 19)
sb.push('| 类型 | 日期 | 主场 | 比分(半场) | 角球 | 客场 | | | 胜负 | 盘路 | 进球数 |
| 主 | 让球 | 客 | 主 | 和 | 客 |
');
else
sb.push('| 类型 | 日期 | 主场 | 比分(半场) | 角球 | 客场 | | | |
| 主 | 让球 | 客 | 主 | 和 | 客 | 胜负 | 让球 | 进球数 |
');
var hColor = "", gColor = "";
for (var a = 0; a < count; a++) {
var item = newdata[a];
if (id == "v") {
hColor = h2h_home == item[4] ? 'green' : 'black';
gColor = h2h_away == item[4] ? 'green' : 'black';
}
else {
var isH = ["hn", "srh"].indexOf(id) > -1;
hColor = (isH ? h2h_home == item[4] : h2h_away == item[4]) ? 'green' : 'black';
gColor = (isH ? h2h_home == item[6] : h2h_away == item[6]) ? 'green' : 'black';
}
sb.push('| {2} | {0} | {5} | {8}-{9}({10}) | {20} | {7} | | | | | | | {12} | {13} | {14} |
'.format(
item[0], item[1], item[23] > 0 ? "" + GetSclassName(item[1]) + "" : item[2], item[3], item[4], GetTeamName(item[4], item[5]), item[6], GetTeamName(item[6], item[7]), item[8], item[9], item[10], item[11], result[item[17] + 1], panlu[item[13] + 2], overUnder[item[14] + 1], a % 2 == 0 ? '#ffffff' : '#f0f0f0', hColor, gColor, item[20], ("tr" + id + "_" + item[20]), item[21] !== "" ? item[21] + "-" + item[22] : "", " title=\"" + item[24] + "赛季" + "\""));
switch (item[18]) {
case 1: win++; break;
case 0: standoff++; break;
case -1: lost++; break;
}
if (item[19] == 1) bigNum++;
if ((item[8] + item[9] + 2) % 2 > 0) singleNum++;
switch (item[17]) {
case 1: victoryNum++; break;
case 0: drawNum++; break;
case -1: lossNum++; break;
}
}
if (win + standoff + lost > 0)
win1 = Math.round(win / (win + standoff + lost) * 1000) / 10;
else
win1 = "0";
if (count > 0) {
if (id == 'v')
sb.push('| 近 ' + count + ' 场, 胜出 ' + victoryNum + ' 场,平局 ' + drawNum + ' 场,输 ' + lossNum + ' 场, 胜率:' + Math.round(victoryNum / count * 1000) / 10 + '% 让胜率:' + (win1 ? win1 : 0) + '% 大率:' + Math.round(bigNum / count * 1000) / 10 + '% 单率:' + Math.round(singleNum / count * 1000) / 10 + '% |
');
else
sb.push('| 近' + count + '场,胜' + victoryNum + '平' + drawNum + '负' + lossNum + ', 胜率:' + Math.round(victoryNum / count * 1000) / 10 + '% 让胜率:' + (win1 ? win1 : 0) + '% 大率:' + Math.round(bigNum / count * 1000) / 10 + '% 单率:' + Math.round(singleNum / count * 1000) / 10 + '% |
');
}
sb.push('
');
jQuery("#" + id).html(sb.join(''));
showOdds_h(id, 0);
showOdds_s(id, 0);
}
function init_vs2(id, count) {
var sb = [];
var win1, standoff = 0, win = 0, lost = 0, victoryNum = 0, drawNum = 0, lossNum = 0, bigNum = 0, singleNum = 0;
sb.push('');
sb.push('| 类型 | 日期 | 主场 | 比分 | 角球 | 客场 | 让球 | 胜负 | 盘路 | 进球数 |
');
for (var a = 0; a < count; a++) {
var sclassName = newdata[a][23] > 0 ? "" + GetSclassName(newdata[a][1])+ "" : newdata[a][2];
sb.push('| {2} | {0} | {5} | {8}-{9} {10} | {24} | {7} | {15} | {17} | {18} | {19} |
'.format(
newdata[a][0], newdata[a][1], sclassName, newdata[a][3], newdata[a][4], GetTeamName(newdata[a][4], newdata[a][5]), newdata[a][6], GetTeamName(newdata[a][6], newdata[a][7]), newdata[a][8], newdata[a][9], newdata[a][10], newdata[a][11], newdata[a][12], newdata[a][13], newdata[a][14], newdata[a][15], newdata[a][16], result[newdata[a][17] + 1], panlu[newdata[a][18] + 2], overUnder[newdata[a][19] + 1], a % 2 == 0 ? '#ffffff' : '#f0f0f0', (id == 'h' || id == 'v' || id == 'h2') && h2h_home == newdata[a][4] || (id == 'a' || id == 'a2') && h2h_away == newdata[a][4] ? 'green' : 'black', (id == 'h' || id == 'v' || id == 'h2') && h2h_home == newdata[a][6] || (id == 'a' || id == 'a2') && h2h_away == newdata[a][6] ? 'green' : 'black', newdata[a][20], newdata[a][21] + "-" + newdata[a][22]));
switch (newdata[a][18]) {
case 1: win++; break;
case 0: standoff++; break;
case -1: lost++; break;
}
if (newdata[a][19] == 1) bigNum++;
if ((newdata[a][8] + newdata[a][9] + 2) % 2 > 0) singleNum++;
switch (newdata[a][17]) {
case 1: victoryNum++; break;
case 0: drawNum++; break;
case -1: lossNum++; break;
}
}
if (win + standoff + lost > 0)
win1 = Math.round(win / (win + standoff + lost) * 1000) / 10;
else
win1 = "0";
if (count > 0) sb.push('| 近 ' + count + ' 场, ' + (id == "v" ? "主场" : "") + '胜率:' + Math.round(victoryNum / count * 1000) / 10 + '% 让胜率:' + win1 + '% 大率(>2.5):' + Math.round(bigNum / count * 1000) / 10 + '% 单率:' + Math.round(singleNum / count * 1000) / 10 + '% |
');
sb.push('
');
jQuery("#" + id).html(sb.join(''));
}
function init_select(id, count) {
var select = $(id + "_s");
if (select == null)
return;
select.options.length = 0;
for (var i = 0; i < newdata.length; i++)
select.options[i] = new Option((i + 1) < 10 ? " " + (i + 1) : (i + 1), (i + 1));
if (select.options.length > 0)
select.options[newdata.length > count ? count - 1 : i - 1].selected = true;
else
select.options[0] = new Option(" " + 0, 0);
}
function showRedCard(ID, teamNum) {
if (ID != 1) return "";
var arrRedCard = RedCard.split("|");
try {
if (arrRedCard[teamNum] == "0")
return "";
else
return " " + arrRedCard[teamNum] + "";
} catch (e) {
return "";
}
}
var cellhtml; //初始表格
function CreateTable(ID) {
var Score;
switch (ID) {
case 1:
Score = ScoreAll;
break;
case 2:
Score = ScoreHome;
break;
case 3:
Score = ScoreGuest;
break;
case 4:
Score = ScoreHalfAll;
break;
case 5:
Score = ScoreHalfHome;
break;
case 6:
Score = ScoreHalfGuest;
break;
}
cellhtml = "";
var buf = new Array();
var theURL = "";
if (Score.length > 0) {
buf.push("");
buf.push("");
buf.push("| 排名 | ");
buf.push("球队名称 | ");
buf.push("赛 | ");
buf.push("胜 | ");
buf.push("平 | ");
buf.push("负 | ");
buf.push("得 | ");
buf.push("失 | ");
buf.push("净 | ");
buf.push("胜% | ");
buf.push("平% | ");
buf.push("负% | ");
buf.push("均得 | ");
buf.push("均失 | ");
buf.push("积分 | ");
buf.push("
");
}
else {
if (document.getElementById("spTop")) document.getElementById("spTop").style.display = "none";
if (document.getElementById("scoreTable")) document.getElementById("scoreTable").style.display = "none";
}
for (var i2 = 0; i2 < Score.length; i2++) {
stringq = Score[i2].split("|");
if (h2h_home == stringq[2] || h2h_away == stringq[2])
buf.push("");
else
buf.push("
");
buf.push(" " + stringq[1] + " | ");
buf.push(" | ");
for (var i = 5; i < 12; i++) {
buf.push(" " + stringq[i] + " | ");
}
buf.push(" " + stringq[12] + " | ");
buf.push(" " + stringq[13] + " | ");
buf.push(" " + stringq[14] + " | ");
buf.push(" " + stringq[15] + " | ");
buf.push(" " + stringq[16] + " | ");
buf.push("" + stringq[17] + " | ");
if (stringq[18].length > 1) {
buf.push("
| " + stringq[18] + " | ");
}
buf.push("
");
}
if (ID == 1 && ScoreColor.length > 0) {
stringc = ScoreColor[0].split("|");
if (stringc.length > 0) {
buf.push("");
buf.push("");
if (stringc[0] != 0)
buf.push("■欧冠杯");
if (stringc[1] != 0)
buf.push("■欧冠附加赛");
if (stringc[2] != 0)
buf.push("■欧冠杯外围赛");
if (stringc[11] != 0) {
if (stringc[10] != 0)
buf.push("■欧霸杯");
}
else {
if (stringc[3] != 0)
buf.push("■欧协附加赛");
if (stringc[4] != 0)
buf.push("■欧协杯");
}
if (stringc[5] != 0)
buf.push("■图图杯");
if (stringc[6] != 0)
buf.push("■升级附加赛");
if (stringc[7] != 0)
buf.push("■升级球队");
if (stringc[8] != 0)
buf.push("■降级附加赛");
if (stringc[9] != 0)
buf.push("■降级球队");
buf.push(" | ");
buf.push("
");
}
}
buf.push("
");
cellhtml = buf.join("");
}
function w(ID) {
for (i = 1; i <= 6; i++) {
if (document.getElementById("menu" + i)) document.getElementById("menu" + i).className = "nav_unselected";
}
if (document.getElementById("menu" + ID)) document.getElementById("menu" + ID).className = "nav_selected";
CreateTable(ID);
if (document.getElementById("tableId"))
document.getElementById("tableId").innerHTML = cellhtml;
}
function changeHalfOrFull(id, obj) {
Config.isHalf = obj.value;
showOdds_h(id, 1);
}
function showOdds_h(id, t) {
Config.getCookie();
var url = "{1}";
var trlist = $("table_" + id).getElementsByTagName("tr");
// var num = $(id + "_s").value;
var num = 0, numBig = 0;
var awin = 0, big = 0, win = 0, draw = 0, loss = 0, singleNum = 0;
var count = (newdata.length > 0 && newdata[0].length <= 16) || newdata.length == 0 ? 0 : 1;
for (var i = 0; i < trlist.length; i++) {
if (trlist[i].getAttribute("index") != null) {
trlist[i].cells[5 + count].innerHTML = "";
trlist[i].cells[6 + count].innerHTML = "";
trlist[i].cells[7 + count].innerHTML = "";
trlist[i].cells[12 + count].innerHTML = "";
trlist[i].cells[13 + count].innerHTML = "";
}
}
if (t == 1) {
if (id == "v") {
Config.acid_v = parseInt($("hSelect_" + id).value);
Config.atype_v = parseInt($("hType_" + id).value);
}
else if (id == "hn") {
Config.acid_hn = parseInt($("hSelect_" + id).value);
Config.atype_hn = parseInt($("hType_" + id).value);
}
else {
Config.acid_an = parseInt($("hSelect_" + id).value);
Config.atype_an = parseInt($("hType_" + id).value);
}
Config.writeCookie();
}
var varcompayid = id == "v" ? Config.acid_v : id === "hn" ? Config.acid_hn : Config.acid_an;
var hType = id == "v" ? Config.atype_v : id === "hn" ? Config.atype_hn : Config.atype_an;
if (t == 0) {
$("hSelect_" + id).value = varcompayid;
$("hType_" + id).value = hType;
}
for (var i = 0; i < Vs_hOdds.length; i++) {
var odds = Vs_hOdds[i];
var tr = $("tr" + id + "_" + odds[0]);
if (tr == null) continue;
if (varcompayid != parseInt(odds[1])) continue;
var strIds = tr.getAttribute("index");
if (strIds == null || strIds == '') continue;
var scheduleArr = getDataArray(id, parseInt(odds[0]));
var strScore = tr.cells[3].innerHTML.replace(/<.+?>/gim, '');
var allFullScore = strScore.split('(')[0].split('-');
var allHalfScore = strScore.split('(')[1].replace(')', '').split('-');
var arrIds = strIds.split(',');
var result1 = -2;
var oddsLoc = Config.isHalf == "1" ? 8 : 0;
var arrScore = Config.isHalf == "1" ? allHalfScore : allFullScore;
var hScore = parseInt(arrScore[0]), gScore = parseInt(arrScore[1]);
var totalGoal;
if (hType == 1) {
if (odds[6 + oddsLoc] != "") {
num++;
result1 = getResult(parseFloat(odds[6 + oddsLoc]), hScore, gScore, parseInt(arrIds[0]), id);
if (result1 == 1)
awin++;
tr.cells[5 + count].innerHTML = odds[5 + oddsLoc];
tr.cells[6 + count].innerHTML = url.format(odds[0], Goal2GoalCn(parseFloat(odds[6 + oddsLoc])));
tr.cells[7 + count].innerHTML = odds[7 + oddsLoc];
}
if (odds[9 + oddsLoc] != "") {
totalGoal = parseFloat(odds[9 + oddsLoc]);
}
} else {
if (odds[3 + oddsLoc] != "") {
num++;
result1 = getResult(parseFloat(odds[3 + oddsLoc]), hScore, gScore, parseInt(arrIds[0]), id);
if (result1 == 1)
awin++;
tr.cells[5 + count].innerHTML = odds[2 + oddsLoc];
tr.cells[6 + count].innerHTML = url.format(odds[0], Goal2GoalCn(parseFloat(odds[3 + oddsLoc])));
tr.cells[7 + count].innerHTML = odds[4 + oddsLoc];
}
if (odds[8 + oddsLoc] != "") {
totalGoal = parseFloat(odds[8 + oddsLoc]);
}
}
//tr.cells[11 + count].innerHTML = Config.isHalf == "1" ? result[scheduleArr[19] + 1] : result[scheduleArr[12] + 1];
tr.cells[12 + count].innerHTML = panlu[result1 + 2];
if (typeof totalGoal !== "undefined") {
numBig++;
var result2 = getTotalResult(totalGoal, hScore, gScore);
if (result2 == 1)
big++;
var ogObj = jQuery(tr.cells[13 + count]);
ogObj.html(result2 > -2 ? overUnder[result2 + 1] : "");
ogObj.attr("title", "让球:" + Goal2GoalCn2(totalGoal));
}
}
var data = getData(id);
for (var i = 0; i < data.length; i++) {
var odds = data[i];
var tr = $("tr" + id + "_" + odds[20]);
if (tr == null) continue;
var strIds = tr.getAttribute("index");
if (strIds == null || strIds == '') continue;
//if (tr.style.display != "") continue;
var strScore = tr.cells[3].innerHTML.replace(/<.+?>/gim, '');
var allFullScore = strScore.split('(')[0].split('-');
var allHalfScore = strScore.split('(')[1].replace(')', '').split('-');
var arrIds = strIds.split(',');
var oddsLoc = Config.isHalf == "1" ? 8 : 0;
var arrScore = Config.isHalf == "1" ? allHalfScore : allFullScore;
var scoreResult = getScoreResult(parseInt(arrScore[0]), parseInt(arrScore[1]), parseInt(arrIds[0]), id);
win += (scoreResult == 1 ? 1 : 0);
draw += (scoreResult == 0 ? 1 : 0);
loss += (scoreResult == -1 ? 1 : 0);
if ((parseInt(arrScore[0]) + parseInt(arrScore[1]) + 2) % 2 > 0) singleNum++;
tr.cells[11 + count].innerHTML = result[scoreResult + 1];
}
try {
$("awin_" + id).innerHTML = (num > 0 ? Math.round(awin / num * 1000) / 10 : 0);
$("big_" + id).innerHTML = (numBig > 0 ? Math.round(big / numBig * 1000) / 10 : 0);
$("win_" + id).innerHTML = win;
$("draw_" + id).innerHTML = draw;
$("loss_" + id).innerHTML = loss;
$("winPre_" + id).innerHTML = (Math.round(win / (win + draw + loss) * 1000) / 10) + "%";
$("single_" + id).innerHTML = (Math.round(singleNum / (win + draw + loss) * 1000) / 10) + "%";
}
catch (ex) {
}
}
function showOdds_s(id, t) {
Config.getCookie();
//var url = "{1}";
var url = "{1}";
var trlist = $("table_" + id).getElementsByTagName("tr");
var count = (newdata.length > 0 && newdata[0].length <= 16) || newdata.length == 0 ? 0 : 1;
for (var i = 0; i < trlist.length; i++) {
if (trlist[i].getAttribute("index") != null) {
trlist[i].cells[8 + count].innerHTML = "";
trlist[i].cells[9 + count].innerHTML = "";
trlist[i].cells[10 + count].innerHTML = "";
}
}
if (t == 1) {
if (id == "v") {
Config.scid_v = parseInt($("sSelect_" + id).value);
Config.stype_v = parseInt($("sType_" + id).value);
}
else if (id == "hn") {
Config.scid_hn = parseInt($("sSelect_" + id).value);
Config.stype_hn = parseInt($("sType_" + id).value);
}
else {
Config.scid_an = parseInt($("sSelect_" + id).value);
Config.stype_an = parseInt($("sType_" + id).value);
}
Config.writeCookie();
}
var varcompayid = id == "v" ? Config.scid_v : id === "hn" ? Config.scid_hn : Config.scid_an;
var hType = id == "v" ? Config.stype_v : id === "hn" ? Config.stype_hn : Config.stype_an;
var cName = varcompayid == 80 ? "澳门" : varcompayid == 18 ? "12B" : varcompayid == 115 ? "威廉希尔" : varcompayid == 281 ? "365" : "Crown";
if (t == 0) {
$("sSelect_" + id).value = varcompayid;
$("sType_" + id).value = hType;
}
for (var i = 0; i < Vs_eOdds.length; i++) {
var odds = Vs_eOdds[i];
var tr = $("tr" + id + "_" + odds[0]);
if (tr == null) continue;
if (varcompayid != parseInt(odds[1])) continue;
var hName = tr.cells[2].innerHTML.replace(/<.+?>/gim, '');
var gName = tr.cells[4 + count].innerHTML.replace(/<.+?>/gim, '');
if (hType == 1) {
tr.cells[8 + count].innerHTML = odds[5];
tr.cells[9 + count].innerHTML = url.format(odds[0], odds[6]);
tr.cells[10 + count].innerHTML = odds[7];
} else {
tr.cells[8 + count].innerHTML = odds[2];
tr.cells[9 + count].innerHTML = url.format(odds[0], odds[3]);
tr.cells[10 + count].innerHTML = odds[4];
}
}
}
function getResult(goal, hScore, gScore, hId, id) {
var result = -2;
if (goal >= 0) {
if (hScore - goal > gScore)
result = 1;
else if (hScore - goal == gScore)
result = 0;
else
result = -1;
}
else {//主队的结果,所以调转
if (gScore - Math.abs(goal) > hScore)
result = -1;
else if (gScore - Math.abs(goal) == hScore)
result = 0;
else
result = 1;
}
if ((id.indexOf('h') != -1 || id.indexOf('v') != -1) && hId != h2h_home)
result = result == 1 ? -1 : result == -1 ? 1 : result;
if (id.indexOf('a') != -1 && hId != h2h_away)
result = result == 1 ? -1 : result == -1 ? 1 : result;
return result;
}
function getTotalResult(goal, hScore, gScore) {
if (hScore + gScore > goal)
return 1;
else if (hScore + gScore == goal)
return 0;
else
return -1;
}
function getScoreResult(hScore, gScore, hId, id) {
var result = 0;
if (hScore > gScore)
result = 1;
else if (hScore == gScore)
result = 0;
else
result = -1;
if ((id.indexOf('h') != -1 || id.indexOf('v') != -1) && hId != h2h_home)
result = result == 1 ? -1 : result == -1 ? 1 : result;
if (id.indexOf('a') != -1 && hId != h2h_away)
result = result == 1 ? -1 : result == -1 ? 1 : result;
return result;
}
function getDataArray(id, scheID) {
var retVal = [];
var data = getData(id);
for (var i = 0; i < data.length; i++) {
if (parseInt(data[i][15]) == scheID) {
retVal = data[i];
break;
}
}
return retVal;
}
function changeVs2(t) {
Config.oldOrNew = t;
Config.writeCookie();
showVs2();
}
function showVs2() {
$("chec_vsOld").checked = (Config.oldOrNew == 0 ? true : false);
$("chec_vsNew").checked = (Config.oldOrNew == 1 ? true : false);
$("vsOld").style.display = (Config.oldOrNew == 0 ? "" : "none");
$("vsNew").style.display = (Config.oldOrNew == 0 ? "none" : "");
if (Config.oldOrNew == 0) {
init("h")
init("a");
init_league('h');
init_league('a');
init("h2")
init("a2");
init_league('h2');
init_league('a2');
}
else {
init("hn");
init("an");
init_league('hn');
init_league('an');
}
}
function com_init_vs() {
var sb = [];
sb.push('');
sb.push('| 球队 | 总入球 | 总失球 | 净胜球 | 场均入球 | 胜率 | 平率 | 负率 | 主客入球 | 主客失球 | 主客净胜球 | 主客均入球 | 主客胜率 | 主客平率 | 主客负率 |
');
sb.push('| ' + hometeam + ' | | | | | | | | | | | | | | |
');
sb.push('| ' + guestteam + ' | | | | | | | | | | | | | | |
');
sb.push('
');
$("div_com").innerHTML = sb.join('');
}
function com_init_data(count) {
var c = count ? count : a_data.length > 10 ? 10 : a_data.length;
com_init_vs_data("a", c);
c = count ? count : h_data.length > 10 ? 10 : h_data.length;
com_init_vs_data("h", c);
if (!count)
init_select_com("com", c);
}
function init_select_com(id, count) {
var select = $(id + "_s");
select.options.length = 0;
for (var i = 0; i < h_data.length; i++)
select.options[i] = new Option((i + 1) < 10 ? " " + (i + 1) : (i + 1), (i + 1));
if (select.options.length > 0)
select.options[h_data.length > count ? count - 1 : i - 1].selected = true;
else
select.options[0] = new Option(" " + 0, 0);
}
function com_init_vs_data(id, count) {
var data = [];
if (id == "h")
data = h_data;
else
data = a_data;
var allGoal = 0, allLossGoal = 0, winNum = 0, drawNum = 0, lossNum = 0, hgCount = 0, hgGoal = 0, hgLossGoal = 0, hgWin = 0, hgDraw = 0, hgLoss = 0;
for (var a = 0; a < count; a++) {
if ((id == "h" && h2h_home == data[a][4]) || (id == "a" && h2h_away == data[a][4])) {
allGoal += parseInt(data[a][8]);
allLossGoal += parseInt(data[a][9]);
if (parseInt(data[a][8]) > parseInt(data[a][9])) {
winNum += 1;
if (id == "h")
hgWin += 1;
}
else if (parseInt(data[a][8]) == parseInt(data[a][9])) {
drawNum += 1;
if (id == "h")
hgDraw += 1;
}
else {
lossNum += 1;
if (id == "h")
hgLoss += 1;
}
if (id == "h") {
hgCount += 1;
hgGoal += parseInt(data[a][8]);
hgLossGoal += parseInt(data[a][9]);
}
}
else if ((id == "h" && h2h_home == data[a][6]) || (id == "a" && h2h_away == data[a][6])) {
allGoal += parseInt(data[a][9]);
allLossGoal += parseInt(data[a][8]);
if (parseInt(data[a][9]) > parseInt(data[a][8])) {
winNum += 1;
if (id == "a")
hgWin += 1;
}
else if (parseInt(data[a][8]) == parseInt(data[a][9])) {
drawNum += 1;
if (id == "a")
hgDraw += 1;
}
else {
lossNum += 1;
if (id == "a")
hgLoss += 1;
}
if (id == "a") {
hgCount += 1;
hgGoal += parseInt(data[a][9]);
hgLossGoal += parseInt(data[a][8]);
}
}
}
var tr = document.getElementById("tr_com_" + id);
tr.cells[1].innerHTML = allGoal;
tr.cells[2].innerHTML = allLossGoal;
tr.cells[3].innerHTML = allGoal - allLossGoal;
tr.cells[4].innerHTML = count > 0 ? Math.round(allGoal / count * 100) / 100 : 0;
tr.cells[5].innerHTML = count > 0 ? Math.round(winNum / count * 1000) / 10 + "%" : "";
tr.cells[6].innerHTML = count > 0 ? Math.round(drawNum / count * 1000) / 10 + "%" : "";
tr.cells[7].innerHTML = count > 0 ? Math.round(lossNum / count * 1000) / 10 + "%" : "";
tr.cells[8].innerHTML = hgGoal;
tr.cells[9].innerHTML = hgLossGoal;
tr.cells[10].innerHTML = hgGoal - hgLossGoal;
tr.cells[11].innerHTML = hgCount > 0 ? Math.round(hgGoal / hgCount * 100) / 100 : "0";
tr.cells[12].innerHTML = hgCount > 0 ? Math.round(hgWin / hgCount * 1000) / 10 + "%" : "";
tr.cells[13].innerHTML = hgCount > 0 ? Math.round(hgDraw / hgCount * 1000) / 10 + "%" : "";
tr.cells[14].innerHTML = hgCount > 0 ? Math.round(hgLoss / hgCount * 1000) / 10 + "%" : "";
}