{include file="$gentemplates/$header_tpl"}
<td class="main_cell">
	<!-- begin main cell -->
	{strip}
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		{if $form.err}
		<tr>
			<td valign="top" style="padding-top:10px;"><font class="error_msg">*&nbsp;{$form.err}</font><br>&nbsp;</td>
		</tr>
		{/if}
		<tr>
			<td valign="top" style="padding-top: 10px">
				<h2>{$lang.sms_payments.choose_a_company}</h2>
				<div id="rate_empty" style="display: none;">
					<div style="padding-top: 10px;"><font class="error_msg">*&nbsp;{$lang.sms_payments.rate_not_chosen}</font></div>
				</div>
				<div style="padding-top: 10px;">
				{if $smssystems ne 'empty'}
					{foreach from=$smssystems item=item}
						<input type="button" class="button" onclick="javascript: LoadRates('{$item.template_name}'); return false;" value="{$item.name}">&nbsp;
					{/foreach}
				{else}
				{$lang.sms_payments.no_sms_systems_found}
				{/if}
				</div>
				<form method="POST" action="" enctype="multipart/form-data" style="padding: 0px; margin: 0px;" id="rate_form" name="sms_systems">
				<div id="rate_div" style="padding-top: 15px;">
				</div>
				</form>
			</td>
		</tr>
		</table>
	{/strip}
	<!-- end main cell -->
</td>
{literal}
<script type="text/javascript">

var req = null;

function InitXMLHttpRequest() {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function LoadRates(system) {
	document.getElementById('rate_empty').style.display = "none";
	destination = document.getElementById("rate_div");
	InitXMLHttpRequest();
	if (req){
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				destination.innerHTML = req.responseText;
			} else {
				destination.innerHTML = "";
			}
		}
		req.open('GET', 'sms_payment.php?sel=ajax_response&r='+Math.random()+'&system='+system, true);
		req.send(null);
	}
	else{
		destination.innerHTML = 'Browser unable to create XMLHttp Object';
	}
	return;
}
function CheckRate(val) {
	document.getElementById('rate_empty').style.display = "none";
	document.getElementById('rate').value = val;
	return false;
}
function CheckEmptyRate() {
	if (document.getElementById('rate').value == '') {
		document.getElementById('rate_empty').style.display = "inline";
	} else {
		document.getElementById('rate_empty').style.display = "none";
		document.getElementById('rate_form').submit();
	}
	return;
}
</script>
{/literal}
{include file="$gentemplates/$footer_tpl"}