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

<script type="text/javascript">
var postminchars = parseInt('$minpostsize');
var postmaxchars = parseInt('$maxpostsize');
var disablepostctrl = parseInt('$disablepostctrl');
var bbinsert = parseInt('$bbinsert');
function checklength(theform) {
	var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : theform.message.value;
	var showmessage = postmaxchars != 0 ? '{lang board_allowed}: ' + postminchars + ' {lang lento} ' + postmaxchars + ' {lang bytes}' : '';
	alert('\n{lang post_curlength}: ' + message.length + ' {lang bytes}\n\n' + showmessage);
}
function validate(theform, previewpost) {
	var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : theform.message.value;
	if (message == "" && theform.subject.value == "") {
		alert("{lang post_subject_and_message_isnull}");
		return false;
	} else if (theform.subject.value.length > 80) {
		alert("{lang post_subject_toolong}");
		return false;
	}
	if (!disablepostctrl && ((postminchars != 0 && message.length < postminchars) || (postmaxchars != 0 && message.length > postmaxchars))) {
		alert("{lang post_message_length_invalid}\n\n{lang post_curlength}: "+message.length+" {lang bytes}\n{lang board_allowed}: "+postminchars+" {lang lento} "+postmaxchars+" {lang bytes}");
		return false;
	}
	if (!previewpost) {
		theform.replysubmit.disabled = true;
	}
	theform.message.value = message;
	return true;
}
</script>

{template post_preview}

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

<div class="spaceborder" style="width: {TABLEWIDTH}">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%">
<tr>
<td colspan="2" class="header"><a href="member.php?action=credits&view=forum_reply&fid=$fid" target="_blank"><img src="{IMGDIR}/credits.gif" alt="{lang credits_policy_view}" align="right" border="0" /></a>{lang post_newreply}</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}-->

<tr>
<td class="altbg1" width="20%"><span class="bold">{lang subject}</span></td>
<td class="altbg2"><input type="text" name="subject" id="subject" size="45" value="$subject" tabindex="3">&nbsp; <span class="smalltxt">({lang optional})</span></td>
</tr>

<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} <a href="faq.php?page=messages#6" target="_blank">{lang post_smilies}</a><br>
<input class="checkbox" type="checkbox" name="bbcodeoff" id="bbcodeoff" value="1" $codeoffcheck> {lang disable} <a href="faq.php?page=misc#1" target="_blank">{lang post_discuzcode}</a><br>
<!--{if $allowhtml}--><input class="checkbox" type="checkbox" name="htmlon" id="htmlon" value="1" $htmloncheck> {lang enable} {lang post_html}<br><!--{/if}-->
<!--{if $allowanonymous}--><input class="checkbox" type="checkbox" name="isanonymous" value="1"> {lang post_anonymous}<br><!--{/if}-->
<input class="checkbox" type="checkbox" name="usesig" value="1" $usesigcheck> {lang post_show_sig}<br>
<input class="checkbox" type="checkbox" name="emailnotify" value="1" $emailcheck> {lang post_email_notify}
</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);">$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" value=" {lang post_topicreset} " tabindex="103" onclick="clearcontent()">
</td></table>
</div>

<!--{if $allowpostattach && !$seccodecheck}-->
	{template post_attachments}
<!--{/if}-->

<div class="postsubmit">
<input class="button" type="submit" name="replysubmit" id="postsubmit" value="{lang post_newreply}" tabindex="101">
<input type="hidden" name="wysiwyg" id="{$editorid}_mode" value="$editormode">
<input type="hidden" name="fid" id="fid" value="$fid">
{lang post_submit_hotkey}
</div>

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

</form>

<br>
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="{TABLEWIDTH}" align="center" class="tableborder">
<tr class="header">
<td colspan="2">{lang post_thread_review}</td>
</tr>

<!--{if $thread['replies'] > $ppp}-->
	<tr class="altbg1"><td colspan="2" valign="top" width="20%">{lang post_replies_toolong}</td></tr>
<!--{else}-->
	<!--{loop $postlist $post}-->
		<tr>
		<td class="altbg1" valign="top" width="20%"><span class="bold"><!--{if $post['author'] && !$post['anonymous']}-->$post[author]<!--{else}-->{lang anonymous}<!--{/if}--></span><br><br></td>
		<td class="altbg2"><span class="smalltxt">{lang poston} $post[dateline]</span><br>
		<table height="100%" width="100%" border="0" cellspacing="0" cellpadding="0" class="line t_msg">
		<tr><td><p>$post[message]</p><br></td></tr></table></td></tr>
	<!--{/loop}-->
<!--{/if}-->

</table>

<script type="text/javascript">
	var textobj = $(editorid + '_textarea');
	<!--{if $bbinsert}-->newEditor(wysiwyg);<!--{/if}-->
	checkFocus();
</script>

{template footer}