﻿
var laT1 = new Array(), laT2 = new Array(), lbT1 = new Array(), lbT2 = new Array(), pkT = new Array(), aswT1 = new Array(), aswT2 = new Array(), bswT1 = new Array(), bswT2 = new Array();

function changeFixture(path)
{
	if(path.substring(0,4)=="odds")
		path = path.replace("odds","default");
	parent.document.location.href = path;
}

function Request(Variable)
{
	var query = location.search;
	if (query != "")
	{
		query = query.split("?")[1];
		query = query.split("&");
		for (var i=0;i<query.length;i++)
		{
			var querycoll = query[i].split("=");
			if (querycoll.length == 2)
			{
				if (querycoll[0].toUpperCase() == Variable.toUpperCase())
				{
					return querycoll[1];
					break;
				}
			}
		}
	}
	return "";
}

function ShowWordAd()
{
	var divLs = document.getElementById('ls'); 
	var obj;
	
	var j = 0;
	for(var i=1; i<=4; i++)
	{
		var tmpHTML=eval("var_MT"+i);
		if(typeof(tmpHTML)!=null && tmpHTML!="")
		{
			var wordAd = document.getElementById("gg_MT" + i);
			
			if(wordAd == null)
			{
				wordAd=document.createElement("div");
				wordAd.id="gg_MT" + i;
				wordAd.className="mt";
			}
			
			if(divLs.childNodes[2].childNodes.length > i+1)
			{
				obj = divLs.childNodes[2].childNodes[i];
				obj.appendChild(wordAd);
			}
			else
			{
				var gameover = document.getElementById("gameover");
				
				j++;
				if(gameover.style.display != "none")
				{
					if(gameover.childNodes.length > j)
					{
						obj = gameover.childNodes[j];
						obj.appendChild(wordAd);
					}
					else
					{
						obj = gameover.childNodes[gameover.childNodes.length-1];
						obj.appendChild(wordAd);
					}
				}
				else
				{				
					obj = divLs.childNodes[2].childNodes[divLs.childNodes[2].childNodes.length-2];
					obj.appendChild(wordAd);
				}				
			}
			wordAd.innerHTML=tmpHTML;
		}
		
	}
}

function ShowWordAd_i()
{
	var live_Table = document.getElementById('live_Table'); 
	var obj;
	
	var j = 0;
	//alert(live_Table.rows.length);
	
	for(var i=1; i<=4; i++)
	{
		var tmpHTML=eval("var_MT"+i);
		if(typeof(tmpHTML)!=null && tmpHTML!="")
		{
			//alert(live_Table.rows.length);
			
			if(live_Table.rows.length >= 2+i*2+i-1)
			{
				var tr = live_Table.insertRow(2+i*2+i-1);
				var td0 = tr.insertCell(0);
				td0.colSpan = live_Table.rows[3].cells.length+4;
				td0.align = 'center';
				td0.innerHTML = tmpHTML;
			}
			else
			{
				var tr = live_Table.insertRow(live_Table.rows.length);
				var td0 = tr.insertCell(0);
				td0.colSpan = live_Table.rows[3].cells.length+4;
				td0.align = 'center';
				td0.innerHTML = tmpHTML;
			}
		}		
	}
}



function showAllProvider()
{
	var cf_input = document.getElementById("cf_input");
	var cf_list = document.getElementById("cf_list");
	var lis = cf_list.getElementsByTagName("li");
	var hlistProvider = document.getElementById("hlistProvider");
	
	if(cf_input.style.display == "none")
	{	
		for(var i=0; i<lis.length; i++)
		{
			lis[i].style.display = "";
		}		
		
		cf_input.style.display = "";
		hlistProvider.className = "lM_up";
		hlistProvider.title = "";
	}
	else
	{
		for(var i=0; i<lis.length; i++)
		{
			if(lis[i].className == "nosel")
			{
				lis[i].style.display = "none";
			}
		}
		
		cf_input.style.display = "none";
		hlistProvider.className = "lM_down";
		hlistProvider.title = contentText[69];
	}
}

function showAllProvider1()
{
	var lis = document.getElementsByTagName("a");
	var hlistProvider = document.getElementById("hlistProvider");
	
	if(hlistProvider.className == "lM_down")
	{	
		for(var i=0; i<lis.length; i++)
		{
			if(lis[i].className.indexOf("cf_ayes") >= 0 || lis[i].className.indexOf("cf_alist") >= 0)
				lis[i].style.display = "";
		}		
		
		hlistProvider.className = "lM_up";
		hlistProvider.title = "";
	}
	else
	{
		for(var i=0; i<lis.length; i++)
		{			
			if(lis[i].className == "cf_alist nosel")
			{
				lis[i].style.display = "none";
			}
		}
		
		hlistProvider.className = "lM_down";
		hlistProvider.title = contentText[69];
	}
}

function LoadJS(fileUrl,callback,code) 
{ 
    var oHead = document.getElementsByTagName('HEAD').item(0); 
    var oScript= document.createElement("script"); 
    oScript.type = "text/javascript";
	
	if(code)
	{
		oScript.charset = code;
	} 
	
    oScript.src=fileUrl ;  
	oHead.appendChild(oScript); 
	if(document.addEventListener)
	{ 
		oScript.onload = callback;
		oScript.onerror = callback; 
	}
	else
	{
		oScript.onreadystatechange =function(){ LoadJsReady(oScript,callback);}; 
	}
}

function LoadJsReady(obj,callBack)
{ 
	if(obj.readyState=="loaded")
	{ 
		callBack();
	} 
}  

//隐藏或显示指数信息
function hide_odds(bh)
{	
	var odds = document.getElementById("tr_" + bh + "_odds");
	var tmp = document.getElementById("a_" + bh);
	
	if(odds.style.display == "none")
	{
		odds.style.display = "";
		tmp.className = 'team_none';
	}
	else
	{
		odds.style.display = "none";
		tmp.className = 'team_dowm';
	}
	
	//重新设置页面高度
	resetPheight();
}


function show(obj, type) {
	if(type == 1) {
		document.getElementById(obj).style.display = 'block';
	} else {
		document.getElementById(obj).style.display = 'none';
	}
}

function getFONT()
{
	var value;
	if(getCookie("lsfont") == "14px")
	{
		if(LANGUAGE_INDEX == 2)
		{
			value = "12px";
		}
		else
		{
			value = "13px";
		}
	}
	else
	{
		if(LANGUAGE_INDEX == 2)
		{
			value = "11px";
		}
		else
		{
			value = "12px";
		}
	}
	
	document.getElementById("ls").style.fontSize = value ;	
}

function setFONT(sz)
{
	var value;
	if(sz == "14px")
	{
		if(LANGUAGE_INDEX == 2)
		{
			value = "12px";
		}
		else
		{
			value = "13px";
		}
	}
	else
	{
		if(LANGUAGE_INDEX == 2)
		{
			value = "11px";
		}
		else
		{
			value = "12px";
		}
	}
	
	frames["Matchframe"].document.getElementById("ls").style.fontSize = value ;	
	setCookie("lsfont", sz);
	
	document.getElementById("Matchframe").style.height = document.all ? document.getElementById("Matchframe").contentWindow.document.documentElement.scrollHeight : document.getElementById("Matchframe").contentWindow.document.documentElement.offsetHeight + 20;
		
	document.getElementById("Matchframe").height = document.all ? document.getElementById("Matchframe").contentWindow.document.documentElement.scrollHeight : 	document.getElementById("Matchframe").contentWindow.document.documentElement.offsetHeight + 20;
}

function NumReturn(Num,Num1,Num2){
	if(Num == '')
		return '';
	return (Math.round((1/(1/Num + 1/Num1 + 1/Num2))*10000)/100) + '%';
}

//显示所有比赛
function showall()
{
	for(var i=0; i<hideMatchs.length; i++)
	{
		var tr_match = document.getElementById("bh" + hideMatchs[i]);
		if(tr_match != null)	
		{
			tr_match.style.display = "";
		}
		
		var tr_match_1 = document.getElementById("bh" + hideMatchs[i] + "_1");
		if(tr_match_1 != null)	
		{
			tr_match_1.style.display = "";
		}
		
		var tr_match_2 = document.getElementById("bh" + hideMatchs[i] + "_2");
		if(tr_match_2 != null)	
		{
			tr_match_2.style.display = "";
		}	
		
		var tr_match_3 = document.getElementById("bh" + hideMatchs[i] + "_3");
		if(tr_match_3 != null)	
		{
			tr_match_3.style.display = "";
		}	
	}
	
	for(var i=0; i<hideLeagues.length; i++)
	{
		var tr_league = document.getElementById("l_" + hideLeagues[i]);
		if(tr_league != null)	
		{
			tr_league.style.display = "";
		}				
	}
	
	//重新赋值隐藏的比赛
	hideMatchs = new Array();
	hideLeagues = new Array();
	
	
	changeHideCount();
	
	//重新设置页面高度
	resetPheight();
}

//隐藏某场比赛
function hide_match(bh)
{
	//var live = document.getElementById("a_" + bh);
	var tr_match = document.getElementById("bh" + bh);
	if(tr_match != null)	
	{
		tr_match.style.display = "none";
	}
	
	var tr_match_1 = document.getElementById("bh" + bh + "_1");
	if(tr_match_1 != null)	
	{
		tr_match_1.style.display = "none";
	}
	
	var tr_match_2 = document.getElementById("bh" + bh + "_2");
	if(tr_match_2 != null)	
	{
		tr_match_2.style.display = "none";
	}
	
	var tr_match_3 = document.getElementById("bh" + bh + "_3");
	if(tr_match_3 != null)	
	{
		tr_match_3.style.display = "none";
	}
	
	hideMatchs[hideMatchs.length] = bh;
	
	//改变隐藏的场数
	changeHideCount();
	
	//重新设置页面高度
	resetPheight();
}


function hide_league(league_id){
	
	if(typeof(ORD) != "undefined")
	{
		for(var i = 0; i < ORD.length; i++){		
			var live_bh = ORD[i];
			
			if(sDt[live_bh][16] == league_id)
			{
				var tr_match = document.getElementById("bh" + live_bh);	
				
				if(tr_match != null)
				{
					tr_match.style.display = "none";	
					hideMatchs[hideMatchs.length] = live_bh;
				}
			}
		}
	}
	else if(typeof(live_bh_Arr) != "undefined")
	{
		for(var i=0; i < live_bh_Arr.length; i++)
		{
			if(league_id == Match_bh_Arr[i]) 
			{
				var tr_match = document.getElementById("bh" + live_bh_Arr[i]);	
				
				if(tr_match != null)
				{
					tr_match.style.display = "none";	
					hideMatchs[hideMatchs.length] = live_bh_Arr[i];
				}
			}
		}
	}
	
	var tr_league = document.getElementById("l_" + league_id);	
	tr_league.style.display = "none";
	hideLeagues[hideLeagues.length] = league_id;
	//改变隐藏的场数
	changeHideCount();
	
	//重新设置页面高度
	resetPheight();
}

function hide_leagues(league_ids){
	
	for(var i=0; i<hideMatchs.length; i++)
	{
		var tr_match = document.getElementById("bh" + hideMatchs[i]);
		if(tr_match != null)	
		{
			tr_match.style.display = "";
		}
		
		var tr_match_1 = document.getElementById("bh" + hideMatchs[i] + "_1");
		if(tr_match_1 != null)	
		{
			tr_match_1.style.display = "";
		}
		
		var tr_match_2 = document.getElementById("bh" + hideMatchs[i] + "_2");
		if(tr_match_2 != null)	
		{
			tr_match_2.style.display = "";
		}	
		
		var tr_match_3 = document.getElementById("bh" + hideMatchs[i] + "_3");
		if(tr_match_3 != null)	
		{
			tr_match_3.style.display = "";
		}	
	}
	
	for(var i=0; i<hideLeagues.length; i++)
	{
		var tr_league = document.getElementById("l_" + hideLeagues[i]);
		if(tr_league != null)	
		{
			tr_league.style.display = "";
		}				
	}
	
	//重新赋值隐藏的比赛
	hideMatchs = new Array();
	hideLeagues = new Array();
	
	if(typeof(ORD) != "undefined")
	{
		for(var i = 0; i < ORD.length; i++){		
			var live_bh = ORD[i];
			
			if((","+league_ids+",").indexOf(","+sDt[live_bh][16]+",")>-1)
			{
				var tr_match = document.getElementById("bh" + live_bh);	
				if(tr_match != null)	
				{
					tr_match.style.display = "none";
				}	
				
				var tr_match_1 = document.getElementById("bh" + live_bh + "_1");	
				if(tr_match_1 != null)	
				{
					tr_match_1.style.display = "none";
				}	
				
				var tr_match_2 = document.getElementById("bh" + live_bh + "_2");	
				if(tr_match_2 != null)	
				{
					tr_match_2.style.display = "none";
				}	
					
				var tr_match_3 = document.getElementById("bh" + live_bh + "_3");	
				if(tr_match_3 != null)	
				{
					tr_match_3.style.display = "none";
				}	
				
				
				hideMatchs[hideMatchs.length] = live_bh;
			}
		}
	}
	else if(typeof(live_bh_Arr) != "undefined")
	{
		for(var i=0; i < live_bh_Arr.length; i++)
		{
			if((","+league_ids+",").indexOf(","+Match_bh_Arr[i]+",")>-1)
			{
				var tr_match = document.getElementById("bh" + live_bh_Arr[i]);	
				if(tr_match != null)	
				{
					tr_match.style.display = "none";
				}	
				
				var tr_match_1 = document.getElementById("bh" + live_bh_Arr[i] + "_1");	
				if(tr_match_1 != null)	
				{
					tr_match_1.style.display = "none";
				}	
				
				var tr_match_2 = document.getElementById("bh" + live_bh_Arr[i] + "_2");	
				if(tr_match_2 != null)	
				{
					tr_match_2.style.display = "none";
				}	
					
				var tr_match_3 = document.getElementById("bh" + live_bh_Arr[i] + "_3");	
				if(tr_match_3 != null)	
				{
					tr_match_3.style.display = "none";
				}	
				
				
				hideMatchs[hideMatchs.length] = live_bh_Arr[i];
			}
		}
	}
	
	if(league_ids != '')
	{
		var leagueIds = league_ids.split(',');
		for(var i=0; i<leagueIds.length; i++)
		{	
			var tr_league = document.getElementById("l_" + leagueIds[i]);
			if(tr_league != null)
			{	
				tr_league.style.display = "none";
				hideLeagues[hideLeagues.length] = leagueIds[i];
			}
		}
	}
	
	
	//改变隐藏的场数
	changeHideCount();
	
	//重新设置页面高度
	resetPheight();
}

function changeHideCount()
{
	document.getElementById("hide_count").innerHTML = hideMatchs.length;
}

//设置页面高度
function resetPheight()
{
//	var isIE= window.ActiveXObject?true:false;   
//	if(!isIE)
//	{
//	  
//	 parent.document.getElementById("Matchframe").style.height=(document.documentElement.offsetHeight)+"px";
//	 
//	}
//	else
//	{ 
//	  parent.document.getElementById("Matchframe").style.height=(document.body.offsetHeight)+"px";
//	   
//	}

	parent.document.getElementById("Matchframe").style.height = document.all ? parent.document.getElementById("Matchframe").contentWindow.document.documentElement.scrollHeight + 50: parent.document.getElementById("Matchframe").contentWindow.document.documentElement.offsetHeight + 50; 
		
	parent.document.getElementById("Matchframe").height = document.all ? parent.document.getElementById("Matchframe").contentWindow.document.documentElement.scrollHeight + 50 : parent.document.getElementById("Matchframe").contentWindow.document.documentElement.offsetHeight + 50;
		
	
}

//function ProcessTime()
//{
//	if (typeof(sDt2) == "object")
//	{
//		var AmountTime = 0;
//		var objBssj = null;
//		for (var i in sDt2)
//		{
//			if (sDt2[i][0] == 1)
//			{
//				AmountTime = parseInt((new Date() - Date.parse(sDt2[i][5])) / 1000 /60) + Timegap;
//				if (AmountTime < 0) AmountTime = 0;
//				if (AmountTime > 45) AmountTime = 45;
//				objBssj = (typeof(ObjArr[i]) == "object" && ObjArr[i].row != null) ? ObjArr[i].ptime : document.getElementById("bssj" + i);
//				if (objBssj != null && objBssj.innerHTML != AmountTime + "'")
//				{
//					objBssj.innerHTML = AmountTime + "'";
//				}
//			}
//			else if (sDt2[i][0] == 3)
//			{
//				AmountTime = parseInt((new Date() - Date.parse(sDt2[i][5])) / 1000 /60) + Timegap + 45;
//				if (AmountTime < 46) AmountTime = 46;
//				if (AmountTime > 90) AmountTime = 90;
//				objBssj = (typeof(ObjArr[i]) == "object" && ObjArr[i].row != null) ? ObjArr[i].ptime : document.getElementById("bssj" + i);
//				if (objBssj != null && objBssj.innerHTML != AmountTime + "'")
//				{
//					objBssj.innerHTML = AmountTime + "'";
//				}
//			}
//		}
//	}
//	if (typeof(ProcessTime_Timer) == "number")
//		clearTimeout(ProcessTime_Timer);
//	ProcessTime_Timer = setTimeout("ProcessTime()", 60000);
//}



function ProcessTime()
{
	if (typeof(sDt2) == "object")
	{
		var AmountTime = 0;
		var objBssj = null;
		for (var i in sDt2)
		{
			
			if (sDt2[i][0] == 1)
			{			
				
				var datetimes;
				
				try
				{
					datetimes=sDt2[i][5].split(",");
					AmountTime = parseInt((new Date() - new Date(datetimes[0], datetimes[1]-1, datetimes[2], datetimes[3],datetimes[4],datetimes[5])) / 1000 /60) + Timegap;
				}
				catch(e)
				{
					//alert(sDt2[i][5]);
					AmountTime = parseInt((new Date() - sDt2[i][5]) / 1000 /60) + Timegap;
				}	
				
				
				if (AmountTime < 0) AmountTime = 0;
				if (AmountTime > 45) AmountTime = 45;
				
				objBssj = (typeof(ObjArr[i]) == "object") ? ObjArr[i].ptime : document.getElementById("bssj" + i);
				if (objBssj != null && objBssj.innerHTML != AmountTime + "'")
				{		
					
					objBssj.innerHTML = AmountTime + "'";
				}
			}
			else if (sDt2[i][0] == 3)
			{				
				try
				{
					datetimes=sDt2[i][5].split(",");
					AmountTime = parseInt((new Date() - new Date(datetimes[0], datetimes[1]-1, datetimes[2], datetimes[3],datetimes[4],datetimes[5])) / 1000 /60) + Timegap + 45;
				}
				catch(e)
				{
					AmountTime = parseInt((new Date() - sDt2[i][5]) / 1000 /60) + Timegap + 45;
				}			
				
				if (AmountTime < 46) AmountTime = 46;
				if (AmountTime > 90) AmountTime = 90;
				objBssj = (typeof(ObjArr[i]) == "object") ? ObjArr[i].ptime : document.getElementById("bssj" + i);
				
				if (objBssj != null && objBssj.innerHTML != AmountTime + "'")
				{
					
					objBssj.innerHTML = AmountTime + "'";
				}
			}
		}
	}
	if (typeof(ProcessTime_Timer) == "number")
	clearTimeout(ProcessTime_Timer);
	ProcessTime_Timer = setTimeout("ProcessTime()", 60000);
}

//function OpenXml()
//{
//	try
//	{	
//	
//http://one.7m.cn/livedata/sxl.js 
//		xmlhttp.open("get", "/readxml.php", true);
//		xmlhttp.onreadystatechange = livexmlonreadystatechange;
//		xmlhttp.send(null);
//	}
//	catch(e)
//	{
//		alert(e.message)
//	}
//	if (typeof(OpenXml_Timer) == "number")
//		clearTimeout(OpenXml_Timer);
//	OpenXml_Timer = setTimeout("OpenXml()", bfRefreshTime);
//}
var sxl=null;


function OpenXml()
{
	try
	{
		sxl=null; 
		LoadJS('http://one.7m.cn/livedata/sxl.js?date='+ new Date().toString("yyyyMMddHHmmss"), livexmlonreadystatechange); 
	}
	catch(e){}
	if (typeof(ReadOXml_Time) != "undefined")
	ReadOXml_Time=clearTimeout(ReadOXml_Time);
	ReadOXml_Time = setTimeout("OpenXml()", 5000); 
}

function OpenXml_()
{
	try
	{
		sxl=null; 
		LoadJS('http://one.7m.cn/livedata/sxl.js?date='+ new Date().toString("yyyyMMddHHmmss"), livexmlonreadystatechange_); 
	}
	catch(e){}
	if (typeof(ReadOXml_Time) != "undefined")
	ReadOXml_Time=clearTimeout(ReadOXml_Time);
	ReadOXml_Time = setTimeout("OpenXml_()", 5000); 
}

function OpenXml2()
{      
	try
	{
		sxl=null; 
		LoadJS('http://one.7m.cn/livedata/sxl_'+ GetFlagNum + '.js?date='+ new Date().toString("yyyyMMddHHmmss"),livexmlonreadystatechange2); 
		
		
	}
	catch(e){}
}

function OpenXml_2()
{      
	try
	{
		sxl=null; 
		LoadJS('http://one.7m.cn/livedata/sxl_'+ GetFlagNum + '.js?date='+ new Date().toString("yyyyMMddHHmmss"),livexmlonreadystatechange_2); 
		
		
	}
	catch(e){}
}
//function OpenXml2()
//{
//	try
//	{
//		xmlhttp2.open("Get", "/readXML.php?n=" + GetFlagNum, true);
//		xmlhttp2.onreadystatechange = livexmlonreadystatechange2;
//		xmlhttp2.send(null);
//	}
//	catch(e)
//	{
//	}
//}


var oldxml = '', newxml='';

function livexmlonreadystatechange()
{
	//if (xmlhttp.readyState != 4 || (xmlhttp.status != 200 && xmlhttp.status != 0))
//		return;
		
	if(sxl==null)  return;
	//alert(11)
	
	var newxml = "";
	
	
//	if(isIE)
//	{
//		XmlDoc = xmlhttp.responseXML;
//		newxml = XmlDoc.xml;
//		if(newxml == "" || newxml == oldxml)
//			return;
//	}
//	else
//	{
//		XmlDoc = parser.parseFromString(xmlhttp.responseText, "text/xml");
//		if(XmlDoc.documentElement.tagName == "parsererror")
//			return;
//		newxml= oSerializer.serializeToString(XmlDoc.documentElement);
//		if(newxml == "" || newxml == oldxml)
//			return;
//	}
	
	var nextfn = sxl.fn;//parseInt(root.getAttribute("t"));
	newxml = nextfn;
	
	
	if(newxml == "" || newxml == oldxml)
	{
		return;
	}
	
	
	//GoalTips = "";
	//GoalTips_Count = 0;
	
	//var root = XmlDoc.documentElement;
	var ResetPage = sxl.rst;//root.getElementsByTagName("Rst")[0].firstChild.nodeValue;
	
	if (!setRefreshValue)
	{
		reflag = ResetPage;
		setRefreshValue = true;
	}
	if (reflag != ResetPage)
	{
		setRefreshValue = false;
		var Rnd = Math.round(Math.random()*19000)+1000;
		setTimeout("location.reload()", Rnd);
		return;
	}
	

	if ((nextfn - 1) > GetFlagNum)
	{
		OpenXml2();
		return;
	}
	
	var cNode = sxl.c;//root.getElementsByTagName("C");

	
	for(var i=0;i<cNode.length;++i)
		Update_Live(cNode[i]);
	
	oldxml = newxml;
	GetFlagNum = parseInt(sxl["fn"]);  
	/*if (SelectGoalSound)
	{
		if(GoalSound)
		{
			PlaySound();
			GoalSound = false;
		}
		if(ErrorGoalSound)
		{
			PlayErrorSound();
			ErrorGoalSound = false;
		}
		if(RedSound)
		{
			PlayRedSound();
			RedSound = false;
		}
	}
	if (GoalTips_Count > 0)
	{
		ShowGoalTips();
	}*/
}


function livexmlonreadystatechange_()
{
	if(sxl==null)  return;	
	var newxml = "";
	
	var nextfn = sxl.fn;//parseInt(root.getAttribute("t"));
	newxml = nextfn;
	
	
	if(newxml == "" || newxml == oldxml)
	{
		return;
	}

	var ResetPage = sxl.rst;	

	if ((nextfn - 1) > GetFlagNum)
	{
		OpenXml_2();
		return;
	}
	
	var cNode = sxl.c;
	
	for(var i=0;i<cNode.length;++i)
		Update_Live_(cNode[i]);
	
	oldxml = newxml;
	GetFlagNum = parseInt(sxl["fn"]); 	
}

function livexmlonreadystatechange2()
{
	//if (xmlhttp2.readyState != 4 || (xmlhttp2.status != 200 && xmlhttp2.status != 0))
	//	return;
		
	//if(isIE)
//	{
//		XmlDoc2 = xmlhttp2.responseXML;
//		if(XmlDoc2.xml == "")
//			return;
//	}
//	else
//	{
//		XmlDoc2 = parser.parseFromString(xmlhttp2.responseText, "text/xml");
//		if(XmlDoc2.documentElement.tagName == "parsererror")
//			return;		
//	}
	if(sxl==null)  return;
	var newxml = "";
	var nextfn = sxl.fn;//parseInt(root.getAttribute("t"));
	
	newxml = nextfn;
	if(newxml == "" || newxml == oldxml)
	{
		return;
	}
	
	var cNode = sxl.c;//root.getElementsByTagName("C");
	for(var i=0;i<cNode.length;++i)
		Update_Live(cNode[i]);
	

	GetFlagNum = sxl.fn;//parseInt(root.getAttribute("t"));

	//GoalTips = "";
	//GoalTips_Count = 0;
//	var root = XmlDoc2.documentElement;
//	var cNode = root.getElementsByTagName("C");
//	for(var i=0;i<cNode.length;++i)
//		eval('Update_Live(' + cNode[i].firstChild.nodeValue +')');
//	
//	GetFlagNum = parseInt(root.getElementsByTagName("fn")[0].firstChild.nodeValue);
}

function livexmlonreadystatechange_2()
{
	if(sxl==null)  return;
	var newxml = "";
	var nextfn = sxl.fn;//parseInt(root.getAttribute("t"));
	
	newxml = nextfn;
	if(newxml == "" || newxml == oldxml)
	{
		return;
	}
	
	var cNode = sxl.c;//root.getElementsByTagName("C");
	for(var i=0;i<cNode.length;++i)
		Update_Live_(cNode[i]);	

	GetFlagNum = sxl.fn;
}


function ChangeState(startIndex)
{
	if (startIndex < 0 || startIndex > 18)
		startIndex = 0;
	return oddsGameText[startIndex];
}


function ElementObj(bh)
{	
	this.row = document.getElementById("bh" + bh);
	
	if (this.row == null)
		return;
	
	
	//alert(document.getElementById("t_at" + bh));
	
	//比赛时间
	this.stime = document.getElementById("sj" + bh);
	
	//主客队
	this.teamA = document.getElementById("t_at" + bh);
	this.teamB = document.getElementById("t_bt" + bh);
	
	//比分
	this.score = document.getElementById("bf" + bh);
	this.lA = document.getElementById("la" + bh);
	this.lB = document.getElementById("lb" + bh);
	
	//半场比分
	this.hscore = document.getElementById("bc" + bh);
	
	//比赛状态
	this.pstatus = document.getElementById("pstatus" + bh);
	
	//比赛进行时间
	this.ptime = document.getElementById("bssj" + bh);	
	
	//红黄牌
	this.rA = document.getElementById("ra" + bh);
	this.rB = document.getElementById("rb" + bh);
}

function MoveGame(bh)
{
	if (document.getElementById("gameover") != null)
	{
		if (document.getElementById("gameover").style.display == "none")
			document.getElementById("gameover").style.display = "";
	}
	if (EndGamebh.indexOf("[" + bh + "]") == -1)
	{
		var row1 = document.getElementById("bh" + bh);
		if (row1 == null)
			return;
		//var row2 = $("resume_" + bh)
		//if(TopCookiestr.indexOf("%"+ bh +"%") > -1){
		//	InsertTop(bh,row1,row2);
		//}else{
		if(document.getElementById("gameover") != null){
			//alert(11)
			InsertMain(bh,row1);
			
			var row2 = document.getElementById("bh" + bh + "_2");
			if (row2 != null)
				InsertMain(bh,row2);
		}
		//}
		//row1.parentNode.appendChild(row1);
		//row2.parentNode.appendChild(row2);
		EndGamebh += "[" + bh + "]";
		
		if (document.getElementById("gameover") != null)
		{
			ShowWordAd();
		}
		else
		{
			ShowWordAd_i();
		}
		resetPheight();
		//if (($("live_Table").rows[1].id == "" && $("live_Table").rows[2].id == "") || ($("live_Table").rows[1].id == "" && $("live_Table").rows[2].id == "gameover"))
		//	$("live_Table").deleteRow(1);
		
	}
}

function set_Attribute(bh, obj, attribute, val)
{
	if (typeof(ObjArr) == "object" && typeof(ObjArr[bh]) == "object")
	eval("if (ObjArr[" + bh + "]." + obj + " != null){ObjArr[" + bh + "]." + obj + "." + attribute + " = '" + val + "';}");
}

function Update_Live(liveNode)
{
	var bh = liveNode[0];

	var IsStart = liveNode[1];
	var live_a = liveNode[2];
	//alert(live_a)
	var live_b = liveNode[3];
	var a_r  = liveNode[4];
	var b_r = liveNode[5];
	var TStart_Time = liveNode[6];
	var Banc = liveNode[7];
	var resume = liveNode[8];
	var Start_Time = liveNode[9];
	var sf = liveNode[10];
	var lbsf = liveNode[11];
	var csf = liveNode[12];	
	
	
	if (typeof(sDt) != "object" || typeof(sDt2) != "object") return;
	if (typeof(sDt[bh]) != "object" || typeof(sDt2[bh]) != "object") return;
	if (typeof(ObjArr) != "object") return;
	if (typeof(ObjArr[bh]) != "object")
	{

		ObjArr[bh] = new ElementObj(bh);	
	}
	if (ObjArr[bh].row == null || ObjArr[bh].row.style.display == "none") return;

		
	if (sDt2[bh][0] != IsStart)
	{
		sDt2[bh][0] = IsStart;
		var State = ChangeState(IsStart); 
		ObjArr[bh].pstatus.innerHTML = State;
		
		if (IsStart == 4 || IsStart == 10 || IsStart == 12 || IsStart == 16)
		{
			ObjArr[bh].pstatus.style.color = "#FF0000";
			ObjArr[bh].score.style.color = "#FF0000";			
		}
		else if (IsStart == 5 || IsStart == 6 || IsStart == 13 || IsStart == 14)
		{
			ObjArr[bh].pstatus.style.color = "#364DA3";
			if (IsStart != 5)
			{
				ObjArr[bh].lA.innerHTML = "";
				ObjArr[bh].lB.innerHTML = "";
				ObjArr[bh].ptime.style.display = "none";
				ObjArr[bh].score.style.display = "none";
				ObjArr[bh].rA.style.display = "none";
				ObjArr[bh].rB.style.display = "none";
				ObjArr[bh].hscore.innerHTML = "";
				setTimeout("MoveGame(" + bh + ")", 60000);
			}
		}
		else
		{
			ObjArr[bh].pstatus.style.color = "#000000";
		}
				
			//if (IsStart != 17)
//			{
//				InsertInfo(State,
//						   Replace_Team_name(sDt[bh][2]),
//						   sDt2[bh][1] + "-" + sDt2[bh][2],
//						   Replace_Team_name(sDt[bh][3]) + "&nbsp;");
//			}
			if (IsStart == 6 || IsStart == 13 || IsStart == 14)
			{
				return;
			}
		}
	
		if (Start_Time != "")
		{
			sDt2[bh][8] = Start_Time;
			if (timezone_TZ != "+0800")
				Start_Time = AmountTimeDiff(Start_Time, 0);
			var TmpValue = Start_Time.split(",");
			if (TmpValue.length == 6)
				ObjArr[bh].stime.innerHTML = TmpValue[3] + ":" + TmpValue[4];
		}
			
		if (IsStart == 17)
		{
			ObjArr[bh].lA.innerHTML = "";
			ObjArr[bh].lB.innerHTML = "";
			if (sDt2[bh][6].indexOf("-") != -1)
			{
				ObjArr[bh].hscore.innerHTML = "";
				sDt2[bh][6] = "";
			}
			ObjArr[bh].rA.style.display = "none";
			ObjArr[bh].rB.style.display = "none";
			ObjArr[bh].ptime.style.display = "none";
			ObjArr[bh].ptime.innerHTML = "0'";
			ObjArr[bh].score.style.display = "";
		}
		else
		{
			if ((IsStart >= 1 && IsStart <= 4) || IsStart == 15)
			{
				if (IsStart == 1 || IsStart == 3)
				{
					if (TStart_Time != "")
					{
						var GetBeginTime = TStart_Time.split(",");
						if (GetBeginTime.length == 6)
						{
							TStart_Time = new Date(GetBeginTime[0], parseFloat(GetBeginTime[1])-1, GetBeginTime[2], GetBeginTime[3], GetBeginTime[4], GetBeginTime[5]);
							sDt2[bh][5] = TStart_Time;
						}
					}
					ObjArr[bh].ptime.style.display = "";
				}
				else
				{
					ObjArr[bh].ptime.style.display = "none";
				}
				
				
				if (ObjArr[bh].lA.innerHTML == "" || ObjArr[bh].lA.innerHTML == "&nbsp;")
				{
					sDt2[bh][1] = 0;
					ObjArr[bh].lA.innerHTML = "0";
				}
				
				if (ObjArr[bh].lB.innerHTML == "" || ObjArr[bh].lB.innerHTML == "&nbsp;")
				{ 
					sDt2[bh][2] = 0;
					ObjArr[bh].lB.innerHTML = "0";
				}
			}
			else
			{
				ObjArr[bh].ptime.style.display = "none";
			}
			
			if (live_a!="" && live_a != sDt2[bh][1])
			{
				var goalimg = "goal";
				if (live_a < sDt2[bh][1])
				{
					goalimg = "gerr";
					ErrorGoalSound = true;

					speakAinefficacy = true;
				}
				else
				{
					GoalSound = true;
				}
				sDt2[bh][1] = live_a;
				ObjArr[bh].lA.style.color = "#FF0000";
				ObjArr[bh].lA.innerHTML = live_a;

				//ObjArr[bh].teamA.className = "home goal";
				clearTimeout(laT1[bh]);
				laT1[bh] = setTimeout("set_Attribute(" + bh + ", 'lA', 'style.color', '')", 180000);
				//clearTimeout(laT2[bh]);
				//laT2[bh] = setTimeout("set_Attribute(" + bh + ", 'teamA', 'className', 'home')", 180000);
				//if (SelectGoalTips)
//				{
//					Gold(0,
//						"<font color=#FF0000>" + sDt2[bh][1] + "</font>-" + sDt2[bh][2], 
//						"<font color=#FF0000>" + Replace_Team_name(sDt[bh][2]) + "</font>", 
//						Replace_Team_name(sDt[bh][3]),
//						sDt[bh][0] + (ObjArr[bh].ptime.style.display == "" ? "[" + ObjArr[bh].ptime.innerHTML + "]": ""), 
//						"#" + sDt[bh][1]);
//				}
//				InsertInfo("<img src=http://img.7m.cn/icon/" + goalimg + ".gif>&nbsp;",
//							 "<font color=#FF0000>" + Replace_Team_name(sDt[bh][2]) + "</font>",
//							 "<font color=#FF0000>" + sDt2[bh][1] + "</font>-" + sDt2[bh][2],
//							 Replace_Team_name(sDt[bh][3]) + "&nbsp;");
//				//speakgoal = true;
			}
	
			if (live_b != "" && live_b != sDt2[bh][2])
			{
				var goalimg = "goal";
				if (live_b < sDt2[bh][2])
				{
					goalimg = "gerr";
					ErrorGoalSound = true;
					speakBinefficacy = true;
				}
				else
				{
					GoalSound = true;
				}  
				sDt2[bh][2] = live_b;
				ObjArr[bh].lB.style.color = "#FF0000";
				ObjArr[bh].lB.innerHTML = live_b;
				//ObjArr[bh].teamB.className = "away goal";
				clearTimeout(lbT1[bh]);
				lbT1[bh] = setTimeout("set_Attribute(" + bh + ", 'lB', 'style.color', '')", 180000);
				//clearTimeout(lbT2[bh]);
				//lbT2[bh] = setTimeout("set_Attribute(" + bh + ", 'teamB', 'className', 'away')", 180000);
				//if (SelectGoalTips)
//				{
//					Gold(1,
//						sDt2[bh][1] + "-<font color=#FF0000>" + sDt2[bh][2] + "</font>", 
//						Replace_Team_name(sDt[bh][2]), 
//						"<font color=#FF0000>" + Replace_Team_name(sDt[bh][3]) + "</font>", 
//						sDt[bh][0] + (ObjArr[bh].ptime.style.display == "" ? "[" + ObjArr[bh].ptime.innerHTML + "]": ""), 
//						"#" + sDt[bh][1]);	
//				}
//				InsertInfo("<img src=http://img.7m.cn/icon/" + goalimg + ".gif>&nbsp;",
//						   Replace_Team_name(sDt[bh][2]),
//						   sDt2[bh][1] + "-<font color=#FF0000>" + sDt2[bh][2] + "</font>",
//						   "<font color=#FF0000>" + Replace_Team_name(sDt[bh][3]) + "</font>&nbsp;");
//				speakgoal = true;
			}
			
			if ((IsStart >= 1 && IsStart <= 3) || IsStart == 5 || (IsStart >=7 && IsStart <= 9) || IsStart == 11)
			{
				ObjArr[bh].rA.style.display = "";
				ObjArr[bh].rB.style.display = "";
				ObjArr[bh].score.style.display = "";
				if (IsStart == 2)
				{
					ObjArr[bh].ptime.innerHTML = "46'";
					ObjArr[bh].hscore.innerHTML = sDt2[bh][1] + "-" + sDt2[bh][2];
					sDt2[bh][6] = sDt2[bh][1] + "-" + sDt2[bh][2];
				}
			}
			else if (IsStart == 4 || IsStart == 12 || IsStart == 15)
			{
				ObjArr[bh].ptime.style.display = "none";
				ObjArr[bh].score.style.display = "";
			}
			if ((IsStart == 4 || IsStart == 6 || IsStart == 10 || (IsStart >= 12 && IsStart <= 15)) && oddslivetype != 1)
			{
				setTimeout("MoveGame(" + bh + ")", 6000);
				resetPheight();
			}
			if (a_r > 0)
			{
				if (sDt2[bh][3] != a_r)
				{
					sDt2[bh][3] = a_r;
					ObjArr[bh].rA.innerHTML = "<img src=http://img.7m.cn/icon/r" + a_r + ".gif>&nbsp;";
					//if (SelectGoalTips)
//					{
//						Gold(0,
//							sDt2[bh][1] + "-" + sDt2[bh][2], 
//							"<font color=#FF0000>" + Replace_Team_name(sDt[bh][2]) + "</font>&nbsp;<img src=http://img.7m.cn/icon/r" + a_r + ".gif>", 
//							Replace_Team_name(sDt[bh][3]), 
//							sDt[bh][0] + (ObjArr[bh].ptime.style.display == "" ? "[" + ObjArr[bh].ptime.innerHTML + "]": ""), 
//							"#" + sDt[bh][1]);
//					}
//					InsertInfo("<img src=http://img.7m.cn/icon/r" + a_r + ".gif>&nbsp;",
//							   "<font color=#FF0000>" + Replace_Team_name(sDt[bh][2]) + "</font>",
//							   sDt2[bh][1] + "-" + sDt2[bh][2],
//							   Replace_Team_name(sDt[bh][3]) + "&nbsp;");
//					speakAred = true;
//					RedSound = true;
				}
			}
			else
			{
				sDt2[bh][3] = a_r;
				ObjArr[bh].rA.innerHTML = "";
			}
			
			if (b_r > 0)
			{
				if (sDt2[bh][4] != b_r)
				{
					sDt2[bh][4] = b_r;
					ObjArr[bh].rB.innerHTML = "&nbsp;<img src=http://img.7m.cn/icon/r" + b_r + ".gif>";
					//if (SelectGoalTips)
//					{
//						Gold(1,
//							sDt2[bh][1] + "-" + sDt2[bh][2], 
//							Replace_Team_name(sDt[bh][2]), 
//							"<img src=http://img.7m.cn/icon/r" + b_r + ".gif>&nbsp;<font color=#FF0000>" + Replace_Team_name(sDt[bh][3]) + "</font>", 
//							sDt[bh][0] + (ObjArr[bh].ptime.style.display == "" ? "[" + ObjArr[bh].ptime.innerHTML + "]": ""), 
//							"#" + sDt[bh][1]);
//					}
//					InsertInfo("<img src=http://img.7m.cn/icon/r" + b_r + ".gif>&nbsp;",
//							   Replace_Team_name(sDt[bh][2]),
//							   sDt2[bh][1] + "-" + sDt2[bh][2],
//							   "<font color=#FF0000>" + Replace_Team_name(sDt[bh][3]) + "</font>&nbsp;");
//					speakBred = true;
//					RedSound = true;
				}
			}
			else
			{
				sDt2[bh][4] = b_r;
				ObjArr[bh].rB.innerHTML = "";
			}
			
			if (Banc != "")
			{
				if (Banc == "-")
					Banc = "";
				sDt2[bh][6] = Banc;
				ObjArr[bh].hscore.innerHTML = Banc;
			}
		}
		
		
	//}
	//catch(e){}
}


function Update_Live_(liveNode)
{
	
	var Start_Time = liveNode[9];
	
	var bh = liveNode[0];
	var IsStart = liveNode[1];

	
	if(MId != bh) return;
	
	
	if(!((IsStart >= 1 && IsStart <= 4) || IsStart == 15)) 
	{
		document.getElementById("live_score").style.display = "none";
		return;
	}
	
	var live_a = liveNode[2];
	var live_b = liveNode[3];
	var Start_Time = liveNode[9];
	
	
	if (Start_Time != "")
	{
		document.getElementById("bssj").innerHTML = getDateStr1(Start_Time);
	}
	
	var live_a_o = document.getElementById("la");
	var live_b_o = document.getElementById("lb");	
	
	if (live_a_o.innerHTML.replace(" ","") == "")
	{			
		live_a_o.innerHTML = "0";
	}
	
	if (live_b_o.innerHTML.replace(" ","") == "")
	{ 
		live_b_o.innerHTML = "0";
	}
	
	document.getElementById("live_score").style.display = "";
	
			
	if (live_a != live_a_o.innerHTML.replace(" ",""))
	{					
		live_a_o.innerHTML = live_a;			
	}

	if (live_b != live_b_o.innerHTML.replace(" ",""))
	{
		live_b_o.innerHTML = live_b;	
	}
	
}


function InsertMain(matchNo,rowobj){ 
	//alert(22)
	//var tbMain=$("trTop").parentNode;
//	var trTop=$("trTop").rowIndex;
//	var trTopOver=$("trTopOver").rowIndex;
//	var trMain=$("trMain").rowIndex;

	//var trOver=0;
//	if($("gameover") != null){
//		trOver=$("gameover").rowIndex;
//	}else{
//		trOver=0;
//		//
//	}

	var tbMain=document.getElementById("gameover");
	//if(trOver != 0 && (sDt2[matchNo][0] == 4 || sDt2[matchNo][0] == 6 || sDt2[matchNo][0] == 10 || (sDt2[matchNo][0] >= 12 && sDt2[matchNo][0] <= 15))){
		//插入完场
	var isInserted = false;
 
		//if(trOver+1 < tbMain.rows.length ){
//		    if(tbMain.rows[trOver+1].tabIndex > rowobj.tabIndex)
//			{
//			   tbMain.rows[trOver+1].insertAdjacentElement("beforeBegin",resobj);
//			   resobj.insertAdjacentElement("beforeBegin",rowobj);
//			   isInserted=true;
//			}else{
//				for(var i=trOver+1;i<tbMain.rows.length;i=i+2){ 
//					if( (i+2 < tbMain.rows.length)  && tbMain.rows[i].tabIndex < rowobj.tabIndex && tbMain.rows[i+2].tabIndex > rowobj.tabIndex){
//						isInserted=true;
//						tbMain.rows[i+2].insertAdjacentElement("beforeBegin",resobj);
//						resobj.insertAdjacentElement("beforeBegin",rowobj);
//						break;
//					}
//				}
//			}
//		}
 
	if(isInserted==false){
		tbMain.appendChild(rowobj);
		//tbMain.appendChild(resobj);
	}
	document.getElementById("gameover").style.display = "";
	//}else{
//		//插入主体 
//		var isInserted = false; 
//	  	if(tbMain.rows[trMain+1].id != "gameover" && tbMain.rows[trMain+1].tabIndex > rowobj.tabIndex){
//			isInserted=true;
//			tbMain.rows[trMain+1].insertAdjacentElement("beforeBegin",resobj);
//			resobj.insertAdjacentElement("beforeBegin",rowobj);
//		}else{
//			var total_tr = trOver == 0?$("live_Table").rows.length:trOver;
//			for(var i=trMain+1;i<total_tr;i=i+2){
//				if(tbMain.rows[i+2].id !="gameover" && tbMain.rows[i].tabIndex < rowobj.tabIndex && tbMain.rows[i+2].tabIndex > rowobj.tabIndex){
//					isInserted=true;
//					tbMain.rows[i+2].insertAdjacentElement("beforeBegin",resobj);
//					resobj.insertAdjacentElement("beforeBegin",rowobj);
//					break;
//				}
//			}
//			
//		} 
//		if(isInserted==false){
//			if($("gameover") != null){
//				$("gameover").insertAdjacentElement("beforeBegin",resobj);
//				resobj.insertAdjacentElement("beforeBegin",rowobj);
//			}
//		}
//	   
//	}
}

function ChangeOdds(odds)
{
	if(odds == "&nbsp;" || odds == "")
		return odds;
	if(odds == 0)
	{
		return RQ_ARR1[Math.abs(odds*4)];	
	}
	else if(odds > 0)
	{		
		return sign[0] + RQ_ARR1[Math.abs(odds*4)];	
	}
	return sign[1] + RQ_ARR1[Math.abs(odds*4)];	
}

function ChangeOdds1(odds)
{
	if(odds == "&nbsp;" || odds == "")
		return odds;
		
	return RQ_ARR1[Math.abs(odds*4)];	
}

function ChangeOver(over){
	if(over == "&nbsp;" || over == "")
		return over;
	return RQ_ARR1[Math.abs(over*4)];	
}

function getCookie(name)   
{  
	var arr = document.cookie.match(new RegExp("(^|)"+name+"=([^;]*)(;|$)"));   
	if(arr != null)  
		return unescape(arr[2]);   
	return   null;   
}   

function setCookie(name,value)   
{   
 	var Days = 30;   //此   cookie   将被保存   30   天   
	var exp = new Date();         //new   Date("December   31,   9998");   
	exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);   
	document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();   
} 

function selLiveType(type)
{
	document.getElementById("ls").innerHTML = "<div class=\"cbox_com\"><br />"+contentText[66]+"<br /><br/>"+contentText[67]+"</div>";
	
	resetPheight();
	
	setCookie("oddslivetype", type);
	
	var rnd = new Date().getTime();
	var src = parent.document.getElementById("Matchframe").src;
	
	if(src.indexOf("?") > 0 )
		parent.document.getElementById("Matchframe").src = src+"&date=" + rnd;
	else
		parent.document.getElementById("Matchframe").src = src+"?date=" + rnd;
}

function setReadWord()
{
	
	var sups = frames["Matchframe"].document.getElementsByTagName("sup");
	//alert(sups.length)
	for(var i=0; i<sups.length; i++)
	{
		if(sups[i].style.display == "none")
		{
			sups[i].style.display = "";
		}
		else
		{
			sups[i].style.display = "none";
		}
	}
}
