{template header}
{template memcp_navbar}

</td><td valign="top" style="padding-left:{TABLESPACE}px !important">

<!--{if $operation == 'transfer'}-->
	<form method="post" action="memcp.php?action=credits">
	<input type="hidden" name="formhash" value="{FORMHASH}">
	<input type="hidden" name="operation" value="transfer">
	<div class="spaceborder">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
	<tr>
	<td width="100%" colspan="2" class="header">{lang memcp_credits_transfer}</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang memcp_credits_currently}</span></td>
	<td class="altbg2" width="85%">$extcredits[$creditstrans][title] $GLOBALS['extcredits'.$creditstrans] $extcredits[$creditstrans][unit]&nbsp;
	</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang password}</span></td>
	<td class="altbg2" width="85%"><input type="password" size="15" name="password"></td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang to}</span></td>
	<td class="altbg2" width="85%"><input type="text" size="15" name="to"></td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{$extcredits[$creditstrans][title]}</span></td>
	<td class="altbg2" width="85%"><input type="text" size="15" id="amount" name="amount" value="0" onkeyup="calcredit()"> {$extcredits[$creditstrans][unit]}</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang memcp_credits_transfer_min_balance}</span></td>
	<td class="altbg2" width="85%">$transfermincredits {$extcredits[$creditstrans][unit]}</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang credits_tax}</span></td>
	<td class="altbg2" width="85%">$taxpercent</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang memcp_credits_income}</span></td>
	<td class="altbg2" width="85%"><span id="desamount">0</span> $extcredits[$creditstrans][unit]</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%" valign="top"><span class="bold">{lang memcp_credits_transfer_message}</span><br><span class="smalltxt">{lang memcp_credits_transfer_message_comment}</span></td>
	<td class="altbg2" width="85%"><textarea name="transfermessage" rows="8" style="width: 85%; word-break: break-all"></textarea></td>
	</tr>

	<tr class="altbg1 bottom">
	<td colspan="2" class="smalltxt">{lang memcp_credits_transfer_comment}</td>
	</tr>

	</table></div><br>
	<div class="option" style="width: 100%"><div class="submitbutton">
	<input class="button" type="submit" name="creditssubmit" value="{lang submit}" onclick="return confirm('{lang memcp_credits_confirm}');">
	</div></div></form>
	<script type="text/javascript">
	function calcredit() {
		var amount = parseInt($('amount').value);
		$('desamount').innerHTML = !isNaN(amount) ? Math.floor(amount * (1 - $creditstax)) : 0;
	}
	</script>
<!--{elseif $operation == 'exchange'}-->
	<form method="post" action="memcp.php?action=credits">
	<input type="hidden" name="formhash" value="{FORMHASH}">
	<input type="hidden" name="operation" value="exchange">

	<script type="text/javascript">
	var ratioarray = new Array();
	<!--{loop $exchcredits $id $ecredits}-->
		ratioarray[$id] = $ecredits[ratio];
	<!--{/loop}-->
	</script>
	<div class="spaceborder">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
	<tr>
	<td width="100%" colspan="2" class="header">{lang memcp_credits_exchange}</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang credits_now}</span></td>
	<td class="altbg2" width="85%">
		<!--{loop $extcredits_exchange $key $credit}-->
			$credit[title] $GLOBALS[$key] $credit[unit]&nbsp;
		<!--{/loop}-->
	</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang password}</span></td>
	<td class="altbg2" width="85%"><input type="password" size="15" name="password"></td>
	</tr>

	<tr>
	<td class="altbg1" width="15%">
	<span class="bold">{lang memcp_credits_log_transaction_outgo}</span>
	</td>
	<td class="altbg2" width="85%">
	<input type="text" size="15" name="amount" id="amount" value="0" onkeyup="calcredit();">&nbsp;&nbsp;<select name="fromcredits" onChange="calcredit();">
	<!--{loop $extcredits $id $credit}-->
		<!--{if $credit[allowexchangeout] && $credit[ratio]}-->
			<option value="$id" unit="$credit[unit]" title="$credit[title]" ratio="$credit[ratio]">$credit[title]</option>
		<!--{/if}-->
	<!--{/loop}-->
	</select>
	</td>
	</tr>
	<tr>
	<td class="altbg1" width="15%">
	<span class="bold">{lang memcp_credits_log_transaction_income}</span>
	</td>
	<td class="altbg2" width="85%">
	<input type="text" size="15" id="desamount" value="0" disabled>&nbsp;&nbsp;<select name="tocredits" onChange="calcredit();">
	<!--{loop $extcredits $id $ecredits}-->
		<!--{if $ecredits[allowexchangein] && $ecredits[ratio]}-->
			<option value="$id" unit="$ecredits[unit]" title="$ecredits[title]" ratio="$ecredits[ratio]">$ecredits[title]</option>
		<!--{/if}-->
	<!--{/loop}-->
	</select>
	</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang memcp_credits_exchange_ratio}</span></td>
	<td class="altbg2" width="85%"><span class="bold">1</span><span id="orgcreditunit"></span><span id="orgcredittitle"></span>{lang credit_exchange}<span class="bold" id="descreditamount"></span><span id="descreditunit"></span><span id="descredittitle"></span></td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang memcp_credits_exchange_min_balance}</span></td>
	<td class="altbg2" width="85%">$exchangemincredits</td>
	</tr>

	<tr>
	<td class="altbg1" width="15%"><span class="bold">{lang credits_tax}</span></td>
	<td class="altbg2" width="85%">$taxpercent</td>
	</tr>

	<tr class="altbg1 bottom">
	<td colspan="2" class="smalltxt">{lang memcp_credits_exchange_comment}</td>
	</tr>

	</table></div><br>
	<div class="option" style="width: 100%"><div class="submitbutton">
	<input class="button" type="submit" name="creditssubmit" value="{lang submit}" onclick="return confirm('{lang memcp_credits_confirm}');">
	</div></div></form>
	<script type="text/javascript">
	function calcredit() {
		with(document.forms[0]) {
			fromcredit = fromcredits[fromcredits.selectedIndex];
			tocredit = tocredits[tocredits.selectedIndex];
			var ratio = Math.round(((fromcredit.getAttribute('ratio') / tocredit.getAttribute('ratio')) * 100)) / 100;
			$('orgcreditunit').innerHTML = fromcredit.getAttribute('unit');
			$('orgcredittitle').innerHTML = fromcredit.getAttribute('title');
			$('descreditunit').innerHTML = tocredit.getAttribute('unit');
			$('descredittitle').innerHTML = tocredit.getAttribute('title');
			$('descreditamount').innerHTML = ratio;
			$('amount').value = $('amount').value.toInt();
			if(fromcredit.getAttribute('title') != tocredit.getAttribute('title') && $('amount').value != 0) {
				$('desamount').value = Math.floor(fromcredit.getAttribute('ratio') / tocredit.getAttribute('ratio') * $('amount').value * (1 - $creditstax));
			} else {
				$('desamount').value = $('amount').value;
			}
		}
	}
	String.prototype.toInt = function() {
		var s = parseInt(this);
		return isNaN(s) ? 0 : s;
	}
	calcredit();
	</script>
<!--{elseif $operation == 'addfunds'}-->
	<form method="post" action="memcp.php?action=credits" target="_blank">
	<input type="hidden" name="formhash" value="{FORMHASH}">
	<input type="hidden" name="operation" value="addfunds">
	<div class="spaceborder">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
	<tr>
	<td width="100%" colspan="2" class="header">{lang memcp_credits_addfunds}</td>
	</tr>

	<tr>
	<td class="altbg1" width="20%"><span class="bold">{lang memcp_credits_currently}</span></td>
	<td class="altbg2" width="80%">$extcredits[$creditstrans][title] $GLOBALS['extcredits'.$creditstrans] $extcredits[$creditstrans][unit]&nbsp;
	</td>
	</tr>

	<tr>
	<td class="altbg1" width="20%" valign="top"><span class="bold">{lang memcp_credits_addfunds_rules}</span></td>
	<td class="altbg2" width="80%">
	{lang memcp_credits_addfunds_rules_ratio} = {$extcredits[$creditstrans][title]} <b>$ec_ratio</b> {$extcredits[$creditstrans][unit]}
	<!--{if $ec_mincredits}--><br>{lang memcp_credits_addfunds_rules_min} {$extcredits[$creditstrans][title]} <b>$ec_mincredits</b> {$extcredits[$creditstrans][unit]}<!--{/if}-->
	<!--{if $ec_maxcredits}--><br>{lang memcp_credits_addfunds_rules_max} {$extcredits[$creditstrans][title]} <b>$ec_maxcredits</b> {$extcredits[$creditstrans][unit]}<!--{/if}-->
	<!--{if $ec_maxcreditspermonth}--><br>{lang memcp_credits_addfunds_rules_month} {$extcredits[$creditstrans][title]} <b>$ec_maxcreditspermonth</b> {$extcredits[$creditstrans][unit]}<!--{/if}-->
	</td>
	</tr>

	<tr>
	<td class="altbg1" width="20%"><span class="bold">{$extcredits[$creditstrans][title]} {lang memcp_credits_addfunds_amount}</span></td>
	<td class="altbg2" width="80%"><input type="text" size="15" id="amount" name="amount" value="0" onkeyup="calcredit()"> {$extcredits[$creditstrans][unit]}</td>
	</tr>

	<tr>
	<td class="altbg1" width="20%"><span class="bold">{lang memcp_credits_addfunds_caculate}</span></td>
	<td class="altbg2" width="80%">{lang memcp_credits_addfunds_caculate_radio}</td>
	</tr>

	<tr class="altbg1 bottom">
	<td colspan="2" class="smalltxt"><ul><li>{lang memcp_credits_addfunds_comment}</td>
	</tr>

	</table></div><br>
	<div class="option" style="width: 100%"><div class="submitbutton">
	<input class="button" type="submit" name="creditssubmit" value="{lang submit}">
	</div></div></form>
	<script type="text/javascript">
	function calcredit() {
		var amount = parseInt($('amount').value);
		$('desamount').innerHTML = !isNaN(amount) ? Math.round(((amount / $ec_ratio) * 10)) / 10 : 0;
	}
	</script>
<!--{elseif $operation == 'paymentlog'}-->
	<div class="spaceborder spacebottom">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr class="header"><td colspan="7">{lang memcp_credits_log_payment}</td></tr>
	<tr align="center" class="category">
	<td width="33%" align="left">{lang subject}</td>
	<td width="10%">{lang author}</td>
	<td width="8%">{lang dateline}</td>
	<td width="18%">{lang forum}</td>
	<td width="8%">{lang memcp_credits_log_payment_dateline}</td>
	<td width="9%">{lang price}</td>
	<td width="9%">{lang pay_author_income}</td>
	</tr>
	<!--{if $loglist}-->
		<!--{loop $loglist $log}-->
			<tr class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">
			<td><a href="viewthread.php?tid=$log[tid]">$log[subject]</a></td>
			<td align="center"><a href="space.php?uid=$log[authorid]">$log[author]</a></td>
			<td align="center">$log[tdateline]</td>
			<td align="center"><a href="forumdisplay.php?fid=$log[fid]">$log[name]</a></td>
			<td align="center">$log[dateline]</td>
			<!--{if !$log['amount'] && !$log['netamount']}-->
				<td align="center" colspan="2">{lang memcp_credits_log_payment_refunded}</td>
			<!--{else}-->
				<td align="center">{$extcredits[$creditstrans][title]} $log[amount] {$extcredits[$creditstrans][unit]}</td>
				<td align="center">{$extcredits[$creditstrans][title]} $log[netamount] {$extcredits[$creditstrans][unit]}</td>
			<!--{/if}-->
			</tr>
		<!--{/loop}-->
	<!--{else}-->
		<td class="altbg1" colspan="7">{lang memcp_credits_log_none}</td></tr>
	<!--{/if}-->

	</table></div>
	<div class="subtable" style="width: {TABLEWIDTH}">$multipage</div>
<!--{elseif $operation == 'incomelog'}-->
	<div class="spaceborder spacebottom">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr class="header"><td colspan="7">{lang memcp_credits_log_income}</td></tr>
	<tr align="center" class="category">
	<td width="33%" align="left">{lang subject}</td>
	<td width="8%">{lang dateline}</td>
	<td width="18%">{lang forum}</td>
	<td width="10%">{lang memcp_credits_log_income_buyer}</td>
	<td width="8%">{lang memcp_credits_log_payment_dateline}</td>
	<td width="9%">{lang price}</td>
	<td width="9%">{lang pay_author_income}</td>
	</tr>
	<!--{if $loglist}-->
		<!--{loop $loglist $log}-->
			<tr class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">
			<td><a href="viewthread.php?tid=$log[tid]">$log[subject]</a></td>
			<td align="center">$log[tdateline]</td>
			<td align="center"><a href="forumdisplay.php?fid=$log[fid]">$log[name]</a></td>
			<td align="center"><a href="space.php?uid=$log[uid]">$log[username]</a></td>
			<td align="center">$log[dateline]</td>
			<!--{if !$log['amount'] && !$log['netamount']}-->
				<td align="center" colspan="2">{lang memcp_credits_log_payment_refunded}</td>
			<!--{else}-->
				<td align="center">{$extcredits[$creditstrans][title]} $log[amount] {$extcredits[$creditstrans][unit]}</td>
				<td align="center">{$extcredits[$creditstrans][title]} $log[netamount] {$extcredits[$creditstrans][unit]}</td>
			<!--{/if}-->
			</tr>
		<!--{/loop}-->
	<!--{else}-->
		<td class="altbg1" colspan="7">{lang memcp_credits_log_none}</td></tr>
	<!--{/if}-->

	</table></div>
	<div class="subtable" style="width: {TABLEWIDTH}">$multipage</div>
<!--{elseif $operation == 'rewardpaylog'}-->
	<div class="spaceborder spacebottom">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr class="header"><td colspan="7">{lang memcp_reward_log_payment}</td></tr>
	<tr align="center" class="category">
	<td width="30%" align="left">{lang subject}</td>
	<td width="20%">{lang dateline}</td>
	<td width="18%">{lang forum}</td>
	<td width="9%">{lang memcp_reward_log_payment_answerer}</td>
	<td width="10%">{lang memcp_reward_total}</td>
	<td width="10%">{lang memcp_reward_fact}</td>
	</tr>
	<!--{if $loglist}-->
		<!--{loop $loglist $log}-->
			<tr class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">
			<td><a href="viewthread.php?tid=$log[tid]">$log[subject]</a></td>
			<td align="center">$log[dateline]</td>
			<td align="center"><a href="forumdisplay.php?fid=$log[fid]">$log[name]</a></td>
			<td align="center"><a href="space.php?uid=$log['uid']">$log[username]</a></td>
			<td align="center">{$extcredits[$creditstrans][title]} $log['price']<!--{if $extcredits[$creditstrans][unit] != ''}--> $extcredits[$creditstrans][unit]<!--{/if}--></td>
			<td align="center">{$extcredits[$creditstrans][title]} $log['netamount']<!--{if $extcredits[$creditstrans][unit] != ''}--> $extcredits[$creditstrans][unit]<!--{/if}--></td>
			</tr>
		<!--{/loop}-->
	<!--{else}-->
		<td class="altbg1" colspan="7">{lang memcp_credits_log_none}</td></tr>
	<!--{/if}-->

	</table></div>
	<table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center"><tr><td>$multipage</td></tr></table>
<!--{elseif $operation == 'rewardincomelog'}-->
	<div class="spaceborder spacebottom">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr class="header"><td colspan="7">{lang memcp_reward_log_income}</td></tr>
	<tr align="center" class="category">
	<td width="30%" align="left">{lang subject}</td>
	<td width="20%">{lang dateline}</td>
	<td width="18%">{lang forum}</td>
	<td width="9%">{lang memcp_reward_log_income_author}</td>
	<td width="10%">{lang memcp_reward_total}</td>
	</tr>
	<!--{if $loglist}-->
		<!--{loop $loglist $log}-->
			<tr class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">
			<td><a href="viewthread.php?tid=$log[tid]">$log[subject]</a></td>
			<td align="center">$log[dateline]</td>
			<td align="center"><a href="forumdisplay.php?fid=$log[fid]">$log[name]</a></td>
			<td align="center"><a href="space.php?uid=$log['uid']">$log[username]</a></td>
			<td align="center">{$extcredits[$creditstrans][title]} $log['price']<!--{if $extcredits[$creditstrans]['unit'] != ''}--> $extcredits[$creditstrans][unit]<!--{/if}--></td>
			</tr>
		<!--{/loop}-->
	<!--{else}-->
		<td class="altbg1" colspan="7">{lang memcp_credits_log_none}</td></tr>
	<!--{/if}-->

	</table></div>
	<table cellspacing="0" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center"><tr><td>$multipage</td></tr></table>
<!--{elseif $operation == 'creditslog'}-->
	<div class="spaceborder spacebottom">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr class="header"><td colspan="5">{lang memcp_credits_log_transaction}</td></tr>
	<tr align="center" class="category"><td width="20%" align="left">{lang memcp_credits_log_transaction_fromto}</td><td width="25%">{lang time}</td><td width="15%">{lang memcp_credits_log_transaction_outgo}</td><td width="15%">{lang memcp_credits_log_transaction_income}</td><td width="25%">{lang action}</td></tr>
	<!--{if $loglist}-->
		<!--{loop $loglist $log}-->
			<tr align="center" class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">
			<td><!--{if $log['fromto'] == 'BANK ACCOUNT'}-->{lang memcp_credits_transfer_bank}<!--{else}--><a href="space.php?username=$log[fromtoenc]">$log[fromto]</a><!--{/if}--></td>
			<td>$log[dateline]</td>
			<td><!--{if $log['send']}-->{$extcredits[$log[sendcredits]][title]} $log[send] {$extcredits[$log[sendcredits]][unit]}<!--{/if}--></td>
			<td><!--{if $log['receive']}-->{$extcredits[$log[receivecredits]][title]} $log[receive] {$extcredits[$log[receivecredits]][unit]}<!--{/if}--></td>
			<td>
			<!--{if $log['operation'] == 'TFR'}-->
				{lang memcp_credits_transfer_send}
			<!--{elseif $log['operation'] == 'RCV'}-->
				{lang memcp_credits_transfer_receive}
			<!--{elseif $log['operation'] == 'EXC'}-->
				{lang memcp_credits_exchange}
			<!--{elseif $log['operation'] == 'UGP'}-->
				{lang memcp_usergroups_charged}
			<!--{elseif $log['operation'] == 'AFD'}-->
				{lang memcp_credits_transfer_bank}
			<!--{/if}-->
			</td>
			</tr>
		<!--{/loop}-->
	<!--{else}-->
		<tr><td class="altbg1" colspan="5">{lang memcp_credits_log_none}</td></tr>
	<!--{/if}-->

	</table></div>
	<div class="subtable" style="width: 100%">$multipage</div>
<!--{/if}-->

</td></tr></table>
{template footer}