{if $ajax eq 0}
	{include file="$admin_nl_gentemplates/admin_nl_site_head.tpl"}
	<div class="user_operation_line">
        <div class="uol_item" onclick="javascript: location.href='change.php?id=0'">
            <div class="uol_in_item">{$lang.newsletter.button.create}</div>
        </div>        
			{if $amount >= 1}
        <div class="uol_item" onclick="DelItems('ListForm')">
            <div class="uol_in_item">{$lang.newsletter.button.del_selected}</div>
        </div>        
			{/if}
	</div>
	<div class="cr"></div>
	<br/><br/><br/><br/>
	<form name="ListForm" action="index.php" enctype="application/x-www-form-urlencoded" method="post" style="margin:0px">
	{if $amount > 0}
		<table cellpadding="2" cellspacing="2" width="100%" border="0">
		<tr>
			<td align="left">{$lang.newsletter.lists.total_lists}: {$amount}</td>
			<td align="center" width="50%">&nbsp;</td>
			<td align="right">{$lang.newsletter.on_page}: 
				<select name="list_page" style="width:auto" onChange="document.location='index.php?list_page=' + document.ListForm.list_page.value">
					{html_options values=$list_page_values selected=$list_page output=$list_page_output}
				</select>
			</td>
		</tr>
		</table>
		<br>
	{/if}
{/if}
<div id="tooltip" onclick="hideToolTip()" style="text-align:center; background-color: #FEF2CB; border: 1px dotted; text-align: {$default_left}; position:absolute; display:none; padding:5px;"></div>
{literal}
<script type="text/javascript">
$(function() {
$('#tool_tip_4 *').tooltip();
});
</script>
{/literal}
<div id="users_table_div" style="width:100%;">
		<table border=0 class="table_main" cellspacing=0 cellpadding=5 width="100%">
		<tr class="table_header">
{*			<td align=center width="1%">&nbsp;</td>*}
			<td align=center width="1%">
				<input type="checkbox" id="select_all" name="select_all" onclick="PutAll()">
				<!--<a href="#" title='Select all items on page' href="#" onClick="setCheckboxes('ListForm',true)">{$lang.newsletter.all}</a><br>
				<a title='Untick the items' href="#" onClick="setCheckboxes('ListForm',false)">{$lang.newsletter.none}</a>-->
			</td> 
			<td align=left width="15%" onclick="PageList('users_table_div','ajax=1&order=name&list_page={$list_page}')">
				<a title="{$lang.newsletter.lists.by_list_name}">
					{$lang.newsletter.lists.list_name}
				</a>
				{if $order == "name" and $end == ""} 
					<img src="{$site_root}{$template_root}/images/newsletter/arrow_up.gif" border="0" height="8"> 
				{elseif $order == "name" and $end <> ""} 
					<img src="{$site_root}{$template_root}/images/newsletter/arrow_down.gif" border="0" height="8">{/if}
			</td>
			<td align=center width="10%" onclick="PageList('users_table_div','ajax=1&order=date&list_page={$list_page}')">
				<a title="{$lang.newsletter.lists.by_date_created}">
					{$lang.newsletter.lists.date_created}
				</a>
				{if $order == "date" and $end == ""}
					<img src="{$site_root}{$template_root}/images/newsletter/arrow_up.gif" border="0" height="8"> 
				{elseif $order == "date" and $end <> ""} 
					<img src="{$site_root}{$template_root}/images/newsletter/arrow_down.gif" border="0" height="8">
				{/if}
			</td>
			<td align=center width="10%">{$lang.newsletter.lists.site_status}</td>
			<td align=center width="10%">{$lang.newsletter.lists.subscribers}</td>
			<td align=right width="19%" style="padding-right:20px;">{$lang.newsletter.lists.action}</td>
		</tr>
		   
		{section name=c loop=$rel}
		<tr {if $smarty.section.c.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if} height=20>
{*			<td align=center><img src="{$site_root}{$template_root}/images/newsletter/list.gif" width="16" height="13"></td>*}
			<td align=center><input name="del[]" type="checkbox" value="{$rel[c].id}"></td>						
			<td align=left>{$rel[c].name}</td>
			<td align=center>{$rel[c].date}</td>
			<td align=center>{if $rel[c].site_status}+{else}-{/if}</td>
			<td align=center>
			{if $rel[c].count >= 1}
				<a onclick="document.location='{$server}/admin/newsletter/users/index.php?lid={$rel[c].id}'"> {$rel[c].count}</a>
			{/if}
			</td>
			<td align=center>	
					<!--<table cellspacing=1 cellpadding=0 width="100%"><tr>
					<td>
						<a class="admin_button" onclick="document.location='{$server}/admin/newsletter/forms/create1.php?lid={$rel[c].id}'">{$lang.newsletter.lists.subscr_form}<span>&nbsp;</span></a>
					</td>

					<td>
						<a class="admin_button" onclick="document.location='change.php?id={$rel[c].id}'">{$lang.newsletter.button.edit}<span>&nbsp;</span></a>
					</td>
					<td>
						<a class="admin_button" onclick="if (confirm('{$lang.newsletter.lists.conf_del_all_subscr|escape:javascript}'))document.location='index.php?clear_id={$rel[c].id}'">{$lang.newsletter.button.clear}<span>&nbsp;</span></a>
					</td>

					<td>
						<a class="admin_button" onclick="if (confirm('{$lang.newsletter.lists.conf_del_list|escape:javascript}')) document.location='index.php?did={$rel[c].id}'">{$lang.newsletter.button.delete}<span>&nbsp;</span></a>
					</td>
					<td>
						<a class="admin_button" onclick="if (confirm('{$lang.newsletter.lists.conf_del_subscr_and_lists|escape:javascript}'))document.location='index.php?erase_id={$rel[c].id}'">{$lang.newsletter.button.erase}<span>&nbsp;</span></a>
					</td>
					</tr></table>-->
					<!-- subscr_form, edit, clear, delete, erase -->
				<div class="block_action fr" style="display: none;">
					<!-- erase -->
					<div class="action_del" style="display: block;float:left;">
						<img width="16" alt="" src="{$site_root}{$template_root}/images/newsletter/icn_clear.png " onclick="if (confirm('{$lang.newsletter.lists.conf_del_subscr_and_lists|escape:javascript}'))document.location='index.php?erase_id={$rel[c].id}'" onmouseover=doTooltip(event,58.7) onmouseout=hideTip()>
					</div>
					<div style="width:10px;" class="fl">&nbsp;</div>
					<!-- subscr_form -->
					<div class="action_edit" style="display: block;float:left;">
						<img width="16" alt="" src="{$site_root}{$template_root}/images/icn_admin_giftshop_orders.png" onclick="document.location='{$server}/admin/newsletter/settings.php?flag=1'" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.newsletter.lists.subscr_form}');return false">
					</div>
					<div style="width:10px;" class="fl">&nbsp;</div>
					
					<!-- edit -->
					<div class="action_edit" style="display: block;float:left;">
						<img width="16" alt="" src="{$site_root}{$template_root}/images/edit.png" onclick="document.location='change.php?id={$rel[c].id}'" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.edit}');return false">
					</div>
					<div style="width:10px;" class="fl">&nbsp;</div>
					
					<!-- clear -->
					<div class="action_del" style="display: block;float:left;">
						<img width="16" alt="" src="{$site_root}{$template_root}/images/newsletter/icn_clear.png" onclick="if (confirm('{$lang.newsletter.lists.conf_del_all_subscr|escape:javascript}'))document.location='index.php?clear_id={$rel[c].id}'" onmouseover=doTooltip(event,58.8) onmouseout=hideTip()>
					</div>
					<div style="width:10px;" class="fl">&nbsp;</div>
					
					<!-- delete -->
					<div class="action_del" style="display: block;float:left;">
						<img width="16" alt="" src="{$site_root}{$template_root}/images/photo_delete.png" onclick="if (confirm('{$lang.newsletter.lists.conf_del_list|escape:javascript}')) document.location='index.php?did={$rel[c].id}'" onmouseover=doTooltip(event,58.5) onmouseout=hideTip()>
					</div>
				</div>
			</td>
		</tr>
		{sectionelse}
			<tr height="40">
				<td class="main_error_text" bgcolor="#FFFFFF" align="left" colspan="6">{$lang.newsletter.lists.no_lists}</td>
			</tr>
		{/section}
		
		<tr class="table_header">
		<!--<td align="left">{$lang.newsletter.on_page}: 
			<select name="list_page1" style="width:auto" onChange="document.location='index.php?list_page=' + document.ListForm.list_page.value">
				{html_options values=$list_page_values selected=$list_page output=$list_page_output}
			</select>
		</td>-->
			<td class="listHeader" colspan="6">
				{*$navigation*}
				{foreach item=item from=$navigation.pages}
					&nbsp;<a onclick="PageList('users_table_div', '{$item.link}');" class="page_link" {if $item.selected} style=" font-weight: bold; text-decoration: none;" {/if}>{$item.name}</a>&nbsp;
				{/foreach}	
				<div class="page_navigation">
					{if $navigation.previous}
						<a onclick="PageList('users_table_div', '{$navigation.previous}');">< {$lang.content.previous} {$per_page}</a>
					{/if}
					{if $navigation.next}
						<a onclick="PageList('users_table_div', '{$navigation.next}');">{$lang.content.next} {$per_page} ></a>
					{/if}
				</div>
			</td>
		<!--<td align="right">{$lang.newsletter.lists.total_lists}: {$amount}</td>-->
		</tr>
	</table>
</div>
</form>
{*{if $amount <= 0}
	<div align="center" ><strong>{$lang.newsletter.lists.conf_del_subscr_and_lists}</strong></div>
{/if}*}
{if $ajax eq 0}
{include file="$admin_nl_gentemplates/admin_nl_site_foot.tpl"}
{/if}
<script type="text/javascript">
{literal}
		function showToolTip(e,text){
			if(document.all)e = event;
			var obj = document.getElementById('tooltip');
			obj.innerHTML = text;
			obj.style.display = 'block';
			var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
			if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
			var leftPos = e.clientX - $('#tooltip').width()-10;
			if(leftPos<0)leftPos = 0;
			obj.style.left = leftPos + 'px';
			obj.style.top = e.clientY - obj.offsetHeight +40 + st + 'px';
		}
		function hideToolTip(){
			document.getElementById('tooltip').style.display = 'none';
		}
{/literal}		
</script>		
{literal}
<script language="JavaScript" type="text/JavaScript">
function DelItems(the_form) {
    var elts       = document.forms[the_form].elements['del[]'];
	var is_ok = false;
    var elts_cnt = 0;

	if (typeof(elts.length) != 'undefined') {
		elts_cnt = elts.length
		for (var i = 0; i < elts_cnt; i++) {
            if (elts[i].checked) {		
				is_ok = true;
				break;
			}
        }
	}	
	else if (typeof(elts.value) != 'undefined') {
		if (elts.checked) {		
			is_ok = true;			
		}	
	}
	if (is_ok) {
		if (confirm('{/literal}{$lang.newsletter.lists.conf_del_lists|escape:javascript}{literal}')) document.forms[the_form].submit();
	}
	else alert('{/literal}{$lang.newsletter.lists.list_not_chosen|escape:javascript}{literal}');
	return false;
}

function PutAll() {
         var o=document.getElementsByName('select_all')	
         var i
         if (o[0].checked){                    
            o=document.getElementsByName('del[]')
            for (i=0; i<o.length; i++){                
                if (!o[i].disabled)
                    o[i].checked = true
            }            
         }
         else{
            o=document.getElementsByName('del[]')
            for (i=0; i<o.length; i++){                
                o[i].checked = false
            }            
         }             
}
function PageList(id_div, par) {
	ajaxLoadingImage(1, 'users_table_div');
	$.post("index.php", par, function(data){
		ajaxLoadingImage(0, 'users_table_div');
		$('#users_table_div').html(data);
	});
}


</script>
{/literal}