{if $ajax eq 0}
{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$form.back}">{$lang.button.back}</a>
</div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.pays.history}</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.billing}
    </div>
</div>
<ul class="tabs">
    <li>
        <a {if $info.active == "history"} class="current" {else} href="admin_pays.php"  {/if}>{$lang.pays.history} </a>
    </li>
    <li>
        <a {if $info.active == "offline"} class="current" {else} href="admin_pays.php?sel=approve" {/if}>{$lang.pays.offline}</a>
    </li>    
</ul>
<div class="user_operation_line" style="height:4px;font-size:0px;">
                                       
</div>
<div class="cr"></div>
<div style="float:left; width: 50%; margin-bottom: 10px;" >
			<table width="100%"><tr class="main_content_text"><td>
			<B>{$lang.pays.name}</B>:&nbsp;{$data.name}<br>
			<B>{$lang.pays.account_status}</B>:&nbsp;<font>{$data.account}</font>&nbsp;{$form.costunits}<br>
			<B>{$lang.pays.membership_payments}</B>:&nbsp;<font>{$data.membership_payments}</font>&nbsp;{$form.costunits}<br>
			<B>{$lang.pays.total_amount}</B>:&nbsp;<font>{$data.total_payments}</font>&nbsp;{$form.costunits}<br>
			</td></tr></table>
</div>
{if $entry}<div style="margin-top: 100px; float: right; margin-top: 5px;" align="right">
    <select name="pays_numpage" onchange="NumUsers(); return false;">                        
                        <option value="10" {if $pays_numpage eq 10} selected {/if}>10 {$lang.button.users}</option>
                        <option value="30" {if $pays_numpage eq 30} selected {/if}>30 {$lang.button.users}</option>
                        <option value="50" {if $pays_numpage eq 50} selected {/if}>50 {$lang.button.users}</option>
                        <option value="100" {if $pays_numpage eq 100} selected {/if}>100 {$lang.button.users}</option>
                    </select>
</div>	{/if}
{/if}			
<div id="user_pay" style="float: left; width: 100%; margin-top: 20px;">
<div id="tooltip" onclick="hideToolTip()" style="text-align:center; background-color: #FFFFFF; border: 1px dotted; width:auto; 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=0 width="100%">					
                          <tr class="table_header">
                                <td width="15%" >{$lang.pays.date_entry}</td>								
								<td width="10%" >{$lang.pays.spent_funds}</td>
								<td width="10%" >{$lang.pays.account}</td>								
								<td width="15%" >{$lang.pays.period_type}</td>
                                <td width="10%" align="right">{$lang.users.actions}</td>                                
						  </tr>
							{if $entry}
							{section name=u loop=$entry}
							<tr {if $smarty.section.u.index mod 2 eq 1}class="even"{else}class="odd"{/if}>
								<td class="main_content_text" style="height: 20px;">{$entry[u].date_send}</td>
                                <td class="main_content_text" style="height: 20px;">{$entry[u].count_curr} {$form.costunits}</td>
								<td class="main_content_text" style="height: 20px;">
                                    <div style="float: left; margin-right: 5px;">{$data.account} {$form.costunits}</div>
                                    <div class="block_action" style="float:left;">
                                        <!-- <a href="{$server}{$site_root}/admin/admin_pays.php?sel=add_billing&id={$user[u].id}" rel="#overlay">-->
                                        <img src="{$site_root}{$template_root}/images/add_money_n.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.pays.account}');return false" alt="" height="13" style="cursor: pointer;" onclick="WindowShow({$id})" />
                                        <!--</a>-->    
                                    </div>
                                </td>
								<td class="main_content_text" style="height: 20px;">{$entry[u].groupname}</td>								
								<td class="main_content_text" style="height: 20px;">
                                    <div class="block_action" style="float:right;">
                                        <img onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.comunicate.editform}');return false" src="{$site_root}{$template_root}/images/communicate.png" alt="" height="16" style="cursor: pointer;" onclick="javascript:window.open('{$entry[u].comunicate}','comunicate', 'height=800, resizable=yes, scrollbars=yes,width=600, menubar=no,status=no');" />                                        
                                    </div>
                                </td>
                                
							</tr>
							{/section}
							{else}
							<tr height="40">
								<td class="main_error_text" align="left" colspan="5">{$lang.pays.empty_user}</td>
							</tr>
							{/if}
				        	<tr class="table_header">
                                <td colspan="5">
                                    &nbsp;&nbsp;
                                    {if $links}
                                    {foreach item=item from=$links.pages}
                                        &nbsp;<a onclick="PageList('', '{$item.link}');" class="page_link" {if $item.selected} style=" font-weight: bold; text-decoration: none;" {/if}>{$item.name}</a>&nbsp;
                                    {/foreach}
                                    {/if}
                                    <div class="page_navigation">
                                    {if $links.previous}
                                        <a onclick="PageList('', '{$links.previous}');">< {$lang.content.previous} {$per_page}</a>
                                    {/if}
                                    {if $links.next}
                                        <a onclick="PageList('', '{$links.next}');">{$lang.content.next} {$per_page} ></a>
                                    {/if}
                                    </div>
                                </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 - 80;
			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';
		}
{/literal}		
</script>
</div>	

<link href="{$site_root}{$template_root}/css/alert.css" rel="stylesheet" type="text/css">
<div id="boxes">
    <div id="close" class="close" onclick="Close()"></div>
	<div id="dialog" class="window">
	</div>
</div>
<div id="mask"></div>
				<!--{if $periods}
				<form method="POST"  action="{$form.action}" style="maring: 0px; padding: 0px;">
				{$form.hiddens}
				<input type="hidden" name="add_type" value="membership">
					<table cellSpacing="0" cellPadding="3" border="0">
					<tr>
						<td class="main_content_text" width="105" align="right">{$lang.pays.add_to_period}:&nbsp;
						</td>
						<td width="160">
						<select name=period style="width: 150px;">
							{section name=u loop=$periods}
							<option value="{$periods[u].id}">{$periods[u].name}</option>
							{/section}
						</select>
						</td>
						<td class="main_content_text"><input type="submit" value="{$lang.button.move_user}" class="button" ></td>
				  	</tr>
				  	</table>
				</form>
				{/if}
				<form method="POST"  action="{$form.action}"  style="maring: 0px; padding: 0px;">
				{$form.hiddens}
				<input type="hidden" name="add_type" value="account">
					<table cellSpacing="0" cellPadding="3" border="0">
					<tr>
						<td class="main_content_text" width="105" align="right">{$lang.pays.add_to_user_account}:&nbsp;
						</td>
						<td width="160">
						<input type="text" name="account_to_add" id="account_to_add"  style="width: 150px;">
						</td>
						<td class="main_content_text"><input type="submit" value="{$lang.button.add_to_account}" class="button"></td>
				  	</tr>
				  	<tr>
				  		<td></td>
				  		<td colspan="2"><i>{$lang.pays.update_account_page.account_to_add_hint}</i></td>
				  	</tr>
					</table>
				</form>
				<input type="button" value="{$lang.pays.back}" class="button" onclick="javascript: location.href='{$form.back}'">-->

<script type="text/javascript">
{literal}
function WindowShow(par) {
	//var id = '#dialog';
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(500);	
		$('#mask').fadeTo("fast",0.8);	
	
		//Get the window height and width
		var winH = $(document).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$('#dialog').css('top',  winH/2-$('#dialog').height()/2);
		$('#dialog').css('left', winW/2-$('#dialog').width()/2);
        
        $('#close').css('top',  winH/2-$('#dialog').height()/2+9);
		$('#close').css('left', winW/2+$('#dialog').width()/2-25);
        $('#close').fadeIn(500);
                
        var par = 'sel=add_billing&id='+par
	
	$.ajax({
  		type: "POST",
  		url: "admin_pays.php",        
		data: (par),
		success: function(data){
			$('#dialog').html(data);
            $('#dialog').fadeIn(500); 
		}
	});
	//transition effect
}

function Close(){
    $('#mask').fadeOut(500);
    $('#close').fadeOut(500)
    $('#dialog').fadeOut(500)	
}
    function PageList(id_div, par) {
        ajaxLoadingImage(1, 'user_pay');
        $.post("admin_pays.php", par, function(data){
            ajaxLoadingImage(0, 'user_pay');
            $('#user_pay').html(data);
        });
    }

function NumUsers(){
    num_users = $("select[name=pays_numpage]").val();    
    par = 'pays_numpage='+num_users+'&ajax=1&sel=user&id={/literal}{$id}{literal}';
    ajaxLoadingImage(1, 'user_pay');
        $.post("admin_pays.php", par, function(data){
            ajaxLoadingImage(0, 'user_pay');
            $('#user_pay').html(data);
        });
    return false;
}
{/literal}
</script>
{if $ajax eq 0}
{include file="$admingentemplates/admin_bottom.tpl"}
{/if}