{template header}

<!--{if empty($infloat)}-->
	{subtemplate header_nofloat}
<!--{/if}-->

<div class="floatwin" style="width: 350px; height: 155px; overflow: hidden;">
	<h3 class="float_ctrl">
		<em id="return_credit"><!--{if $operation == 'transfer'}-->{lang memcp_credits_transfer}<!--{elseif $operation == 'exchange'}-->{lang memcp_credits_exchange}<!--{elseif $operation == 'addfunds'}-->{lang memcp_credits_addfunds}<!--{/if}--></em>
		<span><a title="{lang close}" onclick="floatwin('close_credit')" class="float_close" href="javascript:;">{lang close}</a></span>
	</h3>
	<div class="floatbox">
		<form id="confirmform" class="postbox" method="post" action="memcp.php?action=credits&confirm=yes&infloat=yes" onsubmit="ajaxpost('confirmform', 'return_credit', 'return_credit', 'onerror');return false;">
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<input type="hidden" name="handlekey" value="credits" />
			<!--{if $operation == 'transfer'}-->
				<!--{if !$to}-->
					<p style="margin-bottom:8px;">{lang memcp_credits_transfer_msg_user_incorrect}</p>
				<!--{elseif !$transferamount}-->
					<p style="margin-bottom:8px;">{lang memcp_credits_transfer_msg_num_incorrect}</p>
				<!--{else}-->
					<input type="hidden" name="operation" value="transfer" />
					<input type="hidden" name="transfersubmit" value="yes" />
					<input type="hidden" name="amount" value="$transferamount" />
					<input type="hidden" name="to" value="$to" />
					<p>{lang memcp_credits_transfer_user}$extcredits[$creditstrans][title] $transferamount $extcredits[$creditstrans][unit]{lang credits_give} {$to}, {lang memcp_credits_password}: </p>
					<p style="margin-bottom:8px;"><input type="password" name="password" value="" class="txt" /></p>
					<p>{lang memcp_credits_transfer_message}</p>
					<p><input name="transfermessage" size="40" class="txt" /> <input name="confirm" type="submit" value="{lang confirms}" /></p>
				<!--{/if}-->
			<!--{elseif $operation == 'exchange'}-->
			
				<!--{if $fromcredits == $tocredits}-->
					<p style="margin-bottom:8px;">{lang memcp_credits_exchange_msg_num_invalid}</p>
				<!--{elseif !$netamount}-->
					<p style="margin-bottom:8px;">{lang memcp_credits_exchange_msg_balance_insufficient}</p>
				<!--{else}-->
					<input type="hidden" name="operation" value="exchange" />
					<!--{if $outexange}-->
						<input type="hidden" name="outexange" value="1" />
					<!--{else}-->
						<input type="hidden" name="outexange" value="0" />
					<!--{/if}-->
					<input type="hidden" name="amount" value="$exchangeamount" />
					<input type="hidden" name="fromcredits" value="$fromcredits" />
					<input type="hidden" name="tocredits" value="$tocredits" />
					<input type="hidden" name="exchangesubmit" value="yes" />
					<p style="margin-bottom:8px;">{lang memcp_credits_exchange_you_need}<strong>
						<!--{if $outexange}-->
							$outextcredits[$tocredits][title] $exchangeamount $outextcredits[$tocredits][unit]
						<!--{else}-->
							$extcredits[$tocredits][title] $exchangeamount $extcredits[$tocredits][unit]
						<!--{/if}-->
						</strong>, {lang memcp_credits_exchange_you_pay}</p>
						{lang memcp_credits_exchange_password}: <br />
					<input type="password" name="password" value="" class="txt" size="20"/> <input name="confirm" type="submit" value="{lang confirms}" />
				<!--{/if}-->
			<!--{elseif $operation == 'addfunds'}-->
				<!--{if !$addfundamount}-->
					<p style="margin-bottom:8px;">{lang memcp_credits_addfunds_msg_incorrect}</p>
				<!--{else}-->
					<input type="hidden" name="operation" value="addfunds" />
					<input type="hidden" name="amount" value="$addfundamount" />
					<input type="hidden" name="addfundssubmit" value="yes" />
					<p style="margin-bottom:8px;">{lang memcp_credits_addfunds_msg}</p>
					<input name="confirm" type="submit" value="{lang confirms}" />
				<!--{/if}-->
			<!--{/if}-->
		</form>
	</div>
</div>
<script type="text/javascript" reload="1">
	function messagehandle_credits(key) {
		if(key != 0) {
			$('confirmform').style.display = 'none';
			$('return_credit').className = 'onright';
			creditnoticewin();
		}		
	}
</script>

<!--{if empty($infloat)}-->
	{subtemplate footer_nofloat}
<!--{/if}-->
{template footer}