var m_language = 0;
var flash_sound=Array(5);
var loaded=0, LoadTime=0,nofityTimer;
flash_sound[0] = "<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='36' height='14' id='image1'><param name='movie' value='http://live.bet007.com/bf_img/sound.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
flash_sound[1] = "<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='36' height='14' id='image1'><param name='movie' value='http://live.bet007.com/bf_img/notice.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
flash_sound[2] = "<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='36' height='14' id='image1'><param name='movie' value='http://live.bet007.com/bf_img/base.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
flash_sound[3] = "<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='36' height='14' id='image1'><param name='movie' value='http://live.bet007.com/bf_img/deep.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
var soundid=0;
var state_ch=Array(17);
state_ch[0]="推迟,推遲,Defer";
state_ch[1]="中断,中斷,Halt";
state_ch[2]="腰斩,腰斬,Halt";
state_ch[3]="<font color=green>待定</font>,<font color=green>待定</font>,<font color=green>Wait</font>";
state_ch[13]="<b>完</b>,<b>完</b>,<b>Ft</b>";
state_ch[14]=",,";
state_ch[15]="上,上,Part1";
state_ch[16]="<font color=blue>中</font>,<font color=blue>中</font>,<font color=blue>Half</font>";
state_ch[17]="下,下,Part2";
window.onload = function () {
	setreload();
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function loadodds(){
	loaded=0;
	//setMatchTime();
}
function hidematch(i){
    document.getElementById("tr1_" +  A[i][0]).style.display="none";
    document.getElementById("tr2_" +  A[i][0]).style.display="none";
	document.getElementById("other_" +  A[i][0]).style.display="none";
	document.getElementById("hiddencount").innerHTML=parseInt(document.getElementById("hiddencount").innerHTML)+1;
	var hiddenStr = "-" + A[i][0];
	savePersonalOP(hiddenStr);
}
function SelectOtherLeague(){
    var inputs=document.getElementById("checkboxleague").getElementsByTagName("input");
    var hh=0;
	for(var i=0;i<inputs.length;i++){
        if(inputs[i].checked){
           inputs[i].checked=false;
           for(var j=1;j<=matchcount;j++){
              if(A[j][2]==B[i+1][0]){
                 document.getElementById("tr1_" +  A[j][0]).style.display="none";
				 document.getElementById("tr2_" +  A[j][0]).style.display="none"
                 if(A[j][30]!="") document.getElementById("other_" +  A[j][0]).style.display="none";
			 	 hh=hh+1;
              }
           }
        } 
        else{
           inputs[i].checked=true;
           for(var j=1;j<=matchcount;j++){
              if(A[j][2]==B[i+1][0]){
                 document.getElementById("tr1_" +  A[j][0]).style.display="";
				 document.getElementById("tr2_" +  A[j][0]).style.display=""
                 if(A[j][30]!="") document.getElementById("other_" +  A[j][0]).style.display="";
              }
           }  
        }
    }
    document.getElementById("hiddencount").innerHTML=hh;
}
function ShowAllMatch(){
    var i,j,inputs;
    inputs=document.getElementById("checkboxleague").getElementsByTagName("input");
	for(var i=0; i<inputs.length;i++)
	    inputs[i].checked=true;

	inputs=document.getElementById("table_live").getElementsByTagName("tr");
	for(var i=0; i<inputs.length;i++)	
	    if(inputs[i].getAttribute("index")!=null) inputs[i].style.display="";

    for(var i=1;i<=matchcount;i++){
		document.getElementById("tr1_" +  A[i][0]).style.display="";
        document.getElementById("tr2_" +  A[i][0]).style.display="";
		if(A[i][30]!="") document.getElementById("other_" +  A[i][0]).style.display="";
	}
	document.getElementById("match1").style.display="";
	document.getElementById("match2").style.display="";
	document.getElementById("match3").style.display="";
    document.getElementById("hiddencount").innerHTML="0";
	saveCookie("personalOP", "", 10, "/");
}
function CheckLeague(i){
	var hh=parseInt(document.getElementById("hiddencount").innerHTML);
	var hiddenStr = "";
    if(document.getElementById("checkboxleague_" +  i).checked){
       for(var j=1;j<=matchcount;j++){
              if(A[j][2]==B[i][0]){
                 document.getElementById("tr1_" +  A[j][0]).style.display="";                 
                 document.getElementById("tr2_" +  A[j][0]).style.display="";
				 if(A[j][30]!="") document.getElementById("other_" +  A[j][0]).style.display="";
                 hh--;
				modifyPersonalOP(A[j][0]);
              }
       }
    }
    else{
		
       for(var j=1;j<=matchcount;j++){
              if(A[j][2]==B[i][0]){
                 document.getElementById("tr2_" +  A[j][0]).style.display="none";
                 document.getElementById("tr1_" +  A[j][0]).style.display="none";
				 document.getElementById("other_" +  A[j][0]).style.display="none";
			 	 hh++;
				 hiddenStr += "-" + A[j][0];
              }
       }
		savePersonalOP(hiddenStr);
   }
   document.getElementById("hiddencount").innerHTML=hh;
}
function MakeSclass()
{
	var st;
	var leaguehtml=new Array();
	leaguehtml.push("<table width='242' border='0' align='center' cellpadding='0' cellspacing='0' class='text-bla-12'><tr>");
	for(var i=1;i<=sclasscount;i++)
	{	
		leaguehtml.push("<td width='23' height='28'> <input onclick='CheckLeague(" + i + ")' checked type=checkbox ></td><td style='cursor:pointer' for='checkboxleague_" + i + "'>" + B[i][m_language] + "</td>");
		if(B[i][3]=="1")
    		leaguehtml.push("<td width='50' class='text-pblu-12'>历积盘</td>");
		else
		    leaguehtml.push("<td width='50' class='text-pblu-12'>&nbsp;</td>");

		if (i % 2==0) leaguehtml.push( "</tr><tr>");
    }
    leaguehtml.push("</tr></TABLE>");
	document.getElementById("myleague").innerHTML=leaguehtml.join("");
}
//'按比赛状态显示
function ShowMatchByMatchState(n){
    var i,j;
	var hh=0;
	var trs=document.getElementById("table_live").getElementsByTagName("tr");
	for(var i=1; i<trs.length;i++){	
	    if(trs[i].getAttribute("index")!=null){
	        trs[i].style.display="none";
	        trs[i+1].style.display="none";
			trs[i+2].style.display="none";
	    }
	} 

	for(var i=1;i<=matchcount;i++){
		if(n==1 && parseInt(A[i][13])>0 || n==2 && A[i][13]=="-1" || n==3 && A[i][13]=="0" || n==4 && A[i][28]=="True")
		{
			document.getElementById("tr1_" +  A[i][0]).style.display="";
			document.getElementById("tr2_" +  A[i][0]).style.display="";
			if(A[i][30]!="") document.getElementById("other_" +  A[i][0]).style.display="";			
			hh=hh+1;
		}		
	}
	document.getElementById("hiddencount").innerHTML=matchcount -hh;
}

function hiddenmatch(n){
	var id = document.getElementById("match" + n);
	var inputs=document.getElementById("match" + n).getElementsByTagName("input");
	if(id.style.display == ""){
		id.style.display="none";
		document.getElementById("hiddencount").innerHTML=parseInt(document.getElementById("hiddencount").innerHTML)+inputs.length;
	}else {
		id.style.display="";
		document.getElementById("hiddencount").innerHTML=parseInt(document.getElementById("hiddencount").innerHTML)-inputs.length;
	}
}
function LoadLiveFile()
{
    document.getElementById("allDate").src="/script/zb/bfdata.js";
    //window.setTimeout("LoadLiveFile()",3600*1000);
}
//LoadLiveFile();
function  Year_Month(){
	var  now  =  new  Date();
	var  yy  =  now.getFullYear();
	var  mm  =  now.getMonth();
	var  mmm=new  Array();
	mmm[0]="01";
	mmm[1]="02";
	mmm[2]="03";
	mmm[3]="04";
	mmm[4]="05";
	mmm[5]="06";
	mmm[6]="07";
	mmm[7]="08";
	mmm[8]="09";
	mmm[9]="10";
	mmm[10]="11";
	mmm[11]="12";
	mm=mmm[mm];
	return(mm);
}
function  thisYear(){
	var  now  =  new  Date();
	var  yy  =  now.getFullYear();
	return(yy);
}
function  Date_of_Today(){
	var  now  =  new  Date();
	if(now.getDate() < 10)
	    return("0"+now.getDate());
	else
	    return(now.getDate());
}
function  CurentTime(){
	var  now  =  new  Date();
	var  hh  =  now.getHours();
	var  mm  =  now.getMinutes();
	var  ss  =  now.getTime()  %  60000;
	ss  =  (ss  -  (ss  %  1000))  /  1000;
	if  (hh  <  10)  hh      =  '0'+hh;
	var  clock  =  hh+':';
	if  (mm  <  10)  clock  +=  '0';
	clock  +=  mm+':';
	if  (ss  <  10)  clock  +=  '0';
	clock  +=  ss;
	return(clock);
}
function  refreshCalendarClock(){
	var timestr=thisYear()+'年'+Year_Month()+'月'+Date_of_Today()+'日'+' '+CurentTime();
	document.getElementById('currenttime').innerHTML = timestr;
}
var reloadStatus=15;
var timehandler;
function setreload () {
	if('number' != typeof(reloadStatus)) reloadStatus = parseInt(getCookie("reloadStatus"));
	var html = Array();

	if(isNaN(reloadStatus) || reloadStatus == 0)  reloadStatus = 15;

	html[html.length] = "<span class=text-hui-12-b>刷新:</span>";
	html[html.length] = 15 == reloadStatus ? '<span class="text-blu-12">15秒</span>' : '<a href="#" class="link-bla-12-h" onclick="setreloadtime(15)">15秒</a>';
	html[html.length] = "   ";
	html[html.length] = 45 == reloadStatus ? '<span class="text-blu-12">45秒</span>' : '<a href="#" class="link-bla-12-h" onclick="setreloadtime(45)">45秒</a>';
	html[html.length] = "<span class='text-line-hui'> | </span>";
	html[html.length] = -1 == reloadStatus ? '<span class="text-blu-12">关闭</span>' : '<a href="#" onclick="setreloadtime(-1)" class="link-bla-12-h">关闭</a>';
	
	if (document.getElementById("button_reload")) {
	    document.getElementById("button_reload").innerHTML = html.join("");
	}

	setTime(reloadStatus);
}

function setTime(num) {
	if("undefined" != typeof(timehandler)) window.clearTimeout(timehandler);
	if(0 < num) timehandler = window.setTimeout('reloadpage()', num*1000);
}

function reloadpage() {
	window.location.reload(true);
}

function setreloadtime(num) {
	if(!isNaN(parseInt(num))) reloadStatus = parseInt(num);
	setreload();
	saveCookie("reloadStatus", reloadStatus, 10, "/");
}
function saveCookie (pName, pValue, pExpires, pPath, pDomain, pSecure) {
	var strCookie = pName + "=" + pValue;
	if (pExpires) {
		var curTime = new Date();
		curTime.setTime(curTime.getTime() + pExpires*24*60*60*1000);
		strCookie += "; expires=" + curTime.toGMTString();
	}

	strCookie += (pPath) ? "; path=" + pPath : "";
	strCookie += (pDomain) ? "; domain=" + pDomain : "";
	strCookie += (pSecure) ? "; secure" : "";

	document.cookie = strCookie;
} // end funciton saveCookie

function getCookie (pName) {
	var strCookies = document.cookie;
	var cookieName = pName + "=";  // Cookie名称
	var valueBegin, valueEnd;

	valueBegin = strCookies.indexOf(cookieName);
	if (valueBegin == -1) return null;
	valueEnd = strCookies.indexOf(";", valueBegin);
	if (valueEnd == -1) valueEnd = strCookies.length;

	return strCookies.substring(valueBegin + cookieName.length, valueEnd);
} // end function getCookie
function savePersonalOP(hiddenStr){
	var oldStr = "";
	oldStr = getCookie ("personalOP");
	var newStr = oldStr + hiddenStr;
	if(oldStr){
		var newStr = oldStr + hiddenStr;
	}else{
		var newStr = hiddenStr;
	}
	saveCookie("personalOP", newStr, 1, "/");
}
function modifyPersonalOP(tid){
	var oldStr = "";
	oldStr = getCookie ("personalOP");
	if(oldStr){
		var startIn = oldStr.indexOf(tid);
		if(startIn == -1) return null;
		var reStr = "-" + tid;
		var newStr = oldStr.replace(new RegExp(reStr, "g"), "");
		saveCookie("personalOP", newStr, 1, "/");
	}
}
function checkPersonalOP(){
	var hiddenStr = getCookie ("personalOP");
	var TIds = new Array();
	if(hiddenStr){
		TIds = hiddenStr.split("-");
		for(var i=1;i<TIds.length;i++){
			var tid = TIds[i];
			var matchindex=document.getElementById("tr1_" + tid).attributes["index"].value;
			for(var j=1;j<=sclasscount;j++){
				if(B[j][0] == A[matchindex][2]){
					document.getElementById("checkboxleague_" +  j).checked=false;
				}
			}
			document.getElementById("tr1_" +  tid).style.display="none";
			document.getElementById("tr2_" +  tid).style.display="none";
		}
		document.getElementById("hiddencount").innerHTML=TIds.length;
	}
}
function InitAjax()
{
　	var ajax=false;
　	try {
　　	ajax = new ActiveXObject("Msxml2.XMLHTTP");
　	} catch (e) {
　　	try {
　　　	ajax = new ActiveXObject("Microsoft.XMLHTTP");
　　	} catch (E) {
　　　	ajax = false;
　　	}
　	}
　	if (!ajax && typeof XMLHttpRequest!='undefined') {
　　	ajax = new XMLHttpRequest();
　	}
　	return ajax;
} 

  //显示进球窗口
var startani_C,startani_A,startani_B,pop_TC

function pop(){
  try{
	oPopup.show(x,y,imagewidth, imageheight);
	startani_A=setTimeout("pop()",100);  //显示15秒
	if(pop_TC<0){dismisspopup();};
	pop_TC=pop_TC-1;
  }catch(e){}
}
function dismisspopup()
{	clearTimeout(startani_A);
	oPopup.hide();
}
function ShowTeamOrder(){
	if(document.getElementById("TeamOrderCheck").checked){
		for(var i=1;i<=matchcount;i++){
			if(A[i][22]!="") document.getElementById("horder_" + A[i][0]).innerHTML="<font color=#444444><sup>["+ A[i][22] +"]</sup></font>";
			if(A[i][23]!="") document.getElementById("gorder_" + A[i][0]).innerHTML="<font color=#444444><sup>["+ A[i][23] +"]</sup></font>";
		}
	}
	else{
		for(var i=1;i<=matchcount;i++){
			document.getElementById("horder_" +  A[i][0]).innerHTML="";
			document.getElementById("gorder_" +  A[i][0]).innerHTML="";
		}
	}
}
function CheckSound(n){
	soundid=n;
}
function ShowCHWindow2(str,matchnum)
{
imagewidth=465;
imageheight=46+50*matchnum ;
var st

st="<table width=465 border=0 align=center cellpadding=0 cellspacing=0>"
st=st + "  <tr><td bgcolor=#4E71A6 height=2></td></tr>"
st=st + "      <tr><td background='/images/zb/tc_5.gif'> <table width='461' border='0' align='center' cellpadding='0' cellspacing='0'><tr> <td height='1'></td></tr><tr><td><table width='461' border='0' cellspacing='0' cellpadding='0'><tr><td height='22' background='/images/zb/tc_3.gif'>&nbsp;<span class='text-blu-12-b'>TOM足球比分直播</span></td><td width='20' background='/images/zb/tc_3.gif'><a href='#'><img src='/images/zb/tc_but.gif' width='13' height='13' border='0'></a></td></tr></table></td></tr><tr><td><table width='445' border='0' align='center' cellpadding='0' cellspacing='0'><tr> <td>&nbsp;</td></tr>"
st=st + str
st=st + "<tr><td bgcolor='#E9E9B9' height='1'></td></tr></table></td></tr><tr> <td height='1'></td></tr></table></td></tr><tr><td bgcolor='#4E71A6' height='2'></td></tr></table>"

st=st + "<style type='text/css'>"
st=st + ".text-blu-12-b {font-family: '宋体';font-size: 12px;font-weight: bold;color: #244EA3;}"
st=st + ".text-18-b {font-family: 'Geneva', 'Arial', 'Helvetica', 'sans-serif';font-size: 18px;color: #003EB1;font-weight: bold;}"
st=st + ".text-18-h {font-family: '黑体';font-size: 18px;color: #BF0000;font-weight: bold;}"
st=st + "</style>"
st=st + "<SCRIPT language=JavaScript src=\"http://img.news.tom.com/script/pv/sp.js\"></SCRIPT>"
st=st + "<script src=\"http://news.tom.com/v2008.js\"></script>"
oPopup = window.createPopup();
oPopupBody = oPopup.document.body;
oPopupBody.bgColor="white";

oPopupBody.innerHTML = st
x=280;
y=1;
var winLoc=document.getElementById("winLocation").options[document.getElementById("winLocation").selectedIndex].value;
switch(winLoc)
{			
    case "0":
        x=(screen.width-imagewidth)/2;
        y=1;
        break;
    case "1":
        x=(screen.width-imagewidth)/2;
        y=screen.height-imageheight-30;
        break;
    case "2":
        x=2;
        y=(screen.height-imageheight)/2;
        break;
    case "3":
        x=screen.width-imagewidth-2;
        y=(screen.height-imageheight)/2;
        break;
    case "4":
        x=1;
        y=1;
        break;
    case "5":
        x=screen.width-imagewidth-2;
        y=1;
        break;
    case "6":
        x=1;
        y=screen.height-imageheight-30;
        break;
    case "7":
        x=screen.width-imagewidth-2;
        y=screen.height-imageheight-30;
        break;
}
oPopupBody.style.cursor="pointer";
oPopup.document.body.onmouseover=new Function("clearTimeout(startani_A)");
oPopup.document.body.onmouseout=pop;    
oPopup.document.body.onclick=dismisspopup;
oPopup.document.body.oncontextmenu=dismisspopup;
pop_TC=100;
pop();
}
var zXml = {
    useActiveX: (typeof ActiveXObject != "undefined"),
    useXmlHttp: (typeof XMLHttpRequest != "undefined")
};

zXml.ARR_XMLHTTP_VERS = ["MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0"];

function zXmlHttp() {}

zXmlHttp.createRequest = function ()
{
    if (zXml.useXmlHttp)  return new XMLHttpRequest(); 

    if(zXml.useActiveX)  //IE < 7.0 = use ActiveX
    {  
        if (!zXml.XMLHTTP_VER) {
            for (var i=0; i < zXml.ARR_XMLHTTP_VERS.length; i++) {
                try {
                    new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]);
                    zXml.XMLHTTP_VER = zXml.ARR_XMLHTTP_VERS[i];
                    break;
                } catch (oError) {}
            }
        }        
        if (zXml.XMLHTTP_VER) return new ActiveXObject(zXml.XMLHTTP_VER);
    } 
    alert("对不起，您的电脑不支持 XML 插件，请安装好或升级浏览器。");
};
var oXmlHttp = zXmlHttp.createRequest();
function getxml()
{	
    oXmlHttp.open("get","/script/zb/change.xml?" + Math.floor(Math.random()*10000),true);
    oXmlHttp.onreadystatechange = refresh;	        
    oXmlHttp.send(null);
	window.setTimeout("getxml()",20000);
}
function refresh()
{
    if(oXmlHttp.readyState!=4 || (oXmlHttp.status!=200 && oXmlHttp.status!=0)) return;
    var root=oXmlHttp.responseXML.documentElement;
    if(loaded!= -1)
    {
        loaded=-1;
        return;
    }
    if(root.attributes[0].value!="0")
    {
		//window.setTimeout("LoadLiveFile()",Math.floor(20000 * Math.random()));
		return;
    }

    var D=new Array();
    var matchindex;
    var score1change, score2change, scorechange;
    var goTime;
    var hometeam,guestteam,sclassname,score1,score2;
    
    var matchNum=0;
    var winStr="";
	
    for(var i = 0;i<root.childNodes.length;i++)
    {     
	    D=root.childNodes[i].text.split("^"); //0:ID,1:state,2:score1,3:score2,4:half1,5:half2,6:card1,7:card2,8:time1,9:time2,10:explain,11:lineup	    
    	if(document.getElementById("tr1_" + D[0])==null)  continue;
    	
		matchindex=document.getElementById("tr1_" + D[0]).attributes["index"].value;		
		score1change=false;
		if(A[matchindex][14]!=D[2])
		{	
			A[matchindex][14]=D[2];
			score1change=true;
			document.getElementById("td_team1_" + D[0]).style.backgroundColor="#bbbb22";
			
		}
		score2change=false;
		if(A[matchindex][15]!=D[3])
		{	
			A[matchindex][15]=D[3];
			score2change=true;
			document.getElementById("td_team2_" + D[0]).style.backgroundColor="#bbbb22";
		}
		scorechange=score1change || score2change;
		 
		//附加说明改时变了'
		/*
		if(A[matchindex][30]!= D[10])
		{
			A[matchindex][30]= D[10];
			document.getElementById("other_" + D[0]).innerHTML=D[10];
			if(D[10]=="")
				document.getElementById("tr2_" + D[0]).style.display="none";
			else
				document.getElementById("tr2_" + D[0]).style.display="";			
		}
		*/
		//红牌变化了
		if(D[6]!=A[matchindex][18])
		{
			A[matchindex][18]=D[6];
			if(D[6]=="0")
				document.getElementById("redcard1_" + D[0]).innerHTML="";
			else
				document.getElementById("redcard1_" + D[0]).innerHTML= "<img src=/images/zb/redcard" + D[6] + ".gif border='0'> "; 			
			if(document.getElementById("RedCheck").checked) document.getElementById("td_team1_" + D[0]).style.backgroundColor="#ff8888";	
			window.setTimeout("timecolors(" + D[0] +","+ matchindex + ")",12000);
		}
		if(D[7]!=A[matchindex][19])
		{
			A[matchindex][19]=D[7];
			if(D[7]=="0")
				document.getElementById("redcard2_" + D[0]).innerHTML="";
			else
				document.getElementById("redcard2_" + D[0]).innerHTML= "<img src=/images/zb/redcard" + D[7] + ".gif border='0'> "; 			
			if(document.getElementById("RedCheck").checked) document.getElementById("td_team2_" + D[0]).style.backgroundColor="#ff8888";	
			window.setTimeout("timecolors(" + D[0] +","+ matchindex + ")",12000);
		}		
		//开赛
		if(A[matchindex][11]!=D[8]) document.getElementById("mt_" + D[0]).innerHTML=D[8];
		A[matchindex][11]=D[8];
		A[matchindex][12]=D[9];

		//半场比分
		A[matchindex][16]=D[4];
		A[matchindex][17]=D[5];

		//状态
		if(A[matchindex][13]!= D[1])
		{
			A[matchindex][13]=D[1];
			switch(A[matchindex][13])
			{
			case "0":
					document.getElementById("time_" + D[0]).innerHTML="";
					break;
			case "1":
				    var t = A[matchindex][12].split(",");
			        var t2 = new Date(t[0],t[1],t[2],t[3],t[4],t[5]);
			        goTime = Math.floor((new Date()-t2-difftime)/60000);
					if(goTime>45) goTime = "45+"
					if(goTime<1) goTime = "1";
					document.getElementById("time_" + D[0]).innerHTML = goTime + "<img src='/images/zb/in.gif'>";
					break;
			case "2":
					document.getElementById("time_" + D[0]).innerHTML=state_ch[parseInt(D[1])+14].split(",")[m_language];
					break;
			case "3":
				    var t = A[matchindex][12].split(",");
        			var t2 = new Date(t[0],t[1],t[2],t[3],t[4],t[5]);
		        	goTime = Math.floor((new Date()-t2-difftime)/60000)+46;
					if(goTime>90) goTime = "90+";
					if(goTime<46) goTime = "46";
					document.getElementById("time_" + D[0]).innerHTML = goTime + "<img src='/images/zb/in.gif'>";
					break;
			case "-1":
					document.getElementById("time_" + D[0]).innerHTML=state_ch[parseInt(D[1])+14].split(",")[m_language];
					document.getElementById("score_" + D[0]).style.color = "red";
					window.setTimeout("MoveToBottom(" + D[0] + ")",25000);
					break;
			default:
					document.getElementById("time_" + D[0]).innerHTML=state_ch[parseInt(D[1])+14].split(",")[m_language];
					MoveToBottom(D[0]);
					break;			
   			}
		}
		
		//score
		switch(A[matchindex][13])
		{
			case "0":
				if(D[11]=="1")
				    document.getElementById("score_" + D[0]).innerHTML="阵容"; 
				else
				    document.getElementById("score_" + D[0]).innerHTML="-";
				break;
			case "1":			
				document.getElementById("score_" + D[0]).innerHTML=A[matchindex][14] + "-" + A[matchindex][15];
				break;
			case "-11":
			case "-14":
				document.getElementById("score_" + D[0]).innerHTML="-";
				document.getElementById("half_" + D[0]).innerHTML="-";
				break;
			default:  //2 3 -1 -12 -13			
				document.getElementById("score_" + D[0]).innerHTML=A[matchindex][14] + "-" + A[matchindex][15];
				document.getElementById("half_" + D[0]).innerHTML=A[matchindex][16] + "-" + A[matchindex][17];
				document.getElementById("half_" + D[0]).style.color="red";
				break;
		}
		
		if(scorechange)
		{
			ShowFlash(D[0],matchindex);
			if(document.getElementById("tr1_" + D[0]).style.display!="none")
			{	
				hometeam=A[matchindex][5+m_language].replace("<font color=#880000>(中)</font>"," 中").substring(0,7);
				guestteam=A[matchindex][8+m_language].substring(0,7);
				sclassname=A[matchindex][2+m_language];
				if(score1change){				
				    hometeam="<font color=red>" + hometeam +"</font>";
				    score1="<font color=red>" + D[2] +"</font>";
				    score2="<font color=blue>" + D[3] +"</font>";		    
				}
				if(score2change){
				    guestteam="<font color=red>" + guestteam + "<font>";
				    score1="<font color=blue>" + D[2]+"</font>";
				    score2="<font color=red>" + D[3] +"</font>";
				}
				window.clearTimeout(nofityTimer);
				if(document.getElementById("notify").innerHTML="") document.getElementById("notify").innerHTML="<font color=#6666FF><B>入球提示：</b></font>";
				document.getElementById("notify").innerHTML+= sclassname +":"+ hometeam + " <font color=blue>" + score1 +"-" + score2 + "</font> " +guestteam +" &nbsp; ";
				nofityTimer=window.setTimeout("clearNotify()",20000);
				
				if(document.getElementById("windowCheck").checked && parseInt(D[1])>=-1){
				    if(matchNum % 2==0)
					    winStr+= "<tr><td height=25>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + document.getElementById("time_" + D[0]).innerHTML + " <span class=text-18-b>"+ hometeam +"</span><span class=text-18-b> " + score1 + " :</span> <span class=text-18-h>" + score2 + "</span> <span class=text-18-h>" + guestteam +"</span>&nbsp;&nbsp;&nbsp;&nbsp;" + A[matchindex][2] + "</td></tr><tr><td bgcolor='#E9E9B9' height='1'></td></tr><tr><td height='20' class=\"tc-6\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='/images/zb/tc_6.gif'></td></tr>";
					else
					    winStr+= "<tr><td height=25>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + document.getElementById("time_" + D[0]).innerHTML + " <span class=text-18-b>"+ hometeam +"</span><span class=text-18-b> " + score1 + " :</span> <span class=text-18-h>" + score2 + "</span> <span class=text-18-h>" + guestteam +"</span>&nbsp;&nbsp;&nbsp;&nbsp;" + A[matchindex][2] + "</td></tr><tr><td bgcolor='#E9E9B9' height='1'></td></tr><tr><td height='20' class=\"tc-6\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='/images/zb/tc_6.gif'></td></tr>";
					matchNum=matchNum+1
				}
			}
		}//scorechange
    }
	
    if(matchNum>0) ShowCHWindow2(winStr,matchNum);
}
function ShowFlash(id,n){
    try{
		
	    if(document.getElementById("soundCheck").checked && parseInt(A[n][13])>=-1){
		    if(document.getElementById("tr1_" + id).style.display!="none"){
		       document.getElementById("half_" + id).innerHTML=flash_sound[soundid] ;
		    }
	    }
	}
	catch(e){};
    window.setTimeout("timecolors(" + id +","+ n + ")",12000);
}
function timecolors(matchid,n){
	try{
        if(A[n][13]=="0") document.getElementById("score_" + matchid).innerHTML="-";
        document.getElementById("td_team1_" + matchid).style.backgroundColor="";
        document.getElementById("td_team2_" + matchid).style.backgroundColor="";
        if(A[n][13]=="2" ||A[n][13]=="3" ||A[n][13]=="-1")
           document.getElementById("half_" + matchid).innerHTML=A[n][16] +  "-" +  A[n][17];
	    else
	       document.getElementById("half_" +  matchid).innerHTML="";
    }
    catch(e){}
}
function clearNotify(){
   document.getElementById("notify").innerHTML="";
}
//更新比赛进行的时间
function setMatchTime(){
	for(var i=1;i<=matchcount;i++){
	    if(A[i][13]=="1"){  //上半场
			//alert( A[i][0]);
	        var t = A[i][12].split(",");
			var t2 = new Date(t[0],t[1],t[2],t[3],t[4],t[5]);
			goTime = Math.floor((new Date()-t2-difftime)/60000);
			if(goTime>45) goTime = "45+";
			if(goTime<1)  goTime = "1";
			document.getElementById("time_" +  A[i][0]).innerHTML = goTime +  "<img src='/images/zb/in.gif' border=0>";
		}
		if(A[i][13]=="3"){  //下半场
			//alert( A[i][0]);
	        var t = A[i][12].split(",");
			var t2 = new Date(t[0],t[1],t[2],t[3],t[4],t[5]);
			goTime = Math.floor((new Date()-t2-difftime)/60000)+46;
			if(goTime>90) goTime = "90+";
			if(goTime<46) goTime = "46";
			document.getElementById("time_" +  A[i][0]).innerHTML = goTime +  "<img src='/images/zb/in.gif' border=0>";
		}
	}
	window.setTimeout("setMatchTime()" , 3000);
}