<%

sub down_main_top(n_num,c_num,n_title)
  dim n_username,n_topic,n_tim,n_cname,num_num,num_down,num_today
  sql="select count(id) from down where hidden=1 and tim>=#"&formatdatetime(formatdatetime(joekoe_cms.now_time,2))&"#"
  set rs=joekoe_cms.exec(sql,1)
  num_today=rs(0)
  rs.close
  if not int_true(num_today) then num_today=0
  sql="select top 1 num_down from configs"
  'sql="select count(id) from down where hidden=1"
  set rs=joekoe_cms.exec(sql,1)
  num_num=rs(0)
  rs.close
  if not int_true(num_num) then num_num=0
  sql="select sum(counter) from down where hidden=1"
  set rs=joekoe_cms.exec(sql,1)
  num_down=rs(0)
  rs.close
  response.write vbcrlf&down_bar_top(n_title,1,3) & _
		 vbcrlf&"<tr>" & _
		 vbcrlf&"<td width='70%'>" & _
		 vbcrlf&"  <table border=0 width='100%'>"
  sql="select top "&n_num&" d.id,d.username,d.name,d.tim,d.counter,c.c_id,c.c_name " & _
      "from jk_class c inner join down d on c.c_id=d.c_id where d.hidden=1 order by d.id desc"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    n_username=rs("username")
    n_topic=rs("name")
    n_tim=rs("tim")
    n_tim=joekoe_cms.time_type(n_tim,1)
    n_cname=rs("c_name")
    n_cname=joekoe_cms.code_html(n_cname,1,0)
    response.write vbcrlf&down_topic_main(rs("c_id"),n_cname,c_num,rs("id"),n_username,n_topic,n_tim,rs("counter"),2)
    rs.movenext
  loop
  rs.close
  response.write vbcrlf&"  </table>" & _
		 vbcrlf&"</td>" & _
		 vbcrlf&"<td width='30%' align=center>" & _
		 vbcrlf&"  <table border=0>" & _
		 vbcrlf&"  <tr><td>软件总数：<font class=red>"&num_num&"</font>个软件</td></tr>" & _
		 vbcrlf&"  <tr><td>今日更新：<font class=red>"&num_today&"</font>个软件</td></tr>" & _
		 vbcrlf&"  <tr><td>下载总数：<font class=red>"&num_down&"</font>人次</td></tr>" & _
		 vbcrlf&"  <tr><td class=gray><br>[ "&img_skin(web_img_h)&"<a href='down_list.asp'><font color=red><b>浏览软件详细列表</b></font></a> ]</td></tr>" & _
		 vbcrlf&"  </table>" & _
		 vbcrlf&"</td>" & _
		 vbcrlf&"</tr>" & _
		 vbcrlf&down_bar_end("",1)
end sub

sub down_pic(nt,n_num,c_num,n_title)
  dim temp1,nid,per_num,n_pic,n_topic
  per_num=100\n_num
  response.write vbcrlf&down_bar_top(n_title,1,1) & _
		 vbcrlf&"<tr align=center>"
  sql="select top "&n_num&" id,name,pic from down where hidden=1"
  select case nt
  case "hot"
    sql=sql&" order by counter desc,id desc"
  case "good"
    sql=sql&" and types=5 order by id desc"
  case else
    sql=sql&" order by id desc"
  end select
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    n_topic=rs("name")
    response.write vbcrlf&"<td width='"&per_num&"%'>"&format_pic_type(rs("pic"),n_topic,c_num,"down_view.asp?id="&rs("id"))&"</td>"
    rs.movenext
  loop
  rs.close
  response.write vbcrlf&"</tr>" & _
		 vbcrlf&down_bar_end("",1)
end sub
%>