<div id="body">
<div class="link_path"><a href="{$_config[siteurl]}">首页</a>&nbsp;&raquo;&nbsp;<a href="{$MOD[url]}">兑奖中心</a>&nbsp;&raquo;&nbsp;<a href="exchange.php?action=gift&giftid=$giftid">$gift[name]</a>&nbsp;&raquo;&nbsp;提交兑换</div>
<div class="mainrail rail-border-3">
    <div id="detail_left">
        <div class="post">
            <div class="title"><h1>兑换奖品（$gift[name]）申请</h1></div>
			<form method="post" action="{$_modules[shop][url]}post.php?action=exchange" name="exchangefrm" onsubmit="return check_exchange(this);">
			<input type="hidden" name="giftid" value="$giftid" />
			<table class="table" cellspacing="0" cellpadding="0">
				<tr>
					<td width="80">联&nbsp;&nbsp;系&nbsp;&nbsp;人：</td>
					<td><input type="text" name="linkman" class="t_input" />&nbsp;<span class="font_1">*</span></td>
				</tr>
				<tr>
					<td>兑换数量：</td>
					<td><input type="text" name="number" value="1" size="10" class="t_input" />&nbsp;<span class="font_1">*</span></td>
				</tr>
				<tr>
					<td>联系电话：</td>
					<td><input type="text" name="tel" class="t_input" />&nbsp;<span class="font_1">*</span></td>
				</tr>
				<tr>
					<td>手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
					<td><input type="text" name="mobile" class="t_input" /></td>
				</tr>
				<tr>
					<td>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编：</td>
					<td><input type="text" name="postcode" size="10" class="t_input" />&nbsp;<span class="font_1">*</span></td>
				</tr>
				<tr>
					<td>联系地址：</td>
					<td><input type="text" name="address" size="40" class="t_input" />&nbsp;<span class="font_1">*</span></td>
				</tr>
				<!--{if $_exchange[seccode]}-->
				<tr>
					<td>验&nbsp;&nbsp;证&nbsp;&nbsp;码：</td>
					<td><div id="seccode"></div><input type="text" name="seccode" size="10" onfocus="show_seccode();" class="t_input" />&nbsp;&nbsp;<span class="font_1">*</span></td>
				</tr>
				<!--{/if}-->
				<tr>
					<td valign="top">备注说明：</td>
					<td><textarea name="comment" rows="5" cols="60"></textarea></td>
				</tr>
				<tr>
					<td></td>
					<td><button type="submit" name="exchangesubmit" value="yes" /> 提 交 </button>&nbsp;&nbsp;注：<span class="font_1">*</span>为必填</td>
				</tr>
            </table>
            </form>
        </div>
		<!--
		<div class="exchangeinfo">
            <h3>兑换规则说明</h3>
			<p>-------------</p>
		</div>
		-->
    </div>
    <div id="detail_right" style="margin-top:5px;">
        <div class="mainrail">
            <h1 class="rail-h-3 rail-h-bg-1"><b>$gift[name]</b></h1>
            <ul class="rail-list">
                <li>兑换金币：<span class="font_2">$gift[price]</li>
                <li>库存数量：<span class="font_2">$gift[num]</li>
                <li>累计兑换：<span class="font_2">$gift[salevolume]</li>
            </ul>
        </div>
        <div class="mainrail">
            <h1 class="rail-h-3 rail-h-bg-2">奖品图片</h1>
            <ul class="rail-list">
                <a href="{$_config[siteurl]}uploads/gifts/$gift[picture][filename]" target="_blank"><img src="{$_config[siteurl]}uploads/gifts/$gift[thumb][filename]" $gift[thumb][attr] /></a>
            </ul>
        </div>
    </div>
    <div class="clear"></div>
</div>
</div>
<script type="text/javascript">
function check_exchange(form) {
	form = document.exchangefrm;
	if(form.linkman.value.trim() == '') {
		alert('未填写联系人。');
		return false;
	} else if(form.number.value.trim() == '') {
		alert('未填写兑换数量。');
		return false;
	} else if(!is_numeric(form.number.value.trim())) {
		alert('兑换数量不正确。');
		return false;
	} else if(form.number.value.trim() <= 0) {
		alert('兑换数量不能小于0。');
		return false;
	} else if(form.tel.value.trim() == '') {
		alert('未填写联系电话。');
		return false;
	} else if(!form.tel.value.trim().match(/^[0-9\-]+$/)) {
		alert('联系电话格式不正确。');
		return false;
	} else if(form.mobile.value.trim() != '' && !form.mobile.value.trim().match(/^[0-9\-]+$/)) {
		alert('手机号码格式不正确。');
		return false;
	} else if(form.postcode.value.trim() == '') {
		alert('未填写邮政编码。');
		return false;
	} else if(!form.postcode.value.trim().match(/^[0-9]+$/)) {
		alert('邮政编码格式不正确。');
		return false;
	} else if(form.address.value.trim().length < 2) {
		alert('未填写联系地址。');
		return false;
	} else if(form.seccode.value.trim() != '' && !form.seccode.value.trim().match(/^[0-9a-zA-Z]+$/)) {
		alert('验证码格式不正确。');
		return false;
	} else {
		return confirm('您确定兑换此礼品吗？');
	}
}
</script>