<%@ Page Language="C#" Inherits="Caicai.Jingpin.UI.Common.Reg" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css.css" rel="stylesheet" type="text/css" />
<title>会员注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="style.css" rel="stylesheet" rev="stylesheet" media="all" />
<script type="text/javascript" src="../files/common/jquery.js"></script>
<script type="text/javascript">
$(function()
{
	$("#TB_UserName").blur(function()
	{
		if ($("#TB_UserName").val()!="")
		{
			$.ajax
			({
				url:"reg.aspx?random=" + Math.random(),
				data:"username=" + $("#TB_UserName").val(),
				dataType:"json",
				beforeSend:function(XMLHttpRequest)
				{
					$("#isreg").html("<img src='images/loading.gif' />");
				},
				success: function(msg) 
				{
					$("#isreg").html(msg[0].IsReg);

					if(msg[0].IsReg == "true")
					{
						$("#isregshow").html("用户名已经被其他人占用！");
					}
					else
					{
						$("#isregshow").html("");
					}
				}
			});
			return false;
		}
	})

	$("#ButtonReg").click(function()
	{
		if ($("#TB_UserName").val()=="")
		{
			alert("请填写登录用户名！");
			$("#TB_UserName").focus(); 
			return false;
		}
		if ($("#TB_PassWord").val()=="")
		{
			alert("请填写登录密码！");
			$("#TB_PassWord").focus(); 
			return false;
		}
		if ($("#TB_PassWord1").val()=="")
		{
			alert("请填写确认登录密码！");
			$("#TB_PassWord1").focus(); 
			return false;
		} 
		if($("#TB_PassWord").val() != $("#TB_PassWord1").val())
		{
			alert("两次输入密码不一样，请重新输入！");
			return false;
		}

		if ($("#TB_Name").val()=="")
		{
			alert("请填写真实姓名！");
			$("#TB_Name").focus(); 
			return false;
		} 
		if ($("#DDL_UserClass").val()=="0")
		{
			alert("请选择所在班级，如没有班级选择，请联系老师创建班级！");
			return false;
		} 

		if ($("#isreg").html()=="true")
		{
			alert("用户名已经被其他人占用,请重新输入用户名！");
			$("#TB_UserName").focus(); 
			return false;
		}

		//TB_Validate验证
		if ($("TB_Validate").value=='')
		{
			alert("请填写验证码！");
			$("TB_Validate").focus(); 
			return false;
		} 
		if ($("TB_Validate").value.length != 4)
		{
			alert("请认真填写验证码！");
			$("TB_Validate").focus(); 
			return false;
		}
		if ($("TB_Validate").value.search("^-?\\d+(\\.\\d+)?$")!=0)
		{
			alert("很抱歉，输入的验证码必须为数字！");
			$("TB_Validate").focus(); 
			return false;
		}
		return true;
	})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Panel ID="PanelReg" runat="server">
<table class="table">
<thead>
<tr>
    <td colspan="2" style="background:#f1f1f1;">会员注册(*号为必填项)</td>
</tr>
</thead>
<tr>
    <td style="background:#f1f1f1; width:100px; text-align:right;">登录用户名</td>
    <td><Cai:CTextBox runat="server" ID="TB_UserName" style="width:200px;" MaxLength="20" />&nbsp;* <span id="isreg" style="display:none"></span><span id="isregshow" style="color:red;"></span></td>
</tr>
<tr>
    <td style="background:#f1f1f1; width:100px; text-align:right;">登录密码</td>
    <td><Cai:CTextBox ID="TB_PassWord" runat="server" ControlType="Password" />&nbsp;*</td>
</tr>
<tr>
    <td style="background:#f1f1f1; width:100px; text-align:right;">确认登录密码</td>
    <td><input name="TB_PassWord1" type="password" id="TB_PassWord1" />&nbsp;*</td>
</tr>
<tr>
    <td style="background:#f1f1f1; height:10px; text-align:right;" colspan="2"></td>
</tr>
<tr>
    <td style="background:#f1f1f1; width:100px; text-align:right;">真实姓名</td>
    <td><Cai:CTextBox ID="TB_Name" runat="server" MaxLength="10" />&nbsp;*</td>
</tr>
<tr>
    <td style="background:#f1f1f1; text-align:right;">所在班级</td>
    <td><Cai:CDropDownList ID="DDL_UserClass" runat="server" ControlType="TableName" Name="C_UserClass" TextName="Name" ValueName="ID" Order="ordernum desc, id desc" />&nbsp;*<span>(如没有班级选择，请联系老师创建)</span></td>
</tr>
<tr>
	<td style="background:#f1f1f1; text-align:right;">邮箱</td>
    <td><Cai:CTextBox ID="TB_Email" runat="server" style="width:200px;" MaxLength="50" /></td>
</tr>
<tr>
    <td style="background:#f1f1f1; text-align:right;">性别</td>
    <td><Cai:CRadioButtonList ID="DDL_Sex" runat="server" ControlType="FileName" Name="files/appsettings/sex.xml" /></td>
</tr>
<tr>
	<td style="background:#f1f1f1; text-align:right;">电话</td>
    <td><Cai:CTextBox ID="TB_Tel" runat="server" MaxLength="30" /></td>
</tr>
<tr>
	<td style="background:#f1f1f1; text-align:right;">生日</td>
    <td><Cai:CTextBox ID="TB_BirthDate" runat="server" MaxLength="20" /></td>
</tr>
<tr>
    <td style="background:#f1f1f1; text-align:right;">籍贯</td>
    <td><Cai:CTextBox ID="TB_Origin" runat="server" MaxLength="10" /></td>
</tr>
<tr>
    <td style="background:#f1f1f1;text-align:right;">验证码</td>
    <td><asp:TextBox runat="server" ID="TB_Validate" style="width:50px" />&nbsp;<img src="Validate.aspx" alt="看不清？点击更换" onclick="this.src=this.src+'?'" style="cursor:pointer;border:1px solid #333; position:absolute" /></td>
</tr>
<tr>
    <td></td>
    <td><asp:Button ID="ButtonReg" runat="server" onclick="Reg_Click"  Text=" 注 册 " />&nbsp;<input type="reset" Text="　重　置　"></td>
</tr>
</table>
</asp:Panel>
</form>
</body>
</html>
