var Encode = 'en';
var fn = 0;
var match_list = "", select_match_str = "";
var xmlhttp=null;
var isIE=true;
var parser=null;
var oSerializer=null;
var oldxml="";
if(window.ActiveXObject)
{
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
else
{
xmlhttp = new XMLHttpRequest();
parser = new DOMParser();
oSerializer = new XMLSerializer();
isIE=false;
}
var Ecoding;
switch(Encode)
{
case "gb":
Ecoding = new Array("一","二","三","四","五","六","七","八","九","加","总","赛事选择","赛事","状态","球队","让","","欧");
break;
case "en":
Ecoding= new Array("1","2","3","4","5","6","7","8","9","OT","T","Select match","League","Status","Team","+/-","Handicap","1x2");
break;
case "th":
Ecoding= new Array("1","2","3","4","5","6","7","8","9","OT","T","เลือกลีก","ลีก","สถานะ","ทีม","+/-","แฮนดีแคพ","1x2");
break;
case "vn":
Ecoding= new Array("1","2","3","4","5","6","7","8","9","OT","T","Chọn giải đấu","Giải đấu","Chi tiết","Đội bóng","+/-","Tỷ lệ","1x2");
break;
case "kr":
Ecoding= new Array("1","2","3","4","5","6","7","8","9","OT","T","경기선택","리그","상태","팀","+/-","핸디캡","1x2");
break;
default:
Ecoding= new Array("一","二","三","四","五","六","七","八","九","加","總","賽事選擇","賽事","狀態","球隊","让","","歐");
break;
}
function InitializeData()
{
xmlhttp.open("get", "Data/1_" + Encode + ".xml?" + Number(new Date()).toString().substring(0,10), true);
xmlhttp.onreadystatechange = InitializeReady;
xmlhttp.send(null);
}
function Decimal_point(tmpior,show){
var sign="";
sign =((tmpior < 0)?"Y":"N");
tmpior = (Math.floor(Math.abs(tmpior) * show + 1 / show )) / show;
return (tmpior * ((sign =="Y")? -1:1)) ;
}
function get_HK_ior( H_ratio, C_ratio){
var out_ior=new Array();
var line,lowRatio,nowRatio,highRatio;
var nowType="";
if (H_ratio <= 1000 && C_ratio <= 1000){
out_ior[0]=H_ratio;
out_ior[1]=C_ratio;
return out_ior;
}
line=2000 - ( H_ratio + C_ratio );
if (H_ratio > C_ratio){
lowRatio=C_ratio;
nowType = "C";
}else{
lowRatio = H_ratio;
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"){
out_ior[0]=lowRatio;
out_ior[1]=highRatio;
}else{
out_ior[0]=highRatio;
out_ior[1]=lowRatio;
}
return out_ior;
}
function history(id,param)
{
var lang_index;
if(lang == "big")
{
lang_index = "0";
}
else if(lang == "gb")
{
lang_index = "1";
}
else
{
lang_index = "2";
}
if(param == "3")
{
window.open( "chart.htm?ecd=" + lang_index + "&id=" + id);
}
else
{
window.open( "log_" + lang + ".shtml?id="+id, "", "height=450px,width=480px,toolbar=no,scrollbars=yes,menubar=no");
}
}
function InitializeReady()
{
if(xmlhttp.readyState!=4)return;
var XmlDoc;
if(isIE)
{
XmlDoc = xmlhttp.responseXML;
//alert(XmlDoc.xml);
if(XmlDoc.xml=="")return;
}
else
{
XmlDoc = parser.parseFromString(xmlhttp.responseText,"text/xml");
if(XmlDoc.documentElement.tagName=="parsererror")return;
var xml= oSerializer.serializeToString(XmlDoc.documentElement);
if(xml=="")return;
}
var root = XmlDoc.documentElement;
root =root.getElementsByTagName("c");
if(root.length>1)
{
fn = parseInt(root[0].firstChild.nodeValue);
if(root.length>1)
{
var tmp_rows="";
for (var i=1;i" +
"" +
" " + Ecoding[11] + ":"+ select_match_str + "" +
"" +
"" +
""+Ecoding[12]+"" +
""+Ecoding[13]+"" +
""+Ecoding[14]+"" +
""+Ecoding[15]+"" +
""+Ecoding[0]+"" +
""+Ecoding[1]+"" +
""+Ecoding[2]+"" +
""+Ecoding[3]+"" +
""+Ecoding[4]+"" +
""+Ecoding[5]+"" +
""+Ecoding[6]+"" +
""+Ecoding[7]+"" +
""+Ecoding[8]+"" +
""+Ecoding[9]+"" +
""+Ecoding[10]+"" +
""+Ecoding[17]+"" +
"" +
"" +
"" +
tmp_rows +
"";
lv.innerHTML = liveTable;
ReadData();
}
else
{
lv.innerHTML = "
";
}
add_font_ad();
}
function BuilderHtml(tr_style, bh, state, s_name, match_color, match_type, start_time,h_name, a_name,
set_h1, set_h2, set_h3, set_h4, set_h5,set_h6, set_h7, set_h8, set_h9, set_h10, set_h,
set_a1, set_a2, set_a3, set_a4, set_a5,set_a6, set_a7, set_a8, set_a9, set_a10, set_a, odds, l_id, h_id, a_id , l_year)
{
if (match_list.indexOf("{" + s_name + "}") == -1)
{
match_list += "{" + s_name + "}";
select_match_str += " " + s_name + " ";
}
var hda_home, hda_away, ah_home, ah_away, ah_handicap1,ah_handicap2;
var hda_onclick = '', ah_onclick = '',ah_onclick1 = '', ah_onclick2 = '';
var run_str = '';
if(typeof(odds) != "undefined" && odds != "")
{
var oddsParams = odds.split(',');
if(oddsParams[1] == "True")
{
run_str = "
";
}
if(oddsParams[3] == "")
{
hda_home = "";
hda_away = "";
}
else
{
hda_home = parseFloat(oddsParams[3].split('/')[0]);
hda_away = parseFloat(oddsParams[3].split('/')[1]);
hda_onclick = "onClick=\"history("+oddsParams[0]+", 2)\" style=\"cursor:pointer\"";
}
if(oddsParams[4] == "")
{
ah_home = "";
ah_away = "";
ah_handicap1 = "";
ah_handicap2 = "";
}
else
{
var ior=new Array();
var iorH = oddsParams[4].split('/')[0];
var iorC = oddsParams[4].split('/')[1];
if(iorH < 3) iorH *=1000;
if(iorC < 3) iorC *=1000;
iorH=parseFloat(iorH);
iorC=parseFloat(iorC);
ior = get_HK_ior(iorH, iorC);
ior[0]/=1000;
ior[1]/=1000;
ah_home = "[" + Decimal_point(ior[0],100)+"]";
ah_away = "[" + Decimal_point(ior[1],100)+"]";
if(oddsParams[4].split('/')[4] == "1" )
{
ah_handicap1 = parseFloat(oddsParams[4].split('/')[2])
ah_handicap2 = "";
ah_onclick1 = "onClick=\"history("+oddsParams[0]+", 3)\" style=\"cursor:pointer\"";
ah_onclick2 = "";
}
else
{
ah_handicap1 = "";
ah_handicap2 = parseFloat(oddsParams[4].split('/')[2]);
ah_onclick1 = "";
ah_onclick2 = "onClick=\"history("+oddsParams[0]+", 3)\" style=\"cursor:pointer\"";
}
ah_onclick = "onClick=\"history("+oddsParams[0]+", 3)\" style=\"cursor:pointer\"";
}
}
else
{
hda_home = "";
hda_away = "";
ah_home = "";
ah_away = "";
ah_handicap1 = "";
ah_handicap2 = "";
}
var set_result = AmountResult(match_type,state,set_h1, set_h2, set_h3, set_h4, set_h5,set_h6, set_h7, set_h8, set_h9, set_h10,set_h,
set_a1, set_a2, set_a3, set_a4, set_a5,set_a6, set_a7, set_a8, set_a9, set_a10, set_a);
var live_game1='', live_game2='', live_game_class1='', live_game_class2='';
var lang_index;
if(lang == "big")
{
lang_index = 0;
}
else if(lang == "gb")
{
lang_index = 1;
}
else if(lang == "en")
{
lang_index = 2;
}
else if(lang == "vn")
{
lang_index = 3;
}
else if(lang == "th")
{
lang_index = 4;
}
else
{
lang_index = 5;
}
if (state >= 21)
{
if(set_h > set_a)
{
live_game1 = "赢|贏|win|Thắng kèo|ชนะ|승".split('|')[lang_index];
live_game2 = "輸|输|lose|Thua kèo|แพ้|패".split('|')[lang_index];
live_game_class1 = "bf_win";
live_game_class2 = "bf_lose";
}
else if(set_h < set_a)
{
live_game1 = "輸|输|lose|Thua kèo|แพ้|패".split('|')[lang_index];
live_game2 = "赢|贏|win|Thắng kèo|ชนะ|승".split('|')[lang_index];
live_game_class1 = "bf_lose";
live_game_class2 = "bf_win";
}
else
{
live_game1 = "-";
live_game2 = "-";
live_game_class1 = "";
live_game_class2 = "";
}
}
var league_link = s_name;
var analyse_link = "";
var team_a_link = h_name;
var team_b_link = a_name;
if(l_id == "1" || l_id == "2" || l_id == "3" || l_id == "8" || l_id == "9")
{
/*
league_link = ""
+ s_name + "";
analyse_link = "
";
team_a_link = "" + h_name + "";
team_b_link = "" + a_name + "";
*/
if(Encode == 'vn' || Encode == 'kr'){
league_link = ""
+ s_name + "";
analyse_link = "
";
team_a_link = "" + h_name + "";
team_b_link = "" + a_name + "";
}else{
league_link = ""
+ s_name + "";
analyse_link = "
";
team_a_link = "" + h_name + "";
team_b_link = "" + a_name + "";
}
}
var str = "" +
" "
+ league_link + "
" + AmountTimeDiff(start_time, 4) + run_str + "" +
"" + StateToStr(state) + "" +
""+team_a_link+"" + ah_home + "" +
"" + ah_handicap1 + "" +
"" + set_result[0] + "" +
"" + set_result[1] + "" +
"" + set_result[2] + "" +
"" + set_result[3] + "" +
"" + set_result[4] + "" +
"" + set_result[5] + "" +
"" + set_result[6] + "" +
"" + set_result[7] + "" +
"" + set_result[8] + "" +
"" + set_result[9] + "" +
"" + set_result[10] + "" +
"" + hda_home + "" +
"" + live_game1 + "" +
""+analyse_link+"" +
"" +
"" +
""+team_b_link+"" + ah_away + "" + "" +
"" + ah_handicap2 + "" +
"" + set_result[11] + "" +
"" + set_result[12] + "" +
"" + set_result[13] + "" +
"" + set_result[14] + "" +
"" + set_result[15] + "" +
"" + set_result[16] + "" +
"" + set_result[17] + "" +
"" + set_result[18] + "" +
"" + set_result[19] + "" +
"" + set_result[20] + "" +
"" + set_result[21] + "" +
"" + hda_away + "" +
"" + live_game2 + "" +
"";
return str;
}
function StateToStr(i)
{
var StateStr_gb = new Array("未开始", "第1节", "第2节", "第3节", "第4节", "第5节", "第6节", "第7节", "第8节", "第9节","加时",
"中断", "中断", "中断", "中断", "中断","中断", "中断", "中断", "中断", "中断",
"完场", "完场", "完场", "完场","廷迟", "推迟", "腰斩", "取消","待定");
var StateStr_big = new Array("未開始", "第1節", "第2節", "第3節", "第4節","第5節", "第6節", "第7節", "第8節","第9節", "加時",
"中斷", "中断", "中断", "中断", "中断","中斷", "中断", "中断", "中断", "中断",
"完場","完場","完場","完場", "廷遲", "推遲", "腰斬", "取消","待定");
var StateStr_en = new Array("NSY", "1st Set", "2nd Set", "3rd Set", "4th Set","5th Set","6th Set","7th Set","8th Set","9th Set","ET",
"Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.",
"FT","FT","FT","FT","Postpone", "Pause", "Delay", "Cut","Moment");
var StateStr_th = new Array("NSY", "1st Set", "2nd Set", "3rd Set", "4th Set","5th Set","6th Set","7th Set","8th Set","9th Set","ET",
"Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.",
"FT","FT","FT","FT","Postpone", "Pause", "Delay", "Cut","Moment");
var StateStr_vn = new Array("NSY", "1st Set", "2nd Set", "3rd Set", "4th Set","5th Set","6th Set","7th Set","8th Set","9th Set","ET",
"Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.",
"FT","FT","FT","FT","Postpone", "Pause", "Delay", "Cut","Moment");
var StateStr_kr = new Array("NSY", "1st Set", "2nd Set", "3rd Set", "4th Set","5th Set","6th Set","7th Set","8th Set","9th Set","ET",
"Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.","Canc.",
"FT","FT","FT","FT","Postpone", "Pause", "Delay", "Cut","Moment");
var rltstr = "";
switch(Encode)
{
case "gb":
rltstr = StateStr_gb[i];
break;
case "en":
rltstr = StateStr_en[i];
break;
case "th":
rltstr = StateStr_th[i];
break;
case "vn":
rltstr = StateStr_vn[i];
break;
case "kr":
rltstr = StateStr_kr[i];
break;
default:
rltstr = StateStr_big[i];
break;
}
return rltstr;
}
function ReadData()
{
try
{
xmlhttp.open("get", "ChangeData/change.xml?" + Number(new Date()).toString().substring(0,10), true);
xmlhttp.onreadystatechange = ReadReady;
xmlhttp.send(null);
}
catch(e){}
if (typeof(ReadXml_Time) != "undefined")
clearTimeout(ReadXml_Time);
ReadXml_Time = setTimeout("ReadData()", 2000);
}
function ReadReady()
{
if (xmlhttp.readyState != 4) return;
var XmlDoc,xml;
if(isIE)
{
XmlDoc = xmlhttp.responseXML;
xml=XmlDoc.xml;
if(xml==""||oldxml==xml)return;
}
else
{
XmlDoc = parser.parseFromString(xmlhttp.responseText,"text/xml");
if(XmlDoc.documentElement.tagName=="parsererror")return;
xml= oSerializer.serializeToString(XmlDoc.documentElement);
if(xml==""||oldxml==xml)return;
}
var root=XmlDoc.documentElement.getElementsByTagName("c");
if (root.length > 0)
{
var nextFn = parseInt(root[root.length-1].firstChild.nodeValue);
//alert(nextFn)
//alert(nextFn + " " + fn)
if (nextFn > fn)
{
ReadData2();
}
else
{
var Refresh = root[0].firstChild.nodeValue;
if (document.cookie.indexOf("BaseBall_Rst=") < 0 )
{
document.cookie = "BaseBall_Rst=" + Refresh;
}
var getOldRefresh = document.cookie.substring(document.cookie.indexOf("BaseBall_Rst=")+13,document.cookie.indexOf("BaseBall_Rst=")+14);
if (getOldRefresh != Refresh)
{
var Rnd = Math.round(Math.random()*9000)+1000;
document.cookie = "BaseBall_Rst=" + Refresh;
if (document.cookie !="")
{
setTimeout("location.reload()", Rnd);
return;
}
}
for (var i=1;i 0)
{
var Refresh = root[0].firstChild.nodeValue;
if (document.cookie.indexOf("BaseBall_Rst=") < 0 ){document.cookie = "BaseBall_Rst=" + Refresh;}
var getOldRefresh = document.cookie.substring(document.cookie.indexOf("BaseBall_Rst=")+13,document.cookie.indexOf("BaseBall_Rst=")+14);
if (getOldRefresh != Refresh)
{
var Rnd = Math.round(Math.random()*9000)+1000;
document.cookie = "BaseBall_Rst=" + Refresh;
if (document.cookie !="")
{
setTimeout("location.reload()", Rnd);
return;
}
}
for (var i=1;i 20)
{
eval("Update_Live(" + root[i].firstChild.nodeValue + ")");
}
else
{
//eval("Update_Odds(" + root[i].firstChild.nodeValue + ")");
}
}
fn = parseInt(root[root.length-1].firstChild.nodeValue);
}
}
function Update_Odds(bh, type,id,odds1,odds2,odds3,flag,oper,shangpan)
{
if(document.getElementById("r1_" + bh) == null)
{
return;
}
var obj;
if(type == 2) //ah
{
var ior=new Array();
var iorH = odds1;
var iorC = odds2;
if(iorH < 3) iorH *=1000;
if(iorC < 3) iorC *=1000;
iorH=parseFloat(iorH);
iorC=parseFloat(iorC);
ior = get_HK_ior(iorH, iorC);
ior[0]/=1000;
ior[1]/=1000;
odds1 = Decimal_point(ior[0],100);
odds2 = Decimal_point(ior[1],100);
var tmp;
var obj_h = document.getElementById("h_ah_" + bh);
var odds1_old = obj_h.innerHTML.replace("[","").replace("]","").replace(" ","");
if(odds1_old == '' || parseFloat(odds1) != parseFloat(odds1_old))
{
obj_h.innerHTML = "[" + parseFloat(odds1)+"]";
if(odds1_old != '')
{
//alert(obj.innerHTML)
if(parseFloat(odds1) < parseFloat(odds1_old))
{
obj_h.style.color = "#0E6600";
setTimeout("SetBuleColor('" + obj_h.id + "')", 10000);
}
else
{
obj_h.style.color = "#FF0000";
setTimeout("SetBuleColor('" + obj_h.id + "')", 10000);
}
}
}
var obj_a = document.getElementById("a_ah_" + bh);
var odds2_old = obj_a.innerHTML.replace("[","").replace("]","").replace(" ","");
//alert(odds2_old + ' ' + odds2);
if(odds2_old == '' || parseFloat(odds2) != parseFloat(odds2_old))
{
obj_a.innerHTML = "[" + parseFloat(odds2)+"]";
if(odds2_old != '')
{
if(parseFloat(odds2) < parseFloat(odds2_old))
{
obj_a.style.color = "#0E6600";
setTimeout("SetBuleColor('" + obj_a.id + "')", 10000);
}
else
{
obj_a.style.color = "#FF0000";
setTimeout("SetBuleColor('" + obj_a.id + "')", 10000);
}
}
}
if(shangpan == "1" )
{
document.getElementById("ah_1_" + bh).innerHTML = parseFloat(odds3);
document.getElementById("ah_2_" + bh).innerHTML = "";
}
else
{
document.getElementById("ah_1_" + bh).innerHTML = "";
document.getElementById("ah_2_" + bh).innerHTML = parseFloat(odds3);
}
}
else //hda
{
obj = document.getElementById("h_hda_" + bh);
var odds1_old = obj.innerHTML.replace(" ","");
if(odds1_old == '' || parseFloat(odds1) != parseFloat(odds1_old))
{
obj.innerHTML = parseFloat(odds1);
if(odds1_old != '')
{
if(parseFloat(odds1) < parseFloat(odds1_old))
{
obj.style.color = "#0E6600";
setTimeout("SetBuleColor('" + obj.id + "')", 10000);
}
else
{
obj.style.color = "#FF0000";
setTimeout("SetBuleColor('" + obj.id + "')", 10000);
}
}
}
obj = document.getElementById("a_hda_" + bh);
var odds2_old = obj.innerHTML.replace(" ","");
if(odds2_old == '' || parseFloat(odds2) != parseFloat(odds2_old))
{
obj.innerHTML = parseFloat(odds2);
if(odds2_old != '')
{
if(parseFloat(odds2) < parseFloat(odds2_old))
{
obj.style.color = "#0E6600";
setTimeout("SetBuleColor('" + obj.id + "')", 10000);
}
else
{
obj.style.color = "#FF0000";
setTimeout("SetBuleColor('" + obj.id + "')", 10000);
}
}
}
}
}
function Update_Live(bh, match_type,state, set_h1, set_h2, set_h3, set_h4, set_h5,set_h6, set_h7, set_h8, set_h9, set_h10,set_h,
set_a1, set_a2, set_a3, set_a4, set_a5,set_a6, set_a7, set_a8, set_a9, set_a10, set_a)
{
if (document.getElementById("r1_" + bh) == null) return;
var set_result = AmountResult(match_type,state, set_h1, set_h2, set_h3, set_h4, set_h5,set_h6, set_h7, set_h8, set_h9, set_h10,set_h,
set_a1, set_a2, set_a3, set_a4, set_a5,set_a6, set_a7, set_a8, set_a9, set_a10, set_a);
SetElementHtmlValue("state_" + bh, StateToStr(state), false);
SetElementHtmlValue("h1_" + bh, set_result[0], true);
SetElementHtmlValue("h2_" + bh, set_result[1], true);
SetElementHtmlValue("h3_" + bh, set_result[2], true);
SetElementHtmlValue("h4_" + bh, set_result[3], true);
SetElementHtmlValue("h5_" + bh, set_result[4], true);
SetElementHtmlValue("h6_" + bh, set_result[5], true);
SetElementHtmlValue("h7_" + bh, set_result[6], true);
SetElementHtmlValue("h8_" + bh, set_result[7], true);
SetElementHtmlValue("h9_" + bh, set_result[8], true);
SetElementHtmlValue("h10_" + bh, set_result[9], true);
SetElementHtmlValue("h_" + bh, set_result[10], false);
SetElementHtmlValue("a1_" + bh, set_result[11], true);
SetElementHtmlValue("a2_" + bh, set_result[12], true);
SetElementHtmlValue("a3_" + bh, set_result[13], true);
SetElementHtmlValue("a4_" + bh, set_result[14], true);
SetElementHtmlValue("a5_" + bh, set_result[15], true);
SetElementHtmlValue("a6_" + bh, set_result[16], true);
SetElementHtmlValue("a7_" + bh, set_result[17], true);
SetElementHtmlValue("a8_" + bh, set_result[18], true);
SetElementHtmlValue("a9_" + bh, set_result[19], true);
SetElementHtmlValue("a10_" + bh, set_result[20], true);
SetElementHtmlValue("a_" + bh, set_result[21], false);
if (state >= 21)
setTimeout("MoveFinalGame(" + bh + ")", 10000);
}
function AmountResult(match_type,state, set_h1, set_h2, set_h3, set_h4, set_h5,set_h6, set_h7, set_h8, set_h9, set_h10,seth,
set_a1, set_a2, set_a3, set_a4, set_a5,set_a6, set_a7, set_a8, set_a9, set_a10, seta)
{
var set_result = new Array("-","-","-","-","-","-","-","-","-","-","-",
"-","-","-","-","-","-","-","-","-","-","-");
var set_h = new Array(set_h1,set_h2,set_h3,set_h4,set_h5,set_h6,set_h7,set_h8,set_h9,set_h10);
var set_a = new Array(set_a1,set_a2,set_a3,set_a4,set_a5,set_a6,set_a7,set_a8,set_a9,set_a10);
if (state > 0 && state <= 24)
{
var state_step = state;
//alert(state_step);
if( state >= 11 && state <= 20 )
{
state_step = state - 10;
}
else if(state == 21)
{
state_step = 5;
}
else if(state == 22)
{
state_step = 7;
}
else if(state == 23)
{
state_step = 9;
}
else if(state == 24)
{
state_step = 10;
}
for (var i=0;i