<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/race_const.asp" --><head><title>赛马中心</title></head>


<STYLE>#Layer0 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 10
}
#Layer1 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 20
}
#Layer2 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 30
}
#Layer3 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 40
}
#Layer4 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 50
}
#Layer5 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 60
}
#Layer6 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 60
}
#Layer7 {
	HEIGHT: 20px; LEFT: -100px; POSITION: absolute; TOP: -100px; WIDTH: 60px; Z-INDEX: 60
}
BODY {
	FONT-SIZE: 9pt; LINE-HEIGHT: 13pt; WORD-SPACING: normal
}
P {
	FONT-SIZE: 9pt; LINE-HEIGHT: 13pt; WORD-SPACING: normal
}
TD {
	FONT-SIZE: 9pt; LINE-HEIGHT: 13pt; WORD-SPACING: normal
}
</STYLE>
<style type="text/css">
select,input{font-size:9pt}
td{height:35;background:#ffffff;color:#ffffff;font-size:14}
</style>
<%
DEF_BBS_HomeUrl = "../../"
const npage = 2

GBL_CHK_TempStr=""
OpenDatabase
CheckUserOnline


Dim h1,h2,h3,h4,h5,h6,h7,h8,horseto,win,pledge,i,j,tmpasc

horseto=0
win=Request.Form("win")
if win="" then
%>
<script language="vbscript">
msgbox "对不起，您没有选择马匹！"
location.href = "race.asp"
</script>

<%
else
pledge=Request.Form("pledge")
if not isnumeric(pledge) then
%>
<script language="vbscript">
msgbox "请输入数字！"
location.href = "race.asp"
</script>

<%
elseif int(pledge) - pledge <>0 then
%>
<script language="vbscript">
msgbox "请输入整数！"
location.href = "race.asp"
</script>

<%
elseif pledge -minjinqian< 0 then
%>
<script language="vbscript">
msgbox "对不起，您的赌注太小，赌注下限是<%=minjinqian%>两银子！"
location.href = "race.asp"
</script>

<%
elseif pledge-maxjinqian>0 then
%>
<script language="vbscript">
msgbox "别玩的太大了，赌注上限是<%=maxjinqian%>两银子！"
location.href = "race.asp"
</script>

<%
else

dim horse(7)
for i=0 to 7
	horse(i)=Request.Form("horse"&i)
	if i= win-1 then horse(i)=pledge else horse(i)=0 end if
	for j=1 to len(horse(i))
		tmpasc=asc(mid(horse(i),j,1))
		if tmpasc<48 or tmpasc>57 then
			horse(i)=0
			exit for
		end if
	next
	horseto=horseto+horse(i)
next
horse(win-1)=pledge

if GBL_CHK_USER ="" then

%>
<script language="vbscript">
msgbox "您怎么跑到这里来的？请登陆社区！"
location.href = "<%=DEF_BBS_HomeUrl%>user/login.asp"
</script>

<%
else

dim sqlstr,rst
set rst=server.CreateObject ("adodb.recordset")
sqlstr="select * from [LeadBBS_User] where UserName='" & GBL_CHK_User&"' and points>="&horseto
rst.open sqlstr,con,1,1
dim charmpoint,onlinetime
charmpoint=rst("charmpoint")
onlinetime=clng(rst("onlinetime")/60)
	
if rst.EOF or rst.BOF then
%>
<script language="vbscript">
msgbox "您的钱数不够！"
location.href = "race.asp"
</script>
<%
elseif charmpoint-meili<0 then
%>
<script language="vbscript">
msgbox "您的魅力值不够！"
location.href = "race.asp"
</script>
<%
elseif onlinetime-jinyan<0 then
%>
<script language="vbscript">
msgbox "您的钱数不够！"
location.href = "race.asp"
</script>
<%
else
rst.Close
set rst=nothing
sqlstr="update [LeadBBS_User] set points=points-"&pledge&",charmpoint=charmpoint-"&MEILI&",onlinetime=clng(onlinetime/60-"&jinyan&")*60 where UserName='"&GBL_CHK_User&"'"
con.Execute sqlstr

 
%>
<SCRIPT language=JavaScript>
  
xcoor = new Array(10,10,10,10,10,10,10,10);  
ycoor = new Array(60,95,125,160,195,230,265,300,335);

for(j=0;j<8;j++){
	eval('document.all'+'["Layer'+j+'"]'+'.style.left='+xcoor[j]);
	eval('document.all'+'["Layer'+j+'"]'+'.style.top='+ycoor[j]);
}

function doplay()
{
    var x
    for(j=0;j<8;j++){
    	x=Math.floor(10*Math.random());
    	xcoor[j] = xcoor[j] + x;
    	if ( xcoor[j] >= 600) {
			document.form1.horsewin.value=j;
			document.form1.prize.value='<%=horse(j)%>';
			setTimeout('document.form1.submit()',1500);  
			
			return;
    	}
        eval('document.all'+'["Layer'+j+'"]'+'.style.left='+xcoor[j]);
		eval('document.all'+'["Layer'+j+'"]'+'.style.top='+ycoor[j]);
  	}
    setTimeout('doplay()',100);  
}
</SCRIPT>
<bgsound src=music\horse.mid loop=-1> 
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<body oncontextmenu="self.event.returnValue=false" scroll="no" onload=doplay() bgcolor=#000000>
<DIV id=Layer0><DD><IMG  src=pic/h1.gif > </DD></DIV>
<DIV id=Layer1><DD><IMG  src=pic/h2.gif > </DD></DIV>
<DIV id=Layer2><DD><IMG  src=pic/h3.gif > </DD></DIV>
<DIV id=Layer3><DD><IMG  src=pic/h4.gif > </DD></DIV>
<DIV id=Layer4><DD><IMG  src=pic/h5.gif > </DD></DIV>
<DIV id=Layer5><DD><IMG  src=pic/h6.gif > </DD></DIV>
<DIV id=Layer6><DD><IMG  src=pic/h7.gif > </DD></DIV>
<DIV id=Layer7><DD><IMG  src=pic/h8.gif > </DD></DIV>
<%
 dim horsename(8)
 horsename(1)=h1
 horsename(2)=h2
 horsename(3)=h3
 horsename(4)=h4
 horsename(5)=h5
 horsename(6)=h6
 horsename(7)=h7
 horsename(8)=h8
 win=Request.Form("win")
 pledge=Request.Form("pledge")
%>
<form method="post" action="result.asp" id=form1 name=form1>
  <table width=750 border=1 bgcolor=#ffffff cellpadding="3" cellspacing="0" >
    <tr bordercolor="#000099"> 
      <td colspan=4 align=center style="background:#ffffff;color:#000000"> 
        <div align="left"><font color="#000099" size="3"><br>
          您选择的是<%=win%> 号马 <%=horsename(win)%>，投注额为<%=pledge%> 两银子。</font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width=14 valign="middle" align="center" height="20"><font color="#000099">1</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse0"  value='<%=horse(0)%>'>
        　</font></td>
      <td width=86 height="7%"> 
        <div align="right"><font color="#000099"><%=h1%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">2</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse1"  value='<%=horse(1)%>'>
        　</font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h2%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">3</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse2"  value='<%=horse(2)%>'>
        　</font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h3%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">4</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse3"  value='<%=horse(3)%>'>
        　</font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h4%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">5</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse4"  value='<%=horse(4)%>'>
        　</font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h5%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">6</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse5"  value='<%=horse(5)%>'>
        </font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h6%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">7</font></td>
      <td width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse6"  value='<%=horse(6)%>'>
        </font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h7%></font></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF" bordercolor="#000099"> 
      <td width="14" valign="middle" align="center" height="20"><font color="#000099">8</font></td>
      <td height="31" width="624"> <font color="#000099"> 
        <input type=hidden readonly maxlength=3 size=3 name="horse7"  value='<%=horse(7)%>'>
        </font></td>
      <td width="86" height="7%"> 
        <div align="right"><font color="#000099"><%=h8%></font></div>
      </td>
    </tr>
    <tr width=100% bgcolor="#FFFFFF" bordercolor="#000099"> 
      <input type=hidden maxlength=3 size=3 name="horsewin" value='<%=horseto%>'>
      <input type=hidden maxlength=3 size=3 name="prize" value='<%=horseto%>'>
      <td colspan="3"><font color="#000099"><br>
        <br>
        </font></td>
    </tr>
  </table>
</FORM>
</body>
<% 
end if
end if
end if
end if%>