<form action="system_power.manage.php?action=save_group" method="post" id="form1" name="form1" >
<table border="0" cellpadding="0" cellspacing="0" class="from_table">
	<tr>
	  <th width="100"><tpl> $langSystemPGroupName </tpl></th>
	  <td width="250"><input name="sys_group_name" type="text" id="sys_group_name" maxlength="100" class="txtinput" /></td>
	  <td width="50%" ><label style="display:none" for="sys_group_name" class="wrong" metaDone="true" generated="true"></label></td>
	</tr>
	<tr>
	  <th width="100" align="center" valign="middle"><tpl> $langSystemPGroupArea </tpl></th>
		<td width="250">
			<input type="hidden" name="area_id" id="area_id" />
			<select id="area_c1" class="searchformselect" name="area_c1" style="width: 120px">
				<option valus="" selected></option>
				<tpl> foreach item = parent from = $area_array </tpl>
				<option value="<tpl>$parent.area_id</tpl>||<tpl>$parent.is_parent</tpl>"><tpl> $parent.area_name </tpl></option>
				<tpl> /foreach </tpl>
			</select>
			<select class="searchformselect" id="area_c2" style="width: 120px" name="area_c2">
			</select>
			<select class="searchformselect" id="area_c3" style="width: 120px" name="area_c3">
			</select>
			<select class="searchformselect" id="area_c4" style="width: 120px" name="area_c4">
			</select>
	  </td>
	  <td width="50%" class="vtop tips2"><tpl> $langSystemPThisGroupManageArea </tpl></td>
	</tr>
	<tpl> foreach item = menu from = $navers_all </tpl>
	<tr>
		<th colspan="3" align="left" style="text-align:left"><input <tpl> if $menu.power eq 'index' </tpl> checked="checked" <tpl> /if </tpl> name="sys_group_power[]" type="checkbox" value="<tpl> $menu.power </tpl>" /><tpl> $menu.name </tpl></th>
    </tr>
		<tpl> if $menu.body neq '' </tpl>
		<tr>
			<td colspan="3" align="left" style="padding-left:55px"><tpl> foreach item = menu_baby key=key from = $menu.body </tpl>
				<input name="sys_group_power[]"
						<tpl> if $menu_baby.power eq 'index~9999' </tpl> checked="checked" <tpl> /if </tpl>
				 type="checkbox" value="<tpl> $menu_baby.power </tpl>" /><tpl> $menu_baby.name </tpl>
		  <tpl> /foreach </tpl>	  </td>
		</tr>
		<tpl> /if </tpl>
	<tpl> /foreach </tpl>
	
</table>
<div class="table-5-bottom">
<div class="btn_marginleft_1">
	<span class="btn_left">
		<input name="selectall" type="button" id="selectall" class="btn_submit" value="<tpl> $langSystemPAllSelect </tpl>" /></span>
		
			<span class="btn_left">
		<input name="negative" type="button" id="negative" class="btn_submit" value="<tpl> $langSystemPContrarySelect </tpl>" /></span>
			<span class="btn_left">
		<input name="submit" type="submit" value="<tpl> $langSystemPSave </tpl>" class="btn_submit"/>
		</span>
			<span class="btn_left">
		<input id="butt_addpower" class="btn_submit" name="butt_addpower" type="button" value="<tpl> $langSystemPReturnList </tpl>" onclick="location.href='system_power.manage.php?action=list_group'">
		</span>
		</div></div>
</form>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
	//地区选择
	tonext_area('#area_c1');
	
	$('#negative').click(
		function(){
			$('#form1 input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
	);
	$('#selectall').click(
		function(){
			$('#form1 input[@type=checkbox]').each(function(){
				$(this).attr('checked',true)
			})
		}
	);
	
	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('system_power.manage.php?action=ajax_group');
			}
		},
		type:      'post',
		dataType:  'json'

	};

	//表单验证
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			sys_group_name: {required:true}
		},
		messages: {
			sys_group_name: {required: "<tpl> $langSystemPFillInGroupName </tpl>"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>