{if $ajax eq 0}
	{include file="$admin_nl_gentemplates/admin_nl_site_head.tpl"}
{/if}
	<div class="user_operation_line">
	<div class="cr"></div>

{*        <div class="uol_item" onclick="javascript: location.href='create1.php'">*}
		<div class="uol_item" onclick="ShowBlock('show_block','forms/create1.php?ajax=1');">
            <div class="uol_in_item">{$lang.newsletter.forms.create_form}</div>
        </div>        
		{if $amount >= 1}
        <div class="uol_item" onclick="DelItems('FormForm')">
            <div class="uol_in_item">{$lang.newsletter.button.delete_selected}</div>
        </div>        	
		{/if}
	</div>
	<div class="user_status_line">
        <div id="tab_1" class="user_status_elem" onclick="ShowEditor('1','settings.php?ajax=1');">
            <a>{$lang.admin_menu.nl_general}</a>
        </div>
        <div id="tab_2" class="user_status_elem" onclick="ShowEditor('2','template/index.php?ajax=1');">
            <a>{$lang.admin_menu.nl_templates}</a>
        </div>
        <div id="tab_3" class="user_status_elem_active" onclick="ShowEditor('3','forms/index.php?ajax=1');">
            {$lang.admin_menu.nl_forms}
        </div>
        <div id="tab_4" class="user_status_elem" onclick="ShowEditor('4','attaches/index.php?ajax=1');">
            <a>{$lang.admin_menu.nl_attachments}</a>
        </div>
        <div id="tab_5" class="user_status_elem" onclick="ShowEditor('5','smtp_servers/index.php?ajax=1');">
            <a>{$lang.admin_menu.nl_smtp_servers}</a>
        </div>
        <div class="cr"></div>
        <div class="panel_subtabs" style="width: 100%;">
        	<div class="panel_content" style="width: 100%; margin:0px;">
	<form name="FormForm" class="FormForm" id="FormForm" action="forms/index.php?ajax=1" enctype="application/x-www-form-urlencoded" method="post" style="margin:0px">
	
	{if $amount > 0}
		<table cellpadding="2" cellspacing="2" width="100%" border="0" style="margin-top:5px">
		<tr>
			<td align="left">{$lang.newsletter.forms.total_forms}: {$amount}</td>
			<td align="center" width="50%">&nbsp;</td>
			<td align="right">{$lang.newsletter.on_page} : 
				<select name="form_page" style="width:auto" onChange="ShowBlock('show_block', 'forms/index.php?form_page=' + document.FormForm.form_page.value + '&id={$rel[c].id}&ajax=1')">
					{html_options values=$form_page_values selected=$form_page output=$form_page_output}
				</select>
			</td>
		</tr>
		</table>
	{/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 cellspacing=0 cellpadding=0 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 title='{$lang.newsletter.button.select_all_on_page}' href="#" onClick="setCheckboxes('FormForm',true)">{$lang.newsletter.forms.all}</a><br>
			<a title='{$lang.newsletter.forms.untick_items}' href="#" onClick="setCheckboxes('FormForm',false)">{$lang.newsletter.forms.none}</a>-->
		</td> 
		<td align=left width="25%" onclick="PageList('users_table_div','ajax=1&order=name&form_page={$form_page}')">
			<a title="{$lang.newsletter.forms.sort_form_name}">
			{$lang.newsletter.forms.form_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=left width="25%" onclick="PageList('users_table_div','ajax=1&order=type&form_page={$form_page}')">
			<a title="{$lang.newsletter.forms.form_name}">
				{$lang.newsletter.forms.form_name}
			</a>
			{if $order == "type" and $end == ""} 
				<img src="{$site_root}{$template_root}/images/newsletter/arrow_up.gif" border="0" height="8"> 
			{elseif $order == "type" and $end <> ""} 
				<img src="{$site_root}{$template_root}/images/newsletter/arrow_down.gif" border="0" height="8">
			{/if}                            
		</td>
		<td align=center width="16%" onclick="PageList('users_table_div','ajax=1&order=date&form_page={$form_page}')">
			<a title="{$lang.newsletter.forms.by_date_created}">
				{$lang.newsletter.forms.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=right width=20%>{$lang.newsletter.forms.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 height=20 width=4%>
			<img src="{$site_root}{$template_root}/images/newsletter/form.gif" width="16" height="13">
		</td>*}
		<td align=center><input name="del[]" type="checkbox" value="{$rel[c].id}"></td>						
		<td width=25% align=left>{$rel[c].name}</td>
		<td align=left width=25%>{$rel[c].type}</td>
		<td align=center width=16%>{$rel[c].date}</td>
		<td align=center width=30%>
				<!--<table cellspacing=1 cellpadding=0 width="100%"><tr>
				<td>
					<a class="admin_button" onCLick="window.open('view.php?id={$rel[c].id}','', 'resizable=yes,scrollbars=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,width=400,height=200,left=0,top=0');">{$lang.newsletter.button.view}<span>&nbsp;</span></a>
				</td>
				<td>
					<a class="admin_button" onclick="document.location='code.php?id={$rel[c].id}'">{$lang.newsletter.button.get_html}<span>&nbsp;</span></a>
				</td>
				<td>
					<a class="admin_button" onclick="document.location='create1.php?id={$rel[c].id}'">{$lang.newsletter.button.edit}<span>&nbsp;</span></a>
				</td>
				<td>
					<a class="admin_button" onclick="if (confirm('{$lang.newsletter.forms.confirm_forms_del|escape:javascript}')) document.location='index.php?did={$rel[c].id}'">{$lang.newsletter.button.delete}<span>&nbsp;</span></a>
				</td>
				</tr></table>-->				
			<!-- view, get_html, edit, delete -->
			<div class="block_action fr" style="display: none;">
				<!-- view -->
				<div class="action_edit" style="display: block;float:left;">
					<img width="16" alt="" src="{$site_root}{$template_root}/images/icn_view.png" onCLick="window.open('forms/view.php?id={$rel[c].id}','', 'resizable=yes,scrollbars=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,width=600,height=400,left=0,top=0');" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.view}');return false">
				</div>
				<div style="width:10px;" class="fl">&nbsp;</div>
				
				<!-- get_html -->
				<div class="action_edit" style="display: block;float:left;">
					<img width="16" alt="" src="{$site_root}{$template_root}/images/icn_admin_get_html.png" onCLick="window.open('forms/code.php?id={$rel[c].id}','', 'resizable=yes,scrollbars=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,width=600,height=400,left=0,top=0');" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.newsletter.forms.descr_code}');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="ShowBlock('show_block', 'forms/create1.php?id={$rel[c].id}&ajax=1')" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.edit}');return false">
				</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}'))ShowBlock('show_block', 'forms/index.php?did={$rel[c].id}&ajax=1')" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false">
				</div>
			</div>
		</td>
	</tr>
	{sectionelse}
		<tr height="40">
			<td class="main_error_text" bgcolor="#FFFFFF" align="left" colspan="6">{$lang.newsletter.button.no_forms}</td>
		</tr>
	{/section}

	<tr class="table_header">
		
		<!--<td align="left" >{$lang.newsletter.on_page}: 
			<select name="form_page1" style="width:auto" onChange="document.location='index.php?form_page=' + document.FormForm.form_page.value">
				{html_options values=$form_page_values selected=$form_page output=$form_page_output}
			</select>
		</td>-->
		<td class="listHeader" colspan="11">
			{*$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.forms.total_forms}: {$amount}</td>-->
	</tr>
</table>
</div>
{*{if $amount <= 0}
<div align="center" class="main_content_text"><strong>{$lang.newsletter.button.no_forms}</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.forms.confirm_forms_del|escape:javascript}{literal}')) submit();
	}
	else alert('{/literal}{$lang.newsletter.forms.no_form_chosen|escape:javascript}{literal}');
	return false;
}
			var options = { 
				success: function(data){
					ajaxLoadingImage(0, 'show_block');
					$('#show_block').html(data);
					/*$('#show_block').oneTime(3000, function() {
						$('#show_block').fadeOut(500);
					});*/
					return false;
				},
				beforeSubmit: function() { 
					//ajaxIndicator(1, 'show_block');
					ajaxLoadingImage(1, 'show_block');
				}
			};
			function submit(){
					$('.FormForm').ajaxSubmit(options);
			}

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, 'show_block');
	$.post("forms/index.php", par, function(data){
		ajaxLoadingImage(0, 'show_block');
		$('#show_block').html(data);
	});
}

</script>
{/literal}