<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<!--#include file="Connections/conn_news.asp" -->
<!--#include file="yns_config.asp" -->
<!--#include file="yns_chklogin.asp" -->
<% chk_user_login(1) %>
<!--#include file="yns_chkerror.asp" -->
<%
Dim rst
Dim rst_numRows

Set rst = Server.CreateObject("ADODB.Recordset")
rst.ActiveConnection = MM_conn_news_STRING
rst.Source = "SELECT * FROM t_type where t_id<>57"
rst.CursorType = 0
rst.CursorLocation = 2
rst.LockType = 1
rst.Open()

rst_numRows = 0
%>
<%
Dim rss
Dim rss_numRows

Set rss = Server.CreateObject("ADODB.Recordset")
rss.ActiveConnection = MM_conn_news_STRING
rss.Source = "SELECT * FROM t_stype"
rss.CursorType = 0
rss.CursorLocation = 2
rss.LockType = 1
rss.Open()

rss_numRows = 0
%>
<%
Dim rsts
Dim rsts_numRows

Set rsts = Server.CreateObject("ADODB.Recordset")
rsts.ActiveConnection = MM_conn_news_STRING
rsts.Source = "SELECT *  FROM t_type_son inner join t_type on t_type_son.ts_pid=t_type.t_id  ORDER BY ts_pid desc"
rsts.CursorType = 0
rsts.CursorLocation = 2
rsts.LockType = 1
rsts.Open()

rsts_numRows = 0
%>

<%
Dim fname
Dim filepath
dim mm_rnd
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
Randomize
mm_rnd=Int((9999 - 1000) * Rnd + 1000)
fname=fname&mm_rnd& ".shtml"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>湖南百润医药有限公司-------康曼德www.hnicp.com</title>
<script language="javascript">
<!--
function checkdata()
{
if (document.form1.n_tid.value=="") {
alert ("请选择新闻的大类 ！")
return false
}
if (document.form1.n_tid.value==53) {
alert ("静态新闻，不能增加 ！")
return false
}
if (document.form1.n_tsid.value=="") {
alert ("请选择新闻的小类 ！")
return false
}
if (document.form1.n_title.value=="") {
alert ("请输入新闻标题 ！")
return false
}
if (document.form1.n_author.value=="") {
alert ("请输入新闻作者 ！")
return false
}
return true
}
//-->
</script>
<script>
<!--


function showimg(){
if (document.form1.n_index.checked == true) {
	img.style.display = "";
	advance.innerText="取消首页新闻:"
}else{
	img.style.display = "none";
	advance.innerText="设为首页新闻:"
}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
<%
dim mm_jsmenu
dim i
i = -1
Can_add=",26,27,28,29,30,31,32,33,34,35,36,"
mm_jsmenu = "<script language="&chr(34)&"javascript"&chr(34)&">"&chr(13)
mm_jsmenu = mm_jsmenu&"<!--"&chr(13)
mm_jsmenu = mm_jsmenu&"var subcat = new Array();"&chr(13)
do while not rsts.eof
if instr(Can_add,","&cstr(rsts("ts_id"))&",") then
i = i + 1
mm_jsmenu = mm_jsmenu&"subcat["&i&"] = new Array('"&(rsts.Fields.Item("ts_pid").Value)&"','"&(rsts.Fields.Item("ts_name").Value)&"','"&(rsts.Fields.Item("ts_id").Value)&"')"&chr(13)
end if
rsts.movenext
loop
mm_jsmenu = mm_jsmenu&chr(13)&"function changeselect1(locationid)"&chr(13)
mm_jsmenu = mm_jsmenu&"{"&chr(13)
mm_jsmenu = mm_jsmenu&"document.form1.n_tsid.length = 0; "&chr(13)
mm_jsmenu = mm_jsmenu&"var a=0;for (i=0; i<subcat.length; i++) "&chr(13)
mm_jsmenu = mm_jsmenu&"{"&chr(13)
mm_jsmenu = mm_jsmenu&"if (subcat[i][0] == locationid) "&chr(13)
mm_jsmenu = mm_jsmenu&"{a+=1;document.form1.n_tsid.options[document.form1.n_tsid.length] = new Option(subcat[i][1], subcat[i][2]);} "&chr(13)
mm_jsmenu = mm_jsmenu&"}"&chr(13)
mm_jsmenu = mm_jsmenu&"if (a==1){document.form1.n_tsid.options(1).selected=true};}"&chr(13)
mm_jsmenu = mm_jsmenu&"//-->"&chr(13)&"</script>"&chr(13)
response.Write mm_jsmenu

%>
<link href="style/css.css" rel="stylesheet" type="text/css">
</head>

<body>

<form ACTION="yns_nadd_save.asp" METHOD="POST"   name="form1" id="form1"  >
  <table width="94%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#CCCCCC" class="table-line">
    <tr class="td-title-color">
      <td height="27" colspan="3" nowrap>增加新闻</td>
    </tr>
    <tr class="td-body-color">
      <td width="18%" height="27" align="center" nowrap>类别:</td>
      <td height="27" colspan="2"> <select name="n_tid" style="font-family: 宋体; font-size: 9pt;display:none" onChange="changeselect1(this.value)">
          <%
While (NOT rst.EOF)
%>
          <option value="<%=(rst.Fields.Item("t_id").Value)%>"><%=(rst.Fields.Item("t_name").Value)%></option>
          <%
rst.MoveNext()
Wend
If (rst.CursorType > 0) Then
  rst.MoveFirst
Else
  rst.Requery
End If
%>
        </select>
        <select name="n_tsid" class="px12" id="n_tsid">
          <option selected>请选择</option>
        </select> </td>
    </tr>
	<script>changeselect1(form1.n_tid.value)</script>
    <tr class="td-body-color">
      <td width="18%" height="27" align="center" nowrap>标题:</td>
      <td height="27" colspan="2"> <input name="n_title" type="text" style="font-family: 宋体; font-size: 9pt" value="" size="50">
      </td>
    </tr>
    <tr class="td-body-color">
      <td width="18%" height="27" align="center" nowrap>作者:</td>
      <td height="27" colspan="2"><font color="#F6F6F6">
        <input style="font-family: 宋体; font-size: 9pt" type="text" name="n_author" value="<% = session("ss_user") %>" size="15">
        </font> </td>
    </tr>
  </table>
  <table width="94%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#EFEFEF" class="table-line" id="img" style="display: none">
    <tr>
      <td width="18%" height="27" align="center" nowrap>缩略图:</td>
      <td width="50%" height="27"> <input style="font-family: 宋体; font-size: 9pt"  type="text" name="n_mpic" value="" size="32">
      </td>
      <td width="32%" height="27"> <a href="#" onClick="MM_openBrWindow('yns_upload.asp?m=1','上传图片','width=300,height=100')">上传缩略图</a></td>
    </tr>
    <tr>
      <td width="18%" height="27" align="center" nowrap>真实图:</td>
      <td width="50%" height="27"> <input style="font-family: 宋体; font-size: 9pt" type="text" name="n_rpic" value="" size="32">
      </td>
      <td width="32%" height="27"> <a href="#" onClick="MM_openBrWindow('yns_upload.asp?m=2','上传图片','width=300,height=100')">上传真实图</a></td>
    </tr>
  </table>
  <table width="94%" border="3" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="table-line">
    <tr>
      <td> <iframe ID="eWebEditor1" src="editor/ewebeditor.asp?id=n_content&style=standard" frameborder="0" scrolling="no" width="100%" HEIGHT="350"></iframe>
      </td>
    </tr>
  </table>
  <div align="center"><br>
    <input id=Submit1  type=submit name=Submit1 value="添加新闻" onClick="return checkdata()" >
    <input name="n_fname" type="hidden" id="n_fname" value="<%=fname%>">
    <input name="n_fpath" type="hidden" id="n_fpath" value="<% = date() %>">
    <input name="n_date" type="hidden" id="n_date" value="<%=now()%>">
    <input name="n_content" type="hidden" id="n_content">
    <input type="hidden" name="MM_insert" value="form1">
  </div>
</form>
</body>
</html>
<%
rst.Close()
Set rst = Nothing
%>
<%
rss.Close()
Set rss = Nothing
%>
<%
rsts.Close()
Set rsts = Nothing
%>