{template header}
<style type="text/css">
<!--
.input {
	float: left;
}
.notice {
	float: left;
	margin-left: 10px;
	padding: 6px 1px 1px 1px;
}
.warning {
	float: left;
	color: red;
	margin-left: 10px;
	text-align: left;
	padding-top: 4px;
}
-->
</style>
<script type="text/javascript" src="include/javascript/calendar.js"></script>
<div class="subtable nav" style="width: {TABLEWIDTH}">
<a href="$indexname">$bbname</a> &raquo; {lang register}
</div><br>

<!--{if $bbrules && !$rulesubmit}-->
	<form name="bbrules" method="post" action="register.php">
	<input type="hidden" name="formhash" value="{FORMHASH}">
	<input type="hidden" name="referer" value="$referer">
	<div class="spaceborder" style="width: {TABLEWIDTH}">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr>
	<td class="header">{lang register}</td>
	</tr>

	<tr class="altbg1">
	<td width="21%">$bbrulestxt</td>
	</tr>

	</table></div><br>
	<center>
	<input class="button" type="submit" name="rulesubmit" value="{lang agree}" style="height: 23px">
	<input class="button" type="button" name="return" value="{lang disagree}" style="height: 23px" onclick="javascript:history.go(-1);">
	</center>
	</form>

	<script type="text/javascript">
	var secs = 9;
	var wait = secs * 1000;
	document.bbrules.rulesubmit.value = "{lang agree}(" + secs + ")";
	document.bbrules.rulesubmit.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.bbrules.rulesubmit.value = "{lang agree}";
	        } else {
	                printnr = (wait / 1000) - num;
	                document.bbrules.rulesubmit.value = "{lang agree}(" + printnr + ")";
	        }
	}
	function timer() {
	        document.bbrules.rulesubmit.disabled = false;
	        document.bbrules.rulesubmit.value = "{lang agree}";
	}
	</script>
<!--{else}-->
	<script type="text/javascript">
	function showadv() {
		if(document.register.advshow.checked == true) {
			$("adv").style.display = "";
		} else {
			$("adv").style.display = "none";
		}
	}
	</script>
	<script type="text/javascript" src="include/javascript/msn.js"></script>
	<form method="post" name="register" action="register.php?regsubmit=yes" $enctype onSubmit="this.regsubmit.disabled=true;">
	<input type="hidden" name="formhash" value="{FORMHASH}">
	<input type="hidden" name="referer" value="$referer">
	<div class="spaceborder" style="width: {TABLEWIDTH}">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr>
	<td colspan="2" class="header"><a href="member.php?action=credits&view=promotion_register" target="_blank"><img src="{IMGDIR}/credits.gif" alt="{lang credits_policy_view}" align="right" border="0" /></a>{lang register}</td>
	</tr>
	<tr class="category">
	<td colspan="2">{lang required_info}</td>
	</tr>

	<!--{if $seccodecheck}-->
		<tr>
		<td class="altbg1" width="21%"><span class="bold">{lang seccode}</span></td>
		<td class="altbg2"> <div id="seccodeimage"></div><div class="input"><input type="text" name="seccodeverify" size="4" maxlength="4" id="seccodeverify" onBlur="checkseccode()"></div><div class="notice" id="checkseccodeverify"> {lang seccode_refresh}</div>
		<script type="text/javascript">
		<!--{if $attackevasive & 1}-->
			setTimeout("updateseccode($seccodedata['width'], $seccodedata['height'])", 2001);
		<!--{else}-->
			updateseccode($seccodedata['width'], $seccodedata['height'])
		<!--{/if}-->
		</script></td>
		</tr>
	<!--{/if}-->

	<!--{if $secqaa['status'][1]}-->
		<tr>
		<td class="altbg1" width="21%"><span class="bold">{lang secqaa}</span></td>
		<td class="altbg2"><span id="secquestion"></span><br><div class="input"><input type="text" name="secanswer" size="25" maxlength="50" id="secanswer" onBlur="checksecanswer()"></div><div id="checksecanswer" class="notice"></div>
		<script type="text/javascript">
		<!--{if $attackevasive & 1}-->
			<!--{if $seccodecheck}-->
				setTimeout("updatesecqaa()", 4002);
			<!--{else}-->
				setTimeout("updatesecqaa()", 2001);
			<!--{/if}-->
		<!--{else}-->
			updatesecqaa();
		<!--{/if}-->
		</script></td>
		</tr>
	<!--{/if}-->

	<tr>
	<td class="altbg1" width="21%"><span class="bold">{lang username}</span></td>
	<td class="altbg2"><div class="input"><input type="text" name="username" size="25" maxlength="15" id="username" onBlur="checkusername()"></div><div id="checkusername"></div>
	</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang password}</span></td>
	<td class="altbg2"><div class="input"><input type="password" name="password" size="25" id="password" onBlur="checkpassword()"></div><div id="checkpassword"></div></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang password_confirm}</span></td>
	<td class="altbg2"><div class="input"><input type="password" name="password2" size="25" id="password2" onBlur="checkpassword2()"></div><div id="checkpassword2"></div></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang email}</span></td>
	<td class="altbg2"><div class="input"><input type="text" name="email" size="25" id="email" onBlur="checkemail()"></div><div id="checkemail" class="notice">&nbsp; <span class="smalltxt">{lang register_email_recommend}</span><!--{if $regverify == 1}-->&nbsp; <span class="smalltxt">{lang register_email_comment}</span><!--{/if}-->
	<!--{if $accessemail}-->&nbsp; <span class="smalltxt">{lang register_email_invalid}</span><!--{elseif $censoremail}-->&nbsp; <span class="smalltxt">{lang register_email_censor}</span><!--{/if}--></div>
	</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">MSN</span> ({lang optional_info})</td>
	<td class="altbg2"><div class="input"><input type="text" name="msn" size="25"></div><div id="checkmsn" class="notice">&nbsp; <span class="smalltxt">{lang register_msn_download}</span></div></td>
	</tr>

	<!--{if !empty($fromuser)}-->
		<tr>
		<td class="altbg1"><span class="bold">{lang register_from}</span></td>
		<td class="altbg2"><input type="text" name="fromuser" size="25" value="$fromuser" disabled></td>
		</tr>
	<!--{/if}-->

	<!--{loop $_DCACHE['fields_required'] $field}-->
		<tr>
		<td class="altbg1" width="21%"><span class="bold">$field[title]</span><!--{if $field['description']}--><br><span class="smalltxt">$field[description]</span><!--{/if}--></td>
		<td class="altbg2">
		<!--{if $field['selective']}-->
			<select name="field_$field[fieldid]new">
			<option value="">{lang please_select}</option>
			<!--{loop $field['choices'] $index $choice}-->
				<option value="$index" <!--{if $index == $member['field_'.$field[fieldid]]}-->selected="selected"<!--{/if}-->>$choice</option>
			<!--{/loop}-->
			</select>
		<!--{else}-->
			<input type="text" name="field_$field[fieldid]new" size="25" value="$member['field_'.$field[fieldid]]">
		<!--{/if}-->
		<!--{if $field['unchangeable']}-->&nbsp;<span class="smalltxt"><span class="bold">{lang memcp_profile_unchangeable_comment}</span></span><!--{/if}-->
		</td></tr>
	<!--{/loop}-->

	<!--{if $regverify == 2}-->
		<tr>
		<td class="altbg1" valign="top"><span class="bold">{lang register_message}</span></td>
		<td class="altbg2"><textarea rows="4" cols="30" name="regmessage"></textarea></td>
		</tr>
	<!--{/if}-->

	<tr>
	<td class="altbg1"><span class="bold">{lang register_advanced_options}</span></td>
	<td class="altbg2"><input name="advshow" class="checkbox" type="checkbox" $advcheck value="1" onclick="showadv()"><span id=advance>{lang register_advanced_options_comment}</span>
	</td>
	</tr>

	<tbody id=adv style="display: $advdisplay">
	<tr class="category">
	<td colspan="2">{lang optional_info}</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang security_question}</span></td>
	<td class="altbg2"><select name="questionid">
	<option value="0">{lang security_question_0}</option>
	<option value="1">{lang security_question_1}</option>
	<option value="2">{lang security_question_2}</option>
	<option value="3">{lang security_question_3}</option>
	<option value="4">{lang security_question_4}</option>
	<option value="5">{lang security_question_5}</option>
	<option value="6">{lang security_question_6}</option>
	<option value="7">{lang security_question_7}</option>
	</select> <span class="smalltxt"><span class="bold">{lang memcp_profile_security_comment}</span></span>
	</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang security_answer}</span></td>
	<td class="altbg2"><input type="text" name="answer" size="25"></td>
	</tr>

	<tr><td colspan="2" class="singleborder">&nbsp;</td></tr>

	<!--{loop $_DCACHE['fields_optional'] $field}-->
		<tr>
		<td class="altbg1" width="21%">$field[title]<!--{if $field['description']}--><br><span class="smalltxt">$field[description]</span><!--{/if}--></td>
		<td class="altbg2">
		<!--{if $field['selective']}-->
			<select name="field_$field[fieldid]new">
			<option value="">{lang please_select}</option>
			<!--{loop $field['choices'] $index $choice}-->
				<option value="$index">$choice</option>
			<!--{/loop}-->
			</select>
		<!--{else}-->
			<input type="text" name="field_$field[fieldid]new" size="25">
		<!--{/if}-->
		<!--{if $field['unchangeable']}-->&nbsp;<span class="bold">{lang memcp_profile_unchangeable_comment}</span><!--{/if}-->
		</td></tr>
	<!--{/loop}-->

	<!--{if $groupinfo['allownickname']}-->
		<tr>
		<td class="altbg1"><span class="bold">{lang nickname}</span></td>
		<td class="altbg2"><input type="text" name="nickname" size="25">
		</tr>
	<!--{/if}-->

	<tr>
	<td class="altbg1"><span class="bold">{lang gender}</span></td>
	<td class="altbg2">
	<input class="radio" type="radio" name="gendernew" value="1"> {lang male} &nbsp;
	<input class="radio" type="radio" name="gendernew" value="2"> {lang female} &nbsp;
	<input class="radio" type="radio" name="gendernew" value="0" checked> {lang secret}
	</td></tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang birthday}</span></td>
	<td class="altbg2"><input type="text" name="bday" size="25" onclick="showcalendar(event, this)" onfocus="showcalendar(event, this);if(this.value=='0000-00-00')this.value=''" value="0000-00-00"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang location}</span></td>
	<td class="altbg2"><input type="text" name="locationnew" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang homepage}</span></td>
	<td class="altbg2"><input type="text" name="site" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">QQ</span></td>
	<td class="altbg2"><input type="text" name="qq" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">ICQ</span></td>
	<td class="altbg2"><input type="text" name="icq" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">Yahoo</span></td>
	<td class="altbg2"><input type="text" name="yahoo" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang taobao}</span></td>
	<td class="altbg2"><input type="text" name="taobao" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang alipay}</span></td>
	<td class="altbg2"><input type="text" name="alipay" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1" valign="top"><span class="bold">{lang bio}</span></td>
	<td class="altbg2"><textarea rows="5" cols="30" name="bio"></textarea></td>
	</tr>

	<tr class="category">
	<td colspan="2">{lang board_options}</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang style}</span></td>
	<td class="altbg2"><select name="styleidnew">
	<option value="">{lang use_default}</option>
	$styleselect
	</select>
	</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang tpp}</span></td>
	<td class="altbg2"><select name="tppnew">
	<option value="0">{lang use_default}</option>
	<option value="10">10</option>
	<option value="20">20</option>
	<option value="30">30</option>
	</select></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang ppp}</span></td>
	<td class="altbg2"><select name="pppnew">
	<option value="0">{lang use_default}</option>
	<option value="5">5</option>
	<option value="10">10</option>
	<option value="15">15</option>
	</select></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang timeoffset}</span></td>
	<td class="altbg2">
	<select name="timeoffsetnew">
	<option value="9999" selected="selected">{lang use_default}</option>
	<option value="-12">(GMT -12:00) Eniwetok, Kwajalein</option>
	<option value="-11">(GMT -11:00) Midway Island, Samoa</option>
	<option value="-10">(GMT -10:00) Hawaii</option>
	<option value="-9">(GMT -09:00) Alaska</option>
	<option value="-8">(GMT -08:00) Pacific Time (US &amp; Canada), Tijuana</option>
	<option value="-7">(GMT -07:00) Mountain Time (US &amp; Canada), Arizona</option>
	<option value="-6">(GMT -06:00) Central Time (US &amp; Canada), Mexico City</option>
	<option value="-5">(GMT -05:00) Eastern Time (US &amp; Canada), Bogota, Lima, Quito</option>
	<option value="-4">(GMT -04:00) Atlantic Time (Canada), Caracas, La Paz</option>
	<option value="-3.5">(GMT -03:30) Newfoundland</option>
	<option value="-3">(GMT -03:00) Brassila, Buenos Aires, Georgetown, Falkland Is</option>
	<option value="-2">(GMT -02:00) Mid-Atlantic, Ascension Is., St. Helena</option>
	<option value="-1">(GMT -01:00) Azores, Cape Verde Islands</option>
	<option value="0">(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia</option>
	<option value="1">(GMT +01:00) Amsterdam, Berlin, Brussels, Madrid, Paris, Rome</option>
	<option value="2">(GMT +02:00) Cairo, Helsinki, Kaliningrad, South Africa</option>
	<option value="3">(GMT +03:00) Baghdad, Riyadh, Moscow, Nairobi</option>
	<option value="3.5">(GMT +03:30) Tehran</option>
	<option value="4">(GMT +04:00) Abu Dhabi, Baku, Muscat, Tbilisi</option>
	<option value="4.5">(GMT +04:30) Kabul</option>
	<option value="5">(GMT +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
	<option value="5.5">(GMT +05:30) Bombay, Calcutta, Madras, New Delhi</option>
	<option value="5.75">(GMT +05:45) Katmandu</option>
	<option value="6">(GMT +06:00) Almaty, Colombo, Dhaka, Novosibirsk</option>
	<option value="6.5">(GMT +06:30) Rangoon</option>
	<option value="7">(GMT +07:00) Bangkok, Hanoi, Jakarta</option>
	<option value="8">(GMT +08:00) Beijing, Hong Kong, Perth, Singapore, Taipei</option>
	<option value="9">(GMT +09:00) Osaka, Sapporo, Seoul, Tokyo, Yakutsk</option>
	<option value="9.5">(GMT +09:30) Adelaide, Darwin</option>
	<option value="10">(GMT +10:00) Canberra, Guam, Melbourne, Sydney, Vladivostok</option>
	<option value="11">(GMT +11:00) Magadan, New Caledonia, Solomon Islands</option>
	<option value="12">(GMT +12:00) Auckland, Wellington, Fiji, Marshall Island</option>
	</select></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang timeformat}</span></td>
	<td class="altbg2"><input class="radio" type="radio" value="0" name="timeformatnew" checked>{lang default} &nbsp;
	<input class="radio" type="radio" value="1" name="timeformatnew">12 {lang hour} &nbsp;
	<input class="radio" type="radio" value="2" name="timeformatnew">24 {lang hour}</td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang dateformat}</span><br><span class="smalltxt">{lang eg} yyyy/mm/dd, mm/dd/yy</span></td>
	<td class="altbg2"><input class="radio" type="radio" value="0" name="dateformatnew" checked>{lang default} &nbsp;
	<input class="radio" type="radio" value="1" name="dateformatnew">{lang customize}:
	<input type="text" name="cdateformatnew" size="25"></td>
	</tr>

	<tr>
	<td class="altbg1"><span class="bold">{lang pmsound}</span></td>
	<td class="altbg2"><input class="radio" type="radio" value="0" name="pmsoundnew">{lang none} &nbsp;
	<input class="radio" type="radio" value="1" name="pmsoundnew" checked><a href="images/sound/pm_1.wav">#1</a> &nbsp;
	<input class="radio" type="radio" value="2" name="pmsoundnew"><a href="images/sound/pm_2.wav">#2</a> &nbsp;
	<input class="radio" type="radio" value="3" name="pmsoundnew"><a href="images/sound/pm_3.wav">#3</a></td>
	</tr>

	<!--{if $groupinfo['allowcstatus']}-->
		<tr>
		<td class="altbg1" width="21%"><span class="bold">{lang custom_status}</span></td>
		<td class="altbg2">
		<input type="text" name="cstatus" size="25"></td>
		</tr>
	<!--{/if}-->

	<tr>
	<td class="altbg1"><span class="bold">{lang other_options}</span></td>
	<td class="altbg2">
	<!--{if $groupinfo['allowinvisible']}-->
		<input class="checkbox" type="checkbox" name="invisiblenew" value="1"> {lang online_invisible}<br>
	<!--{/if}-->
	<input class="checkbox" type="checkbox" name="showemailnew" value="1" checked="checked"> {lang show_email_addr}<br>
	<input class="checkbox" type="checkbox" name="newsletter" value="1" checked="checked"> {lang allow_newsletter}<br>
	</tr>

	<!--{if $groupinfo['allowavatar'] == 1}-->
		<tr>
		<td class="altbg1" valign="top"><span class="bold">{lang avatar}</span></td>
		<td class="altbg2"><input type="text" name="urlavatar" id="urlavatar" size="25"><input type="button" value="{lang memcp_avatar_list}" onclick="$('avatardiv').style.display = $('avatardiv').style.display == 'none' ? '' : 'none'; if($('avatardiv').innerHTML == ''){ showAvatar(1); }">
		<span id="statusid"></span>
		<div id="avatardiv" style="display: none; margin-top: 10px;"></div>
		</td>
		</tr>
	<!--{elseif $groupinfo['allowavatar'] == 2}-->
		<tr>
		<td class="altbg1" valign="top"><span class="bold">{lang avatar}</span></td>
		<td class="altbg2"><input type="text" name="urlavatar" id="urlavatar" size="25"> <input type="button" value="{lang memcp_avatar_list}" onclick="$('avatardiv').style.display = $('avatardiv').style.display == 'none' ? '' : 'none'; if($('avatardiv').innerHTML == ''){ showAvatar(1); }">
		<span id="statusid"></span>
		<div id="avatardiv" style="display: none; margin-top: 10px;"></div>
		<br>{lang width}: <input type="text" name="avatarwidth" size="1" value="*"> &nbsp; {lang height}: <input type="text" name="avatarheight" size="1" value="*"></td>
		</tr>
	<!--{/if}-->

	<!--{if $groupinfo['maxsigsize']}-->
		<tr>
		<td class="altbg1" valign="top"><span class="bold">{lang signature}<!--{if $maxsigsize}--> ($maxsigsize {lang bytes_limited})<!--{/if}--></span><br><br>
		<span class="smalltxt">{faq discuzcode} <span class="bold"><!--{if $groupinfo['allowsigbbcode']}-->{lang enabled}<!--{else}-->{lang disabled}<!--{/if}--></span><br>
		{lang post_imgcode} <span class="bold"><!--{if $groupinfo['allowsigimgcode']}-->{lang enabled}<!--{else}-->{lang disabled}<!--{/if}--></span>
		</span></td>
		<td class="altbg2"><textarea rows="4" cols="30" name="signature"></textarea></td>
		</tr>
	<!--{/if}-->
	</tbody>

	</table></div><br>
	<div class="option"><div class="submitbutton"><input class="button" type="submit" name="regsubmit" value="{lang submit}"></div></div>
	</form>

	<script type="text/javascript">
	var profile_seccode_invalid = '{lang register_profile_seccode_invalid}';
	var profile_secanswer_invalid = '{lang register_profile_secqaa_invalid}';
	var profile_username_toolong = '{lang register_profile_username_toolong}';
	var profile_username_tooshort = '{lang register_profile_profile_username_tooshort}';
	var profile_username_illegal = '{lang register_profile_username_illegal}';
	var profile_passwd_illegal = '{lang register_profile_passwd_illegal}';
	var profile_passwd_notmatch = '{lang register_profile_passwd_notmatch}';
	var profile_email_illegal = '{lang register_profile_email_illegal}';
	var profile_email_invalid = '{lang register_profile_email_invalid}';
	var profile_email_censor = '{lang register_profile_email_censor}';
	var profile_email_msn = '{lang register_profile_email_msn}';
	var doublee = parseInt('$doublee');
	var lastseccode = lastsecanswer = lastusername = lastpassword = lastemail = '';
	var xml_http_building_link = '{lang xml_http_building_link}';
	var xml_http_sending = '{lang xml_http_sending}';
	var xml_http_loading = '{lang xml_http_loading}';
	var xml_http_load_failed = '{lang xml_http_load_failed}';
	var xml_http_data_in_processed = '{lang xml_http_data_in_processed}';

	document.register.seccodeverify ? document.register.seccodeverify.focus() : $('username').focus();
	function showAvatar(page) {
		var x = new Ajax('XML', 'statusid');
		x.get('member.php?action=viewavatars&page='+page, function(s){
			$("avatardiv").innerHTML = s;
			if($('multipage')) {
				var multiChildNodes = $('multipage').firstChild.childNodes;
				for(k in multiChildNodes) {
					if(multiChildNodes[k].href) {
						var r = multiChildNodes[k].href.match(/page=(\d*)/);
						var currpage = parseInt(r[1]);
		 				if(multiChildNodes) {
							multiChildNodes[k].href = isNaN(currpage) ? '' : 'javascript:showAvatar("'+currpage+'")';
						}
					}
				}
			}
		});
	}

	function checkseccode() {
		var seccodeverify = $('seccodeverify').value;
		if(seccodeverify == lastseccode) {
			return;
		} else {
			lastseccode = seccodeverify;
		}
		var cs = $('checkseccodeverify');
		if(!(/[0-9A-Za-z]{4}/.test(seccodeverify))) {
			warning(cs, profile_seccode_invalid);
			return;
		}
		ajaxresponse('checkseccodeverify', 'action=checkseccode&seccodeverify=' + seccodeverify);
	}
	function checksecanswer() {
	        var secanswer = $('secanswer').value;
		if(secanswer == lastsecanswer) {
			return;
		} else {
			lastsecanswer = secanswer;
		}
		ajaxresponse('checksecanswer', 'action=checksecanswer&secanswer=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(secanswer) : secanswer));
	}
	function checkusername() {
		var username = trim($('username').value);
		if(username == lastusername) {
			return;
		} else {
			lastusername = username;
		}
		var cu = $('checkusername');
		var unlen = username.replace(/[^\x00-\xff]/g, "**").length;

		if(unlen < 3 || unlen > 15) {
			warning(cu, unlen < 3 ? profile_username_tooshort : profile_username_toolong);
			return;
		}
                ajaxresponse('checkusername', 'action=checkusername&username=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username));
	}
	function checkpassword(confirm) {
		var password = $('password').value;
		if(!confirm && password == lastpassword) {
			return;
		} else {
			lastpassword = password;
		}
		var cp = $('checkpassword');
		if(password == '' || /[\'\"\\]/.test(password)) {
			warning(cp, profile_passwd_illegal);
			return false;
		} else {
			cp.style.display = 'none';
			if(!confirm) {
				checkpassword2(true);
			}
			return true;
		}
	}
	function checkpassword2(confirm) {
		var password = $('password').value;
		var password2 = $('password2').value;
		var cp2 = $('checkpassword2');
		if(password2 != '') {
			checkpassword(true);
		}
		if(password == '' || (confirm && password2 == '')) {
			cp2.style.display = 'none';
			return;
		}
		if(password != password2) {
			warning(cp2, profile_passwd_notmatch);
		} else {
			cp2.style.display = 'none';
		}
	}
	function checkemail() {
		var email = trim($('email').value);
		if(email == lastemail) {
			return;
		} else {
			lastemail = email;
		}
		var ce = $('checkemail');
		var accessemail = '$accessemail';
		var censoremail = '$censoremail';
		var accessexp = accessemail != '' ? $accessexp : null;
		var censorexp = censoremail != '' ? $censorexp : null;

		illegalemail = !(/^[\-\.\w]+@[\.\-\w]+(\.\w+)+$/.test(email));
		invalidemail = accessemail != '' ? !accessexp.test(email) : censoremail != '' && censorexp.test(email);
		if(illegalemail || invalidemail) {
			warning(ce, illegalemail ? profile_email_illegal : (accessemail != '' ? profile_email_invalid : profile_email_censor));
			return;
		}

		if(!(/@(msn|hotmail|live)\.com$/.test(email))) {
			$('checkemail').style.display = '';
			$('checkemail').innerHTML = ' &nbsp; ' + profile_email_msn;
			return;
		}

		if(!doublee) {
			ajaxresponse('checkemail', 'action=checkemail&email=' + email);
		} else {
			ce.innerHTML = '<img src="{IMGDIR}/check_right.gif" width="13" height="13">';
		}

	}
	function trim(str) {
		return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
	}
        function ajaxresponse(objname, data) {
        	var x = new Ajax('XML', objname);
        	x.get('ajax.php?inajax=1&' + data, function(s){
        	        var obj = $(objname);
        	        if(s == 'succeed') {
        	        	obj.style.display = '';
        	                obj.innerHTML = '<img src="{IMGDIR}/check_right.gif" width="13" height="13">';
        			obj.className = "warning";
        		} else {
        			warning(obj, s);
        		}
        	});
        }
	function warning(obj, msg) {
		if((ton = obj.id.substr(5, obj.id.length)) != 'password2') {
			$(ton).select();
		}
		obj.style.display = '';
		obj.innerHTML = '<img src="{IMGDIR}/check_error.gif" width="13" height="13"> &nbsp; ' + msg;
		obj.className = "warning";
	}
	</script>

<!--{/if}-->
{template footer}