<%@language=vbscript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="News_Sub.asp"-->
<script language="JavaScript" type="text/JavaScript">
function checkBig()
{
  if (document.form1.BigClassName.value=="")
  {
    alert("大类名称不能为空！");
    document.form1.BigClassName.focus();
    return false;
  }
}
</script>
<script language="JavaScript" type="text/JavaScript">
function checkSmall()
{
  if (document.form1.SmallClassName.value=="")
  {
    alert("小类名称不能为空！");
    document.form1.SmallClassName.focus();
    return false;
  }
}
</script>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body>
<%
If Request.QueryString("add")="bigclass" Then
Call AddBigClass
  If Request.Form("Add")=" 添 加 " Then
  BigClassName=Trim(Request("BigClassName"))
   If BigClassName="" Then
   FoundErr=True
        Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('文章大类名不能为空!');" & Chr(13)
		Response.write "window.document.location.href='News_ClassManage.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End 
   End if
     If FoundErr<>True then
     Set rs=Server.CreateObject("Adodb.RecordSet")
     rs.Open "Select * From [BigClassNews] Where [News_BigClassName]='" & BigClassName & "'",Conn,1,3
        If not (rs.bof and rs.EOF) then
	FoundErr=True
	Response.Write  "<br><li>文章大类“" & BigClassName & "”已经存在！</li>"
        Else
    	rs.addnew
     	rs("News_BigClassName")=BigClassName
    	rs.Update
     	rs.Close
	set rs=Nothing
    	Response.Redirect "News_ClassManage.asp"  
	End if
     End if
  End if
End if
If Request.QueryString("add")="smallclass" Then
Call AddSmallClass
   If Request.Form("AddS")=" 添 加 " Then
   SmallClassName=Trim(Request("SmallClassName"))
   BigClass=Trim(Request("selectd"))
   If SmallClassName="" or BigClass="0" Then
   FoundErrS=True
        Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('文章小类名不能为空!');" & Chr(13)
		Response.write "window.document.location.href='News_ClassManage.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End 
   End if
     If FoundErrS<>True then
     Set rss=Server.CreateObject("Adodb.RecordSet")
     rss.Open "Select * From [SmallClassNews] Where News_SmallClassName='" & SmallClassName & "'",Conn,1,3
        If not (rss.bof and rss.EOF) then
	FoundErrS=True
	Response.Write  "<center><br><li>文章小类“" & SmallClassName & "”已经存在！</li></center>"
        Else
    	rss.addnew
        rss("News_BigClassName")=BigClass
     	rss("News_SmallClassName")=SmallClassName
    	rss.Update
     	rss.Close
	set rss=Nothing
    	Response.Redirect "News_ClassManage.asp"  
	End if
     End if
  End if   
End if
%>
</body>
</html>