dim met_ob(2)
met_ob(0) = "<img src='/images/index/redc.gif'>"
met_ob(1) = "<img src='/images/index/goal.gif'>"

dim bcn_ob(100)
bcn_ob(1) = "澳彩"	
bcn_ob(3) = "SB"
bcn_ob(4) = "立博"
bcn_ob(12) = "易胜博"
bcn_ob(24) = "IBC沙巴"

dim odds_flag_arr(3)
odds_flag_arr(0) = ""
odds_flag_arr(1) = "&nbsp;<FONT color=#ff0000>升</FONT>"
odds_flag_arr(2) = "&nbsp;<FONT color=#0000ff>降</FONT>"
odds_flag_arr(3) = ""

dim level_flag_arr(3)
level_flag_arr(0) = ""
level_flag_arr(1) = "style=background-color:#ffbebe;"
level_flag_arr(2) = "style=background-color:#aaffaa;"
level_flag_arr(3) = ""

dim GoalCn(40) '让球盘口
dim Goal_T_Cn(80)'大小盘盘口
GoalCn(0)="平手"
GoalCn(1)="平手/半球"
GoalCn(2)="半球"
GoalCn(3)="半球/一球"
GoalCn(4)="一球"
GoalCn(5)="一球/球半"
GoalCn(6)="球半"
GoalCn(7)="球半/两球"
GoalCn(8)="两球"
GoalCn(9)="两球/两球半"
GoalCn(10)="两球半"
GoalCn(11)="两球半/三球"
GoalCn(12)="三球"
GoalCn(13)="三球/三球半"
GoalCn(14)="三球半"
GoalCn(15)="三球半/四球"
GoalCn(16)="四球"
GoalCn(17)="四球/四球半"
GoalCn(18)="四球半"
GoalCn(19)="四球半/五球"
GoalCn(20)="五球"
GoalCn(21)="五球/五球半"
GoalCn(22)="五球半"
GoalCn(23)="五球半/六球"
GoalCn(24)="六球"

Goal_T_Cn(0)="0"
Goal_T_Cn(1)="0/0.5"
Goal_T_Cn(2)="0.5"
Goal_T_Cn(3)="0.5/1"
Goal_T_Cn(4)="1"
Goal_T_Cn(5)="1/1.5"
Goal_T_Cn(6)="1.5"
Goal_T_Cn(7)="1.5/2"
Goal_T_Cn(8)="2"
Goal_T_Cn(9)="2/2.5"
Goal_T_Cn(10)="2.5"
Goal_T_Cn(11)="2.5/3"
Goal_T_Cn(12)="3"
Goal_T_Cn(13)="3/3.5"
Goal_T_Cn(14)="3.5"
Goal_T_Cn(15)="3.5/4"
Goal_T_Cn(16)="4"
Goal_T_Cn(17)="4/4.5"
Goal_T_Cn(18)="4.5"
Goal_T_Cn(19)="4.5/5"
Goal_T_Cn(20)="5"
Goal_T_Cn(21)="5/5.5"
Goal_T_Cn(22)="5.5"
Goal_T_Cn(23)="5.5/6"
Goal_T_Cn(24)="6"
Goal_T_Cn(25)="6/6.5"
Goal_T_Cn(26)="6.5"
Goal_T_Cn(27)="6.5/7"
Goal_T_Cn(28)="7"
Goal_T_Cn(29)="7/7.5"
Goal_T_Cn(30)="7.5"
Goal_T_Cn(31)="7.5/8"
Goal_T_Cn(32)="8"
Goal_T_Cn(33)="8/8.5"
Goal_T_Cn(34)="8.5"
Goal_T_Cn(35)="8.5/9"
Goal_T_Cn(36)="9"
Goal_T_Cn(37)="9/9.5"
Goal_T_Cn(38)="9.5"
Goal_T_Cn(39)="9.5/10"
Goal_T_Cn(40)="10"
Goal_T_Cn(41)="10/10.5"
Goal_T_Cn(42)="10.5"
Goal_T_Cn(43)="10.5/11"
Goal_T_Cn(44)="11"
Goal_T_Cn(45)="11/11.5"
Goal_T_Cn(46)="11.5"
Goal_T_Cn(47)="11.5/12"
Goal_T_Cn(48)="12"
pkob=3
function get_match_info_html(dt,matchid,yearstr)
	set data_xml_ob = CreateObject("Microsoft.XMLDOM")
	data_xml_ob.async = false 
	'msgbox "/matchxml/"&yearstr&"/"&matchid&".xml"
	If data_xml_ob.load("/asp/matchxml.asp?idstr=/"&yearstr&"/"&matchid&".xml") Then
		set  rs = data_xml_ob.documentelement
		
		ti = rs.getElementsByTagName("ti")(0).text
		ti_2=split(ti,"!")
		ti_2_0_ary=split(ti_2(0),",")
		ti_2_1_ary=split(ti_2(1),",")
		'Select Case lver
			'case "big5"
				xt=ti_2_0_ary(0)
				yt=ti_2_1_ary(0)
			'case "gb"
				'xt=ti_2_0_ary(1)
				'yt=ti_2_1_ary(1)
			'case "en"
				'xt=ti_2_0_ary(2)
				'yt=ti_2_1_ary(2)
		'End select
		bf = rs.getElementsByTagName("bf")(0).text
		If instr(bf,"!")>0 Then
		bf_ary=split(bf,"!")
		bf_x=bf_ary(0)
		bf_y=bf_ary(1)
		Else
			bf_x=""
			bf_y=""
		End If
		rd = rs.getElementsByTagName("rd")(0).text			
		if instr(rd,"!")>0 Then	
			rd_ary=split(rd,"!")
			rd_x=rd_ary(0)
			rd_y=rd_ary(1)
		Else
			rd_x=""
			rd_y=""
		end If
		pm_x=""
		pm_y=""
		pm = rs.getElementsByTagName("pm")(0).text
		If instr(pm,"!")>0 Then
		pm_ary=split(pm,"!")
		if pm_ary(0)<>"" Then pm_x = "["&pm_ary(0)&"]"
		if pm_ary(1)<>"" Then pm_y = "["&pm_ary(1)&"]"
		End If
		no = rs.getElementsByTagName("no")(0).text
	
		wt = rs.getElementsByTagName("wt")(0).text
		If instr(wt,"|")>0 Then
		wt_ary=split(wt,"|")
		If wt_ary(0)<>"" Then
			wea_msg = wt_ary(1)&" "&wt_ary(2)
			'wea_img = "<img src='/images/weather/"&wea_img_ob(wt_ary(0))&"'>"
		End If
		End If
		tv = rs.getElementsByTagName("tv")(0).text
		gd = rs.getElementsByTagName("gd")(0).text
	
		gd_msg = "(主)"
		if gd = "n" then 
			gd_msg = "(中)"
		End If
		html_2 = ""
		html_3 = ""
		table_w = "290"
		if dt = "odds" then 
			table_w = "350"
		End If
	End If
	html = "<div class='dataFly xFly'  style='WIDTH: "&table_w&"px;'>"
	Select Case dt
		case "goal"
			html_2 = html_2&"{goal_list}"
			html_3 =html_3& "<table cellpadding=0 cellspacing=0>"
			html_3 =html_3& "<tr>"
			html_3 =html_3&"<td bgcolor=#cccccc colspan=3 height=1></td>"
			html_3 =html_3& "</tr>"
			if tv<>"" Then 
				html_3 =html_3& "<tr align=left><td style='padding-left: 5px'><img src='/images/tv.gif'>&nbsp;"&tv&"</td></tr>"
			End If
			if wt<>"" Then
				html_3 =html_3& "<tr align=left><td style='padding-left: 5px'>"&wea_img&"&nbsp;"+wea_msg+"</td></tr>"
			End If
			if no<>"" Then
				html_3 =html_3& "<tr align=center><td style='padding-left: 5px;color:red;'>"&no&"</td></tr>"
			End If
			
			html_3 =html_3& "</table>"
			
			html =html& "<sup>"&rd_x&" "&pm_x&"</sup><strong>"&xt&"</strong><em>"&gd_msg&"</em>　<strong>"&bf_x&"-"&bf_y&"</strong>　 <strong>"&yt&"</strong><sup>"&pm_y&""&rd_y&"</sup>"
		case "odds"
			html_2 =html_2& "{odds_list}"
			
			html =html& "<span style='float:right;color:#900'>"&bcn_ob(pkob)&"指数</span><sup>"&rd_x&" "&pm_x&"</sup><strong>"&xt&"</strong><em>"&gd_msg&"</em>　<strong>"&bf_x&"-"&bf_y&"</strong>　 <strong>"&yt&"</strong><sup>"&pm_y&""&rd_y&"</sup>        "
	End Select
	
	html =html& html_2
	html =html& html_3
	html =html&" <div class=explain>www.qiutan.net Copyrgiht &copy; 2007</div>"
	html =html& "</div>"

	
	
	get_match_info_html=html
	set data_xml_ob=nothing
end function 


sub data_popup(display,dt,matchid,yearstr)

	if dt = "goal" and omv_bf = "2" Then
		exit sub
	End If
	if dt = "odds" and omv_pk = "2" Then
		exit sub
	End If

	 html = ""
	
	if display <> "none" Then 
		'yearstr=changedatap(datestr)
		html = get_match_info_html(dt,matchid,yearstr)
		set data_xml_ob = CreateObject("Microsoft.XMLDOM")
		data_xml_ob.async = false
		Select Case dt
			Case "goal"
				If data_xml_ob.load("/bfxml/"&yearstr&"/"&matchid&".xml") Then
					set rs=data_xml_ob.documentelement
					
					mestr = rs.getElementsByTagName("me")(0).text
					me_2=split(mestr,"!")
				
					ghtml = "<table width=98% align=center cellpadding=1 cellspacing=1>"
					For i=0 to ubound(me_2)-1
						If instr(me_2(i),",")>0 Then
						me_3=split(me_2(i),",")
					
						team_flag = me_3(0)
						event_type = me_3(1)
						timestr = trim(me_3(2))
						man = me_3(3)
						If event_type="card" Then
							event_type=0
						ElseIf event_type="goal"  Then
							event_type=1
						End If
						ghtml = ghtml& "<tr>"
						Select Case team_flag
							case "x"
								ghtml = ghtml&"<td width='44%' align='right' valign='baseline'>"
								ghtml = ghtml& met_ob(event_type) & "&nbsp;" & man
								ghtml = ghtml& "</td>"
								ghtml = ghtml& "<td width='12%' align='center' valign='baseline'>"
								ghtml = ghtml& "<font color=#993300>["&timestr&"']</font>"
								ghtml = ghtml& "</td>"
								ghtml = ghtml& "<td width='44%' align='left' valign='baseline'>"
								ghtml = ghtml& "&nbsp;"
								ghtml = ghtml& "</td>"
							case "y"
								ghtml = ghtml& "<td width='44%' align='right'>"
								ghtml = ghtml& "&nbsp;"
								ghtml = ghtml& "</td>"
								ghtml = ghtml& "<td width='12%' align='center' valign='baseline'>"
								ghtml = ghtml& "<font color=#993300>["&timestr&"']</font>"
								ghtml = ghtml& "</td>"
								ghtml = ghtml& "<td width='44%' align='left'>"
								ghtml = ghtml&  man & "&nbsp;" & met_ob(event_type)				
								ghtml = ghtml&  "</td>"
						End Select
						ghtml = ghtml& "</tr>"
						End If
					Next
					ghtml = ghtml& "</table>"
					html=Replace(html,"{goal_list}",ghtml)
				Else
					html =Replace(html,"{goal_list}","")
				End If
			case "odds"
				'msgbox "/oddsxml/"&pkob&"/"&yearstr&"/"&matchid&".xml"
				If data_xml_ob.load("/asp/oddsxml.asp?pkob="&pkob&"&idstr="&yearstr&"/"&matchid&".xml") Then
					set rs = data_xml_ob.documentElement
					
					asia = rs.getElementsByTagName("asia")(0).text
					If instr(asia,"!")>0 Then
						asia_2=split(asia,"!")
						If instr(asia_2(0),",")>0 Then
							asia_3=split(asia_2(0),",")
							asia_3_0=asia_3(0)
							asia_3_1=asia_3(1)
							asia_3_2=asia_3(2)
							asia_3_3=asia_3(3)
							asia_3_4=asia_3(4)
							asia_3_5=asia_3(5)
							pkstr=Goal2GoalCn(asia_3_0)
						Else
							pkstr="--"
						End If
						If instr(asia_2(1),",")>0 Then
							asia_4=split(asia_2(1),",")
							asia_4_0=asia_4(0)
							asia_4_1=asia_4(1)
							asia_4_2=asia_4(2)
							plstr2=Goal2GoalCn(asia_4_0)
						Else
							plstr2="--"
						End If
					End If
				
					ohtml = "<table border=""0"" cellspacing=""0"" cellpadding=""0"">"
					ohtml =ohtml& "<tr>"
					ohtml =ohtml& "<td>&nbsp;</td>"
					ohtml =ohtml& "<td colspan=""3"" class=""bgY"">即时指数</td>"
					ohtml =ohtml& "<td colspan=""3"">初盘指数</td>"
					ohtml =ohtml& "</tr>"
					ohtml =ohtml& "<tr>"
					ohtml =ohtml& "<td>亚</td>"
					ohtml =ohtml& "<td width=35 "&level_flag_arr(asia_3_3)&" class=bgY>"&asia_3_2&"</td>"
				
					ohtml =ohtml& "<td width=100>"&pkstr&odds_flag_arr(asia_3_1)&"</td>"
					ohtml =ohtml& "<td width=35 "&level_flag_arr(asia_3_5)&" class=bgY>"&asia_3_4&"</td>"
					ohtml =ohtml& "<td width=35>"&asia_4_1&"</td>"
					ohtml =ohtml& "<td width=100>"&pkstr2&"</td>"
					ohtml =ohtml& "<td width=35>"&asia_4_2&"</td>"
					ohtml =ohtml& "</tr>"
					'<europe>主胜,主胜升降标记,平手,平手升降标记,主负,主负水位升降标记,时间!初  主胜,平手,主负,时间</europe>
				
					europe = rs.getElementsByTagName("europe")(0).text				
					europe_3_0="--"
					europe_3_1="--"
					europe_3_2="--"
					europe_3_3="--"
					europe_3_4="--"
					europe_3_5="--"
				
					europe_4_0="--"
					europe_4_1="--"
					europe_4_2="--"
					If europe<>"" Then
						If instr(europe,"!")>0 Then
							europe_2 =split(europe,"!")
							If instr(europe_2(0),",")>0 Then
								europe_3 = split(europe_2(0),",")
								europe_3_0 = europe_3(0)
								europe_3_1 = level_flag_arr(europe_3(1))
								europe_3_2 = europe_3(2)
								europe_3_3 = level_flag_arr(europe_3(3))
								europe_3_4 = europe_3(4)
								europe_3_5 = level_flag_arr(europe_3(5))
							End IF
							If instr(europe_2(1),",")>0 Then
								europe_4 = split(europe_2(1),",")
								europe_4_0 = europe_4(0)
								europe_4_1 = europe_4(1)
								europe_4_2 = europe_4(2)
							End If
						End If
						
					
						
					End If
				
					ohtml =ohtml& "<tr>"
					ohtml =ohtml& "<td>欧</td>"
					ohtml =ohtml& "<td width=35 "&europe_3_1&" class=bgY>"&europe_3_0&"</td>"
					ohtml =ohtml& "<td width=100 "&europe_3_3&" class=bgY>"&europe_3_2&"</td>"
					ohtml =ohtml& "<td width=35 "&europe_3_5&" class=bgY>"&europe_3_4&"</td>"
					ohtml =ohtml& "<td width=35>"&europe_4_0&"</td>"
					ohtml =ohtml& "<td width=100>"&europe_4_1&"</td>"
					ohtml =ohtml& "<td width=35>"&europe_4_2&"</td>"
					ohtml =ohtml&"</tr>"
					bs = rs.getElementsByTagName("bs")(0).text
		
							
					bs_3_0="--"
					bs_3_1=""
					bs_3_2="--"
					bs_3_3="--"
					bs_3_4="--"
					bs_3_5="--"
				
					bs_4_0="--"
					bs_4_1="--"
					bs_4_2="--"
				
					If bs<>"" Then	
						If instr(bs,"!")>0 Then
							bs_2 =split(bs,"!")
							If instr(bs_2(0),",")>0 Then
								bs_3 =split(bs_2(0),",")
								
								bs_3_0 = Goal_T_Cn(abs(cint(bs_3(0)*4)))
								bs_3_1 = odds_flag_arr(bs_3(1))
								bs_3_2 = bs_3(2)
								bs_3_3 = level_flag_arr(bs_3(3))
								bs_3_4 = bs_3(4)
								bs_3_5 = level_flag_arr(bs_3(5))
								
							End If
							If instr(bs_2(1),",")>0 Then
								
								bs_4 =split(bs_2(1),",")
								bs_4_0 = Goal_T_Cn(abs(cint(bs_4(0)*4)))
								bs_4_1 = bs_4(1)
								bs_4_2 = bs_4(2)
							End If
						End If	
						
					
						
					End If
					
					ohtml =ohtml& "<tr>"
					ohtml =ohtml& "<td>大</td>"
					ohtml =ohtml& "<td width=35 "&bs_3_3&" class=bgY>"&bs_3_2&"</td>"
					ohtml =ohtml& "<td width=100>"&bs_3_0&bs_3_1&"</td>"
					ohtml =ohtml& "<td width=35 "&bs_3_5&" class=bgY>"&bs_3_4&"</td>"
					ohtml =ohtml& "<td width=35>"&bs_4_1&"</td>"
					ohtml =ohtml& "<td width=100>"&bs_4_0&"</td>"
					ohtml =ohtml& "<td width=35>"&bs_4_2&"</td>"
					ohtml =ohtml& "</tr>"
					ohtml =ohtml& "</table>"
					
					html=Replace(html,"{odds_list}", ohtml)
				Else
					html =replace(html,"{odds_list}","")
				End If
				
		End select 
		
		set data_xml_ob=nothing
	End If
	
	If typename(document.getElementById("data_div"))<>"Nothing" then
		document.getElementById("data_div").style.display = ""
	Else
		mst = "<div id='data_div' style='position:absolute;display:none; border-width:1; border-style:outset; padding:3; width:20; height:20; z-index:1; left: 300; top: 100;background-color:#ffffff'>"
		mst =mst& "<table width=100% border=0 cellspacing=2 cellpadding=0 align=center>"
		mst =mst& "<tr><td id='data_td' noWrap></td></tr>"
		mst =mst&"</table></div>"
		document.body.insertAdjacentHTML "beforeEnd",mst 
	End If
	
	if html<>"" Then 
		document.getElementById("data_td").innerHTML = html
		
	End If
		
	
	document.getElementById("data_div").style.display = display
	'select case row
		'case "r1" 

			document.all.data_div.style.pixelLeft = window.event.clientX + 20 + window.document.body.scrollLeft
			document.all.data_div.style.pixelTop = window.event.clientY + document.documentElement.scrollTop-5
		
		'case "r2"
			'document.all.data_div.style.pixelLeft = window.event.clientX - 200 + window.document.body.scrollLeft
			'document.all.data_div.style.pixelTop = window.event.clientY + document.documentElement.scrollTop+15
		
	'End select 
end sub



sub data_popup1()
	If typename(document.getElementById("data_div"))<>"Nothing" then
		'select case row
			'case "r1" 

				document.all.data_div.style.pixelLeft = window.event.clientX + 20 + window.document.body.scrollLeft
				document.all.data_div.style.pixelTop = window.event.clientY + document.documentElement.scrollTop-5
		
			'case "r2"
				'document.all.data_div.style.pixelLeft = window.event.clientX - 200 + window.document.body.scrollLeft
				'document.all.data_div.style.pixelTop = window.event.clientY + document.documentElement.scrollTop+15
		'End Select
	End If
end sub


sub TeamPanlu_10(id,matchdate)
	theUrl="/asp/panlu.asp?id="&id&""
	
	window.open theURL
end sub
sub showgoallist(id,matchdate)
	theURL="/asp/detail.asp?id="&id&""
	window.open theURL
end sub

sub  analysis(ID,matchdate)
	'theURL="/analysis/asp/analysis.asp?id=" & ID & ""
	theURL="/analysis.asp?id="&ID&""
	window.open theURL
end sub
sub Showoddspanlu(matchid,pkob,matchdate)
	theURL="/odds/odds_panlu.asp?matchid="&matchid&"&companyid="&pkob&""
	window.open theURL
end sub
function Goal2GoalCn(goal)
	'数字盘口转汉汉字
	if goal>=0 then Goal2GoalCn=GoalCn(cint(goal*4)) else Goal2GoalCn="*"& GoalCn(abs(cint(goal*4)))
end function
function Goal2GoalCn2(goal)
	'数字盘口转 0/0.5形式的盘口
	if goal>=0 then Goal2GoalCn2=Goal_T_Cn(cint(goal*4)) else Goal2GoalCn2="*"& Goal_T_Cn(abs(cint(goal*4)))
end function

function changedatap(datestr)
	yearstr=year(datestr)
	monthstr=month(datestr)
	daystr=Day(datestr)
	If monthstr<10 Then
		monthstr="0"&monthstr
	End If
	If daystr<10 Then
		daystr="0"&daystr
	End If
	changedatap=yearstr&"/"&yearstr&monthstr&daystr
	
End function
function changedata(datestr)
	yearstr=year(datestr)
	monthstr=month(datestr)
	daystr=Day(datestr)
	If monthstr<10 Then
		monthstr="0"&monthstr
	End If
	If daystr<10 Then
		daystr="0"&daystr
	End If
	changedata=yearstr&monthstr&daystr
	
End function