<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Register.aspx.cs" Inherits="JuSNS.Web.Register" %>

<!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>
<meta http-equiv="Content-Type" content="text/html;" />
<title id="ptitle" runat="server">注册 </title>
<meta name="keywords" content="交友,社交,博客,<% Response.Write(JuSNS.Config.UiConfig.SiteName); %> SNS,日志,心情,社会化网络" />
<meta name="description" content="<% Response.Write(JuSNS.Config.UiConfig.SiteName); %>是一个社交网络交友系统，通过她您可以结交更多的朋友！" />
<script language="javascript" type="text/javascript" src="js/ajax.js"></script>
<script language="javascript" type="text/javascript" src="js/public.js"></script>
<link href="template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/base.css" id="skinpath" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript">
<!--
var arryprv = new Array(<%= cityarray%>);
function ChangeProv(obj) 
{
    var objcity = document.getElementById('SlctCity');
    var s = obj.options[obj.selectedIndex].value;
    objcity.options.length = 0;
    if( s == '0')
    {
        objcity.style.display = 'none';
        document.getElementById('err_addr').style.display = '';
        return;
    }
    else
    {
        document.getElementById('err_addr').style.display = 'none';
    }
    objcity.style.display = '';
    var optn = document.createElement('option');
    optn.value = '0';
    optn.innerHTML = ' ';
    objcity.appendChild(optn);
    for(var i=0;i<arryprv.length;i++)
    {
        var arr = arryprv[i];
        if(arr[0] == s)
        {
            var opt = document.createElement('option');
            opt.value = arr[1];
            opt.innerHTML = arr[2];
            objcity.appendChild(opt);
        }
    }
}
//检查email
function checkemail()
{
    var obj = document.getElementById('TxtEmail');
    var s = obj.value.trim();
    
    if(s == '' || !s.IsEmail())
    {
        document.getElementById('err_mail').style.display = '';
        document.getElementById('hnt_mail').style.display = 'none';
        return false;
    }
    else
    {
        document.getElementById('err_mail').style.display = 'none';
        document.getElementById('hnt_mail').style.display = '';
        return true;
    }    
}
//检查姓名
function checkname()
{
    var obj = document.getElementById('TxtName');
    var s = obj.value.trim();
    obj.value = s.replace(/\|/g,'');
    if(s == '')
    {
        document.getElementById('hnt_name').style.color = 'red';
        return false;
    }
    else
    {
        document.getElementById('hnt_name').style.color = '#666';
        return true;
    }    
}

function checksex()
{
    var obj =document.getElementById("Txtgender");
    var s = obj.value.trim();
   if(s=='')
   {
        document.getElementById('error_sex').style.display = '';
        return false;
   }  
   else
   {
        document.getElementById('error_sex').style.display = 'none';
        return true;
   }
}

function checkpwd()
{
    var obj = document.getElementById('TxtPassword');
    var s = obj.value.trim();
    if(s.length < 4)
    {
        document.getElementById('hnt_pwd').style.color = 'red';
        return false;
    }
    else
    {
        document.getElementById('hnt_pwd').style.color = '#666';
        return true;
    }
}
function checkvrf()
{
    var s1 = document.getElementById('TxtPassword').value;
    var s2 = document.getElementById('TxtVerifyPass').value;
    if(s1 != s2)
    {
        document.getElementById('err_vrf').style.display = '';
        return false;
    }
    else
    {
        document.getElementById('err_vrf').style.display = 'none';
        return true;
    }
}
function checkconfer(obj)
{
    var btn = document.getElementById('btnok');
    if(obj.checked)
       btn.disabled = false;
    else
       btn.disabled = true;
}
function checkform()
{    
    if(!(checkemail() && checkname() && checkvrf()&&checkpwd()))
    {
        return false;
    }
   
    var sexobj = document.getElementById('Slctgender');
    var sx = sexobj.options[sexobj.selectedIndex].value;
    if(sx=='')
    {
        document.getElementById('error_sex').style.display = '';
        sexobj.focus();
        return false;
    }  
    else
    {
        document.getElementById('error_sex').style.display = 'none';
    }
    
    var obj = document.getElementById('SlctProvince');
    var s = obj.options[obj.selectedIndex].value;
    if(s == '0')
    {
        document.getElementById('err_addr').style.display = '';
        obj.focus();
        return false;
    }
    else
    {
        document.getElementById('err_addr').style.display = 'none';
    }
   
   
    
    return true;
}
//-->
</script>
</head>
<body>
<!--头部-->
<%=this.GetHtmlShort()%>
<div id="divhead">
    <%=this.GetHtmlHead()%>
</div>

<div id="divbody">
    <div id="body_first">
        <div class="body_menu"> 
        <%=this.GetHtmlLeft()%>
        </div>
    </div>
    <div id="body_sec">
            <div id="body_mid"> 
                <div class="body_frame"> 
                    <div class="body_sec_all"> 
                    <div class="spline"></div>
                    <%if (error != string.Empty)
                      {%>
                    <div class="msg-error">
                        <%# error%>
                    </div>
                    <%} if (succeed != 1 && succeed!=2)
                      {%>
                    <div class="content padding10">
                        <div class="bold pstr font14">注册并开始使用<% Response.Write(JuSNS.Config.UiConfig.SiteName); %></div>
                        <div>
                        加入<% Response.Write(JuSNS.Config.UiConfig.SiteName); %>联络朋友、分享照片、创建您的个人主页或玩在线游戏！。 首先，请填写下面的表格</div>
                        <div>以下项目必须填写才能注册</div>
                        <div class="line"></div>
                        <form method="post" action="Register.aspx" class="nf lf" name="formreg" id="formreg">
                            <p class="content">
                                <label class="f-label" for="email_reg">电子邮件<%=isRegMobile%></label>
                                <input type="text" id="TxtEmail" name="TxtEmail" onblur="return checkemail();" class="f-text reshow s20" value="" /> <a href="help?r=RecEmail" target="_blank">推荐使用的电子邮件</a>
                            </p>
                           <p class="content">
                                <label class="f-label">&nbsp;</label>
                                <span class="reshow" id="err_mail" style="display: none;">请输入有效的电子邮件</span><span id="hnt_mail">用来登录<%# JuSNS.Config.UiConfig.SiteName %>，不会对外公开。请准确填入您的邮箱，在忘记密码，或者您使用邮件通知功能时，会发送邮件到该邮箱。</span>
                           </p> 
                            <p class="content">
                                <label class="f-label" for="realname">
                                    姓名</label>
                                <input type="text" id="TxtName" name="TxtName" onblur="checkname();" class="f-text s20"
                                    value="" maxlength="12" />
                            </p>
                           <p class="content">
                                <label class="f-label">&nbsp;</label>
                                <span id="hnt_name">请输入真实姓名。</span>
                           </p> 
                           
                            <p class="content">
                                <label class="f-label" for="TxtPassword">
                                    密码</label>
                                <input type="password" name="TxtPassword" onblur="checkpwd();" id="TxtPassword" class="f-text s20"
                                    maxlength="32" />
                            </p>
                           <p class="content">
                                <label class="f-label">&nbsp;</label>
                                <span id="hnt_pwd">请输入最少 4 个字符。</span>
                           </p> 
                            <p class="content">
                                <label class="f-label" for="verifypass">
                                    重复密码</label>
                                <input type="password" name="TxtVerifyPass" onblur="checkvrf();" id="TxtVerifyPass"
                                    class="f-text s20" maxlength="32" />
                            </p>
                           <p class="content" id="err_vrf" style="display: none;">
                                <label class="f-label">&nbsp;</label>
                                <span class="reshow">两次密码不一致。</span>
                           </p> 
                           <p class="content" style="display:block;">
                             <label class="f-label" for="gender">
                                    性别</label>
                                    <select name="Slctgender" id="Slctgender">
	                                <option selected="selected" value="">选择性别...</option>
	                                <option value="1">男</option>
	                                <option value="0">女</option>
                                    </select>
                           </p> 
                           <p class="content"  id="error_sex" style="display: none;">
                                <label class="f-label">&nbsp;</label>
                                    <span class="reshow">请选择性别</span>
                           </p> 
                           
                            <p class="content">
                                <label class="f-label" for="province">
                                    目前居住地</label>
                                <select name="SlctProvince" id="SlctProvince" onchange="ChangeProv(this);">
                                    <option value="0" selected="selected"></option>
                                    <%# province%>
                                </select>
                                <select name="SlctCity" id="SlctCity" style="display: none;">
                                </select>
                            </p>
                           <p class="content" id="err_addr" style="display: none;">
                                <label class="f-label">&nbsp;</label>
                                <span  class="reshow">请选择目前你所居住地。</span>
                           </p> 
                            
                            <p  class="pstr">
                                 <label class="f-label" for="verifypass">
                                    &nbsp;</label> 
                                <input type="submit" id="Registerbtnok" onclick="return checkform();" class="f-button" value="确认注册"
                                    name="reg" /> <span style="display: none;" id="p_sending" class="showSumbitflow">正在发送，请稍候……</span>
                            </p>
                            <p class="pstr">
                                <label class="f-check" for="agreement">
                                    <input type="checkbox" id="agreement" onclick="checkconfer(this);" onchange="checkconfer(this);"
                                        checked="checked" value="on" name="agreement" />
                                    我已阅读并无条件接受
                                </label>
                                <a href="help/?r=prot" target="_blank">《<% Response.Write(JuSNS.Config.UiConfig.SiteName); %>使用协议》</a>
                            </p>
                            <input type="hidden" name="Register" id="city" value="Submit" />
                        </form>
                    </div>
                    <%}
                      else if(succeed==1)
                      { 
                    %>
                    <div class="content">
                        <div class="bold pstr font14 reshow">验证你的 Email 地址</div>
                        <div class="pstr">
                            谢谢你的注册！我们给你发送了一封验证邮件到 <strong class="reshow"><%# email%></strong>，请查收该邮件完成注册。
                         </div>
                        <div class="pstr font14">
                            <button class="f-button" onclick="window.open('<%# JuSNS.Config.EmailConfig.GetEmailLoginUrl(email)%>')">点击这里登录你的邮箱</button></div>
                        <div class="pstr">
                             <div>注意看看是否在垃圾箱里。 </div>
                            <div class="reshow">如果确实没有收到验证邮件。请用你的注册邮箱给 <%= JuSNS.Config.UiConfig.gEmail%> 发一封标题为“验证邮件”的邮件，管理员将协助你激活帐号。</div>
                        </div>
                    </div>
                    <%}
                      else if (succeed == 2)
                      {%>
                    <div class="content">
                        <div class="bold pstr font14 reshow">您已注册成功！但未验证您的电子邮件。</div>
                        <div class="spline"></div>    
                        <div class="pstr bold">
                            您现在可以：
                        </div>
                        <div class="pstr">&bull; <a href="index.aspx">登录系统</a></div>
                        <div class="pstr">&bull; <a href="EmailActive.aspx?email=<%# email%>">验证您的电子邮件</a></div>
           
                        <div class="spline"></div>    
                        </div>
                    <%} %>
                    </div>
            </div>
            
            <!--底部-->
             <div class="divbottom">
              <%=this.GetHtmlFoot() %>
              </div>        
              </div>
        </div>
</div>
</body>
</html>
