<%
Class Adcolumn_Cls
	Private ErrMsg
	Private SucMsg
	Private Founderr
	Private NC_Admin
	Private Rs
	Private SQL
	Private isEdit
	Private i
	Private totalnumber
	Private Pcount
	Private totalPut
	Private CurrentPage
	Private bookmark
	Private maxperpage

	Private Sub Class_Initialize()
		On Error Resume Next
		maxperpage = 12 '###每页显示数
		Founderr = False
		Set Rs = Server.CreateObject("ADODB.Recordset")
	End Sub

	Private Sub Class_Terminate()
		If IsObject(Conn) Then
			Conn.Close
			Set Conn = Nothing
		End If
		Set NC_Admin = Nothing
	End Sub

	Public Sub Init_Adcolumn()
		On Error Resume Next
		Server.ScriptTimeout = 9999
		Set NC_Admin = New Check
		NC_Admin.AdminChk = "01"
		NC_Admin.Check
		DownsysClass.admin_header

		Response.Write "<script language = JavaScript>" & vbCrLf
		Response.Write "function showsetting(myform){" & vbCrLf
		Response.Write " for (var j=0;j<7;j++){" & vbCrLf
		Response.Write " var tab = eval('document.all.settable'+j);" & vbCrLf
		Response.Write " if(myform.AdsType.selectedIndex==j)" & vbCrLf
		Response.Write " tab.style.display = '';" & vbCrLf
		Response.Write " else" & vbCrLf
		Response.Write " tab.style.display = 'none';" & vbCrLf
		Response.Write " }" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""tableBorder"">" & vbCrLf
		Response.Write "    <tr>" & vbCrLf
		Response.Write "      <th>广告管理  |  <A HREF='admin_adcolumn.asp?action=add' class=TableTitleLink>添加广告</A></th></tr>" & vbCrLf
		Response.Write " <tr height=""25"">" & vbCrLf
		Response.Write "      <td class=forumRow><B>管理:</B> <A HREF='admin_adcolumn.asp'>广告管理首页</A>  |  <A HREF='admin_adcolumn.asp?ColumnID=0'>栏目共用广告</A>" & vbCrLf
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=1'>下载首页</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=2'>下载列表</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=3'>软件信息</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=4'>文章首页</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=5'>文章列表</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=6'>文章内容</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?ColumnID=7'>其它页面</A>"
		Response.Write "  |  <A HREF='admin_adcolumn.asp?action=add'>添加广告</A>"
		Response.Write "      </td></tr>" & vbCrLf
		Response.Write "</table><BR>" & vbCrLf
		Select Case Trim(Request("action"))
			Case "add"
				isEdit = False
				Call EditAdColumn(isEdit)
			Case "edit"
				isEdit = True
				Call EditAdColumn(isEdit)
			Case "save"
				Call savenew
			Case "modify"
				Call savemodify
			Case "del"
				Call DelAds
			Case "delall"
				Call DelAllAds
			Case "islock"
				Call isLockAds
			Case "unlock"
				Call UnlockAds
			Case "indate"
				Call indateAds
			Case "move"
				Call BatchMove
			Case Else
				Call AdsMain
		End Select
		If Founderr = True Then
			NC_Admin.Error_Msg (ErrMsg)
		End If
		DownsysClass.admin_footer
	End Sub

	Private Sub AdsMain()
		Dim intWidth
		Dim intHeight
		If Not IsEmpty(Request("page")) Then
			CurrentPage = CLng(Request("page"))
		Else
			CurrentPage = 1
		End If
		If Not IsNumeric(Request("page")) And Request("page") <> "" Then
			Response.Write "错误的系统参数!请输入整数"
			Response.End
		End If
		Response.Write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""tableBorder"">" & vbCrLf
		Response.Write "    <tr>" & vbCrLf
		Response.Write "      <th noWrap>选项</th><th noWrap>状态</th><th width=""85%"">"
		Select Case Request("ColumnID")
			Case -0
				Response.Write "广告管理首页"
			Case 0
				Response.Write "栏目共用广告管理"
			Case 1
				Response.Write "下载首页广告管理"
			Case 2
				Response.Write "下载列表广告管理"
			Case 3
				Response.Write "软件信息广告管理"
			Case 4
				Response.Write "文章首页广告管理"
			Case 5
				Response.Write "文章列表广告管理"
			Case 6
				Response.Write "文章内容广告管理"
			Case 7
				Response.Write "其它页面广告管理"
			Case Else
				Response.Write "广告管理首页"
		End Select
		Response.Write " </th><th noWrap>广告类型</th><th noWrap>编辑广告</th>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write "<form name=""myform"" method=""post"" action=''>" & vbCrLf
		Set Rs = CreateObject("ADODB.Recordset")
		If Request("ColumnID") <> "" Then
			SQL = "select * from NC_AdColumn where ColumnID=" & Request("ColumnID") & " order by AdsTime desc,id desc"
		Else
			SQL = "select * from NC_AdColumn order by AdsTime desc,id desc"
		End If
		Rs.Open SQL, Conn, 1, 1
		DownsysClass.SqlQueryNum = DownsysClass.SqlQueryNum + 1
		If Rs.bof And Rs.EOF Then
			Response.Write "<tr><td colspan=5 class=forumrow>还没有找到任何广告信息！</td></tr>"
		Else
			totalnumber = Rs.recordcount
			If (totalnumber Mod maxperpage) = 0 Then
				Pcount = totalnumber \ maxperpage
			Else
				Pcount = totalnumber \ maxperpage + 1
			End If
			Rs.MoveFiRst
			If CurrentPage > Pcount Then CurrentPage = Pcount
			If CurrentPage < 1 Then CurrentPage = 1
			Rs.Move (CurrentPage - 1) * maxperpage
			bookmark = Rs.bookmark
			i = 0
			Do While Not Rs.EOF And i < CLng(maxperpage)
				If Rs("width") > 468 Then
					intWidth = 486
				Else
					intWidth = Rs("width")
				End If
				If Rs("height") > 60 Then
					intHeight = 60
				Else
					intHeight = Rs("height")
				End If
				Response.Write "<tr height=""25"">" & vbCrLf
				Response.Write " <td class=forumRow align=center><input type=checkbox name=seladsid value="""
				Response.Write Rs("id")
				Response.Write """></td>" & vbCrLf
				Response.Write " <td class=forumRow align=center>"
				If Rs("isLock") = 1 Then
					Response.Write "<img src='images/locks.gif' border=0 align=absMiddle>"
				Else
					Response.Write "<img src='images/folder.gif' border=0 align=absMiddle>"
				End If
				Response.Write "</td>" & vbCrLf
				Response.Write " <td class=forumRow align=center>" & vbCrLf

				If Rs("LinkType") = 0 Then
					Response.Write " <img src="""
					Response.Write Rs("imageUrl")
					Response.Write """ width="""
					Response.Write intWidth
					Response.Write """ height="""
					Response.Write intHeight
					Response.Write """ border=0>" & vbCrLf

				ElseIf Rs("LinkType") = 1 Then
					Response.Write " <object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"" width="""
					Response.Write intWidth
					Response.Write """ height="""
					Response.Write intHeight
					Response.Write """>" & vbCrLf
					Response.Write " <param name=""movie"" value="""
					Response.Write Rs("imageUrl")
					Response.Write """>" & vbCrLf
					Response.Write " <param name=""quality"" value=""high"">" & vbCrLf
					Response.Write " <embed src="""
					Response.Write Rs("imageUrl")
					Response.Write """ quality=""high"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash"" width="""
					Response.Write intWidth
					Response.Write """ height="""
					Response.Write intHeight
					Response.Write """></embed>" & vbCrLf
					Response.Write " </object>" & vbCrLf
				Else
					Response.Write Left(DownsysClass.HTMLEncode(Rs("Remark")), 150)
				End If
				Response.Write " </td>" & vbCrLf
				Response.Write " <td class=forumRow noWrap align=center>" & vbCrLf

				Select Case Rs("AdsType")
					Case 0
						Response.Write "弹出广告"
					Case 1
						Response.Write "Banner广告"
					Case 2
						Response.Write "栏目广告"
					Case 3
						Response.Write "内容页广告"
					Case 4
						Response.Write "浮动广告"
					Case 5
						Response.Write "左边固定广告"
					Case 6
						Response.Write "右边固定广告"
					Case 7
						Response.Write "其它位置广告"
					Case 8
						Response.Write "精彩推荐广告"
					Case 9
						Response.Write "软件简介广告*"
					Case 10
						Response.Write "下载地址广告*"
					Case Else
						Response.Write "其它位置广告"
				End Select
				Response.Write "</td>" & vbCrLf
				Response.Write " <td class=forumRow align=center><A HREF=""?action=edit&id="
				Response.Write Rs("id")
				Response.Write """>编辑广告</A></td>" & vbCrLf
				Response.Write "</tr>" & vbCrLf
				Rs.movenext
				i = i + 1
				If i >= maxperpage Then Exit Do
			Loop
		End If
		Rs.Close
		Response.Write "<tr height=""25"">" & vbCrLf
		Response.Write " <td class=forumRow align=center>管理</td>" & vbCrLf
		Response.Write " <td class=forumRow colspan=4><input name=""chkAll"" type=""checkbox"" id=""chkAll"" onclick=CheckAll(this.form) value=""checkbox"">全选/反选　" & vbCrLf
		Response.Write " <input type=""radio"" name=""action"" value=""move"" title=""管理选项：批量移动选中的广告"">批量移动 ->" & vbCrLf
		Response.Write "<select name='ColumnID' id='ColumnID'>" & vbCrLf
		Response.Write "<option value='0' >栏目共用广告</option>" & vbCrLf
		Response.Write "<option value='1' >下载首页广告</option>" & vbCrLf
		Response.Write "<option value='2' >下载列表页广告</option>" & vbCrLf
		Response.Write "<option value='3' >下载信息页广告</option>" & vbCrLf
		Response.Write "<option value='4' >文章首页广告</option>" & vbCrLf
		Response.Write "<option value='5' >文章列表页广告</option>" & vbCrLf
		Response.Write "<option value='6' >文章内容页广告</option>" & vbCrLf
		Response.Write "<option value='7' >其它页面广告</option>" & vbCrLf
		Response.Write "</select>" & vbCrLf
		Response.Write " <input type=""radio"" name=""action"" value=""del"" title=""管理选项：批量删除选中的广告"">批量删除" & vbCrLf
		Response.Write " <input type=""radio"" name=""action"" value=""indate"" title=""管理选项：批量设置为最新广告"">设置为最新广告" & vbCrLf
		Response.Write " <input type=""radio"" name=""action"" value=""islock"" title=""管理选项：批量锁定选中的广告"">锁定广告" & vbCrLf
		Response.Write " <input type=""radio"" name=""action"" value=""unlock"" title=""管理选项：批量解除锁定选中的广告"">解除锁定" & vbCrLf
		Response.Write " <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit name=Submit value=""执行操作"" class=button onclick=""{if(confirm('您确定执行此操作吗?')){this.document.myform.submit();return true;}return false;}""></td>" & vbCrLf
		Response.Write "</tr></form>" & vbCrLf
		Response.Write "<tr height=""25"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight colspan=5><div title=""轩溪软件园<BR>"">"
		Call showpage
		Response.Write "</div></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "</table>" & vbCrLf
	End Sub

	Private Sub EditAdColumn(isEdit)
		Dim strTitle
		If isEdit Then
			Set Rs = CreateObject("ADODB.Recordset")
			SQL = "select * from NC_AdColumn where id=" & Request("id")
			Rs.Open SQL, Conn, 1, 1
			DownsysClass.SqlQueryNum = DownsysClass.SqlQueryNum + 1
			strTitle = "编辑广告"
		Else
			strTitle = "添加广告"
		End If
		Response.Write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""tableBorder"">" & vbCrLf
		Response.Write "    <tr>" & vbCrLf
		Response.Write "      <th  colspan=2>" & strTitle & "</th>" & vbCrLf
		Response.Write " </tr>" & vbCrLf
		Response.Write "<form name=""myform"" method=""post"" action='admin_adcolumn.asp'>" & vbCrLf
		Response.Write "<input type=""Hidden"" name=""action"" value='"
		If isEdit Then
			Response.Write "modify"
		Else
			Response.Write "save"
		End If
		Response.Write "'>" & vbCrLf
		If isEdit Then
			Response.Write " <input type=""Hidden"" name=""id"" value='"
			Response.Write CStr(Request("id"))
			Response.Write "'>" & vbCrLf
			Response.Write " "
		End If
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td width=""25%"" class=forumRowHighlight align=right>所属栏目:</td>" & vbCrLf
		Response.Write " <td width=""75%"" class=forumRow><select name='ColumnID' id='ColumnID'>" & vbCrLf
		Response.Write " <option value='0' "
		If isEdit Then
			If Rs("ColumnID") = 0 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">栏目共用广告</option>" & vbCrLf
		Response.Write " <option value='1' "
		If isEdit Then
			If Rs("ColumnID") = 1 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">下载首页广告</option>" & vbCrLf
		Response.Write " <option value='2' "
		If isEdit Then
			If Rs("ColumnID") = 2 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">下载列表页广告</option>" & vbCrLf
		Response.Write "<option value='3' "
		If isEdit Then
			If Rs("ColumnID") = 3 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">下载信息页广告</option>" & vbCrLf
		Response.Write "<option value='4' "
		If isEdit Then
			If Rs("ColumnID") = 4 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">文章首页广告</option>" & vbCrLf
		Response.Write "<option value='5' "
		If isEdit Then
			If Rs("ColumnID") = 5 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">文章列表页广告</option>" & vbCrLf
		Response.Write "<option value='6' "
		If isEdit Then
			If Rs("ColumnID") = 6 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">文章内容页广告</option>" & vbCrLf
		Response.Write "<option value='7' "
		If isEdit Then
			If Rs("ColumnID") = 7 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">其它页面广告</option>" & vbCrLf
		Response.Write "</select></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>广告类型:</td>" & vbCrLf
		Response.Write " <td class=forumRow><select name='AdsType' id='AdsType' onchange=showsetting(this.form)>" & vbCrLf
		Response.Write " <option value='0' "
		If isEdit Then
			If Rs("AdsType") = 0 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">弹出广告</option>" & vbCrLf
		Response.Write "<option value='1' "
		If isEdit Then
			If Rs("AdsType") = 1 Then
				Response.Write "selected"
			End If
		Else
			Response.Write "selected"
		End If
		Response.Write ">Banner广告</option>" & vbCrLf
		Response.Write "<option value='2' "
		If isEdit Then
			If Rs("AdsType") = 2 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">栏目广告</option>" & vbCrLf
		Response.Write "<option value='3' "
		If isEdit Then
			If Rs("AdsType") = 3 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">内容页广告</option>" & vbCrLf
		Response.Write "<option value='4' "
		If isEdit Then
			If Rs("AdsType") = 4 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">浮动广告</option>" & vbCrLf
		Response.Write "<option value='5' "
		If isEdit Then
			If Rs("AdsType") = 5 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">左边固定广告</option>" & vbCrLf
		Response.Write "<option value='6' "
		If isEdit Then
			If Rs("AdsType") = 6 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">右边固定广告</option>" & vbCrLf
		Response.Write "<option value='7' "
		If isEdit Then
			If Rs("AdsType") = 7 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">其它位置广告</option>" & vbCrLf
		Response.Write "<option value='8' "
		If isEdit Then
			If Rs("AdsType") = 8 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">精彩推荐广告</option>" & vbCrLf
		Response.Write "<option value='9' "
		If isEdit Then
			If Rs("AdsType") = 9 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">软件简介广告*</option>" & vbCrLf
		Response.Write "<option value='10' "
		If isEdit Then
			If Rs("AdsType") = 10 Then
				Response.Write "selected"
			End If
		End If
		Response.Write ">下载地址广告*</option>" & vbCrLf
		Response.Write "</select></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"" id='settable0'>" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>弹出广告设置:</td>" & vbCrLf
		Response.Write " <td class=forumRow>边距：<input name='sidemargin' type='text' id='sidemargin' value='"
		If isEdit Then
			Response.Write Rs("sidemargin")
		Else
			Response.Write "100"
		End If
		Response.Write "' size='6' maxlength='5'>" & vbCrLf
		Response.Write " 上边距：<input name='topmargin' type='text' id='topmargin' value='"
		If isEdit Then
			Response.Write Rs("topmargin")
		Else
			Response.Write "100"
		End If
		Response.Write "' size='6' maxlength='5'></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<div id='settable1' style='DISPLAY: none'></div>" & vbCrLf
		Response.Write "<div id='settable2' style='DISPLAY: none'></div>" & vbCrLf
		Response.Write "<div id='settable3' style='DISPLAY: none'></div>" & vbCrLf
		Response.Write "<div id='settable4' style='DISPLAY: none'></div>" & vbCrLf
		Response.Write "<div id='settable7' style='DISPLAY: none'></div>" & vbCrLf
		Response.Write "<tr height=""21"" id='settable5'>" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>左边固定广告设置:</td>" & vbCrLf
		Response.Write " <td class=forumRow>左边距：<input name='sidemargin1' type='text' id='sidemargin1' value='"
		If isEdit Then
			Response.Write Rs("sidemargin1")
		Else
			Response.Write "20"
		End If
		Response.Write "' size='6' maxlength='5'>" & vbCrLf
		Response.Write " 上边距：<input name='topmargin1' type='text' id='topmargin1' value='"
		If isEdit Then
			Response.Write Rs("topmargin1")
		Else
			Response.Write "110"
		End If
		Response.Write "' size='6' maxlength='5'></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"" id='settable6'>" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>右边固定广告设置:</td>" & vbCrLf
		Response.Write " <td class=forumRow>右边距：<input name='sidemargin2' type='text' id='sidemargin2' value='"
		If isEdit Then
			Response.Write Rs("sidemargin2")
		Else
			Response.Write "20"
		End If
		Response.Write "' size='6' maxlength='5'>" & vbCrLf
		Response.Write " 上边距：<input name='topmargin2' type='text' id='topmargin2' value='"
		If isEdit Then
			Response.Write Rs("topmargin2")
		Else
			Response.Write "110"
		End If
		Response.Write "' size='6' maxlength='5'></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>网站名称:</td>" & vbCrLf
		Response.Write " <td class=forumRow><input name='HomeName' type='text' id='HomeName' size=30 "
		If isEdit Then
			Response.Write "value='"
			Response.Write Rs("HomeName")
			Response.Write "'"
		End If
		Response.Write "></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>网站连接URL:</td>" & vbCrLf
		Response.Write " <td class=forumRow><input name='LinkUrl' type='text' id='LinkUrl' size=60 "
		If isEdit Then
			Response.Write "value='"
			Response.Write Rs("LinkUrl")
			Response.Write "'"
		Else
			Response.Write "value='http://'"
		End If
		Response.Write "></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>网站简介或广告代码:<BR><B>注意：</B>如果你的连接类型选择了代码，请在此处输入代码，支持HTML语法。</td>" & vbCrLf
		Response.Write " <td class=forumRow><textarea name='Remark' id='Remark' cols='60' rows='5'>"
		If isEdit Then
			Response.Write Server.HTMLEncode(Rs("Remark"))
		End If
		Response.Write "</textarea></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>图片URL:</td>" & vbCrLf
		Response.Write " <td class=forumRow><input name='image1' id=image1 type='text' size=60 "
		If isEdit Then
			Response.Write "value='"
			Response.Write Rs("ImageUrl")
			Response.Write "'"
		End If
		Response.Write "></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRow colspan=2><iframe name=""image"" frameborder=0 width=100% height=42 scrolling=no src=upfile.asp?type=image&upnum=1></iframe></td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>图片大小:</td>" & vbCrLf
		Response.Write " <td class=forumRow>宽度：<input name='width' type='text' id='width' size='6' maxlength='5' "
		If isEdit Then
			Response.Write "value='"
			Response.Write Rs("width")
			Response.Write "'"
		End If
		Response.Write "> 像素 * " & vbCrLf
		Response.Write " 高度：<input name='height' type='text' id='height' size='6' maxlength='5' "
		If isEdit Then
			Response.Write "value='"
			Response.Write Rs("height")
			Response.Write "'"
		End If
		Response.Write "> 像素</td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRowHighlight align=right>连接类型:</td>" & vbCrLf
		Response.Write " <td class=forumRow><input type='radio' name='LinkType' value='0' "
		If isEdit Then
			If Rs("LinkType") = 0 Then
				Response.Write "checked"
			End If
		Else
			Response.Write "checked"
		End If
		Response.Write ">图片&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf
		Response.Write " <input type='radio' name='LinkType' value='1' "
		If isEdit Then
			If Rs("LinkType") = 1 Then
				Response.Write "checked"
			End If
		End If
		Response.Write ">FLASH&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf
		Response.Write " <input type='radio' name='LinkType' value='2' "
		If isEdit Then
			If Rs("LinkType") = 2 Then
				Response.Write "checked"
			End If
		End If
		Response.Write ">代码&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf
		If isEdit Then
			Response.Write "<input type=checkbox name=UpdateTime value='yes'> 更新成最新广告"
		End If
		Response.Write "</td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<tr height=""21"">" & vbCrLf
		Response.Write " <td class=forumRow colspan=2 align=center>" & vbCrLf
		Response.Write " <input type=""button"" name=""Submit1"" onclick=""javascript:history.go(-1)"" value=""返回上一页"" class=button>&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf
		Response.Write " <input type='submit' name='Submit' value='保存广告' class=button>" & vbCrLf
		Response.Write " </td>" & vbCrLf
		Response.Write "</tr>" & vbCrLf
		Response.Write "<script language=JavaScript>showsetting(myform);</script></form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		If isEdit Then
			Rs.Close
			Set Rs = Nothing
		End If
	End Sub

	Private Sub savenew()
		If Len(Request.Form("HomeName")) = 0 Then
			Founderr = True
			ErrMsg = ErrMsg + "<li>网站名称不能为空！</li>"
			Exit Sub
		End If
		If Len(Request.Form("Remark")) = 0 Then
			Founderr = True
			ErrMsg = ErrMsg + "<li>网站简介或广告代码！</li>"
			Exit Sub
		End If
		If Founderr = False Then
			Set Rs = CreateObject("ADODB.Recordset")
			SQL = "select * from NC_AdColumn where (id is null)"
			Rs.Open SQL, Conn, 1, 3
			Rs.addnew
			Rs("HomeName") = DownsysClass.HTMLEncodes(Request.Form("HomeName"))
			Rs("Remark") = Request.Form("Remark")
			If Trim(Request.Form("LinkUrl")) <> "" Then Rs("LinkUrl") = Request.Form("LinkUrl")
			If Trim(Request.Form("image1")) <> "" Then Rs("ImageUrl") = Request.Form("image1")
			If Trim(Request.Form("Height")) <> "" Then Rs("Height") = Request.Form("Height")
			If Trim(Request.Form("Width")) <> "" Then Rs("Width") = Request.Form("Width")
			If Len(Request.Form("topmargin")) <> 0 Then Rs("topmargin") = Request.Form("topmargin")
			If Len(Request.Form("sidemargin")) <> 0 Then Rs("sidemargin") = Request.Form("sidemargin")
			If Len(Request.Form("topmargin1")) <> 0 Then Rs("topmargin1") = Request.Form("topmargin1")
			If Len(Request.Form("sidemargin1")) <> 0 Then Rs("sidemargin1") = Request.Form("sidemargin1")
			If Len(Request.Form("topmargin2")) <> 0 Then Rs("topmargin2") = Request.Form("topmargin2")
			If Len(Request.Form("sidemargin2")) <> 0 Then Rs("sidemargin2") = Request.Form("sidemargin2")
			Rs("AdsType") = Request.Form("AdsType")
			Rs("ColumnID") = Request.Form("ColumnID")
			Rs("AdsHits") = 0
			Rs("AdsTime") = Now
			Rs("LinkType") = Request.Form("LinkType")
			Rs("isLock") = 0
			Rs.Update
			Rs.Close
			Set Rs = Nothing
			NC_Admin.Succeed_Msg ("<li>添加广告 " & Request.Form("HomeName") & " 成功!</li>")
			Response.Write "<meta http-equiv=""refresh"" content=""3;url='admin_adcolumn.asp'"">" & vbCrLf
		End If
	End Sub

	Private Sub savemodify()
		If Len(Request.Form("HomeName")) = 0 Then
			Founderr = True
			ErrMsg = ErrMsg + "<li>网站名称不能为空！</li>"
			Exit Sub
		End If
		If Len(Request.Form("Remark")) = 0 Then
			Founderr = True
			ErrMsg = ErrMsg + "<li>网站简介或广告代码！</li>"
			Exit Sub
		End If
		If Founderr = False Then
			Set Rs = CreateObject("ADODB.Recordset")
			SQL = "select * from NC_AdColumn where id=" & Request.Form("id")
			Rs.Open SQL, Conn, 1, 3
			Rs("HomeName") = DownsysClass.HTMLEncodes(Request.Form("HomeName"))
			Rs("Remark") = Request.Form("Remark")
			If Trim(Request.Form("LinkUrl")) <> "" Then Rs("LinkUrl") = Request.Form("LinkUrl")
			If Trim(Request.Form("image1")) <> "" Then Rs("ImageUrl") = Request.Form("image1")
			If Trim(Request.Form("Height")) <> "" Then Rs("Height") = Request.Form("Height")
			If Trim(Request.Form("Width")) <> "" Then Rs("Width") = Request.Form("Width")
			If Len(Request.Form("topmargin")) <> 0 Then Rs("topmargin") = Request.Form("topmargin")
			If Len(Request.Form("sidemargin")) <> 0 Then Rs("sidemargin") = Request.Form("sidemargin")
			If Len(Request.Form("topmargin1")) <> 0 Then Rs("topmargin1") = Request.Form("topmargin1")
			If Len(Request.Form("sidemargin1")) <> 0 Then Rs("sidemargin1") = Request.Form("sidemargin1")
			If Len(Request.Form("topmargin2")) <> 0 Then Rs("topmargin2") = Request.Form("topmargin2")
			If Len(Request.Form("sidemargin2")) <> 0 Then Rs("sidemargin2") = Request.Form("sidemargin2")
			Rs("AdsType") = Request.Form("AdsType")
			Rs("ColumnID") = Request.Form("ColumnID")
			Rs("AdsHits") = 0
			If Request.Form("UpdateTime") = "yes" Then Rs("AdsTime") = Now
			Rs("LinkType") = Request.Form("LinkType")
			Rs("isLock") = 0
			Rs.Update
			Rs.Close
			Set Rs = Nothing
			NC_Admin.Succeed_Msg ("<li>添加广告 " & Request.Form("HomeName") & " 成功!</li>")
			Response.Write "<meta http-equiv=""refresh"" content=""3;url='admin_adcolumn.asp'"">" & vbCrLf
		End If
	End Sub

	Private Sub DelAds()
		DownsysClass.Execute ("delete from NC_AdColumn where id in (" & Request.Form("seladsid") & ")")
		DelAdsImage (Request.Form("seladsid"))
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
		Err.Raise -19691969
	End Sub

	Private Sub DelAllAds()
		DownsysClass.Execute ("delete from NC_AdColumn")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
		Err.Raise -19691969
	End Sub

	Private Sub isLockAds()
		DownsysClass.Execute ("update NC_AdColumn set isLock = 1 where id in (" & Request.Form("seladsid") & ")")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
		Err.Raise -19691969
	End Sub

	Private Sub UnlockAds()
		DownsysClass.Execute ("update NC_AdColumn set isLock = 0 where id in (" & Request.Form("seladsid") & ")")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
		Err.Raise -19691969
	End Sub

	Private Sub BatchMove()
		DownsysClass.Execute ("update NC_AdColumn set ColumnID = " & Request.Form("ColumnID") & " where id in (" & Request.Form("seladsid") & ")")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
		Err.Raise -19691969
	End Sub

	Private Sub indateAds()
		DownsysClass.Execute ("update NC_AdColumn set AdsTime = " & DownsysClass.SqlString & " where id in (" & Request.Form("seladsid") & ")")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
		Err.Raise -19691969
	End Sub

	Private Sub showpage()
		Dim FileName
		Dim n
		Dim ii
		FileName = "admin_adcolumn.asp"
		If totalnumber Mod maxperpage = 0 Then
			n = totalnumber \ maxperpage
		Else
			n = totalnumber \ maxperpage + 1
		End If
		Response.Write "<table cellspacing=1 width='100%' border=0><form method=Post action=" & FileName & "><tr><td align=center> " & vbCrLf
		If CurrentPage < 2 Then
			Response.Write "共有广告 <font COLOR=#FF0000><B>" & totalnumber & "</B></font> &nbsp;首 页&nbsp;上一页&nbsp;"
		Else
			Response.Write "共有广告 <font COLOR=#FF0000><B>" & totalnumber & "</B></font> &nbsp;<a href=" & FileName & "?page=1>首 页</a>&nbsp;"
			Response.Write "<a href=" & FileName & "?page=" & CurrentPage - 1 & ">上一页</a>&nbsp;"
		End If
		If n - CurrentPage < 1 Then
			Response.Write "下一页&nbsp;尾 页 " & vbCrLf
		Else
			Response.Write "<a href=" & FileName & "?page=" & (CurrentPage + 1) & ">下一页</a>"
			Response.Write "&nbsp;<a href=" & FileName & "?page=" & n & ">尾 页</a>" & vbCrLf
		End If
		Response.Write "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
		Response.Write "&nbsp;转到："
		Response.Write "&nbsp;<select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:submit()'>" & vbCrLf
		For ii = 1 To n
			Response.Write "<option value='" & ii & "' "
			If CurrentPage = Int(ii) Then
				Response.Write "selected "
			End If
			Response.Write ">第" & ii & "页</option>"
		Next
		Response.Write "&nbsp;</select> " & vbCrLf
		Response.Write "</td></tr></FORM></table>" & vbCrLf
	End Sub

	Private Function DelAdsImage(FileID)
		Dim FSO
		Dim FilePath
		Dim Rs_Obj
		If Not DownsysClass.IsObjectFSO(DownsysClass.Script_FSO) Then Exit Function
		Set FSO = Server.CreateObject(DownsysClass.Script_FSO)
		Set Rs_Obj = CreateObject("adodb.recordset")
		SQL = "select id,ImageUrl from NC_Adcolumn where id in (" & FileID & ")"
		Rs_Obj.Open SQL, Conn, 1, 1
		Do While Not Rs_Obj.EOF
			FilePath = Rs_Obj(1)
			FilePath = Replace(FilePath, "http:/", "")
			If FSO.FileExists(Server.MapPath(FilePath)) Then
				FSO.DeleteFile Server.MapPath(FilePath), True
			End If
			Rs_Obj.movenext
		Loop
		Rs_Obj.Close
		Set Rs_Obj = Nothing
		Set FSO = Nothing
	End Function
	'*************************************************************
	'函数作用：Banner广告
	'*************************************************************
	Public Function BannerAds(ColumnID)
		Dim SQL, Rs_Ad, HtmlString
		Set Rs_Ad = CreateObject("adodb.recordset")
		SQL = "select Top 1 * from NC_Adcolumn where AdsType = 1 And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
		Rs_Ad.Open SQL, Conn, 1, 1
		If Rs_Ad.bof And Rs_Ad.EOF Then
			HtmlString = "<A HREF='http://www.s0575.net/' target=_blank><img src='" & DownsysClass.SetupDir & "images/Banner.gif' border=0 width='468' height='60'></A>"
		Else
			If Rs_Ad("LinkType") = 0 Then
				HtmlString = "<A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A>"
			ElseIf Rs_Ad("LinkType") = 1 Then
				HtmlString = " <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>" & vbCrLf
				HtmlString = HtmlString & " <param name='movie' value='" & Rs_Ad("ImageUrl") & "'>" & vbCrLf
				HtmlString = HtmlString & " <param name='quality' value='high'>" & vbCrLf
				HtmlString = HtmlString & " <embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>" & vbCrLf
				HtmlString = HtmlString & " </object>" & vbCrLf
			Else
				HtmlString = Rs_Ad("Remark")
			End If
		End If
		Rs_Ad.Close
		Set Rs_Ad = Nothing
		BannerAds = HtmlString
	End Function
	'*************************************************************
	'函数作用：栏目广告
	'*************************************************************
	Public Function AdsColumn(ColumnID, TypeID)
		Dim SQL, Rs_Ad, HtmlString
		Set Rs_Ad = CreateObject("adodb.recordset")
		SQL = "select Top 12 * from NC_Adcolumn where AdsType = " & TypeID & " And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
		Rs_Ad.Open SQL, Conn, 1, 1
		If Rs_Ad.bof And Rs_Ad.EOF Then
			HtmlString = ""
		Else
			Do While Not Rs_Ad.EOF
				If Rs_Ad("LinkType") = 0 Then
					HtmlString = HtmlString & "<A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A>" & vbCrLf & Chr(9)
				ElseIf Rs_Ad("LinkType") = 1 Then
					HtmlString = HtmlString & " <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>" & vbCrLf
					HtmlString = HtmlString & " <param name='movie' value='" & Rs_Ad("ImageUrl") & "'>" & vbCrLf
					HtmlString = HtmlString & " <param name='quality' value='high'>" & vbCrLf
					HtmlString = HtmlString & " <embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>" & vbCrLf
					HtmlString = HtmlString & " </object>" & vbCrLf & Chr(9)
				Else
					HtmlString = HtmlString & Rs_Ad("Remark") & vbCrLf & Chr(9)
				End If
				Rs_Ad.movenext
			Loop
		End If
		Rs_Ad.Close
		Set Rs_Ad = Nothing
		AdsColumn = HtmlString
	End Function
	'*************************************************************
	'函数作用：文章内容广告
	'*************************************************************
	Public Function AdsColumn1(ColumnID, TypeID)
		Dim SQL, Rs_Ad, HtmlString
		Set Rs_Ad = CreateObject("adodb.recordset")
		SQL = "select Top 1 * from NC_Adcolumn where AdsType = " & TypeID & " And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
		Rs_Ad.Open SQL, Conn, 1, 1
		If Rs_Ad.bof And Rs_Ad.EOF Then
			HtmlString = ""
		Else
			Do While Not Rs_Ad.EOF
				If Rs_Ad("LinkType") = 0 Then
					HtmlString = HtmlString & "<A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "' align='left'></A>" & vbCrLf & Chr(9)
				ElseIf Rs_Ad("LinkType") = 1 Then
					HtmlString = HtmlString & " <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>" & vbCrLf
					HtmlString = HtmlString & " <param name='movie' value='" & Rs_Ad("ImageUrl") & "'>" & vbCrLf
					HtmlString = HtmlString & " <param name='quality' value='high'>" & vbCrLf
					HtmlString = HtmlString & " <embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>" & vbCrLf
					HtmlString = HtmlString & " </object>" & vbCrLf & Chr(9)
				Else
					HtmlString = HtmlString & Rs_Ad("Remark") & vbCrLf & Chr(9)
				End If
				Rs_Ad.movenext
			Loop
		End If
		Rs_Ad.Close
		Set Rs_Ad = Nothing
		AdsColumn1 = HtmlString
	End Function
	'*************************************************************
	'函数作用：固定广告
	'*************************************************************
	Public Function ScriptFixedAds(ColumnID)
		Dim SQL, Rs_Ad, HtmlString, ScriptString, strMargin
		Set Rs_Ad = CreateObject("adodb.recordset")
		SQL = "select Top 12 * from NC_Adcolumn where AdsType in (5,6) And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
		Rs_Ad.Open SQL, Conn, 1, 1
		If Rs_Ad.bof And Rs_Ad.EOF Then
			ScriptFixedAds = ""
		Else
			Do While Not Rs_Ad.EOF
				If Rs_Ad("AdsType") = 6 Then strMargin = "style='right:" & Rs_Ad("sidemargin2") & "px;POSITION:absolute;TOP:" & Rs_Ad("topmargin2") & "px;'"
				If Rs_Ad("AdsType") = 5 Then strMargin = "style='left:" & Rs_Ad("sidemargin1") & "px;POSITION:absolute;TOP:" & Rs_Ad("topmargin1") & "px;'"
				If Rs_Ad("LinkType") = 0 Then
					HtmlString = HtmlString & "suspendcode" & Rs_Ad("id") & "=""<DIV id=lovexin" & Rs_Ad("id") & " " & strMargin & "><A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A></div>""" & vbCrLf
					HtmlString = HtmlString & "document.write(suspendcode" & Rs_Ad("id") & "); " & vbCrLf
					ScriptString = ScriptString & "document.all.lovexin" & Rs_Ad("id") & ".style.pixelTop+=percent;" & vbCrLf
				ElseIf Rs_Ad("LinkType") = 1 Then
					HtmlString = HtmlString & " suspendcode" & Rs_Ad("id") & "=""<DIV id=lovexin" & Rs_Ad("id") & " " & strMargin & "><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>"
					HtmlString = HtmlString & "<param name='movie' value='" & Rs_Ad("ImageUrl") & "'>"
					HtmlString = HtmlString & "<param name='quality' value='high'>"
					HtmlString = HtmlString & "<embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>"
					HtmlString = HtmlString & "</object></div>""" & vbCrLf
					HtmlString = HtmlString & "document.write(suspendcode" & Rs_Ad("id") & "); " & vbCrLf
					ScriptString = ScriptString & "document.all.lovexin" & Rs_Ad("id") & ".style.pixelTop+=percent;" & vbCrLf
				Else
					HtmlString = HtmlString & "suspendcode" & Rs_Ad("id") & "=""<DIV id=lovexin" & Rs_Ad("id") & " " & strMargin & "><table border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'><tr><td class=AdsBorder>" & Rs_Ad("Remark") & "</td></tr></table></div>""" & vbCrLf
					HtmlString = HtmlString & "document.write(suspendcode" & Rs_Ad("id") & "); " & vbCrLf
					ScriptString = ScriptString & "document.all.lovexin" & Rs_Ad("id") & ".style.pixelTop+=percent;" & vbCrLf
				End If
				Rs_Ad.movenext
			Loop
			ScriptFixedAds = "<script language=""JavaScript"">" & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "lastScrollY=0;" & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "function heartBeat(){ " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "diffY=document.body.scrollTop; " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "percent=.1*(diffY-lastScrollY); " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "if(percent>0)percent=Math.ceil(percent); " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "else percent=Math.floor(percent); " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & ScriptString
			ScriptFixedAds = ScriptFixedAds & "lastScrollY=lastScrollY+percent; " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "} " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & HtmlString
			ScriptFixedAds = ScriptFixedAds & "window.setInterval(""heartBeat()"",1); " & vbCrLf
			ScriptFixedAds = ScriptFixedAds & "</script>" & vbCrLf
		End If
		Rs_Ad.Close
		Set Rs_Ad = Nothing
	End Function
	'*************************************************************
	'函数作用：漂浮广告
	'*************************************************************
	Public Function ScriptFloatAds(ColumnID)
		Dim SQL, Rs_Ad, HtmlString
		Set Rs_Ad = CreateObject("adodb.recordset")
		SQL = "select Top 1 * from NC_Adcolumn where AdsType = 4 And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
		Rs_Ad.Open SQL, Conn, 1, 1
		If Rs_Ad.bof And Rs_Ad.EOF Then
			HtmlString = ""
		Else
			HtmlString = HtmlString & "<SCRIPT LANGUAGE=JavaScript src=" & DownsysClass.SetupDir & "js/floatads.js></SCRIPT>" & vbCrLf
			If Rs_Ad("LinkType") = 0 Then
				HtmlString = HtmlString & "<div id='yuxingtome' style='position:absolute;'><A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A></div>" & vbCrLf
			ElseIf Rs_Ad("LinkType") = 1 Then
				HtmlString = HtmlString & "<div id='yuxingtome' style='position:absolute;'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>"
				HtmlString = HtmlString & "<param name='movie' value='" & Rs_Ad("ImageUrl") & "'>"
				HtmlString = HtmlString & "<param name='quality' value='high'>"
				HtmlString = HtmlString & "<embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>"
				HtmlString = HtmlString & "</object></div>" & vbCrLf
			Else
				HtmlString = HtmlString & "<div id='yuxingtome' style='position:absolute;'><table border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'><tr><td class=AdsBorder>" & Rs_Ad("Remark") & "</td></tr></table></div>" & vbCrLf
			End If
			HtmlString = HtmlString & "<SCRIPT LANGUAGE=JavaScript>yuxingtome()</SCRIPT>" & vbCrLf
		End If
		Rs_Ad.Close
		Set Rs_Ad = Nothing
		ScriptFloatAds = HtmlString
	End Function
	'*************************************************************
	'函数作用：弹出式窗口
	'*************************************************************
	Public Function RunScriptAds(ColumnID)
		Dim SQL, Rs_Ad, HtmlString
		Set Rs_Ad = CreateObject("adodb.recordset")
		SQL = "select Top 1 * from NC_Adcolumn where AdsType = 0 And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
		Rs_Ad.Open SQL, Conn, 1, 1
		If Rs_Ad.bof And Rs_Ad.EOF Then
			HtmlString = ""
		Else
			HtmlString = "<SCRIPT language=javascript>window.open(""" & DownsysClass.SetupDir & "runads.asp?id=" & Rs_Ad("id") & """,""runads" & Rs_Ad("id") & """,""toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=" & Rs_Ad("Width") & ",height=" & Rs_Ad("Height") & ",top=" & Rs_Ad("topmargin") & ",left=" & Rs_Ad("sidemargin") & """);</script>" & vbCrLf
		End If
		Rs_Ad.Close
		Set Rs_Ad = Nothing
		RunScriptAds = HtmlString
	End Function
End Class
%>
