<%template _header%>
<script language="javascript" type="text/javascript" src="templates/{templatepath}/calendar.js"></script>
<script type="text/javascript">
var postminchars = parseInt('{config.minpostsize}');
var postmaxchars = parseInt('{config.maxpostsize}');
var disablepostctrl = parseInt('{disablepost}');

</script>
<!--TheCurrent start-->
<%if page_err==0%>
<%if {ispost}%>
<%template _msgbox%>
<%else%>
<div id="foruminfo">
	<div class="userinfo">
		<h2><a href="{config.forumurl}">{config.forumtitle}</a><span>{forumnav}</span><strong>发表新主题</strong></h2>
	</div>
</div>
<!--TheCurrent end-->
<div id="previewtable" style="display: none">
	<div class="ntforumbox">
		<div class="titlebar">
		<h3>预览帖子</h3>
		</div>
		<div class="NtForumForm" style="border-bottom:0;">
				<table width="100%" align="left">
				<tr>
				<td style="width:197px;"><span>{username}</span>
				</td>
				<td style="padding-left: 8px;border-left:1px solid #fff;text-align:left;">
					<span class="fontfamily">{nowdatetime}</span>
					<span id="previewmessage"></span>
				</td>
				</tr>
				</table>
		</div>
	</div>
</div>
<div class="ntforumbox">
	<div class="titlebar">
			<h3>发表新主题</h3>
	</div>
<form method="post" name="postform" id="postform" action="" enctype="multipart/form-data" onsubmit="return validate(this);">
<table cellpadding="0" cellspacing="0" border="0">
<%template _tempaccounts%>
<tbody>
	<tr class="list">
			<th class="formlabel">标题:</th>
			<td class="formbody">
			<%if {forum.applytopictype}==1 && {topictypeselectoptions}!=""%>
				<select name="typeid" ID="typeid">{topictypeselectoptions}</select>
			<%/if%>
			<input name="title" type="text" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';"  id="title" size="60" title="标题最多为60个字符" /></td>
	</tr>
</tbody>
<tbody>
	<tr class="list">
			<th class="formlabel">图标:</th>
			<td class="formbody">
				<input name="iconid" type="radio" value="0" checked /> 无&nbsp;
				<input type="radio" name="iconid" value="1" />
				<img src="images/posticons/1.gif" alt="求助"/>
				<input type="radio" name="iconid" value="2" />
				<img src="images/posticons/2.gif" alt="示好"/>
				<input type="radio" name="iconid" value="3" />
				<img src="images/posticons/3.gif" alt="贡献"/>
				<input type="radio" name="iconid" value="4" />
				<img src="images/posticons/4.gif" alt="音乐"/>
				<input type="radio" name="iconid" value="5" />
				<img src="images/posticons/5.gif" alt="光碟"/>
				<input type="radio" name="iconid" value="6" />
				<img src="images/posticons/6.gif" alt="游戏"/>
				<input type="radio" name="iconid" value="7" />
				<img src="images/posticons/7.gif" alt="照片"/><br/>
				<input type="radio" name="iconid" value="8" />
				<img src="images/posticons/8.gif" alt="诈唬"/>
				<input type="radio" name="iconid" value="9" />
				<img src="images/posticons/9.gif" alt="播放"/>
				<input type="radio" name="iconid" value="10" />
				<img src="images/posticons/10.gif" alt="点火"/>
				<input type="radio" name="iconid" value="11" />
				<img src="images/posticons/11.gif" alt="体育"/>
				<input type="radio" name="iconid" value="12" />
				<img src="images/posticons/12.gif" alt="提示"/>
				<input type="radio" name="iconid" value="13" />
				<img src="images/posticons/13.gif" alt="阳光"/>
				<input type="radio" name="iconid" value="14" />
				<img src="images/posticons/14.gif" alt="代码脚本"/>
				<input type="radio" name="iconid" value="15" />
				<img src="images/posticons/15.gif" alt="玫瑰"/>
			</td>
	</tr>
</tbody>
<tbody>
	<tr>
				<%template _editor%>
	</tr>
</tbody>
<tbody>
	<tr class="list">
			<th class="formlabel"><input name="advoption" type="checkbox" id="advoption" onclick="expandoptions('divAdvOption');" value="1" />高级选项</th>
			<td class="formbody">&nbsp;</td>
	</tr>
</tbody>
<%if {creditstrans}!=0%>
<tbody  id="divAdvOption" style="display:none">
		<tr class="list">
			<th class="formlabel">金钱:</th>
			<td class="formbody">
			<input name="topicprice" type="text" id="topicprice" class="colorblue"  onfocus="this.className='colorfocus';" onblur="this.className='colorblue';"  value="0" size="5" />
			{userextcreditsinfo.unit}
		{userextcreditsinfo.name}
		&nbsp;&nbsp;[ 主题最高售价 {maxprice} 
			{userextcreditsinfo.unit}
		{userextcreditsinfo.name}
		 ](售价只允许非负整数)</td>
		</tr>
		<%/if%>
		<tr class="list">
				<th class="formlabel">阅读权限:</th>
				<td class="formbody">
				<input name="topicreadperm" type="text" id="topicreadperm" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';"   value="0" size="5" />(阅读权限的最大有效值为 255)</td>
		</tr>
</tbody>
<%if {usergroupinfo.allowpostpoll}==1%>
<tbody>
<tr class="list">
			<th class="formlabel">
           		<input name="createpoll" type="checkbox" id="createpoll" onclick="expandoptions('divPoll');" value="1" />发布投票
			</th>
			<td class="formbody">
				<div id="divPoll" style="display:none"><input name="button" type="button" class="lightbutton" onclick="clonePoll('{config.maxpolloptions}')" value="增加投票项" /> <input name="button" type="button" class="lightbutton"  onclick="if(!delObj(document.getElementById('polloptions'),2)){alert('投票项不能少于2个');}" value="删除投票项" />
				   <input id="PollItemname" type="hidden" name="PollItemname" value="" />
				   <input id="PollItemvalue" type="hidden" name="PollItemvalue" value="" />
				   <p>
					<input type="radio" name="polltype" value="0" checked="checked" class="radioinput"/>
					单选<input type="radio" name="polltype" value="1"  class="radioinput"/>
					多选</span>
					<span  style="margin-top:5px;margin-left:10px;">投票结束日期:
					<input name="enddatetime" type="text" id="enddatetime" size="10" value="{enddatetime}" style="cursor:default" class="colorblue" onClick="showcalendar(event, 'enddatetime', 'cal_startdate', 'cal_enddate', '{enddatetime}');" readonly="readonly" /></span>
		<input type="hidden" name="cal_startdate" id="cal_startdate" size="10"  value="{enddatetime}">
		<input type="hidden" name="cal_enddate" id="cal_enddate" size="10"  value="">
				   </p>
					<div id="polloptions" style="margin-top:3px;"><div id="divPollItem" style="padding-top:4px"><input type="text" size="70" id="pollitemid" name="pollitemid" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" /></div><div style="padding-top:4px"><input type="text" size="70" id="pollitemid" name="pollitemid" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" /></div>
				    </div>
			     </div>&nbsp;
			 </td>
	</tr>
	</tbody> 
	<%/if%>     
	<%if {isseccode}%>
	<tbody>
		<tr class="list">
			<th class="formlabel">验证码</th>
	 		<td class="formbody">
				<p class="formcode"><%template _vcode%></p>
			</td>
		</tr>
	</tbody>
    <%/if%>
	<tbody>
		<tr class="list">
			<td colspan="2" class="formarea">
			  		<input type="hidden" id="postbytopictype" name="postbytopictype" value="{forum.postbytopictype}" tabindex="3">
					<input name="topicsubmit" type="submit" id="postsubmit" value="发表主题" class="sbutton" style="margin-bottom:-3px;margin-right:10px;"/><%if {spaceid}>0%><input type="checkbox" name="addtoblog" /> 添加到个人空间<%/if%> [完成后可按 Ctrl + Enter 发布]
			</td>
		</tr>
	</tbody>
	</table>
</form>
</div>

<script language="javascript" type="text/javascript">
if (getQueryString('restore') == '1')
{
	loadData(true);
}
$("title").focus();
function setPollDisplay() {
	var mydiv = $('divPoll');
	var check = $('createpoll');
	if (mydiv){
		if(check.checked == false) {
			mydiv.style.display = 'none';
		} else {
			mydiv.style.display = '';
		}
	}
}
document.onreadystatechange = setPollDisplay;
</script>
</div>
<%template _copyright%>
<%/if%>
<%else%>
<%template _errmsgbox%>
</div>
<%/if%>
<%template _footer%>