<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../inc/conn.asp"-->
<!-- #include file="../session.asp"-->
<!-- #include file="../vippass.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #0590D3;
}
-->
</style>
<link href="../tgy_css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>
<SCRIPT language=JavaScript>

function check(){
	if(trim(document.Form1.news_title.value) == "") {
		    alert("请输入新闻标题");
			document.Form1.news_title.focus();
		    return false;
	}
	if(trim(document.Form1.game_id.value) == "") {
		    alert("请选择新闻所属游戏");
			document.Form1.game_id.focus();
		    return false;
	}
	return true;
	document.Form1.submit()
    }
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 	

</SCRIPT>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="huise_line">
  <!--DWLayoutTable-->
  <tr>
    <td height="27" colspan="2" align="center" valign="middle" bgcolor="#0590D3" class="font_color">添加游戏新闻</td>
  </tr>
  <form action="news_save.asp?a=add" method="post" name="Form1" onSubmit="return check()">
  <tr>
    <td width="79" height="29" align="right" valign="middle">新闻标题：</td>
    <td width="684"  valign="middle"><input name="news_title" type="text" id="news_title" size="50" /></td>
  </tr>
  <tr>
    <td height="29" align="right" valign="middle">设置推荐：</td>
    <td  valign="middle"><input type="checkbox" name="news_flag" value="1" /></td>
  </tr>
  <tr>
    <td height="29" align="right" valign="middle">新闻类别：</td>
    <td valign="middle"><select name="news_typeid">
	<%set nrs=server.CreateObject("adodb.recordset")
	  nrs.open "select * from cdkey88_newstype",conn,1,1
	  do while not nrs.eof
	  %>
	  <option value="<%=nrs("typeid")%>"><%=nrs("news_type")%></option>
	  <%nrs.movenext
	    loop
		nrs.close
		set nrs=nothing
		%>
    </select>    </td>
  </tr>
  <tr>
    <td height="29" align="right" valign="middle">相关游戏：</td>
    <td valign="middle"><select name="game_id" id="game_id">
	  <option value="">请选择相关游戏</option>
      <option value="0">综合新闻</option>
	  <%set rs1=server.CreateObject("adodb.recordset")
	    rs1.open "select game_id,game_name from cdkey88_game where fb=1 or (fb=0 and username='"&username&"')",conn,1,1
		do while not rs1.eof
		%>
		<option value="<%=rs1("game_id")%>"><%=rs1("game_name")%></option>
		<%rs1.movenext
		 loop
		 rs1.close
		 set rs1=nothing
		 %>
    </select>    </td>
  </tr>
  <tr>
    <td height="28" align="right" valign="middle">详细内容：</td>
    <td rowspan="2" valign="top"><textarea name="content" id="content" style="display:none"></textarea>
      <iframe id="Editor" name="Editor" src="../../editor/index.html?ID=content" frameborder="0" marginheight="0" marginwidth="0" scrolling="No" style="height:320px;width:99%"></iframe></td>
  </tr>
  <tr>
    <td height="300">&nbsp;</td>
    </tr>
  <tr>
    <td height="58" colspan="2" align="center" valign="middle"><input type="submit"  name="Submit" value="确定" /></td>
  </tr>
  </form>
</table>
<%conn.close
set conn=nothing
%>
</body>
</html>
