<link id="calCss" type="text/css" href="<tpl> $site_url </tpl>/js/calendar/blue/blue.css" rel="Stylesheet" />
<script type="text/javascript" src="<tpl> $site_url </tpl>/js/calendar/Calendar.js"></script>
<form action="../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=save" method="post" enctype="multipart/form-data" name="form_add" id="form_add">
    <table class="from_table">
		<tr>
			<th class="th3"><tpl> $langSysCATitle </tpl>:</th>
			<td width="530" class="td1">
				<input type="text" maxlength="100" name="ca_title" id="ca_title" />
			</td>
		</tr>
		<tr>
			<th class="th3"><tpl> $langSysCAEndTime </tpl>:</th>
			<td width="530" class="td1"><input type="text" name="ca_end_time" id="ca_end_time" style="border:solid 1px #B0DF82;cursor:pointer; width:100px; background:url(<tpl> $site_url </tpl>/js/calendar/blue/cal_btn.gif) no-repeat right; height:18px; padding-right:19px;" readonly="readonly" /></td>
		</tr>
		<tr>
			<th class="th3"><tpl> $langSysCAContent </tpl>:</th>
			<td width="530" class="td1">
			<tpl> php </tpl>
			include("../../classes/resource/fckeditor/fckeditor.php") ;
			$oFCKeditor = new FCKeditor('content') ;
			$oFCKeditor->BasePath	= '../classes/resource/fckeditor/' ;
			$oFCKeditor->ToolbarSet = 'Simple';
			$oFCKeditor->Width	= 510 ;
			$oFCKeditor->Height	= 300 ;
			$oFCKeditor->Value	= '';
			$oFCKeditor->Create() ;
			<tpl> /php </tpl>
			<input type="hidden" name="ca_content" id="ca_content" />
			</td>
		</tr>
		<tr>
			<th class="th3"><tpl> $langSysCAGoods </tpl>:</th>
			<td width="530" class="td1">
				<table width="100%" border="0" cellpadding="0" cellspacing="0" rules="none" class="tables_table">
					<tr>
						<td><tpl> $langSysCAGoodsName </tpl></td>
						<td><tpl> $langSysCAGoodsNum </tpl></td>
						<td><tpl> $langSysCAGoodsCredits </tpl></td>
						<td><tpl> $langSysCAGoodsPic </tpl></td>
					</tr>
					<tbody id="act_pro">
						<tr>
							<td><input type='text' size='20' maxlength='100'  name='product_name[]' /></td>
							<td><input type='text' size='10' maxlength='6' name='product_num[]' /></td>
							<td><input type='text' size='10' maxlength='6' name='product_credits[]' /></td>
							<td><input type='file' name='product_pic_0' /></td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		<tr>
    		<td>
		  </td>
    	    <td width="530">
				<span class="btn_left"><input type="submit" class="btn_submit" value="<tpl> $langSysCASave </tpl>" /></span>
				<span class="btn_left"><input type="button" name="add_button" id="add_button" class="btn_submit" value="<tpl> $langSysCAGoodsAdd </tpl>" /></span>
				<span class="btn_left"><input type="button" name="return_button" id="return_button" class="btn_submit" value="<tpl> $langSysCAReturnList </tpl>" /></span>
			</td>
		</tr>
  </table>
</form>
<script>
$(document).ready(function() {
	//增加一列
	$('#add_button').click(function(e){
		var num = $('#act_pro').children('tr').length;
		$('#act_pro').append("<tr>" + 
			"<td><input type='text' size='20'  name='product_name[]' /></td>" + 
			"<td><input type='text' size='10' name='product_num[]' /></td>" + 
			"<td><input type='text' size='10' name='product_credits[]' /></td>" +
			"<td><input type='file' name='product_pic_"+num+"' /></td>"
			+"</tr>"
		);
	});
	
	$('#return_button').click(
		function(){
			ShowDiv	= 'result_content';
			getPageContent("../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=ajax_list&curpage=<tpl>$curpage</tpl>");
		}
	);
	
	//添加
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ShowDiv	= 'result_content';
								getPageContent("../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=ajax_list");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	//对添加表单做的验证定义
	$("#form_add").validate({
		errorClass: "wrong",
		rules: {
			ca_title:{required:true},
			ca_end_time:{required:true}
		},
		messages: {
			ca_title:{required:'<tpl> $errSysCATitleIsEmpty </tpl>'},
			ca_end_time:{required:'<tpl> $errSysCAEntTimeIsEmpty </tpl>'}
		},
		submitHandler: function() {
			var oEditor = FCKeditorAPI.GetInstance('content');
			$('#ca_content').val(oEditor.GetXHTML(true));
			$('#form_add').ajaxSubmit(options);
		}
	});
});
//时间
$(function(){
   $("#ca_end_time").datepicker();
})
</script>