<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 cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr class="table_header">
        <td width="35%">
            {$lang.pays.period}
        </td>    
        <td width="35%">
            {$lang.pays.pay}  
        </td>        
        <td width="30%" align="right">
            {$lang.button.action}  
        </td>        
    </tr>
    {section name=i loop=$data.price}
        <tr {if $smarty.section.i.index mod 2 eq 1}class="even"{else}class="odd"{/if}>
            <td>
                <div  style="float: left; margin-right: 5px;">
                    {$data.price[i].count}&nbsp;{$data.price[i].period}                    
                </div>
            </td>
            <td> 
                <div style="float: left;">{$data.price[i].cost}&nbsp;{$form.costunits}&nbsp;</div>               
            </td>
            <td> 
                <div class="block_action" style="float:right; padding-top: 2px;">
                    <img src="{$site_root}{$template_root}/images/photo_delete.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" alt="" height="13" style="cursor: pointer;" onclick="Del({$data.price[i].id}, {$data.id})" />
                </div>                       
            </td>
        </tr>
	{sectionelse}
		<tr height="40">
			<td class="main_error_text" align="left" colspan="3" bgcolor="#FFFFFF">{$lang.interests_spr.empty}</td>
		</tr>	
	{/section}
    <tr>
        <td colspan="3">        
            <div id="str">
                            
            </div>
        </td>
    </tr>
	<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';
		}
{/literal}		
</script>

<script type="text/javascript">
{literal}

function AddStr(){
    var str = "<form name=\"add\" action=\"admin_groups.php?sel=addprice\" onkeypress=\"Send(event);\"> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td width=\"130\"><input type=\"text\" id=count style=\"width:25px;\">&nbsp;<select id=period style=\"width:70px;height:22px;\"><option value=\"day\">"+{/literal}'{$lang.pays.periods.day}'{literal}+"</option><option value=\"week\">"+{/literal}'{$lang.pays.periods.week}'{literal}+"</option><option value=\"month\">"+{/literal}'{$lang.pays.periods.month}'{literal}+"</option><option value=\"year\">"+{/literal}'{$lang.pays.periods.year}'{literal}+"</option></select>&nbsp;&nbsp;&nbsp;</td><td ><input type=\"text\" id=\"cost\" style=\"width:50px\">&nbsp;"+{/literal}'{$form.costunits}'{literal}+"</td><td><img src=\""+{/literal}'{$site_root}{$template_root}'{literal}+"/images/success.png\" alt=\"\" style=\"margin-left: 10px; cursor: pointer;\" onclick=\"Send_1();\" /></td></tr></table></form>"
 
    $('#str').html(str)    

}

function Send(e){
     if (e.keyCode != 13)
        return false
     else{ 
        var cost = document.getElementById('cost').value
        var count = document.getElementById('count').value
        var period = document.getElementById('period').value
        $.ajax({
            type: "POST",
            data: 'sel=addprice&ajax=1&count='+count+'&cost='+cost+'&period='+period+'&group={/literal}{$data.id}{literal}',
            url: "admin_groups.php",
            success: function(data){
                $('#table_price').html(data)
            }
        })   
     }        
}

function Send_1(){
    
        var cost = document.getElementById('cost').value
        var count = document.getElementById('count').value
        var period = document.getElementById('period').value
        $.ajax({
            type: "POST",
            data: 'sel=addprice&ajax=1&count='+count+'&cost='+cost+'&period='+period+'&group={/literal}{$data.id}{literal}',
            url: "admin_groups.php",
            success: function(data){
                $('#table_price').html(data)
            }
        })               
}

function Del(par, group){
    $.ajax({
            type: "POST",
            data: 'sel=delprice&id='+par+'&ajax=2&group='+group,
            url: "admin_groups.php",
            success: function(data){
                $('#table_price').html(data)
            }
        })   
}
{/literal}
</script>