{*<?php exit();?>*}
<div class="block">
	<div class="head"><span>添加管理员帐号</span></div>
	<div class="main">
	<form id="form_add_admin" method="post" action="{url channel=$global.channel}">
			<input name="cmd" type="hidden" value="add_admin" />
			<table class="table">
				<tr>
					<td>用户名：</td>
					<td><input class="text" name="v_username" type="text" /></td>
				</tr>
				<tr>
					<td>密码：</td>
					<td><input class="text" name="v_password" type="password" /></td>
				</tr>
				<tr>
					<td>重复密码：</td>
					<td><input class="text" name="r_password" type="password" /></td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="bt_row">
							<input class="button" type="button" onclick="check_add_admin()" value="提交" />
						</div>
					</td>
				</tr>
			</table>
	</form>
	</div>
</div>
{literal}
<script language="javascript">
	function check_add_admin()
	{
		var obj = document.getElementById("form_add_admin");
		var str = "";
		if(obj.v_username.value.length < 5)
		{
			str = "用户名长度不能小于5个字符";
		}else if(obj.v_password.value.length < 5){
			str = "密码长度不能小于5个字符";
		}else if(obj.v_password.value != obj.r_password.value){
			str = "两次输入密码不一致";
		}
		ajax("post","?/site/","cmd=check_admin_name&name=" + obj.v_username.value,
		function(data)
		{
			if(data == 1)
			{
				str = "对不起，用户名已存在";
			}
			if(str != "")
			{
				alert(str);
			}else{
				obj.submit();
			}
		});
	}
</script>
{/literal}
