{include file="$gentemplates/$header_tpl"}
<div class="profile_general_table">
<div>
    <h2>{$lang.section.account}</h2>
	<p>{$lang.account.toptext}</p>	
	<!-- begin homepage table -->
	{strip}
	<!-- begin info section -->
	<h3 class="p-b5">{$lang.account.subheader_info}</h3>
	
	
	<div class="account">
		<dl style="padding-top:0px;">
			<dt>{$lang.account.info_login}:</dt>
			<dt>{$data.login}</dt>
		</dl>
		<dl>
			<dt>{$lang.account.info_email}:</dt>
			<dt style="{if $account_homepage.err && ($confirm_err || $status_err)}width:570px;{/if}">
				{if $account_homepage.err}				
					{if $confirm_err || $status_err}					
					<div class="search_form_hide_show" style="width:100%;padding:10px;">						
						<div class="error_msg" id="err_confirm"></div>
						<div>
							{if $confirm_err}
								{$lang.account.alert_header_confirm}<br/>
								{$lang.account.confirm_link}{/if}
						</div>
						{if $confirm_err}
						<div>
							<input type="text" name="email" id="email" size="45" value="">&nbsp;
							<input type="button" class="button" value="{$lang.button.send}" onclick="SendConfirm();">
							<!--&nbsp;&nbsp;&nbsp;<a onclick="$('.search_form_hide_show').css('display','none'); ">{$lang.button.vip_cancel}</a>-->
						</div>	
						{/if}
							{if $status_err}<p>{$link}</a></p>{/if}
					</div>
					{/if}
				{else}					
					<span id="mail">{$data.email}</span>
				{/if}
			</dt>
			<dd>
				{if $account_homepage.err}				
				{else}
					<a href="{$data.modify_profile_link}">{$lang.button.edit}</a>
				{/if}
			</dd>
		</dl>
		<dl>
			<dt>{$lang.account.info_password}:</dt>
			<dt>&nbsp;******</dt>
			<dd><a href="{$data.modify_link}">{$lang.button.edit}</a></dd>
		</dl>
		
		<!--<p>
			<a href="#" onclick="javascript: if (window.confirm('{$header.info_delete_confirm|escape:javascript}')) document.location='{$data.delete_link}'; else return false;">{$header.info_delete}</a>
		</p>
		{if $data.use_hide_profile_feature}
			<p><a href="{$data.switch_link}">{$data.info_switch}</a></p>
			<p>{$data.info_switch_comment}</p>
		{/if}-->
	</div>
	<!-- end info section -->
	{/strip}
		
	{if $form.use_account}
	{strip}
	<!-- begin account section -->
		<h3 class="p-b5">{$lang.account.subheader_account}</h3>
		{if $refer_comment}
			<p>{$refer_comment}</p>
		{/if}
		<div class="account" style="padding-top: 20px;">
			<table border="0">
				<tr style="height: 40px;">
					<td width="30%">{$lang.account.account_count}:</td>
					<td width="50%">{$data.count}&nbsp;{$data.account_currency}</td>
					<td width="20%"><a href="#" onclick="document.location.href='{$site_root}/{$seo.payment}?sel=update_account';">{$lang.button.update_account}</a></td>
				</tr>
				<tr style="height: 40px;">
					<td>{$lang.account.account_groups}:</td>
					<td>{$data.groups}</td>
					<td style="width:141px;"><a href="#" onclick="document.location.href='{$data.groups_link}';">{$lang.button.update_memeberships}</a></td>
				</tr>
				<tr style="height: 40px;">
					<td>{$lang.account.account_period}:</td>
					<td colspan="2">{if $data.period eq ' - '}{$lang.account.unlimited}{else}{$data.period}{/if}</td>
				</tr>
				<tr style="height: 40px;">
					<td>{$lang.account.account_period_rest}:</td>
					<td colspan="2">{$data.rest}&nbsp;{$lang.account.account_period_day}</td>
				</tr>
			{if $use_promo_codes}
				<tr style="height: 40px;">
					<td>{$lang.promo_code.have_promo_code}&nbsp;</td>
					<td style="width:500px;">
					<form name="code" action="{$site_root}/{$seo.account}" method="post">
						<div>
							<div class="float_left" style="width:140px;">
								<input type="hidden" name="sel" value="use_code" />
								<input id="code_id" name="code" type="text" size="8" />&nbsp;
							</div>
							<a class="float_left" href="#" onclick="checkCode();">{$lang.button.check}</a>
						</div>
					</form>
					</td>
				</tr>
			{/if}
			</table>
		</div>
	<!-- end account section -->
	{/strip}
	{/if}
		
	<!-- begin my alert section -->
	{strip}
	<div class="account">
		<form action="{$form.action}" method="post">
		<h3 class="p-b5">{$lang.account.subheader_myalerts}</h3>
		<!-- alerts  -->
		{$form.alerts_hiddens}		
		{section name=n loop=$my_alerts_email}
                {if $my_alerts_email[n].id!=1}
		<p><input type="checkbox" id="my_alerts_email[{$smarty.section.n.index}]" name="my_alerts_email[{$smarty.section.n.index}]" value="{$my_alerts_email[n].id}" {if $my_alerts_email[n].check}checked{/if}>
			&nbsp;<label for="my_alerts_email[{$smarty.section.n.index}]">{$my_alerts_email[n].name}</label>
		</p>
                {/if}
		{/section}<p><input type="submit" class="index_btn" value="{$lang.button.gr_valider}"></p>
		</form>
	</div>
	{if $use_pilot_module_sms_notifications}
	<div class="account">
		<form action="{$form.action}" method="post">	
			<input type="hidden" name="sel" value="sms_notification">
			<!-- begin sms notifications -->
		
				<h3 class="p-b5" style="padding-top: 15px;">{$sms_notifications.sms_subscribtion}</h3>
				{if !$sms_balance}
					<p>
					{$sms_notifications.empty_sms_balance}&nbsp;<a href='{$link_to_sms}' target="_blank">{$sms_notifications.want_sms_link}</a>
					</p>
				{else}
					{foreach from=$sms_cases item=item key=key}
					{assign var=lang_str value=about_$item}
					<p>
						<input type="checkbox" id="sms_price_{$key}" name="sms_price[{$key}]" {if $sms_user_event[$key]}checked{/if}>
						<label for="sms_price_{$key}">
							&nbsp;{$sms_notifications[$lang_str]}
						</label>
					</p>
					{/foreach}
				<p>
					<a href='{$link_to_sms}' target="_blank">{$sms_notifications.sms_more_info}</a>
				</p>
				{/if}
		
			<!-- end sms notifications -->
			<p><input type="submit" class="index_btn" value="{$lang.button.gr_valider}"></p>
		</form>
	</div>
	{/if}							
	<div class="account">
		<form action="{$form.action}" method="post" style="margin: 0px;">
		<input type="hidden" name="sel" value="notifications">
		<h3 class="p-b5">{$lang.account.subheader_mynotifications}</h3>									
		{foreach from=$notifications item=item}
		{if $item.name == "new_messages"}
			{if $use_mailbox == "1"}
				<p>
					<input type="checkbox" name="{$item.name}" value="{$item.id}" {$item.checked}>&nbsp;{$item.description}
				</p>
			{/if}
		{else}
			<p>
				<input type="checkbox" name="{$item.name}" value="{$item.id}" {$item.checked}>&nbsp;{$item.description}
			</p>
		{/if}
		{/foreach}
		<p><input type="submit" class="index_btn" value="{$lang.button.gr_valider}"></p>
		</form>
	</div>
	{/strip}
	<!-- end my alert section -->
		
{if $alerts || $adm_subscr}
	{if $adm_subscr}
		
	{strip}
	<!-- begin subscriber section -->
	<h3 class="p-b5">{$lang.account.subheader_subscribe}</h3>
	<div>
		<form action="{$form.action}" method="post" style="margin:0px">
		{$form.subscribe_hiddens}
		
		{section name=n loop=$adm_subscr}
		<p><input type="checkbox" name="a_subscr[{$smarty.section.n.index}]" value="{$adm_subscr[n].id}" {if $adm_subscr[n].check}checked{/if}>
			&nbsp;{$adm_subscr[n].name}
		</p>
		{/section}
		<p>
			<input type="submit" class="index_btn" value="{$lang.button.gr_valider}">
		</p>
		</form>
	</div>
	<!-- end subscriber section -->
	{/strip}
		
	{/if}
	{if $alerts}
		{strip}
		<!-- begin system alerts section -->
			<h3 class="p-b5">{$lang.account.subheader_alerts}</h3>
			<div>
				<div>
				{section name=n loop=$alerts}
				<dl>
					<dd style="padding-top: 5px;" class="text"><div><b>{$alerts[n].date}</b></div><font class="text">{$alerts[n].text} ({$alerts[n].type})</font></dd>
				</dl>
				{/section}
				</div>
			</div>
		<!-- end system alerts section -->
		{/strip}
	{/if}
{/if}
</div>
<!-- end homepage table -->
  							
	{* {if $banner.right}<div style="float: left;">{$banner.right}</div>{/if}	*}
		
<script type="text/javascript">
{literal}
function checkCode(){
    var code = $("#code_id").val();
    var str = 'ajax=1&code='+code;
    $.post("{/literal}{$site_root}/{$seo.account}{literal}?sel=check_code",str, function(data){	
        var resp = getJQData(data);
        if (!resp) return;
        if (resp['code'] == 1){
            if (confirm(resp['msg']))
                $("form[name=code]").submit();
        }else{
            alert(resp['msg']);
        }
    });
}
function SendConfirm() {
	email = $("#email").val();
	var re = /^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$/;
	if (!email.match(re)) {
		$("#err_confirm").text('{/literal}{$lang.homepage.confirm_err_mail|escape:html}{literal}');
		$('.search_form_hide_show').css('display','none');
		return;
	} else {
		$.post(SEO_SITE_ROOT + "/backend.php",{sel:'confirm',email:email}, function(data){$("#err_confirm").text(data)});
	}
}
{/literal}
</script>
{include file="$gentemplates/$footer_tpl"}