{template header}
<div class="subtable nav" style="width: {TABLEWIDTH}">
<a href="$indexname">$bbname</a> &raquo; {lang trade}
</div><br>

<script type="text/javascript">
var feevalue = 0;
var price = $trade[price];
var discounttax = 0;
</script>

<div class="spaceborder" style="width: {TABLEWIDTH}">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
<form method="post" name="tradepost" action="trade.php?action=trade<!--{if !$fromcode}-->&tid=$tid<!--{/if}-->">
<tr class="header"><td colspan="3" align="center">{lang trade_buy}</td></tr>
<tr><td class="altbg1" width="20%">{lang trade_seller}:</td>
<td class="altbg2">$trade[seller]</td></tr>
<!--{if !$discuz_uid}-->
	<tr><td class="altbg1" width="20%">{lang trade_buyer}:</td>
	<td class="altbg2"><input type="text" name="guestuser" value="{lang guest}"></td></tr>
<!--{/if}-->
<tr><td class="altbg1">{lang post_trade_name}:</td>
<td class="altbg2">$trade[subject]</td></tr>
<!--{if !$fromcode}-->
	<tr><td class="altbg1">{lang post_trade_quality}:</td>
	<td class="altbg2">
	<!--{if $trade['quality'] == 1}-->{lang trade_new}<!--{/if}-->
	<!--{if $trade['quality'] == 2}-->{lang trade_old}<!--{/if}--></td></tr>
	<tr><td class="altbg1">{lang post_trade_locus}:</td>
	<td class="altbg2">$trade[locus]</td></tr>
	<tr><td class="altbg1">{lang trade_type}:</td>
	<td class="altbg2">
	<!--{if $trade['itemtype'] == 1}-->{lang trade_type_buy}<!--{/if}-->
	<!--{if $trade['itemtype'] == 2}-->{lang trade_type_service}<!--{/if}-->
	<!--{if $trade['itemtype'] == 3}-->{lang trade_type_auction}<!--{/if}-->
	<!--{if $trade['itemtype'] == 4}-->{lang trade_type_donate}<!--{/if}-->
	<!--{if $trade['itemtype'] == 5}-->{lang trade_type_compensate}<!--{/if}-->
	<!--{if $trade['itemtype'] == 6}-->{lang trade_type_bonus}<!--{/if}-->
	</td></tr>
<!--{else}-->
	<input type="hidden" name="payto" value="$payto">
	<input type="hidden" name="seller" value="$seller">
	<input type="hidden" name="fromtid" value="$fromtid">
	<input type="hidden" name="fromcode" value="yes">
<!--{/if}-->
<tr><td class="altbg1">{lang post_trade_price}:</td>
<td class="altbg2">$trade[price] {lang payment_unit}</td></tr>
<!--{if $discountprice > 0 && $discountcredit && $currentcredit >= $discountcredit}-->
	<tr><td class="altbg1">{lang trade_favourable}:</td>
	<td class="altbg2">$discountprice {lang payment_unit}
	<!--{if $discountprice > 0 && $discountcredit && $currentcredit >= $discountcredit}-->
		<input class="checkbox" type="checkbox" name="allowdiscount" value="yes" onclick="calcsum()">{lang trade_discount}
	<!--{else}-->
		<input type="hidden" name="allowdiscount">
	<!--{/if}-->
	</td></tr>
	<script type="text/javascript">discounttax = $tax</script>
<!--{/if}-->
<tr><td class="altbg1">{lang post_trade_transport}:</td>
<td class="altbg2">
<!--{if $trade['transport'] == 1}--><input type="hidden" name="transport" value="1">{lang post_trade_transport_seller}<!--{/if}-->
<!--{if $trade['transport'] == 2}--><input type="hidden" name="transport" value="2">{lang post_trade_transport_buyer}<!--{/if}-->
<!--{if $trade['transport'] == 3}--><input type="hidden" name="transport" value="3">{lang post_trade_transport_virtual}<!--{/if}-->
<!--{if $trade['transport'] == 4}--><input type="hidden" name="transport" value="4">{lang post_trade_transport_physical}<!--{/if}-->
<br>
<!--{if $trade['transport'] == 1 or $trade['transport'] == 2 or $trade['transport'] == 4}-->
	<!--{if !empty($trade['ordinaryfee'])}--> <input class="radio" type="radio" name="fee" value="1" checked <!--{if $trade['transport'] == 2}-->onclick="feevalue = $trade[ordinaryfee];calcsum()"<!--{/if}-->> {lang post_trade_transport_mail} $trade[ordinaryfee] {lang payment_unit}<!--{if $trade['transport'] == 2}--><script type="text/javascript">feevalue = $trade[ordinaryfee]</script><!--{/if}--><!--{/if}-->
	<!--{if !empty($trade['expressfee'])}--> <input class="radio" type="radio" name="fee" value="3" checked <!--{if $trade['transport'] == 2}-->onclick="feevalue = $trade[expressfee];calcsum()"<!--{/if}-->> {lang post_trade_transport_express} $trade[expressfee] {lang payment_unit}<!--{if $trade['transport'] == 2}--><script type="text/javascript">feevalue = $trade[expressfee]</script><!--{/if}--><!--{/if}-->
	<!--{if !empty($trade['emsfee'])}--> <input class="radio" type="radio" name="fee" value="2" checked <!--{if $trade['transport'] == 2}-->onclick="feevalue = $trade[emsfee];calcsum()"<!--{/if}-->> EMS $trade[emsfee] {lang payment_unit}<!--{if $trade['transport'] == 2}--><script type="text/javascript">feevalue = $trade[emsfee]</script><!--{/if}--><!--{/if}-->
<!--{/if}-->
</td></tr>
<tr><td class="altbg1">{lang trade_nums}:</td>
<td class="altbg2"><input type="text" name="number" onkeyup="calcsum()" value="1"></td></tr>
<tr><td class="altbg1">{lang trade_credits_total}:</td>
<td class="altbg2"><span id="caculate"></span></td>
</tr>
<tr><td class="altbg1" width="100">{lang trade_seller_contact}:</td>
<td class="altbg2"><input type="text" name="buyercontact" maxlength="50" style="width: 100%"><br>{lang trade_seller_contact_comment}</td></tr>
<tr><td class="altbg1">{lang trade_seller_remark}:<br>{lang trade_seller_remark_comment}</td>
<td class="altbg2"><textarea name="buyermsg" style="width: 100%" rows="3"></textarea></td></tr>
<tr><td class="altbg1 bottom" colspan="2" align="center">
<!--{if !$discuz_uid}-->{lang trade_guest_alarm}<br><!--{/if}-->
<input class="button" type="submit" name="tradesubmit" value="{lang trade_buy_confirm}">
<!--{if $discuz_uid}--><input class="button" type="button" onclick="window.open('my.php?item=buytrades','','')" value="{lang my_trades}"><!--{/if}-->
</td></tr>
</form>
</table></div>

<script type="text/javascript">
function calcsum() {
	var tax = (tradepost.allowdiscount && tradepost.allowdiscount.checked)? discounttax : 0;
	$('caculate').innerHTML = ((price - tax) * tradepost.number.value + feevalue) + '{lang trade_units}';
}
calcsum();
</script>

{template footer}