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; } function InitializeData() { xmlhttp.open("get", "/DataFile/live_" + Encode + ".xml?" + Number(new Date()).toString().substring(0,10), true); xmlhttp.onreadystatechange = InitializeReady; xmlhttp.send(null); } function InitializeReady() { if(xmlhttp.readyState!=4)return; var XmlDoc; if(isIE) { XmlDoc = xmlhttp.responseXML; 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" + "" + " " + select_match_str + "" + "" + tmp_rows + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + ""; lv.innerHTML = liveTable; ReadData(); } else { lv.innerHTML = "
"; } } function BuilderHtml(tr_style, bh, state, s_name, match_color, match_type, start_time, ph1_name, ph2_name, pa1_name, pa2_name, player_h1, player_h2, player_a1, player_a2, set_h1, set_h2, set_h3, set_h4, set_h5, set_a1, set_a2, set_a3, set_a4, set_a5, note) { if (match_list.indexOf("{" + s_name + "}") == -1) { match_list += "{" + s_name + "}"; select_match_str += " " + s_name + " "; } /*if (ph1_name != "") ph1_name = "" + ph1_name + ""; if (ph2_name != "") ph2_name = "" + ph2_name + ""; if (pa1_name != "") pa1_name = "" + pa1_name + ""; if (pa2_name != "") pa2_name = "" + pa2_name + "";*/ var p_name1 = ph1_name; if (ph2_name != "") p_name1 += " - " + ph2_name; var p_name2 = pa1_name; if (pa2_name != "") p_name2 += " - " + pa2_name; var set_result = AmountResult(match_type,state,set_h1,set_h2,set_h3,set_h4,set_h5,set_a1,set_a2,set_a3,set_a4,set_a5); if (match_type == 1) { set_result[3] = "x"; set_result[4] = "x"; set_result[8] = "x"; set_result[9] = "x"; } var str = "" + " " + s_name + "" + " " + AmountTimeDiff(start_time, 4) + "" + " " + StateToStr(state) + "" + " " + p_name1 + "" + " " + set_result[0] + "" + " " + set_result[1] + "" + " " + set_result[2] + "" + " " + set_result[3] + "" + " " + set_result[4] + "" + " " + set_result[10] + "" + "" + "" + " " + p_name2 + "" + " " + set_result[5] + "" + " " + set_result[6] + "" + " " + set_result[7] + "" + " " + set_result[8] + "" + " " + set_result[9] + "" + " " + set_result[11] + "" + ""; var note_display = "display:none"; if (note != "") { if (note.indexOf("{") != -1 && note.indexOf("}") != -1) { var re = new RegExp("\\{(.*)\\}", "ig"); if (Encode == "en") note = re.exec(note)[1]; else note = note.replace(re, ""); } note_display = ""; } str += "" + " " + note + "" + ""; return str; } function StateToStr(i) { var StateStr_gb = new Array("未开始", "第1局", "第2局", "第3局", "第4局", "第5局", "完场", "中断", "中断", "中断", "中断", "中断", "廷期", "取消", "待定", "廷迟"); var StateStr_big = new Array("未開始", "第1局", "第2局", "第3局", "第4局", "第5局", "完場", "中斷", "中斷", "中斷", "中斷", "中斷", "廷期", "取消", "待定", "廷遲"); var StateStr_en = new Array("NSY", "1st Set", "2nd Set", "3rd Set", "4th Set", "5th Set", "FT", "AET", "AET", "AET", "AET", "AET", "Int.", "Can.", "FT Only", "Delay"); var rltstr = ""; switch(Encode) { case "gb": rltstr = StateStr_gb[i]; break; case "en": rltstr = StateStr_en[i]; break; default: rltstr = StateStr_big[i]; break; } return rltstr; } function ReadData() { try { xmlhttp.open("get", "liveData/sXl.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); if (nextFn > fn) { ReadData2(); } else { var Refresh = root[0].firstChild.nodeValue; if (document.cookie.indexOf("tennis_Rst=") < 0 ){document.cookie = "tennis_Rst=" + Refresh;} var getOldRefresh = document.cookie.substring(document.cookie.indexOf("tennis_Rst=")+11,document.cookie.indexOf("tennis_Rst=")+12); if (getOldRefresh != Refresh) { var Rnd = Math.round(Math.random()*9000)+1000; document.cookie = "tennis_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("tennis_Rst=") < 0 ){document.cookie = "tennis_Rst=" + Refresh;} var getOldRefresh = document.cookie.substring(document.cookie.indexOf("tennis_Rst=")+11,document.cookie.indexOf("tennis_Rst=")+12); if (getOldRefresh != Refresh) { var Rnd = Math.round(Math.random()*9000)+1000; document.cookie = "tennis_Rst=" + Refresh; if (document.cookie !="") { setTimeout("location.reload()", Rnd); return; } } for (var i=1;i 0 && state != 12 && state != 13) { set_result[10] = 0; set_result[11] = 0; var state_step = (state > 6) ? 6 : state; var max_win = (match_type == 0) ? 3 : 2; var stop_amount = 5; if (state >= 7 && state <= 11) state_step = state - 6; var draw = 0; for (var i=1;i set_a[i-1]) { set_result[10]++; if (set_result[10] >= max_win) { stop_amount = i; break; } } else if (set_h[i-1] < set_a[i-1]) { set_result[11]++; if (set_result[11] >= max_win) { stop_amount = i; break; } } else if (set_h[i-1] == set_a[i-1]) { draw++; stop_amount = max_win + draw; } } for (var i=0;i i) { if (i < stop_amount) { set_result[i] = set_h[i]; set_result[i+5] = set_a[i]; } } } } return set_result; } function SetElementHtmlValue(ElementName, HtmlValue, ChangeColor) { var obj = document.getElementById(ElementName); if (obj != null) { var objText = obj.innerHTML; if (objText != "x" && objText != HtmlValue.toString()) { obj.innerHTML = HtmlValue; if (ChangeColor) { obj.style.color = "#FF0000"; setTimeout("SetNorColor('" + obj.id + "')", 10000); } } } } function SetNorColor(ElementName) { var obj = document.getElementById(ElementName); if (obj != null) obj.style.color = "#000000"; } function SelectMatch(obj, MatchesName) { var re = new RegExp("]*>" + MatchesName + "", "ig"); var cr = document.all.LiveTable.innerHTML.match(re); var str = ""; if (cr != null) { for(var i=0;i