<!-- #include file="include/config.asp" -->
<!-- #include file="../include/jk_pagecute.asp" -->
<!-- #include file="../include/jk_page_cute.asp" -->
<%
dim nummer,nums,rssum,page,viewpage,thepages,pageurl,sql_add,num_col,pnum,w_num,vvt,vvs,nid,nname,nemoney,tr_ture,sqladd,vhead
pageurl="?types="&types&"&"
num_col=3
pnum=100\col_num
w_num=20
tr_ture=true
nummer=num_col*col_num
nums=nummer
sql_add=""

select case types
case "flash"
  vvt=2
  vvs=0
  n_sort="flash"
  tit="精彩Flash"
%>
<!-- #include file="../style/data_sort_flash.asp" -->
<%
case "film"
  vvt=0
  vvs=0
  n_sort="film"
  tit="精彩视频"
%>
<!-- #include file="../style/data_sort_film.asp" -->
<%
case else
  vvt=1
  vvs=0
  n_sort="gall"
  types="paste"
  tit="精彩贴图"
  url1="?types="&types
%>
<!-- #include file="../style/data_sort_gall.asp" -->
<%
end select

call cid_sid()
call getsortnames()

call web_head(0,0,0,0,0)
call vouch_load(0,0,0)
'----------------------------左边 开始----------------------------
call vouch_left_sort(tit,vvs)
call vouch_left()
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
call vouch_search(tit,0,types)
call gallery_list()
'----------------------------中间 结束----------------------------
call vouch_end()
call web_end(0,0)

sub gallery_list()
 dim tmp1,body
if cid>0 then
  sql_add=sql_add&" and c_id="&cid
  pageurl=pageurl&"c_id="&cid&"&"
  if sid>0 then
    sql_add=sql_add&" and s_id="&sid
    pageurl=pageurl&"s_id="&sid&"&"
  end if
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&"action=search&sea_type="&sea_type&"&keyword="&server.urlencode(keyword)&"&"
    vhead="&nbsp;&nbsp;搜索结果"
  end if
end if
sql="select count(id) from gallery where hidden=1 and types='"&types&"'"&sql_add&sqladd
set rs=joekoe_cms.exec(sql,1)
rssum=rs(0)
rs.close
call format_pagecute()
sql="select top "&nummer*viewpage&" id,name,spic,emoney,power,counter from gallery where hidden=1 and types='"&types&"'"&sql_add&sqladd&" order by id desc"
call joekoe_cms.exec("",-1)
rs.open sql,conn,1,1
if int(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
  nid=rs("id")
  nname=rs("name")
  nemoney=rs("emoney")
  if (i-1) mod col_num=0 then
      tmp1=tmp1&vbcrlf&"<tr><td>" & _
           vbcrlf&"  <table border=0 cellspacing=0 cellpadding=0 width='100%'>" & _
           vbcrlf&"  <tr align=center>"
    tr_ture=false
  end if
    tmp1=tmp1&vbcrlf&"<td width='"&pnum&"%'>" & _
         vbcrlf&"  <table border=0 cellspacing=0 cellpadding=2>" & _
         vbcrlf&"  <tr><td align=center>"&pic_fk(rs("spic"),1,"gallery_view.asp?types="&types&"&id="&nid)&"</td></tr>" & _
         vbcrlf&"  <tr><td align=center><b><a href='gallery_view.asp?types="&types&"&id="&nid&"' alt='"&joekoe_cms.code_html(nname,1,0)&"'>"&joekoe_cms.code_html(nname,0,w_num)&"</a></b></td></tr>"
 if vvt>0 then
    tmp1=tmp1&vbcrlf&"<tr><td align=center>"&joekoe_cms.web_unit&"：<font class=red2>"&nemoney&"</font>  人气：<font class=red>"&rs("counter")&"</font></td></tr>"
' if vvt>1 then
   ' tmp1=tmp1&vbcrlf&"<tr><td align=center>"&format_emoney_power(nemoney,rs("power"),0)&"</td></tr>"
   '   end if
    end if
    tmp1=tmp1&vbcrlf&"  </table>" & _
         vbcrlf&"</td>"
    if i mod col_num=0 then
      tr_ture=true
      tmp1=tmp1&vbcrlf&"  </tr>" & _
           vbcrlf&"  </table>" & _
           vbcrlf&"</td></tr>"
    end if
    rs.movenext
  next
  rs.close
  if not tr_ture then
    tmp1=tmp1&vbcrlf&"  </tr>" & _
         vbcrlf&"  </table>" & _
         vbcrlf&"</td></tr>"
  end if
tmp1=tmp1&vbcrlf&"  <tr><td height=30>" & _
		  vbcrlf&"  现有 <font class=red>"&rssum&"</font> 个"&tit&" ，" & _
		  vbcrlf&"  页次：<font class=red>"&viewpage&"</font>/<font class=red>"&thepages&"</font>&nbsp;" & _
		  vbcrlf&"  &nbsp;分页："&jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")&"" & _
		  vbcrlf&"</td><tr>"
 call vouch_center_table(tit,tmp1,1,"") 
end sub

sub getsortnames()
    sql="select c_name from jk_class where c_id="&cid
    if cint(sid)>0 then 
      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=joekoe_cms.exec(sql,1)
    if rs.eof then
      rs.close
        tit2="列表"
      exit sub
    end if
    tit2=rs("c_name")
	url2="list.asp?types="&types&"&c_id="&cid
    if cint(sid)>0 then tit3=rs("s_name")
    rs.close
end sub 

%>
