{include file="$gentemplates/$header_tpl"}

{literal}
<SCRIPT language="JavaScript" type="text/javascript">
<!--
 var ptn_empty=/^\s*$/;
 var ptn_email=/^\s*\w+([\.\w\-]+)*\w@\w+([\.\w\-]+)*\w\.\w{2,}\s*$/;

 function check_empty(field, name)
 {
    if (!field.value || ptn_empty.test(field.value))
    {
{/literal}
        error = "'"+name+"' {$lang.affiliate.empty_error|escape:javascript}";
{literal}
        alert(error); field.focus(); field.select();
        return false;
    }
    return true;
 }

 function check(field, pattern, name)
 {
    if (field.value && pattern.test(field.value) == false)
    {
{/literal}
        error = "'"+name+"' {$lang.affiliate.incorrect_error|escape:javascript}";
{literal}
        alert(error); field.focus(); field.select();
        return false;
    }
    return true;
 }

 function check_profile()
 {
 	save_form_obj = document.save_form;
{/literal}
    res = (check_empty(save_form_obj.FullName, '{$lang.affiliate.full_name}')
     && check_empty(save_form_obj.Email, '{$lang.affiliate.email}')
     && check_empty(save_form_obj.Address, '{$lang.affiliate.address}')
     && check_empty(save_form_obj.City, '{$lang.affiliate.city}')
     && check_empty(save_form_obj.State, '{$lang.affiliate.state}')
     && check_empty(save_form_obj.Zip, '{$lang.affiliate.zip}')
     && check_empty(save_form_obj.Country, '{$lang.affiliate.country}')
     && check(save_form_obj.Email, ptn_email, '{$lang.affiliate.email}'));
{literal}
    if (res == false) return false;
    if (save_form_obj.change_password.checked) {
{/literal}
     res = (check_empty(save_form_obj.password1, '{$lang.affiliate.password}') && check_empty(save_form_obj.password2, '{$lang.affiliate.retype_password}'));
{literal}
     if (res == false) return false;
     if (save_form_obj.password1.value != save_form_obj.password2.value)
     {
{/literal}
        error = "{$lang.affiliate.pass_not_equal|escape:javascript}";
{literal}
        alert(error); save_form_obj.password1.focus(); save_form_obj.password1.select();
        return false;
     }
    }
    return true;
 }

//-->
</SCRIPT>
{/literal}
<h2>{$lang.affiliate.razdel_name}</h2>
{include file="$aff_gentemplates/aff_menu.tpl"}

{*if $error}<p class="error_msg">*&nbsp;{$error}</p>{/if}
{if ($msg)}<p class="error_msg">*&nbsp;{$msg}</p>{/if}
{if ($msg_sent)}<p class="error_msg">*&nbsp;{$msg_sent}</p>{/if*}

<h3 class="p-b5">{$lang.affiliate.edit_profile}</h3>

<form action="aff_profile.php" method="POST" name="save_form" style="margin:0px">
<input type="hidden" name="action" value="Save">
<!-- begin profile form -->
<p>
	{$lang.affiliate.username}:<br />
	{$login}
</p>
<p>
	{$lang.affiliate.password}:<br />
	<input type="password" name="password1" maxlength="15" size=30 />
	<input type="checkbox" name="change_password" value=1>&nbsp;{$lang.affiliate.change_password}
</p>
<p>
	{$lang.affiliate.retype_password}:<br />
	<input type="password" name="password2" maxlength="15" size=30 />
</p>
<p>
	{$lang.affiliate.full_name}: *<br />
	<input type="text" name="FullName" value="{$fullname}" maxlength="100" size=30 />
</p>
<p>
	{$lang.affiliate.email}: *<br />
	<input type="text" name="Email" value="{$email}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.web_site}:<br />
	<input type="text" name="Web_site" value="{$web_site}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.unique_month_visitors}:<br />
	<input type="text" name="Unique_v" value="{$unique_v}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.address} *<br />
	<input type="text" name="Address" value="{$address}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.city}: *<br />
	<input type="text" name="City" value="{$city}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.state}: *<br />
	<input type="text" name="State" value="{$state}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.zip}: *<br />
	<input type="text" name="Zip" value="{$zip}" size="8" maxlength="10">
</p>
<p>
	{$lang.affiliate.country} *<br />
	<input type="text" name="Country" value="{$country}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.phone}<br />
	<input type="text" name="Telephone" value="{$telephone}" maxlength="64" size=30>
</p>
<p>
	{$lang.affiliate.bank}<br />
	<textarea name="Bank" cols=45 rows=5>{$bank}</textarea>
</p>
<p>
	<input type="button" class="button" onclick="javascript: if (check_profile()) document.save_form.submit(); else return false;" value="{$lang.button.save}"></TD>
</p>
<!-- end profile form -->
</form>

<h3 class="p-b5">{$lang.affiliate.messages}</h3>

<form action="aff_profile.php" method="POST" name="send_form" style="margin:0px">
<input type="hidden" name="action" value="Send">
	<!-- begin messages form -->
	{*if $page_links}
		<p>
		<b>{$lang.affiliate.pages}:</b>
		{section name=c loop=$page_links}
			<a href={$page_links[c].url}>{$page_links[c].text}</a>&nbsp;
		{/section}
		</p>
	{/if}
	{section name=num loop=$messages}
		<p>
			[{$messages[num].date}]&nbsp;&lt;<b>{$messages[num].sender}</b>&gt;&nbsp;&lt;<b>{$messages[num].recipient}</b>&gt;<br />
			&nbsp;{$messages[num].body}
		</p>
	{sectionelse}
		<p>
			{$lang.affiliate.no_messages}
		</p>
	{/section*}
	<p>		
		{$lang.affiliate.send_message_to} {$lang.affiliate.admin}:<br />
		<textarea rows="10" cols="80" name="message"></textarea>
		<!-- end messages form -->
	</p>
	<p>
		<input type="button" class="button" onclick="javascript: document.send_form.submit();" value="{$lang.button.send}">
	</p>
</form>

{include file="$gentemplates/$footer_tpl"}