{include file="$gentemplates/$header_tpl"}
<div class="mailbox">
	<h2>{$lang.section.email}</h2>		
	
	{*if $form.err}
		<p class="error_msg">*&nbsp;{$form.err}</p>
	{/if*}
	
	<!-- begin top menu table -->
	{strip}
	<!-- main tabs -->	
	<div class="main_tabs">
		<div class="tab_block first active">
			<a href="{$form.inbox_link}" onclick="">{$lang.mailbox.inbox}&nbsp;({$form.inbox_new}/{$form.inbox_all})</a>
		</div>
		<div class="tab_block" >
			<a href="{$form.outbox_link}" onclick="">{$lang.mailbox.outbox}&nbsp;({$form.outbox_all})</a>
		</div>
		<div class="tab_block">
			<a href="{$form.write_link}" onclick="">{$lang.mailbox.compose}</a>
		</div>
	</div>
	<!-- end main tabs -->		
	{/strip}
		
	<form style="padding-top:10px;" action="{$delete_after_form.action}" enctype="multipart/form-data" method="post" name="delete_after_form">
		{$delete_after_form.hiddens}
		<div>
			<input type="checkbox" name="delete_after_form_status" value="1" {if $delete_after_form.status}checked="checked"{/if} onclick="javascript: switchForm(document.delete_after_form);"/>
			{$lang.mailbox.delete_after_comment}
			<input type="text" style="height:19px;" size="3" name="delete_after_form_amount" value="{$delete_after_form.amount}"  {if !$delete_after_form.status}disabled="disabled"{/if}/>
			<select style="height: 21px; margin-top:0px;" name="delete_after_form_period" {if !$delete_after_form.status}disabled="disabled"{/if}>
				<option value="day" {if $delete_after_form.period == 'day'}selected="selected"{/if}>{$lang.periods.day}</option>
				<option value="month" {if $delete_after_form.period == 'month'}selected="selected"{/if}>{$lang.periods.month}</option>
				<option value="year" {if $delete_after_form.period == 'year'}selected="selected"{/if}>{$lang.periods.year}</option>
			</select>
			<a href="#" onClick="javascript: checkForm(document.delete_after_form);">{$lang.button.save}</a>
		</div>
	</form>
	<script type="text/javascript">
		{literal}
			function checkForm(form){
				amount = form.delete_after_form_amount.value = parseInt(form.delete_after_form_amount.value);
				if (isNaN(amount)){
					alert('{/literal}{$lang.mailbox.wrong_amount|escape:javascript}{literal}');
					return false;
				}else{
					form.submit();
				}
			}
			function switchForm(form){
				if (form.delete_after_form_status.checked){
					form.delete_after_form_amount.disabled = false;
					form.delete_after_form_period.disabled = false;
				}else{
					form.delete_after_form_amount.disabled = true;
					form.delete_after_form_period.disabled = true;
				}
			}
		{/literal}
	</script>
	<!-- begin message list -->
	{strip}
	<div style="width:100%;padding-top:10px;">
		{if !$maillist}
			<p class="error">{$lang.mailbox.empty}</p>
		{else}
			<div style="display:table;width:100%;">					
				{include file="$gentemplates/pagination_top.tpl"}
			</div>
			<form action="{$form.action}" method="post" name="mailbox_form">
				{$form.hidden}
				<div class="mailbox_table">
				{section name=s loop=$maillist}					
					<dl class="dl_line text{if $maillist[s].new}_head{/if}">
						<dd style="width: 35px">
						{if $maillist[s].attach eq 1}
							{if $maillist[s].new}
								<img src="{$site_root}{$template_root}{$template_images_root}/message_unread_icon_attach.gif" border="0" alt="" vspace="0" hspace="0">
							{else}
								<img src="{$site_root}{$template_root}{$template_images_root}/message_read_icon_attach.gif" border="0" alt="" vspace="0" hspace="0">
							{/if}
						{else}
							{if $maillist[s].new}
								<img src="{$site_root}{$template_root}{$template_images_root}/message_unread_icon.gif" border="0" alt="" vspace="0" hspace="0">
							{else}
								<img src="{$site_root}{$template_root}{$template_images_root}/message_read_icon.gif" border="0" alt="" vspace="0" hspace="0">
							{/if}
						{/if}
						</dd>
						<dd style="width: 150px; -o-text-overflow: ellipsis; text-overflow: ellipsis; overflow: hidden;">{$maillist[s].from}</dd>
						<dd style="width: 420px"><a href="{$maillist[s].read_link}">{if $maillist[s].subject eq ''}{$lang.mailbox.subject}{else}{$maillist[s].subject}{/if}</a></dd>
						<dd style="width: 120px">{$maillist[s].date}&nbsp;{$maillist[s].time}</dd>
						<dd style="width: 14px"><input type="checkbox" name="delete[{$smarty.section.s.index}]" value="{$maillist[s].id}"></dd>
					</dl>					
				{/section}
				<dl>					
					<dd class="button float_left" style="padding-top: 10px; width:100%;text-align:{$default_right};float:{$default_right};margin-{$default_right}:10px;">
						<input type="button" class="index_btn" onclick="javascript: document.forms['mailbox_form'].submit();" value="{$lang.button.delete}">
					</dd>
				</dl>
				</div>
				</form>
				{include file="$gentemplates/pagination_bottom.tpl"}
			{/if}
		</div>		
		
	</div>  							  
	{/strip}
{include file="$gentemplates/$footer_tpl"}