<form action="system_power.manage.php?action=update_group" method="post" id="form1" name="form1" >
<table border="0" cellpadding="0" cellspacing="0" class="from_table">
	<tr>
	  <th width="100" height="19"><tpl> $langSystemPGroupName </tpl></th>
	  <td width="250"><input name="sys_group_name" type="text" id="sys_group_name" maxlength="100" value="<tpl> $group_array.sys_group_name </tpl>"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"><tpl> $langSystemPGroupArea </tpl></th>
		<td width="250">
		<input type="hidden" name="area_id" id="area_id" value="<tpl> $group_array.sys_group_area_id </tpl>" />
			<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 <tpl> if $sel_area[0].area_id eq $parent.area_id </tpl>selected="selected"<tpl> /if  </tpl> 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">
				<option valus="<tpl> $sel_area[1].area_id </tpl>" selected><tpl> $sel_area[1].area_name </tpl></option>
			</select>
			<select class="searchformselect" id="area_c3" style="width: 120px" name="area_c3">
				<option valus="<tpl> $sel_area[2].area_id </tpl>" selected><tpl> $sel_area[2].area_name </tpl></option>
			</select>
			<select class="searchformselect" id="area_c4" style="width: 120px" name="area_c4">
				<option valus="<tpl> $sel_area[3].area_id </tpl>" selected><tpl> $sel_area[3].area_name </tpl></option>
			</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> foreach item = group_power key=key from = $group_array.sys_group_power </tpl>
					<tpl> if $group_power eq $menu.power </tpl> checked="checked" <tpl> /if </tpl>
				<tpl> /foreach </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"">&nbsp;
		<tpl> foreach item = menu_baby key=key from = $menu.body </tpl>
			<input name="sys_group_power[]"
				<tpl> foreach item = group_power key=key from = $group_array.sys_group_power </tpl>
					<tpl> if $group_power eq $menu_baby.power </tpl> checked="checked" <tpl> /if </tpl>
				<tpl> /foreach </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 class="btn_submit" name="selectall" type="button" id="selectall" value="<tpl> $langSystemPAllSelect </tpl>" />
		  </span>
			<span class="btn_left">
			<input class="btn_submit" name="negative" type="button" id="negative" value="<tpl> $langSystemPContrarySelect </tpl>" /></span>
			<span class="btn_left">
			<input class="btn_submit" name="submit" type="submit" value="<tpl> $langSystemPSubmit </tpl>" />
			</span>
			<span class="btn_left"><input class="btn_submit" id="butt_addpower" name="butt_addpower" type="button" value="<tpl> $langSystemPReturnList </tpl>" onclick="location.href='system_power.manage.php?action=list_group&curpage=<tpl> $curpage </tpl>'"></span>
		  <input type="hidden" name="sys_group_id" value="<tpl> $group_array.sys_group_id </tpl>" />
		  </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){
				ShowDiv = 'result_content';
				getPageContent('system_power.manage.php?action=ajax_group&curpage=<tpl> $curpage </tpl>');
			}
		},
		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>