{subtemplate header}
<div id="nav"><a href="$indexname">$bbname</a> &raquo; {lang trade_confirm_buy}</div>

<script type="text/javascript" src="include/javascript/viewthread.js"></script>

<script type="text/javascript">
zoomstatus = parseInt($zoomstatus);
var feevalue = 0;
var price = $trade[price];
</script>

<form method="post" id="tradepost" name="tradepost" action="trade.php?action=trade&tid=$tid&pid=$pid">
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<div class="mainbox viewthread tradeinfo">
		<h1>$trade[subject]</h1>
		<div class="tradethumb"><a href="viewthread.php?do=tradeinfo&tid=$tid&pid=$pid">
		<!--{if $trade['aid']}-->
			<img src="attachment.php?aid=$trade[aid]&amp;k={echo md5($trade[aid].md5($authkey).$timestamp);}&amp;t=$timestamp" onload="thumbImg(this)" width="80" height="80" alt="$trade[subject]" /></a>
		<!--{else}-->
			<img src="{IMGDIR}/trade_nophotosmall.gif" alt="$trade[subject]" /></a>
		<!--{/if}-->
		</div>
		<div class="tradeattribute">
			<dl>
			<dt>{lang trade_price}:</dt>
			<dd><strong>$trade[price]</strong>&nbsp;{lang payment_unit}</dd>
			<!--{if $trade[locus]}--><dt>{lang post_trade_locus}:</dt><dd>$trade[locus]</dd><!--{/if}-->
			<dt>{lang trade_seller}:</dt>
			<dd><a href="space.php?uid=$trade[sellerid]" target="_blank">$trade[seller]</a>
			<!--{if $trade['account']}--><a href="https://www.alipay.com/trade/i_credit.do?email=$trade[account]" target="_blank"><img src="{IMGDIR}/alipaysmall.gif" border="0" />{lang payto_creditinfo}</a><!--{/if}-->
			</dd>
			</dl>
		</div>
	</div>

	<div class="mainbox formbox">
		<h3>{lang trade_confirm_buy}</h3>
		<table summary="{lang trade_confirm_buy}" cellspacing="0" cellpadding="0">
			<tr>
				<th>{lang trade_credits_total}</th>
				<td><strong id="caculate"></strong>&nbsp;{lang trade_units}</td>
			</tr>
			<tr>
				<th><label for="number">{lang trade_nums}</label></th>
				<td><input type="text" id="number" name="number" onkeyup="calcsum()" value="1" /></td>
			</tr>
			<tr>
				<th>{lang post_trade_transport}</th>
				<td>
					<p>
					<!--{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}-->
					</p>
					<!--{if $trade['transport'] == 1 or $trade['transport'] == 2 or $trade['transport'] == 4}-->
						<!--{if !empty($trade['ordinaryfee'])}--> <label><input class="radio" type="radio" name="fee" value="1" checked="checked" <!--{if $trade['transport'] == 2}-->onclick="feevalue = $trade[ordinaryfee];calcsum()"<!--{/if}--> /> {lang post_trade_transport_mail} $trade[ordinaryfee] {lang payment_unit}</label><!--{if $trade['transport'] == 2}--><script type="text/javascript">feevalue = $trade[ordinaryfee]</script><!--{/if}--><!--{/if}-->
						<!--{if !empty($trade['expressfee'])}--> <label><input class="radio" type="radio" name="fee" value="3" checked="checked" <!--{if $trade['transport'] == 2}-->onclick="feevalue = $trade[expressfee];calcsum()"<!--{/if}--> /> {lang post_trade_transport_express} $trade[expressfee] {lang payment_unit}</label><!--{if $trade['transport'] == 2}--><script type="text/javascript">feevalue = $trade[expressfee]</script><!--{/if}--><!--{/if}-->
						<!--{if !empty($trade['emsfee'])}--> <label><input class="radio" type="radio" name="fee" value="2" checked="checked" <!--{if $trade['transport'] == 2}-->onclick="feevalue = $trade[emsfee];calcsum()"<!--{/if}--> /> EMS $trade[emsfee] {lang payment_unit}</label><!--{if $trade['transport'] == 2}--><script type="text/javascript">feevalue = $trade[emsfee]</script><!--{/if}--><!--{/if}-->
					<!--{/if}-->
				</td>
			</tr>
			<tr>
				<th>{lang trade_paymethod}</th>
				<td>
					<!--{if !$discuz_uid}-->
						<label><input type="hidden" name="offline" value="0" checked="checked" /> {lang trade_pay_alipay}</label>
					<!--{elseif !$trade['account']}-->
						<input type="hidden" name="offline" value="1" checked="checked" /> {lang trade_pay_offline}
					<!--{else}-->
						<label><input type="radio" class="radio" name="offline" value="0" checked="checked" /> {lang trade_pay_alipay}</label> <label><input type="radio" class="radio" name="offline" value="1" /> {lang trade_pay_offline}</label>
					<!--{/if}-->
				</td>
			</tr>
			<tr>
				<th><label for="buyername">{lang trade_buyername}</label></th>
				<td><input type="text" id="buyername" name="buyername" maxlength="50" value="$lastbuyerinfo[buyername]" /></td>
			</tr>
			<tr>
				<th><label for="buyercontact">{lang trade_buyercontact}</label></th>
				<td><input type="text" id="buyercontact" name="buyercontact" maxlength="100" size="80" value="$lastbuyerinfo[buyercontact]" /></td>
			</tr>
			<tr>
				<th><label for="buyerzip">{lang trade_buyerzip}</label></th>
				<td><input type="text" id="buyerzip" name="buyerzip" maxlength="10" value="$lastbuyerinfo[buyerzip]" /></td>
			</tr>
			<tr>
				<th><label for="buyerphone">{lang trade_buyerphone}</label></th>
				<td><input type="text" id="buyerphone" name="buyerphone" maxlength="20" value="$lastbuyerinfo[buyerphone]" /></td>
			</tr>
			<tr>
				<th><label for="buyermobile">{lang trade_buyermobile}</label></th>
				<td><input type="text" id="buyermobile" name="buyermobile" maxlength="20" value="$lastbuyerinfo[buyermobile]" /></td>
			</tr>
			<tr>
				<th valign="top"><label for="buyermsg">{lang trade_seller_remark}</label><div class="tips">{lang trade_seller_remark_comment}</div></th>
				<td>
					<textarea id="buyermsg" name="buyermsg" style="width: 95%" rows="3"></textarea>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td>
					<button class="submit" type="submit" name="tradesubmit" value="true">{lang trade_buy_confirm}</button>
					<!--{if !$discuz_uid}--><em class="tips">{lang trade_guest_alarm}</em><!--{/if}-->
				</td>
			</tr>
		</table>
	</div>
</form>

<script type="text/javascript">
function calcsum() {
	$('caculate').innerHTML = (price * $('tradepost').number.value + feevalue);
}
calcsum();
</script>

{subtemplate footer}