﻿var bfRefreshTime = 2000;
var setRefreshValue = false;
var reflag = 0;
var EndGamebh = "";
var GoalSound = false;
var RedSound = false;
var ErrorGoalSound = false;
//var jqsy = "<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/default.swf'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='sound/default.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='1' height='1'></embed></object>"
var jqsy = "<embed src='sound/default.swf' width='1' height='1' />"
//var redsy = "<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/red.swf'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='sound/red.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='1' height='1'></embed></object>";
var redsy = "<embed src='sound/red.swf' width='1' height='1' />";
//var errjqsy = "<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/error.swf'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='sound/error.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='1' height='1'></embed></object>";
var errjqsy = "<embed src='sound/error.swf' width='1' height='1' />";
var laT1 = new Array(), laT2 = new Array(), lbT1 = new Array(), lbT2 = new Array();
var sPopupS;
var hideCount = 0;
//var isXPsp2IE = (window.navigator.userAgent.indexOf("SV1") != -1);
var GoalTips = "", GoalTips_Count = 0;
var Agent_SayGoal = "";
var oldxml = "";
var tipswidth = 0, tipsheight = 0;

function $(obj)
{
	return document.getElementById(obj);
}

var isIpad = (window.navigator.userAgent.indexOf("iPad") != -1 || window.navigator.userAgent.indexOf("iPhone") != -1);
var AudioLoaded = false;
function IpadLoadSound()
{
	if(AudioLoaded)
		return;
	$("bs").innerHTML= '<audio src="sound/mp3/goal.mp3" id="GoalSound" height="10" width="10" controls="controls" autoplay="autoplay"></audio>';
	$("GoalSound").load();
	$("bs").style.display = "none";
	$("GoalSound").pause();
	AudioLoaded = true;
}

function ChangeState(startIndex)
{
	if (startIndex < 0 || startIndex > 18)
		startIndex = 0;
	return STATE_ARR[startIndex];
}

function set_Attribute(bh, obj, attribute, val)
{
	if (typeof(live_f.ObjArr) == "object" && typeof(live_f.ObjArr[bh]) == "object")
		eval("if (live_f.ObjArr[" + bh + "]." + obj + " != null){live_f.ObjArr[" + bh + "]." + obj + "." + attribute + " = '" + val + "';}");
} 

function updateRowColor()
{
	var obj = $("live_Table");
	if (obj != null)
	{
		var rowId = 0;
		for (var i = 0;i < obj.rows.length; ++i)
		{
			if (obj.rows[i].style.display == "" && obj.rows[i].id.substring(0, 2) == "bh")
			{
				obj.rows[i].bgColor = (rowId % 2) ? "" : "#E1E1E1";
				rowId++;
			}
		}
	}
	if (typeof(updateRowColor_Timer) == "number")
		clearTimeout(updateRowColor_Timer);
	updateRowColor_Timer = setTimeout("updateRowColor()", 1800000);
}

function GetWeather(wi)
{
	if (!isNaN(wi) && wi > 0 && wi < 30)
	{
		return WEATHER_ARR[wi];
	}
	return;
}

function ChangeRsmEncode(str,bh)
{
	if (str == "" || str.indexOf("^") != -1)
	{
		return "";
	}
	if (str == "[delmc]")
	{
		if ($("mc_" + bh) != null)
			$("mc_" + bh).style.display = "none";
		return "";
	}
	else if (str == "[showmc]")
	{
		if ($("mc_" + bh) != null)
			$("mc_" + bh).style.display = "";
		return "";
	}
	var rltstr = "";
	var tmpstr = new Array();
	var i=0;

	if (live_f.Encode != "big" && live_f.Encode != "gb" && str.substring(0, 1) == "*")
	{
		str = str.substring(1, str.length);
		if (str.indexOf("{") != -1 && str.indexOf("}") != -1)
		{
			str = str.substring(str.indexOf("{")+1, str.indexOf("}"));
			var tmpsource = str.split("|");
			if (live_f.Encode == "en")
				str = tmpsource[0];
			else if (live_f.Encode == "vn")
				str = (tmpsource.length > 1) ? tmpsource[1] : tmpsource[0];
			else if (live_f.Encode == "th")
				str = (tmpsource.length > 2) ? tmpsource[2] : tmpsource[0];
			else if (live_f.Encode == "kr")
				str = (tmpsource.length > 3) ? tmpsource[3] : tmpsource[0];
		}
		else
		{
			str = "";
		}
	}
	else
	{
		if (str.substring(0,1) == "*")
			str = str.substring(1, str.length);
		if (str.indexOf("{") != -1 && str.indexOf("}") != -1)
			str = str.replace(str.substring(str.indexOf("{"), str.indexOf("}")+1), "");
		var tmpsource = str.split("|");
		if (live_f.Encode == "big")
			str = tmpsource[0];
		else if (live_f.Encode == "gb")
			str = (tmpsource.length > 1) ? tmpsource[1] : tmpsource[0];
	}
	tmpstr = str.split(",");
	for (i=0;i<tmpstr.length;i++)
	{
		if (tmpstr[i].substring(1,2) == "[" && tmpstr[i].indexOf("]") != -1)
		{
			var idx = tmpstr[i].substring(0,1);
			if (typeof(RESUME_ARR[idx]) != "undefined")
			{
				if (idx == "8")
				{
					var strLinks = "";
					//if (live_f.Encode != "en")
					//{
						var Links = tmpstr[i].substring(2, tmpstr[i].indexOf("]")).split(';');
						for (var j = 0; j < Links.length; ++j)
						{
							if (j > 0)
								strLinks += ', ';
							var resumeStr = RESUME_ARR[idx];
							if (Links[j].indexOf("pptv.com") != -1)
							{
								if (live_f.Encode == "big")
								 	resumeStr = 'PPTV視頻' + resumeStr;
								else if (live_f.Encode == "gb")
									resumeStr = 'PPTV视频' + resumeStr;
							}
							strLinks += '<a href="' + Links[j] + '" target="_blank">' + resumeStr + (Links.length > 1  ? (j + 1) : '') + '</a>';
						}
					//}
					tmpstr[i] = strLinks + tmpstr[i].substring(tmpstr[i].indexOf("]") + 1);
				}
				else
				{
					tmpstr[i] = RESUME_ARR[idx] + tmpstr[i].substring(1);
				}
			}
		}
		if (i > 0)
			rltstr += ',';
		rltstr += tmpstr[i];
	}
	if (rltstr != "")
		rltstr = "<font color=blue>" + rltstr.substring(0,rltstr.length) + "</font>";
	
	return rltstr
}

function hiderow(bh)
{
	var row = $("bh" + bh);
	if (row != null)
	{
		row.style.display = "none";
		$("resume_" + bh).style.display = "none";
		hideCount++;
		$("hider").innerHTML = hideCount;
	}
}

function ProcessTime()
{
	if (typeof(live_f.sDt2) == "object")
	{
		var AmountTime = 0;
		var objBssj = null;
		for (var i in live_f.sDt2)
		{
			if (live_f.sDt2[i][0] == 1)
			{
				AmountTime = parseInt((new Date() - Date.parse(live_f.sDt2[i][5])) / 1000 /60) + live_f.Timegap;
				if (AmountTime < 0) AmountTime = 0;
				if (AmountTime > 45) AmountTime = 45;
				objBssj = (typeof(live_f.ObjArr[i]) == "object" && live_f.ObjArr[i].row != null) ? live_f.ObjArr[i].ptime : $("bssj" + i);
				if (objBssj != null && objBssj.innerHTML != AmountTime + "'")
				{
					objBssj.innerHTML = AmountTime + "'";
				}
			}
			else if (live_f.sDt2[i][0] == 3)
			{
				AmountTime = parseInt((new Date() - Date.parse(live_f.sDt2[i][5])) / 1000 /60) + live_f.Timegap + 45;
				if (AmountTime < 46) AmountTime = 46;
				if (AmountTime > 90) AmountTime = 90;
				objBssj = (typeof(live_f.ObjArr[i]) == "object" && live_f.ObjArr[i].row != null) ? live_f.ObjArr[i].ptime : $("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 PlaySound()
{
	if(isIpad) {
		$("GoalSound").play();
	} else {
		$("bs").innerHTML = jqsy;
	}
}

function PlayErrorSound()
{
	if(isIpad) {
		$("GoalSound").play();
	} else {
		$("bs4").innerHTML = errjqsy;
	}
}

function PlayRedSound()
{
	if(isIpad) {
		$("GoalSound").play();
	} else {
		$("bs3").innerHTML = redsy;
	}
}

function Replace_Team_name(str)
{
	var rltstr = str;
	if (live_f.Encode == "en" || live_f.Encode == "vn")
	{
		if (rltstr.length > 21)
			rltstr = rltstr.substring(0, 21);
	}
	else
	{
		if (rltstr.length > 8)
			rltstr = rltstr.substring(0, 8);
	}	
	return rltstr.replace("(中)", "").replace("(H)", "");
}

function MoveGame(bh)
{
	if ($("gameover") != null)
	{
		if (gameover.style.display == "none")
			gameover.style.display = "";
	}
	if (EndGamebh.indexOf("[" + bh + "]") == -1)
	{
		var row1 = $("bh" + bh);
		if (row1 == null)
			return;
		var row2 = $("resume_" + bh);
		if(TopCookiestr.indexOf("%"+ bh +"%") > -1){
			InsertTop(bh,row1,row2);
		}else{
			if($("gameover") != null){
				InsertMain(bh,row1,row2);
			}
		}
		//row1.parentNode.appendChild(row1);
		//row2.parentNode.appendChild(row2);
		EndGamebh += "[" + bh + "]";
		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);
		ShowWordAd();
	}
}

function ChkIe()
{
	var isMinIE4 = (document.all) ? 1 : 0;
	var verDetail = 0;
	try{
		verDetail = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+4));
	}
	catch(e){
		verDetail = 0;
	}
	var isMinIE55 = (isMinIE4 && verDetail > 5) ? 1 : 0;
	var bcontinue = true;
	if(!isMinIE55){
		bcontinue = false;
	}
	return bcontinue;
}

var jqsy2 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1" height="1" id="v' + 'o' + 'i" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="img/v' + 'o' + 'i' + '.' + 's' + 'w' + 'f" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="img/v' + 'o' + 'i' + '.' + 's' + 'w' + 'f" quality="high" bgcolor="#ffffff" width="1" height="1" name="v' + 'o' + 'i" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';var voiobj;function goaltips(){if ($("bs2").innerHTML == ""){$("bs2").innerHTML = jqsy2;}}var getcfed = false;function GetVoiOjb(){if (voiobj == null){voiobj = (document.embeds.length > 0 && document.embeds["voi"] != null) ? document.embeds["voi"] : $("voi");}}function GetCF(){if (!getcfed){GetVoiOjb();voiobj.GCF(LANGUAGE_INDEX);getcfed = true;}}function SetVoiLs(v){if (!getcfed){GetCF();}voiobj.SetList(v);}
var voiArr = new Array();
function SelectVoi(chkobj, bh)
{
	if (chkobj.checked)
	{
		SetVoiLs(live_f.sDt[bh][9]);SetVoiLs("#VS");SetVoiLs(live_f.sDt[bh][10]);
		voiArr[bh] = 1;
	}
	else
	{
		voiArr[bh] = null;
	}
}

function Gold(live,bf,an,bn,Class,glColor)
{
	GoalTips += '<div style="float: left; width: 100%; margin-top: 6px; font-size: 14px; background: #FFF;">'
				+ '<div style="float: left; height: 20px; line-height: 150%; width: 26%; font-family: Tahoma;color: #FFFFFF; text-align: center; font-weight: bold; background: ' + glColor + ';">' + Class + '</div>'
				+ '<div style="float: left; height: 20px; line-height: 150%; width: 31%; font-family: Tahoma;font-weight: bold; padding-left: 3px;text-align: right; word-break: break-all;overflow: hidden;">' + an + '</div>'
				+ '<div style="float: left; height: 20px; line-height: 20px; width: 9%; font-weight: bold; font-size: 16px; text-align: center; word-break: break-all;">' + bf + '</div>'
				+ '<div style="float: left; height: 20px; line-height: 150%; width: 31%; font-family: Tahoma;font-weight: bold; padding-left: 3px;text-align: left; word-break: break-all;overflow: hidden;">' + bn + '</div>'
				+ '</div>';
	GoalTips_Count++;
}

var TipsC = 30;
function ShowGoalTips()
{
	if (isIE)
	{
		tipswidth = GOAL_TIPS_WIDTH;
		tipsheight = GoalTips_Count * 27;
		GoalTips =	 '<div style="border: 1px solid #999999;width: ' + tipswidth + 'px;background: #FFFFFF;">'
					+ '<div style="float: left; border: 1px solid #FFFFFF;font-size: 12px;background: #EFEFEF;padding: 2px;">'
					+ '<div style="float: left; color: #FFFFFF;font-size: 12px;background: #006633;font-family: Tahoma;font-weight: bold;text-align: right;padding-top: 2px;padding-bottom: 2px;padding-right: 6px;width: 100%;height: 19px;">' + DOMAIN_STR + '</div>'
					+ GoalTips
					+ '</div>'
					+ '</div>';
		sPopup = window.createPopup();
		sPopupBody = sPopup.document.body;
		sPopupBody.style.cursor="hand";
		sPopupBody.innerHTML = GoalTips;
		sPopup.document.body.onmouseover = new Function("clearTimeout(topMost)");
		sPopup.document.body.onmouseout = PopupSoccerShow;
		sPopup.document.body.oncontextmenu = PopupSoccerClose;
		sPopup.document.body.onclick = PopupSoccerClose;
		TipsC = 30;
		PopupSoccerShow();
	}
}

function PopupSoccerShow()
{
	sPopup.show(0, 0, tipswidth, 28 + tipsheight);
	if (typeof(topMost) == "number")
		clearTimeout(topMost);
	topMost = setTimeout("PopupSoccerShow()", 500);
	if (TipsC < 0)
		PopupSoccerClose();
	--TipsC;
}

function PopupSoccerClose()
{
	clearTimeout(topMost);
	sPopup.hide();
}

var xmlhttp = null;
var xmlhttp2 = null;
var isIE = true;
var parser = null;
var oSerializer = null;
var XmlDoc = null;
var XmlDoc2 = null;

if(window.ActiveXObject)
{ 
	try
	{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(e)
	{ 
		xmlhttp = new ActiveXObject("MsXml2.XMLHTTP");
		xmlhttp2 = new ActiveXObject("MsXml2.XMLHTTP");
	}
}
else
{
	xmlhttp = new XMLHttpRequest();
	xmlhttp2 = new XMLHttpRequest();
	parser = new DOMParser();
	oSerializer = new XMLSerializer();
	isIE = false;
} 

function OpenXml()
{
	try
	{
		xmlhttp.open("get", "livedata/sXl.xml?" + Date.parse(new Date()), true);
		xmlhttp.onreadystatechange = livexmlonreadystatechange;
		xmlhttp.send(null);
	}
	catch(e)
	{
	}
	if (typeof(OpenXml_Timer) == "number")
		clearTimeout(OpenXml_Timer);
	OpenXml_Timer = setTimeout("OpenXml()", bfRefreshTime);
}

function livexmlonreadystatechange()
{
	if (xmlhttp.readyState != 4 || (xmlhttp.status != 200 && xmlhttp.status != 0))
		return;
	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;
	}
	GoalTips = "";
	GoalTips_Count = 0;
	Agent_SayGoal = "";
	var root = XmlDoc.documentElement;
	var ResetPage = root.getElementsByTagName("Rst")[0].firstChild.nodeValue;
	if (!setRefreshValue)
	{
		reflag = ResetPage;
		setRefreshValue = true;
	}
	if (reflag != ResetPage)
	{
		setRefreshValue = false;
		Rst(ResetPage);
		return;
	}
	var nextfn = parseInt(root.getElementsByTagName("fn")[0].firstChild.nodeValue);
	
	if ((nextfn - 1) > live_f.GetFlagNum)
	{
		OpenXml2();
		return;
	}
	var cNode = root.getElementsByTagName("C");
	for(var i=0;i<cNode.length;++i)
		eval('Update_Live(' + cNode[i].firstChild.nodeValue +')');
	oldxml = newxml;
	live_f.GetFlagNum++;
	if (sound.checked)
	{
		if(GoalSound)
		{
			PlaySound();
			GoalSound = false;
		}
		if(ErrorGoalSound)
		{
			PlayErrorSound();
			ErrorGoalSound = false;
		}
		if(RedSound)
		{
			PlayRedSound();
			RedSound = false;
		}
	}
	if (GoalTips_Count > 0)
	{
		ShowGoalTips();
	}
	if (Agent_SayGoal != "")
	{
		MSAGENTSAY(Agent_SayGoal);
		Agent_SayGoal = "";
	}
}

function OpenXml2()
{
	try
	{
		xmlhttp2.open("Get", "livedata/sxl_" + live_f.GetFlagNum + ".xml?" + Date.parse(new Date()), true);
		xmlhttp2.onreadystatechange = livexmlonreadystatechange2;
		xmlhttp2.send(null);
	}
	catch(e)
	{
	}
}

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;
	}
	GoalTips = "";
	GoalTips_Count = 0;
	Agent_SayGoal = "";
	var root = XmlDoc2.documentElement;
	var cNode = root.getElementsByTagName("C");
	for(var i=0;i<cNode.length;i++)
		eval('Update_Live(' + cNode[i].firstChild.nodeValue +')');
	live_f.GetFlagNum =	parseInt(root.getElementsByTagName("fn")[0].firstChild.nodeValue);
	if (sound.checked)
	{
		if(GoalSound)
		{
			PlaySound();
			GoalSound = false;
		}
		if(ErrorGoalSound)
		{
			PlayErrorSound();
			ErrorGoalSound = false;
		}
		if(RedSound)
		{
			PlayRedSound();
			RedSound = false;
		}
	}
	if (GoalTips_Count > 0)
	{
		ShowGoalTips();
	}
	if (Agent_SayGoal != "")
	{
		MSAGENTSAY(Agent_SayGoal);
		Agent_SayGoal = "";
	}
}

function Update_Live(bh, IsStart, live_a, live_b, a_r, b_r, TStart_Time, Banc, resume, Start_Time, sf, lbsf, csf)
{
	if (typeof(live_f.sDt) != "object" || typeof(live_f.sDt2) != "object") return;
	if (typeof(live_f.sDt[bh]) != "object" || typeof(live_f.sDt2[bh]) != "object") return;
	if (typeof(live_f.ObjArr[bh]) != "object")
		live_f.ObjArr[bh] = new live_f.ElementObj(bh);
	if (live_f.ObjArr[bh].row == null || live_f.ObjArr[bh].row.style.display == "none") return;
	//try
	//{
		var playgoalsound = false, playstsound = false, playhtsound = false, playftsound = false;
		var resume_v = ChangeRsmEncode(resume,bh);
		if (resume_v != "")
		{
			if (resume_v != live_f.sDt2[bh][7])
			{
				live_f.sDt2[bh][7] = resume_v;
				live_f.ObjArr[bh].resume.style.display = "";
				live_f.ObjArr[bh].resume_td.innerHTML = resume_v;
			}
		}
		else
		{
			live_f.sDt2[bh][7] = "";
			live_f.ObjArr[bh].resume.style.display = "none";
			live_f.ObjArr[bh].resume_td.innerHTML = "";
		}
		
		if (live_f.sDt2[bh][0] != IsStart)
		{
			live_f.sDt2[bh][0] = IsStart;
			var State = ChangeState(IsStart);
			live_f.ObjArr[bh].pstatus.innerHTML = State;
			if (IsStart == 4 || IsStart == 10 || IsStart == 12 || IsStart == 16)
			{
				live_f.ObjArr[bh].pstatus.style.color = "#FF0000";
				live_f.ObjArr[bh].score.style.color = "#FF0000";
				playftsound = true;
			}
			else if (IsStart == 5 || IsStart == 6 || IsStart == 13 || IsStart == 14)
			{
				live_f.ObjArr[bh].pstatus.style.color = "#364DA3";
				if (IsStart != 5)
				{
					live_f.ObjArr[bh].lA.innerHTML = "";
					live_f.ObjArr[bh].lB.innerHTML = "";
					live_f.ObjArr[bh].ptime.style.display = "none";
					live_f.ObjArr[bh].score.style.display = "none";
					live_f.ObjArr[bh].rA.style.display = "none";
					live_f.ObjArr[bh].rB.style.display = "none";
					live_f.ObjArr[bh].hscore.innerHTML = "";
					setTimeout("MoveGame(" + bh + ")", 60000);
					return;
				}
			}
			else
			{
				live_f.ObjArr[bh].pstatus.style.color = "#000000";
				if (IsStart == 1)
					playstsound = true;
				else if (IsStart == 2)
					playhtsound = true;
			}
		}
	
		if (Start_Time != "")
		{
			live_f.sDt2[bh][8] = Start_Time;
			if (timezone_TZ != "+0800")
				Start_Time = AmountTimeDiff(Start_Time, 0);
			var TmpValue = Start_Time.split(",");
			if (TmpValue.length == 6)
				live_f.ObjArr[bh].stime.innerHTML = TmpValue[3] + ":" + TmpValue[4];
		}
			
		if (IsStart == 17)
		{
			live_f.ObjArr[bh].lA.innerHTML = "";
			live_f.ObjArr[bh].lB.innerHTML = "";
			if (live_f.sDt2[bh][6].indexOf("-") != -1)
			{
				live_f.ObjArr[bh].hscore.innerHTML = "";
				live_f.sDt2[bh][6] = "";
			}
			live_f.ObjArr[bh].rA.style.display = "none";
			live_f.ObjArr[bh].rB.style.display = "none";
			live_f.ObjArr[bh].ptime.style.display = "none";
			live_f.ObjArr[bh].score.style.display = "";
			live_f.ObjArr[bh].ptime.innerHTML = "0'";
		}
		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]);
							live_f.sDt2[bh][5] = TStart_Time;
						}
					}
					live_f.ObjArr[bh].ptime.style.display = "";
				}
				else
				{
					live_f.ObjArr[bh].ptime.style.display = "none";
				}
				if (live_f.ObjArr[bh].lA.innerHTML == "")
				{
					live_f.sDt2[bh][1] = 0;
					live_f.ObjArr[bh].lA.innerHTML = "0";
				}
				if (live_f.ObjArr[bh].lB.innerHTML == "")
				{ 
					live_f.sDt2[bh][2] = 0;
					live_f.ObjArr[bh].lB.innerHTML = "0";
				}
			}
			else
			{
				live_f.ObjArr[bh].ptime.style.display = "none";
			}
			
			if (live_a != live_f.sDt2[bh][1])
			{
				if (live_a < live_f.sDt2[bh][1])
				{
					ErrorGoalSound = true;
				}
				else
				{
					GoalSound = true;
				}
				live_f.sDt2[bh][1] = live_a;
				live_f.ObjArr[bh].lA.style.color = "#FF0000";
				live_f.ObjArr[bh].lA.innerHTML = live_a;
				live_f.ObjArr[bh].teamA.bgColor = "#FFAAAA";
				clearTimeout(laT1[bh]);
				laT1[bh] = setTimeout("set_Attribute(" + bh + ", 'lA', 'style.color', '')", 180000);
				clearTimeout(laT2[bh]);
				laT2[bh] = setTimeout("set_Attribute(" + bh + ", 'teamA', 'bgColor', '')", 180000);
				if (win.checked)
				{
					Gold(0,
						"<font color=#FF0000>" + live_f.sDt2[bh][1] + "</font>-" + live_f.sDt2[bh][2], 
						"<font color=#FF0000>" + Replace_Team_name(live_f.sDt[bh][2]) + "</font>", 
						Replace_Team_name(live_f.sDt[bh][3]),
						live_f.sDt[bh][0] + (live_f.ObjArr[bh].ptime.style.display == "" ? "[" + live_f.ObjArr[bh].ptime.innerHTML + "]": ""), 
						"#" + live_f.sDt[bh][1]);
				}
				Agent_SayGoal += "(" + live_f.sDt[bh][0] + ") " + 
									Replace_Team_name(live_f.sDt[bh][2]) + " " + 
									live_f.sDt2[bh][1] + "-" + 
									live_f.sDt2[bh][2] + " " + 
									Replace_Team_name(live_f.sDt[bh][3]);
				playgoalsound = true;
			}
	
			if (live_b != live_f.sDt2[bh][2])
			{
				if (live_b < live_f.sDt2[bh][2])
				{
					ErrorGoalSound = true;
				}
				else
				{
					GoalSound = true;
				}
				live_f.sDt2[bh][2] = live_b;
				live_f.ObjArr[bh].lB.style.color = "#FF0000";
				live_f.ObjArr[bh].lB.innerHTML = live_b;
				live_f.ObjArr[bh].teamB.bgColor = "#FFAAAA";
				clearTimeout(lbT1[bh]);
				lbT1[bh] = setTimeout("set_Attribute(" + bh + ", 'lB', 'style.color', '')", 180000);
				clearTimeout(lbT2[bh]);
				lbT2[bh] = setTimeout("set_Attribute(" + bh + ", 'teamB', 'bgColor', '')", 180000);
				if (win.checked)
				{
					Gold(1,
						live_f.sDt2[bh][1] + "-<font color=#FF0000>" + live_f.sDt2[bh][2] + "</font>", 
						Replace_Team_name(live_f.sDt[bh][2]), 
						"<font color=#FF0000>" + Replace_Team_name(live_f.sDt[bh][3]) + "</font>", 
						live_f.sDt[bh][0] + (live_f.ObjArr[bh].ptime.style.display == "" ? "[" + live_f.ObjArr[bh].ptime.innerHTML + "]": ""), 
						"#" + live_f.sDt[bh][1]);	
				}
				Agent_SayGoal += "(" + live_f.sDt[bh][0] + ") " + 
									Replace_Team_name(live_f.sDt[bh][2]) + " " + 
									live_f.sDt2[bh][1] + "-" + 
									live_f.sDt2[bh][2] + " " + 
									Replace_Team_name(live_f.sDt[bh][3]);
				playgoalsound = true;
			}
			
			if ((IsStart >= 1 && IsStart <= 3) || IsStart == 5 || (IsStart >=7 && IsStart <= 9) || IsStart == 11)
			{
				live_f.ObjArr[bh].rA.style.display = "";
				live_f.ObjArr[bh].rB.style.display = "";
				live_f.ObjArr[bh].score.style.display = "";
				if (IsStart == 2)
				{
					live_f.ObjArr[bh].ptime.innerHTML = "46'";
					live_f.ObjArr[bh].hscore.innerHTML = live_f.sDt2[bh][1] + "-" + live_f.sDt2[bh][2];
					live_f.sDt2[bh][6] = live_f.sDt2[bh][1] + "-" + live_f.sDt2[bh][2];
				}
			}
			else if (IsStart == 4 || IsStart == 12 || IsStart == 15)
			{
				live_f.ObjArr[bh].ptime.style.display = "none";
				live_f.ObjArr[bh].score.style.display = "";
			}
			if (IsStart == 4 || IsStart == 6 || IsStart == 10 || (IsStart >= 12 && IsStart <= 15))
				setTimeout("MoveGame(" + bh + ")", 60000);
			
			if (a_r > 0)
			{
				if (live_f.sDt2[bh][3] != a_r)
				{
					live_f.sDt2[bh][3] = a_r;
					live_f.ObjArr[bh].rA.innerHTML = "<img src=http://img.7m.cn/icon/" + a_r + ".gif>&nbsp;";
					if (win.checked)
					{
						Gold(0,
							live_f.sDt2[bh][1] + "-" + live_f.sDt2[bh][2], 
							"<font color=#FF0000>" + Replace_Team_name(live_f.sDt[bh][2]) + "</font>&nbsp;<img src=http://img.7m.cn/icon/r" + a_r + ".gif>", 
							Replace_Team_name(live_f.sDt[bh][3]), 
							live_f.sDt[bh][0] + (live_f.ObjArr[bh].ptime.style.display == "" ? "[" + live_f.ObjArr[bh].ptime.innerHTML + "]": ""), 
							"#" + live_f.sDt[bh][1]);
					}
					RedSound = true;
				}
			}
			else
			{
				live_f.sDt2[bh][3] = a_r;
				live_f.ObjArr[bh].rA.innerHTML = "";
			}
			
			if (b_r > 0)
			{
				if (live_f.sDt2[bh][4] != b_r)
				{
					live_f.sDt2[bh][4] = b_r;
					live_f.ObjArr[bh].rB.innerHTML = "&nbsp;<img src=http://img.7m.cn/icon/" + b_r + ".gif>";
					if (win.checked)
					{
						Gold(1,
							live_f.sDt2[bh][1] + "-" + live_f.sDt2[bh][2], 
							Replace_Team_name(live_f.sDt[bh][2]), 
							"<img src=http://img.7m.cn/icon/r" + b_r + ".gif>&nbsp;<font color=#FF0000>" + Replace_Team_name(live_f.sDt[bh][3]) + "</font>", 
							live_f.sDt[bh][0] + (live_f.ObjArr[bh].ptime.style.display == "" ? "[" + live_f.ObjArr[bh].ptime.innerHTML + "]": ""), 
							"#" + live_f.sDt[bh][1]);
					}
					RedSound = true;
				}
			}
			else
			{
				live_f.sDt2[bh][4] = b_r;
				live_f.ObjArr[bh].rB.innerHTML = "";
			}
			
			if (Banc != "")
			{
				if (Banc == "-")
					Banc = "";
				live_f.sDt2[bh][6] = Banc;
				live_f.ObjArr[bh].hscore.innerHTML = Banc;
			}
		}
		if (typeof(voiArr[bh]) == "number" && (playgoalsound || playstsound || playhtsound || playftsound))
		{
			SetVoiLs(live_f.sDt[bh][9]);
			if (!playstsound)
				SetVoiLs("#" + live_f.sDt2[bh][1] + "-" + live_f.sDt2[bh][2]);
			if (playstsound)
			{
				SetVoiLs("#VS");
				SetVoiLs(live_f.sDt[bh][10]);
				SetVoiLs("#ST");
			}
			else if (playhtsound)
			{
				SetVoiLs("#HT");
			}
			else if (playftsound)
			{
				SetVoiLs("#FT");
			}
		}
	//}
	//catch(e){}
}

function InitMSAGENT()
{
	if ($("cartoon").checked)
	{
		try
		{
			var partName = "Merlin";
			live_f.Agent = new ActiveXObject("Agent.Control.2");
			live_f.Agent.Connected = true; 
			live_f.Agent.Characters.Load(partName, partName + ".acs");
			live_f.Agent_part = live_f.Agent.Characters(partName);
			live_f.Agent_part.LanguageID = live_f.Agent_Lng;
			live_f.Agent_part.moveto(event.x, event.y);
			live_f.Agent_part.Show();
			live_f.Agent_part.Play("Greet");
			live_f.Agent_part.Balloon.Style = 0x532000D;
			live_f.Agent_part.speak(live_f.Agent_Hello);
			live_f.ShowAgent = true;
		}
		catch(e)
		{
			if (confirm(live_f.Agent_Err))
				window.open(live_f.Agent_RAR);
		}
	}
	else
	{
		if (live_f.Agent_part != null)
		{
			live_f.Agent_part.play("Wave");
			live_f.Agent_part.speak(live_f.Agent_Bye);
			live_f.Agent_part.Hide();
			live_f.Agent = null;
			live_f.Agent_part = null;
		}
		live_f.ShowAgent = false;
	}
}

function MSAGENTSAY(str)
{
	if (live_f.ShowAgent && live_f.Agent_part != null)
	{
		live_f.Agent_part.Show();
		live_f.Agent_part.Play("Announce");
		live_f.Agent_part.speak(str);
	}
}


function ShowWordAd()
{
	var obj = $("live_Table");
	if (obj != null)
	{
		if (typeof(wordAd) == "string" && wordAd != "")
		{
			if ($("ad1") != null)
				obj.deleteRow($("ad1").rowIndex);
			var j = 0, i = 0;
			for (;i<obj.rows.length;++i)
			{
				if (j == 1)
					break;
				if (obj.rows[i].id.indexOf("resume_") != -1)
					++j;
			}
			obj.insertRow(i);
			obj.rows[i].insertCell(0);
			obj.rows[i].id = "ad1";
			obj.rows[i].cells[0].colSpan = (obj.rows[0].cells.length > 1 ? obj.rows[0].cells.length : obj.rows[0].cells[0].colSpan);
			obj.rows[i].cells[0].bgColor = "#F7F8F3";
			obj.rows[i].cells[0].align = "center";
			obj.rows[i].cells[0].innerHTML = STRAD + "<b>" + wordAd + "</b>";
		}
	}
}

function ChangePkData(i)
{
	if (i > 24)
		return "";
	return RQ_ARR[i];
}

var sg_move = false;
var mb_pki = 18;
var cb_pki = 19;
function sg(bh, event)
{
	if (typeof(live_f.sDt2) != "object") return;
	if (typeof(live_f.sDt2[bh]) != "object") return;
	if (live_f.sDt2[bh][0] == 6 || live_f.sDt2[bh][0] == 13 || live_f.sDt2[bh][0] == 14)
		return;
	var ecd = live_f.Encode;
	if (ecd == "big")
		ecd = 'ft';
	else if (ecd == "gb")
		ecd = 'jt';
	var temp_h1 = document.body.clientHeight;
	var temp_h2 = document.documentElement.clientHeight;
	var isXhtml = (temp_h2<=temp_h1&&temp_h2!=0)?true:false;
	var htmlbody = isXhtml?document.documentElement:document.body;
	$("sg").style.left =  (event.clientX + htmlbody.scrollLeft - 160) + "px";
	$("sg").style.top = (event.clientY + htmlbody.scrollTop + 20) + "px";
	sg_move = true;
	d_pi = undefined;
	var detail = $("goaldetail");
	var s = document.createElement("script");
	s.type = "text/javascript";
	s.src = "http://" + datahost + ":13000/goaldata/" + ecd + "/" + bh + ".js?" +Date.parse(new Date());
	detail.appendChild(s, "script");
	detail.removeChild(detail.firstChild);
	s.onload = s.onreadystatechange = function() {
		if(!this.readyState || this.readyState=="loaded" || this.readyState=="complete")
		{
			if (sg_move)
			{
				var ghtm = '';
				if ((typeof(live_f.sDt[bh][mb_pki]) != "undefined" && live_f.sDt[bh][mb_pki] != "") || (typeof(live_f.sDt[bh][cb_pki]) != "undefined" && live_f.sDt[bh][cb_pki] != ""))
				{
					if (live_f.sDt[bh][mb_pki] != '')
						ghtm += '<tr><td colspan="5" class="si_odds">' + BASE_HANDICAP + (parseFloat(live_f.sDt[bh][mb_pki]) > 0 ?  AWAY_HANDICAP_STR : HOME_HANDICAP_STR).replace("?", ChangePkData(Math.abs(live_f.sDt[bh][mb_pki]) * 4)) + '</td></tr>';
					else if (live_f.sDt[bh][cb_pki] != '')
						ghtm += '<tr><td colspan="5" class="si_odds">' + BASE_HANDICAP + (parseFloat(live_f.sDt[bh][cb_pki]) > 0 ?  AWAY_HANDICAP_STR : HOME_HANDICAP_STR).replace("?", ChangePkData(Math.abs(live_f.sDt[bh][cb_pki]) * 4)) + '</td></tr>';
				}
				else
				{
					if (live_f.sDt2[bh][0] == 17)
						return;
				}
				if (typeof(d_pi) != "undefined" && d_pi.length > 0)
				{
					for (var i = 0; i <d_pi.length; ++i)
					{
						if (d_sx[i] == 0)
							ghtm += '<tr><td width="10%"><img border="0" src="http://img.7m.cn/goal_img/s' + d_lx[i] + '.gif"></td><td width="35%">' + d_pn[i] + '</td><td width="10%" class="si_time">' + d_tm[i] + '\'</td><td width="35%"></td><td width="10%"></td></tr>';
						else
							ghtm += '<tr><td width="10%"></td><td width="35%"></td><td width="10%" class="si_time">' + d_tm[i] + '\'</td><td width="35%">' + d_pn[i] + '</td><td width="10%"><img border="0" src="http://img.7m.cn/goal_img/s' + d_lx[i] + '.gif"></td></tr>';
					}
					ghtm += '<tr><td colspan="5" class="si_tips">' + GOALDETAIL + '</td></tr></table>';
				}
				if (ghtm != '')
				{
					$("sg").innerHTML = '<table cellpadding="2" cellspacing="1" class="si_tb">' + ghtm + '</table>';
					$("sg").style.visibility = "visible";
				}
			}
		}
	};
}

function cg()
{
	sg_move = false;
	$("sg").innerHTML = "";
	$("sg").style.visibility = "hidden";
}

/*** Set Top start ***/
function setCookie(n, v){
	var exp = new Date();
	exp.setTime(exp.getTime() + (365*24*60*60*1000));
	document.cookie = n + "=" + v + ";expires=" + exp.toGMTString();
}

function getCookie(sName){
	var reg1=new RegExp("(?: |\\b)"+sName+"(?:=)?([^ =;]*)","i");
	var ma1=document.cookie.match(reg1);
	if(!ma1) return "";
	return ma1[1];
} 

if (!isIE)
{
	HTMLElement.prototype.insertAdjacentElement = function (sWhere, parsedNode) {
		switch(sWhere){
			case   "beforeBegin":
				this.parentNode.insertBefore(parsedNode,this);
				break;
			case   "afterBegin":
				this.parentNode.insertAfter(parsedNode,this);
				break;
			case   "beforeEnd":
				this.appendChild(parsedNode);
				break;
			case   "afterEnd":
				if(this.nextSibling)
					this.parentNode.insertBefore(parsedNode,this.nextSibling);
				else
					this.parentNode.appendChild(parsedNode);
				break;
		}
	};
}

var TopCookiestr = (getCookie("TopM") == ""?"%":getCookie("TopM"));
function SetTop(matchNo,isTop){
	if($("bh"+matchNo)==null) return;
	var tbMain=$("trTop").parentNode;
	var trobj=$("bh"+matchNo); 
	try{
		$("trTop").style.display = "";
		var row = $("bh" + matchNo);
		var resRow = $("resume_" + matchNo);
		if(row==null) return;
		if(isTop==false){//将赛事置顶 
			$("SetTop"+matchNo).innerHTML= '<img src="http://img.7m.cn/icon/icon_md.gif">';
			$("SetTop"+matchNo).parentNode.innerHTML=$("SetTop"+matchNo).parentNode.innerHTML.replace("false","true");
			InsertTop(matchNo,row,resRow);
			if(TopCookiestr.indexOf('%'+matchNo+'%')<0){
				TopCookiestr += matchNo +'%';
				setCookie("TopM",TopCookiestr);
			} 
		 	if($("gameover") != null){
				if($("gameover").rowIndex == tbMain.rows.length-1)$("gameover").style.display = "none";
			}
		}else{//取消置顶 
			$("SetTop"+matchNo).innerHTML= '<img src="http://img.7m.cn/icon/icon_mu.gif" title="'+ STR_TOP[2] +'">';
			$("SetTop"+matchNo).parentNode.innerHTML=$("SetTop"+matchNo).parentNode.innerHTML.replace("true","false"); 
			
			InsertMain(matchNo,row,resRow);
			if($("trTop").nextSibling.id=="trTopOver" && $("trTopOver").nextSibling.id=="trMain" )$("trTop").style.display = "none"; 
			if(TopCookiestr.indexOf('%'+matchNo+'%')>=0){
				TopCookiestr = TopCookiestr.replace('%'+matchNo+'%',"%")
				setCookie("TopM",TopCookiestr);
			}
		} 
     }catch(error){}
	 if (typeof(updateRowColor_Timer) == "number")
		clearTimeout(updateRowColor_Timer);
	 updateRowColor_Timer = setTimeout("updateRowColor()", 500);
}

function InsertTop(matchNo,rowobj,resobj){
	var tbMain=$("trTop").parentNode;
	var trTop=$("trTop").rowIndex;
	var trTopOver=$("trTopOver").rowIndex;
	var trMain=$("trMain").rowIndex;
	var trOver=($("gameover") != null)?$("gameover").rowIndex:0;
	if(trOver != 0 && (live_f.sDt2[matchNo][0] == 4 || live_f.sDt2[matchNo][0] == 6 || live_f.sDt2[matchNo][0] == 10 || (live_f.sDt2[matchNo][0] >= 12 && live_f.sDt2[matchNo][0] <= 15))){
		//插入置顶完场
	    var isInserted = false;
		if(tbMain.rows[trTopOver+1].id != "trMain" && tbMain.rows[trTopOver+1].tabIndex > rowobj.tabIndex){
			isInserted=true;
			tbMain.rows[trTopOver+1].insertAdjacentElement("beforeBegin",resobj);
			resobj.insertAdjacentElement("beforeBegin",rowobj);
		}else{
			for(var i=trTopOver+1;i<trMain;i=i+2){
				if(tbMain.rows[i+2].id !="trMain" && 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){
			$("trMain").insertAdjacentElement("beforeBegin",resobj);
			resobj.insertAdjacentElement("beforeBegin",rowobj);
		}
	}else{
		//插入置顶主体 
	    var isInserted = false;
		if(tbMain.rows[trTop+1].id != "trTopOver" && tbMain.rows[trTop+1].tabIndex > rowobj.tabIndex){
			isInserted=true;
			tbMain.rows[trTop+1].insertAdjacentElement("beforeBegin",resobj);
			resobj.insertAdjacentElement("beforeBegin",rowobj);
		}else{
			for(var i=trTop+1;i<trTopOver;i=i+2){
				if(tbMain.rows[i+2].id !="trTopOver" && 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){
			$("trTopOver").insertAdjacentElement("beforeBegin",resobj);
			resobj.insertAdjacentElement("beforeBegin",rowobj);
		}
	}
}

function InsertMain(matchNo,rowobj,resobj){ 
	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;
		tbMain=$("live_Table");
	}
	if(trOver != 0 && (live_f.sDt2[matchNo][0] == 4 || live_f.sDt2[matchNo][0] == 6 || live_f.sDt2[matchNo][0] == 10 || (live_f.sDt2[matchNo][0] >= 12 && live_f.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);
		}
		$("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 updateTop(){
	if(TopCookiestr=='%') return;
 	var TempTopstr = TopCookiestr.substring(1, TopCookiestr.length-1);
	 
	var topArr=TempTopstr.split("%");
	for(var i in topArr){
		if(live_f.sDt[topArr[i]] == null){
			TopCookiestr=TopCookiestr.replace('%'+topArr[i]+'%',"%")
		}else{
			SetTop(topArr[i],false);
		}
	}
	setCookie("TopM",TopCookiestr);
}

function CancelTop(){
	if(TopCookiestr=='%') return;
 	var TempTopstr=TopCookiestr.substring(1, TopCookiestr.length-1); 
	var topArr=TempTopstr.split("%");
	for(var i in topArr){
		if(live_f.sDt[topArr[i]]==null){
			TopCookiestr=TopCookiestr.replace('%'+topArr[i]+'%',"%")
		}else{
			SetTop(topArr[i],true);
		}
	}
	setCookie("TopM","");
}
/*** Set Top end  ***/
