{template header}

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

<!--{if isset($trade) && $allowposttrade || isset($activity) && $allowpostactivity}-->
	<script type="text/javascript" src="include/javascript/calendar.js"></script>
<!--{/if}-->
<script type="text/javascript">
var postminchars = parseInt('$minpostsize');
var postmaxchars = parseInt('$maxpostsize');
var disablepostctrl = parseInt('$disablepostctrl');
var attachments = new Array();
var bbinsert = parseInt('$bbinsert');
var attachimgurl = new Array();
function checklength(theform) {
	var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
	var showmessage = postmaxchars != 0 ? '{lang board_allowed}: ' + postminchars + ' {lang lento} ' + postmaxchars + ' {lang bytes}' : '';
	alert('\n{lang post_curlength}: ' + mb_strlen(message) + ' {lang bytes}\n\n' + showmessage);
}
function validate(theform, previewpost) {
	var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
	if (message == "" && theform.subject.value == "") {
		alert("{lang post_subject_and_message_isnull}");
		theform.subject.focus();
		return false;
	} else if (mb_strlen(theform.subject.value) > 80) {
		alert("{lang post_subject_toolong}");
		theform.subject.focus();
		return false;
	}<!--{if isset($trade) && $allowposttrade}--> else if (theform.seller.value == "") {
		alert("{lang post_trade_alipay_null}");
		theform.seller.focus();
		return false;
	} else if (theform.item_name.value == "") {
		alert("{lang post_trade_goodsname_null}");
		theform.item_name.focus();
		return false;
	} else if (theform.item_price.value == "") {
		alert("{lang post_trade_price_null}");
		theform.item_price.focus();
		return false;
	} else if (theform.item_locus.value == "") {
		alert("{lang post_trade_addr_null}");
		theform.item_locus.focus();
		return false;
	}<!--{elseif isset($activity) && $allowpostactivity}--> else if (theform.activityclass.value == "") {
		alert("{lang post_activity_sort_null}");
		theform.activityclass.focus();
		return false;
	} else if ($('starttimefrom_0').value == "" && $('starttimefrom_1').value == "") {
		alert("{lang post_activity_fromtime_null}");
		return false;
	} else if (theform.activityplace.value == "") {
		alert("{lang post_activity_addr_null}");
		theform.activityplace.focus();
		return false;
	}<!--{elseif isset($reward) && $allowpostreward}--> else if (theform.rewardprice.value == "") {
		alert("{lang reward_credits_null}");
		theform.rewardprice.focus();
		return false;
	}
	<!--{/if}-->
	if (!disablepostctrl && ((postminchars != 0 && mb_strlen(message) < postminchars) || (postmaxchars != 0 && mb_strlen(message) > postmaxchars))) {
		alert("{lang post_message_length_invalid}\n\n{lang post_curlength}: "+mb_strlen(message)+" {lang bytes}\n{lang board_allowed}: "+postminchars+" {lang lento} "+postmaxchars+" {lang bytes}");
		return false;
	}
	if (!previewpost) {
		theform.editsubmit.disabled = true;
	}
	theform.message.value = message;
	return true;
}
function restore(aid) {
	obj = $('attach'+aid);
	objupdate = $('attachupdate'+aid);
	obj.style.display = '';
	objupdate.innerHTML = '';

}
function attachupdate(aid) {
	obj = $('attach'+aid);
	objupdate = $('attachupdate'+aid);
	obj.style.display = 'none';
	objupdate.innerHTML = '<input type="file" name="attachupdate[paid' + aid + ']" size="15"> <input class="button" type="button" value="{lang cancel}" onclick="restore(\'' + aid + '\')">';
}
function insertAttachTag(aid) {
	if (bbinsert && wysiwyg) {
		insertText('[attach]' + aid + '[/attach]', false);
	} else {
		AddText('[attach]' + aid + '[/attach]');
	}
}
function insertAttachimgTag(aid, width) {
	if (bbinsert && wysiwyg) {
		eval('var attachimgurl = attachimgurl_' + aid);
		insertText('<img src="' + attachimgurl[0] + '" border="0" aid="attachimg_' + aid + '" width="' + width + '" alt="" />', false);
	} else {
		AddText('[attachimg]' + aid + '[/attachimg]');
	}
}
</script>

{template post_preview}

<form method="post" id="postform" action="post.php?action=edit&extra=$extra&editsubmit=yes&mod=$mod" $enctype onSubmit="return validate(this)">
<input type="hidden" name="formhash" id="formhash" value="{FORMHASH}">
<input type="hidden" name="page" value="$page">

<div class="spaceborder" style="width: {TABLEWIDTH}">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
<tr>
<td colspan="2" class="header">{lang post_editpost}</td>
</tr>

<!--{if $discuz_uid}-->
	<tr><td class="altbg1"><span class="bold">{lang username}</span></td>
	<td class="altbg2">$discuz_userss <span class="smalltxt">[<a href="$link_logout">{lang member_logout}</a>]</span></td>
	</tr>
<!--{/if}-->

<!--{if $allowsetreadperm && $isfirstpost}-->
	<tr>
	<td class="altbg1"><span class="bold">{lang readperm_thread}</span></td>
	<td class="altbg2"><input type="text" name="readperm" size="6" value="$thread[readperm]"> <span class="smalltxt">({lang post_zero_is_nopermission})</span></td>
	</tr>
<!--{/if}-->

<!--{if $maxprice && $isfirstpost && !$thread['special']}-->
	<tr>
	<td class="altbg1"><span class="bold">{lang price}</span>({$extcredits[$creditstrans][title]})</td>
	<td class="altbg2">
	<!--{if $thread['price'] == -1 || $thread['freecharge']}-->
		<input type="text" name="price" size="6" value="$thread[pricedisplay]" disabled> <span class="smalltxt">{$extcredits[$creditstrans][unit]}&nbsp;
		<!--{if $thread['price'] == -1}-->({lang post_price_refunded})<!--{else}-->({lang post_price_free})<!--{/if}-->
		</span>
	<!--{else}-->
		<input type="text" name="price" size="6" value="$thread[pricedisplay]"> <span class="smalltxt">{$extcredits[$creditstrans][unit]} ({lang post_price_comment}<!--{if $maxincperthread}-->{lang post_price_income_comment}<!--{/if}--><!--{if $maxchargespan}-->{lang post_price_charge_comment}<!--{/if}-->)</span>
		{lang post_price_free_comment}
	<!--{/if}-->
	</td></tr>
<!--{/if}-->

<!--{if $thread['special'] == 3 && $isfirstpost}-->
	<tr>
	<td class="altbg1"><span class="bold">{lang reward_price}</span><!--{if !empty($extcredits[$creditstrans][title])}-->({$extcredits[$creditstrans][title]})<!--{/if}--></td>
	<td class="altbg2">
	<!--{if $thread['price'] > 0}-->
	<input onkeyup="getrealprice(this.value)" type="text" name="rewardprice" size="6" value="$rewardprice">
	{lang reward_tax_add}: <span id="realprice">0</span> {$extcredits[$creditstrans][unit]} ({lang reward_low} $minrewardprice {$extcredits[$creditstrans][unit]}<!--{if $maxrewardprice > 0}--> - $maxrewardprice {$extcredits[$creditstrans][unit]}<!--{/if}--></span>)
	<!--{elseif $thread['price'] < 0 && $forum['ismoderator']}-->
	<input type="text" name="rewardprice" size="6" value="$rewardprice">
	<!--{else}-->
	<input onkeyup="getrealprice(this.value)" type="hidden" name="rewardprice" size="6" value="$rewardprice">$rewardprice {$extcredits[$creditstrans][unit]}
	<!--{/if}-->
	</td>
	</tr>
	<!--{if $thread['price'] > 0}-->
	<script type="text/javascript">
		$('realprice').innerHTML = 0;
		function getrealprice(price){
			if(!price.search(/^\d+$/) ) {
				n = parseInt(price) + Math.ceil(parseInt(price * $creditstax)) - (parseInt($thread['price']) + Math.ceil(parseInt($thread['price'] * $creditstax)));
				if(price > 32767) {
					$('realprice').innerHTML = '<b>{lang reward_price_overflow}</b>';
				} else if (price < $rewardprice) {
					$('realprice').innerHTML = '<b>{lang reward_cant_fall}</b>';
				}else if (price < $minrewardprice || ($maxrewardprice > 0 && price > $maxrewardprice)) {
					$('realprice').innerHTML = '<b>{lang reward_price_bound}</b>';
				} else {
					$('realprice').innerHTML = n;
				}
			}else{
				$('realprice').innerHTML = '<b>{lang input_invalid}</b>';
			}
		}
	</script>
	<!--{/if}-->
<!--{/if}-->

<tr>
<td class="altbg1" width="20%"><span class="bold"><!--{if isset($activity) && $allowpostactivity}-->{lang activity_name}<!--{else}-->{lang subject}<!--{/if}--></span></td>
<td class="altbg2">
<!--{if $isfirstpost}-->$typeselect<!--{/if}-->
<!--{if $thread['special'] == 3 && !$forum['ismoderator'] && $isfirstpost && $thread['replies'] > 0}-->
<input type="hidden" name="subject" id="subject" size="45" value="$postinfo[subject]" tabindex="3">$postinfo[subject]
<!--{else}-->
<input type="text" name="subject" id="subject" size="45" value="$postinfo[subject]" tabindex="3">
<!--{/if}-->
<input type="hidden" name="origsubject" value="$postinfo[subject]">
</td></tr>

<!--{if $thread['special'] == 1 && $isfirstpost && ($alloweditpoll || $thread['authorid'] == $discuz_uid)}-->
	<input type="hidden" name="polls" value="yes">
	<tr><td class="altbg1"><span class="bold">{lang poll_days_valid}</span></td><td class="altbg2"><input type="text" name="expiration" value="<!--{if !$poll[expiration]}-->0<!--{elseif $poll[expiration] < 0}-->{lang poll_close}<!--{elseif $poll[expiration] < $timestamp}-->{lang poll_finish}<!--{else}{eval print_r(round(($poll[expiration] - $timestamp) / 86400))} {/if}-->" size="6" tabindex="4"> <span class="smalltxt">({lang post_zero_is_nopermission})</span></td></tr>
	<tr>
	<td class="altbg1" valign="top"><span class="bold">{lang post_poll_options}</span><br>
	{lang post_poll_comment} $maxpolloptions<br><br>
	<input class="checkbox" type="checkbox" name="visibilitypoll" value="1" <!--{if !$poll[visible]}-->checked<!--{/if}-->> {lang poll_submit_after}<br>
	<input class="checkbox" type="checkbox" name="multiplepoll" value="1" <!--{if $poll[multiple]}-->checked<!--{/if}-->  onclick="this.checked?$('maxchoicescontrol').style.display='':$('maxchoicescontrol').style.display='none';"> {lang post_poll_allowmultiple}<br>
	<!--{if !$poll[expiration] || $poll[expiration] > $timestamp}--><input class="checkbox" type="checkbox" name="close" value="1"> {lang poll_close}<br><!--{/if}-->
	<span id="maxchoicescontrol"<!--{if !$poll[multiple]}-->style="display: none"<!--{/if}-->>{lang poll_max_options}: <input type="text" name="maxchoices" value="$poll[maxchoices]" size="5"><br>
	</span></td><td class="altbg2">
	{lang poll_show_order}&nbsp;<a id="addpolloptlink" href="###" onclick="addpollopt()">[{lang poll_option_add}]</a><br>
	<!--{loop $poll['polloption'] $key $option}-->
		<input type="hidden" name="polloptionid[{$poll[polloptionid][$key]}]" value="$poll[polloptionid][$key]">
		<input type="text" name="displayorder[{$poll[polloptionid][$key]}]" value="$poll[displayorder][$key]" size="5" style="text-align:right">&nbsp;<input type="text" name="polloption[{$poll[polloptionid][$key]}]" value="$option" size="55"<!--{if !$alloweditpoll}--> readonly<!--{/if}-->><br>
	<!--{/loop}-->
	<span id="addpolloptindex"></span>
	</td></tr>
<script type="text/javascript">
var max = $key + 1;
var polloptionid = $poll[polloptionid][$key] + 1;
function addpollopt() {
	if(max < $maxpolloptions) {
		max++;
		var optrow='<input type="hidden" name="polloptionid['+ polloptionid +']" value='+ polloptionid +'><input type="text" name="displayorder['+ polloptionid +']" value="" size="5" style="text-align:right">&nbsp;<input type="text" name="polloption['+ polloptionid +']" value="" size="55"><br>';
		$('addpolloptindex').innerHTML = $('addpolloptindex').innerHTML + optrow;
		polloptionid++;
		if(max == $maxpolloptions) {
			$('addpolloptlink').disabled=true;
		}
	}
}
</script>
<!--{/if}-->

<!--{if $thread['special'] == 2 && $allowposttrade && $isfirstpost}-->
	<input type="hidden" name="trade" value="yes">
	<tr>
	<td class="altbg1"><span class="bold">{lang post_trade_seller}</span></td>
	<td class="altbg2"><input type="text" name="seller" size="30" value="$trade[account]"></td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang post_trade_name}</span></td>
	<td class="altbg2"><input type="text" name="item_name" size="30" value="$trade[subject]"></td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang post_trade_price}</span></td>
	<td class="altbg2"><input onkeyup="getrealtax(this.value)" type="text" name="item_price" size="30" value="$trade[price]"> <!--{if $mintradeprice && $maxtradeprice}-->{lang tarde_price_bound} $mintradeprice {lang payment_unit} - $maxtradeprice {lang payment_unit}<!--{else}-->{lang trade_min_price} $mintradeprice {lang payment_unit}<!--{/if}-->
	<!--{if $ec_commision && $tradetaxs}-->
		({lang trade_procedure_price}: <!--{if $tradetaxtype == 2}-->$tradetaxs%, <span id="realtax">0</span> {lang payment_unit}<!--{else}--><span id="realtax">$tradetaxs</span> {lang payment_unit}<!--{/if}-->)
	<!--{else}-->
		<span id="realtax"></span>
	<!--{/if}-->
	</td>
	</tr>
	<script type="text/javascript">
		function getrealtax(price){
			if(!price.search(/^[\d\.]+$/) ) {
				<!--{if $tradetaxtype == 2}-->n = Math.ceil(price * ($tradetaxs / 100));<!--{else}-->n = Math.ceil($tradetaxs)<!--{/if}-->
				if(price < $mintradeprice<!--{if $maxtradeprice}--> || price > $maxtradeprice<!--{/if}-->) {
					$('realtax').innerHTML = '<b>{lang trade_price_exceed}</b>';
				} else {
					<!--{if $ec_commision && $tradetaxs}-->
						if(price > n) {
							$('realtax').innerHTML = n;
						} else {
							$('realtax').innerHTML = 0;
						}
					<!--{else}-->
						$('realtax').innerHTML = '';
					<!--{/if}-->
				}
			}else{
				$('realtax').innerHTML = '<b>{lang input_invalid}</b>';
			}
		}
		<!--{if $tradetaxtype == 2}-->$('realtax').innerHTML = Math.ceil($trade[price] * ($tradetaxs / 100));<!--{/if}-->
	</script>
	<tr>
	<td class="altbg1"><span class="bold">{lang post_trade_locus}</span></td>
	<td class="altbg2"><input type="text" name="item_locus" size="30" value="$trade[locus]"></td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang trade_goods_number}</span></td>
	<td class="altbg2"><input type="text" name="item_number" size="30" value="$trade[amount]"></td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang post_trade_quality}</span></td>
	<td class="altbg2">
	<select name="item_quality">
	<option value="1" <!--{if $trade['quality'] == 1}-->selected<!--{/if}-->>{lang trade_new}</option>
	<option value="2" <!--{if $trade['quality'] == 2}-->selected<!--{/if}-->>{lang trade_old}</option>
	</select>
	</td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang trade_type}</span></td>
	<td class="altbg2">
	<select name="item_type">
	<option value="1" <!--{if $trade['itemtype'] == 1}-->selected<!--{/if}-->>{lang trade_type_buy}</option>
	<option value="2" <!--{if $trade['itemtype'] == 2}-->selected<!--{/if}-->>{lang trade_type_service}</option>
	<option value="3" <!--{if $trade['itemtype'] == 3}-->selected<!--{/if}-->>{lang trade_type_auction}</option>
	<option value="4" <!--{if $trade['itemtype'] == 4}-->selected<!--{/if}-->>{lang trade_type_donate}</option>
	<option value="5" <!--{if $trade['itemtype'] == 5}-->selected<!--{/if}-->>{lang trade_type_compensate}</option>
	<option value="6" <!--{if $trade['itemtype'] == 6}-->selected<!--{/if}-->>{lang trade_type_bonus}</option>
	</select>
	</td>
	</tr>
	<tr>
	<td class="altbg1" valign="top"><span class="bold">{lang post_trade_transport}</span></td>
	<td class="altbg2">
	<input class="radio" type="radio" name="transport" value="virtual" <!--{if $trade['transport'] == 3}-->checked<!--{/if}--> onclick="$('logisticssetting').style.display='none'"> {lang post_trade_transport_virtual}<br>
	<input class="radio" type="radio" name="transport" value="seller" <!--{if $trade['transport'] == 1}-->checked<!--{/if}--> onclick="$('logisticssetting').style.display=''"> {lang post_trade_transport_seller}
	<input class="radio" type="radio" name="transport" value="buyer" <!--{if $trade['transport'] == 2}-->checked<!--{/if}--> onclick="$('logisticssetting').style.display=''"> {lang post_trade_transport_buyer}
	<input class="radio" type="radio" name="transport" value="logistics" <!--{if $trade['transport'] == 4}-->checked<!--{/if}--> onclick="$('logisticssetting').style.display=''"> {lang trade_type_transport_physical}<br>
	<span id="logisticssetting" style="display:<!--{if $trade['transport'] == 3}-->none<!--{/if}-->">
	{lang post_trade_transport_mail} <input type="text" name="postage_mail" size="3" value="$trade[ordinaryfee]"> {lang payment_unit} ({lang post_trade_transport_mail_unit})<br>
	{lang post_trade_transport_express} <input type="text" name="postage_express" size="3" value="$trade[expressfee]"> {lang payment_unit} ({lang post_trade_transport_express_unit})<br>
	EMS <input type="text" name="postage_ems" size="3" value="$trade[emsfee]"> {lang payment_unit} ({lang post_trade_transport_ems_unit})<br>
	</td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang trade_start}</span></td>
	<td class="altbg2">
	<select name="closed">
	<option value="0" <!--{if $trade['closed'] == 0}-->selected<!--{/if}-->>{lang yes}</option>
	<option value="1" <!--{if $trade['closed'] == 1}-->selected<!--{/if}-->>{lang no}</option>
	</select>
	</td>
	</tr>
	<tr>
	<td class="altbg1"><span class="bold">{lang thread_moderations_expiration}</span></td>
	<td class="altbg2"><input onclick="showcalendar(event, this, false)" type="text" name="item_expiration" size="30" value="$trade[expiration]">
	<select onchange="this.form.item_expiration.value = this.value">
	<option value=''></option>
	<option value=''>{lang thread_moderations_expiration_unlimit}</option>
	<option value='$expiration_7'>{lang seven_days}</option>
	<option value='$expiration_14'>{lang fourteen}</option>
	<option value='$expiration_month'>{lang one_months}</option>
	</select>
	({lang trade_expiration_forever}) {lang sample}: <!--{eval echo date("Y-m-d", $timestamp + 86400 * 14)}--></td>
	</tr>
<!--{/if}-->

<!--{if $thread['special'] == 4 && $isfirstpost}-->
	<input type="hidden" name="activity" value="yes">
	<tr>
	<td class="altbg1"><span class="bold">{lang activiy_sort}</span></td>
	<td class="altbg2">
	<input type="text" size="45" name="activityclass" value="$activity['class']" tabindex="4">
	</td>
	</tr><tr>
	<td class="altbg1"><span class="bold">{lang activity_starttime}</span></td>
	<td class="altbg2">
	<input class="radio" type="radio" value="0" name="activitytime" onclick="$('certainstarttime').style.display='';$('uncertainstarttime').style.display='none';" <!--{if !$activity['starttimeto']}-->checked<!--{/if}-->>{lang activity_specific_time}: <span id="certainstarttime" <!--{if $activity['starttimeto']}-->style="display: none"<!--{/if}-->><input onclick="showcalendar(event, this, true)" type="text" name="starttimefrom[0]" id="starttimefrom_0" size="15" value="<!--{if !$activity['starttimeto']}-->$activity[starttimefrom]<!--{/if}-->"> {lang sample}:<!--{eval echo date("Y-m-d H:i", $timestamp + 86400)}--></span><br>
	<input class="radio" type="radio" value="1" name="activitytime" onclick="$('certainstarttime').style.display='none';$('uncertainstarttime').style.display=''" <!--{if $activity['starttimeto']}-->checked<!--{/if}-->>{lang activity_bound_time}: <span id="uncertainstarttime" <!--{if !$activity['starttimeto']}-->style="display: none"<!--{/if}-->> <input onclick="showcalendar(event, this, true)" type="text" name="starttimefrom[1]" id="starttimefrom_1" size="20" value="<!--{if $activity[starttimeto]}-->$activity[starttimefrom]<!--{/if}-->"> - <input onclick="showcalendar(event, this, true)" type="text" name="starttimeto" size="20" value="<!--{if $activity['starttimeto']}-->$activity[starttimeto]<!--{/if}-->"></span>
	</td>
	</tr><tr>
	<td class="altbg1"><span class="bold">{lang activity_space}</span></td>
	<td class="altbg2"><input type="text" name="activityplace"size="45" value="$activity['place']" tabindex="6"></td>
	</tr><tr>
	<td class="altbg1"><span class="bold">{lang activity_payment}</span></td>
	<td class="altbg2">
	<input onkeyup="checkvalue(this.value, 'costmessage')" type="text" name="cost" size="8" value="$activity['cost']" tabindex="7"> {lang payment_unit} <span id="costmessage"></span>
	</td>
	</tr><tr>
	<td class="altbg1"><span class="bold">{lang gender}</span></td>
	<td class="altbg2">
	<input class="radio" type="radio" name="gender" value="0" <!--{if !$activity['gender']}-->checked<!--{/if}-->>{lang unlimited} <input class="radio" type="radio" name="gender" value="1" <!--{if $activity['gender'] == 1}-->checked<!--{/if}-->>{lang male} <input class="radio" type="radio" name="gender" value="2" <!--{if $activity['gender'] == 2}-->checked<!--{/if}-->>{lang female}</td>
	</tr><tr>
	<td class="altbg1"><span class="bold">{lang activity_about_member}</span>({lang optional_info})</td>
	<td class="altbg2"><input onkeyup="checkvalue(this.value, 'activitynumbermessage')" type="text" name="activitynumber" size="45" value="$activity['number']" tabindex="8"> <span id="activitynumbermessage"></span></td>
	</tr>
	<script type="text/javascript">
		function checkvalue(value, message){
			if(!value.search(/^\d+$/)) {
				$(message).innerHTML = '';
			} else {
				$(message).innerHTML = '<b>{lang input_invalid}</b>';
			}
		}
	</script>
	<tr>
	<td class="altbg1"><span class="bold">{lang activity_totime}</span>({lang optional_info})<br>{lang post_zero_is_nopermission}</td>
	<td class="altbg2"><input onclick="showcalendar(event, this, true)" type="text" name="activityexpiration" size="45" value="$activity['expiration']" tabindex="9"> {lang sample}:<!--{eval echo date("Y-m-d H:i", $timestamp + 86400)}--></td>
	</tr>
<!--{/if}-->

<!--{if $isfirstpost}-->
	<tr>
	<td class="altbg1"><span class="bold">{lang icon}</span></td><td class="altbg2"><input class="radio" type="radio" name="iconid" value="0" checked> {lang none} $icons</td>
	</tr>
<!--{/if}-->

<tr class="bottom">
<td class="altbg1" valign="top">
{template post_sminsert}
<input class="checkbox" type="checkbox" name="parseurloff" id="parseurloff" value="1" $urloffcheck> {lang disable} {lang post_parseurl}<br>
<input class="checkbox" type="checkbox" name="smileyoff" id="smileyoff" value="1" $smileyoffcheck> {lang disable} {faq smilies}<br>
<input class="checkbox" type="checkbox" name="bbcodeoff" id="bbcodeoff" value="1" $codeoffcheck> {lang disable} {faq discuzcode}<br>
<!--{if $orig['allowhtml']}--><input class="checkbox" type="checkbox" name="htmlon" id="htmlon" value="1" $htmloncheck> {lang enable} {lang post_html}<br><!--{/if}-->
<!--{if $allowanonymous || (!$allowanonymous && $orig['anonymous'])}--><input class="checkbox" type="checkbox" name="isanonymous" value="1" <!--{if $orig['anonymous']}-->checked<!--{/if}-->> {lang post_anonymous}<br><!--{/if}-->
<input class="checkbox" type="checkbox" name="usesig" value="1" $usesigcheck> {lang post_show_sig}<br>

<!--{if ($isorigauthor || $forum['ismoderator']) && $isfirstpost && $thread['replies'] < 1}-->
	<input class="checkbox" type="checkbox" name="delete" value="1"> <b>{lang post_delpost}</b>
	<!--{if $thread['special'] == 3}-->{lang reward_price_back}<!--{/if}--><br>
<!--{elseif !$isfirstpost && ($isorigauthor || $forum['ismoderator'])}-->
	<input class="checkbox" type="checkbox" name="delete" value="1"> <b>{lang post_delpost}</b>
<!--{/if}-->

<!--{if $auditstatuson}--><input class="checkbox" type="checkbox" name="audit" value="1"> <b>{lang auditstatuson}</b><!--{/if}-->
</td>

<td align="left" class="altbg2" valign="top">
<div id="$editorid">
{template post_bbinsert}
<div class="editor_text"><textarea name="message" rows="10" cols="60" style="width:100%; height:350px;" tabindex="100" id="{$editorid}_textarea" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyUp="javascript:storeCaret(this);" onKeyDown="ctlent(event);">$postinfo[message]</textarea></div>
<table width="100%" cellpadding="{TABLESPACE}" cellspacing="0" class="editor_button"><tr><td>
<div class="editor_textexpand"><img src="images/common/bb_contract.gif" width="11" height="21" title="{lang post_discuzcode_contract}" alt="{lang post_discuzcode_contract}" onclick="resizeEditor(-100)" /><img src="images/common/bb_expand.gif" width="11" height="21" title="{lang post_discuzcode_expand}" alt="{lang post_discuzcode_expand}" onclick="resizeEditor(100)" /></div>
</td><td align="right">
<input type="button" class="lightbutton" value="{lang post_check_length}" onclick="checklength($('postform'))">
<input type="button" class="lightbutton" name="previewbutton" id="previewbutton" value="{lang post_previewpost}" tabindex="102" onclick="previewpost()">
<input type="button" class="lightbutton" name="restoredata" id="restoredata" value="{lang post_autosave_restore}" tabindex="103" title="{lang post_autosave_last_restore}" onclick="loadData()">
<input type="button" class="lightbutton" value=" {lang post_topicreset} " tabindex="104" onclick="clearcontent()">
</td></tr>
<!--{if $allowpostattach}-->
	<tr><td colspan="2">
	{template post_attachments}
	</td></tr>
<!--{/if}-->
</table>
</div>

<div class="postsubmit">
<input class="button" type="submit" name="editsubmit" id="postsubmit" value="{lang post_editpost}" tabindex="101">
<input type="hidden" name="wysiwyg" id="{$editorid}_mode" value="$editormode">
<input type="hidden" name="fid" id="fid" value="$fid">
<input type="hidden" name="tid" value="$tid">
<input type="hidden" name="pid" value="$pid">
<input type="hidden" name="postsubject" value="$postinfo[subject]">
{lang post_submit_hotkey}
</div>

</td></tr></table></div>

<!--{if $postinfo['attachment']}-->
	<br>
	<div class="spaceborder" style="width: {TABLEWIDTH}; clear: both">
	<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
	<tr><td colspan="9" class="header">{lang attachments}</td></tr>
	<tr align="center" class="category"><td>{lang delete_check}</td><td>aid</td><td width="30%" align="left">{lang attachment}</td><td>{lang attachment_date}</td><td>{lang attachment_size}</td><td>{lang downloads}</td><td>{lang readperm}</td><td>{lang price}</td><td>{lang description}</td></tr>
	<!--{loop $attachments $attach}-->
		<tr align="center" class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">
		<td><input class="checkbox" type="checkbox" name="deleteaid[]" value="$attach[aid]"></td>
		<td>
		<!--{if $attach['isimage']}-->
			<a href="###" onclick="insertAttachimgTag('$attach[aid]', '$attach['width']')" title="{lang post_attachment_insert}">$attach[aid]</a>
			<script>attachimgurl_{$attach[aid]} = ['$attach[url]/$attach[attachment]', {$attach['width']}];</script>
		<!--{else}-->
			<a href="###" onclick="insertAttachTag('$attach[aid]')" title="{lang post_attachment_insert}">$attach[aid]</a>
		<!--{/if}-->
		</td>
		<td align="left">
		<div id="attach$attach[aid]">
		<a href="###" class="right" onclick="attachupdate('$attach[aid]')">[{lang update}]</a>
		<!--{if $attach['isimage']}-->
			<a href="###" class="right" onclick="insertAttachimgTag('$attach[aid]', '$attach['width']')" title="{lang post_attachment_insert}">[{lang post_attachment_insertlink}]</a>
		<!--{else}-->
			<a href="###" class="right" onclick="insertAttachTag('$attach[aid]')" title="{lang post_attachment_insert}">[{lang post_attachment_insertlink}]</a>
		<!--{/if}-->
		<!--{if $attach['isimage']}-->
			<!--{if $editormode || $allowswitcheditor}-->
				<span id="imgpreview_$attach[aid]" onmouseover="showMenu(this.id, 0, 0, 1, 0)">$attach[filetype] <a href="attachment.php?aid=$attach[aid]&noupdate=yes&nothumb=yes" target="_blank">$attach[filename]</a></span>
				<div class="popupmenu_popup" id="imgpreview_$attach[aid]_menu" style="display: none;margin-left:20px;"><img width="$attach[width]" src="$attach[url]/$attach[attachment]"></div>
			<!--{else}-->
				$attach[filetype] <a href="attachment.php?aid=$attach[aid]&noupdate=yes&nothumb=yes" target="_blank">$attach[filename]</a>
			<!--{/if}-->
		<!--{else}-->
			$attach[filetype] <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
		<!--{/if}-->
		</div>
		<span id="attachupdate$attach[aid]"></span>
		</td>
		<td>$attach[dateline]</td>
		<td>$attach[filesize]</td>
		<td>$attach[downloads]</td>
		<td><!--{if $allowsetattachperm}--><input type="text" size="3" name="attachpermnew[{$attach[aid]}]" value="$attach[readperm]"><!--{else}--><input type="text" size="3" value="$attach[readperm]" disabled><!--{/if}--></td>
		<td><!--{if $maxprice}--><input type="text" size="3" name="attachpricenew[{$attach[aid]}]" value="$attach[price]"><!--{else}--><input type="text" size="3" value="$attach[price]" disabled><!--{/if}--></td>
		<td><input type="text" size="25" name="attachdescnew[{$attach[aid]}]" value="$attach[description]"></td>
		</tr>
	<!--{/loop}-->
	</table></div>
<!--{/if}-->

</form>

<script type="text/javascript">
	var textobj = $(editorid + '_textarea');
	<!--{if $bbinsert}-->
		<!--{if $editormode}-->if(!(is_opera && is_opera < 9)) {textobj.value = bbcode2html(textobj.value);}<!--{/if}-->
		newEditor(wysiwyg);
	<!--{/if}-->
	checkFocus();
	setCaretAtEnd();
	if(!(is_ie >= 5 || is_moz >= 2)) {
		$('restoredata').style.display = 'none';
	}
</script>

{template footer}