﻿var zArray=new Array();
var LeagueAry=new Array();

function gb2utf8(data){ //gb2312转换为utf-8
    var glbEncode = []; 
    gb2utf8_data = data; 
    execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "VBScript"); 
    var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2"); 
    t=t.split("@"); 
    var i=0,j=t.length,k; 
    while(++i<j) { 
        k=t[i].substring(0,4); 
        if(!glbEncode[k]) { 
            gb2utf8_char = eval("0x"+k); 
            execScript("gb2utf8_char = Chr(gb2utf8_char)", "VBScript"); 
            glbEncode[k]=escape(gb2utf8_char).substring(1,6); 
        } 
        t[i]=glbEncode[k]+t[i].substring(4); 
    } 
    gb2utf8_data = gb2utf8_char = null; 
    return unescape(t.join("%")); 
}


function zLiveBuildObj(){

var XmlHttp = null;
var XmlTimeHttp = null;
var XmlLiveHttp = null;
var DataObject = document.getElementById("LiveDataShow");
var LoadingBar = document.getElementById("LoadStatus");
var LoadingMax = 500;
var LoadingWidth = null;
var LoadingTimer = 10;
var LoadingTimerID = null;
var FinishTimer = 50;
var FinishTimerID = null;
var ShowTimeTimerID = null;
var UpTimes = 2000;
var ShowLiveTimerID = null;
var ShowPopTimerID = null
var LiveDocOld = "";
var HttpState = 0;
var CanFree = false;
var LCounts = 0;
var isIE = true;
var IeVersion = "";
var PageLoaded = 0;
var RemberTime =(new Date()).getTime()/1000;
var ico_live = "<img src='../images/live.gif' border=0 width=8 height=8>&nbsp;";
var ico_goal="<img src='../images/goal.gif' border=0 width=13>";
var DiShowPlaySound = getCookie("DiShowPlaySound");
var DiShowWindow = getCookie("DiShowWindow");
var DiShowPopTxt = getCookie("DiShowPopTxt");
if(""!=DiShowPlaySound){document.getElementsByName("showgoal_s")[0].checked=false;}
if(""!=DiShowWindow){document.getElementsByName("showgoal_f")[0].checked=false;}
if(""!=DiShowPopTxt){document.getElementsByName("showscroller")[0].checked=false;}

this.Create = function(free){
	try{
		if(free){CanFree = true};
		if(window.ActiveXObject){
			var bActivexFound=false;
			var msxmls = new Array('Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP');
			for(var i=0;i<msxmls.length && !bActivexFound;i++)
			{
				try{ XmlHttp=new ActiveXObject(msxmls[i]); XmlTimeHttp=new ActiveXObject(msxmls[i]); XmlLiveHttp=new ActiveXObject(msxmls[i]); bActivexFound=true; }catch (e1){}
			}
			IeVersion=Number(navigator.appVersion.split(";")[1].replace("MSIE ",""));
		}else{
			XmlHttp=new XMLHttpRequest(); XmlTimeHttp=new XMLHttpRequest(); XmlLiveHttp=new XMLHttpRequest(); isIE=false;
		}
		return true;
	}catch(e2){return false;}
}

this.SynSend = function(){
	try{
		XmlTimeHttp.open("GET", "/js/time.xml?"+Date.parse(new Date()), true);    
		XmlTimeHttp.onreadystatechange = this.TimeStateChange; 
		XmlTimeHttp.send(null);
	}catch(e){}
}

this.LiveSend = function(){
	try{
		XmlLiveHttp.open("GET", "/js/live_2004.xml?"+Date.parse(new Date()), true);    
		XmlLiveHttp.onreadystatechange = utilityOBJ.LiveStateChange; 
		XmlLiveHttp.send(null);
	}catch(e){}
	if(ShowLiveTimerID){clearInterval(ShowLiveTimerID);}
	ShowLiveTimerID=setInterval(utilityOBJ.LiveSend,UpTimes);
}

this.LiveStateChange = function(){
	try{
		if(XmlLiveHttp.readyState!=4 || (XmlLiveHttp.status!=200 && XmlLiveHttp.status!=0)){return;}
		var d=new Date();
		var newDoc=XmlLiveHttp.responseText;
		if(newDoc!=""){RemberTime=d.getTime()/1000;}
		if(LiveDocOld==newDoc || newDoc==""){return;}
		var finNm=0;
		var LNmi=0;
		var popAry=new Array();
		var popWin=0;
		while(finNm!=-1)
		{
			finNm=newDoc.indexOf("<G>",finNm);
			if(finNm==-1){break;}
			var fs1=finNm+3;
			var fs2=newDoc.indexOf("</G>",fs1);
			var rs=newDoc.substring(fs1,fs2).split("#");
			if(LNmi==0)
			{
				if(UpTimes!=rs[2]){UpTimes=rs[2];}
				if(LCounts!=rs[0]){LCounts=rs[0];window.setTimeout("utilityOBJ.Send()",2000);return;}
			}else{
				if(zArray["z"+k] == "undefined"){continue;}
				
				var k=rs[0];
				var isCheck=document.getElementById("select_"+k).checked;
				if(zArray["z"+k].stim!=rs[4])
				{
					if(isCheck){utilityOBJ.ShowTheMessage("<b>"+SssAry[rs[4]]+"</b>&nbsp;"+zArray["z"+k].ss+" "+zArray["z"+k].tama+"&nbsp;"+rs[2]+"&nbsp;"+zArray["z"+k].tamb+"<br>");}
					if(rs[4] == 0 || rs[4] == 3){document.getElementById("time_"+k).innerHTML=FixedTime(rs[1]);}
					if(rs[4] == 1){document.getElementById("time_"+k).innerHTML=ico_live+"<font color=#CC0000>&nbsp;1'</font>";}
					if(rs[4] == 2){document.getElementById("time_"+k).innerHTML=ico_live+"<font color=#CC0000>46'</font>";}
					if(rs[4] == 4 || rs[4] == 5 || rs[4] == 8)
					{
						document.getElementById("time_"+k).innerHTML = FixedTime(rs[1]);
						var ThisItem=document.getElementById("ss_"+k).parentNode;
						//ThisItem.cells[1].className="tda2";
						//ThisItem.cells[2].className="tda2";
						//ThisItem.cells[3].className="tdb2";
						//ThisItem.cells[4].className="tda2";
						ThisItem.cells[4].style.color="#EE0000";
						ThisItem.cells[4].style.fontSize="8pt";
						//ThisItem.cells[5].className="tdb2";
						//ThisItem.cells[6].className="tda2";
						//ThisItem.cells[7].className="tdb2";
						//ThisItem.cells[8].className="tda2";
						var TmpItem = document.getElementById("tr_over");
						TmpItem.parentNode.insertBefore(document.getElementById("stime_" + k).parentNode,TmpItem);
						if(document.getElementById("tdmID_"+k) != null){TmpItem.parentNode.insertBefore(document.getElementById("tdmID_"+k).parentNode,TmpItem);}
					}
					if(rs[4] == 6 || rs[4] == 7){document.getElementById("time_"+k).innerHTML=ico_live;}
					document.getElementById("stime_"+k).innerHTML = SssAry[rs[4]];
					document.getElementById("score_"+k).innerHTML = rs[2];
					document.getElementById("half_"+k).innerHTML=rs[3];
					zArray["z"+k].stim=rs[4];
					zArray["z"+k].scoe=rs[2];
					zArray["z"+k].half=rs[3];
					continue;
				}

				if(zArray["z"+k].scoe != rs[2])
				{
					var OScore=zArray["z"+k].scoe.split("-");
					var NScore=rs[2].split("-");
					zArray["z"+k].scoe=rs[2];

					var tmpAtm=zArray["z"+k].tama;
					var tmpBtm=zArray["z"+k].tamb;

					if(NScore[0] != OScore[0])
					{
						NScore[0]="<font color=red>"+NScore[0]+"</font>";
						tmpAtm="<font color=red>"+tmpAtm+"</font>";
						document.getElementById("TeamA_"+k).className="tdgo";
					}
					if(NScore[1] != OScore[1])
					{
						NScore[1]="<font color=red>"+NScore[1]+"</font>";
						tmpBtm="<font color=red>"+tmpBtm+"</font>";
						document.getElementById("TeamB_"+k).className="tdgo";
					}
	
					var tmpScore = NScore[0]+"-"+NScore[1];
					document.getElementById("score_"+k).innerHTML=tmpScore;
					zArray["z"+k].updatetime=d.getTime()/1000;
					window.setTimeout("utilityOBJ.ClearSytle("+k+")",60000);
					if(isCheck)
					{
						utilityOBJ.ShowTheMessage(ico_goal+"&nbsp;"+zArray["z"+k].ss+"&nbsp;"+tmpAtm+"&nbsp;"+tmpScore+"&nbsp;"+tmpBtm+"<br>");
						if(document.getElementsByName("showgoal_s")[0].checked){document.getElementById("PlaySound").innerHTML=sound_B;}
						if(document.getElementsByName("showgoal_f")[0].checked && IeVersion > 5 && isIE==true)
						{
							popAry[popWin] = "<tr height=18><td align=center colspan=3>"+
							"				"+ico_goal+"&nbsp;&nbsp;"+zArray["z"+k].ss+"&nbsp;&nbsp;"+document.getElementById("time_"+k).innerHTML+
							"			</td></tr><tr height=20>"+
							"				<td align=right width='40%' noWrap>"+tmpAtm+"&nbsp;&nbsp;"+
							"				<td align=center width='20%' noWrap><b style='font-family:Verdana;'>"+tmpScore+
							"				<td width='40%' noWrap>&nbsp;&nbsp;"+tmpBtm+
							"			</tr>";
							popWin++;
						}
					}
				}

				if(zArray["z"+k].half != rs[3]){zArray["z"+k].half=rs[3];document.getElementById("half_"+k).innerHTML=rs[3];}
	
				if(zArray["z"+k].time != rs[1]){zArray["z"+k].time=rs[1];document.getElementById("time_"+k).innerHTML=FixedTime(rs[1]);}

				if(zArray["z"+k].reda != rs[5])
				{	
					zArray["z"+k].reda=rs[5];
					document.getElementById("TeamA_"+k).innerHTML = "<span class=tred>"+rs[5]+"</span>&nbsp;"+zArray["z"+k].tama;
					if(isCheck){utilityOBJ.ShowTheMessage("<img src='../images/redcard.gif' border=0 width=13>&nbsp;"+zArray["z"+k].ss+"&nbsp;<font color=#CC6600>"+zArray["z"+k].tama+"</font>&nbsp;"+rs[2]+"&nbsp;"+zArray["z"+k].tamb+"<br>");}
				}
				if(zArray["z"+k].redb != rs[6])
				{	
					zArray["z"+k].redb=rs[6];
					document.getElementById("TeamB_"+k).innerHTML = zArray["z"+k].tamb+"&nbsp;<span class=tred>"+rs[6]+"</span>";
					if(isCheck){utilityOBJ.ShowTheMessage("<img src='../images/redcard.gif' border=0 width=13>&nbsp;"+zArray["z"+k].ss+"&nbsp;"+zArray["z"+k].tama+"&nbsp;"+rs[2]+"&nbsp;<font color=#CC6600>"+zArray["z"+k].tamb+"</font><br>");}
				}

				if(zArray["z"+k].mess!=rs[7] && LANG!="2")
				{
					zArray["z"+k].mess=rs[7];
					if(rs[7]!="")
					{
						var reString=rs[7].replace(/\\/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">");
						if(document.getElementById("tdmID_"+k) != null)
						{
							document.getElementById("tdmID_"+k).innerHTML=reString;
						}else{
							var tmpTR=document.createElement("tr");if(!document.getElementById("select_"+k).checked){tmpTR.style.display = "none";}
							var tmpTD=document.createElement("td");tmpTD.colSpan = 9;tmpTD.className="tdms";tmpTD.id="tdmID_"+k;tmpTD.innerHTML=reString;
							tmpTR.appendChild(tmpTD);
							var TmpNode=document.getElementById("score_"+k).parentNode;
							TmpNode.parentNode.insertBefore(tmpTR,TmpNode.nextSibling);
						}
					}else{
						if(document.getElementById("tdmID_"+k) != null){var TmpNode = document.getElementById("tdmID_"+k).parentNode; TmpNode.parentNode.removeChild(TmpNode);}
					} 
				}
			}

			finNm=fs2;
			LNmi++

			if(popWin > 0 && isIE==true)
			{
				var TmpShowTxt="<table bordercolor=black border=1 cellspacing=0 cellpadding=0 style='font-size:9pt;border-collapse:collapse' width='100%'><tr><td><table bgcolor=#FFFFFF bordercolor=#FFFFFF border=1 cellspacing=0 cellpadding=2 style='font-size:9pt;border-collapse:collapse' width='100%'><tr><td align=center style='background-color:#51AD64;color:white;font-family:Arial;font-Weight:bold'>进球提示</td></tr><tr><td align=center  style='font-family:Verdana;' bgcolor=#FAF0BB><table  width='100%' border=0 cellpadding=0 cellspacing=0  bgcolor=#FAF0BB style='font-size:9pt;border-collapse:collapse'>"+popAry.join("")+"</table></td></tr><td align=center style='background-color:#66CCCC;color:yellow;'>足球比分网 zq180.com</td></tr></table></td></tr></table>";
			
				utilityOBJ.ShowTheWindows(TmpShowTxt,popWin);
			}
		}
		LiveDocOld=newDoc;
	}catch(e){}
}

this.ClearSytle = function(k){
	var d=new Date();
	var GoOutTime = d.getTime()/1000 - zArray["z"+k].updatetime;
	if(GoOutTime > 29.8)
	{
		document.getElementById("score_"+k).innerHTML = zArray["z"+k].scoe;
		document.getElementById("TeamA_"+k).className = "tdb1";
		document.getElementById("TeamB_"+k).className = "tdb1";
	}
}

this.ShowTheMessage = function(Message){
	var Item = document.getElementById("zqzz_showgoaltext");
	if(Item.parentNode.style.display=="none" && document.getElementsByName("showscroller")[0].checked){Item.parentNode.style.display="";}
	var tmpMM=document.createElement("DIV");
	tmpMM.className="tdb1";
	tmpMM.innerHTML=Message
	Item.insertBefore(tmpMM,Item.firstChild)
	if(Item.getElementsByTagName("DIV").length>50){Item.removeChild(Item.getElementsByTagName("DIV")[Item.getElementsByTagName("DIV").length-1])}
}


this.ShowTheWindows = function(poptext,popWin){

	this.dismisspopup = function(){oPopup.hide();clearInterval(ShowPopTimerID);}

	this.pop=function(){
		oPopup.show(x,y,imagewidth,imageheight);
		if(ShowPopTimerID){clearInterval(ShowPopTimerID);}
		ShowPopTimerID=setInterval(this.dismisspopup,10000);
	}

	var thisHeight = popWin*36
	var imagewidth = 258;
	var imageheight = 49+thisHeight;
	var x = screen.width/2-imagewidth-1;
	var y = 1;
	var oPopup = window.createPopup();
	var oPopupBody = oPopup.document.body;
	oPopupBody.style.cursor = "hand";
	oPopupBody.innerHTML = poptext;
	oPopup.document.body.onmouseover = new Function("clearInterval(ShowPopTimerID)");
	oPopup.document.body.onclick = this.dismisspopup;
	oPopup.document.body.oncontextmenu = this.dismisspopup;
	this.pop();
}

this.TimeStateChange = function(){
	try{
		if(XmlTimeHttp.readyState!=4 || (XmlTimeHttp.status!=200 && XmlTimeHttp.status!=0)){return false;}
		var tmpTxt=XmlTimeHttp.responseText;
		var root = tmpTxt.substring(tmpTxt.indexOf("<i>")+3,tmpTxt.indexOf("</i>"));
		var rs = root.split(",");
		var serverTime = new Date(rs[0],rs[1],rs[2],rs[3],rs[4],rs[5]);
		var clientTime = new Date();
		diffTime = Math.round((serverTime-clientTime)/1000/60);
		XmlTimeHttp=null;
		utilityOBJ.Show_NowTimes();
	}catch(e){}
}

this.ShowDoingTime = function(){
	try{
		var d = new Date();
		for(key in zArray)
		{
			var id=zArray[key].lsid;
			var tmpStr="";
			if(zArray[key].stim == 6 || zArray[key].stim == 7 || zArray[key].stim == 9 || zArray[key].stim == 10 || zArray[key].stim == 11 || zArray[key].stim == 12){document.getElementById("time_"+id).innerHTML = ico_live;continue;}

			if(zArray[key].stim==1)
			{
				var sUTAry = zArray[key].time.split(",");
				var sMTime = new Date(sUTAry[0],sUTAry[1]-1,sUTAry[2],sUTAry[3],sUTAry[4],0);
				var sUTime = Math.round((d-sMTime)/1000/60+diffTime)-sUTAry[5];
				if(sUTime < 1){tmpStr = ico_live+"<font color=#CC0000>&nbsp;1'</font>";}
				if(sUTime > 45){tmpStr = ico_live+"<font color=#CC0000>45'</font>";}
				if(sUTime > 0 && sUTime < 46){ if(sUTime < 10){sUTime = "&nbsp;"+sUTime;} tmpStr = ico_live+"<font color=#CC0000>"+sUTime+"'</font>";} 
				document.getElementById("time_"+id).innerHTML = tmpStr; continue;
			}
			if(zArray[key].stim==2)
			{
				var sUTAry = zArray[key].time.split(",");
				var sMTime = new Date(sUTAry[0],sUTAry[1]-1,sUTAry[2],sUTAry[3],sUTAry[4],0);
				var sUTime = Math.round((d-sMTime)/1000/60+diffTime)-15-sUTAry[5];
				if(sUTime < 46){tmpStr = ico_live+"<font color=#CC0000>46'</font>";}
				if(sUTime > 90){tmpStr = ico_live+"<font color=#CC0000>90'</font>";}
				if(sUTime > 45 && sUTime < 91){ if(sUTime < 10){sUTime = "&nbsp;"+sUTime;} tmpStr = ico_live+"<font color=#CC0000>"+sUTime+"'</font>";} 
				document.getElementById("time_"+id).innerHTML = tmpStr; continue;
			}
		}
	}catch(e){}
}

this.Show_NowTimes = function(){
	try{
		if((new Date()).getTime()/1000-RemberTime > 120){
			if(confirm("由于程序忙，或其他网络问题，你已经和服务器断开连接超过 3 分钟，是否要重新连接观看比分？")){
				location.reload();
			}
		}
		var d = new Date(new Date()*1+diffTime*1000*60);
		var YY = d.getFullYear();
		var MM = ((d.getMonth()+1) < 10)? "0"+(d.getMonth()+1):(d.getMonth()+1);
		var DD = (d.getDate() <10)? "0"+d.getDate():d.getDate();
		var ss = (d.getHours() <10)? "0"+d.getHours():d.getHours();
		var mm = (d.getMinutes() < 10)? "0"+d.getMinutes():d.getMinutes();
		document.getElementById("now_times").innerHTML = "[GMT+8]&nbsp;"+YY+"-"+MM+"-"+DD+" ("+ss+":"+mm+")";
		if(ShowTimeTimerID){clearInterval(ShowTimeTimerID);}
		ShowTimeTimerID=setInterval(utilityOBJ.Show_NowTimes,60000);
		if(PageLoaded==1){utilityOBJ.ShowDoingTime();}
	}catch(e){}
}

this.Send = function(){
	try{
		if(PageLoaded==0){this.SynSend();}
		if(LoadingBar){
			LoadingMax = LoadingBar.offsetWidth;
			LoadingWidth = LoadingBar.style.width;
			LoadingBar.style.width = "0px";
			LoadingBar.innerHTML = "0%";
			LoadingBar.parentNode.parentNode.parentNode.parentNode.style.display = "";
			DataObject.style.display = "";
			HttpState = 0;
			if(LoadingTimerID){clearInterval(LoadingTimerID);}
			LoadingTimerID=setInterval(this.StatusBar, LoadingTimer);
		}
		XmlHttp.open("GET", "/js/liveTname.js?"+Date.parse(new Date()), true);    
		XmlHttp.onreadystatechange = this.StateChange; 
		XmlHttp.send(null);
		return true;
	}catch(e){return false;}
}



this.StateChange = function(){
	try{
		if(XmlHttp.readyState){HttpState=XmlHttp.readyState;}
		if(XmlHttp.readyState == 4){
			if(LoadingTimerID)clearInterval(LoadingTimerID);
			if(LoadingBar){
				LoadingBar.style.width = LoadingWidth;
				LoadingBar.innerHTML = "100%";
				if(FinishTimerID){clearInterval(FinishTimerID);}
				FinishTimerID=setInterval(this.Finish, FinishTimer);
			}else{
				//DataObject.innerHTML = XmlHttp.responseText;
				if(CanFree){this.Destroy();}
			}
		}
  
		this.Finish = function(){
			if(FinishTimerID){clearInterval(FinishTimerID);}
			LoadingBar.parentNode.parentNode.parentNode.parentNode.style.display = "none";
			DataObject.style.display = "";
			var fs1=XmlHttp.responseText.indexOf("TodayData=")+11;
			var fs2=XmlHttp.responseText.indexOf("\";",fs1);
			utilityOBJ.zPutDataNow(XmlHttp.responseText.substring(fs1,fs2).replace(/\^\^/g,""));
			if(CanFree){this.Destroy();}
		}

		this.Destroy = function(){
			if(LoadingTimerID){clearInterval(LoadingTimerID);}
			if(FinishTimerID){clearInterval(FinishTimerID);}
			//XmlHttp=null;
		}
   
	}catch(e){} 
}

this.StatusBar = function(){
	try{
		if(LoadingBar.offsetWidth >= LoadingMax){
			LoadingBar.innerHTML = "100%";
			LoadingBar.style.width = LoadingWidth;
			return;
		}

		if(LoadingBar.offsetWidth < (HttpState + 1) * Math.floor(LoadingMax / 4)){
			var loading = LoadingBar.offsetWidth + Math.floor(LoadingMax / 40);
			LoadingBar.style.width = loading + "px";
			var percen = Math.floor(loading / LoadingMax * 100);
			LoadingBar.innerHTML = (percen>100?100:percen) + "%";
		}else{
			LoadingBar.style.width = (HttpState + 1) * Math.floor(LoadingMax / 4) + "px";
			LoadingBar.innerHTML = Math.floor(100 / (4 - HttpState)) + "%";
		}
	}catch(e){}
}

this.zPutDataNow = function(zText){
try{
	zArray=new Array();
	LeagueAry=new Array();
	document.getElementById("LeagueDataShow").innerHTML="";
	DataObject.innerHTML="";
	var zMe=["賽事","時間","球隊","比分","半場","選"];
	if(LANG==1){zMe=["赛事","时间","球队","比分","半场","选"];}
	if(LANG==2){zMe=["MATCH","TIME","TEAM","SCORE","HALF","SEL"];}
	var tmp_table=document.createElement("table");
	tmp_table.id="Tableone";
	tmp_table.width=555;
	tmp_table.className="zMainTab";
	DataObject.appendChild(tmp_table);

	var tmp_tbody=document.createElement("tbody");
	tmp_table.appendChild(tmp_tbody);

	var tmp_tr=document.createElement("tr");
	tmp_tr.bgColor="#BD1C00";	
	tmp_tr.style.color="#FAF0BB";	
	var tmp_td=document.createElement("td");
	tmp_td.width="12%";
	tmp_td.innerHTML=zMe[0];
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="8%";
	tmp_td.innerHTML=zMe[1];
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	
	tmp_td.width="4%";
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="23%";
	tmp_td.innerHTML=zMe[2];
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="8%";
	tmp_td.innerHTML=zMe[3];
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="23%";
	tmp_td.innerHTML=zMe[2];
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="7%";
	tmp_td.innerHTML=zMe[4];
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="5%";
	tmp_td.innerHTML="&nbsp;";
	tmp_tr.appendChild(tmp_td);
	tmp_td=document.createElement("td");
	tmp_td.width="4%";	
	tmp_td.innerHTML=zMe[5];
	tmp_tr.appendChild(tmp_td);	
	tmp_tbody.appendChild(tmp_tr);
	var tmp_tra=document.createElement("tr");
	tmp_tra.id="tr_live";
	tmp_tra.style.display="none";
	tmp_tbody.appendChild(tmp_tra);
	tmp_tr=document.createElement("tr");	
	tmp_td=document.createElement("td");
	tmp_td.innerHTML="&nbsp;完場賽事";
	if(LANG==1){tmp_td.innerHTML="&nbsp;完场赛事";}
	if(LANG==2){tmp_td.innerHTML="&nbsp;Results";}
	tmp_td.className="tdr";
	tmp_td.colSpan=9;
	tmp_tr.appendChild(tmp_td);
	tmp_tbody.appendChild(tmp_tr);
	var tmp_trb=document.createElement("tr");
	tmp_trb.id="tr_over";
	tmp_trb.style.display="none";
	tmp_tbody.appendChild(tmp_trb);

	var zAry=zText.split("@")
	var d = new Date();
	for(var i=1;i<zAry.length;i++)
	{		
		var rs=zAry[i].split("|");
		if(ShowMatch_Type=="1" && rs[18] == ""){continue;}
		zArray["z"+rs[1]]=new this.Live_Class(rs);

		var isDropTr="";
		var isDropSel=true
		if(DropIdAry.indexOf(rs[1]) != -1 && PageLoaded==0){isDropTr="none";isDropSel=false;document.getElementById("MatchHideNum").firstChild.nodeValue=Number(document.getElementById("MatchHideNum").firstChild.nodeValue)+1;}

		tmp_tr=document.createElement("tr");
		tmp_tr.style.display=isDropTr;
		tmp_tr.id="trID_"+rs[1];
		tmp_td=document.createElement("td");
		tmp_td.id="ss_"+rs[1];
		tmp_td.style.color="#ffffff";		
		tmp_td.bgColor=rs[2];
		tmp_td.innerHTML=zArray["z"+rs[1]].ss;
		tmp_tr.appendChild(tmp_td);
		
		if(LeagueAry.toString().indexOf(zArray["z"+rs[1]].ss+"^")==-1){LeagueAry[LeagueAry.length]=[rs[16],zArray["z"+rs[1]].ss+"^"];}

		var trCls=(rs[13] != 4 && rs[13] != 5 && rs[13] != 8)?"1":"2";
		var insetObj=(rs[13] != 4 && rs[13] != 5 && rs[13] != 8)?tmp_tra:tmp_trb;

		var timing=FixedTime(rs[14]);
		if(rs[13]==1)
		{
			var sUTAry = rs[14].split(",");
			var sMTime = new Date(sUTAry[0],sUTAry[1]-1,sUTAry[2],sUTAry[3],sUTAry[4],0);
			var sUTime = Math.round((d-sMTime)/1000/60+diffTime)-sUTAry[5];
			if(sUTime < 1){timing = ico_live+"<font color=#CC0000>&nbsp;1'</font>";}
			if(sUTime > 45){timing = ico_live+"<font color=#CC0000>45'</font>";}
			if(sUTime > 0 && sUTime < 46){ if(sUTime < 10){sUTime = "&nbsp;"+sUTime;} timing = ico_live+"<font color=#CC0000>"+sUTime+"'</font>";} 
		}
		if(rs[13]==2)
		{
			var sUTAry = rs[14].split(",");
			var sMTime = new Date(sUTAry[0],sUTAry[1]-1,sUTAry[2],sUTAry[3],sUTAry[4],0);
			var sUTime = Math.round((d-sMTime)/1000/60+diffTime)-15-sUTAry[5];
			if(sUTime < 46){timing = ico_live+"<font color=#CC0000>46'</font>";}
			if(sUTime > 90){timing = ico_live+"<font color=#CC0000>90'</font>";}
			if(sUTime > 45 && sUTime < 91){ if(sUTime < 10){sUTime = "&nbsp;"+sUTime;} timing = ico_live+"<font color=#CC0000>"+sUTime+"'</font>";} 
		}
		
		tmp_td=document.createElement("td");
		tmp_td.id="time_"+rs[1];
		
		//zcyzzzm处理表格颜色		
		var zcy_yushu		
		if (zcy_yushu==1){
			var zcy_yushu=0
		}
		else{
			var zcy_yushu=1
		}		
		if (zcy_yushu==1) tmp_td.className="tda"+trCls;	
		
		tmp_td.innerHTML=timing;
		tmp_td.title=GoStratTime(rs[14]);
		//tmp_td.style.cursor="help";
		tmp_td.style.cursor="hand";
		
		tmp_tr.appendChild(tmp_td);
		tmp_td=document.createElement("td");
		tmp_td.id="stime_"+rs[1];
		
		if (zcy_yushu==1) tmp_td.className="tda"+trCls;
		
		tmp_td.innerHTML=SssAry[rs[13]];
		tmp_tr.appendChild(tmp_td);

		var nTeamA=(rs[9]=="")?zArray["z"+rs[1]].tama:"<span class=tred>"+rs[9]+"</span>&nbsp;"+zArray["z"+rs[1]].tama;
		tmp_td=document.createElement("td");
		tmp_td.id="TeamA_"+rs[1];
		
		if (zcy_yushu==1) tmp_td.className="tda"+trCls;
		
		tmp_td.style.textAlign="right";
		tmp_td.style.paddingRight=2;
		tmp_td.innerHTML=nTeamA;
		tmp_tr.appendChild(tmp_td);
		tmp_td=document.createElement("td");
		tmp_td.id="score_"+rs[1];		
		
		if (zcy_yushu==1) tmp_td.className="tda"+trCls;
		
		tmp_td.innerHTML=rs[11];
		tmp_td.style.cursor="pointer";
		tmp_td.style.fontWeight="bold";
		tmp_td.style.fontFamily="Verdana";
		if(rs[13] == 4 || rs[13] == 5 || rs[13] == 8){ tmp_td.style.fontSize="11px";tmp_td.style.color="#ff0000"; }
		tmp_td.onmouseover=function(){this.style.textDecoration='underline';}
		tmp_td.onmouseout=function(){this.style.textDecoration='none';}
		//tmp_td.setAttribute("onclick","openplayer("+rs[1]+")");
		//tmp_td.onclick=function(){openplayer(rs[1]);}
		tmp_tr.appendChild(tmp_td);
		tmp_td.onclick=function(){openplayer(this.id.replace("score_",""));}

		var nTeamB=(rs[10]=="")?zArray["z"+rs[1]].tamb:zArray["z"+rs[1]].tamb+"&nbsp;<span class=tred>"+rs[10]+"</span>";
		tmp_td=document.createElement("td");
		tmp_td.id="TeamB_"+rs[1];
		if (zcy_yushu==1) tmp_td.className="tdb"+trCls;	
		tmp_td.style.textAlign="left";
		tmp_td.style.paddingLeft=2;
		tmp_td.innerHTML=nTeamB;
		tmp_tr.appendChild(tmp_td);
		tmp_td=document.createElement("td");
		tmp_td.id="half_"+rs[1];
		if (zcy_yushu==1) tmp_td.className="tda"+trCls;
		//zcyzzzm天气
		rs[17] = ""//增加这行屏蔽天气		
		var tmpHaf=(rs[17] != "" && zArray["z"+rs[1]].stim == 0)?"<img src='../images/stats-wear.gif' border=0 style='cursor:pointer' title='"+rs[17]+"'>":zArray["z"+rs[1]].half;
		
		
		tmp_td.innerHTML=tmpHaf;
		tmp_td.style.color="#ff0000";
		tmp_td.style.fontSize="10px";
		tmp_td.style.fontFamily="Verdana";
		tmp_tr.appendChild(tmp_td);
		tmp_td=document.createElement("td");
		if (zcy_yushu==1) tmp_td.className="tdb"+trCls;	
		
		rs[19] = ""//zcyzzzm屏蔽电视
		var tmpTvs=(rs[19] != "")?"<img src='../images/stats-tv.gif' border=0 style='cursor:pointer' title='"+rs[19].replace(/，/g,"\n")+"'>":"";
		
		//var tmpFxt=(rs[20] != "")?"<img src='../images/stats-icon.gif' border=0 onClick=\"window.open('/match_info/match_info.asp?id="+rs[1]+"','zQzzMatchInfo')\" style='cursor:pointer' title='两队近来战况'>":"";
		var tmpFxt=(rs[20] != "")?"<a onClick=\"window.open('/match_info/match_info.asp?id="+rs[1]+"','zQzzMatchInfo')\" style='cursor:pointer' title='分析'>析</a>":"";
		
		tmp_td.innerHTML=tmpFxt+tmpTvs;
		tmp_tr.appendChild(tmp_td);
		tmp_td=document.createElement("td");
		if (zcy_yushu==1) tmp_td.className="tda"+trCls;
		tmp_tr.appendChild(tmp_td);
		var tmp_input=document.createElement("input");
		tmp_input.id="select_"+rs[1];
		tmp_input.type="checkbox";
		tmp_td.appendChild(tmp_input);
		tmp_input.onclick=function(){utilityOBJ.ShowHiddenTr(this.id.replace("select_",""));}
		tmp_tbody.insertBefore(tmp_tr,insetObj);
		tmp_input.checked=isDropSel;
		rs[22]=""//zcyzzzm增加这句代码可以消除“视频转播”的行
		if(rs[22]!="")
		{
			var tmpMsgtr=document.createElement("tr");
			tmpMsgtr.style.display=isDropTr;
			var tmpMsgtd=document.createElement("td");
			tmpMsgtd.id="tdmID_"+rs[1];
			tmpMsgtd.colSpan=9;
			tmpMsgtd.className="tdms";
			tmpMsgtd.innerHTML=rs[22].replace(/\\/g,"");
			tmpMsgtr.appendChild(tmpMsgtd);
			tmp_tbody.insertBefore(tmpMsgtr,insetObj);
		}
	}

	var tmpStr=""
	LeagueAry.sort();
	var Mt=["全部比賽","正在比賽","完場比賽","準備開賽","賽事反選"];
	if(LANG==1){Mt=["全部比赛","正在比赛","完场比赛","准备开赛","赛事反选"];}
	if(LANG==2){Mt=["MatchFull","MatchNow","MatchFin","MatchReady","MatchInvers"];}
	tmpStr+="<tr bgcolor=#51AD64><td colspan=4>  <input type=button value='"+Mt[0]+"' onclick='utilityOBJ.select_ssall()'> <input type=button value='"+Mt[1]+"' onclick='utilityOBJ.select_live()'> <input type=button value='"+Mt[2]+"' onclick='utilityOBJ.select_over()'> <input type=button value='"+Mt[3]+"' onclick='utilityOBJ.select_will()'> <input type=button value='"+Mt[4]+"' onclick='utilityOBJ.select_inverse()'></td><td align=center><input type=button value='关闭' onclick='document.getElementById(\"LeagueDataShow\").style.display=\"none\";'></td>";
	for(var i=0;i<LeagueAry.length;i++)
	{
		var theLeagueStr=LeagueAry[i][1].replace("\^","");
		if(i%5==0){tmpStr+="<tr bgcolor=#FAF0BB>";}
		tmpStr+="<td bgcolor=#FAF0BB><input name='trss_"+i+"' type='checkbox' value='"+theLeagueStr+"' checked onclick='utilityOBJ.select_ss(\""+theLeagueStr+"\",this.checked)'>"+theLeagueStr+"</td>";
	}
	tmpStr+="<tr bgcolor=#AAD7B3><td colspan=5 align=center>&nbsp;&nbsp;"
	document.getElementById("LeagueDataShow").innerHTML="<table width='100%' cellspacing='0' style='font-family:宋体;font-size:12px;background-color:#FAF0BB;border-color:#000000;border-style:solid;border-width:1px 1px 1px 1px;' align=center>"+tmpStr+"</table>";
	if(PageLoaded==0){LCounts=zAry.length-1;PageLoaded=1;utilityOBJ.LiveSend();}
}catch(e){}
}

this.ClickLeagueDIV = function(){
	try{
		var tmpItem=document.getElementById("LeagueDataShow");
		var diyItem=document.getElementById("DiyOptionDIV");
		if(tmpItem.style.display=="none"){tmpItem.style.display="";}else{tmpItem.style.display="none";}
		tmpItem.style.top=diyItem.parentNode.parentNode.parentNode.parentNode.offsetTop+diyItem.offsetHeight+1;
		tmpItem.style.left=diyItem.parentNode.parentNode.parentNode.parentNode.offsetLeft+131;
	}catch(e){}
}

this.ClickOptionDIV = function(){
	try{
		var tmpItem=document.getElementById("OptionSelectShow");
		var diyItem=document.getElementById("DiyOptionDIV");
		if(tmpItem.style.display=="none"){tmpItem.style.display="";}else{tmpItem.style.display="none";}
		tmpItem.style.top=diyItem.parentNode.parentNode.parentNode.parentNode.offsetTop+diyItem.offsetHeight+1;
		tmpItem.style.left=diyItem.parentNode.parentNode.parentNode.parentNode.offsetLeft+131;
	}catch(e){}
}

this.ClickLanguageDIV = function(){
	try{
		var tmpItem=document.getElementById("LanguageSelectShow");
		var diyItem=document.getElementById("DiyOptionDIV");
		if(tmpItem.style.display=="none"){tmpItem.style.display="";}else{tmpItem.style.display="none";}
		tmpItem.style.top=diyItem.parentNode.parentNode.parentNode.parentNode.offsetTop+diyItem.offsetHeight+1;
		tmpItem.style.left=diyItem.parentNode.parentNode.parentNode.parentNode.offsetLeft+131;
	}catch(e){}
}

this.ShowHiddenTr = function(id){
	if(!document.getElementById("select_"+id).checked)
	{
		document.getElementById("trID_"+id).style.display="none";
		if(document.getElementById("tdmID_"+id) != null){document.getElementById("tdmID_"+id).parentNode.style.display = "none";}
		var TmpNum = parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue);
		TmpNum++;
		document.getElementById("MatchHideNum").firstChild.nodeValue = TmpNum;
		DropIdAry+=":"+id;
		setCookie("DropIdAry",DropIdAry,1000*60*60*24);
	}
}

this.select_ssall = function(){
try{
	for(key in zArray)
	{
		var id=zArray[key].lsid;
		if(!document.getElementById("select_"+id).checked){
			document.getElementById("select_"+id).checked=true;
			document.getElementById("trID_"+id).style.display="";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="";}
		}
	}

	for(var i=0;i<LeagueAry.length;i++)
	{
		if(!document.getElementsByName("trss_"+i)[0].checked){document.getElementsByName("trss_"+i)[0].checked=true;}
	}
	document.getElementById("MatchHideNum").firstChild.nodeValue=0;
	setCookie("DropIdAry","",1000*60*60*24);
}catch(e){}
}

this.select_live = function(){
try{
	for(key in zArray)
	{
		var id=zArray[key].lsid;
		if(zArray[key].stim!=4 && zArray[key].stim!=5 & zArray[key].stim!=8 & zArray[key].stim!=0)
		{
			if(!document.getElementById("select_"+id).checked){
				document.getElementById("select_"+id).checked=true;
				document.getElementById("trID_"+id).style.display="";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="";}
				document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)-1;
				DropIdAry=DropIdAry.replace(":"+id,"");

			}
		}else{
			if(document.getElementById("select_"+id).checked){
				document.getElementById("select_"+id).checked=false;
				document.getElementById("trID_"+id).style.display="none";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="none";}
				document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)+1;
				DropIdAry+=":"+id;
			}
		}
	}
	setCookie("DropIdAry",DropIdAry,1000*60*60*24);
}catch(e){}
}

this.select_over = function(){
try{
	for(key in zArray)
	{
		var id=zArray[key].lsid;
		if(zArray[key].stim==4 || zArray[key].stim==5 || zArray[key].stim==8)
		{
			if(!document.getElementById("select_"+id).checked){
				document.getElementById("select_"+id).checked=true;
				document.getElementById("trID_"+id).style.display="";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="";}
				document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)-1;
				DropIdAry=DropIdAry.replace(":"+id,"");

			}
		}else{
			if(document.getElementById("select_"+id).checked){
				document.getElementById("select_"+id).checked=false;
				document.getElementById("trID_"+id).style.display="none";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="none";}
				document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)+1;
				DropIdAry+=":"+id;
			}
		}
	}
	setCookie("DropIdAry",DropIdAry,1000*60*60*24);
}catch(e){}
}

this.select_will = function(){
try{
	for(key in zArray)
	{
		var id=zArray[key].lsid;
		if(zArray[key].stim==0)
		{
			if(!document.getElementById("select_"+id).checked){
				document.getElementById("select_"+id).checked=true;
				document.getElementById("trID_"+id).style.display="";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="";}
				document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)-1;
				DropIdAry=DropIdAry.replace(":"+id,"");

			}
		}else{
			if(document.getElementById("select_"+id).checked){
				document.getElementById("select_"+id).checked=false;
				document.getElementById("trID_"+id).style.display="none";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="none";}
				document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)+1;
				DropIdAry+=":"+id;
			}
		}
	}
	setCookie("DropIdAry",DropIdAry,1000*60*60*24);
}catch(e){}
}

this.select_inverse = function(){
try{
	for(key in zArray)
	{
		var id=zArray[key].lsid;
		if(!document.getElementById("select_"+id).checked){
			document.getElementById("select_"+id).checked=true;
			document.getElementById("trID_"+id).style.display="";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="";}
			document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)-1;
			DropIdAry=DropIdAry.replace(":"+id,"");
		}else{
			document.getElementById("select_"+id).checked=false;
			document.getElementById("trID_"+id).style.display="none";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="none";}
			document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)+1;
			DropIdAry+=":"+id;
		}
	}

	for(var i=0;i<LeagueAry.length;i++)
	{
		if(document.getElementsByName("trss_"+i)[0].checked){document.getElementsByName("trss_"+i)[0].checked=false;}else{document.getElementsByName("trss_"+i)[0].checked=true;}
	}
	setCookie("DropIdAry",DropIdAry,1000*60*60*24);
}catch(e){}
}

this.select_ss = function(ss,ok){
try{

	for(key in zArray)
	{
		var id=zArray[key].lsid;
		if(zArray[key].ss==ss){
			if(ok){
				if(!document.getElementById("select_"+id).checked){
					document.getElementById("trID_"+id).style.display="";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="";}
					document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)-1;
					DropIdAry=DropIdAry.replace(":"+id,"");
				}
			}else{
				if(document.getElementById("select_"+id).checked){
					document.getElementById("trID_"+id).style.display="none";if(document.getElementById("tdmID_"+id)!=null){document.getElementById("tdmID_"+id).parentNode.style.display="none";}
					document.getElementById("MatchHideNum").firstChild.nodeValue=parseInt(document.getElementById("MatchHideNum").firstChild.nodeValue)+1;
					DropIdAry+=":"+id;
				}
			}
			document.getElementById("select_"+id).checked=ok;

		}
	}
	setCookie("DropIdAry",DropIdAry,1000*60*60*24);
}catch(e){}
}

this.Live_Class = function(rs){
	this.lsid=rs[1];this.colo=rs[2];
	this.tama=rs[3]; this.tamb=rs[6]; this.ss=rs[15]
	if(LANG==1){this.tama=rs[4]; this.tamb=rs[7]; this.ss=rs[23]}
	if(LANG==2){this.tama=rs[5]; this.tamb=rs[8]; this.ss=rs[16]}
	this.reda=rs[9];this.redb=rs[10];this.scoe=rs[11];this.half=rs[12];this.stim=rs[13];this.time=rs[14];this.mess=rs[22];this.updatetime=null;
}

}