<!--#include file="Config.asp" -->
<% 
TypeID = Wed_Lot_ID
eims = "About"
Title="抽奖中心"
PageTitle=eRead("Abaut",TypeID,"Title")

TempStr="000"
Set Rs = Server.CreateObject("ADODB.Recordset")
Condition="ItemRec=1 and TypeID="&TypeID&" and st1=0 and st2=0"
Sql = "Select Tel From [eims_Lottery] where "&Condition&" order by ItemID desc"
Rs.Open Sql,Conn,1,1
while not Rs.eof
TempStr=TempStr&"|"&trim(Rs(0))
Rs.movenext
wend
Rs.close
set Rs=nothing

tempArr=split(TempStr,"|")
%>
<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="img/eims.css">
<script type="text/javascript" src="Ajax.js"></script>

<script language="JavaScript">
var i=1;
var intervalid;

function LotStart(){	
	document.getElementById('LotStart').disabled=true;
	document.getElementById('LotStop').disabled=false;	
	intervalid = setInterval("objStart()", 50);		
}

function objStart(){
var tempStr = document.getElementById("Lotnow").innerText;
var tempArr = tempStr.split("|");
var tempNum = tempArr.length-1;

if (tempArr[i] != ''){
	var xnum = GetRandomNum(1,tempNum);
	document.getElementById("Tel").value=tempArr[xnum];
	//以随机数抽取，下面为顺序抽取
	//if (i<=tempNum){document.getElementById("Tel").value=tempArr[i];}
	//i++;
	//if (i>tempNum){i=1;}
}
}

function LotStop(){
document.getElementById('LotStart').disabled=false;
document.getElementById('LotStop').disabled=true;
clearInterval(intervalid);
Ajax(<%=TypeID%>); //载入AJAX数据
}

function GetRandomNum(Min,Max){   
var Range = Max - Min;   
var Rand = Math.random();   
return(Min + Math.round(Rand * Range));   
}  
</script>

<style>
.ec1 {width:480px;padding:3px 10px; border:#ee9999 dashed 2px; text-align:left; font-size:14px; font-weight:bold; font-family:'微软雅黑'}
.et1 {background:#def; color:#900; padding:10px; font-size:60px; border:none; width:380px; font-weight:bold;}
.et2 {background:#fca; color:#330000; font-size:16px; font-weight:bold;}
#colee_bottom1,#colee_bottom2 { color:#333333;}

#AjaxUl { list-style:none; list-style-type:none; margin:0; padding:0;}
#AjaxUl li {text-align:left;}

.LotTel {color:#FF0000; float:right; width:170px;height:290px;border-left:#888 dashed 1px; padding-left:10px; text-align:left; overflow:hidden;}
</style>
<title><% =Title %></title>
</head><body>

<%
telstr="未中奖名单1" '未中奖名单
for i=1 to ubound(tempArr)
telstr=telstr&"|"&tempArr(i)
next
%>
<div id="Lotnow" style="display:none;"><%=telstr%></div>

<div id="wrapper">	
<div id="scroller">

<div style="position:absolute; top:0; left:0; width:100%;" align="center">
<div style="width:666px;">
<h1 align="center" style="font-family:'微软雅黑'"><%=PageTitle%></h1>
<h3 style="text-align:center; font-family:'微软雅黑'">抽 奖 活 动 说 明</h3>
<div class="ec1"><%=eRead("Abaut",TypeID,"ItemNote")%></div>
<table border="0" cellspacing="0" cellpadding="8">
  <tr>
    <td><input type="text" name="tel" class="et1" readonly="true" value="00000000000" id="Tel"></td>
    <td>
	<div style="line-height:44px;">
	<input type="button" value="开始抽奖" class="et2" id="LotStart" onClick="LotStart()">
	<br>
	<input type="button" value="停止抽号" class="et2" id="LotStop" onClick="LotStop()" disabled="true">
	</div>
	</td>
  </tr>
  <tr>
    <td>
<div style="width:380px; height:300px; background:#FFeeee; padding:10px;">
<div id="AjaxContent" class="LotTel">中奖名单：</div>
<div id="colee_bottom" style="overflow:hidden;width:170px;height:290px; float:left;">
<div id="colee_bottom1">
	<ul id='AjaxUl'>
	<%
	for i=1 to ubound(tempArr)
	response.write "<li>"&tempArr(i)&"</li>"
	next
	%>
	</ul>
</div>
<div id="colee_bottom2"></div>
</div>
<script>
var speed=30
var colee_bottom2=document.getElementById("colee_bottom2");
var colee_bottom1=document.getElementById("colee_bottom1");
var colee_bottom=document.getElementById("colee_bottom");
colee_bottom2.innerHTML=colee_bottom1.innerHTML
colee_bottom.scrollTop=colee_bottom.scrollHeight
function Marquee2(){
if(colee_bottom1.offsetTop-colee_bottom.scrollTop>=0)
colee_bottom.scrollTop+=colee_bottom2.offsetHeight
else{
colee_bottom.scrollTop--
}
}
var MyMar2=setInterval(Marquee2,speed)
colee_bottom.onmouseover=function() {clearInterval(MyMar2)}
colee_bottom.onmouseout=function() {MyMar2=setInterval(Marquee2,speed)}
</script>

</div>
	</td>
    <td>
	</td>
  </tr>
</table>

<p style="width:100%; text-align:center">
技术支持：<a href="http://www.eims.org.cn/" target="_blank">EIMS工作室</a></p>

</div>
</div>

</div>	
</div>

</body></html>
<% Call CloseConn() %>