<form action="news.manage.php" id="form_add" name="form_add" method="post">
	<input type="hidden" name="action" value="save" />
    <table border="0" cellpadding="0" cellspacing="0" class="from_table">
	<tr>
		<th><tpl> $langSysNNewsName </tpl>:</th>
	  <td valign="top" class="td rowform"><input name="txttitle"class="txtinput" type="text" id="txttitle" maxlength="100" /></td>
		<td class="vtop tips2"><label style="display:none" for="txttitle" class="wrong" metaDone="true" generated="true"></label></td>
	</tr>
	<tr>
		<th><tpl> $langSysNClassName </tpl>:</th>
		<td class="td rowform" colspan="2"><tpl> $slCId </tpl>
			<span id="close_add_class"><a href="javascript:;" onclick="show_ajax_add_class();"><tpl> $langSysNCreateClass </tpl>&gt;&gt;</a></span>
			<span id="open_add_class" style="display:none">
			<tpl> $langSysNCreateClass </tpl> 
			<input type="text" name="ajax_class_name" id="ajax_class_name" class="txtinput" size="10" maxlength="50" />
			<a href="javascript:;" onclick="ajax_add_class();"><tpl> $langSysNCreate </tpl></a> <a href="javascript:;" onclick="JumpClass();"><tpl> $langSysNClassManage </tpl></a>&nbsp;&nbsp;<a href="javascript:;" onclick="cancell_ajax_add_class();">&lt;&lt;</a>			</span>
			<label style="display:none" for="news_c_id" class="wrong" metaDone="true" generated="true"></label>		</td>
	</tr>
	<tr>
		<th><tpl> $langSysNNewsContent </tpl>:</th>
		<td class="td rowform" colspan="2">
			<input type="hidden" name="txtcontent" id="txtcontent" />
			
			<tpl>php</tpl>
				include("../classes/resource/fckeditor/fckeditor.php") ;
				$oFCKeditor = new FCKeditor('content') ;
				$oFCKeditor->BasePath	= '../classes/resource/fckeditor/' ;
				$oFCKeditor->ToolbarSet = 'Simple';
				$oFCKeditor->Width	= 385 ;
				$oFCKeditor->Height	= 220 ;
				$oFCKeditor->Value		= '';
				$oFCKeditor->Create() ;
			<tpl>/php</tpl>		</td>
	</tr>
	<tr>
		<th><tpl> $langSysNNewsSort </tpl>:</th>
	  <td valign="top" class="td rowform"><input name="txtsort"class="txtinput" type="text" id="txtsort" maxlength="11" /></td>
		<td class="vtop tips2"><label style="display:none" for="txtsort" class="wrong" metaDone="true" generated="true"></label></td>
	</tr>
	<tr>
		<th><tpl> $langSysNNewsJumpUrl </tpl>:</th>
	  <td valign="top" class="td rowform"><input name="txtjumpurl"class="txtinput" type="text" id="txtjumpurl" maxlength="255" /></td>
		<td class="vtop tips2"><tpl> $langSysNNewsJumpUrlRemark </tpl></td>
	</tr>
	
</table>
<div class="table-5-bottom">
<div class="p-left-2">
				<span class="btn_left">
			<input type="submit" class="btn_submit" name="Submit" value="<tpl> $langSysNSubmit </tpl>" />
			</span>
				<span class="btn_left">
			<input type="button" class="btn_submit" name="return_list" id="return_list" value="<tpl> $langSysNReturn </tpl>" /></span>			</div>
  </div>
</form>
<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langSysNJumpToClassManage </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
</div>
<script>
$(document).ready(function() {
	//添加
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ST(0,0);
								ShowDiv	= 'result_content';
								getPageContent("news.manage.php?action=ajax_list");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	//对添加表单做的验证定义
	$("#form_add").validate({
		errorClass: "wrong",
		rules: {
			txttitle: {required: true},
			news_c_id: {required: true,min: 1},
			txtsort: {required: true,number: true,min: 0},
			txtjumpurl: {url: true}
		},
		messages: {
			txttitle: {required: "<tpl> $errSysNNewsNameIsEmpty </tpl>"},
			news_c_id: {required: "<tpl> $errSysNNewsClassIsEmpty </tpl>",min:"<tpl> $errSysNNewsClassIsEmpty </tpl>"},
			txtsort: {required: "<tpl> $errSysNNewsSortIsWrong </tpl>",number: "<tpl> $errSysNNewsSortIsWrong </tpl>",min: "<tpl> $errSysNNewsSortIsWrong </tpl>"},
			txtjumpurl: {url: "<tpl> $errSysNNewsJumpUrl </tpl>"}
		},
		submitHandler: function() {
			//将FCK值写入隐藏域
			var oEditor = FCKeditorAPI.GetInstance('content');
			$('#txtcontent').val(oEditor.GetXHTML(true));
			$('#form_add').ajaxSubmit(options);
		}
	});
	
	$("#return_list").click(function(){
		ST(0,0);
		ShowDiv	= 'result_content';
		getPageContent("news.manage.php?action=ajax_list");
	});
	
	//跳转到类别页面
	$('#yes').click(function() {
		$.unblockUI();
		ST(2,2);
		ShowDiv	= 'result_content';
		getPageContent("news.manage.php?action=ajax_class_list");
		return false;
	});
	$('#no').click($.unblockUI);
});

//显示添加类别层
function show_ajax_add_class(){
	$("#close_add_class").css("display","none");
	$("#open_add_class").css("display","");
}

//取消添加类别层
function cancell_ajax_add_class(){
	$("#close_add_class").css("display","");
	$("#open_add_class").css("display","none");
}

//添加类别动作
function ajax_add_class(){
	//去左右空格
	var str = $("#ajax_class_name").val();
	str = str.replace(/(\s*$)/g,  "");  
	str = str.replace(/(^\s*)/g,  "");  

	if(str.length <= 0){
		alert('<tpl> $errSysNClassIsEmpty </tpl>');
		return false;
	}else{
		add_class(str);
	}
}

//添加类别
function add_class(str){
	$.ajax({
		url: "news.manage.php",
		data: "action=save_class&return_sign=1&txttitle="+str,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			if(msg.type == '1'){
				//将新添加的分类，添加到下拉列表中，并且选中这个选项
				$("#news_c_id").append( "<option selected=\"selected\" value=\""+msg.message+"\">"+str+"</option>" );
				cancell_ajax_add_class();
			}else{//返回错误信息
				showMessage(msg.message,msg.type);
			}
		}
	});
	return false;
}
//跳转到类别列表
var question = $('#question')[0];
function JumpClass(){
	$.blockUI(question, { width: '275px' });
}
</script>