function init(){
	try{
		if (xSD.readyState!=4) return;
		var nodes = xSD.selectNodes("/_hgoal/f[@matchType='1']");
		var lines = new Array();
		var si=0;
		var month = "";
		var day = "";
		if (nodes.length>0){
			var arr = nodes[0].text.split("*");
			var fd = ParseDate( arr[2] );
			var fmd = new Date(fd.valueOf() - 6 * 60 * 60 * 1000);
			month = fmd.getMonth() + 1;
			day = fmd.getDate();
		}
		for(var i=0; i<nodes.length; i++){
			var arr = nodes[i].text.split("*");
			if (arr[12]=="8" || arr[12]=="9" || arr[12]=="10" || arr[12]=="16")	continue;
			aSD[arr[0]] = nodes[i].text;
			if (aDP[arr[0]]==null) aDP[arr[0]] = true;
			if (!aDP[arr[0]]) continue;
			lines[si++] = MI(arr, aCS[color][si%2]);
		}
		for(var i=0; i<nodes.length; i++){
			var arr = nodes[i].text.split("*");
			if (arr[12]!="8") continue;
			aSD[arr[0]] = nodes[i].text;
			if (aDP[arr[0]]==null) aDP[arr[0]] = true;
			if (!aDP[arr[0]]) continue;
			lines[si++] = MI(arr, aCS[color][si%2]);
		}
		lines[si++] = "<tr id=fend style='display:none;'><td colspan=9></td></tr>";
		for(var i=0; i<nodes.length; i++){
			var arr = nodes[i].text.split("*");
			if (arr[12]!="9" && arr[12]!="10" && arr[12]!="16") continue;
			aSD[arr[0]] = nodes[i].text;
			if (aDP[arr[0]]==null) aDP[arr[0]] = true;
			if (!aDP[arr[0]]) continue;
			lines[si++] = MI(arr, aCS[color][si%2]);
		}
		lines[si++] = "<tr id=fchanged style='display:none;'><td colspan=9></td></tr>";

		//篮球 开始
		var nodes = xSD.selectNodes("/_hgoal/f[@matchType='2']");
		for(var i=0; i<nodes.length; i++){
			var arr = nodes[i].text.split("*");
			if (arr[12]=="8" || arr[12]=="9" || arr[12]=="10" || arr[12]=="16") continue;
			aSD[arr[0]] = nodes[i].text;
			if (aDP[arr[0]]==null) aDP[arr[0]] = true;
			if (!aDP[arr[0]]) continue;
			lines[si++] = MIB(arr, aCS[color][si%2]);
		}
		for(var i=0; i<nodes.length; i++){
			var arr = nodes[i].text.split("*");
			if (arr[12]!="8" && arr[12]!="9" && arr[12]!="10" && arr[12]!="16") continue;
			aSD[arr[0]] = nodes[i].text;
			if (aDP[arr[0]]==null) aDP[arr[0]] = true;
			if (!aDP[arr[0]]) continue;
			lines[si++] = MIB(arr, aCS[color][si%2]);
		}
		lines[si] = "<tr id=fbend style='display:none;'><td colspan=9></td></tr>";

		//篮球 结束
		var notice="";
		var noticelink="";
		if (noticelink!="") notice = "<a href='" + noticelink + "' target=_blank>" + notice + "</a>";
		str = "<table border=1 width=100% bordercolor=#DDDDDD cellpadding=0 cellspacing=0 style='border-collapse: collapse'><tr align=center><td bgcolor=#FFFFFF><div id=notice></div></td></tr></table><table border=1 width=100% id=scoreTable bordercolor=#C4DFEE cellpadding=1 cellspacing=0 style='border-collapse: collapse'>	<tr bgcolor=#10518C height=18 align=center><td width=3%></td><td width=11%><font color=white>" + month + "月" + day + "日</font></td>		<td colspan=2 width=13%><span id=goalsound></span><span id=cardsound></span><font color=white>时间</font></td>		<td width=23%><font color=white>主队</font></td>		<td width=12%><font color=white>比分</font></td>		<td width=23%><font color=white>客队</font></td>		<td width=8%><font color=white>半场</font></td> <td width=7%><font color=white>资料</font></td>	</tr>" + lines.join("") + "</table>";

		GEBI("liveScore").innerHTML = str;
		GEBI("HideMatchCount").innerText = getHideMatchCount();
		GEBI("notice").innerHTML = notice;
		setLeagueBoard();
	}catch(e){
		window.status=e.description + "|init";
	}
}

function MI(arr, cs)
{
	var str = "";
	str += "<tr id=f" + arr[0] + " bgcolor=" + cs + " align=center height=22>";
	str += "<td><input type=checkbox checked style='width:13; height:13; ' onclick='hideScore(" + arr[0] + "); return false;'></td>";
	str += "<td bgcolor=" + arr[3] + " align=center><font color=white>" + getLN(arr) + "</font></td>";
	str += "<td id=t" + arr[0] + ">" + getMT(arr) + "</td>";
	str += "<td>" + getStatus(arr) + "</td>";
	str += "<td align=right>" + getHT(arr, 0, 0) + "</td>";
	str += "<td onclick=\"showEvent(" + arr[0] + ", " + arr[15] + ", '" + arr[33] + "', '" + arr[34] + "');\" style='cursor:hand;' onmouseover='this.style.backgroundImage=\"url(images/blued.gif )\"' onmouseout='this.style.backgroundImage=\"none\"'>" + getScore(arr, 0) + "</td>";
	str += "<td align=left>" + getAT(arr, 0, 0) + "</td>";
	if (arr[40]!="0") str += "<td  onclick=\"showzst(" + arr[0] + ", " + arr[15] + ", " + arr[23] + ", '" + getHTN(arr) + "', '" + getATN(arr) + "','" + arr[2] + "','" + arr[31] + "','" + arr[33] + "','" + arr[34] + "'); return false;\" style='cursor:hand;' onmouseover='this.style.backgroundImage=\"url(images/yl.gif )\"' onmouseout='this.style.backgroundImage=\"none\"' bgcolor=#DBF0FF>" + getHTScore(arr) + "</td>";
	else str += "<td>" + getHTScore(arr) + "</td>";
	if (arr[30]=="1"){
		str += "<td align=left class=zd><div style='margin-top:5px;'>";
	}else{
		str += "<td align=left><div style='letter-spacing:2px;margin-top:5px;'>";
	}
	str += "<a href=# onclick=\"op('http://live.hgoal.com/analyse_p/" + arr[0] + ".htm'); return false;\"><font color=#000000>析</font></a>";
	str += "<a href=# onclick=\"op('http://live.hgoal.com/review/review.asp?FixtureID=" + arr[0] + "'); return false;\"><font color=#000000>评</font></a>";
	str += "</div></td>";
	str += "</tr>";
	str += "<tr id=r" + arr[0] + " style='display:" + (arr[22]==""?"none":"") + ";' align=center><td colspan=10 bgcolor=#FFFFFF><font color=#008000>" + arr[22].replace("http://img.8bo8.com/vod/", "#") + "</font></td></tr>";
	return str;
}

function MIB(arr, cs)
{
	var str = "";
	str += "<tr id=f" + arr[0] + " bgcolor=" + cs + " align=center height=22>";
	str += "<td><input type=checkbox checked style='width:13; height:13; ' onclick='hideScore(" + arr[0] + "); return false;'></td>";
	str += "<td bgcolor=" + arr[3] + " align=center><font color=white>" + getLN(arr) + "</font></td>";
	str += "<td id=t" + arr[0] + ">" + getBMT(arr) + "</td>";
	str += "<td>" + getBStatus(arr) + "</td>";
	str += "<td align=right><a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + arr[0] + ".html'); return false;\" title=让分盘路><font color=#000000>" + getBHT(arr, 0, 0) + "</font></a></td>";
	if (arr[1]!="NCAA") str += "<td onclick='showEvent(" + arr[0] + ", " + arr[15] + ");' style='cursor:hand;' onmouseover='this.style.backgroundImage=\"url(images/blued.gif)\"' onmouseout='this.style.backgroundImage=\"none\"'>" + getScore(arr, 0) + "</td>";
	else str += "<td>" + getScore(arr, 0) + "</td>";
	str += "<td align=left><a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + arr[0] + ".html'); return false;\" title=让分盘路><font color=#000000>" + getBAT(arr, 0, 0) + "</font></a></td>";
	str += "<td>" + getBHTScore(arr, arr[0], arr[23], arr[12], arr[8], arr[9]) + "</td>";
	str += "<td align=left><div style='letter-spacing:2px;margin-top:5px;'>";
	if (arr[26]!="" && arr[1]=="CBA"){
		str += "<a href=# onclick=\"op('http://live.hgoal.com/analyse/" + arr[0] + ".htm'); return false;\"><font color=#000000>析</font></a>";
	}
	if(arr[26]!="" && arr[1]!="CBA"){
		str += "<a href=# onclick=\"op('http://live.hgoal.com/analyse/" + arr[0] + ".html'); return false;\"><font color=#000000>析</font></a>";
	}
	str += "<a href=# onclick=\"op('http://live.hgoal.com/review/review.asp?FixtureID=" + arr[0] + "'); return false;\"><font color=#000000>评</font></a>";
	str += "</div></td></tr>";
	str += "<tr id=r" + arr[0] + " style='display:" + (arr[22]==""?"none":"") + ";' align=center><td colspan=10 bgcolor=#FFFFFF><font color=#008000>" + arr[22].replace("http://img.8bo8.com/vod/", "#") + "</font></td></tr>";
	return str;
}

function GEBI(id){
	return document.getElementById(id);
}

function ParseDate(dtstr){
	var tmp = dtstr.split(/[-: ]/);
	return new Date(parseInt(tmp[0]), parseInt(tmp[1])-1, parseInt(tmp[2]), parseInt(tmp[3]), parseInt(tmp[4]), 0);
}

function toTimeString(dt){
	var str = "";
	if (dt.getHours()<10) str += "0";
	str += dt.getHours() + ":";
	if (dt.getMinutes()<10) str += "0";
	str += dt.getMinutes();
	return str;
}

function getMT(arr){
	return toTimeString(ParseDate(arr[2]));
}

function getSEN(sid){
	var d = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,21,22,23,24".split(",");
	var n = ",1ST,HT,2ST,ADD,PEN,STOP,FT,CAN,ALT,1TH,2TH,3TH,4TH,LATER,WAIT,1FT,2FT,3FT,4FT".split(",");
	for(var i=0; i<d.length;i++)
		if (sid==d[i]) return n[i];
	return "";
}

function getStatus(arr){
	var sid=arr[12];
	var sn=arr[13];
	var tmp = sn;
	if (sid=="3") tmp = "中";
	if (sn=="改") tmp = "改期";
	if (sn=="待") tmp = "等待";
	if (lang==3) tmp = getSEN(sid);
	if (sid=="1") tmp = "";
	if (sid=="3" || sid=="8") return "<font color=red><b>" + tmp + "</b></font>";
	if (sid!="1" && sid!="2" && sid!="4") tmp = "<b>" + tmp + "</b>";
	var t = ParseDate(arr[2]);
	var s = arr[12];
	var diff = arr[32];
	var dt = new Date();
	var st = dt - diffTime;
	var mt = Math.round((st - t)/1000/60);
	if (mt<0) mt=0;
	if (s=="2"){
		if (mt>45) mt="" + 45 + "+";
		return "<font color=red>" + mt + "</font><img src='images/dot.gif' width='3' height='10' align='absmiddle'>";
	}
	if (s=="4" || s=="5" || s=="6"){
		mt = mt - 18 + parseInt(diff);
		if (mt<45) mt=45;
		if (mt>90) mt="" + 90 + "+";
		return "<font color=red>" + mt + "</font><img src='images/dot.gif' width='3' height='10' align='absmiddle'>";
	}
	return tmp;
}

function toBTimeString(dt){
	var str = "";
	if (dt.getHours()<10) str += "0";
	str += dt.getHours() + ":";
	if (dt.getMinutes()<10) str += "0";
	str += dt.getMinutes();
	return str;
}

function getBMT(arr){
	var t = ParseDate(arr[2]);
	var sid = arr[12];
	var sn = arr[13];
	var tmp = sn;
	if (sid=="22") tmp = "中场";
	if (lang==3) tmp = getSEN(sid);
	if (sid=="11" || sid=="12" || sid=="13" || sid=="14" ||  sid=="5" || sid=="15")	return tmp;
	if (sid=="21" || sid=="22" || sid=="23" || sid=="24") return "<font color=red>" + tmp + "</font>";
	return toBTimeString(t);
}

function getBStatus(arr){
	var sid=arr[12];
	var sn=arr[13];
	if (sid=="11" || sid=="12") return "<img src=images/shang.gif align=absmiddle width=4 height=4>"
	if (sid=="13" || sid=="14" ||  sid=="5") return "<img src=images/xia.gif align=absmiddle width=4 height=4>";
	if (sid=="21" || sid=="22" || sid=="23" || sid=="24" || sid=="15") return "";
	var tmp = sn;
	if (sid=="22") tmp = "中场休息";
	if (lang==3) tmp = getSEN(sid);
	if (sid=="8" || sid=="21" || sid=="22" || sid=="23" || sid=="24") tmp = "<font color=red>" + tmp + "</font>"; 
	return tmp;
}

function getScore(arr, goal){
	var sid=arr[12];
	var hscore=arr[6];
	var ascore=arr[7];
	var tmp = "-";
	if (sid=="1" || sid=="9" || sid=="10")
		hscore = ascore = "";
	else{
		if (hscore=="") hscore="0";
		if (ascore=="") ascore="0";
	}
	switch(goal){
		case 0:
			tmp = "<b>" + hscore + "-" + ascore + "</b>";
			if (sid=="8") tmp = "<font color=red>" + tmp + "</font>";
			break;
		case 1:
			tmp = "<b><font color=red>" + hscore + "</font>-" + ascore + "</b>";
			break;
		case 2:
			tmp = "<b>" + hscore + "-<font color=red>" + ascore + "</font></b>";
			break;
		case 3:
			tmp = "<b><font color=red>" + hscore + "</font>-<font color=red>" + ascore + "</font></b>";
	}
	if (sid=="16") return tmp;
	return "<font color=blue>" + tmp + "</font>";
}

function getRC(rc){
	var tmp = "";
	for (var i=0; i<rc; i++) tmp += "<img src=images/red.gif align=absmiddle border=0 width=7 height=10>";
	return tmp;
}

function getHT(arr, goal, card){
	var tmp = getHTN(arr);
	var fid = arr[0];
	var tcn = arr[35];
	if (tcn != "") tmp += "(" + tcn + ")";
	tmp = getRC(arr[10]) + tmp;
	if (goal==1 || goal==3 || card==1 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	tmp = tmp;
	tmp = "<a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + fid + ".html'); return false;\" title=盘路查询><font color=black>" + tmp + "</font></a>";
	return tmp;
}

function getHT2(arr, goal, card){
	var tmp = getHTN(arr).substring(0,6);
	var rc = arr[10];
	tmp = getRC(arr[10]) + tmp;
	if (goal==1 || goal==3 || card==1 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	return tmp;
}

function getHT3(arr, goal, card){
	var tmp = getHTN(arr);
	var rc = arr[10];
	tmp = getRC(arr[10]) + tmp;
	if (goal==1 || goal==3 || card==1 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	return tmp;
}

function getBHT(arr, goal, card){
	var tmp = getHTN(arr).substring(0,6);
	if (goal==1 || goal==3 || card==1 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	return tmp;
}

function getBAT(arr, goal, card){
	var tmp = getATN(arr);
	if (goal==2 || goal==3 || card==2 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	return tmp;
}

function getAT(arr, goal, card){
	var tmp = getATN(arr);
	var fid = arr[0];
	var tcn = arr[36];
	if (tcn != "") tmp += "(" + tcn + ")";
	tmp += getRC(arr[11]);
	if (goal==2 || goal==3 || card==2 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	tmp = "<a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + fid + ".html'); return false;\" title=盘路查询><font color=black>" + tmp + "</font></a>";
	return tmp;
}

function getAT2(arr, goal, card){
	var tmp = getATN(arr).substring(0,6);
	tmp += getRC(arr[11]);
	if (goal==2 || goal==3 || card==2 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	return tmp;
}

function getAT3(arr, goal, card){
	var tmp = getATN(arr);
	tmp += getRC(arr[11]);
	if (goal==2 || goal==3 || card==2 || card==3) tmp = "<font color=red><b>" + tmp + "</b></font>";
	return tmp;
}

function getHTScore(arr){
	var sid = arr[12];
	var tmp = "";
	if (arr[40]!="0") tmp = "<font color=#FF33FF>√<font>";
	if (sid=="1" || sid=="9" || sid=="10") return tmp;
	var hths = arr[8];
	var htas = arr[9];
	if (sid=="1" || sid=="2" || sid=="9" || sid=="10") hths = htas = "";
	else{
		if (hths=="") hths="0";
		if (htas=="") htas="0";
	}
	tmp = "<font color=red>" + hths + "-" + htas + "</font>";
	return tmp;
}

function getBHTScore(arr){
	var sid = arr[12];
	var tmp = "";
	if (arr[26]!="" && arr[1]!="CBA") tmp += "<a href=# onclick=\"op2('data/oddsall.aspx?fid=" + arr[0] + "'); return false;\"><font color=#FF33FF>√<font></a> ";
	if (sid=="1" || sid=="9" || sid=="10") return tmp;
	var hths = arr[8];
	var htas = arr[9];
	if (sid=="1" || sid=="2" || sid=="9" || sid=="10") hths = htas = "";
	else{
		if (hths=="") hths="0";
		if (htas=="") htas="0";
	}
	if (arr[26]!="" && arr[1]!="CBA") return "<a href=# onclick=\"op2('data/oddsall.aspx?fid=" + arr[0] + "'); return false;\"><font color=red>" + hths + "-" + htas + "</font></a>"
	return hths + "-" + htas;
}

function getLN(arr){
	if (lang==1) return arr[1];
	if (lang==2) return arr[16];
	if (lang==3) return arr[17];
}

function getLN2(arr){
	if (lang==1) return arr[1];
	if (lang==2) return arr[16];
	if (lang==3) return arr[17];
}

function getHTN(arr){
	if (lang==1) return arr[4];
	if (lang==2) return arr[18];
	if (lang==3) return arr[19];
}

function getATN(arr){
	if (lang==1) return arr[5];
	if (lang==2) return arr[20];
	if (lang==3) return arr[21];
}

function getXmlData(){
	try{
		var dt = new Date();
		xLD.onreadystatechange = refresh;
		if (sysbusy){
			wait ++;
			if (wait>3){
				wait = 0;
				xLD.load("xmldata/scoreall.xml?dt=" + dt.valueOf());
			}
		}else{
			wait = 0;
			xLD.load("xmldata/scoreall.xml?dt=" + dt.valueOf());
		}
	}catch (e){}
	window.setTimeout("getXmlData();", 2000);
}

var oldxml="";
var goalTextCount = 0;
var sysbusy = false;
var wait = 0;

function refresh(){
	if (xLD.readyState!=4) return;
	try{
		var arrPopItem = new Array();
		var tmp = "";
		var tmpCount = 0;
		xmlDoc.XMLDocument.async = false; 
		xmlDoc.XMLDocument.loadXML(xLD.xml);
		if(xLD.xml=="") return;	
		if(oldxml==xLD.xml) return;	
		sysbusy = true;
		var nodes = xmlDoc.selectNodes("/_8bo8/f");
		for(var i=0; i<nodes.length; i++){
			try{
				var str = "";
				var arr = nodes[i].text.split("*");
				//	实现数据还原
				if (aSD[arr[0]]==null) continue;
				var arro = aSD[arr[0]].split("*");
				for(var j=0; j<arro.length; j++)
					if (",1,3,4,5,16,17,18,19,20,21,28,29,33,34,35,36,".indexOf("," + j + ",")>-1) arr[j] = arro[j];
				if (aSD[arr[0]] == arr.join("*")) continue;
				var goal = 0;
				if (arr[6]!=arro[6] || arr[7]!=arro[7]){
					if (arro[6]!="" && arr[6]!=arro[6]) goal += 1;
					if (arro[6]!="" && arr[7]!=arro[7]) goal += 2;
				}
				var card = 0;
				if (arr[10]!=arro[10] || arr[11]!=arro[11]){
					if (arr[10]>"0" && arr[10]>arro[10]) card += 1;
					if (arr[11]>"0" && arr[11]>arro[11]) card += 2;
				}
				var trf = GEBI("f" + arr[0]);
				trf.cells[5].innerHTML = getScore(arr, goal);
				if (arr[15]=="1"){
					trf.cells[2].innerHTML = getMT(arr);
					trf.cells[3].innerHTML = getStatus(arr);
					trf.cells[4].innerHTML = getHT(arr, goal, card);
					trf.cells[6].innerHTML = getAT(arr, goal, card);
					trf.cells[7].innerHTML = getHTScore(arr);
				}else{
					trf.cells[2].innerHTML = getBMT(arr);
					trf.cells[3].innerHTML = getBStatus(arr);
					trf.cells[4].innerHTML = "<a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + arr[0] + ".html'); return false;\" title=让分盘路><font color=#000000>" + getBHT(arr, goal, card) + "</font></a>";
					trf.cells[6].innerHTML = "<a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + arr[0] + ".html'); return false;\" title=让分盘路><font color=#000000>" + getBAT(arr, goal, card) + "</font></a>";
					trf.cells[7].innerHTML = getBHTScore(arr, arr[0], arr[23], arr[12], arr[8], arr[9]);
				}
				if (arr[12]!=arro[12]){
					var trr = GEBI("r" + arr[0]);
					trr.cells[0].innerHTML = "<font color=#0066CC>" + arr[22] + "</font>";
					trr.style.display = (arr[22]==""?"none":"");
				}
				if (goal>0 || card>0) window.setTimeout("reset(" + arr[0] + ");", 60000);
				if (goal==1 || goal==3) trf.cells[4].style.backgroundImage = "url(images/yl.gif)";
				if (goal==2 || goal==3) trf.cells[6].style.backgroundImage = "url(images/yl.gif)";
				if (aDP[arr[0]] == true){
					if ((goal>0 || card>0) && arr[15]=="1") arrPopItem[arrPopItem.length] = makePopupText(arr, goal, card);
					if (arr[12]!=arro[12] || goal>0 || card>0){
						//状态变化
						var goalInfo = "";
						goalInfo += "&nbsp;<font color=" + arr[3] +"><b>" + getLN(arr) + "</b></font>&nbsp;";
						goalInfo += "<b>" + getStatus(arr) + "</b>&nbsp;" 
						if (arr[12]!="8" && arr[12]!="9" && arr[12]!="10") goalInfo += getMT(arr) + "&nbsp;";
						if (card>0) goalInfo += "<font color=red>红牌</font>&nbsp;";
						if (goal>0) goalInfo += "<img src=images/zd.gif width=10 height=10 align=baseline width=8 height=8>&nbsp;";
						goalInfo += "<br>&nbsp;";
						goalInfo += getHT3(arr, goal, card) + "&nbsp;" + getScore(arr, goal) + "&nbsp;" + getAT3(arr, goal, card) + "<br>\n";
						tmpCount ++;
						tmp = goalInfo + tmp;
						if (!infoWin && !lockInfoWin){
							infoWin = true;
							GEBI("goaltext").style.display="";
							GEBI("InfoWinControl").checked = true;
						}
					}
				}
				if (arr[12]=="8"){
					if (arr[15]=="1"){
						GEBI("fend").insertAdjacentElement("BeforeBegin",GEBI("f" + arr[0]))
						GEBI("fend").insertAdjacentElement("BeforeBegin",GEBI("r" + arr[0]))
					}else{
						GEBI("fbend").insertAdjacentElement("BeforeBegin",GEBI("f" + arr[0]))
						GEBI("fbend").insertAdjacentElement("BeforeBegin",GEBI("r" + arr[0]))
					}
					replaceColorTask();
				}
				if (arr[12]=="9" || arr[12]=="10" || arr[12]=="16"){
					GEBI("fchanged").insertAdjacentElement("BeforeBegin",GEBI("f" + arr[0]))
					GEBI("fchanged").insertAdjacentElement("BeforeBegin",GEBI("r" + arr[0]))
					replaceColorTask();
				}
			}catch (e){
				window.status = e.description + "|refresh";
			}
			aSD[arr[0]] = arr.join("*");
		}
		if (goalTextCount+tmpCount>200){
			goalTextCount = tmpCount;
			GEBI("goaltext").innerHTML = tmp;
		}else{
			goalTextCount+= tmpCount;
			GEBI("goaltext").innerHTML = tmp + GEBI("goaltext").innerHTML;
		}
		makePopupWin(arrPopItem);
		oldxml=xLD.xml;
		sysbusy = false;
	}catch(e){
		window.status = e.description + "|refresh2";
	}
}

function getHideMatchCount(){
	try{
		var count = 0;
		var nodes = xSD.selectNodes("/_hgoal/f");
		for(var i=0; i<nodes.length; i++){
			var arr = nodes[i].text.split("*");
			if (aDP[arr[0]] == false) count ++;
		}
		return count;
	}catch(e){
		window.status = e.description + "| getHideMatchCount";
	}
}

function reset(fid){
	try{
		var arr = aSD[fid].split("*");	
		var trf = GEBI("f" + arr[0]);
		if (arr[15]=="1"){
			trf.cells[4].innerHTML = getHT(arr, 0, 0);
			trf.cells[5].innerHTML = getScore(arr, 0);
			trf.cells[6].innerHTML = getAT(arr, 0, 0, arr[0]);
		}else{
			trf.cells[4].innerHTML = "<a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + arr[0] + ".html'); return false;\" title=让分盘路><font color=#000000>" + getBHT(arr, 0, 0) + "</font></a>";
			trf.cells[5].innerHTML = getScore(arr, 0);
			trf.cells[6].innerHTML = "<a href=# onclick=\"op1('http://live.hgoal.com/panlu/f" + arr[0] + ".html'); return false;\" title=让分盘路><font color=#000000>" + getBAT(arr, 0, 0) + "</font></a>";
		}
		trf.cells[4].style.backgroundImage = "none";
		trf.cells[6].style.backgroundImage = "none";
	}catch (e){}
}

function hideScore(fid){
	try{
		aDP[fid] = false;
		var trf = GEBI("f" + fid);
		var trr = GEBI("r" + fid);
		trf.style.display = "none";
		trr.style.display = "none";
		GEBI("HideMatchCount").innerText = getHideMatchCount();
		replaceColorTask();
	}catch(e){}
}

var replaceCL_index = 1;
var replaceCL_count = 0;
var replaceColorHandler = null;

function replaceColor(){
	try{
		var si=0;
		var tab = GEBI("scoreTable");
		var start = replaceCL_index;
		var end = replaceCL_index + 50;
		for (var i=start; i<end && i<tab.rows.length; i++,i++){
			var trf = scoreTable.rows[i];
			var ttt = trf.style.display=="";
			if (ttt){
				trf.style.background = aCS[color][replaceCL_count%2];
				replaceCL_count++;
			}
		}
		replaceCL_index += 50;
		if (replaceCL_index < tab.rows.length)		{
			window.clearTimeout(replaceColorHandler);
			replaceColorHandler = window.setTimeout("replaceColor()", 1000);
		}
	}catch (e){
		window.status = e.description + "|replaceColor";
		window.clearTimeout(replaceColorHandler);
		replaceColorHandler = window.setTimeout("replaceColor()", 1000);
	}
}

function replaceColorTask(){
	replaceCL_busy = true;
	replaceCL_index = 1;
	replaceCL_count = 0;
	window.clearTimeout(replaceColorHandler);
	replaceColorHandler = window.setTimeout("replaceColor()", 100);
}

var updateMT_index = 0;
var updateMatchTimeHandler = null;

function updateMatchTime(){
	try{
		var nodes = xSD.selectNodes("/_hgoal/f");
		var start = updateMT_index;
		var end = updateMT_index + 50;
		for (var i=start; i<end && i<nodes.length; i++){
			var fid = nodes[i].text.split("*")[0];
			var arr = aSD[fid].split("*");
			if (arr[12]=="1" || arr[12]=="3" || arr[12]=="8" || arr[12]=="9" || arr[12]=="10") continue;
			if (arr[15]=="1"){
				var trf = GEBI("f" + arr[0]);
				//trf.cells[2].innerHTML = getMT(arr);
				trf.cells[3].innerHTML = getStatus(arr);
			}else{
				var trf = GEBI("f" + arr[0]);
				//trf.cells[2].innerHTML = getBMT(arr);
				trf.cells[3].innerHTML = getBStatus(arr);
			}
		}
		updateMT_index += 50;
		if (updateMT_index < nodes.length){
			window.clearTimeout(updateMatchTimeHandler);
			updateMatchTimeHandler = window.setTimeout("updateMatchTime()", 1000);
		}
	}catch (e){}
}

function updateMatchTimeTask(){
	try{
		updateMT_busy = true;
		updateMT_index = 0;
		window.clearTimeout(updateMatchTimeHandler);
		updateMatchTimeHandler = window.setTimeout("updateMatchTime()", 100);
		window.setTimeout("updateMatchTimeTask()", 30000);
	}catch (e){}
}

var oPopup = window.createPopup();
var imagewidth = 320;
var imageheight = 80;
var speed = 40;
var x = (screen.width-imagewidth-1)/2;
var y = 1;
var pop_TC = 30;
var startani_A;
var isShowPopwin = false;

function popupInfo(text){
	try{
		var oPopupBody = oPopup.document.body;
		oPopupBody.style.cursor = "hand";
		oPopupBody.innerHTML = text;
		oPopupBody.oncontextmenu = dismisspopup;
		oPopupBody.click = dismisspopup;
		pop_TC = 30;
		isShowPopwin = true;
		pop();
	}catch (e){}
}

function pop(){
	oPopup.show(x,y,imagewidth, imageheight);
	if (isShowPopwin) startani_A = setTimeout("pop()", 500);
	if (pop_TC<0) dismisspopup();
	pop_TC --;
}

function dismisspopup(){
	isShowPopwin = false;
	oPopup.hide();
	clearTimeout(startani_A);
}

function makePopupWin(arr){
	if (arr.length<1) return;
	imageheight = arr.length * 24+ 41;
	var tmp = "";
	tmp += "<table border=2 width=320 cellspacing=0 bgcolor=#FFFFFF style='border-collapse: collapse' bordercolor=#525252 cellpadding=0><tr><td><table border=0 width=100% cellpading=0 cellspacing=0><tr bgcolor=#185F9C><td align=center><font color=#FFFFFF style='font-size: 10pt'><b>[射门比分网]</b></font></td></tr></table></td></tr><tr><td bgcolor=#F7FBFF align=center>";
	tmp += "<table border=0 cellspacing=2 cellpadding=0 width=100%>"
	tmp += "<tr height=22><td bgcolor=#FFFFFF align=center>";
	tmp += arr.join("</td></tr><tr height=22><td bgcolor=#FFFFFF align=center>");
	tmp += "</td></tr></table><table border=0 cellspacing=0 celpadding=0 width=100% bgcolor=#EAF3FF><tr height=16 align=right><td><font color=#666666 style='font-family: Verdana; font-size:8pt;'><b>www.hgoal.com&nbsp;</b></font></td></tr></table></td></tr></table>";
	if (tipsWin) popupInfo(tmp);
}

function makePopupText(arr, goal, card){
	var colorStyle = arr[3];
	var leagueName = getLN(arr);
	var statusName = arr[13];
	var goalTime = getStatus(arr);
	var htName = getHT2(arr, goal, card);
	var atName = getAT2(arr, goal, card);
	var hscore = arr[6];
	var ascore = arr[7];
	if (arr[12]=="1" || arr[12]=="9" || arr[12]=="10") hscore=ascore="";
	else{
		if (hscore=="") hscore="0";
		if (ascore=="") ascore="0";
	}
	var goalSound_flash = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='1' height='1'><param name='movie' value='" + aSS[sound] + "'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
	var sound_flash2 = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='1' height='1'><param name='movie' value='sr.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
	if (sound==0) sound_flash2="";
	if (goal==1 || goal==3){
		htName = htName + "<img src=images/zd.gif width=8 height=8 align=baseline>";
		hscore = "<font color=red>" + hscore + "</font>";
		GEBI("goalsound").innerHTML = goalSound_flash;
	}
	if (goal==2 || goal==3){
		atName = "<img src=images/zd.gif width=8 height=8 align=baseline>" + atName;
		ascore = "<font color=red>" + ascore + "</font>";
		GEBI("goalsound").innerHTML = goalSound_flash;
	}
	if (card==1 || card==3) GEBI("cardsound").innerHTML = sound_flash2;
	if (card==2 || card==3) GEBI("cardsound").innerHTML = sound_flash2;
	var text = "";
	text += "<table border=0 width=310 cellpadding=0 cellspacing=0><tr align=center>";
	text += "<td bgcolor=" + colorStyle + " width=56><span style='font-size: 9pt; color:#ffffff'>" + leagueName + "</span></font></td>";
	text += "<td width=60><font style='font-size: 9pt;'><b>" + goalTime + "</b></font></td>";
	text += "<td width=194><font style='font-size: 9pt;'>" + htName + " <b>" + hscore + "-" + ascore + "</b> " + atName + "</font></td></tr></table>";
	return text;
}