<xen:title>{xen:phrase sign_up}</xen:title>
<form action="{xen:link 'register/register'}" method="post" class="xenForm AutoValidator"
data-fieldValidatorUrl="{xen:link register/validate-field}"
data-normalSubmit="1"
>
<xen:if is="{$errors}">
<div class="errorPanel">
<h3 class="errorHeading">{xen:phrase please_correct_following_errors}:</h3>
<div class="baseHtml errors">
<ol>
<xen:foreach loop="$errors" value="$error">
<li>{xen:raw $error}</li>
</xen:foreach>
</ol>
</div>
</div>
</xen:if>
<dl class="ctrlUnit">
<dt><label for="ctrl_{$fieldMap.username}">{xen:phrase name}:</label></dt>
<dd>
<input type="text" name="{$fieldMap.username}" value="{$fields.username}" class="textCtrl" id="ctrl_{$fieldMap.username}" autofocus="true" autocomplete="off" />
<p class="explain">{xen:phrase this_is_name_that_will_be_shown_with_your_messages}</p>
</dd>
</dl>
<dl class="ctrlUnit">
<dt><label for="ctrl_{$fieldMap.email}">{xen:phrase email}:</label></dt>
<dd>
<input type="email" name="{$fieldMap.email}" value="{$fields.email}" dir="ltr" class="textCtrl" id="ctrl_{$fieldMap.email}" />
</dd>
</dl>
<fieldset>
<dl class="ctrlUnit">
<dt><label for="ctrl_{$fieldMap.password}">{xen:phrase password}:</label></dt>
<dd><input type="password" name="{$fieldMap.password}" class="textCtrl OptOut" id="ctrl_{$fieldMap.password}" autocomplete="off" /></dd>
</dl>
<dl class="ctrlUnit">
<dt><label for="ctrl_{$fieldMap.password_confirm}">{xen:phrase confirm_password}:</label></dt>
<dd>
<input type="password" name="{$fieldMap.password_confirm}" class="textCtrl OptOut" id="ctrl_{$fieldMap.password_confirm}" />
<p class="explain">{xen:phrase enter_your_password_in_first_box_and_confirm_it_in_second}</p>
</dd>
</dl>
</fieldset>
<dl class="ctrlUnit">
<dt>{xen:phrase gender}:</dt>
<dd>
<ul>
<li><label><input type="radio" name="{$fieldMap.gender}" value="male" {xen:checked "{$fields.gender} == 'male'"} /> {xen:phrase male}</label></li>
<li><label><input type="radio" name="{$fieldMap.gender}" value="female" {xen:checked "{$fields.gender} == 'female'"} /> {xen:phrase female}</label></li>
<li><label><input type="radio" name="{$fieldMap.gender}" value="" {xen:checked "!{$fields.gender}"} /> ({xen:phrase unspecified})</label></li>
</ul>
</dd>
</dl>
<xen:include template="helper_birthday_row_register" />
<xen:if is="{$xenOptions.registrationSetup.requireLocation}">
<dl class="ctrlUnit">
<dt>
{xen:phrase location}:
<dfn>{xen:phrase required}</dfn>
</dt>
<dd>
<input type="text" name="location" value="{$fields.location}" class="textCtrl" />
</dd>
</dl>
</xen:if>
<dl class="ctrlUnit" style="display: none">
<dt><label for="ctrl_{$fieldMap.timezone}">{xen:phrase time_zone}:</label></dt>
<dd>
<select name="{$fieldMap.timezone}" class="textCtrl {xen:if $fields.timezoneAuto, 'AutoTimeZone'} OptOut" id="ctrl_{$fieldMap.timezone}">
<xen:foreach loop="$timeZones" key="$identifier" value="$name">
<option value="{$identifier}" {xen:selected "{$identifier} == {$fields.timezone}"}>{$name}</option>
</xen:foreach>
</select>
</dd>
</dl>
<xen:if hascontent="true">
<fieldset>
<xen:contentcheck>
<xen:include template="helper_captcha_unit" />
</xen:contentcheck>
</fieldset>
</xen:if>
<dl class="ctrlUnit submitUnit">
<dt></dt>
<dd>
<xen:set var="$timerHtml"><xen:if is="{$xenOptions.registrationTimer}">
<span id="RegTimer">({xen:phrase please_wait_x_seconds, "seconds=<span>{$xenOptions.registrationTimer}</span>"})</span>
</xen:if></xen:set>
<xen:if is="{$tosUrl}">
<ul>
<li>
<div class="text">{xen:phrase i_agree_to_terms_and_rules, 'checkbox=<input type="checkbox" name="agree" value="1" id="ctrl_agree" class="Disabler" />', 'terms_attributes=href="{$tosUrl}" target="_blank"'}</div>
<ul id="ctrl_agree_Disabler">
<li><input type="submit" value="{xen:phrase sign_up}" accesskey="s" class="button primary" id="SubmitButton" /> {xen:raw $timerHtml}</li>
</ul>
</li>
</ul>
<xen:else />
<input type="submit" value="{xen:phrase sign_up}" accesskey="s" class="button primary" id="SubmitButton" /> {xen:raw $timerHtml}
</xen:if>
</dd>
</dl>
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
<input type="hidden" name="reg_key" value="{$regKey}" />
</form>
<xen:if is="{$xenOptions.registrationTimer}">
<script>
(function($) {
$(function() {
var rt = $('#RegTimer'), s = rt.find('span'), t = parseInt(s.text(), 10),
sub = $('#SubmitButton'),
i = setInterval(function() {
t--;
if (t <= 0) {
rt.hide();
clearInterval(i);
} else {
s.text(t);
}
}, 1000);
var f = function(e) {
if (t > 0) {
e.preventDefault();
}
};
sub.click(f);
sub.closest('form').submit(f);
});
})(jQuery);
</script>
</xen:if>