<!-- #include file="include/onlogin.asp" -->
<!--#include file ="include/conn.asp"-->
<SCRIPT language=JavaScript src="style/admin_ads.js"></SCRIPT>
<%
dim AdsCategoryID,AdsID,chk,ASProportion
tit=vbcrlf & "<a href='admin_adsmain.asp?'>广告管理</a>&nbsp;┋ <a href='admin_adv.asp'>论坛广告管理</a>┋&nbsp;<a href='admin_popwin.asp?nsort=popwin'>弹出广告</a>┋&nbsp;" & _
    vbcrlf & "<a href='admin_adsmain.asp?action=edit'>广告分类</a>"
response.write header(1,tit)
chk=trim(request.querystring("chk"))

select case action
case "Proportion"
    call ads_Proportion()
case "Condition"
    call ads_Condition()
case "Count"
    call ads_Count()
case "MD"
    call ads_MD()
case "Operation"
    call ads_Operation()
case "StateCovt"
    call ads_StateCovt()
case "Depict"
    call Depict_main()
case "showflash"
    call show_adflash()    
case else
  call ads_main()
end select

call close_conn()
response.write ender()


Sub Succeed(bit,msg,url,x)
%>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
<TR align="center">
<TD>
<%
if bit="false" then
response.write "操作成功"
else
response.write "操作错误"
end if	  
%>
</TD>
</TR>
<TR align="center">
<TD>
<%=msg%>
</TD>
</TR>
<form method=post action="<%=url%>">
<TR align="center">
<TD>
<%
if bit="false" then
response.write "<input type=""submit"" value="" 确 定 "" onclick=""return menugo('admin_adsmain.asp')"">"
else
response.write"<input type=""button"" value="" 返 回 "" onclick=""javascript:history.back()"">"
end if	  
%>
</TD>
</TR>
</form>
</TABLE>
<%
end Sub

sub head_main()
AdsCategoryID=request("AdsCategoryID")
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
  <tr align="center" bgcolor=<%response.write color3%>>
    <td height="18"><a href="?AdsCategoryID=<%=AdsCategoryID%>">基本状态</a></td>
    <td><a href="?action=Proportion&AdsCategoryID=<%=AdsCategoryID%>">显示比例</a></td>
    <td><a href="?action=MD&AdsCategoryID=<%=AdsCategoryID%>">修改/删除</a></td>
    <td><a href="?action=Operation&AdsCategoryID=<%=AdsCategoryID%>">添加广告</a></td>
  </tr>
</table>
<%
end sub

sub Depict_main()
dim rsAccessToday,rsClickToday,TodayAccessCount,TodayClickCount,AverageTodayClick,rsAccess,rsClick,AccessCount,ClickCount,AverageClick
  AdsCategoryID=request("AdsCategoryID")
  AdsID=request("AdsID")
  set rs=conn.execute("select AdsName,AdsID from Ads where AdsCategoryID="&AdsCategoryID)



call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr> 
<td height="18" colspan="2" bgcolor=<%response.write color3%>>&nbsp;<select onchange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}">
<%while not rs.eof%>
<option value="?action=Depict&AdsID=<%=rs(1)%>&AdsCategoryID=<%=AdsCategoryID%>" <%if ccur(request("AdsID"))=ccur(rs(1)) then response.write "selected"%>><%=rs(0)%></option>
<%rs.movenext:wend%>
</select><strong>－－概况</strong></td>
</tr>

</table>
<%
end sub

sub ads_main()
  AdsCategoryID=request("AdsCategoryID")
  set rs=conn.execute("select PicUrl,PicHeight,PicWidth,AdsID,AdsName,AdsType,AdsState,SProportion from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
  <tr align="center">
    <td>标题</td>
    <td>广告缩略图</td>
    <td>当前状态</td>
    <td>显示比例</td>
    <td>状态设定</td>
  </tr>
  <%
while not rs.eof
%>
<form name=form1 method="post" action="">
<tr <%response.write mtr%>>
<td>&nbsp;<a href="?action=Depict&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>"><%=rs("AdsName")%></a></td>
<td align="center"> 
<%
select case rs("AdsType")
case "pic" 
dim PicUrl
  PicUrl=rs("PicUrl")
  response.write "<a href="&PicUrl&" target=_blank><img src='"&PicUrl&"' width=130 height=30 border=0></a>"
case "flash"
  response.write"Flash广告 <a href=# onclick=""javascript:open('?action=showflash&AdsID="&rs("AdsID")&"','','scrollbars=yes,width="&rs("Picwidth")+50&",height="&rs("Picheight")+100&"')"">预览和取得链接</a>"
end select
%> 　
</td>
<td align="center"> 
<%
if rs("AdsState")=true then
response.write"<font color=green>正在播放</font>"
else
response.write"<font color=red>暂停播放</font>"
end if
%> 　</td>
<td align="center"> 
<%
if rs("AdsState")=true then
response.write"<font color=green>"&rs("SProportion")&"</font>"
else
response.write"<font color=red>N/A</font>"
end if
%> 　</td>
<td align="center"> 
<%
if rs("AdsState")=true then
response.write"<a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=stop' onclick=""return operation()""><img src=images/on_stop.gif border=0 align=absMiddle>暂停</a> &nbsp;&nbsp;<a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=arranged'><img src=images/on_schedule.gif border=0 align=absMiddle>计划</a>"
else
response.write"<a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=start'><img src=images/on_show.gif border=0 align=absMiddle>开始</a> &nbsp;&nbsp;<a href='?action=StateCovt&AdsID="&rs("AdsID")&"&AdsCategoryID="&AdsCategoryID&"&AdsState=arranged'><img src=images/on_schedule.gif border=0 align=absMiddle>计划</a>"
end if
%> 　</td>
</tr>
<%
i=i+1
rs.movenext
wend
rs.close
set rs=nothing
%>
</form>
</table>
<%
end sub

sub ads_StateCovt()
dim AdsState,SProportion,etime,SSProportion,x,MaxS,OSNum
  AdsCategoryID=request("AdsCategoryID")
  AdsID=request("AdsID")
  AdsState=request("AdsState")
  SProportion=request("SProportion")
  etime=request("etime")
  if AdsState="stop" then
    set rs=conn.execute("select SProportion from Ads where AdsCategoryID="&AdsCategoryID&" and AdsID="&AdsID&" order by AdsID desc")
	SSProportion=rs(0)
	set rs=conn.execute("select SProportion from Ads where AdsCategoryID="&AdsCategoryID&" and AdsState=1 and AdsID<>"&AdsID&" order by AdsID desc")
    while not rs.eof
      i=i+1
	  x=x+rs(0)
	  rs.movenext
    wend
	if i>=1 then 
	  OSNum=SSProportion/i
	else
	  OSNum=0
	end if
    conn.execute("update Ads set AdsState=0,SProportion=null where AdsID="&AdsID)
	conn.execute("update Ads set SProportion=SProportion+"&OSNum&" where AdsState=1")
	response.redirect"admin_AdsManage.asp?AdsCategoryID="&AdsCategoryID&""
  end if
  if chk="启动" then
    set rs=conn.execute("select SProportion from Ads where AdsCategoryID="&AdsCategoryID&" and AdsState=1 order by AdsID desc")
	i=0
	x=0
    while not rs.eof
      i=i+1
	  x=x+rs(0)
	  rs.movenext
    wend
    MaxS=10-i
	if i>=1 then 
	  OSNum=(10-SProportion)/i
	else
	  OSNum=0
	end if
	if 100-SProportion<i then Call Succeed("true","显示比例超过最大值  <b>"&MaxS&"</b>","",""):response.end
    conn.execute("update Ads set SProportion="&OSNum&" where AdsState=1")
	conn.execute("update Ads set AdsState=1,SProportion="&SProportion&" where AdsID="&AdsID)
	response.redirect"admin_AdsManage.asp?AdsCategoryID="&AdsCategoryID&""
  elseif chk="确定" then
    if etime<>"" then conn.execute("update Ads set Arranged='"&etime&"' where AdsID="&AdsID)
	response.redirect"admin_AdsManage.asp?AdsCategoryID="&AdsCategoryID&""
  end if
  set rs=conn.execute("select * from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<%if AdsState="start" then%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<form name=form method="post" action="?action=StateCovt&chk=启动&AdsID=<%=AdsID%>&AdsCategoryID=<%=AdsCategoryID%>">
<tr align="center"> 
<td height="50%">显示比例<br><font color=#c0c0c0>启动广告播放之前先必须填写显示比例</font></td>
<td><input type="text" name="SProportion" size=10 class=form80 onblur="Isvalidity(SProportion,'显示比例')"></td>
</tr>
<tr bgcolor="#f6f6f6"> 
<td colspan=2 align="right">
<input type="submit" value="启动" name="chk" class=button onclick="return CheckProportion()">
<input type="button" value="返回" class=button onclick="javascript:history.back()">
</td>
</tr></form>
</table>
<%elseif AdsState="arranged" then
set rs=conn.execute("select Arranged from Ads where AdsCategoryID="&AdsCategoryID&" and AdsID="&AdsID)
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<form name=form method="post" action="?action=StateCovt&chk=确定&AdsID=<%=AdsID%>&AdsCategoryID=<%=AdsCategoryID%>">
<tr align="center"> 
<td height="50%">停止播放时间<br><font color=#c0c0c0>请输入要停止播放广告的时间</font></td>
<td>
<INPUT class=form80 name=etime size=20 value="<%=rs(0)%>" readonly> 
<INPUT class=button name=ret onclick="showCalendar(CalendarLayer,this.form.etime)" type=button value=日期>
</td>
</tr>
<tr bgcolor="#f6f6f6"> 
<td colspan=2 align="right">
<input type="submit" value="确定" name="chk" class=button onclick="return operation()">
<input type="button" value="返回" class=button onclick="javascript:history.back()">
</td>
</tr></form>
</table>
<%
end if
end sub

sub ads_Proportion()
  AdsCategoryID=request("AdsCategoryID")
  ASProportion=0
  if chk="修改" then
  for i=1 to request("AdsID").count
     if not ISNumeric(request("SProportion")(i)) then Call Succeed("true","显示比例只能为整数","",""):response.end
    ASProportion=ASProportion+request("SProportion")(i)
  next
  if Ccur(ASProportion)>10 then Call Succeed("true","显示比例总和超过最大值  <b>10</b>","",""):response.end
  for i=1 to request("AdsID").count
    conn.execute("update Ads set SProportion="&request("SProportion")(i)&" where AdsID="&request("AdsID")(i))
  next
  end if
  set rs=conn.execute("select * from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr align="center"> 
    <td>标题</td>
    <td>广告缩略图</td>
    <td>当前状态</td>
    <td>显示比例设定</td>
</tr>
<form name=form1 method="post" action="?action=Proportion&chk=修改&AdsCategoryID=<%=rs("AdsCategoryID")%>">
<%
while not rs.eof
%>
<tr <%response.write mtr%>>
<td>&nbsp;<a href="?action=Depict&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>"><%=rs("AdsName")%></a></td>
<td align="center"> 
<%
select case rs("AdsType")
case "pic"
dim PicUrl
  PicUrl=rs("PicUrl")
  response.write"<a href='"&PicUrl&"' target=_blank><img src="&PicUrl&" width=130 height=30 border=0></a>"
case "flash"
  response.write"Flash广告 <a href=# onclick=""javascript:open('?action=showflash&AdsID="&rs("AdsID")&"','','scrollbars=yes,width="&rs("Picwidth")+50&",height="&rs("Picheight")+100&"')"">预览和取得链接</a>"
end select
%> 　</td>
<td align="center"> 
<%
if rs("AdsState")=true then
response.write"<font color=green>正在播放</font>"
else
response.write"<font color=red>暂停播放</font>"
end if
%> 　</td>
<td align="center">
<%
if rs("AdsState")=true then%>
当前比例<input name="SProportion" type="text" class=form80 value="<%=rs("SProportion")%>" size="4">
<input type="hidden" name="AdsID" value="<%=rs("AdsID")%>">
<%else
response.write"N/A"
end if
%>
</td>
</tr>
<%
rs.movenext
wend
rs.close
set rs=nothing
%>
<tr bgcolor="#f6f6f6"> 
<td colspan=4 align="right">显示比例范围1-10
<input type="submit" value="修改" name="chk" class=button onclick="return modify()">&nbsp;
</td>
</tr>
</form>
</table>
<%
end sub

sub ads_Condition()
dim ShowState,ClickState,ShowCount,ClickCount
  AdsCategoryID=request("AdsCategoryID")
  ASProportion=0
  if chk="修改" then
  for i=1 to request("AdsID").count
    if request("ShowState-"&request("AdsID")(i)&"")=1 and not isNumeric(request("ShowCount-"&request("AdsID")(i)&"")) then Call Succeed("true","请输入显示次数!","",""):response.end

	if request("ClickState-"&request("AdsID")(i)&"")=1 and not isNumeric(request("ClickCount-"&request("AdsID")(i)&"")) then Call Succeed("true","请输入点击次数!","",""):response.end
  next
  for i=1 to request("AdsID").count
    ShowState=request("ShowState-"&request("AdsID")(i)&"")
	ClickState=request("ClickState-"&request("AdsID")(i)&"")
	ShowCount=request("ShowCount-"&request("AdsID")(i)&"")
	ClickCount=request("ClickCount-"&request("AdsID")(i)&"")     
	conn.execute("update Ads set ClickState="&ClickState&",ShowState="&ShowState&" where AdsID="&request("AdsID")(i))
	if ClickState=1 then conn.execute("update Ads set ClickCount="&ClickCount&" where AdsID="&request("AdsID")(i))
	if ShowState=1 then conn.execute("update Ads set ShowCount="&ShowCount&" where AdsID="&request("AdsID")(i))
	if ShowState=0 then conn.execute("update Ads Set ShowCount=null where AdsID="&request("AdsID")(i))
	if ClickState=0 then conn.execute("update Ads Set ClickCount=null where AdsID="&request("AdsID")(i))
  next
  end if
  
  set rs=conn.execute("select * from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
  <tr align="center"> 
    <td>标题</td>
    <td>条件设置</td>
  </tr>
<form name=form1 method="post" action="?action=Condition&chk=修改&AdsCategoryID=<%=rs("AdsCategoryID")%>">
<%
while not rs.eof
%>
<tr <%response.write mtr%>>
<td>&nbsp;<a href="?action=Depict&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>"><%=rs("AdsName")%></a></td>
<td align="center">         
<input type="radio" name="ShowState-<%=rs("AdsID")%>" value="0" <%if rs("ShowState")=false or isnull(rs("ShowState")) then response.write"checked"%>>不限制显示次数
<input type="radio" name="ShowState-<%=rs("AdsID")%>" value="1" <%if rs("ShowState")=true then response.write"checked"%>>显示次数超过
<input name="ShowCount-<%=rs("AdsID")%>" type="text" size="3" class=form80 value="<%=rs("ShowCount")%>">后停止播放
<br>
<font color=green>
<input type="radio" name="ClickState-<%=rs("AdsID")%>" value="0" <%if rs("ClickState")=false or isnull(rs("ClickState")) then response.write"checked"%>>不限制点击次数       
<input type="radio" name="ClickState-<%=rs("AdsID")%>" value="1" <%if rs("ClickState")=true then response.write"checked"%>>点击次数超过
<input name="ClickCount-<%=rs("AdsID")%>" type="text" size="3" class=form80 value="<%=rs("ClickCount")%>">后停止播放</font>
<input name="AdsID" type="hidden" value="<%=rs("AdsID")%>">
</td>
</tr>
<%
rs.movenext
wend
%>
<tr bgcolor="#f6f6f6"> 
<td colspan=2 align="right">
<input type="submit" value="修改" name="chk" class=button onclick="return modify()">&nbsp;</td>
</tr>
</form>
</table>
<%
rs.close
set rs=nothing
end sub

sub ads_MD()
AdsCategoryID=request("AdsCategoryID")
if chk="删除" then
for i=1 to request("AdsID").count
conn.execute("delete from Ads where AdsID="&request("AdsID")(i))
next
end if
set rs=conn.execute("select * from Ads where AdsCategoryID="&AdsCategoryID&" order by AdsID desc")
call head_main()
%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr align="center"> 
<td>标题</td>
<td>备注</td>
<td>当前状态</td>
<td>操作类型</td>
</tr>
<%
while not rs.eof
%>
<form name=form1 method="post" action="?action=MD&chk=删除&AdsCategoryID=<%=rs("AdsCategoryID")%>">
<tr <%response.write mtr%>>
<td>&nbsp;<a href="?action=Depict&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>"><%=rs("AdsName")%></a></td>
<td align="center"><%=rs("remark")%>　</td>
<td align="center"> 
<%
if rs("AdsState")=true then
response.write"<font color=green>正在播放</font>"
else
response.write"<font color=red>暂停播放</font>"
end if
%> 　</td>
<td align="center"><a href="?action=Operation&AdsID=<%=rs("AdsID")%>&AdsCategoryID=<%=AdsCategoryID%>">修改</a> 
<input type="checkbox" value="<%=rs("AdsID")%>" name="AdsID"> </td>
</tr>
<%
i=i+1
rs.movenext
wend
rs.close
set rs=nothing
%>
<tr bgcolor="#f6f6f6"> 
<td colspan=5 align="right"><input type="submit" value="删除" name="chk" onclick="return Del()" class=button>
选中所有
<input type="checkbox" name="chkall" onclick="CheckAll(this.form)" value="ON">
</td>
</tr>
</form>
</table>
<%
end sub

sub ads_Operation()
dim Stat,AdsName,AdsType,PicUrl,ObjUrl,PicHeight,PicWidth,Remark,AdsState
	Stat=request("Stat")
    AdsCategoryID=request("AdsCategoryID")
	AdsID=request("AdsID")
    AdsName=trim(request("AdsName"))
	AdsType=trim(request("AdsType"))
	PicUrl=trim(request("PicUrl"))
	ObjUrl=trim(request("ObjUrl"))
	PicHeight=request("PicHeight")
	PicWidth=request("PicWidth")
	Remark=request("Remark")

  if chk="修改" then
	set rs=server.createobject("adodb.recordset")
	sql="select * from Ads where AdsID="&AdsID
	rs.open sql,conn,3,3
	  rs("AdsName")=AdsName
	  rs("AdsType")=AdsType
	  rs("PicUrl")=PicUrl
	  rs("ObjUrl")=ObjUrl
	  rs("PicHeight")=PicHeight
	  rs("PicWidth")=PicWidth
	  rs("Remark")=Remark
	rs.update
	response.redirect"?action=MD&AdsCategoryID="&AdsCategoryID&""
  elseif chk="添加" then
	set rs=server.createobject("adodb.recordset")
	sql="select * from Ads"
	rs.open sql,conn,3,3
	rs.addnew
	  rs("AdsName")=AdsName
      rs("AdsCategoryID")=AdsCategoryID
	  rs("AdsType")=AdsType
	  rs("AdsState")=0
	  rs("PicUrl")=PicUrl
	  rs("ObjUrl")=ObjUrl
	  rs("PicHeight")=PicHeight
	  rs("PicWidth")=PicWidth
	  rs("Remark")=Remark
	  rs("CurrentSCount")=0
	  rs("InputDate")=Now()
	rs.update
    rs.close
    set rs=nothing
	response.redirect"?action=MD&AdsCategoryID="&AdsCategoryID&""
  end if

  if AdsID<>"" then  
  set rs=conn.execute("select * from Ads where AdsID="&AdsID&" order by AdsID desc")
  if not rs.eof then
    AdsName=rs("AdsName")
	AdsType=rs("AdsType")
	AdsState=rs("AdsState")
	PicHeight=rs("PicHeight")
	PicWidth=rs("PicWidth")
	PicUrl=rs("PicUrl")
	ObjUrl=rs("ObjUrl")
	remark=rs("remark")
  end if
  end if
%>

<%if AdsID<>"" then%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr><td height="18" colspan="2" align="center" bgcolor=<%response.write color3%>><strong>修改广告</strong></td></tr>
<form name=form method="post" action="?action=Operation&chk=修改&AdsCategoryID=<%=rs("AdsCategoryID")%>&AdsID=<%=rs("AdsID")%>">
<%else%>
<table border=1 width='100%' cellspacing=0 cellpadding=1<%response.write table1%>>
<tr><td height="18" colspan="2" align="center" bgcolor=<%response.write color3%>><strong>添加广告</strong></td></tr>
<form name=form method="post" action="?action=Operation&chk=添加&AdsCategoryID=<%=AdsCategoryID%>">
<%end if%>
<tr> 
<td width="50%">&nbsp;广告名称<br><font color=#c0c0c0>广告的简单说明</font></td>
<td><input type="text" class=form80 name="AdsName" value="<%=AdsName%>" size="20"></td>
</tr>
<tr> 
<td>&nbsp;广告类型<br><font color=#c0c0c0>请选择普通图片或Flash</font></td>
<td>
<input type="radio" name="AdsType" value="pic" <%if AdsType="pic" or AdsType="" then response.write"checked"%>>图片
<input type="radio" name="AdsType" value="flash" <%if AdsType="flash" then response.write"checked"%>>Flash
</td>
</tr>
<tr> 
<td>&nbsp;图片(Flash)长、宽<br><font color=#c0c0c0>此广告的图片长度、宽度</font></td>
<td>长：<input type="text" class=form80 size=5 name="PicHeight" value="<%=PicHeight%>" onblur="Isvalidity(PicHeight,'长')">
宽：<input type="text" class=form80 size=5 name="PicWidth" value="<%=PicWidth%>" onblur="Isvalidity(PicWidth,'宽')"></td>
</tr>
<tr> 
<td>&nbsp;图片(Flash)路径</td>
<td><input type="text" class=form80 name="PicUrl" size=30 value="<%if PicUrl="" then response.write"http://":else:response.write PicUrl%>"></td>
</tr>
<tr> 
<td>&nbsp;目标广告联接</td>
<td>
<input type="text" class=form80 name="ObjUrl" size=30 value="<%if ObjUrl="" then response.write"http://":else:response.write ObjUrl%>">
</td>
</tr>
<tr> 
<td>&nbsp;备注</td>
<td><textarea name=remark rows=5 cols=30><%=remark%></textarea></td>
</tr>
<tr align="center" bgcolor="#f6f6f6"> 
<td colspan="2">
<%if AdsID<>"" then %>
<input type="submit" class=button value="修改" name=chk onclick="return CheckAds()">
<input type="reset" class=button value="还原">
<input type="button" class=button value="返回" onclick="javascript:history.back()">
<%else%>
<input type="submit" class=button value="添加" name=chk onclick="return CheckAds()">
<input type="reset" class=button value="还原">
<input type="button" class=button value="返回" onclick="javascript:history.back()">
<%end if%>
</td>
</tr>
</form>
</table>
<%
end sub

sub show_adflash()
dim PicUrl,PicHeight,PicWidth
AdsID=request("AdsID")
set rs=conn.execute("select PicUrl,PicHeight,PicWidth From Ads where AdsID="&AdsID)
if rs.eof then response.end
PicUrl=rs("PicUrl")
PicHeight=rs("PicHeight")
PicWidth=rs("PicWidth")
%>
<div align=center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="<%=PicWidth%>" height="<%=PicHeight%>"><param name=movie value="<%=PicUrl%>"><param name=quality value=high>
  <embed src="<%=PicUrl%>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="<%=PicWidth%>" height="<%=PicHeight%>"></embed></object>
<br>链接：<textarea name="VoteCode" cols="52" rows="3"><%="AdsUrl.asp?AdsID="&Adsid%></textarea>
<br><a href="javascript:window.close()">关闭窗口</a>
</div>
<%
end sub
%>