function changeSelect(){
	var roleId=$("#roleId option:selected").val(), html = "";
	if(roleId==null || roleId==0){
		$("input[type='checkbox']").prop("checked",false);//清空选中的值
		$(".checkbox").checkbox();
	}else{
	ajax({url:"getRoleForPermission.htm",data:{"roleId":roleId},callBack:function(res){
		if(res.code == 1){
			$("input[type='checkbox']").prop("checked",false);//清空选中的值
			$('.auth input').each(function(){
				var $this = $(this);
				$.each(res.list,function(index, item){
					if($this.val() == item.permissionId) $this.check();
				});
			});
			$(".checkbox").checkbox();
		}
	},load:false});
	}
}

function checkRolePermissionModfiy(){
	var permissionId;
	var data = $("#modfiyRolePermissionForm").serializeJSON();
	if(data.roleId==0){
		tips("请选择角色。");
		return false;
	}
	 $('input:checkbox[name=permissionId]:checked').each(function(i){
       if(0==i){
    	   permissionId = $(this).val();
       }else{
    	   permissionId += (","+$(this).val());
       }
	 });
	ajax("updateRolePermission.htm",{"permissionId":permissionId,"roleId":data.roleId},function(res){
		if(res.code == 1)
			alert({title:"更新权限提示",nav:res.msg,flag:1,next:function(){
				//$("#modfiyRolePermissionForm").clearForm(true);
			}});
		else
			tips(res.msg);
	});
	return false;
}
