﻿
if(window.navigator.userAgent.indexOf("MSIE")==-1){ //firefox innerText define
   isIE=false;
	 HTMLElement.prototype.__defineGetter__(	"innerText", 
		function(){ 
			return this.textContent; 
		} 
	); 
	HTMLElement.prototype.__defineSetter__(	"innerText", 
		function(sText){ 
			this.textContent=sText; 
		} 
	); 
		
}
var coldXml = "";
var REFTIME = 10000;
var SHOWTIME = 180000;
var clTimeout = new Array(new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), 
						new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), 
						new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), 
						new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array(), new Array());
						
var xmlhttp=null;
var isIE=true;
var parser=null;
var oSerializer=null;
var list = new Array();
var rebuilder;
var soundflag=true;


if(window.ActiveXObject)
{		 
	xmlhttp= new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
else
{
	xmlhttp= new XMLHttpRequest();
	parser = new DOMParser();
	oSerializer = new XMLSerializer();
	isIE=false;
}



function openData(flag)
{ 
	if(typeof(rebuilder)!="undefined")
		clearTimeout(rebuilder);
	try
	{
			xmlhttp.open("get","/xml/" + xml + "?"+Date.parse(new Date()),true);
			xmlhttp.onreadystatechange=LoadData ;
			xmlhttp.send(null);
	}catch(e)
{}
	
	if(flag)
 rebuilder=setTimeout("openData",600000);
 
}



		


function openGlobalData()
{
	xmlhttp.open("get", "/xml/odds_config.xml?" + Date.parse(new Date()), true);
	xmlhttp.onreadystatechange=loadGlobalData;
	xmlhttp.send(null);
}


function ShowSound(obj,lan)
{	
		if(soundflag)
		{
			soundflag=false;
			obj.src="http://img.7m.cn/img2/lb_a2.gif";
		}
		else
		{
			soundflag=true;
			obj.src="http://img.7m.cn/img2/lb_a1.gif";
		}
		if(lan=="big")
			obj.title= soundflag?"點擊:關閉提示音":"點擊:開啟提示音";
		else if(lan=="gb")
			obj.title= soundflag?"点击，关闭提示音":"点击，开启提示音";
		else if(lan=="en")
			obj.title= soundflag?"Sound Off":"Sound On";	
}







function s_time(sDate)
{
	return sDate.substr(9,5);
}

function playPkSound()
{
	if (soundflag)
	{
		pk.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='1' HEIGHT='1'><param name='movie' value='/sound/s1.swf'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='/sound/s1.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='1' height='1'></embed></object>";
	}
}

function playPlSound()
{
	if (soundflag)
	{
		pl.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='1' HEIGHT='1'><param name='movie' value='/sound/s2.swf'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='/sound/s2.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='1' height='1'></embed></object>";
	}
}

function set_attribute(eid, attribute, color)
{
	if (document.getElementById(eid) != null)
		eval("document.getElementById(\"" + eid + "\")." + attribute + "=\"" + color + "\"");
}
/***********************************************************************************************************************/

function ModifyWinOddsData(fn)
{
	try
	{
		xmlhttp.open("Get","/xml/" + fn + "?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =WinOddsChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifyWinOddsData('" +  fn + "')", REFTIME);
	
	
}



function WinOddsChange()
{
	
	if(xmlhttp.readyState !=4) return;
	
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var pksound = false;
	var plsound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var gg = root[i].getAttribute("gg");
		var g = root[i].getAttribute("g");
		var ho = root[i].getAttribute("ho");
		var ao = root[i].getAttribute("ao");
		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("r" + id).g != g || document.getElementById("r" + id).gg != gg)
			{
				var kg = (g == "H") ? "-" : "+";
				var tg = (kg == "-") ? "+" : "-";
				if (gg <= 1)
				{
					kg = "";
					tg = "";
				}
				document.getElementById("kg" + id).innerText = '[' + kg + gg + ']';
				document.getElementById("tg" + id).innerText = '[' + tg + gg + ']';
				var color = "";
				if (parseFloat(document.getElementById("r" + id).gg) < gg)
					color = "#FF6600";
				else if (parseFloat(document.getElementById("r" + id).gg) > gg)
					color = "#99CC00";
				if (color != "")
				{
					document.getElementById("kg" + id).style.backgroundColor = color;
					document.getElementById("tg" + id).style.backgroundColor = color;
					clearTimeout(clTimeout[0][id]);
					clearTimeout(clTimeout[1][id]);
					clTimeout[0][id] = setTimeout("set_attribute('kg" + id + "', 'style.backgroundColor', '')", SHOWTIME);
					clTimeout[1][id] = setTimeout("set_attribute('tg" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				}
				document.getElementById("r" + id).g = g;
				document.getElementById("r" + id).gg = gg;
				pksound = true;
			}
			if (document.getElementById("ho" + id).innerText != ho || document.getElementById("ao" + id).innerText != ao)
			{
				if (parseFloat(document.getElementById("ho" + id).innerText) < ho)
					document.getElementById("ho" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ho" + id).innerText) > ho)
					document.getElementById("ho" + id).style.backgroundColor = "#99CC00";
				if (parseFloat(document.getElementById("ao" + id).innerText) < ao)
					document.getElementById("ao" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ao" + id).innerText) > ao)
					document.getElementById("ao" + id).style.backgroundColor = "#99CC00";
				document.getElementById("ho" + id).innerText = ho;
				document.getElementById("ao" + id).innerText = ao;
				clearTimeout(clTimeout[2][id]);
				clearTimeout(clTimeout[3][id]);
				clTimeout[2][id] = setTimeout("set_attribute('ho" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[3][id] = setTimeout("set_attribute('ao" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				plsound = true;
			}
		}
	}
	if (pksound)
		playPkSound();
	if (plsound)
		playPlSound();
	coldXml =xml;
}
/***********************************************************************************************************************/

function ModifySelfWin()
{
	try
	{
		xmlhttp.open("Get","/xml/selfwin.xml?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =SelfWinChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifySelfWin()", REFTIME);
}

function SelfWinChange()
{
	if(xmlhttp.readyState !=4) return;
	
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var sound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var ho = root[i].getAttribute("ho");
		var ao = root[i].getAttribute("ao");
		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("ho" + id).innerText != ho || document.getElementById("ao" + id).innerText != ao)
			{
				if (parseFloat(document.getElementById("ho" + id).innerText) < ho)
					document.getElementById("ho" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ho" + id).innerText) > ho)
					document.getElementById("ho" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("ao" + id).innerText) < ao)
					document.getElementById("ao" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ao" + id).innerText) > ao)
					document.getElementById("ao" + id).style.backgroundColor = "#99CC00";
				document.getElementById("ho" + id).innerText = ho;
				document.getElementById("ao" + id).innerText = ao;
				clearTimeout(clTimeout[0][id]);
				clearTimeout(clTimeout[1][id]);
				clTimeout[0][id] = setTimeout("set_attribute('ho" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[1][id] = setTimeout("set_attribute('ao" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				sound = true;
			}
		}
	}
	if (sound)
		playPlSound();
	coldXml = xml;
}
/***********************************************************************************************************************/

function ModifyOverUnder(fn)
{
	try
	{
		xmlhttp.open("Get","/xml/" + fn + "?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =OverUnderChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifyOverUnder('" +  fn + "')", REFTIME);
	
}

function OverUnderChange()
{
	if(xmlhttp.readyState !=4) return;
	
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var sound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var oo = root[i].getAttribute("oo");
		var pts = root[i].getAttribute("pts");
		var uo = root[i].getAttribute("uo");
		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("oo" + id).innerText != oo || document.getElementById("uo" + id).innerText != uo || 
				document.getElementById("pts1" + id).innerText != pts || document.getElementById("pts2" + id).innerText != pts)
			{
				if (parseFloat(document.getElementById("oo" + id).innerText) < oo)
					document.getElementById("oo" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("oo" + id).innerText) > oo)
					document.getElementById("oo" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("uo" + id).innerText) < uo)
					document.getElementById("uo" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("uo" + id).innerText) > uo)
					document.getElementById("uo" + id).style.backgroundColor = "#99CC00";
				if (document.getElementById("pts1" + id).innerText != pts || document.getElementById("pts2" + id).innerText != pts)
				{
					document.getElementById("pts1" + id).className = "bh1";
					document.getElementById("pts2" + id).className = "bh1";
				}
				document.getElementById("pts1" + id).innerText = pts;
				document.getElementById("pts2" + id).innerText = pts;
				document.getElementById("oo" + id).innerText = oo;
				document.getElementById("uo" + id).innerText = uo;
				clearTimeout(clTimeout[0][id]);
				clearTimeout(clTimeout[1][id]);
				clearTimeout(clTimeout[2][id]);
				clearTimeout(clTimeout[3][id]);
				clTimeout[0][id] = setTimeout("set_attribute('oo" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[1][id] = setTimeout("set_attribute('uo" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[2][id] = setTimeout("set_attribute('pts1" + id + "', 'className', '')", SHOWTIME);
				clTimeout[3][id] = setTimeout("set_attribute('pts2" + id + "', 'className', '')", SHOWTIME);
				sound = true;
			}
		}
	}
	if (sound)
		playPlSound();
	coldXml = xml;
}
/***********************************************************************************************************************/

function ModifyOddEven()
{
	try
	{
		xmlhttp.open("Get","/xml/oddeven.xml?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =OddEvenChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifyOddEven()", REFTIME);
	
}

function OddEvenChange()
{
	if(xmlhttp.readyState !=4) return;
	
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var sound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var oo = root[i].getAttribute("oo");
		var eo = root[i].getAttribute("eo");
		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("oo" + id).innerText != oo || document.getElementById("eo" + id).innerText != eo)
			{
				if (parseFloat(document.getElementById("oo" + id).innerText) < oo)
					document.getElementById("oo" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("oo" + id).innerText) > oo)
					document.getElementById("oo" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("eo" + id).innerText) < eo)
					document.getElementById("eo" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("eo" + id).innerText) > eo)
					document.getElementById("eo" + id).style.backgroundColor = "#99CC00";
				
				document.getElementById("oo" + id).innerText = oo;
				document.getElementById("eo" + id).innerText = eo;
				
				clearTimeout(clTimeout[0][id]);
				clearTimeout(clTimeout[1][id]);

				clTimeout[0][id] = setTimeout("set_attribute('oo" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[1][id] = setTimeout("set_attribute('eo" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				sound = true;
			}
		}
	}
	if (sound)
		playPlSound();
	coldXml = xml;
}
/***********************************************************************************************************************/

function ModifyWinMargin()
{	
	try
	{
		xmlhttp.open("Get","/xml/winmargin.xml?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =WinMarginChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifyWinMargin()", REFTIME);
	
	
}

function WinMarginChange()
{
		if(xmlhttp.readyState !=4) return;
	
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var sound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var h1 = root[i].getAttribute("h1");
		var h2 = root[i].getAttribute("h2");
		var h3 = root[i].getAttribute("h3");
		var h4 = root[i].getAttribute("h4");
		var h5 = root[i].getAttribute("h5");
		var h6 = root[i].getAttribute("h6");
		var h7 = root[i].getAttribute("h7");
		var a1 = root[i].getAttribute("a1");
		var a2 = root[i].getAttribute("a2");
		var a3 = root[i].getAttribute("a3");
		var a4 = root[i].getAttribute("a4");
		var a5 = root[i].getAttribute("a5");
		var a6 = root[i].getAttribute("a6");
		var a7 = root[i].getAttribute("a7");

		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("h1" + id).innerText != h1 || document.getElementById("h2" + id).innerText != h2 ||
				document.getElementById("h3" + id).innerText != h3 || document.getElementById("h4" + id).innerText != h4 ||
				document.getElementById("h5" + id).innerText != h5 || document.getElementById("h6" + id).innerText != h6 ||
				document.getElementById("h7" + id).innerText != h7 ||
				document.getElementById("a1" + id).innerText != a1 || document.getElementById("a2" + id).innerText != a2 ||
				document.getElementById("a3" + id).innerText != a3 || document.getElementById("a4" + id).innerText != a4 ||
				document.getElementById("a5" + id).innerText != a5 || document.getElementById("a6" + id).innerText != a6 ||
				document.getElementById("a7" + id).innerText != a7)
			{
				if (parseFloat(document.getElementById("h1" + id).innerText) < h1)
					document.getElementById("h1" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h1" + id).innerText) > h1)
					document.getElementById("h1" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("h2" + id).innerText) < h2)
					document.getElementById("h2" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h2" + id).innerText) > h2)
					document.getElementById("h2" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("h3" + id).innerText) < h3)
					document.getElementById("h3" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h3" + id).innerText) > h3)
					document.getElementById("h3" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("h4" + id).innerText) < h4)
					document.getElementById("h4" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h4" + id).innerText) > h4)
					document.getElementById("h4" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("h5" + id).innerText) < h5)
					document.getElementById("h5" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h5" + id).innerText) > h5)
					document.getElementById("h5" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("h6" + id).innerText) < h6)
					document.getElementById("h6" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h6" + id).innerText) > h6)
					document.getElementById("h6" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("h7" + id).innerText) < h7)
					document.getElementById("h7" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("h7" + id).innerText) > h7)
					document.getElementById("h7" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("a1" + id).innerText) < a1)
					document.getElementById("a1" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a1" + id).innerText) > a1)
					document.getElementById("a1" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("a2" + id).innerText) < a2)
					document.getElementById("a2" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a2" + id).innerText) > a2)
					document.getElementById("a2" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("a3" + id).innerText) < a3)
					document.getElementById("a3" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a3" + id).innerText) > a3)
					document.getElementById("a3" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("a4" + id).innerText) < a4)
					document.getElementById("a4" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a4" + id).innerText) > a4)
					document.getElementById("a4" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("a5" + id).innerText) < a5)
					document.getElementById("a5" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a5" + id).innerText) > a5)
					document.getElementById("a5" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("a6" + id).innerText) < a6)
					document.getElementById("a6" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a6" + id).innerText) > a6)
					document.getElementById("a6" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("a7" + id).innerText) < a7)
					document.getElementById("a7" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("a7" + id).innerText) > a7)
					document.getElementById("a7" + id).style.backgroundColor = "#99CC00";
					
				document.getElementById("h1" + id).innerText = h1;
				document.getElementById("h2" + id).innerText = h2;
				document.getElementById("h3" + id).innerText = h3;
				document.getElementById("h4" + id).innerText = h4;
				document.getElementById("h5" + id).innerText = h5;
				document.getElementById("h6" + id).innerText = h6;
				document.getElementById("h7" + id).innerText = h7;
				
				document.getElementById("a1" + id).innerText = a1;
				document.getElementById("a2" + id).innerText = a2;
				document.getElementById("a3" + id).innerText = a3;
				document.getElementById("a4" + id).innerText = a4;
				document.getElementById("a5" + id).innerText = a5;
				document.getElementById("a6" + id).innerText = a6;
				document.getElementById("a7" + id).innerText = a7;

				clearTimeout(clTimeout[0][id]);
				clearTimeout(clTimeout[1][id]);
				clearTimeout(clTimeout[2][id]);
				clearTimeout(clTimeout[3][id]);
				clearTimeout(clTimeout[4][id]);
				clearTimeout(clTimeout[5][id]);
				clearTimeout(clTimeout[6][id]);
				clearTimeout(clTimeout[7][id]);
				clearTimeout(clTimeout[8][id]);
				clearTimeout(clTimeout[9][id]);
				clearTimeout(clTimeout[10][id]);
				clearTimeout(clTimeout[11][id]);
				clearTimeout(clTimeout[12][id]);
				clearTimeout(clTimeout[13][id]);
				
				clTimeout[0][id] = setTimeout("set_attribute('h1" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[1][id] = setTimeout("set_attribute('h2" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[2][id] = setTimeout("set_attribute('h3" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[3][id] = setTimeout("set_attribute('h4" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[4][id] = setTimeout("set_attribute('h5" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[5][id] = setTimeout("set_attribute('h6" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[6][id] = setTimeout("set_attribute('h7" + id + "', 'style.backgroundColor', '')", SHOWTIME);
			
				clTimeout[7][id] = setTimeout("set_attribute('a1" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[8][id] = setTimeout("set_attribute('a2" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[9][id] = setTimeout("set_attribute('a3" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[10][id] = setTimeout("set_attribute('a4" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[11][id] = setTimeout("set_attribute('a5" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[12][id] = setTimeout("set_attribute('a6" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[13][id] = setTimeout("set_attribute('a7" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				sound = true;
			}
		}
	}
	if (sound)
		playPlSound();
	coldXml = xml;
}
/***********************************************************************************************************************/

function ModifyTeamTotal()
{
	try
	{
		xmlhttp.open("Get","/xml/teamtotal.xml?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =TeamTotalChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifyTeamTotal()", REFTIME);
	
}

function TeamTotalChange()
{
	if(xmlhttp.readyState !=4) return;
	
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var sound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var hpts = root[i].getAttribute("hpts");
		var ho = root[i].getAttribute("ho");
		var hu = root[i].getAttribute("hu");
		var apts = root[i].getAttribute("apts");
		var ao = root[i].getAttribute("ao");
		var au = root[i].getAttribute("au");
		
		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("hpts" + id).innerText != hpts || document.getElementById("apts" + id).innerText != apts ||
				document.getElementById("ho" + id).innerText != ho || document.getElementById("hu" + id).innerText != hu ||
				document.getElementById("ao" + id).innerText != ao || document.getElementById("au" + id).innerText != au)
			{
				if (parseFloat(document.getElementById("hpts" + id).innerText) < hpts)
					document.getElementById("hpts" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("hpts" + id).innerText) > hpts)
					document.getElementById("hpts" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("apts" + id).innerText) < apts)
					document.getElementById("apts" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("apts" + id).innerText) > apts)
					document.getElementById("apts" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("ho" + id).innerText) < ho)
					document.getElementById("ho" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ho" + id).innerText) > ho)
					document.getElementById("ho" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("hu" + id).innerText) < hu)
					document.getElementById("hu" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("hu" + id).innerText) > hu)
					document.getElementById("hu" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("ao" + id).innerText) < ao)
					document.getElementById("ao" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ao" + id).innerText) > ao)
					document.getElementById("ao" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("au" + id).innerText) < au)
					document.getElementById("au" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("au" + id).innerText) > au)
					document.getElementById("au" + id).style.backgroundColor = "#99CC00";
				
				document.getElementById("hpts" + id).innerText = hpts;
				document.getElementById("apts" + id).innerText = apts;
				document.getElementById("ho" + id).innerText = ho;
				document.getElementById("hu" + id).innerText = hu;
				document.getElementById("ao" + id).innerText = ao;
				document.getElementById("au" + id).innerText = au;

				clearTimeout(clTimeout[0][id]);
				clearTimeout(clTimeout[1][id]);
				clearTimeout(clTimeout[2][id]);
				clearTimeout(clTimeout[3][id]);
				clearTimeout(clTimeout[4][id]);
				clearTimeout(clTimeout[5][id]);
				
				clTimeout[0][id] = setTimeout("set_attribute('hpts" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[1][id] = setTimeout("set_attribute('apts" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[2][id] = setTimeout("set_attribute('ho" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[3][id] = setTimeout("set_attribute('hu" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[4][id] = setTimeout("set_attribute('ao" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[5][id] = setTimeout("set_attribute('au" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				sound = true;
			}
		}
	}
	if (sound)
		playPlSound();
	coldXml = xml;
}
/***********************************************************************************************************************/
function ModifyHalfFull()
{
	
	try
	{
		xmlhttp.open("Get","/xml/halffull.xml?"+ Date.parse(new Date()), true);
		xmlhttp.onreadystatechange =HalfFullChange;
		xmlhttp.send(null);
	}
	catch(e){}
	//
	setTimeout("ModifyHalfFull()", REFTIME);
	
}

function HalfFullChange()
{
	if(xmlhttp.readyState !=4) return;
	var xmldoc=null;
	var xml;
	if(isIE)
	{
		xmldoc=xmlhttp.responseXML;
		xml=xmldoc.xml;
		if(xml==""||xml==coldXml) return;
	}
	else
	{
		
		xmldoc= parser.parseFromString(xmlhttp.responseText,"text/xml");
		if(xmldoc.documentElement.tagName=="parsererror") return;
		xml = oSerializer.serializeToString(xmldoc.documentElement);
		
		if(xml==coldXml) return;
	}
	var root = xmldoc.documentElement.getElementsByTagName("Fixture");
	var sound = false;
	for (var i=0;i<root.length;++i)
	{
		var id = root[i].getAttribute("id");
		var hh = root[i].getAttribute("hh");
		var ha = root[i].getAttribute("ha");
		var dh = root[i].getAttribute("dh");
		var da = root[i].getAttribute("da");
		var ah = root[i].getAttribute("ah");
		var aa = root[i].getAttribute("aa");
		if (document.getElementById("r" + id) != null)
		{
			if (document.getElementById("hh" + id).innerText != hh || document.getElementById("ha" + id).innerText != ha || 
				document.getElementById("dh" + id).innerText != dh || document.getElementById("da" + id).innerText != da ||
				document.getElementById("ah" + id).innerText != ah || document.getElementById("aa" + id).innerText != aa)
			{
				if (parseFloat(document.getElementById("hh" + id).innerText) < hh)
					document.getElementById("hh" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("hh" + id).innerText) > hh)
					document.getElementById("hh" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("ha" + id).innerText) < ha)
					document.getElementById("ha" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ha" + id).innerText) > ha)
					document.getElementById("ha" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("dh" + id).innerText) < dh)
					document.getElementById("dh" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("dh" + id).innerText) > dh)
					document.getElementById("dh" + id).style.backgroundColor = "#99CC00";
					
				if (parseFloat(document.getElementById("da" + id).innerText) < da)
					document.getElementById("da" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("da" + id).innerText) > da)
					document.getElementById("da" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("ah" + id).innerText) < ah)
					document.getElementById("ah" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("ah" + id).innerText) > ah)
					document.getElementById("ah" + id).style.backgroundColor = "#99CC00";
				
				if (parseFloat(document.getElementById("aa" + id).innerText) < aa)
					document.getElementById("aa" + id).style.backgroundColor = "#FF6600";
				else if (parseFloat(document.getElementById("aa" + id).innerText) > aa)
					document.getElementById("aa" + id).style.backgroundColor = "#99CC00";
					
				document.getElementById("hh" + id).innerText = hh;
				document.getElementById("ha" + id).innerText = ha;
				document.getElementById("dh" + id).innerText = dh;
				document.getElementById("da" + id).innerText = da;
				document.getElementById("ah" + id).innerText = ah;
				document.getElementById("aa" + id).innerText = aa;

				clearTimeout(clTimeout[0][id]);
				clearTimeout(clTimeout[1][id]);
				clearTimeout(clTimeout[2][id]);
				clearTimeout(clTimeout[3][id]);
				clearTimeout(clTimeout[4][id]);
				clearTimeout(clTimeout[5][id]);
				
				clTimeout[0][id] = setTimeout("set_attribute('hh" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[1][id] = setTimeout("set_attribute('ha" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[2][id] = setTimeout("set_attribute('dh" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[3][id] = setTimeout("set_attribute('da" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[4][id] = setTimeout("set_attribute('ah" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				clTimeout[5][id] = setTimeout("set_attribute('aa" + id + "', 'style.backgroundColor', '')", SHOWTIME);
				sound = true;
			}
		}
	}
	if (sound)
		playPlSound();
	coldXml = xml;
}
/***********************************************************************************************************************/


function ShowWordAd()
{
	var obj = document.getElementById("odds_tb");
	if (obj != null)
	{	
		
		var i;
		if (typeof(wordAd) == "string" && wordAd != "")
		{	
			if (typeof(document.all.ad1) == "object")
				obj.deleteRow(document.all.ad1.rowIndex);
			for (i=0;i<obj.rows.length;++i)
			{
				if(obj.rows[i].id=="") continue;
				i+= obj.rows[i].cells[0].rowSpan;
				break;
			}
			obj.insertRow(i);
			obj.rows[i].insertCell(0);
			obj.rows[i].id = "ad1";
			obj.rows[i].cells[0].colSpan = 100 ;
			obj.rows[i].cells[0].bgColor = "#FFFFFF";
			obj.rows[i].cells[0].align = "center";
			obj.rows[i].cells[0].innerHTML = wordAd;
		}
	
		if (typeof(wordAd2) == "string" && wordAd2 != "")
		{	
			if (typeof(document.all.ad2) == "object")
				obj.deleteRow(document.all.ad2.rowIndex);
			for (i=i+1;i<obj.rows.length;++i)
			{
				if(obj.rows[i].id=="") continue;
				i+= obj.rows[i].cells[0].rowSpan;
				break;
			}
			obj.insertRow(i);
			obj.rows[i].insertCell(0);
			obj.rows[i].id = "ad2";
			obj.rows[i].cells[0].colSpan = 100;
			obj.rows[i].cells[0].bgColor = "#FFFFFF";
			obj.rows[i].cells[0].align = "center";
			obj.rows[i].cells[0].innerHTML = wordAd2;
		}
	
		if (typeof(wordAd3) == "string" && wordAd3 != "")
		{	
			if (typeof(document.all.ad3) == "object")
				obj.deleteRow(document.all.ad3.rowIndex);
			for (i=i+1;i<obj.rows.length;++i)
			{
				if(obj.rows[i].id=="") continue;
				i+= obj.rows[i].cells[0].rowSpan;
				break;
			}
			obj.insertRow(i);
			obj.rows[i].insertCell(0);
			obj.rows[i].id = "ad3";
			obj.rows[i].cells[0].colSpan = 100;
			obj.rows[i].cells[0].bgColor = "#FFFFFF";
			obj.rows[i].cells[0].align = "center";
			obj.rows[i].cells[0].innerHTML = wordAd3;
		}
		
	}
}


