<form id="form1" name="form1" method="post" action="area.manage.php" style="margin-bottom:20px;">
<input type="hidden" name="action" value="mergerarea_save" />
<input type="hidden" name="del_id" id="del_id" value="<tpl> $area_id </tpl>" />
  <table class="from_table">
    <tr>
      <th class="th2"  align="right"><tpl> $langAreaMergerTo </tpl>：</th>
	  <td width="530" class="td1">
	  	<select name="txtArea" id="txtArea">
			<tpl> section name=loop loop=$sel_area </tpl>
			<option value="<tpl> $sel_area[loop][0] </tpl>"><tpl> $sel_area[loop][2] </tpl></option>
			<tpl> /section </tpl>
		</select>
	 </td>
    </tr>
    <tr>
      <td></td>
      <td width="530"><div class="btn_marginleft"><span class="btn_left"><input type="submit" name="Submit" class="btn_submit" value="<tpl> $langAreaMergerOperate </tpl>" /></span>
	  <span class="btn_left">
		<input id="butt_list" class="btn_submit" type="button" value="<tpl> $backAreaList </tpl>" />
		</span>
	  </div></td>
    </tr>
  </table>
</form>
<script>
$(document).ready(function() {
	//返回列表
	$("#butt_list").click(function(){
		ShowDiv = "result_content";
		getPageContent("area.manage.php?action=ajax_list");
	});
	//编辑
	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							showMessage(msg.message,msg.type);
							if(msg.type == 1){
								ST(0,0);
								ShowDiv = 'result_content';
								getPageContent('area.manage.php?action=ajax_list');
							}
						},
		type:      'post',
		dataType:  'json'
	};
	
	//对添加表单做的验证定义
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			txtAreaName: {required:true},
			txtAreaIntro: {required:true},
			txtAreaSort: {required:true,number:true}
		},
		messages: {
			txtAreaName: {required: "<tpl> $errEmptyAreaName </tpl>"},
			txtAreaIntro: {required: "<tpl> $errEmptyAreaIntro </tpl>"},
			txtAreaSort: {required:"<tpl> $errAreaSort </tpl>",number:"<tpl> $errAreaSortIsNum </tpl>"}
			
		},
		submitHandler: function() {
			if($('#txtArea').val() == $('#del_id').val()){
				alert('<tpl> $errAreaMergerIsSame </tpl>');
			}else{
				$('#form1').ajaxSubmit(options);
			}
		}
	});
});
</script>
