<%template _header%>
<!--TheCurrent start-->
<div id="foruminfo">
	<div class="userinfo">
		<h2><a href="{config.forumurl}">{config.forumtitle}</a> <strong>用户注册</strong></h2>
	</div>
</div>
<!--TheCurrent end-->

<!--reg start-->
<%if {agree}==""%>
	<%if page_err==0%>
		<%if {config.rules}==1%>
			<form id="form1" name="form1" method="post" action="?agree=1">
			<div class="ntforumbox">
				<div class="titlebar">
					<h3>用户注册协议</h3>
				</div>
				<table cellpadding="0" cellspacing="0" border="0">
					<tbody>
					<tr class="list">
						<td>
						<textarea name="textarea" cols="" rows="" readonly="readonly" class="colorblue" style="width:700px;height:320px;margin:10px 0;">{config.rulestxt}</textarea>
						</td>
					</tr>
					</tbody>
					<tbody>
					<tr class="list">
						<td  style="padding:2px;">
					  <input name="agree" disabled="disabled" type="submit" id="agree" value="我同意" class="sbutton" />
					  &nbsp;&nbsp;
					  <input name="cancel" type="button" id="cancel" value="不同意" onClick="javascript:location.replace('index.aspx')" class="sbutton" />
					  
						<script type="text/javascript">
						var secs = 5;
						var wait = secs * 1000;
						document.getElementById("agree").value = "同 意(" + secs + ")";
						document.getElementById("agree").disabled = true;
						for(i = 1; i <= secs; i++) {
								window.setTimeout("update(" + i + ")", i * 1000);
						}
						window.setTimeout("timer()", wait);
						function update(num, value) {
								if(num == (wait/1000)) {
										document.getElementById("agree").value = "同 意";
								} else {
										printnr = (wait / 1000) - num;
										document.getElementById("agree").value = "同 意(" + printnr + ")";
								}
						}
						function timer() {
								document.getElementById("agree").disabled = false;
								document.getElementById("agree").value = "同 意";
						}
						</script>
						 </td>
					 </tr>
					 </tbody>
					 </table>
			</div>
				</form>
		<%template _copyright%>
		<%else%>
		<script type="text/javascript">
		location.replace('register.aspx?agree=yes')
		</script>
		<%/if%>
	<%else%>
		<%template _errmsgbox%>
	<%/if%>
<%else%>

<%if {createuser}==""%>
<form id="form1" name="form1" method="post" action="?agree=1&createuser=1">
<div class="ntforumbox">
	<div class="titlebar">
		<h3>填写注册信息</h3>
	</div>
	<div class="forumform">
	<table cellpadding="0" cellspacing="0" border="0">
	<thead>
		<tr>
			<td class="navformcommend"  colspan="2">必填</td>
		</tr>
	</thead>
	<tbody>
	<tr class="list">
				<th class="formlabel">用户名:</th>
				<td class="formbody"><input name="username" type="text" id="username" maxlength="20" size="20" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';checkusername(this.value);" /><span id="checkresult">不超过20个字符</span>
				</td>
	</tr>
	</tbody>
	<tbody>
	<tr class="list">
				<th class="formlabel">密码:</th>
				<td class="formbody"><input name="password" type="password" id="password" size="20" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" onkeyup="return loadinputcontext(this);" /><span>不得少于6个字符</span></td>
	</tr>
	</tbody>
	<tbody>
	<tr class="list">
				<th class="formlabel">密码强度:</th>
				<td class="formbody">
<script type="text/javascript">
        var PasswordStrength ={
            Level : ["极佳","一般","较弱","太短"],
            LevelValue : [15,10,5,0],//强度值
            Factor : [1,2,5],//字符加数,分别为字母，数字，其它
            KindFactor : [0,0,10,20],//密码含几种组成的加数 
            Regex : [/[a-zA-Z]/g,/\d/g,/[^a-zA-Z0-9]/g] //字符正则数字正则其它正则
            }
            
        PasswordStrength.StrengthValue = function(pwd)
        {
            var strengthValue = 0;
            var ComposedKind = 0;
            for(var i = 0 ; i < this.Regex.length;i++)
            {
                var chars = pwd.match(this.Regex[i]);
                if(chars != null)
                {
                    strengthValue += chars.length * this.Factor[i];
                    ComposedKind ++;
                }
            }
            strengthValue += this.KindFactor[ComposedKind];
            return strengthValue;
        } 
        
        PasswordStrength.StrengthLevel = function(pwd)
        {
            var value = this.StrengthValue(pwd);
            for(var i = 0 ; i < this.LevelValue.length ; i ++)
            {
                if(value >= this.LevelValue[i] )
                    return this.Level[i];
            }
        }
     
		function loadinputcontext(o)
		{
		   var showmsg=PasswordStrength.StrengthLevel(o.value);
		   switch(showmsg)
		   {
			  case "太短": showmsg+=" <img src='images/level/1.gif' width='88' height='11' />";break;
			  case "较弱": showmsg+=" <img src='images/level/2.gif' width='88' height='11' />";break;
			  case "一般": showmsg+=" <img src='images/level/3.gif' width='88' height='11' />";break;
			  case "极佳": showmsg+=" <img src='images/level/4.gif' width='88' height='11' />";break;
		   }
		   
		   document.getElementById('showmsg').innerHTML = showmsg;
			
		}

		function htmlEncode(source, display, tabs)
		{
			function special(source)
			{
				var result = '';
				for (var i = 0; i < source.length; i++)
				{
					var c = source.charAt(i);
					if (c < ' ' || c > '~')
					{
						c = '&#' + c.charCodeAt() + ';';
					}
					result += c;
				}
				return result;
			}
			
			function format(source)
			{
				// Use only integer part of tabs, and default to 4
				tabs = (tabs >= 0) ? Math.floor(tabs) : 4;
				
				// split along line breaks
				var lines = source.split(/\r\n|\r|\n/);
				
				// expand tabs
				for (var i = 0; i < lines.length; i++)
				{
					var line = lines[i];
					var newLine = '';
					for (var p = 0; p < line.length; p++)
					{
						var c = line.charAt(p);
						if (c === '\t')
						{
							var spaces = tabs - (newLine.length % tabs);
							for (var s = 0; s < spaces; s++)
							{
								newLine += ' ';
							}
						}
						else
						{
							newLine += c;
						}
					}
					// If a line starts or ends with a space, it evaporates in html
					// unless it's an nbsp.
					newLine = newLine.replace(/(^ )|( $)/g, '&nbsp;');
					lines[i] = newLine;
				}
				
				// re-join lines
				var result = lines.join('<br />');
				
				// break up contiguous blocks of spaces with non-breaking spaces
				result = result.replace(/  /g, ' &nbsp;');
				
				// tada!
				return result;
			}

			var result = source;
			
			// ampersands (&)
			result = result.replace(/\&/g,'&amp;');

			// less-thans (<)
			result = result.replace(/\</g,'&lt;');

			// greater-thans (>)
			result = result.replace(/\>/g,'&gt;');
			
			if (display)
			{
				// format for display
				result = format(result);
			}
			else
			{
				// Replace quotes if it isn't for display,
				// since it's probably going in an html attribute.
				result = result.replace(new RegExp('"','g'), '&quot;');
			}

			// special characters
			result = special(result);
			
			// tada!
			return result;
		}


		var profile_username_toolong = '对不起，您的用户名超过 20 个字符，请输入一个较短的用户名。';
		var profile_username_tooshort = '对不起，您输入的用户名小于3个字符, 请输入一个较长的用户名。';
		var profile_username_pass = "可用";

		function checkusername(username)
		{
			var unlen = username.replace(/[^\x00-\xff]/g, "**").length;

			if(unlen < 3 || unlen > 20) {
				document.getElementById("checkresult").innerHTML = "<font color='#009900'>" + (unlen < 3 ? profile_username_tooshort : profile_username_toolong) + "</font>";
				return;
			}
			ajaxRead("tools/ajax.aspx?t=checkusername&username=" + escape(username), "showcheckresult(obj,'" + username + "');");
		}

		function showcheckresult(obj, username)
		{
			var res = obj.getElementsByTagName('result');
			var resContainer = document.getElementById("checkresult");

			var result = "";
			if (res[0] != null && res[0] != undefined)
			{
				if (res[0].childNodes.length > 1) {
					result = res[0].childNodes[1].nodeValue;
				} else {
					result = res[0].firstChild.nodeValue;    		
				}
			}
			if (result == "1")
			{
				resContainer.innerHTML = "<font color='#009900'>对不起，您输入的用户名 \"" + htmlEncode(username, true, 4) + "\" 已经被他人使用或被禁用，请选择其他名字后再试。</font>";
			}
			else
			{
				resContainer.innerHTML = profile_username_pass;
			}
		}
		function checkSetting()
		{
			if ($('receiveuser').checked)
			{
				$('showhint').disabled = false;
			}
			else
			{			
				$('showhint').checked = false;
				$('showhint').disabled = true;
			}
		}
</script>
<script type="text/javascript" src="templates/{templatepath}/ajax.js"></script>
			 <strong id="showmsg"></strong>&nbsp;
		</td>
	</tr>
	</tbody>
	<tbody>
	<tr class="list">
				<th class="formlabel"><span>重复输入密码:</span></th>
				<td class="formbody"><input name="password2" type="password" id="password2" size="20" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" /></td>
	</tr>
	</tbody>
	<tbody>
	<tr class="list">
				<th class="formlabel"><span>Email:</span></th>
				<td class="formbody"><input name="email" type="text" id="email" size="30" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" /></td>
	</tr>
	</tbody>
	<%if {config.Realnamesystem}==1%>
		<%template _realnamesystem%>
	<%/if%>
	<%if {isseccode}%>
	<tbody>
	<tr class="list">
						<th class="formlabel"><span>验证码:</span></th>
						<td class="formbody"><%template _vcode%></td>
	</tr>
	</tbody>
	<%/if%>
	<tbody>
		<tr class="list">
			<td colspan="2" class="formarea">
						<input name="submit" type="submit" class="sbutton" value="创建用户"/>  <input type="button" class="sbutton" onclick="javascript:window.location.replace('./index.aspx')" value="取消"/>
			</td>
		</tr>
	</tbody>
	</table>
	</div>
</div>
<%if {config.Regadvance}==1%>
<div class="ntforumbox">
	<div class="titlebar">
		<span class="open">
			<a href="###" onclick="toggle_collapse('regoptions');"><img id= "regoptions_img" src="templates/{templatepath}/images/open_yes.gif" alt="展开" /></a>
		</span>
		<h3>填写可选项</h3>
	</div>
	<div id="regoptions" style="display:none;" class="forumform">
	<table cellpadding="0" cellspacing="0" border="0">
		<thead>
		<tr>
			<td class="navformcommend"  colspan="2">找回密码问题</td>
		</tr>
		</thead>
		<tbody>
		<tr class="list">
			<th class="formlabel">问题:</th>
			<td class="formbody">
				 <select name="question" id="question">
				  <option value="0" selected="selected">无</option>
				  <option value="1">母亲的名字</option>
				  <option value="2">爷爷的名字</option>
				  <option value="3">父亲出生的城市</option>
				  <option value="4">您其中一位老师的名字</option>
				  <option value="5">您个人计算机的型号</option>
				  <option value="6">您最喜欢的餐馆名称</option>
				  <option value="7">驾驶执照的最后四位数字</option>
				</select>
			</td>
		</tr>
		</tbody>
		<tbody>
		<tr class="list">
				<th class="formlabel">答案:</th>
				<td class="formbody">
					 <input name="answer" type="text" id="answer" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="30" />
				</td>
		</tr>
		</tbody>
		<tbody>	
		<tr>
			<td class="navformcommend"  colspan="2">个人信息</td>
		</tr>
		</tbody>
		<%if {config.Realnamesystem}==0%>
			<%template _realnamesystem%>
		<%/if%>
		<tbody>	
		<tr class="list">
				<th class="formlabel">性别:</th>
				<td class="formbody">
						<input type="radio" name="gender" value="1" style="InPutRadio"/>
						男
						<input type="radio" name="gender" value="2"  style="InPutRadio"/>
						女
						<input name="gender" type="radio" value="0" checked="checked"  style="InPutRadio"/>
						保密
				</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
				<th class="formlabel">昵称:</th>
				<td class="formbody">
					<input name="nickname" type="text" id="nickname" size="20" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" />
				</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
				<th class="formlabel">生日:</th>
				<td class="formbody">
					<input name="bday_y" type="text" id="bday_y" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="4" maxlength="4" />
					年
					<input name="bday_m" type="text" id="bday_m" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="2"  maxlength="2"/>
					月
					<input name="bday_d" type="text" id="bday_d" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="2"  maxlength="2"/>
					日
				</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">来自:</th>
						<td class="formbody">
							<input name="location" type="text" id="location" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="20" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">MSN Messenger:</th>
						<td class="formbody">
							<input name="msn" type="text" id="msn" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="30" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">Yahoo Messenger:</th>
						<td class="formbody">
							<input name="yahoo" type="text" id="yahoo" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="30" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">Skype:</th>
						<td class="formbody">
							<input name="skype" type="text" id="skype" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="30" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">ICQ:</th>
						<td class="formbody">
							<input name="icq" type="text" id="icq" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="12" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">QQ:</th>
						<td class="formbody">
						<input name="qq" type="text" id="qq" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="12" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">主页:</th>
						<td class="formbody">
						<input name="homepage" type="text" id="homepage" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" size="30" />
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">自我介绍:</th>
						<td class="formbody">
							<textarea name="bio" cols="50" rows="6" id="bio" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';"  style="height:95px;width:85%;"></textarea>
						</td>
		</tr>
		</tbody>
		<tbody>
		<tr>
			<td class="navformcommend" colspan="2">论坛使用喜好设置:</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">风格:</th>
						<td class="formbody">
							<select name="templateid" id="templateid" >
							  <option value="0" selected>默认</option>
							  <%loop template templatelist%>
								<option value="{template[templateid]}">{template[name]}</option>
							  <%/loop%>
							</select>
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">每页主题数:</th>
						<td class="formbody">
							<select name="tpp" id="tpp">
							  <option value="0" selected="selected">默认</option>
							  <option value="10">10</option>
							  <option value="15">15</option>
							  <option value="25">25</option>
							</select>
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">每页帖子数:</th>
						<td class="formbody">
							<select name="ppp" id="ppp">
							  <option value="0" selected="selected">默认</option>
							  <option value="10">10</option>
							  <option value="15">15</option>
							  <option value="20">20</option>
							</select>
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">是否提示短消息:</th>
						<td class="formbody">
							<input name="newpm" type="radio" value="radiobutton" checked="checked"  style="InPutRadio"/>
								是
							<input type="radio" name="newpm" value="radiobutton"  style="InPutRadio"/>
								否
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">短消息铃声:</th>
						<td class="formbody">
							<select name="pmsound" id="pmsound">
							  <option value="1" selected="selected">默认</option>							  
							  <option value="1">提示音1</option>							  
							  <option value="2">提示音2</option>							  
							  <option value="3">提示音3</option>		
							  <option value="4">提示音4</option>		
							  <option value="5">提示音5</option>							  
							  <option value="0">无</option>
							</select>
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">是否显示Email:</th>
						<td class="formbody">
							<input name="showemail" type="radio" value="1" checked="checked"  style="InPutRadio"/>
								是
							<input type="radio" name="showemail" value="0"  style="InPutRadio"/>
								否
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">消息接收设置:</th>
						<td class="formbody">
							<input id="receiveuser" onclick="checkSetting();" type="checkbox" name="receivesetting" value="2" checked="checked" />接收用户短消息
							<input id="showhint" onclick="checkSetting();" type="checkbox" name="receivesetting" value="4" checked="checked" />显示短消息提示框
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">是否隐身:</th>
						<td class="formbody">
							<input type="radio" name="invisible" value="1"  style="InPutRadio"/>
								是
							<input name="invisible" type="radio" value="0" checked="checked"  style="InPutRadio"/>
								否
						</td>
		</tr>
		</tbody>
		<tbody>	
		<tr class="list">
						<th class="formlabel">签名:</th>
						<td class="formbody">
							<textarea name="signature" cols="50" rows="6" id="signature" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';"  style="height:95px;width:85%;"></textarea>
				  <input name="sigstatus" type="checkbox" id="sigstatus" value="1" checked="checked" />使用签名
						</td>
		</tr>
		</tbody>
		<tbody>
		<tr class="list">
			<td colspan="2" class="formarea">
					<input name="submit" type="submit" class="sbutton" value="创建用户"/>  <input type="button" class="sbutton" onclick="javascript:window.location.replace('./index.aspx')" value="取消"/></td>
		</tr>
		</tbody>
		</table>
		</div>
</div>
<%/if%>
</form>
<!--reg end-->
</div>
<%template _copyright%>
<%else%>
<%if {createuser}!=""%>
	<%if page_err==0%>
	<%template _msgbox%>
	<%else%>
	<%template _errmsgbox%>
	<%/if%>
	</div>
<%/if%>
<%/if%>
<%/if%>
<%template _footer%>
