/*
WF 输出顶部form
参数：l 语种（cn 或 en）
参数：kt 公司名 kellynic_temp
参数：hm 隐藏了的赛事
参数：p 当前页 page
*/
function WF(l, kt, hm, p) {
	W('<tr bgcolor="#F1F1F1">');
	W('	<form name="form1" method="get" action="">');
	W('	<td width="13%" valign="top">');
	W('		<input name="version" id="version_gd" type="radio" onclick="this.form.submit()" value="gd"' + (l == 'gd' || l == '' ? ' checked' : '') + ' /><label for="version_gd">粤语</label>');
	W('		<input name="version" id="version_cn" type="radio" onclick="this.form.submit()" value="cn"' + (l == 'cn' ? ' checked' : '') + ' /><label for="version_cn">国语</label>');
	W('	</td>');
	W('	</form>');
	W('	<td>浏览模式：显示近期所有' + kt + '开盘赛事' + hm + '，当前是第' + p + '页 </td>');
	W('	<td width="11%" align="right" valign="top"><img src="http://img.mso.com.cn/www/odds/option_b5.gif" width="85" height="19" onmouseup="MM_showHideLayers(\'option\',\'\',\'show\',\'match\',\'\',\'hide\',\'company\',\'\',\'hide\')" style="cursor: hand">');
	W('		<div id="option" style="position:absolute;z-index:100;width:128px;visibility:hidden;">');
	W('			<div>');
	W('				<img src="http://img.mso.com.cn/www/odds/op_tit_01.gif" width=45 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_function.gif" width=60 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_03.gif" width=23 height=23 alt="" onmouseup="MM_showHideLayers(\'option\',\'\',\'hide\')" style="cursor: hand"></div>');
	W('			<div><img src="http://img.mso.com.cn/www/odds/option_win_02.gif" width=128 height=5 alt=""></div>');
	W('			<div style="background-image:url(http://img.mso.com.cn/www/odds/option_win_02.gif);">');
	W('				<div align="left" style="padding:8px;">');
	W('					<input id="SoundSwitch" name="SoundSwitch" type="checkbox" onclick="save_SoundSwitch()" value=1><label for="SoundSwitch">声音提示</label><br><span id="ShowSound"></span>');
	W('					<input id="OpenWinMsg" name="OpenWinMsg" type="checkbox" onclick="save_OpenWinMsg();" value=1><label for="OpenWinMsg">弹出窗口</label><br>');
	W('					<input id="Color_Mark" name="Color_Mark" type="checkbox" value=1 onclick="save_setLeagues_Color();"><label for="Color_Mark">颜色区分各联赛</label></div>');
	W('				<div align="center"><img src="http://img.mso.com.cn/www/odds/option_b3.gif" width="38" height="24" onmouseup="MM_showHideLayers(\'option\',\'\',\'hide\')" style="cursor: hand"></div>');
	W('				<div align="right" style="padding-right:6px;"><img src="http://img.mso.com.cn/www/odds/opt_url.gif" vspace="2"></div></div>');
	W('				<div><img src="http://img.mso.com.cn/www/odds/option_win_04.gif" width=128 height=7 alt="" style="cursor: hand"></div></div>');
	W('	</td>');
	W('</tr>');
	W('<tr bgcolor="#F1F1F1">');
	W('	<td height="20" align="center" nowrap>' + (l == 'en' ? 'Last Update' : '最新变化') + '</td>');
	W('	<td align="center"><span id="LastUpdateOdds">&nbsp;</span></td>');
	W('	<td align="right" nowrap><img src="http://img.mso.com.cn/www/odds/option_b4.gif" width="85" height="19" onmouseup="MM_showHideLayers(\'match\',\'\',\'show\',\'option\',\'\',\'hide\',\'company\',\'\',\'hide\')" style="cursor: hand">');
	W('		<div id="match" style="position:absolute;z-index:100;width:128px;visibility:hidden;">');
	W('		<div><img src="http://img.mso.com.cn/www/odds/op_tit_01.gif" width=45 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_02.gif" width=60 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_03.gif" width=23 height=23 alt="" onmouseup="MM_showHideLayers(\'match\',\'\',\'hide\')" style="cursor: hand"></div>');
	W('		<div><img src="http://img.mso.com.cn/www/odds/option_win_02.gif" width=128 height=5 alt=""></div>');
	W('		<div style="background-image:url(http://img.mso.com.cn/www/odds/option_win_02.gif);">');
	W('			<div id="LEAGUE_SEL" align="left" style="padding:8px;">&nbsp;</div>');
	W('			<div align="center">');
	W('				<img src="http://img.mso.com.cn/www/odds/option_b1.gif" width="38" height="24" onclick="_revSelAll_Leagues();" style="cursor: hand">');
	W('				<img src="http://img.mso.com.cn/www/odds/option_b2.gif" width="38" height="24" onclick="_selAll_Leagues();" style="cursor: hand">');
	W('				<img src="http://img.mso.com.cn/www/odds/option_b3.gif" width="38" height="24" onmouseup="MM_showHideLayers(\'match\',\'\',\'hide\')" style="cursor: hand"></div>');
	W('			<div align="right" style="padding-right:6px;"><img src="http://img.mso.com.cn/www/odds/opt_url.gif" vspace="2"></div></div>');
	W('			<div><img src="http://img.mso.com.cn/www/odds/option_win_04.gif" width=128 height=7 alt="" style="cursor: hand"></div></div>');
	W('	</td>');
	W('</tr>');
	W('<tr><td height="22" align="center" bgcolor="F1F1F1" colspan="3"><span id="alert_msg" style="color:#ff0000">点击水位、盘口的数字可以查看该水位、盘口变动的历史资料(本站采用最新技术，赔率更新与澳门同步)</span></td></tr>');
}

/*
WW1 输出中间选择
参数：showflag 显示公司
参数：m 模式（亚盘或标盘）
参数：s 日期列表
参数：s1 联赛选择
*/
function WW1(showflag, m, s, s1) {
	W('<tr>');
	W('	<td height="22" align="right" bgcolor="F1F1F1" colspan="3">');
	W('		<table width="100%" border=0 cellspacing=0 cellpadding=0>');
	W('			<tr>');
	W('				<td width="50%" align="left">');
	W('					<select name="cmp" style="width:140px;background:#eeee66" onchange="window.open(\'odds_eur_company.asp?id=\'+this.value,\'\',\'\');">');
	W('						<option value="0">标盘博彩公司</option>');
	for (var k in COMPANY)
		if (COMPANY[k].s)
			W('<option value="' + COMPANY[k].i + '">' + COMPANY[k].n + '</option>');
	W('					</select>');
	W('					<select name="cmp2" style="width:140px;background:#eeee66" onchange="window.open(\'odds_asi_company.asp?id=\'+this.value,\'\',\'\');">');
	W('						<option value="0">亚盘博彩公司</option>');
	for (var k in COMPANY)
		if (COMPANY[k].y)
			W('<option value="' + COMPANY[k].i + '">' + COMPANY[k].n + '</option>');
	W('					</select>');
	W('				</td>');
	W('				<form name="checkfrm" method="get" action="">');
	W('				<td width="35%"align=right>');
	W('					<input name="show" type="hidden" value="' + showflag + '">');
	W('					<input type="hidden" name="m" value="' + m + '">');
	W('					<select name="d" onchange="this.form.submit()" style="width:150px;background:#ccee00;">');
	W('						<option value="0">请选择日期查询</option>' + s);
	W('					</select>');
	W('				</td>');
	W('				</form>');
	W('				<form name="checkfrm2" method="get" action="">');
	W('				<td align="right">');
	W('					<input name="show" type="hidden" value="0">');
	W('					<input type="hidden" name="m" value="' + m + '">');
	W('					<select name="LMC" style="background:#ccee00" onchange="this.form.submit();">');
	W('						<option value="">全部联赛</option>' + s1);
	W('					</select>');
	W('				</td>');
	W('				</form>');
	W('			</tr>');
	W('		</table>');
	W('	</td>');
	W('</tr>');
	
	W('<tr>');
	W('	<td height="22" align="center" bgcolor="F1F1F1" colspan="3">');
	W('<table width="100%" border=0 cellpadding=0 cellspacing=0 background="http://img.mso.com.cn/www/odds/oddsbt2_01.gif">');
	W('	<tr>');
	W('		<td width="74" valign="top"><img src="http://img.mso.com.cn/www/odds/re_head.gif" width="74" height="31" border="0"></td>');
	W('		<td valign="top" align="right">');
}

/*
WWC 输出公司tab
参数：showflag 显示公司
参数：p 当前页
参数：d 日期
参数：m 模式（亚盘或标盘）
参数：src 默认图片
参数：src2 鼠标移上去图片
参数：c 公司名称
*/
function WWC(ShowFlag, p, d, m, src, src2, c) {
	W('<a href="?show=' + ShowFlag + '&Page=' + p + '&d=' + d + '&m=' + m + '"><img src="' + src + '" onmouseover="this.src=\'' + src2 + '\';" onmouseout="this.src=\'' + src + '\';" border="0" title="显示近期所有' + c + '开盘赛事" align="top"></a>');
}

/*
WCS 输出功能选项里的公司项
参数：showflag 显示公司
参数：p 当前页
参数：lmc 联赛代码 request("lmc")
参数：d 日期
参数：m 模式（亚盘或标盘）
参数：cs 公司数组
*/
function WCS(ShowFlag, p, lmc, d, m, cs) {
	W('								<img src="http://img.mso.com.cn/www/odds/setup_company.gif" onmouseup="MM_showHideLayers(\'company\',\'\',\'show\',\'option\',\'\',\'hide\',\'match\',\'\',\'hide\')" style="cursor: hand" align="absmiddle">');
	W('								<div id="company" style="position:absolute;z-index:100;width:128px;visibility:hidden;">');
	W('								<div><img src="http://img.mso.com.cn/www/odds/op_tit_01.gif" width=45 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_function05.gif" width=60 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_03.gif" width=23 height=23 alt="" onmouseup="MM_showHideLayers(\'company\',\'\',\'hide\')" style="cursor: hand"></div>');
	W('								<div><img src="http://img.mso.com.cn/www/odds/option_win_02.gif" width=128 height=5 alt=""></div>');
	W('								<div style="background-image:url(http://img.mso.com.cn/www/odds/option_win_02.gif);">');
	W('									<form id="kellynic_companys_form" onsubmit="return companySubmit(this);" action="?show=0&setstyle=1&Page=' + p + '&LMC=' + lmc + '&d=' + d + '&m=' + m + '" method="post" target="_self" style="margin:0px;">');
	W('									<div align="left" style="padding:8px;">');
	
	window.KELLYNIC_COMPANYS = {
		_MAC : '澳门', 
		_EAS : '易胜博', 
		_LAD : '立博', 
		_VIC : '韦德', 
		_YN2 : '印尼', 
		_3ST : '三星', 
		_ABEX : '八达', 
		_CAM : '金宝博', 
		_HOO : '互博', 
		_TIG : '泰国', 
		_MN88 : '明陞',
		_365 : 'Bet365', 
		_PTB : '新加坡',
		_BET : '必发',
		_ASC : 'ASC',
		_SI3 : '皇冠'
		
	};
	var temp = 0;
	for(var k in window.KELLYNIC_COMPANYS)
		if(k != '_ABEX' && k != '_3ST' && k != '_YN2' && k != '_TIG' && k != '_PTB' && k != '_ASC')
			W('<input id="Company_' + temp + '" name="companys" type="checkbox" value="' + temp + '"><label for="Company_' + temp ++ + '">' + window.KELLYNIC_COMPANYS[k] + '</label><br />');
		else temp ++;
	
	window.companySubmit = function(form) {
		var count = 0;
		var temp = -1;
		for(var k in window.KELLYNIC_COMPANYS)
		if(form['Company_' + ++temp] && form['Company_' + temp].checked) {
			count ++;
			if(count > 5) {
				alert('您只能选择5家公司，谢谢！');
				return false;
			}
		}
	}
	window.funcReset = function() {
		for(var a = 0 ; a < cs.length ; a ++)
			if($('Company_' + cs[a]))
				$('Company_' + cs[a]).checked = true;
	}
	window.funcReset();
	
	W('										</div>');
	W('										<div align="center">');
	W('											<input type="image" src="http://img.mso.com.cn/www/odds/option_b5_company.gif" width="38" height="24" style="cursor: hand"> <img src="http://img.mso.com.cn/www/odds/option_b3.gif" width="38" height="24" onmouseup="MM_showHideLayers(\'company\',\'\',\'hide\');$(\'kellynic_companys_form\').reset();funcReset();" style="cursor: hand"></div>');
	W('										<div align="center" style="color:red;font-size:12px;">(限制5家公司)</div></form></div>');
	W('									<div><img src="http://img.mso.com.cn/www/odds/option_win_04.gif" width=128 height=7 alt="" style="cursor: hand"></div></div>');
	
	W('							</td>');
	W('						</tr>');
	W('					</table>');
	W('					<div style=padding:5px;><iframe marginHeight="0" marginwidth="0" scrolling="no" frameborder="0" src="http://a.mso.cn/script/a/show.asp?group_id=157&bgcolor=f1f1f1" noresize allowtransparency="true" width="500" height="14"></iframe></div>');
	W('					<table width=100% border=0 cellpadding=0 cellspacing=0>');
	W('						<tr>');
	W('							<td background="http://img.mso.com.cn/www/odds/oddsbt2_01.gif" align="left">');
}


/*
WCS 输出功能选项里的公司项
参数：showflag 显示公司
参数：p 当前页
参数：lmc 联赛代码 request("lmc")
参数：d 日期
参数：m 模式（亚盘或标盘）
参数：cs 公司数组
*/
function WCS222(ShowFlag, p, lmc, d, m, cs) {
	W('	<table><tr><td>							<img src="http://img.mso.com.cn/www/odds/setup_company.gif" onmouseup="MM_showHideLayers(\'company\',\'\',\'show\',\'option\',\'\',\'hide\',\'match\',\'\',\'hide\')" style="cursor: hand" align="absmiddle">');
	W('								<div id="company" style="position:absolute;z-index:100;width:128px;visibility:hidden;">');
	W('								<div><img src="http://img.mso.com.cn/www/odds/op_tit_01.gif" width=45 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_function05.gif" width=60 height=23 alt=""><img src="http://img.mso.com.cn/www/odds/op_tit_03.gif" width=23 height=23 alt="" onmouseup="MM_showHideLayers(\'company\',\'\',\'hide\')" style="cursor: hand"></div>');
	W('								<div><img src="http://img.mso.com.cn/www/odds/option_win_02.gif" width=128 height=5 alt=""></div>');
	W('								<div style="background-image:url(http://img.mso.com.cn/www/odds/option_win_02.gif);">');
	W('									<form id="kellynic_companys_form" onsubmit="return companySubmit(this);" action="?show=0&setstyle=1&Page=' + p + '&LMC=' + lmc + '&d=' + d + '&m=' + m + '" method="post" target="_self" style="margin:0px;">');
	W('									<div align="left" style="padding:8px;">');
	
	window.KELLYNIC_COMPANYS = {
		_MAC : '澳门', 
		_EAS : '易胜博', 
		_LAD : '立博', 
		_VIC : '韦德', 
		_YN2 : '印尼', 
		_3ST : '三星', 
		_ABEX : '八达', 
		_CAM : '金宝博', 
		_HOO : '互博', 
		_TIG : '泰国', 	
		_MN88 : '明陞', 
		_365 : 'Bet365', 
		_PTB : '新加坡',
		_BET : '必发',
		_ASC : 'ASC',
		_SI3 : '皇冠'
	};
	var temp = 0;
	for(var k in window.KELLYNIC_COMPANYS)
		if(k != '_ABEX' && k != '_3ST' && k != '_YN2' && k != '_TIG' && k != '_PTB' && k != '_ASC')
			W('<input id="Company_' + temp + '" name="companys" type="checkbox" value="' + temp + '"><label for="Company_' + temp ++ + '">' + window.KELLYNIC_COMPANYS[k] + '</label><br />');
		else temp ++;
	
	window.companySubmit = function(form) {
		var count = 0;
		var temp = -1;
		for(var k in window.KELLYNIC_COMPANYS)
		if(form['Company_' + ++temp] && form['Company_' + temp].checked) {
			count ++;
			if(count > 5) {
				alert('您只能选择5家公司，谢谢！');
				return false;
			}
		}
	}
	window.funcReset = function() {
		for(var a = 0 ; a < cs.length ; a ++)
			if($('Company_' + cs[a]))
				$('Company_' + cs[a]).checked = true;
	}
	window.funcReset();
	
	W('										</div>');
	W('										<div align="center">');
	W('											<input type="image" src="http://img.mso.com.cn/www/odds/option_b5_company.gif" width="38" height="24" style="cursor: hand"> <img src="http://img.mso.com.cn/www/odds/option_b3.gif" width="38" height="24" onmouseup="MM_showHideLayers(\'company\',\'\',\'hide\');$(\'kellynic_companys_form\').reset();funcReset();" style="cursor: hand"></div>');
	W('										<div align="center" style="color:red;font-size:12px;">(限制5家公司)</div></form></div>');
	W('									<div><img src="http://img.mso.com.cn/www/odds/option_win_04.gif" width=128 height=7 alt="" style="cursor: hand"></div></div>');
	
	W('							</td>');
	W('						</tr>');
	W('					</table>');
}

/*
WPB 输出分页前或数据结束HTML
*/
function WPB(f) {
	if(! f) {
		W('						</td>');
		W('					</tr>');
	}
	W('					</table>');
	W('				</td>');
	W('			</tr>');
	W('		</table>');
	W('		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">');
	W('			<tr align="center">');
	W('				<td valign="top" bgcolor="#000000">');
	W('					<table width="100%" border="0" cellpadding="0" cellspacing="1">');
}

/*
WDH 输出数据头标题
参数：m 模式（亚盘或标盘）
参数：d 日期
*/
function WDH(m, d) {
	W('						<tr align="center" class=bg_2>');
	W('							<td height=22 style="color:#FFFFFF;font-weight:bold;">' + d + '</td>');
	if (m.toUpperCase() == 'A') {
		W('						<td width="68" style="color:#FFFFFF;">公司</td>');
		W('						<td width="62" style="color:#FFFFFF;">主队</td>');
		W('						<td width="107" style="color:#FFFFFF;">现盘</td>');
		W('						<td width="64" style="color:#FFFFFF;">客队</td>');
		W('						<td colspan="3" style="color:#FFFFFF;">初　盘</td>');
	} else {
		W('						<td width="68" style="color:#FFFFFF;">公司</td>');
		W('						<td width="62" style="color:#FFFFFF;">主队</td>');
		W('						<td width="107" style="color:#FFFFFF;">现盘</td>');
		W('						<td width="64" style="color:#FFFFFF;">客队</td>');
		W('						<td colspan="3" style="color:#FFFFFF;">标　准　盘</td>');
	}
	W('						</tr>');
}

/*
WDLH 输出数据联赛头标题
参数：VsRound 赛季
参数：lmc 联赛代码
参数：ln 联赛名称
*/
function WDLH(VsRound, lmc, ln) {
	W('						<tr bgcolor="#e7e7e7">');
	W('							<td colspan="9">');
	W('								<table id="setColor" lmc="' + lmc + '" border=0 width="100%" cellspacing=0 cellpadding=0 height="22">');
	W('									<tr>');
	W('										<td width="85%" align="left" style="color:cc0000;font-size:10.5pt;padding-top:2px;">');
	W('											<a name="L' + lmc + '"></a>&nbsp;&nbsp;&nbsp;&nbsp;' + ln + getVsRound(VsRound));
	if(LEAGUE['_' + lmc] && LEAGUE['_' + lmc].d)
		if(LEAGUE['_' + lmc].c) W(' | <span onclick="MM_openBrWindow(\'/html/database/' + lmc + '_/\',\'\',\'toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=1024,height=768\')" style="cursor: hand">资料库</span>');
		else W(' | <span onclick="MM_openBrWindow(\'/html/database/' + lmc + '_/table.shtml\',\'\',\'toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=1024,height=768\')" style="cursor: hand">积分榜</span>');
	W('										</td>');
	W('										<td width="12%" align=right><img id="img_' + lmc + '" src="http://img.mso.com.cn/www/odds/b-.gif" border=0 onclick="selectLeague_Line(\'' + lmc + '\' , \'' + lmc + '\');" style="cursor: hand"></td>');
	W('										<td width="3%" align=right><a href="#top"><img src="http://img.mso.com.cn/www/odds/gotop.gif" border=0 hspace="2" alt="回到页顶"></a></td>');
	W('									</tr>');
	W('								</table>');
	W('							</td>');
	W('						</tr>');
}

/*
WDBL 输出数据体左边
参数：lmc 联赛代码
参数：ln 联赛名称
参数：vsid 比赛ID
参数：line 行
参数：date 比赛日期
参数：tc1 主队代码
参数：tn1 主队名称
参数：to1 主队order
参数：tc2 客队代码
参数：tn2 客队名称
参数：to2 客队order
参数：VsNeutral 
参数：Vsgraph
参数：bgtemp
*/
function WDBL(lmc, ln, vsid, line, date, tc1, tn1, to1, tc2, tn2, to2, VsNeutral, Vsgraph, bgtemp, ts) {
	W('						<tr id="tr_' + lmc + '" matchid="' + vsid + '" style="display:block" leaguename="' + ln + '" height="21">');
	W('							<td id="matchtime_' + vsid + '" indexofmatch="' + line + '" matchtime="' + date + '" align="center" valign="middle" bgcolor="#FFFFFF" width="33%">');
	W('								<table width="100%" border="0" cellspacing="0" cellpadding="1">');
	W('									<tr>');
	W('										<td colspan="4" align="center" height="40">');
	W('											<span id="team_name_' + line + '"><a href="/html/database/team/' + tc1 + '_/" target="_blank" class=en105pt>' + (to1 != '' ? '[' + to1 + ']' : '') + tn1 + '</a> VS <a href="/html/database/team/' + tc2 + '_/" target="_blank" class=en105pt>' + tn2 + (to2 != '' ? '[' + to2 + ']' : '') + '</a></span><br>' + (VsNeutral ? '<font color=red>中立场</font>' : '') + ' ' + date + (ts ? ' <font size=+1>' + ts + '</font>' : ''));
	W('										</td>');
	W('									</tr>');
	W('									<tr align="center">');
	W('										<td  colspan="4"><a href="/versus/index.asp?id=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_2.gif" border=0></a> ');
	W('											<a href="http://lota.mso.com.cn/lota.asp?vsid=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_3.gif" border=0></a>  <a href="/odds/odds_avg.asp?lmc='+ lmc +'&syear=20'+ date.substr(0,2) +'&id=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_9.gif" border=0></a> '  );
	W('										</td>');
	W('									</tr>');
	W('									<tr align="center">');
	W('										<td colspan="4"><a href="/odds/odds_standard.asp?id=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_5.gif" border=0></a> <a href="/odds/odds_asian.asp?id=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_6.gif" border=0></a> <a href="/odds/odds_score.asp?lmc='+ lmc +'&syear=20'+ date.substr(0,2) +'&id=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_7.gif" border=0></a> <a href="/odds/odds_goal.asp?lmc='+ lmc +'&syear=20'+ date.substr(0,2) +'&id=' + vsid + '" target="_blank"><img src="http://img.mso.com.cn/www/odds/odds_left_8.gif" border=0></a></td>');
	W('									</tr>');
	W('								</table>');
	W('							</td>');
	W('							<td colspan=8 align="center" valign="top" bgcolor="#FFFFFF">');
	W('								<table width="100%" border="0" cellpadding="0" cellspacing="1" background="http://img.mso.com.cn/www/odds/' + bgtemp + '.gif" bgcolor="#FFFFFF">');
}

/*
WDBR 输出数据体右边
参数：m 模式
参数：comc 公司代码
参数：vsid 比赛ID
参数：xpath XML_Path
参数：odds 赔率数组
*/
function WDBR(m, comc, vsid, xpath, odds) {
	if(COMPANY['_' + comc]){
		if (m == 'A') {
			W('								<tr align="center" height="22">');
			W('									<td id="' + comc.toLowerCase() + '_hot_' + vsid + '" updatetime="0" width="13%">' + COMPANY['_' + comc].n + '</td>');
			W('									<td width="12%"><span id="' + comc.toLowerCase() + '_ho_' + vsid + '" hoodds="" style="cursor:pointer" onclick="popup(' + vsid + ', \'' + comc + '|' + xpath + '\')"><strong>' + odds[0] + '</strong></span></td>');
			W('									<td width="21%"><span id="' + comc.toLowerCase() + '_handicap_' + vsid + '" handicapodds="" style="cursor:pointer" onclick="popup(' + vsid + ', \'' + comc + '|' + xpath + '\')">' + odds[1] + '</span></td>');
			W('									<td width="12%"><span id="' + comc.toLowerCase() + '_lo_' + vsid + '" loodds="" style="cursor:pointer" onclick="popup(' + vsid + ', \'' + comc + '|' + xpath + '\')"><strong>' + odds[2] + '</strong></span></td>');
			W('									<td width="12%"><font color="#666666"><strong>' + odds[3] + '</strong></font></td>');
			W('									<td ><font color="#666666">' + odds[4] + '</font></td>');
			W('									<td width="12%"><font color="#666666"><strong>' + odds[5] + '</strong></font></td>');
			W('								</tr>');
		} else if(m == 'AE') {
			W('								<tr align="center" height="22">');
			W('									<td id="' + comc.toLowerCase() + '_hot_' + vsid + '" updatetime="0" width="13%">' + COMPANY['_' + comc].n + '</td>');
			W('									<td width="12%"><span id="' + comc.toLowerCase() + '_ho_' + vsid + '" hoodds="" style="cursor:pointer" onclick="popup(' + vsid + ', \'' + comc + '|' + xpath + '\')"><strong>' + odds[0] + '</strong></span></td>');
			W('									<td width="21%"><span id="' + comc.toLowerCase() + '_handicap_' + vsid + '" handicapodds="" style="cursor:pointer" onclick="popup(' + vsid + ', \'' + comc + '|' + xpath + '\')">' + odds[1] + '</span></td>');
			W('									<td width="12%"><span id="' + comc.toLowerCase() + '_lo_' + vsid + '" loodds="" style="cursor:pointer" onclick="popup(' + vsid + ', \'' + comc + '|' + xpath + '\')"><strong>' + odds[2] + '</strong></span></td>');
			W('									<td width="12%"><span id="' + comc.toLowerCase() + '_ohome_' + vsid + '" ohomeodds=""><font color="#666666"><strong>' + odds[3] + '</strong></font></span></td>');
			W('									<td ><span id="' + comc.toLowerCase() + '_odraw_' + vsid + '" odrawodds=""><font color="#666666"><strong>' + odds[4] + '</strong></font></span></td>');
			W('									<td width="12%"><span id="' + comc.toLowerCase() + '_oaway_' + vsid + '" oawayodds=""><font color="#666666"><strong>' + odds[5] + '</strong></font></span></td>');
			W('								</tr>');
		} else {
			W('								<tr align="center" height="22">');
			W('									<td width="8%">&nbsp;</td>');
			W('									<td width="7%">&nbsp;</td>');
			W('									<td width="16%">&nbsp;</td>');
			W('									<td width="7%">&nbsp;</td>');
			W('									<td width="7%">&nbsp;</td>');
			W('									<td width="15%">&nbsp;</td>');
			W('									<td width="7%">&nbsp;</td>');
			W('								</tr>');
		}
	}
}

/*
WDBE 输出数据体结束HTML
*/
function WDBE() {
	W('								</table>');
	W('							</td>');
	W('						</tr>');
}

/*
WE 输出全部结束
*/
function WE() {
	W('					</table>');
	W('				</td>');
	W('			</tr>');
}

/*
WEE 输出最后结束部分
*/
function WEE() {
	W('		<div style="background-image:url(http://img.mso.com.cn/www/odds/oddsbt2_01.gif);" align="left">');
	W('		<div style="margin-top:8px;padding-left:5px;float:left;width:200px;height:31px;font-weight:150%;color:#fff;">Powered by BetBrain</div><div align="right">');
	W($('getpagelist').outerHTML);
	W('		</div></div>');
	WEE2();
}

function WEE2() {
	W('		<div id="oDialog" style="display:none;">');
	W('			<table width="200" border="0" cellspacing="0" cellpadding="0">');
	W('				<tr>');
	W('					<td colspan="3"><img src="http://img.mso.com.cn/www/odds/popup_1.gif" width="170" height="33"><img src="http://img.mso.com.cn/www/odds/popup_2.gif" width="30" height="33" onclick="parent.oPopup.hide();"></td>');
	W('				</tr>');
	W('				<tr>');
	W('					<td width="5"><img src="http://img.mso.com.cn/www/odds/popup_3.gif" width="5" height="86"></td>');
	W('					<td id="LastUpdateOddsPoP" width="190" background="http://img.mso.com.cn/www/odds/popup_bg.gif" align="center"></td>');
	W('					<td width="5"><img src="http://img.mso.com.cn/www/odds/popup_4.gif" width="5" height="86"></td>');
	W('				</tr>');
	W('				<tr>');
	W('					<td colspan="3"><img src="http://img.mso.com.cn/www/odds/popup_5.gif" width="200" height="18"></td>');
	W('				</tr>');
	W('			</table>');
	W('		</div>');
}

/*****************************其他函数*****************************/
/*
DESCRIPT : setTimeout loop and setTimeout reload xml data
*/
function kellynicOdds(LMC) {
	W('<xml id="xmlDoc_' + LMC + '"></xml>');
	//W('<input type="text" id="title_' + LMC + '" style="border:1px solid #CCCCCC;width:160px;">');
	var xmlDocTopic = new ActiveXObject("Microsoft.XMLDOM");
	var xmlDoc = $('xmlDoc_' + LMC);
	var GetOddsCount = 0;
	var recordCount = 0;
	var OldXML = null;
	var rs = null;
	var d = null;
	
	var hoOdds = [];
	var handicapOdds = [];
	var loOdds = [];
	
	setTimeout("window.NIC._" + LMC + ".openXML()", 2000);
	
	this.openXML = function() {
		if(typeof(window['SERVER_TIME$' + LMC]) == 'undefined') window['SERVER_TIME$' + LMC] = SERVER_TIME;
		else window['SERVER_TIME$' + LMC] += 1;
		xmlDocTopic.load("/xml/odds/" + LMC + ".xml?" + Math.random()); //window['SERVER_TIME$' + LMC]
		xmlDocTopic.onreadystatechange = xmlDocTopiconreadystatechange;
	}
	
	this.loop = function() {
		if(rs.Eof) {
			setTimeoutReload();
			return;
		}
		
		var matchid = rs("i").value;
		var isUpdateOdds = false;

		if($(LMC + "_ho_" + matchid) && $(LMC + '_ho_' + matchid).innerText != '--') {
			var oddsMatch = rs("asian_odds").value;
			var oddsMatchArray = oddsMatch.split("*");
			
			indexOfMatch = $("matchtime_" + matchid).indexofmatch;
			window.status = "The value of mso live odds is: " + mystuff;
			
			if (oddsMatch != "") {
				if (hoOdds[indexOfMatch] != oddsMatchArray[0] && oddsMatchArray[0] != "") {
					old_hoOdds = $(LMC + "_ho_" + matchid).innerText;
					new_hoOdds = oddsMatchArray[0];
					
					$(LMC + "_ho_" + matchid).hoOdds = oddsMatchArray[0];
					$(LMC + "_ho_" + matchid).innerText = oddsMatchArray[0];
					
					hoOdds[indexOfMatch] = oddsMatchArray[0];
					$(LMC + "_hot_" + matchid).updateTime = d.getTime() / 1000;
					isUpdateOdds = true;
				}
			
				window.status = "The value of mso live odds is: " + mystuff;
				if (handicapOdds[indexOfMatch] != oddsMatchArray[1] && oddsMatchArray[1] != "") {
					$(LMC + "_handicap_" + matchid).style.color = "#0000FF";
					$(LMC + "_handicap_" + matchid).handicapOdds = oddsMatchArray[1];
					$(LMC + "_handicap_" + matchid).innerText = oddsMatchArray[1];
					
					handicapOdds[indexOfMatch] = oddsMatchArray[1];
					isUpdateOdds = true;
				}
				
				window.status = "The value of mso live odds is: " + mystuff;
				if (loOdds[indexOfMatch] != oddsMatchArray[2] && oddsMatchArray[2] != "") {
					old_loOdds = $(LMC + "_lo_" + matchid).innerText;
					new_loOdds = oddsMatchArray[2];
					
					$(LMC + "_lo_" + matchid).loOdds = oddsMatchArray[2];
					$(LMC + "_lo_" + matchid).innerText = oddsMatchArray[2];
					
					loOdds[indexOfMatch] = oddsMatchArray[2];
					isUpdateOdds = true;
				}
				
				if(isUpdateOdds) {
					if($("SoundSwitch") && $("SoundSwitch").checked && $("ShowSound"))
						$("ShowSound").innerHTML = flash_Sound;
					setColor(LMC + "_ho_" , old_hoOdds , new_hoOdds , matchid , LMC);
				}
				
				window.status = "The value of mso live odds is: " + mystuff;
			}
		}
		
		window.status = "The value of mso live odds is: " + mystuff;
		
		recordCount ++;
		rs.MoveNext();
		
		setTimeout("window.NIC._" + LMC + ".loop()", 10);
	}
	
	function xmlDocTopiconreadystatechange() {
		if (xmlDocTopic.parseError.errorCode != 0) {
			window.status = "The xml document cannot find ！";
			setTimeoutReload();
			return;
		}
		if (xmlDocTopic.readyState != 4)
			return;

		d = new Date();
		
		if(typeof(lastUpdateTime) != 'undefined')
			lastUpdateTime.innerText = FormatNumber(d.getHours()) + ":" + FormatNumber(d.getMinutes());
		GetOddsCount ++;
		recordCount = 0;
		
		var ttt = "0";
		try {
			xmlDoc.XMLDocument.async = false;
			xmlDoc.XMLDocument.loadXML(xmlDocTopic.xml);
			rs = xmlDoc.recordset;
			
			if (xmlDocTopic.xml != "" && xmlDocTopic.xml != OldXML) {
				if (parseInt(rs("asian_odds").value) != msGetOddsXML && 
					parseInt(rs("asian_odds").value) > 1000) msGetOddsXML = parseInt(rs("asian_odds").value);
				
				rs.MoveNext();
				setTimeout("window.NIC._" + LMC + ".loop()", 10);
			} else
				setTimeoutReload();
		} catch(e) {
			//setTimeoutReload();
			document.title = e.message;
			window.status = "The value of mso live odds is: " + mystuff;
		}
	}
	
	function setTimeoutReload() {
		if(! d) d = new Date();
		//$('title_' + LMC).value = GetOddsCount + ' ' + (xmlDocTopic.xml != "" && OldXML != xmlDocTopic.xml && OldXML != "" ? '变了' : '未变') + ' ' + recordCount + ' ' + (new Date().getTime() - d.getTime()) + 'ms ' + window['SERVER_TIME$' + LMC];
		//$('title_' + LMC).value = window['SERVER_TIME$' + LMC] + ' ' + recordCount + ' ' + (new Date().getTime() - d.getTime()) + 'ms';
		OldXML = xmlDocTopic.xml;
		setTimeout("window.NIC._" + LMC + ".openXML()", msGetOddsXML);
	}
}

function _selAll_Leagues(index) {
	var Leagues_Input = document.all['input_league'];
	if(! index) index = 0;
	
	if(Leagues_Input.length) {
		if(index >= Leagues_Input.length) return;
		Leagues_Input[index].checked = true;
		Leagues_Input[index].onclick();
	} else {
		Leagues_Input.checked = true;
		Leagues_Input.onclick();
		return;
	}
	window.status="The value of mso live odds is: "+mystuff;
	
	setTimeout("_selAll_Leagues(" + (index + 1) + ")" , 10);
}

function _revSelAll_Leagues(index) {
	var Leagues_Input = document.all['input_league'];
	if(! index) index = 0;
	
	if(Leagues_Input.length) {
		if(index >= Leagues_Input.length) return;
		Leagues_Input[index].checked = !Leagues_Input[index].checked;
		Leagues_Input[index].onclick();
	} else {
		Leagues_Input.checked = !Leagues_Input.checked;
		Leagues_Input.onclick();
		return;
	}
	window.status="The value of mso live odds is: " + mystuff;
	
	setTimeout("_revSelAll_Leagues(" + (index + 1) + ")" , 10);
}

function _setLeagues_Color(index) {
	if(! index) index = 0;
	var LeaguesObject = document.all['setColor'];
	if(! LeaguesObject || index >= LeaguesObject.length) return;
	if(LeaguesObject.length) LeaguesObject = LeaguesObject[index];
	if($('Color_Mark').checked && LEAGUE['_' + LeaguesObject.lmc.toUpperCase()]) {
		LeaguesObject.bgColor = LEAGUE['_' + LeaguesObject.lmc.toUpperCase()].r;
		LeaguesObject.getElementsByTagName('td')[0].style.color = 'white';
	} else {
		LeaguesObject.bgColor = "#DFDFDF";
		LeaguesObject.getElementsByTagName('td')[0].style.color = '#C50002';
	}
	setTimeout("_setLeagues_Color(" + (index + 1) + ")" , 10);
}

function save_SoundSwitch() {
	deleteCookie("SoundSwitch");
	if(document.all("SoundSwitch").checked)
		setCookie("SoundSwitch",1,24);
	else
		setCookie("SoundSwitch",0,24);
}
function save_OpenWinMsg() {
	deleteCookie("OpenWinMsg");
	if(document.all("OpenWinMsg").checked)
		setCookie("OpenWinMsg",1,24);
	else
		setCookie("OpenWinMsg",0,24);
}
function save_setLeagues_Color() {
	deleteCookie("Color_Mark")
	if(document.all("Color_Mark").checked)
		setCookie("Color_Mark",1,24);
	else
		setCookie("Color_Mark",0,24);
	_setLeagues_Color();
}
function get_OpenWinMsg() {
	var getValue = getCookie("OpenWinMsg");
	if(parseInt(getValue) == 1)
		document.all("OpenWinMsg").checked = true;
	else
		document.all("OpenWinMsg").checked = false;
}

function get_SoundSwitch() {
	var getValue = getCookie("SoundSwitch");
	if(parseInt(getValue) == 1)
		document.all("SoundSwitch").checked = true;
	else
		document.all("SoundSwitch").checked = false;
}

function get_setLeagues_Color() {
	var getValue = getCookie("Color_Mark");
	if(parseInt(getValue)==1){
		document.all("Color_Mark").checked = true;
		_setLeagues_Color()
    } else
		document.all("Color_Mark").checked = false;
}

function revIMG(obj) {
	var objPath = obj.src;
	if(objPath.indexOf("b-.gif") > 0)
		obj.src="http://img.mso.com.cn/www/odds/b+.gif";
	else
		obj.src="http://img.mso.com.cn/www/odds/b-.gif";
}

//格式化日期串
Date.prototype.parseString = function(option) {
	return this.getYear() + '-' + 
			(option == 120 && (this.getMonth() + 1) < 10 ? '0' : '') + (this.getMonth() + 1) + '-' + 
			(option == 120 && this.getDate() < 10 ? '0' : '') + this.getDate() + ' ' +
			(option == 120 && this.getHours() < 10 ? '0' : '') + this.getHours() + ':' + 
			(option == 120 && this.getMinutes() < 10 ? '0' : '') + this.getMinutes() + ':' + 
			(option == 120 && this.getSeconds() < 10 ? '0' : '') + this.getSeconds();
}
/**东南亚即时赔率公共函数,参数***************************/
var mystuff;
mystuff="MSO 东南亚即时赔率"

flash_Sound = "<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='0' height='0' id='goal'><param name='movie' value='http://img.mso.com.cn/www/odds/odds_sound.swf'><param name='quality' value='high'><param name='wmode' value='transparent'></object>"


/**选择联赛部分****************************************/
function selectLeague_Line(LMC , index , sender) {
	var coll = document.all['tr_' + LMC];
	var imgs = document.all['img_' + LMC];
	var temp = $("input_league_" + index);
	if(! sender) temp.checked = !temp.checked;
	if(coll.length) {
		for(var a = coll.length - 1 ; a >= 0 ; a --) {
			coll[a].style.display = temp.checked ? 'block' : 'none';
			if(imgs.length && imgs[a]) imgs[a].src = temp.checked ? 'http://img.mso.com.cn/www/odds/b-.gif' : 'http://img.mso.com.cn/www/odds/b+.gif';
		}
		if(!imgs.length) imgs.src = temp.checked ? 'http://img.mso.com.cn/www/odds/b-.gif' : 'http://img.mso.com.cn/www/odds/b+.gif';
	} else {
		coll.style.display = temp.checked ? 'block' : 'none';
		imgs.src = temp.checked ? 'http://img.mso.com.cn/www/odds/b-.gif' : 'http://img.mso.com.cn/www/odds/b+.gif';
	}
}
/**选择联赛部分结束****************************************/

window.setColor_Object = {};
window.setColor_Object_Interval = {};

function setColor(obj,old_value,new_value,VSID,LMC){
	window.setColor_Object[String(VSID)] = LMC;
	clearTimeout(window.setColor_Object_Interval[String(VSID)]);
	window.setColor_Object_Interval[String(VSID)] = setTimeout("revertodds('" + VSID + "')", msShowOdds);
	
	var coll1 = $(LMC + '_ho_' + VSID);
	var coll2 = $(LMC + '_lo_' + VSID);
	var coll3 = $(LMC + '_hot_' + VSID);
	
	if(coll1 && coll2 && coll3) {
	
		if(old_value != new_value && parseFloat(old_value) < parseFloat(new_value) && old_value != "" && new_value != "") { //上升
			coll1.style.color = "#FF0000";
			coll2.style.color = "#006600";
			coll3.innerHTML = coll3.innerText + ' <img src="http://img.mso.com.cn/www/odds/1.gif" align="absmiddle">';
		}
		
		if(old_value != new_value && parseFloat(old_value) > parseFloat(new_value) && old_value != "" && new_value != "") {	//下降
			coll1.style.color = "#006600";
			coll2.style.color = "#ff0000";
			coll3.innerHTML = coll3.innerText + ' <img src="http://img.mso.com.cn/www/odds/2.gif" align="absmiddle">';
		}
		
		LastUpdateOdds(VSID , $("matchtime_" + VSID).indexofmatch , LMC)  //最后更新
		
		coll1.style.fontWeight = "bold";
		coll2.style.fontWeight = "bold";
		
		window.status = "The value of mso live odds is: " + mystuff;
	}
}

function revertodds(VSID) { //还原样式
	var o = $(window.setColor_Object[VSID] + '_hot_' + VSID);
	o.innerHTML = o.innerText;
	$(window.setColor_Object[VSID] + '_ho_' + VSID).style['color'] = '#666666';
	$(window.setColor_Object[VSID] + '_lo_' + VSID).style['color'] = '#666666';
	$(window.setColor_Object[VSID] + '_handicap_' + VSID).style['color'] = '#666666';
}

function LastUpdateOdds(UPDATEID,IndexOfNum,UpdateCom)
{
	var ComName = COMPANY['_' + UpdateCom.toUpperCase()].n;
	var UpdateHTML = "";
	var HandicapHtml = "";
	
	var temp = $('matchtime_' + UPDATEID).parentNode.leaguename;
	
	document.title = "最后变化[" + new Date().parseString(120).substr(11 , 10) + "] " + temp + "  " + ($("team_name_" + IndexOfNum) ? $("team_name_" + IndexOfNum).innerText : '') + "  " + ComName + " " +
		$(UpdateCom + "_ho_" + UPDATEID).innerText + " " + 
		$(UpdateCom + "_handicap_" + UPDATEID).innerText + " " + 
		$(UpdateCom + "_lo_" + UPDATEID).innerText + " - 即时赔率 - 足球 - MSO智慧体育在线";

	UpdateHTML = "<span style='font-size:9pt;'>" + temp + " " + ($("team_name_" + IndexOfNum) ? $("team_name_" + IndexOfNum).innerHTML : '') + "</span> "

	HandicapHtml = "<span style='font-size:9pt;'>" + ComName + " <font color='" + $(UpdateCom+"_ho_"+ UPDATEID).style.color+"'>" + $(UpdateCom+"_ho_"+ UPDATEID).innerText + "</font> " + 
		" <font style='font-size:9pt;' color='" + $(UpdateCom+"_handicap_"+ UPDATEID).style.color + "'>" + $(UpdateCom+"_handicap_" + UPDATEID).innerText + "</font> "+
		" <font style='font-size:9pt;' color='" + $(UpdateCom+"_lo_"+ UPDATEID).style.color + "'>" + $(UpdateCom+"_lo_"+ UPDATEID).innerText + "</font> </span>"
	
	try {
		$("LastUpdateOdds").innerHTML = UpdateHTML + HandicapHtml;
	}
	catch(e) {}
	
	window.status = "The value of mso live odds is: " + mystuff;
	
	//显示弹出的信息
	if(UpdateHTML != "" && document.all["OpenWinMsg"] && document.all["OpenWinMsg"].checked) {
		var o = $("LastUpdateOddsPoP");
		o.innerHTML = UpdateHTML + '<br>' + HandicapHtml// + '<br>' + o.innerHTML;
		richDialog();
	}
}

//关闭弹出窗口
//建立一个弹出窗口
var oPopup = window.createPopup();

//得到这个弹出窗口的body
var oPopupBody = oPopup.document.body;
var oPopupTimoutInterval = null;
//显示弹出窗口的方法
function richDialog() {
	//在弹出窗口中写入文字和数据
	oPopup.document.body.innerHTML = oDialog.innerHTML;
	
	oPopupBody.style.fontSize = document.body.currentStyle.fontSize;
	oPopupBody.style.backgroundColor='infobackground';
	oPopupBody.style.cursor="pointer";
	oPopupBody.style.color = "infotext";
	oPopupBody.style.borderWidth='0px';
	oPopupBody.style.borderStyle='window-inset';
	oPopupBody.style.borderColor='activeborder';
	//下面代码会立即显示弹出窗口
	oPopup.show(window.screen.width, window.screen.height - 200, 200, 140);
	clearTimeout(oPopupTimoutInterval);
	oPopupTimoutInterval = window.setTimeout( closePopup, msShowOdds);
}

function closePopup() {
	if(oPopup) oPopup.hide();
}

document.onreadystatechange = function() {
	if(document.readyState == "complete") {
		get_OpenWinMsg();
		get_SoundSwitch();
		get_setLeagues_Color();
	}
}