<script type="text/javascript">
function checknode(obj) {
	var chk = $("input[type='checkbox']");
	var count = chk.length;
	var num = chk.index(obj);
	var level_top = level_bottom = chk.eq(num).attr('level');
	for (var i=num; i>=0; i--) {
		var le = chk.eq(i).attr('level');
		if(eval(le) < eval(level_top)) {
			chk.eq(i).attr("checked",true);
			var level_top = level_top-1;
		}
	}
	for (var j=num+1; j<count; j++) {
		var le = chk.eq(j).attr('level');
		if(chk.eq(num).attr("checked")==true) {
			if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",true);
			else if(eval(le) == eval(level_bottom)) break;
		} else {
			if(eval(le) > eval(level_bottom)) chk.eq(j).attr("checked",false);
			else if(eval(le) == eval(level_bottom)) break;
		}
	}
}
</script>
<form id="formAdd" method="post" action="?action=set">
<input type="hidden" name="dosubmit" value="1">
<input type="hidden" name="id" value="{?$id?}">
<table width="100%" class="grid">
	<tr>
	<th style='padding-left:30px;'><a href="#" onclick="javascript:$('input[name=node[]]').attr('checked', true)">全选</a> / <a href="#" onclick="javascript:$('input[name=node[]]').attr('checked', false)">取消</a></th>
	</tr>
	<tbody>
	{?$menus?}
	</tbody>
</table>
<div><input type="submit" name="submit" id="submit" class="button dodialog" value="提 交"/></div>
</form>
<script type="text/javascript">
$(function(){
	$("#formAdd").ajaxForm({
        dataType: "json",
        success : function(data){
			if(data.flag == 0){
				doTip(data.msg);
			}else{
				window.top.mainframe.location.reload();
				doDialogClose();
			}
        }
    });
})
</script>