{if {$_CONF['info_row']['ajax_register']} == 0}
{template}address_bar_part1{/template}
 {$lang['register']}
{template}address_bar_part2{/template}
{/if}
<script type='text/javascript'>
//<![CDATA[
function AjaxChkName()
{
	var AjaxState = {ajaxSend : $("#result1").html("<div class='info_bar'> <img border='0' src='<?php echo $PowerBB->_CONF['template']['image_path']; ?>/loading.gif' width='25' height='25'/></div>")};
	var data = {};
	data['username']    =  $("#username_id").val();
	data['ajax']	=  1;
	$.post("index.php?page=register&checkname=1",data,function Success(xml) { $("#result1").html(xml); });
	}
	function AjaxChkEmail()
	{
	var AjaxState = {ajaxSend :
	$("#result2").html("<div class='info_bar'> <img border='0' src='<?php echo $PowerBB->_CONF['template']['image_path']; ?>/loading.gif' width='25' height='25'/></div>")};
	var data = {};
	data['email']	=  $("#email_id").val();
	data['ajax']	=  1;
	$.post("index.php?page=register&checkemail=1",data,function Success(xml) { $("#result2").html(xml); });
}
function Ready()
{
	$("#username_id").change(AjaxChkName);
	$("#email_id").change(AjaxChkEmail);
}

$(document).ready(Ready);
//]]>
</script>
{if {$_CONF['info_row']['ajax_register']}}
<script type='text/javascript'>
//<![CDATA[
function AjaxRegister()
{
	var AjaxState = {ajaxSend : $("#result").html("<div class='info_bar'> <img border='0' src='{$image_path}/loading.gif'></div>")};

	var data = {};

	data['username'] 			= 	$("#username_id").val();
	data['password'] 			= 	$("#password_id").val();
	data['password_confirm'] 	= 	$("#password_confirm_id").val();
	data['email'] 				= 	$("#email_id").val();
	data['email_confirm'] 		= 	$("#email_confirm_id").val();
	data['gender'] 				= 	$("#gender_id").val();
	data['invite'] 				= 	$("#invite_id").val();
	data['code'] 				= 	$("#code_confirm").val();
	{Des::while}{extrafields}
	data['{$extrafields['name_tag']}']        =   $("#{$extrafields['name_tag']}_id").val();
	{/Des::while}
    data['ajax'] 				= 	1;
	$.post("index.php?page=register&start=1",data,Success);
}

function Wait()
{
	$("#result").html("{$lang['Ongoing_process']}");
}

function Success(xml)
{
	$("#result").html(xml);
}

function Ready()
{
	$("#register_id").click(AjaxRegister);
}

$(document).ready(Ready);
//]]>
</script>

{template}address_bar_part1{/template}
{$lang['register']}
{template}address_bar_part2{/template}


 <div id="result" align="center"><font color="#808000"></font></div>

{/if}

<form name="register" method="post" action="index.php?page=register&amp;start=1">
<table border="0" cellspacing="1" class="border" width="90%" align="center">
	<tr>
		<td width="80%" class="tcat" colspan="2">
		{$lang['Registr_Form']}
		</td>
	</tr>
{if {$_CONF['info_row']['def_group']} == '5'}
	<tr>
		<td width="80%" class="row1" colspan="2">
<b><font color="#CC0066" face="Tahoma" size="1">{$lang['message_activa_registered']}</font></b>
		</td>
	</tr>
{/if}
	<tr>
		<td width="20%" class="row1">
		{$lang['username']}
		</td>
		<td width="30%" class="row1">
			<input type="text" name="username" id="username_id" />
			<span id="result1"></span>
		</td>
	</tr>
	<tr>
		<td width="20%" class="row1">
		{$lang['password']}
		</td>
		<td width="30%" class="row1">
			<input type="password" name="password" id="password_id" />
		</td>
	</tr>
	<tr>
		<td width="20%" class="row1">
		{$lang['password_confirm']}
		</td>
		<td width="30%" class="row1">
			<input type="password" name="password_confirm"  id="password_confirm_id" />
		</td>
	</tr>
	<tr>
		<td width="20%" class="row1">
		{$lang['email']}
		</td>
		<td width="30%" class="row1">
			<input type="text" name="email" id="email_id"  dir="ltr" />
			<span id="result2"></span>
		</td>
	</tr>
	<tr>
		<td width="20%" class="row1">
		{$lang['email_confirm']}
		</td>
		<td width="30%" class="row1">
			<input type="text" name="email_confirm" id="email_confirm_id" dir="ltr" />
		</td>
	</tr>
	{if {$_CONF['info_row']['captcha_o']} == 1 }
<tr>
<td width="20%" class="row1" rowspan="2">{$lang['Image_Verification']}<br />
<font size="1">{$lang['Verification']}</font></td>
		<td width="31%" class="row1">
<input name="code" id="code_confirm" type="text" size="7" dir="ltr"/>

	&nbsp;&nbsp;<img id="turing" src="includes/captcha.php" width="87" height="17"/><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="updateImg();">{$lang['Image_replacement']}</a>
<script type='text/javascript'>
//<![CDATA[

     var clicks = 0;

     function updateImg()
     {
      clicks++
     var doc = document.getElementById("turing");
     doc.src = "includes/captcha.php" + "?act=" + clicks;
     }
//]]>
</script>

</td>
	</tr>
{/if}

</table>
<br />
<table border="0" cellspacing="1" class="border" width="90%" align="center">
		<td width="80%" class="tcat" colspan="2">
		{$lang['mor_information']}
		</td>
	{if {$_CONF['info_row']['active_birth_date']} == 1 }
<tr>
		<td width="20%" class="row1">
		{$lang['Birth_date']}
		</td>
		<td width="30%" class="row1">
{template}birth_date{/template}
		</td>
	</tr>
{/if}
	<tr>
		<td width="20%" class="row1">
		{$lang['user_gender']}
		</td>
		<td width="30%" class="row1">
			<select name="gender" id="gender_id">
				<option value="m" selected="selected">{$lang['gender_m']}</option>
				<option value="f">{$lang['gender_f']}</option>
			</select>
		</td>
	</tr>
	<tr>
		<td width="20%" class="row1">
		{$lang['Registr_invite']}
		<br />
		{$lang['invite_form']}
		</td>
		<td width="30%" class="row1">
			<input type="text" name="invite" value="{$invite}" id="invite_id" />
		</td>
	</tr>

	{Des::while}{extrafields}
	 <tr>
    <td width="20%" class="row1">
    {$extrafields['name']}
    </td>
    <td width="30%" class="row1">
      {$extrafields['type_html']}
      	{if {$extrafields['required']} == 'yes' }
{$lang['required']}
      	{/if}
    </td>
  </tr>

  {/Des::while}
	<tr>
		<td width="70%" class="row1" colspan="2" align="center">
			<strong>{$lang['modify_settings_after_registration']}</strong>
		</td>
	</tr>
	<tr>
		<td width="70%" class="tbar" colspan="2" align="center">
			<div align="center">
{if {$_CONF['info_row']['ajax_register']}}
<input name="register_button" id="register_id" type="button" value="{$lang['Registr_Complete']}"/>
{else}
<input name="register_button" type="submit" value="{$lang['Registr_Complete']}" />
{/if}
</div></td>
	</tr>
</table>
<br />

</form>

<br />