var iisound=false,flag=false;
var AllContestItem = "$";
var ShowItem = "$";
var HideGameid=",";
var g_match = 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 RangQiuName = new Array(30);//31
RangQiuName[0]="-";
RangQiuName[1]="平手";
RangQiuName[2]="平手/半球";
RangQiuName[3]="半球";
RangQiuName[4]="半球/一球";
RangQiuName[5]="一球";
RangQiuName[6]="一球/球半";
RangQiuName[7]="一球半";
RangQiuName[8]="球半/二球";
RangQiuName[9]="二球";
RangQiuName[10]="二球/二球半";
RangQiuName[11]="二球半";
RangQiuName[12]="二球半/三球";
RangQiuName[13]="三球";
RangQiuName[14]="三球/三球半";
RangQiuName[15]="三球半";
RangQiuName[16]="三球半/四球";
RangQiuName[17]="四球";
RangQiuName[18]="四球/四球半";
RangQiuName[19]="四球半";
RangQiuName[20]="四球半/五球";
RangQiuName[21]="五球";
RangQiuName[22]="五球/五球半";
RangQiuName[23]="五球半";
RangQiuName[24]="五球半/六球";
RangQiuName[25]="六球";
RangQiuName[26]="六球/六球半";
RangQiuName[27]="六球半";
RangQiuName[28]="六球半/七球";
RangQiuName[29]="七球";

var req=null,OldDoc=null;
function isIE(){ //ie? 
    if (window.navigator.userAgent.indexOf("MSIE")>=1)return true; 
    else return false; 
}
var isIE=isIE();
function initXMLHTTPRequest(){
var xRequest=null;
if(window.ActiveXObject){
try{xRequest=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){xRequest=new ActiveXObject("Msxml2.XMLHTTP");}
}
else if(window.XMLHttpRequest){xRequest=new XMLHttpRequest();}
return xRequest;
}

function sendRequest(url,params,HttpMethod)
{
if(!HttpMethod)HttpMethod="GET";
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=Oddsconreadystatechange;
req.open(HttpMethod,url,false);
req.setRequestHeader("Content_Type","application/x-www-form-urlencoded");
req.setRequestHeader("If-Modified-Since","0");
req.setRequestHeader("Cache-Control","no-cache");
req.send(params);
}
}
function ViOddsXml(){
//try{
sendRequest('xml/sjp_all.xml?fresh='+ Math.random());
//}
//catch(e){alert(e);}
}
function Oddsconreadystatechange(){
    try{
    //if ((req.readyState != 4)||(req.status!=200&&req.status!=0))return;
    if (req.readyState == 4){ //if  4
    //myxml.XMLDocument=req.responseXML;
    var xmlDoc=req.responseText;
    var el=null,em=null;//elChild
    var thehtml="";
    var strStart=xmlDoc.indexOf("<s>")+3;
	var strEnd=xmlDoc.indexOf("</s>");
	var mdata=xmlDoc.substring(strStart,strEnd);
    var el=mdata.split("$");
    for(var i=1;i<el.length;i++)
    {
    em=el[i].split("*");
    thehtml+=ther(em,i);
    }
    //var trfont="<tr style=\"visibility: hidden; height: 0px;\"><td width=16%>1</td><td>2</td><td width=20%>3</td><td>4</td><td>5</td><td>6</td><td width=20%>7</td><td>8</td><td>9</td><td>10</td><td>11</td></tr>";
thehtml="<table cellspacing=1 cellpadding=0  border=0 width=708 align=center bgColor=#A1BACB><tr style='font-size: 14px; color: #003366; height: 22px; vertical-align: middle; background-image:url(images/home/th_Bg.gif)'><th><b>赛事</b></th><th><b>时间</b></th><th><b>球队</b></th><th><b>赔率</b></th><th><b>让球</b></th><th><b>赔率</b></th><th><b>球队</b></th><th><b>大</b></th><th><b>球分</b></th><th>小</th><th></th></tr>"+thehtml+"</table>";
document.getElementById("maintext").innerHTML=thehtml;
OldDoc=null;
}// if  4
}
catch(e){}
}


function ther(em,count){
var str="";
var mcid=em[0];
if(em[1].length>5)em[1]=em[1].substr(0,5);
for(var j=0;j<em.length;j++){g_match[j][mcid]=em[j];}
if(AllContestItem.indexOf("$"+em[1]+"$")==-1){AllContestItem += em[1] + "$";}
if(HideGameid.indexOf("," + mcid + ",")!=-1 || (ShowItem!="$" && ShowItem.indexOf("$" + em[1] + "$")==-1))return "";//style=\"display='none';\"  //bgColor=#FFFF00
var itemcolor,rangqiu="",pl1="",pl2="",dpl="",xpl="";//赛类颜色
var colorcss="tr_color3";//行颜色
var runball="";//滚球
if((count%2)==0)colorcss="tr_color2";
if(em[5]!="")rangqiu=RangQiuName[em[5]];
else g_match[5][mcid]=0;
if(em[6]!=0)pl1=em[6];
if(em[7]!=0)pl2=em[7];
if(em[9]!=0)dpl=em[9];
if(em[10]!=0)xpl=em[10];
if(em[11]==1)runball="<img src=images/goal02.gif title=\"走地\">";
if(em[13]!="")runball=em[13];
//str+="<TABLE cellSpacing=1 cellPadding=0 width=100% align=center bgColor=#FDFDFB border=0 id=table_"+mcid+">";
str+="<TR class="+colorcss+" id=tr_"+mcid+" align=middle height=24>";
str+="<td class=item id=item_"+mcid+" bgColor=#"+em[12]+">&nbsp;<INPUT style=\"width:12px;\" onclick=\"AddHideMatch("+mcid+");return false;\" type=checkbox CHECKED>&nbsp;"+em[1]+"</td><td class=td_time id=mctime_"+mcid+">"+em[2]+"</td><td class=team1 id=team1_"+mcid+">"+em[3]+"</td>"+
     "<td class=td_pl id=pl1_"+mcid+">"+pl1+"</td><td class=rangqiu id=rangqiu_"+mcid+">"+rangqiu+"</td><td class=td_pl id=pl2_"+mcid+">"+pl2+"</td><td class=team2 id=team2_"+mcid+">"+em[4]+"</td>"+
     "<td class=td_pl2 id=dpl_"+mcid+">"+dpl+"</td><td class=dxqiu id=dxqiu_"+mcid+">"+em[8]+"</td><td class=td_pl2 id=xpl_"+mcid+">"+xpl+"</td><td class=runball id=runball_"+mcid+">"+runball+"</td></TR>";
//str+="</TABLE>";
return str;
}
ViOddsXml(); //window.onload=function(){ViOddsXml();}
setInterval("ViOddsXml()",240000);

function AddHideMatch(i)
{
HideGameid += i + ",";
document.getElementById("tr_"+i).style.display="none"
}

function getxmlRequest(url,params,HttpMethod)
{
if(!HttpMethod)HttpMethod="GET";
req=initXMLHTTPRequest();
if(req){
req.onreadystatechange=xmlDocTopreadystatechange;
req.open(HttpMethod,url,true);
req.setRequestHeader("Content_Type","application/x-www-form-urlencoded");
req.setRequestHeader("If-Modified-Since","0");
req.setRequestHeader("Cache-Control","no-cache");
req.send(params);
}
}
function xmlDocTopreadystatechange(){
    if ((req.readyState != 4)||(req.status!=200&&req.status!=0))return;
try{
    var xmlDoc=req.responseXML;
    var NewDoc="";
    var el=new Array(),em; //新文本,elChild
    var mcid,rangqiu,dxqiu,pl1="",pl2="",dpl="",xpl="";//id
    var flagSound=false;
//    var elcount=xmlDoc.getElementsByTagName("m").length;
//    for(var i=0;i<elcount;i++)//for1
//    {
//    el[i]=xmlDoc.getElementsByTagName("m")[i].firstChild.data;
//    NewDoc+=el[i];
//    }
    NewDoc=xmlDoc.getElementsByTagName("m")[0].firstChild.data;
    if(OldDoc==NewDoc){return;}
    var ell=NewDoc.split("$");
    for(var i=1;i<ell.length;i++)//for1
    {
    em=ell[i].split("*");
    mcid=em[0];
    if(document.getElementById("tr_"+mcid) && document.getElementById("tr_"+mcid).style.display!='none'){//fA
    if(em[1]=="")em[1]=0;
    else em[1]=parseInt(em[1]);
    pl1=em[2];pl2=em[3];
    
    if(em[2]!=0 && em[3]!=0){//0
    if(g_match[6][mcid]!=em[2]||g_match[7][mcid]!=em[3]||g_match[5][mcid]!=em[1]){//if,1
    if(g_match[6][mcid]!=em[2]){//1.1
    document.getElementById("pl1_"+mcid).innerHTML=em[2];
    if(g_match[6][mcid]!=0 && g_match[6][mcid] < em[2]){
    document.getElementById("pl1_"+mcid).style.color="#FFFFFF";
    document.getElementById("pl1_"+mcid).style.backgroundColor="#FF8888";
    pl1 = "<font color=red>" + em[2] +"</font>";
    }
    else if(g_match[6][mcid]!=0){//g_match[6][mcid] > em[2]
    document.getElementById("pl1_"+mcid).style.color="#FFFFFF";
    document.getElementById("pl1_"+mcid).style.backgroundColor="#60CC60";
    pl1 = "<font color=green>" + em[2] +"</font>";
    }
    }//end 1.1
    if(g_match[7][mcid]!=em[3]){document.getElementById("pl2_"+mcid).innerHTML=em[3];}
    g_match[6][mcid]=em[2];
    g_match[7][mcid]=em[3];
    rangqiu="<font color=#762D8E>" + RangQiuName[em[1]] + "</font>";
    document.getElementById("rangqiu_"+mcid).innerHTML=RangQiuName[em[1]];
    if(g_match[5][mcid]!=em[1]){//if,1.2
    if(g_match[5][mcid]!=0){//if ""
    if(g_match[5][mcid] < em[1]){
    document.getElementById("rangqiu_"+mcid).style.color="#E9480E";
    rangqiu="<font color=#E9480E>" + RangQiuName[em[1]] + "</font>";
    }
    else{
    document.getElementById("rangqiu_"+mcid).style.color="#0EA03E";
    rangqiu="<font color=#0EA03E>" + RangQiuName[em[1]] + "</font>";
    }
    }//end if ""
    }//end if,1.2
    g_match[5][mcid]=em[1];
    setTimeout("recolor(" + mcid + ")",24000);
    flagSound = true;
    GoalMessage(g_match[1][mcid],g_match[12][mcid],g_match[3][mcid],g_match[4][mcid],rangqiu,pl1,pl2);
    if(isIE==true&&flag==true)InsertInfo(g_match[3][mcid],g_match[4][mcid],rangqiu,pl1,pl2);
    }//end if,1
    }
    else
    {
    document.getElementById("pl1_"+mcid).innerHTML="";
    document.getElementById("pl2_"+mcid).innerHTML="";
    document.getElementById("rangqiu_"+mcid).innerHTML="";
    document.getElementById("pl1_"+mcid).style.backgroundColor="";
    g_match[6][mcid]=0;
    g_match[7][mcid]=0;
    }//0
    
    if(em[5]!=0 && em[6]!=0){//OU
    if(g_match[9][mcid]!=em[5]||g_match[10][mcid]!=em[6]||g_match[8][mcid]!=em[4]){//if,3
    if(g_match[9][mcid]!=em[5]){//3.1
    document.getElementById("dpl_"+mcid).innerHTML=em[5];
    if(g_match[9][mcid]!=0 && g_match[9][mcid] < em[5]){
    document.getElementById("dpl_"+mcid).style.color="#FFFFFF";
    document.getElementById("dpl_"+mcid).style.backgroundColor="#FF8888";
    }
    else if(g_match[9][mcid]!=0){//g_match[9][mcid] > em[5]
    document.getElementById("dpl_"+mcid).style.color="#FFFFFF";
    document.getElementById("dpl_"+mcid).style.backgroundColor="#60CC60";
    }
    }//end 3.1
    if(g_match[10][mcid]!=em[6]){document.getElementById("xpl_"+mcid).innerHTML=em[6];}
    document.getElementById("dxqiu_"+mcid).innerHTML=em[4];
    g_match[9][mcid]=em[5];
    g_match[10][mcid]=em[6];
    g_match[8][mcid]=em[4];
//    if(g_match[8][mcid]!=em[4]){//if,3-2
//    document.getElementById("dxqiu_"+mcid).innerHTML=em[4];
//    if(g_match[8][mcid]!=""){//if ""
//    if(g_match[8][mcid] < em[4]){
//    document.getElementById("dxqiu_"+mcid).style.color="#E9480E";
//    }
//    else{document.getElementById("dxqiu_"+mcid).style.color="#0EA03E";}
//    }//end if ""
//    g_match[8][mcid]=em[4];
//    }//end if,3-2
    setTimeout("recolor2(" + mcid + ")",24000);
    flagSound = true;
    }//end if,3
    }
    else
    {
    document.getElementById("dpl_"+mcid).innerHTML="";
    document.getElementById("xpl_"+mcid).innerHTML="";
    document.getElementById("dxqiu_"+mcid).innerHTML="";
    document.getElementById("dpl_"+mcid).style.backgroundColor="";
    g_match[9][mcid]=0;
    g_match[10][mcid]=0;
    }//OU
    
    if(em[9]!="" && g_match[13][mcid]!=em[9]){document.getElementById("runball_"+mcid).innerHTML=em[9];g_match[13][mcid]!=em[9];}
    
    }//End fA
    }//for1
    if((flagSound==true) && (iisound==true)){
	Esound.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'><param name='movie' value='sound/nba.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>";
	}
    OldDoc=NewDoc;
}
catch(e){}
}//End function

function recolor(mcid){
if(document.getElementById("tr_"+mcid)){
document.getElementById("pl1_"+mcid).style.color="";
document.getElementById("rangqiu_"+mcid).style.color="";
document.getElementById("pl1_"+mcid).style.backgroundColor="";
}
}
function recolor2(mcid){
if(document.getElementById("tr_"+mcid)){
document.getElementById("dpl_"+mcid).style.color="";
document.getElementById("dxqiu_"+mcid).style.color="";
document.getElementById("dpl_"+mcid).style.backgroundColor="";
}
}
function getCrownsOddsXml(){
getxmlRequest('xml/jp.xml?fresh='+ Math.random());
//getxmlRequest('xml/NewXml.xml?fresh='+ Math.random());
window.setTimeout("getCrownsOddsXml()", 2000);
}
window.setTimeout("getCrownsOddsXml()", 4000);
//window.setTimeout("ischecked()", 2000);

function hidefloter(){document.getElementById("floater").style.visibility="hidden";}

function InsertInfo(OneTeamName,TwoTeamName,RangQiuName,peilv_one,peilv_two)
{
	OneTeamName=OneTeamName.replace("[主]","");
	OneTeamName=OneTeamName.replace("[中]","");
	TwoTeamName=TwoTeamName.replace("[主]","");
	TwoTeamName=TwoTeamName.replace("[中]","");
	if(OneTeamName.length>4){OneTeamName=OneTeamName.substr(OneTeamName,4);}
	if(TwoTeamName.length>4){TwoTeamName=TwoTeamName.substr(TwoTeamName,4);}
	var OneTeamNameTMP="<font color=red>"+OneTeamName+"</font>";
	var TwoTeamNameTMP="<font color=blue>"+TwoTeamName+"</font>";
	last_info.insertRow(0);
	last_info.rows[0].insertCell();
	last_info.rows[0].cells[0].colSpan = 4;
	last_info.rows[0].cells[0].align = "center";
	last_info.rows[0].cells[0].innerHTML = "<img src=images/shade01.gif width=100% height=1>";
	last_info.insertRow(0);
	last_info.rows[0].insertCell();
	last_info.rows[0].insertCell();
	last_info.rows[0].insertCell();
	
	last_info.rows[0].cells[0].align = "left";
	last_info.rows[0].cells[0].innerHTML ="&nbsp;"+TwoTeamNameTMP;
	last_info.rows[0].cells[1].align = "center";
	last_info.rows[0].cells[1].innerHTML = "";
	last_info.rows[0].cells[2].align = "right";
	last_info.rows[0].cells[2].innerHTML = peilv_two+"&nbsp;";
	
	last_info.rows[0].cells[0].width = "40%";
	last_info.rows[0].cells[1].width = "40%";
	last_info.rows[0].cells[2].width = "20%";
	last_info.insertRow(0);
	last_info.rows[0].insertCell();
	last_info.rows[0].insertCell();
	last_info.rows[0].insertCell();
	
	last_info.rows[0].cells[0].align = "left";
	last_info.rows[0].cells[0].innerHTML ="&nbsp;"+OneTeamNameTMP;
	last_info.rows[0].cells[1].align = "center";
	last_info.rows[0].cells[1].innerHTML = RangQiuName;
	last_info.rows[0].cells[2].align = "right";
	last_info.rows[0].cells[2].innerHTML = peilv_one+"&nbsp;";
	last_info.rows[0].cells[0].width = "40%";
	last_info.rows[0].cells[1].width = "40%";
	last_info.rows[0].cells[2].width = "20%";
	var rowsCount=last_info.rows.length
	if(rowsCount>21)
	{
		last_info.deleteRow(rowsCount-1);
		last_info.deleteRow(rowsCount-2);
		last_info.deleteRow(rowsCount-3);
	}
}

var dragapproved=false
var iex;
var iey;
var tempx;
var tempy;
var old_move;
var old_up;
function drag_dropie(){
if (dragapproved==true){
document.getElementById("showimage").style.pixelLeft=tempx+event.clientX-iex;
document.getElementById("showimage").style.pixelTop=tempy+event.clientY-iey;
event.cancelBubble=true;
}
}
function drag_drup(){
if(document.detachEvent){
document.detachEvent("onmousemove",drag_dropie);
document.detachEvent("onmouseup",drag_drup);
}else{
document.onmousemove=old_move;
document.onmouseup=old_up;
}
event.cancelBubble=true;
}

function initializedragie(){
iex=event.clientX;
iey=event.clientY;
tempx=showimage.style.pixelLeft;
tempy=showimage.style.pixelTop;
dragapproved=true;
if(document.attachEvent){
document.attachEvent("onmousemove",drag_dropie);
document.attachEvent("onmouseup",drag_drup);
}else{
old_move=document.onmousemove;
old_up=document.onmouseup;
document.onmousemove=drag_dropie;
document.onmouseup=drag_drup;
}
event.cancelBubble=true;
event.returnValue=false;
}
////drag drop functions end here//////

function hidebox(){
if (document.getElementById("showimage"))document.getElementById("showimage").style.visibility="hidden";
else{return;}
}
function showbox(_flag)
{
var v=(_flag==true?"visible":"hidden");
document.getElementById("showimage").style.visibility = v;
}

function GoalMessage(item,itemcolor,team1,team2,rangqiu,pl1,pl2){
    team1=team1.replace("[主]","");
	team1=team1.replace("[中]","");
	team2=team2.replace("[主]","");
	team2=team2.replace("[中]","");
	if(item.length>3){item=item.substr(0,3);}
	if(team1.length>4){team1=team1.substr(0,4);}
	if(team2.length>4){team2=team2.substr(0,4);}
	var team_1="<font color=red>"+team1+"</font>";
	var team_2="<font color=blue>"+team2+"</font>";
	item="<font color=#"+itemcolor+">"+item+"</font>";
	
	var Item = document.getElementById("showgoaltext");
	Item.parentNode.style.display="";
	var tmpMM=document.createElement("DIV");
	tmpMM.className="tdb1";
	tmpMM.innerHTML="<table cellSpacing=0 cellPadding=0 border=0 width=100%><tr align=center><td width=14%>"+item+"</td><td width=23%>"+team_1+"</td><td width=10%>"+pl1+"</td><td width=20%>"+rangqiu+"</td><td width=10%>"+pl2+"</td><td  width=23%>"+team_2+"</td></tr></table>";
	Item.insertBefore(tmpMM,Item.firstChild);
	if(Item.getElementsByTagName("DIV").length>30){Item.removeChild(Item.getElementsByTagName("DIV")[Item.getElementsByTagName("DIV").length-1]);}
}

var live=new Object();
live.clkbt = null;
live.popMenu = new Array();
live.popMenu[0] = new Array(" ","S2指数", "云鼎指数", "波音指数","篮球指数");
live.popMenu[1] = new Array("  ", "正进行比赛", "未开场比赛", "已完场比赛", "所有的比赛");
live.popMenu[2] = new Array("声音:", "开", "关");
live.popMenu[3] = new Array("列表:", "开", "关");
live.popMenu[4] = new Array("  ", "简体", "繁体", "English");

live.ShowPopup = function(cc, sid) {
 var div_p = document.getElementById("div_popup");
 if(live.clkbt == cc && div_p.style.display != "none") {
 div_p.style.display = "none";
 live.clkbt = null;
 return; 
 }
 live.clkbt = cc;
 var arr = new Array();
 arr.push("<table cellpadding=0 cellspacing=0 class='dataSheet lightBlue'");
 for(var i=1; i<live.popMenu[sid].length; i++)
 arr.push("<tr><td style='cursor:pointer;text-align:center;' onmouseover='this.bgColor=\"#e8e8ff\";' onmouseout='this.bgColor=\"#ffffff\";' onclick='live.ChgSet("+sid+","+i+");'>"+live.popMenu[sid][i]+"</td></tr>");
 arr.push("</table>");
 var el = cc;
 var showy = 0, showx = 0;
 while(el) {
  showy += el.offsetTop;
  showx += el.offsetLeft;
  el = el.offsetParent;
 }
 div_p.innerHTML = arr.join("");
 div_p.style.left = showx + "px";
 div_p.style.top = (showy + 20) + "px";
 div_p.style.width = sid==1?"120px":"80px";
 div_p.style.display = "";
}
live.ChgSet = function(sid, v) {
  var bt_s = document.getElementById("bt_set_"+sid);
  if(sid!=0)bt_s.value = live.popMenu[sid][0] + live.popMenu[sid][v];
  document.getElementById("div_popup").style.display = "none";
  if(sid==0){ //reload
  live.Version = v
  if(live.Version=="1")location.reload();
  else if(live.Version=="2") window.open("http://odds.190Q.com/yun.htm", "_blank");
  else if(live.Version=="3") window.open("http://odds.190Q.com/boin.htm", "_blank");
  else if(live.Version=="4") window.open("http://odds.190Q.com/nba.htm", "_blank");
  } 
  else if(sid==2) iisound = (v==1);//声音 
  else if(sid==3) {flag = (v==1);showbox(flag);}//提示  
}
live.showSL = function() {
    var dv = document.getElementById("div_set_1");
    if(dv) dv.style.display = (dv.style.display=="none"?"":"none");
    live.setLeagueS();
}
live.setLeagueS = function() {
    var ItemNames= AllContestItem.split("$");
    var str = new Array();
    var n=0;
    str.push('<table id="tb_l_sel" cellpadding="0" cellspacing="0" class="dataSheet lightBlue">');
    str.push("");
    for(i=1; i<=ItemNames.length-2; i++) {
      if(i%6==1) str.push("<tr>"); //"+(n%12==0?"":" class='alt'")+"
      if(ShowItem=="$"|| ShowItem.indexOf("$" + ItemNames[i] + "$")!=-1){
        str.push('<td width="16%" style="text-align:left; padding-left:6px;" bgcolor="#ffeae0" style="FONT-FAMILY: 宋体;"><input type="checkbox" checked id="SelectItem_'+i+'" value="'+ItemNames[i]+'" onclick="live.selL(this);" /><font color=black style="font-weight: bold;">'+ItemNames[i]+'</font></td>');
      } else {
        str.push('<td width="16%" style="text-align:left; padding-left:6px;" style="FONT-FAMILY: 宋体;"><input type="checkbox" id="SelectItem_'+i+'" value="'+ItemNames[i]+'" onclick="live.selL(this);" /><font color=black>'+ItemNames[i]+'</font></td>');
      }
      if(i%6==0) str.push("</tr>");
      n++;
    }
    str[1] = '<caption><span>请选择</span></caption>';
    if(n%6!=0) {
      while(n++%6!=0) str.push('<td width="16%" style="text-align:left; padding-left:6px;"></td>');
    }
    str.push("</table>");
    document.getElementById("div_l_sel").innerHTML = str.join("");
  }

  live.selL = function(cb) {
    var td = cb.parentNode;
    if(!cb.checked) {
      td.bgColor = "";
      td.childNodes[1].style.fontWeight = "";
    } else {
      td.bgColor = "#ffeae0";
      td.childNodes[1].style.fontWeight = "bold";
    }
  }

  live.selLOk = function() {
    var strTemp="$";
    var ItemNames= AllContestItem.split("$");
    for(i=1; i<=ItemNames.length-2; i++) {
    if(document.getElementById("SelectItem_"+i.toString()).checked)
    strTemp+=ItemNames[i]+"$";
    }
    ShowItem=strTemp;
    document.getElementById("div_set_1").style.display = "none";
    HideGameid=",";
    ViOddsXml();
  }
  
  live.selLAll = function() {
    var i, j, cc;
    var tb = document.getElementById("tb_l_sel");
    for(j=0; j<tb.rows.length; j++) {
      for(i=0; i<tb.rows[j].cells.length; i++) {
        cc = tb.rows[j].cells[i].childNodes[0];
        if(cc && !cc.checked) {
          cc.checked = true;
          cc.parentNode.bgColor = "#ffeae0";
          cc.parentNode.childNodes[1].style.fontWeight = "bold";
        }
      }
    }
  }

  live.selLRev = function() {
    var i, j, cc;
    var tb = document.getElementById("tb_l_sel");
    for(j=0; j<tb.rows.length; j++) {
      for(i=0; i<tb.rows[j].cells.length; i++) {
        cc = tb.rows[j].cells[i].childNodes[0];
        if(cc) {
          cc.checked = !cc.checked;
            if(cc.checked) {
              cc.parentNode.bgColor = "#ffeae0";
              cc.parentNode.childNodes[1].style.fontWeight = "bold";
            } else {
              cc.parentNode.bgColor = "";
              cc.parentNode.childNodes[1].style.fontWeight = "";
            }
        }
      }
    }
  }
  live.SetPlan = function(pid) {
    document.getElementById("div_set_1").style.display = "none";
  }
