<!-- #include file="include/admin_onlogin.asp" -->
<!-- #include file="include/ads_txt_dim.asp" -->
<%
dim ntit2,tmp1
index_url="ads"
call admin_master(0,0)
call admin_header(0,0)
if jk_mod="txt" then
  call dim_ndim()
  ntit="文字"&tit_fir
  nsort_name=nsort_name&ntit
  pageurl=pageurl&"nsort="&nsort&"&"
else
  ntit="图片"&tit_fir
  jk_mod=""
end if
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?jk_mod='<%if jk_mod<>"txt" then response.write " class=red"%>>图片<%response.write tit_fir%>管理</a></td>
  <td width=10></td>
  <td><a href='?jk_mod=txt'<%if jk_mod="txt" then response.write " class=red"%>>文字<%response.write tit_fir%>管理</a></td>
  </tr>
  </table>
</td></tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<%
call admin_table(1,1)
call admin_td(ntit)

select case jk_mod
case "txt"
%>
<tr align=center valign=top>
<td>
  <table border=0>
  <tr><td height=30><%response.write img_admin("","")%>&nbsp;<a href='<%response.write pageurl%>'>所有<%response.write ntit%></a></td></tr>
<%
for i=1 to nnum
  tmp1=""
  response.write vbcrlf&"  <tr><td>"&img_admin("","")&"&nbsp;<a href='?jk_mod="&jk_mod&"&nsort="&ndim(0,i)&"'"
  if nsort=ndim(0,i) then
    response.write " class=red"
    ntit2=ndim(1,i)
    tmp1=vbcrlf&"  <tr><td>"&img_admin("s_imp","")&"&nbsp;<a href='"&pageurl&"action=js' onclick=""javascript:return click_return('更新"&ntit2&ntit&"ＪＳ',0);"" class=blue>更新"&ntit2&"ＪＳ</td></tr><tr><td height=5></td></tr>"
  end if
  response.write ">"&ndim(1,i)&ntit&"</a></td></tr>" & tmp1
next
%>
  <tr><td height=30><%response.write img_admin("","")%>&nbsp;<a href='<%response.write pageurl%>action=add'<%if action="add" then response.write " class=red"%>>添加<%response.write ntit%></a></td></tr>
  </table>
</td>
<td>
  <table cellspacing=1 cellpadding=3 class=table0>
<%
  if action="handle" then call joekoe_chk_txt_handle()
  select case action
  case "js"
    call joekoe_chk_txt_js()
  case "edit"
    call joekoe_chk_txt_edit()
  case "add"
    call joekoe_chk_txt_add()
  case else
    call joekoe_chk_txt_main()
  end select
%>
  </table>
</td>
</tr>
<%
case else
%>
<tr align=center valign=top>
<td>
  <table border=0>
  <tr><td height=30><%response.write img_admin("","")%>&nbsp;<a href='<%response.write pageurl%>'>所有<%response.write ntit%></a></td></tr>
  <tr><td height=30><%response.write img_admin("","")%>&nbsp;<a href='<%response.write pageurl%>action=add'<%if action="add" then response.write " class=red"%>>添加<%response.write ntit%></a></td></tr>
  </table>
</td>
<td>
  <table cellspacing=1 cellpadding=3 class=table0>
<%
  if action="handle" then call joekoe_chk_handle()
  select case action
  case "view"
    call joekoe_chk_view()
  case "edit"
    call joekoe_chk_edit()
  case "add"
    call joekoe_chk_add()
  case else
    call joekoe_chk_main()
  end select
%>
  </table>
</td>
</tr>
<tr class=tr2><td>调用方法：</td><td>&lt;script language=javascript src='ads/ads_<font class=red>(广告代码)</font>.js'&gt;&lt;/script&gt;</td></tr>
<tr class=tr2><td>相关说明：</td><td>每当您添加或修改<%response.write ntit%>时都会自动生成一个 JS 脚本，即为广告的内容。</td></tr>
<%
end select

call erase_ndim()
call admin_ender(1)

sub joekoe_chk_txt_js()
  dim filetype,file_name,topic,rssum
  file_name="../style/data_ads_txt_"&nsort&".js"
  rssum=1
  sql="select * from ads_txt where nsort='"&nsort&"' order by id"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    filetype=filetype&"ads_txt_dim["&rssum&"]="""&rs("head")&"|"&rs("topic")&"|"&rs("tit")&"|"&rs("url")&""";"&vbcrlf
    rs.movenext
    rssum=rssum+1
  loop
  rs.close
  rssum=rssum-1
  filetype="<!--"&vbcrlf & _
	   "var ads_txt_dim=new Array("&rssum&");"&vbcrlf & _
	   "var ads_txt_num="&rssum&";"&vbcrlf & _
	   filetype & _
	   "-->"
  call create_file(file_name,filetype)
  call admin_msg("生成 "&nsort_name&" JS 成功！",pageurl,1)
end sub

sub joekoe_chk_txt_handle()
  dim sel_type,seltype,sel_id,hdim,hnum,hid,hi,htype
  htype=1
  sel_type=trim(request.form("sel_type"))
  select case sel_type
  case "删除"
    seltype="delete"
  case else
    sel_type=""
    seltype=""
  end select
  if joekoe_cms.post_chk()=false or seltype="" then exit sub
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  for hi=0 to hnum
    hid=hdim(hi)
    if isnumeric(hid) then
      call joekoe_cms.exec("delete from ads_txt where id="&hid,0)
    end if
  next
  erase hdim
  action=""
  call admin_event(sel_type&" "&(hnum+1)&" 条 （"&ntit2&"）"&ntit,0,0)
  response.write vbcrlf&"<script language=javascript>alert(""已成功"&sel_type&"了 "&(hnum+1)&" （"&ntit2&"）"&ntit&"！"");</script>"
end sub

sub joekoe_chk_txt_edit()
  sql="select top 1 * from ads_txt where id="&id
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(nsort_name&"（ID："&id&"）不在存！",pageurl,1)
    exit sub
  end if
  dim head,topic,url
  call admin_td("编辑"&ntit)
  if chk() then
    nsort=nsort_type(trim(request.form("nsort")),0)
    head=code_admin("head",1,10)
    topic=code_admin("topic",1,50)
    tit=code_admin("tit",1,30)
    url=code_admin("url",1,200)
    if nsort="" or head="" or topic="" or url="" or lcase(url)="http://" then
      call admin_error("请填写"&ntit&"的相关信息！")
      exit sub
    end if
    rs("nsort")=nsort
    rs("head")=head
    rs("topic")=topic
    rs("tit")=tit
    rs("url")=url
    rs.update
    rs.close
    call admin_msg("成功编辑一条"&nsort_name,pageurl,1)
    exit sub
  end if
  call form_first()
%>
  <form action='<%response.write pageurl%>action=edit&id=<%response.write id%>' method=post>
  <input type=hidden name=chk value='yes'>
  <tr><td width='15%'><%response.write tit_fir%>类型：</td><td width='85%'><%response.write nsort_select(rs("nsort"),ntit)%></td></tr>
  <tr height=30><td><%response.write tit_fir%>题头：</td><td><input type=text name=head value='<%response.write rs("head")%>' size=10 maxlength=10><%response.write redx%>如：<font class=blue>广告</font>&nbsp;&nbsp;<font class=gray>注意：不要加入“[”、“]”</a></td></tr>
  <tr height=30><td><%response.write tit_fir%>内容：</td><td><input type=text name=topic value='<%response.write rs("topic")%>' size=50 maxlength=50><%response.write redx%></td></tr>
  <tr height=30><td><%response.write tit_fir%>参数：</td><td><input type=text name=tit value='<%response.write rs("tit")%>' size=30 maxlength=30></td></tr>
  <tr height=30><td>链接地址：</td><td><input type=text name=url value='<%response.write rs("url")%>' size=50 maxlength=200><%response.write redx%></td></tr>
<%
  rs.close
  call submit_edit()
end sub

sub joekoe_chk_txt_add()
  dim head,topic,url
  call admin_td("添加"&ntit)
  if chk() then
    nsort=nsort_type(trim(request.form("nsort")),0)
    head=code_admin("head",1,10)
    topic=code_admin("topic",1,50)
    tit=code_admin("tit",1,30)
    url=code_admin("url",1,200)
    if nsort="" or head="" or topic="" or url="" or lcase(url)="http://" then
      call admin_error("请填写"&ntit&"的相关信息！")
      exit sub
    end if
    sql="select * from ads_txt"
    call joekoe_cms.exec("",-1)
    rs.open sql,conn,1,3
    rs.addnew
    rs("nsort")=nsort
    rs("head")=head
    rs("topic")=topic
    rs("tit")=tit
    rs("url")=url
    rs.update
    rs.close
    call admin_msg("成功添加一条新的"&nsort_name,pageurl,1)
    exit sub
  end if
  call form_first()
%>
  <form action='<%response.write pageurl%>action=add' method=post>
  <input type=hidden name=chk value='yes'>
  <tr><td width='15%'><%response.write tit_fir%>类型：</td><td width='85%'><%response.write nsort_select(nsort,ntit)%></td></tr>
  <tr height=30><td><%response.write tit_fir%>题头：</td><td><input type=text name=head value='广告' size=10 maxlength=10><%response.write redx%>如：<font class=blue>广告</font>&nbsp;&nbsp;<font class=gray>注意：不要加入“[”、“]”</a></td></tr>
  <tr height=30><td><%response.write tit_fir%>内容：</td><td><input type=text name=topic size=50 maxlength=50><%response.write redx%></td></tr>
  <tr height=30><td><%response.write tit_fir%>参数：</td><td><input type=text name=tit size=30 maxlength=30></td></tr>
  <tr height=30><td>链接地址：</td><td><input type=text name=url value='http://' size=50 maxlength=200><%response.write redx%></td></tr>
<%
  call submit_add()
end sub

sub joekoe_chk_txt_main()
%>
  <form name=sel_form action='<%response.write pageurl%>action=handle' method=post>
  <tr align=center>
  <td class=td width='7%'>序号</td>
  <td class=td width='10%'>题头</td>
  <td class=td width='70%'><%response.write ntit%>内容</td>
  <td class=td width='7%'>编辑</td>
  <td class=td width='6%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
  </tr>
<%
  if nsort<>"" then sql_add=" where nsort='"&nsort&"'"
  sql="select count(id) from ads_txt"&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from ads_txt"&sql_add&" order by id desc"
  call joekoe_cms.exec(sql,-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
    id=rs("id")
%>
  <tr align=center>
  <td class=tims><%response.write (viewpage-1)*nummer+i%></td>
  <td class=gray>[<font class=red><%response.write rs("head")%></font>]</td>
  <td align=left><a href='<%response.write rs("url")%>' target=_blank <%response.write rs("tit")%>><%response.write joekoe_cms.code_html(rs("topic"),1,0)%></a></td>
  <td><%response.write pro_edit(pageurl&"action=edit&id="&id,"编辑该"&tit_fir)%></td>
  <td><input type=checkbox name=sel_id value='<%response.write id%>'></td>
  </tr>
<%
    rs.movenext
  next
  rs.close
%>
  <tr class=tr1>
  <td colspan=3>
现有<font class=red><%response.write rssum%></font>条<%response.write tit_fir%>，
每页<font class=red><%response.write nummer%></font>条，
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
  </td>
  <td colspan=2 align=center><input type=submit value='删除' onclick="return sel_click(this.form);"></td>
  </tr>
  <input type=hidden name=sel_type value='删除'>
  </form>
<%
end sub

'############################################ 图片广告 ############################################

sub joekoe_chk_handle()
  dim sel_type,seltype,sel_id,hdim,hnum,hid,hi,htype
  htype=1
  sel_type=trim(request.form("sel_type"))
  select case sel_type
  case "删除"
    seltype="delete"
  case else
    sel_type=""
    seltype=""
  end select
  if joekoe_cms.post_chk()=false or seltype="" then exit sub
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  for hi=0 to hnum
    hid=hdim(hi)
    if isnumeric(hid) then
      sql="select top 1 asort from ads where aid="&hid
      set rs=joekoe_cms.exec(sql,1)
      if not rs.eof then call del_file("../ads/ads_"&rs(0)&".js",5)
      rs.close
      call joekoe_cms.exec("delete from ads where aid="&hid,0)
    end if
  next
  erase hdim
  action=""
  call admin_event(sel_type&" "&(hnum+1)&" 条 "&ntit,0,0)
  response.write vbcrlf&"<script language=javascript>alert(""已成功"&sel_type&"了 "&(hnum+1)&" "&ntit&"！"");</script>"
end sub

sub joekoe_chk_edit()
  sql="select top 1 * from ads where aid="&id
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(ntit&"（ID："&id&"）不在存！",pageurl,1)
    exit sub
  end if
  dim asort,atype,asize,awidth,aheight,aname,alink,aurl
  call admin_td("添加"&ntit)
  if chk() then
    asort=code_admin("asort",1,10)
    atype=int(request.form("atype"))
    asize=trim(request.form("asize"))
    awidth=trim(request.form("awidth"))
    aheight=trim(request.form("aheight"))
    aname=code_admin("aname",1,50)
    alink=code_admin("alink",1,100)
    aurl=code_admin("aurl",1,100)
    if not joekoe_cms.int_true(atype) then atype=1
    if int(atype)>3 or int(atype)<1 then atype=1
    if var_null(asort)="" or var_null(aname)="" then
      rs.close
      call admin_error(tit_fir&"代码 和 文字说明 不能为空！")
      exit sub
    end if
    if asize="yes" and (not(isnumeric(awidth)) or not(isnumeric(aheight))) then
      rs.close
      call admin_error(tit_fir&" 宽 和 高  只能为数字！")
      exit sub
    end if
    rs("atype")=atype
    if asize="yes" then
      rs("asize")=true
      rs("awidth")=awidth
      rs("aheight")=aheight
    else
      rs("asize")=false
    end if
    rs("aname")=aname
    rs("alink")=alink
    rs("aurl")=aurl
    rs.update
    rs.close
    call joekoe_ads_file(id)
    call admin_msg("成功编辑一条"&ntit,pageurl,1)
    exit sub
  end if
  call form_first()
  atype=rs("atype")
%>
  <form action='<%response.write pageurl%>action=edit&id=<%response.write id%>' method=post>
  <input type=hidden name=chk value='yes'>
  <tr><td width='15%'><%response.write tit_fir%>代码：</td><td width='85%'><input type=text name=asort value='<%response.write rs("asort")%>' size=15 maxlength=10><%response.write redx%>区别某一版块，不可修改，如：down_1</td></tr>
  <tr><td><%response.write tit_fir%>类型：</td><td><input type=radio name=atype value='1'<%if int(atype)<>2 and int(atype)<>3 then response.write " checked"%>>&nbsp;图片广告&nbsp;&nbsp;<input type=radio name=atype value='2'<%if int(atype)=2 then response.write " checked"%>>&nbsp;FLASH广告&nbsp;&nbsp;<input type=radio name=atype value='3'<%if int(atype)=3 then response.write " checked"%>>&nbsp;文字广告</td></tr>
  <tr><td><%response.write tit_fir%>大小：</td><td><input type=checkbox name=asize value='yes'<%if rs("asize") then response.write " checked"%>>&nbsp;按固顶像素大小显示&nbsp;&nbsp;&nbsp;宽：<input type=text name=awidth size=5 maxlength=10 value='<%response.write rs("awidth")%>'>&nbsp;像素&nbsp;&nbsp;&nbsp;高：<input type=text name=aheight size=5 maxlength=10 value='<%response.write rs("aheight")%>'>&nbsp;像素</td></tr>
  <tr><td>文字说明：</td><td><input type=text name=aname value='<%response.write rs("aname")%>' size=55 maxlength=50></td></tr>
  <tr><td>链接地址：</td><td><input type=text name=alink value='<%response.write rs("alink")%>' size=55 maxlength=100></td></tr>
  <tr><td>文件地址：</td><td><input type=text name=aurl value='<%response.write rs("aurl")%>' size=55 maxlength=100></td></tr>
<%
  rs.close
  call submit_edit()
end sub

sub joekoe_chk_add()
  dim asort,atype,asize,awidth,aheight,aname,alink,aurl
  call admin_td("添加"&ntit)
  if chk() then
    asort=code_admin("asort",1,10)
    atype=int(request.form("atype"))
    asize=trim(request.form("asize"))
    awidth=trim(request.form("awidth"))
    aheight=trim(request.form("aheight"))
    aname=code_admin("aname",1,50)
    alink=code_admin("alink",1,100)
    aurl=code_admin("aurl",1,100)
    if not joekoe_cms.int_true(atype) then atype=1
    if int(atype)>3 or int(atype)<1 then atype=1
    if var_null(asort)="" or var_null(aname)="" then
      call admin_error(tit_fir&"代码 和 文字说明 不能为空！")
      exit sub
    end if
    if asize="yes" and (not(isnumeric(awidth)) or not(isnumeric(aheight))) then
      call admin_error(tit_fir&" 宽 和 高  只能为数字！")
      exit sub
    end if
    sql="select top 1 * from ads where asort='"&asort&"'"
    call joekoe_cms.exec("",-1)
    rs.open sql,conn,1,3
    if not rs.eof then
      rs.close
      call admin_error("广告代码（<font class=red>"&asort&"</font>）已存在！请选用其它的代码。")
      exit sub
    end if
    rs.addnew
    rs("asort")=asort
    rs("atype")=atype
    if asize="yes" then
      rs("asize")=true
      rs("awidth")=awidth
      rs("aheight")=aheight
    else
      rs("asize")=false
    end if
    rs("aname")=aname
    rs("alink")=alink
    rs("aurl")=aurl
    rs.update
    rs.close
    call joekoe_ads_file(first_id("ads","aid"))
    call admin_msg("成功添加一条新的"&ntit,pageurl,1)
    exit sub
  end if
  call form_first()
%>
  <form action='<%response.write pageurl%>action=add' method=post>
  <input type=hidden name=chk value='yes'>
  <tr><td width='15%'><%response.write tit_fir%>代码：</td><td width='85%'><input type=text name=asort size=15 maxlength=10><%response.write redx%>区别某一版块，不可修改，如：down_1</td></tr>
  <tr><td><%response.write tit_fir%>类型：</td><td><input type=radio name=atype value='1' checked>&nbsp;图片广告&nbsp;&nbsp;<input type=radio name=atype value='2'>&nbsp;FLASH广告&nbsp;&nbsp;<input type=radio name=atype value='3'>&nbsp;文字广告</td></tr>
  <tr><td><%response.write tit_fir%>大小：</td><td><input type=checkbox name=asize value='yes'>&nbsp;按固顶像素大小显示&nbsp;&nbsp;&nbsp;宽：<input type=text name=awidth size=5 maxlength=10>&nbsp;像素&nbsp;&nbsp;&nbsp;高：<input type=text name=aheight size=5 maxlength=10>&nbsp;像素</td></tr>
  <tr><td>文字说明：</td><td><input type=text name=aname size=55 maxlength=50></td></tr>
  <tr><td>链接地址：</td><td><input type=text name=alink value='http://' size=55 maxlength=100></td></tr>
  <tr><td>文件地址：</td><td><input type=text name=aurl value='ads/' size=55 maxlength=100></td></tr>
<%
  call submit_add()
end sub

sub joekoe_ads_file(aid)
  dim file_name,asort,atype,atemp,awh
  awh=""
  sql="select top 1 asort,atype,asize,awidth,aheight,aname,alink,aurl from ads where aid="&aid
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    exit sub
  end if
  asort=rs("asort")
  atype=int(rs("atype"))
  if rs("asize")=true then awh=" width="&rs("awidth")&" height="&rs("aheight")
  select case atype
  case 1
    atemp="<a href='"&rs("alink")&"' target=_blank><img src='"&rs("aurl")&"' border=0 alt='"&rs("aname")&"'"&awh&"></a>"
  case 2
    atemp="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'"&awh&">" & _
	  "<param name=movie value='"&rs("aurl")&"'><param name=quality value=high>" & _
	  "<embed src='"&rs("aurl")&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'"&awh&">" & _
	  "</embed></object>"
  case 3
    atemp="<a href='"&rs("alink")&"' target=_blank>"&rs("aname")&"</a>"
  end select
  rs.close
  atemp="document.write("""&atemp&""");"
  file_name="../ads/ads_"&asort&".js"
  call create_file(file_name,atemp)
end sub

sub joekoe_chk_view()
  dim file_name,asort,atype,atemp,awh
  awh=""
  sql="select top 1 asort,atype,asize,awidth,aheight,aname,alink,aurl from ads where aid="&id
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    call admin_msg(ntit&"（ID："&id&"）不在存！",pageurl,1)
    exit sub
  end if
  call admin_td("浏览"&ntit)
  asort=rs("asort")
  atype=int(rs("atype"))
  if rs("asize")=true then awh=" width="&rs("awidth")&" height="&rs("aheight")
  select case atype
  case 1
    atemp="<a href='"&rs("alink")&"' target=_blank><img src='"&rs("aurl")&"' border=0 alt='"&rs("aname")&"'"&awh&"></a>"
  case 2
    atemp="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'"&awh&">" & _
	  "<param name=movie value='"&rs("aurl")&"'><param name=quality value=high>" & _
	  "<embed src='"&rs("aurl")&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'"&awh&">" & _
	  "</embed></object>"
  case 3
    atemp="<a href='"&rs("alink")&"' target=_blank>"&rs("aname")&"</a>"
  end select
  rs.close
%>
  <tr><td colspan=2 align=center><br><%response.write atemp%><br><br></td></tr>
  <tr class=tr1><td colspan=2 align=center height=40><a href='<%response.write pageurl%>action=edit&id=<%response.write id%>'>编辑此<%response.write ntit%></a>　　<%response.write go_back%></td></tr>
<%
end sub

sub joekoe_chk_main()
  dim topic
%>
  <form name=sel_form action='<%response.write pageurl%>action=handle' method=post>
  <tr align=center>
  <td class=td width='7%'>序号</td>
  <td class=td width='16%'>广告代码</td>
  <td class=td width='14%'>广告类型</td>
  <td class=td width='44%'>文字说明</td>
  <td class=td width='12%'>编辑</td>
  <td class=td width='6%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
  </tr>
<%
  sql="select count(aid) from ads"&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from ads"&sql_add&" order by aid desc"
  call joekoe_cms.exec(sql,-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
    id=rs("aid")
    topic=rs("aname")
%>
  <tr align=center>
  <td class=tims><%response.write (viewpage-1)*nummer+i%></td>
  <td align=left><a href='<%response.write pageurl%>action=view&id=<%response.write id%>' alt='浏览此<%response.write ntit%>'><%response.write rs("asort")%></a></td>
  <td><%
    select case int(rs("atype"))
    case 1
      response.write "图片广告"
    case 2
      response.write "FLASH广告"
    case 3
      response.write "文字广告"
    end select
%></td>
  <td align=left><a href='<%response.write pageurl%>action=edit&id=<%response.write id%>' alt='<%response.write joekoe_cms.code_html(topic,1,0)%>'><%response.write joekoe_cms.code_html(topic,1,(20+tnum))%></a></td>
  <td><%response.write pro_edit(pageurl&"action=edit&id="&id,"编辑该"&tit_fir)%>&nbsp;&nbsp;<a href='<%response.write pageurl%>action=view&id=<%response.write id%>' alt='浏览此<%response.write ntit%>'>浏览</a></td>
  <td><input type=checkbox name=sel_id value='<%response.write id%>'></td>
  </tr>
<%
    rs.movenext
  next
  rs.close
%>
  <tr class=tr1>
  <td colspan=4>
现有<font class=red><%response.write rssum%></font>条<%response.write tit_fir%>，
每页<font class=red><%response.write nummer%></font>条，
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
  </td>
  <td colspan=2 align=center><input type=submit value='删除' onclick="return sel_click(this.form);"></td>
  </tr>
  <input type=hidden name=sel_type value='删除'>
  </form>
<%
end sub
%>