<!--#include file="../siteconfig/conn.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登录，或者超时了！请重新登录');this.location.href='login.asp';</script>")
Response.End
End if
%>
<!--#include file="Admin_ClassFunction.asp"-->
<HTML>
<HEAD>
<TITLE>分类管理</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</HEAD>
<script language="JavaScript" type="text/javascript" src="js.js"></script>
<BODY>
<%dim Menu,ClassAd_Title,ClassAd_StartTime,ClassAd_EndTime,ClassAd_ClassId,ClassAd_Html,ClassAd_Type
ClassAd_Title=Request("ClassAd_Title")
ClassAd_StartTime=Request("ClassAd_StartTime")
ClassAd_EndTime=Request("ClassAd_EndTime")
ClassAd_ClassId=Request("ClassAd_ClassId")
ClassAd_Html=Request("ClassAd_Html")
ClassAd_Type=Request("ClassAd_Type")
Menu=Request("Menu")
if Menu="AddClassAd" then
   rs.open"select * from ClassAd where ClassAd_ClassId="&ClassAd_ClassId&" and ClassAd_Type="&ClassAd_Type,conn,1,3
   if not rs.eof and not rs.bof then
          rs.close
          Response.Write("<script language=javascript>alert('该广告已存在');javascript:history.go(-1)</script>")
	      Response.End()
   else
   rs.addnew
      rs("ClassAd_Title")=ClassAd_Title
	  rs("ClassAd_StartTime")=ClassAd_StartTime
	  rs("ClassAd_EndTime")=ClassAd_EndTime
	  rs("ClassAd_ClassId")=ClassAd_ClassId
	  rs("ClassAd_Html")=ClassAd_Html
	  rs("ClassAd_Type")=ClassAd_Type
   rs.update
   rs.close
   Response.Write("<script language=javascript>alert('广告添加成功');parent.window.location.reload();DivOpenClose('',2,0,0);</script>")
   Response.End()
   end if
end if
%>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr>
    <td width="45%">添加广告</td>
    <td width="55%" align="right"><a href="#" onClick="javascript:DivOpenClose('',2,0,0);return false">关闭</a></td>
  </tr>
</table>
<form name="ClassAdFrom" method="post" action="?Menu=AddClassAd" id="ClassAdFrom" onSubmit="return ClassAdCheck();">
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr bgcolor="#FFFFFF">
    <td>广告名称</td>
    <td><input name="ClassAd_Title" type="text" class="inputcss" id="ClassAd_Title" size="15"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>开始时间</td>
    <td><input name="ClassAd_StartTime" type="text" class="inputcss" id="ClassAd_StartTime" size="15">
      时间格式 如:2008-11-11 </td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>结束时间</td>
    <td><input name="ClassAd_EndTime" type="text" class="inputcss" id="ClassAd_EndTime" size="15">
       时间格式 如:2008-11-11 不设就是长久广告    </td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>所属分类</td>
    <td><select name="ClassAd_ClassId" class="inputcss" id="ClassAd_ClassId">
      <option value="0" selected>-默认广告-</option>
<%
set RsClass(0)=server.createobject("adodb.recordset")
RsClass(0).open "select Class_Id,Class_Name from Class where Class_TopClassId=0",conn,1,3
while not RsClass(0).eof
		response.write "<option value='"&RsClass(0)("Class_Id")&"'>"&RsClass(0)("Class_Name")&"</option>"&vbCrLf
	call addlistunder(1)
	RsClass(0).movenext
wend
%>
</select></td>
  </tr>
  
  <tr bgcolor="#FFFFFF">
    <td>广告HTML</td>
    <td><textarea name="ClassAd_Html" cols="30" rows="5" class="inputcss" id="ClassAd_Html"></textarea> 
    支持HTML和JS</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>广告类型</td>
    <td><select name="ClassAd_Type" class="inputcss" id="ClassAd_Type">
	 <option value="0" selected>顶部广告</option>
	 <option value="1">底部广告</option>
	 </select></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>&nbsp;</td>
    <td><input name="Submit" type="submit" class="SubmitCss" value="添加广告"></td>
  </tr>
</table>
</form>
</BODY>
</HTML>

