<%@language=vbscript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="JsInc/Function.asp"-->
<!--#include file="JsInc/config.asp"-->
<%
Dim onecount
Set rs=Conn.Execute("Select * From [SmallClassProduct]")
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%=trim(rs("Product_SmallClassName"))%>","<%= trim(rs("Product_BigClassName"))%>","<%= trim(rs("Product_SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    } 

function CheckForm()
{   
  if (editor.EditMode.checked==true)
	  document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
  else
	  document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; 

  if (document.myform.Title.value=="")
  {
    alert("项目案例标题不能为空！");
	document.myform.Title.focus();
	return false;
  }
  if (document.myform.key.value=="")
  {
    alert("项目案例关键字不能为空！");
	document.myform.key.focus();
	return false;
  }
  if (document.myform.Content.value=="")
  {
    alert("项目案例内容不能为空！");
	editor.HtmlEdit.focus();
	return false;
  }
   if (document.myform.guige.value=="")
  {
    alert("合同编号不能为空！");
	document.myform.guige.focus();
	return false;
  }

     if (document.myform.unit.value=="")
  {
    alert("单位不能为空！");
	document.myform.unit.focus();
	return false;
  }
    if (document.myform.mome.value=="")
  {
    alert("备注不能为空！");
	document.myform.mome.focus();
	return false;
  }
  return true;  
  if (document.myform.UpdateTime.value=="")
  {
    alert("录入时间不能为空！");
	document.myform.UpdateTime.focus();
	return false;
  }
  return true;  
}
function loadForm()
{
  editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
  return true
}
</script>
<%
If Request.QueryString("action")="add" Then
titel = Trim(Request.Form("Title"))
pro_id = Trim(Request.Form("pro_id"))
mome = Trim(Request.Form("mome"))
face = Trim(Request.Form("face"))
guige = Trim(Request.Form("guige"))
unit = Trim(Request.Form("unit"))
key = Trim(Request.Form("key"))
content = Trim(Request.Form("Content"))
BigClassName = Trim(Request.Form("BigClassName"))
SmallClassName = Trim(Request.Form("SmallClassName"))
passshow = Trim(Request.Form("Elite"))
pass = Trim(Request.Form("pass"))
UpTime = Trim(Request.Form("UpdateTime"))
If Request.Form("add") = "添加" Then
If SmallClassName="0" Then 
%>
<Script Language="JavaScript">
alert("请选择项目案例小类!");
javascript:history.go(-1);
</Script>
<%
Response.End
End if
        If UpdateTime<>"" and IsDate(UpdateTime)=true then
		UpdateTime=CDate(UpdateTime)
	Else
		UpdateTime=date()
	End if
Set add=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [Product] Where ID is Null"
add.Open Sql,Conn,1,3
add.addnew
add("Name")=titel
add("Product_ID")=pro_id
add("Content")=content
add("Mome")=mome
add("Image")=face
add("Unit")=unit
add("GuiGe")=guige
add("Key")=key
add("UpTime")=UpTime
add("BigClassP")=BigClassName
add("SmallClassP")=SmallClassName
If passshow="yes" Then 
add("PassShow")=true
Else
add("PassShow")=false
End if
If pass="yes" Then 
add("Pass")=true
Else
add("Pass")=false
End if
add.Update
add.Close
Set add=Nothing
JaSys("管理员" & session("ManagerUser") & "<font color=red>添加新项目案例["&titel&"]</font>成功")
Response.write "<script language='javascript'>" & chr(13)
		response.write "alert('项目案例添加成功！');" & Chr(13)
		response.write "window.document.location.href='Product_Manage.asp';"&Chr(13)
		response.write "</script>" & Chr(13)
Response.End
End if
End if
%>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body>
<body onLoad="javascipt:setTimeout('loadForm()',1000);">
<table width="100%" height="43%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="411" align="center" valign="top"> <img src="../ima/cp.gif" width="631" height="800"><br> 
      <form method="POST" name="myform" onSubmit="return CheckForm();" action="Product_Add.asp?action=add">
        <div align="center"> 
          <p>&nbsp;</p>
        </div>
      </form></td>
  </tr>
</table>
</body>
</html>