var _menus = {
	"menus" : [ {
		"menuid" : "1",
		"icon" : "icon-sys",
		"menuname" : "系统管理",
		"menus" : [ {
			"menuid" : "11",
			"menuname" : "机构管理",
			"icon" : "icon-set",
			"url" : "/admin/org/goinOrgListPage"
		}, {
			"menuid" : "12",
			"menuname" : "用户管理",
			"icon" : "icon-users",
			"url" : "/admin/user/queryAllUser"
		}, {
			"menuid" : "13",
			"menuname" : "角色管理",
			"icon" : "icon-role",
			"url" : "/admin/role/goinRoleListPage"
		}, {
			"menuid" : "14",
			"menuname" : "权限管理",
			"icon" : "icon-role",
			"url" : "/admin/privilegeManage/goinPriListPage"
		}, {
			"menuid" : "15",
			"menuname" : "角色权限分配",
			"icon" : "icon-role",
			"url" : "/admin/privilegeManage/goRolePriListPage"
		}, {
			"menuid" : "16",
			"menuname" : "数据字典管理", 
			"icon" : "icon-database",
			"url" : "/admin/metadataManage/goinMetadataListPage" 
		} ]
	}, { 
		"menuid" : "8",
		"icon" : "icon-sys",
		"menuname" : "业务管理",
		"menus" : [ {
			"menuid" : "21",
			"menuname" : "新闻管理(<font style=\"color:red;font-weight:bold\">中</font>)",
			"icon" : "icon-nav",
			"url" : "/admin/newsManage/goinNewsListPage"
		}, {
			"menuid" : "22",
			"menuname" : "新闻管理(<font style=\"color:green;font-weight:bold\">英</font>)",
			"icon" : "icon-nav",
			"url" : "/admin/newsManage/goinNewsListPage_en"
		}, {
			"menuid" : "23",
			"menuname" : "议题工作组(<font style=\"color:red;font-weight:bold\">中</font>)",
			"icon" : "icon-nav",
			"url" : "/admin/topicTeamManage/goinTopicWorkTeamListPage"
		}, {
			"menuid" : "24",
			"menuname" : "议题工作组(<font style=\"color:green;font-weight:bold\">英</font>)",
			"icon" : "icon-nav",
			"url" : "/admin/topicTeamManage/goinTopicWorkTeamListPage_en"
		}, {
			"menuid" : "25",
			"menuname" : "议题内容(<font style=\"color:red;font-weight:bold\">中</font>)",
			"icon" : "icon-nav",
			"url" : "/admin/topicTeamManage/goinTopicWorkListPage"
		}, {
			"menuid" : "26",
			"menuname" : "议题内容(<font style=\"color:green;font-weight:bold\">英</font>)",
			"icon" : "icon-nav",
			"url" : "/admin/topicTeamManage/goinTopicWorkListPage_en"
		}, {
			"menuid" : "27",
			"menuname" : "链接管理",
			"icon" : "icon-nav",
			"url" : "/admin/linkManage/goinLinkInfoListPage"
		} ]
	}, {
		"menuid" : "56",
		"icon" : "icon-sys",
		"menuname" : "日志管理",
		"menus" : [ {
			"menuid" : "31",
			"menuname" : "统计日志",
			"icon" : "icon-nav",
			"url" : "/admin/logManage/goinLogInfoListPage"
		} ]
	}]
};
// 设置登录窗口
function openPwd() {
	$('#w').window({
		title : '修改密码',
		width : 400,
		height : 200,
		modal : true,
		shadow : true,
		closed : true, 
		collapsible : false, // 是否显示折叠按钮
		minimizable : false, // 是否显示最小化按钮
		maximizable : false, // 是否显示最大化按钮
		resizable : false
	});
}
// 关闭登录窗口
function closePwd() {
	$('#w').window('close');
}

// 修改密码
function serverLogin() {
	var $newpass = $('#txtNewPass');
	var $rePass = $('#txtRePass');

	if ($newpass.val() == '') {
		msgShow('系统提示', '请输入密码！', 'warning');
		return false;
	}
	if ($rePass.val() == '') {
		msgShow('系统提示', '请在一次输入密码！', 'warning');
		return false;
	}

	if ($newpass.val() != $rePass.val()) {
		msgShow('系统提示', '两次密码不一至！请重新输入', 'warning');
		return false;
	}

	$.post('/admin/user/changePass/' + $newpass.val(), function(msg) {
		msgShow('系统提示', '恭喜，密码修改成功！<br>您的新密码为：' + $newpass.val(), 'info');
		$newpass.val('');
		$rePass.val('');
		$("#w").window('close');
	})

}

$(function() {
	openPwd();

	$('#editpass').click(function() {
		$('#w').window('open');
	});

	$('#btnEp').click(function() {
		serverLogin();
	})

	$('#btnCancel').click(function() {
		closePwd();
	})

	$('#loginOut').click(function() {
		$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function(r) {
			if (r) {
				location.href = '/admin/logout';
			}
		});
	})
});