<%@ Register TagPrefix="uc2" TagName="bottom" Src="template/bottom.ascx" %>
<%@ Register TagPrefix="uc1" TagName="top" Src="template/top.ascx" %>
<%@ Page CodeBehind="Reg.aspx.cs" Language="c#" AutoEventWireup="True" Inherits="Typhoto.Reg" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
		<title> <%=title%>  用户注册</title>
		<link href="template/img/style.css" rel="stylesheet" type="text/css">
			<style type="text/css">
.style5 { COLOR: #ff0000 }
</style>
			<script type="text/javascript" language="javascript" src="js/dialog.js"></script>
			<script language="javascript">
function getRbGroupValue(rbGroup)
{
	var objs=document.getElementsByName(rbGroup);
	for(var i=0;i<objs.length;i++)
	{
		if(objs[i].checked)	return objs[i].value;
	}
	return "";
}
function RegUser()
{
	var sub;
	try
	{
		if (Page_ClientValidate()) sub=true;else sub=false;
	}
	catch(e)
	{
		sub=true;
	}
	if (sub)
	{
		Init();
		try{
			Typhoto.Reg.RegUser(document.all.username.value,document.all.Password1.value,document.all.uquestion.value,document.all.uanswer.value,document.all.email.value,getRbGroupValue('sex'),document.all.url.value,document.all.qq.value,document.all.msn.value,document.all.recommend.value,document.all.ValidateCode.value,document.all.curr.value,IsRegUser_callback);
		}
		catch(e){
			alert('IIS缺少默认的ashx扩展名支持！无法启用ajax，请在网站属性->目录->配置里，添加.ashx的扩展名，路径要设定到c:\\windows\\microsoft.net\\framework\\v1.1.4322\\aspnet_isapi.dll，若为.net2.0版本，中间的版本号要改为v2.0.50727，添加时一定要把\“确认文件是否存在\”的对勾去掉!');
		}
	}
}
function IsRegUser_callback(res)
{
	document.all.loading.style.display='none';
	var bRet = res.value;
	if (bRet == "0")
	{
		var d = new dialog();d.init();
		d.set('src','Images/dlgico_right.gif');
		d.set('title','系统提示信息');
		d.event('注册成功！', 'window.location="default.aspx";','','');	
	}
	else if (bRet.charAt(0) == "1")
	{
		var d = new dialog();d.init();
		d.set('src','Images/dlgico_excal.gif');
		d.set('title','系统提示信息');
		d.event(bRet.substr(1), 'window.location="Default.aspx";','','');
	}
	else
	{
		var d = new dialog();d.init();
		d.set('src','Images/dlgico_excal.gif');
		d.set('title','系统提示信息');
		d.event(bRet, 'document.all.dialogBox.style.display=\'none\'','','');
	}
}
function VerifyUsername(name)
{
	Typhoto.Reg.check(name, IsUsernameExist_callback);
}
function IsUsernameExist_callback(res)
{
	var msg = document.getElementById('chkinfo');
	var bRet = res.value;
	
	if (bRet == "") msg.style.display='none';
	else
	{
		msg.style.display='';
		msg.innerHTML = res.value;
		msg.style.color = 'red';	
	}
}
function Init()
{
	document.all.loading.style.top =  (window.screen.height-40)/2-80;
	document.all.loading.style.left = (window.screen.width-182)/2;
	document.all.loading.style.display='';
}
			</script>
</HEAD>
	<body>
		<form runat="server">
			<table width="760" border="0" align="center">
              <tr>
                <td>
				<div id="loading" style=" BORDER-RIGHT:#dbdce3 1px solid; BORDER-TOP:#dbdce3 1px solid; DISPLAY:none; BORDER-LEFT:#dbdce3 1px solid; WIDTH:180px; BORDER-BOTTOM:#dbdce3 1px solid; POSITION:absolute; BACKGROUND-COLOR:#ffffae"><img src="images/loading.gif" width="32" height="32" align="absMiddle">
					<b>正在处理，请稍候……</b></div>
				<uc1:top id="index1" runat="server"></uc1:top>
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="step1"
					runat="server">
					<tbody>
						<tr>
							<td class="body_range_3"><div class="title"><img src="images/icon_1_2.gif" width="12" height="15" align="absMiddle">
									新用户注册协议
								</div>
								<div class="body">
									<div align="center">&nbsp; <textarea class="kuan" id="agreement" name="agreement" rows="10" cols="100" runat="server"></textarea>
									</div>
								</div>
							</td>
						</tr>
						<tr>
							<td class="body_range_3"><div align="center">
									<input class="btn" id="Submit2" type="button" value="我同意" name="submit2" onClick="javascript:document.all.step1.style.display='none';document.all.step2.style.display='';">
									&nbsp;&nbsp;&nbsp;&nbsp; <input class="btn" id="Submit3" type="button" value="不同意" name="submit3" onClick="javascript:history.go(-1);">
								</div>
							</td>
						</tr>
					</tbody>
				</table>
				<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" id="step2"
					runat="server">
					<tbody>
						<tr>
							<td class="body_range_3"><div class="title"><img src="images/icon_1_2.gif" width="12" height="15" align="absMiddle">
									新用户注册
								</div>
								<div class="body">
									<table cellspacing="7" cellpadding="3" width="100%" align="center" border="0">
										<tbody>
											<tr>
												<td id="tdMessage" align="center" colspan="2"></td>
											</tr>
											
											<tr>
												<td width="116"><div align="right">用户名：</div>												</td>
												<td width="631"><input name="username" class="kuan" id="username" onBlur="VerifyUsername(this.value);"
														size="30" runat="server">
													<span class="style5">
                              *
                              <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="请输入用户名" ControlToValidate="username"
															Display="Dynamic"></asp:RequiredFieldValidator>
                              <asp:regularexpressionvalidator id="Regularexpressionvalidator1" runat="server" ErrorMessage="用户名必须为数字或英文字母" ControlToValidate="username"
															Display="Dynamic" ValidationExpression="^[\w_]+$">用户名必须为数字或英文字母</asp:regularexpressionvalidator>
                              <asp:regularexpressionvalidator id="Regularexpressionvalidator2" runat="server" ErrorMessage="" ControlToValidate="username"
															Display="Dynamic" ValidationExpression="^[\w_]+$"></asp:regularexpressionvalidator></span><DIV id="chkinfo"></DIV>												</td>
											</tr>
											<tr>
												<td><div align="right">密码：</div>												</td>
												<td class="td_input_1"><input class="kuan" id="Password1" type="password" size="30" name="Password1" runat="server">
													<span class="style5">
                              *
                              <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="请输入密码" ControlToValidate="Password1"
															Display="Dynamic"></asp:RequiredFieldValidator>
                              <asp:regularexpressionvalidator id="Regularexpressionvalidator4" runat="server" ErrorMessage="" ControlToValidate="Password1"
															Display="Dynamic" ValidationExpression="^[\w_]+$"></asp:regularexpressionvalidator>
                              </span></td>
											</tr>
											<tr>
												<td><div align="right">确认密码：</div>												</td>
												<td><input class="kuan" id="Password2" type="password" size="30" name="Password2" runat="server">
													<span class="style5">
                              *
                              <asp:RequiredFieldValidator id="RequiredFieldValidator4" runat="server" ErrorMessage="请再次输入密码" ControlToValidate="Password2"
															Display="Dynamic"></asp:RequiredFieldValidator>
                              <asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="两次输入密码不一致" ControlToValidate="Password2"
															Display="Dynamic" ControlToCompare="Password1">两次输入密码不一致</asp:CompareValidator>
                              </span></td>
											</tr>
											<tr>
												<td><div align="right">密码问题：</div>												</td>
												<td><input name="uquestion" class="kuan" id="uquestion" size="30" runat="server">
													<span class="style5">
                              *
                              <asp:RequiredFieldValidator id="RequiredFieldValidator5" runat="server" ErrorMessage="请输入提示问题" ControlToValidate="uquestion"></asp:RequiredFieldValidator>
                              </span></td>
											</tr>
											<tr>
												<td><div align="right">密码答案：</div>												</td>
												<td><input name="uanswer" class="kuan" id="uanswer" size="30" runat="server">
													<span class="style5">
                              *
                              <asp:RequiredFieldValidator id="RequiredFieldValidator6" runat="server" ErrorMessage="请输入提示答案" ControlToValidate="uanswer"
															Display="Dynamic"></asp:RequiredFieldValidator>
                              <asp:CompareValidator id="CompareValidator2" runat="server" ErrorMessage="提示问题和答案不能相同" ControlToValidate="uanswer"
															Display="Dynamic" ControlToCompare="uquestion" Operator="NotEqual">提示问题和答案不能相同</asp:CompareValidator>
                              </span></td>
											</tr>
											<tr>
												<td><div align="right">性别：</div>												</td>
												<td><input type="radio" checked value="男" name="sex"> 男 <input type="radio" value="女" name="sex">
													女</td>
											</tr>
											<tr>
												<td><div align="right">邮箱：</div>												</td>
												<td><input name="email" class="kuan" id="email" size="30" runat="server">
													<span class="style5">
                              *
                              <asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="请输入邮件地址" ControlToValidate="email"
															Display="Dynamic"></asp:RequiredFieldValidator>
                              <asp:RegularExpressionValidator id="RegularExpressionValidator3" runat="server" ErrorMessage="错误的电子邮件地址" ControlToValidate="email"
															Display="Dynamic" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                              </span></td>
											</tr>
											<tr>
												<td><div align="right">主 页：</div>												</td>
												<td><input name="url" class="kuan" id="url" size="30"></td>
											</tr>
											<tr>
												<td><div align="right">QQ：</div>												</td>
												<td><input name="qq" class="kuan" id="qq" size="30"></td>
											</tr>
											<tr>
												<td><div align="right">MSN：</div>												</td>
												<td><input name="msn" class="kuan" id="msn" size="30"></td>
											</tr>
											<tr>
												<td><div align="right"><font face="宋体">简介：</font></div>												</td>
												<td><textarea class="kuan" id="recommend" name="recommend" rows="5" cols="50"></textarea></td>
											</tr>
											
											<tr id="vcode" runat="server">
												<td>
													<div align="right">验证码：</div>												</td>
												<td><input class="kuan" id="ValidateCode" maxlength="25" size="10" name="ValidateCode" runat="server">
													<img src="ValidateCode.aspx"></td>
											</tr>
											<tr>
												<td>&nbsp;</td>
												<td><input class="btn" id="Submit1" type="button" value="现在注册" name="submit1" onClick="RegUser();"></td>
											</tr>
										</tbody>
									</table></div>
						  </td>
						</tr>
					</tbody>
				</table>
				<br><INPUT id=curr type=hidden size=6 name=curr runat="server">
				<uc2:bottom id="index2" runat="server"></uc2:bottom></td>
              </tr>
            </table>
<DIV></DIV>
		</form>
	</body>
</HTML>
