sub main_center_video(vname,vgen,c_num,w_num)
dim osql,id,name,pnum
select case vgen
case "hot"
osql=" order by counter desc,id desc"
case "good"
osql=" and star=5 order by tim desc,id desc"
case else
osql=" order by id desc"
end select
pnum=100\c_num
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td0> <%response.write vname%></td></tr>
<tr class=bg_td><td>
<table border=0 cellspacing=0 cellpadding=0 width='100%'>
<tr align=center>
<%
if vgen="good" then
Dim idCollection,idArray,n,NN,idResult,idNum,idCount,idBound
idBound=50
set rs=joekoe_cms.exec("select count(id) as idCount from video where hidden=1 and star=5",1)
idCount=rs("idCount")
if idCount>idBound then
idCount=idBound
end if
rs.close
set rs=joekoe_cms.exec("select top " & idBound & " id from video where hidden=1 and star=5 order by id desc",1)
idCollection=""
do while not rs.eof
if n<idCount then
idCollection=idCollection & rs("id") & ","
else
idCollection=idCollection & rs("id")
end if
rs.movenext
loop
idArray=Split(idCollection,",")
idResult=""
idNum=0
do while idNum<6
Randomize()
NN=int(rnd()*Ubound(idArray)+1)
'response.write Ubound(idArray) & "-" & NN
'response.Flush()
if idArray(NN)<>"" then
idResult=idResult & idArray(NN) & ","
idArray(NN)=""
idNum=idNum+1
end if
loop
if len(idResult)>1 then
idResult=Left(idResult,Len(idResult)-1)
end if
rs.close
sql="select id,name,types,genre,lang,star,emoney,power,counter,star,remark,pic from video where id in (" & idResult & ") and hidden=1 and star=5 order by tim desc,id desc"
else
sql="select top "&c_num&" id,name,types,genre,lang,star,emoney,power,counter,star,remark,pic from video where hidden=1"&osql
end if
set rs=joekoe_cms.exec(sql,1)
do while not rs.eof
id=rs("id")
name=rs("name")
%>
<td width='<%'response.write pnum%>%'>
<table border=0 cellspacing=0 cellpadding=0>
<tr><td align=center><%response.write pic_fk(rs("pic"),6,"video_view.asp?id="&id)%></td></tr>
<tr><td align=center><b><a onclick="sAD()" href='video_view.asp?id=<%response.write id%>' alt='<%response.write joekoe_cms.code_html(name,1,0)%>'><%response.write joekoe_cms.code_html(name,1,w_num)%></a></b></td></tr>
</table>
</td>
<%
rs.movenext
loop
rs.close
%>
</tr>
</table>
</td></tr>
</table>
<%
end sub