<%

sub down_list()
  dim mhead,n_name,n_tim,n_remark,sqladd,sql_tmp,cname,sname,sea_type,keyword,sea_term,taxis
  mhead=tit
  sqladd=""
  cname=""
  sname=""
  taxis=trim(request.querystring("taxis"))
  if cint(cid)>0 then
    sqladd=" and c_id="&cid
    sql="select c_name from jk_class where c_id="&cid
    if cint(sid)>0 then 
      sqladd=" and s_id="&sid
      sql="select jk_class.c_name,jk_sort.s_name from jk_sort inner join jk_class on jk_sort.c_id=jk_class.c_id where jk_sort.c_id="&cid&" and jk_sort.s_id="&sid
    end if
    set rs=conn.execute(sql)
    if not(rs.eof) then
      cname=rs("c_name")
      if cint(sid)>0 then sname=rs("s_name")
    end if
    rs.close
    mhead=mhead&"&nbsp;¡ú&nbsp;"&cname
    if sid>0 and sname<>"" then mhead=mhead&"&nbsp;¡ú&nbsp;"&sname
  end if
  keyword=code_search(request.querystring("keyword"))
  if action="search" and keyword<>"" then
    sea_type=trim(request.querystring("sea_type"))
    sea_term=trim(request.querystring("sea_term"))
    if sea_type<>"username" then sea_type="name"
    if sea_term<>"only" then sea_term="all"
    sql_tmp=sql_key(keyword,sea_type,2,sea_term)
    if sql_tmp<>"" then
      sqladd=sqladd&" and "&sql_tmp
      sql_tmp=""
      pageurl=pageurl&"sea_type="&sea_type&"&keyword="&server.urlencode(keyword)&"&"
      mhead=mhead&"&nbsp;¡ú&nbsp;¹Ø¼ü×Ö£º"&keyword
    end if
  end if
  sql="select count(id) from down where hidden=1"&sqladd
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  response.write vbcrlf&down_bar_top(mhead,1,1) & _
		 vbcrlf&down_list_top(pageurl&"page="&viewpage&"&")
  sql="select top "&viewpage*nummer&" id,name,tim,counter,sizes,types,remark from down where hidden=1"&sqladd
  select case taxis
  case "tim"
    sql=sql&" order by tim desc,id desc"
  case "counter"
    sql=sql&" order by counter desc,id desc"
  case "types"
    sql=sql&" order by types desc,id desc"
  case else
    taxis=""
  end select
  pageurl=pageurl&"taxis="&taxis&"&"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if cint(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
    n_name=rs("name")
    n_tim=rs("tim")
    n_tim=joekoe_cms.time_type(n_tim,1)
    n_remark=rs("remark")
    n_remark=joekoe_cms.cuted(n_remark,40)
    n_remark=joekoe_cms.code_html(n_remark,2,0)
    response.write vbcrlf&down_list_body(((viewpage-1)*nummer+i),rs("id"),n_name,n_tim,rs("counter"),rs("sizes"),rs("types"),n_remark)
    rs.movenext
  next
  rs.close
  if action<>"hot" then response.write vbcrlf&down_list_pagecute(nummer,rssum,viewpage,thepages,pageurl)
  response.write vbcrlf&down_bar_end("",1)
end sub

%>