{if $ajax eq 0}{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_modules.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.sms_payments.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.main.sms_systems}
			{if $settype == 'smscoin'}<br>{$lang.admin_help.smscoin_1}http://yoursite.com/account.php?sel=sms_payment&response=yes&system=smscoin{$lang.admin_help.smscoin_2}http://yoursite.com/account.php?sel=sms_payment&response=no&system=smscoin{$lang.admin_help.smscoin_3}http://yoursite.com/include/sms_payment_request.php?sel=smscoin{$lang.admin_help.smscoin_4}{/if}
			{if $settype == 'daopay'}<br>{$lang.admin_help.daopay}{/if}
			{if $settype == 'zaypay'}<br>{$lang.admin_help.zaypay}{/if}
    </div>
</div>
<div class="cr">&nbsp;</div>
<ul class="tabs">
    <li>
        <a class="current">{$lang.admin_menu.payment_module}</a>
    </li>
</ul>
{*		<div class="user_operation_line" style="height:4px;font-size:0px;">*}
			{*<div id="add_rate_but" onclick="ShowAddRateDiv();return false;" class="uol_item" style="display:none;">
				<div class="uol_in_item">{$lang.sms_payments.add_rate}</div>
			</div>*}
{*		</div><br>*}
{*{strip}
<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}
<div>
	<div>
	<form action="{$form.action}" method="post" enctype="multipart/form-data" style="padding: 0px; margin: 0px;" name="form1">
	<input type="hidden" name="sel" value="saveset">
	<input type="hidden" name="settype" value="{$settype}">
	<table border=0 cellspacing=1 cellpadding=5 width="100%">
		<tr height="30" bgcolor="#ffffff">
		<td colspan=3 class="main_content_text" align="left" style="padding-left:5px;"><b>{$lang.sms_payments.select_activate_payment_system}:</b>&nbsp;&nbsp;&nbsp;
		{foreach item=item from=$sms_systems}
			{if $item.value ne $settype}<a href="admin_sms_payments.php?sel=systems&settype={$item.value}">{/if}{$item.name_orig}{if $item.value ne $settype}</a>{/if}
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		{/foreach}
		</td>
		</tr>
	{if $settype=='general'}
		<tr>
			<td colspan="3">&nbsp;{$lang.sms_payments.general_text}</td>
		</tr>
	{else}
		{$data.table_options}
		<tr>
			<td colspan="3" align="left"><a class="admin_button_major" onclick="document.form1.submit();">{$button.save}<span>&nbsp;</span></a>&nbsp;&nbsp;&nbsp;
			</td>
		</tr>
	{/if}
	</table>
	</form>
	</div>
	{if $settype!='general'}
	<div style="padding-top: 15px;">
	<form action="{$form.action}" method="POST" enctype="multipart/form-data" style="padding: 0px; margin: 0px;" name="sms_systems">
	<input type="hidden" name="sel" value="save_rate">
	<input type="hidden" name="settype" value="{$settype}">
	{$data.rates}
	</form>
	</div>
	{/if}
</div>
{/strip}*}
<div class="panel">
    <div class="user_operation_line" style="height:4px;font-size:0px;">
    </div>
    <div class="cr"></div>
    <div class="fl" style="width:100%;">
        {foreach from=$sms_systems item=item key=k}
            <div class="sgs_system_box_outer">
            {strip}
            <div class="sgs_system_box" onclick="ShowSettings('{$item.value}')">
                {if $item.used}
                    <img src="{$site_root}{$template_root}/images/systems/{$item.value}_logo.png" alt="">
                    <div class="sgs_action_active"><img width="16" src='{$site_root}{$template_root}/images/success.png'alt=""></div>
                {else}
                    <img src="{$site_root}{$template_root}/images/systems/{$item.value}_logo_grey.png"alt="">
                {/if}
                <div class="sgs_action_edit"><img width="16" src='{$site_root}{$template_root}/images/edit.png'alt=""></div>
            </div>
            {/strip}
            </div>
{*            {if $k is div by 5}
                </div>
                <div class="cr"></div>
                <div class="fl">
            {/if}*}
        {/foreach}
    </div>
{/if}
    <div id="paysys_set" style="float:left;width:100%;">
		{if $settype!='general'}
		<div>
		<form action="{$form.action}" method="post" enctype="multipart/form-data" style="padding: 0px; margin: 0px;" name="form1">
		<input type="hidden" name="sel" value="saveset">
		<input type="hidden" name="settype" value="{$settype}">
		<table border=0 cellspacing=1 cellpadding=5 width="100%">
			{$data.table_options}
			<tr>
				<td colspan="3" align="left"><a class="admin_button_major" onclick="document.form1.submit();">{$button.save}<span>&nbsp;</span></a>&nbsp;&nbsp;&nbsp;
				{*<a class="admin_button" onclick="document.location.href='{$form.action}'">{$button.back}<span>&nbsp;</span></a>*}
				</td>
			</tr>
		</table>
		</form>
		</div>
		<div style="padding-top: 15px;">
		<form action="{$form.action}" method="POST" enctype="multipart/form-data" style="padding: 0px; margin: 0px;" name="sms_systems">
		<input type="hidden" name="sel" value="save_rate">
		<input type="hidden" name="settype" value="{$settype}">
		{$data.rates}
		</form>
		</div>
		{/if}
    </div>
{if $ajax eq 0}    <div class="cr">&nbsp;</div>
    <div class="user_operation_line" style="height:4px;font-size:0px;">
    </div>
</div>
<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}
$('.sgs_system_box').mouseover(function (e) {
    $(this).addClass('sgs_system_box_sel');
    $(this).css('top', '-3');
    $(this).css('left', '-3');
    $(this).find(".sgs_action_edit").show();
});
$('.sgs_system_box').mouseout(function (e) {
    $(this).removeClass('sgs_system_box_sel');
    $(this).css('top', '0');
    $(this).css('left', '0');
    $(this).find(".sgs_action_edit").hide();
});
function ShowSettings(paysys) {
    ajaxLoadingImage(1, 'paysys_set');
    $.post('admin_sms_payments.php',{sel:'systems',settype:paysys, ajax:1},function(data){
        ajaxLoadingImage(0, 'paysys_set');
        $('#paysys_set').html(data);
    });
}

var options = { 
    success: function(data){
		ShowAjaxError(data, '', 'success');
        return false;
    },
    beforeSubmit: function() { 
        ajaxIndicator(1, 'error_box');
    }
 };
 function SavePaysys(){
 	manual_body = $('iframe').contents().find('iframe').contents().find('body').html() ? $('iframe').contents().find('iframe').contents().find('body').html() : null;
 	if(manual_body){
 		$('#manual_body').val(manual_body);
 	}
    $('#money_form').ajaxSubmit(options);
    return false;
 }
    
{/literal}
</script>
{include file="$admingentemplates/admin_bottom.tpl"}
{/if}