{?set $jieqi_pagetitle = "论坛主题-{$jieqi_sitename}"?}
{?set $jieqi_contenttitle = "论坛主题"?}
{?set jieqi_page_rows = "10"?}

{?if $newpost > 0?}
<div class="textbox hot" id="postresult">{?$postresult?}</div>
<script type="text/javascript">
setTimeout(function(){$_('postresult').hide()}, 3000);
</script>
{?/if?}

<div class="blockn cf">
	<a href="{?function jieqi_geturl:'forum':topiclist:$lpage:$forumid?}" class="btnlink b_note fl">返回论坛</a>
	<a href="#postnew" class="btnlink b_note fr">发表回复</a>
</div>

<div class="block">
<div class="blockcontent" id="jieqi_page_contents">
{?section name=i loop=$postrows?}
	<div class="c_row cf">
	<h4>{?$postrows[i].subject?}</h4>
	<em>{?$postrows[i].posttime|date:Y-m-d H:i:s?}</em> <b>{?if $postrows[i].posterid > 0?}{?$postrows[i].username?}{?else?}游客{?/if?}：</b>
	<p>
		{?section name=m loop=$postrows[i].attachimages?}
		<div><img src="{?$postrows[i]['attachimages'][m].url?}" border="0" style="max-width:100%;"></div>
		{?/section?}
		{?section name=n loop=$postrows[i].attachfiles?}
		<span class="iconfont note">&#xee2c;</span><strong>附件:</strong><a href="{?$postrows[i]['attachfiles'][n].url?}">{?$postrows[i]['attachfiles'][n].name?}</a>({?$postrows[i]['attachfiles'][n].size_k?}K)<br /><br />
		{?/section?}
		<div class="c_content">{?$postrows[i].posttext?}</div>
	</p>
	</div>
{?/section?}

<div class="pages">{?$url_jumppage?}</div>
</div>
</div>

<a name="postnew"></a>
<script type="text/javascript">
function frmpost_validate(){
  if(document.frmpost.pcontent.value == ""){
    alert("请输入内容");
    document.frmpost.pcontent.focus();
    return false;
  }
}
</script>

<div class="block">
	<div class="blocktitle">回复主题</div>
	<div class="blockcontent">
		<form class="cf" name="frmpost" id="frmpost" method="post" action="{?$jieqi_modules['forum']['url']?}/newpost.php?do=submit" onsubmit="return frmpost_validate();" enctype="multipart/form-data">
		<fieldset>
		<div class="frow">
		<textarea class="textarea" name="posttext" style="width:100%;height:5em;"></textarea>
		</div>
		{?if $postcheckcode > 0?}
		<div class="frow">验证码：<input type="text" class="text" style="width:6em;" name="checkcode" id="checkcode" onfocus="if(this.form.imgccode.style.display == 'none'){this.form.imgccode.src = '{?$jieqi_url?}/checkcode.php?rand={?$jieqi_time?}';this.form.imgccode.style.display = '';}" title="点击显示验证码"><img name="imgccode" src="" style="cursor:pointer;vertical-align:middle;margin-left:3px;display:none;" onclick="this.src='{?$jieqi_url?}/checkcode.php?rand='+Math.random();" title="点击刷新验证码"></div>
		{?/if?}
		<div class="frow">
		<input type="hidden" name="fid" id="fid" value="{?$forumid?}">
		<input type="hidden" name="tid" id="tid" value="{?$topicid?}">
		<input type="hidden" name="act" id="act" value="newpost">{?$jieqi_token_input?}
		<button type="button" name="Submit" class="button" style="cursor:pointer;" onclick="Ajax.Request('frmpost',{onComplete:function(){alert(this.response.replace(/<br[^<>]*>/g,'\n'));if(this.response.indexOf('验证码错误') != -1){$_('checkcode').value = '';$_('checkcode').focus();} else Form.reset('frmpost');}});"> 发表回复 </button>
		</div>
		</fieldset>
		</form>

	</div>
</div>