{*{include file="$admingentemplates/admin_top.tpl"}

<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_affilate.php?ref=8">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.affiliate.razdel_name}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div class="help_text" style="display:block;">
    <div class="close_help">
        <img src="{$site_root}{$template_root}/images/close_help.png" alt="">
    </div>
    <div class="help_body">
        <span class="help_title">{$lang.help}:</span>{$lang.admin_help.aff_banners}
    </div>
</div>
<div class="cr">&nbsp;</div>

<div class="panel">
*}
    <div class="user_status_line" style="margin-bottom:0px;width:100%;">
        <div id="tab_feeds" class="user_status_elem" onclick="links_load();">
            <a>{$lang.affiliate.links}</a>
        </div>
        <div id="tab_news" class="user_status_elem_active">
            {$lang.affiliate.banners}
        </div>
	</div>
<div class="panel" style="margin: 0px;">
	<div class="panel_subtabs" style="background-color:#FFFFFF;">
		<div class="panel_content" style="width: 99%; margin: 5px 5px 20px;">

<form action="affiliate/aff_bans.php" name="form1" method="POST" id="form1" enctype="multipart/form-data" style="margin:0px">
	<table border="0" cellspacing="3" cellpadding="0">
	<tr><td>
		<input type="hidden" name="action" value="Save">
		<b>{$lang.affiliate.add_banner}:</b> {$lang.affiliate.picture} <input type="file" name="upload" style="padding: 1px 4px">
	</td><td>
		<div class="fl" style="text-align:left;">
			<a href="#" class="admin_button_major" style="margin:0px;" id="" onclick="Save_ban();">{$lang.button.select}<span>&nbsp;</span></a>
		</div>
	</td></tr>
	</table>
</form>

<br>
{if $page_links}
<b>{$lang.affiliate.pages}:</b>
{section name=c loop=$page_links}
	<a href={$page_links[c].url}>{$page_links[c].text}</a>&nbsp;
{/section}
<br><br>
{/if}
<div id="tooltip" onclick="hideToolTip()" style="text-align:center; background-color: #FFFFFF; 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}

<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr class="table_header">
  <td width="5%">#</td>
  <td width="90%" align="center">{$lang.affiliate.picture}</td>
  <td width="5%">{$lang.button.action}</td>
</tr>

{section name=num loop=$ads}

<tr {if $smarty.section.num.index mod 2 eq 1}class="table_row even"{else}class="table_row odd"{/if}>
  <td valign="top" align=center>{$smarty.section.num.iteration}</td>
  <td valign="top" align=center><img src="{$ads[num].picture}"></td>
  <td valign="top">{*<a href="aff_bans.php?action=Delete&which={$ads[num].id}">{$lang.button.delete}</a>*}
	<div class="block_action fr" style="display: none;">
		<div class="action_del" style="display: block;cursor:pointer;">				
			<img width="16" alt="" src="{$site_root}{$template_root}/images/photo_delete.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" onclick="del_ban('{$ads[num].id}');">
		</div>
	</div>  
  </td>
</tr>

{sectionelse}

<tr>
    <td align=center colspan="3">{$lang.affiliate.no_banners}</td>
</tr>

{/section}
<tr class="table_header"><td colspan="3">&nbsp;</td></tr>
</table>
<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 -10 + st + 'px';
	}
	function hideToolTip(){
		document.getElementById('tooltip').style.display = 'none';
	}
	function links_load(){
		ajaxLoadingImage(1, 'aff_ads_div');
		$.post("affiliate/aff_ads.php?ajax=1", function(data){
			ajaxLoadingImage(0, 'aff_ads_div');
			$('#aff_ads_div').html(data);
		});			
	}
		
	function Save_ban(){
		var options = {
			success: function() {
				ajaxLoadingImage(1, 'aff_ads_div');
				$.post("affiliate/aff_bans.php", function(data){
					ajaxLoadingImage(0, 'aff_ads_div');
					$('#aff_ads_div').html(data);
				});			
			}
		};
		$("#form1").ajaxSubmit(options); 
	}
	
	function del_ban(num){
		ajaxLoadingImage(1, 'aff_ads_div');
		$.post("affiliate/aff_bans.php?action=Delete&which="+num, function(data){
			ajaxLoadingImage(0, 'aff_ads_div');
			$('#aff_ads_div').html(data);
		});			
	}
{/literal}		
</script>
		</div>
	</div>
{*
</div>

{include file="$admingentemplates/admin_bottom.tpl"}*}
