<%template _header%>
<%if {infloat}!=1%>
<div id="nav">
	<div class="wrap s_clear">
		<a href="{config.forumurl}" class="title">{config.forumtitle}</a> &raquo; <%if {forum.Pathlist}!=""%>{ShowForumAspxRewrite(forum.Pathlist.Trim(),forumid,forumpageid)}  &raquo; <%/if%><strong>
			<%if {type}=="bonus"%>
				发表新悬赏
			<%else if {type}=="poll"%>
				发表新投票
			<%else if {type}=="debate"%>
				发起新辩论
			<%else%>
		       发表新主题
			<%/if%></strong>
	</div>
</div>
<%/if%>
<script type="text/javascript" reload="1">
var postminchars = parseInt('{config.minpostsize}');
var postmaxchars = parseInt('{config.maxpostsize}');
var disablepostctrl = parseInt('{disablepost}');
var forumpath = "{forumpath}";
var posturl=forumpath+'posttopic.aspx?forumid={forumid}&forumpage={forumpageid}';
var postaction='{rooturl}posttopic.aspx?infloat=1&forumid={forumid}&'
function closenewthread()
{
		if($('floatwin_newthread'))
        $('floatwin_newthread').parentNode.removeChild($('floatwin_newthread')); 
		if($('floatwin_newthread_mask'))
		 $('floatwin_newthread_mask').parentNode.removeChild($('floatwin_newthread_mask'));
}



</script>

<%if page_err==0%>
<%if {ispost}%>
	<%if {infloat}==1%>	
       <%if {fromindex}!=1%>
	     <%if {needaudit}%>
		 <script type="text/javascript">
			$('returnmessage').className='';
			//submithandle_newthread('forumdisplay.php?fid=5', '非常感谢，管理员设置了需要对新主题进行审核，现在将转入主题列表，您的帖子通过审核后将被显示出来。');
            floatwin('open_confirm', -1,390,130);
		    $('floatwin_confirm').innerHTML='<div><h3 class="float_ctrl"><em id="floatwin_confirm_title">提示信息</em><span><a href="javascript:;" class="float_close" onclick="floatwinreset = 1;floatwin(\'close_confirm\');">&nbsp;</a></span></h3></div><div id="floatwin_confirm_content">非常感谢，管理员设置了需要对新主题进行审核，现在将转入主题列表，您的帖子通过审核后将被显示出来。<br><button onclick="location.href=\'{rooturl}{msgbox_url}\';floatwin(\'close_confirm\')">确定</button></div>'
            floatwinreset = 1;
	        closeEditorwin();
		 </script>
		    

		 <%else%>
		 <script type="text/javascript">
			$('returnmessage').className='';
			location.href='{rooturl}{msgbox_url}';	
		</script>
		 <%/if%>
		
	   <%/if%>
	<%else%>
	<%template _msgbox%>
	<%/if%>
<%else%>
	<%if {infloat}==0%>
<div class="wrap s_clear" id="wrap">
<div class="main">
	<div class="nojs" style="position:relative;">
	<div id="floatwinnojs">
	<%/if%>
	<script>
	function geteditormessage(theform)
	{
    	var message = wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
	    theform.message.value = message;
	}
	</script>
	<%if {infloat}==1%>
	<div id="floatlayout_newthread" class="float" style="width: 600px; height: 410px;">
	<%else%>
	<div id="floatlayout_newthread" class="float">
	<%/if%>
	<%if {infloat}==1%>
<form method="post" name="postform" id="postform" action="{rooturl}posttopic.aspx?infloat=1&forumid={forumid}&" enctype="multipart/form-data" onsubmit="return validate(this);">	
	<%else%>
<form method="post" name="postform" id="postform" action="" enctype="multipart/form-data" onsubmit="return validate(this);">	
	<%/if%>
	<%template _post%>
	<script  reload="1">
	openEditor();
	<%if {canpostattach}%>
	initAttach();
	<%/if%>
	</script>
	<%if {adveditor}%>
	<div id="specialposttable" style="height:0;line-height:0;">	
		<%if {type}=="bonus"%>	
		<div class="specialpost s_clear">
		<div class="specialinfo">
			<dl>
				<dt><label for="rewardprice">悬赏价格:</label></dt>
				<dd>
				<input name="topicprice" type="text" class="txt" id="topicprice" value="{usergroupinfo.minbonusprice}" size="5" maxlength="5" onkeyup="getrealprice(this.value)"/>
				{bonusextcreditsinfo.unit}{bonusextcreditsinfo.name} (只允许正整数)
				</dd>
				<dd class="tips">
				[ 悬赏范围 {usergroupinfo.minbonusprice} - {usergroupinfo.maxbonusprice}  
				{bonusextcreditsinfo.unit}
				{bonusextcreditsinfo.name}, 当前可用 {mybonustranscredits} {bonusextcreditsinfo.unit}{bonusextcreditsinfo.name}]
				</dd>
				<dd class="tips">
				[ 税后支付 <span id="realprice">0</span>]
				</dd>
				<script type="text/javascript" reload="1">
				    function getrealprice(price) {
				        if (!price.search(/^\d+$/)) {
				            n = Math.ceil(parseInt(price) + price * {Scoresets.GetCreditsTax()});
				            if (price > 32767) {
				                $('realprice').innerHTML = '<b>悬赏不能高于 32767</b>';
				            } else if (price < {usergroupinfo.minbonusprice} || (price > {usergroupinfo.maxbonusprice})) {
				                $('realprice').innerHTML = '<b>悬赏超出范围</b>';
				            } else {
				                $('realprice').innerHTML = n;
				            }
				        } else {
				            $('realprice').innerHTML = '<b>填写无效</b>';
				        }
				    }
                </script>
			</dl>
		</div>
		</div>
		<%/if%>
		<%if {usergroupinfo.allowpostpoll}==1&&{type}=="poll"%>
		<div class="specialpost s_clear">
			<p><em>选项:</em>每行填写 1 个选项</p>
			<div class="specialinfo sppoll">
				<input id="PollItemname" type="hidden" name="PollItemname" value="" />
				<input id="PollItemvalue" type="hidden" name="PollItemvalue" value="" />
				<div id="polloptions">
					<p id="divPollItem"><input type="text" id="pollitemid" name="pollitemid" class="optioninfo txt" tabindex="1"/><a onclick="if(!delObj(document.getElementById('polloptions'),2,this.parentNode)){alert('投票项不能少于2个');}" title="删除投票项" class="deloption" href="javascript:;">del</a></p>
					<p><input type="text" id="pollitemid" name="pollitemid" class="optioninfo txt" tabindex="1"/><a onclick="if(!delObj(document.getElementById('polloptions'),2,this.parentNode)){alert('投票项不能少于2个');}" title="删除投票项" class="deloption" href="javascript:;">del</a></p>
				</div>
				<p><a onclick="clonePoll('{config.maxpolloptions}')" href="javascript:;">+增加投票项</a> <a onclick="if(!delObj(document.getElementById('polloptions'),2)){alert('投票项不能少于2个');}" href="javascript:;">删除投票项</a> </p>
			</div>
			<div class="specialaddons">
				<p><label for="polldatas">投票结束日期</label>
					<input name="enddatetime" type="text" id="enddatetime" size="10" value="{enddatetime}" style="cursor:default" class="txt" onClick="showcalendar(event, 'enddatetime', 'cal_startdate', 'cal_enddate', '{enddatetime}');" readonly="readonly" />
					<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>
				<p><label for="pollnum">
					<input type="checkbox" name="multiple"  onclick="this.checked?$('maxchoicescontrol').style.display='':$('maxchoicescontrol').style.display='none';" class="checkinput" />多选投票</label>
					<span id="maxchoicescontrol" style="display: none">最多可选项数: <input type="text" tabindex="1" value="" class="spshortinput txt" name="maxchoices"/></span>
				</p>
				<p>
					<input name="createpoll" type="hidden" id="createpoll" value="1" />
					<input type="checkbox" tabindex="1" value="1" name="visiblepoll"/>提交投票后结果才可见</p>
				<p><input type="checkbox" tabindex="1" value="1" name="overt"/>公开投票参与人</p>
			</div>
		</div>
		<%/if%>
		<%if {type}=="debate"%>
		<div class="specialpost s_clear">
			<div class="specialinfo">
				<h4><label for="affirmpoint">正方:</label>(最多 200 字)</h4>
				<div><textarea tabindex="1" class="txtarea" id="positiveopinion" name="positiveopinion"></textarea></div>
				<h4><label for="negapoint">反方:</label>(最多 200 字)</h4>
				<div><textarea tabindex="1" class="txtarea" id="negativeopinion" name="negativeopinion"></textarea></div>
			</div>
			<div class="specialaddons">
				<label for="endtime">结束时间:</label>
				<p>
					<input type="text" name="terminaltime" id="terminaltime" style="cursor:default;" class="txt" size="16" value="{enddatetime}" onclick="showcalendar(event, 'terminaltime', 'cal_startdate', 'cal_enddate', '{enddatetime}');" readonly />
					<input type="hidden" name="cal_startdate" id="cal_startdate" value="{enddatetime}">
					<input type="hidden" name="cal_enddate" id="cal_enddate" value="">
				</p>
			</div>
		</div>
		<script type="text/javascript">
			function doadvdebate()
			{
				var adv_open = $('advdebate_open');
				var adv_close = $('advdebate_close');
				if (adv_open && adv_close)
				{
					if (adv_open.style.display != 'none')
					{
						adv_open.style.display = 'none';
						adv_close.style.display = '';
					}
					else
					{
						adv_open.style.display = '';
						adv_close.style.display = 'none';
					}
				}
			}
		</script>
		<%/if%>
		</div>
	<%/if%>
	</form>
	</div>
	<%if {infloat}==0%>
	</div>
	</div>
</div>
</div>
	<%/if%>
	</div>
	<script type="text/javascript" reload="1">
	if (getQueryString('restore') == '1')
	{
		var message;
		if (is_ie)	{
			message = clipboardData.getData('Text');
		}
		var title = getQueryString('t');
		$('title').value = unescape(title);
		if(typeof wysiwyg == 'undefined' || !wysiwyg) {
			textobj.value = html2bbcode(message);
		} else {
			editdoc.body.innerHTML = message;
		}
	}
	</script>
	<%/if%>
<%else%>
    <%if {ispost}%>
		<%if {needlogin}%>
			<%template _login%>
		<%else%>
		 <%if {infloat}==1%>
         <p>{msgbox_text}</p>
		 <%else%>
		   <%template _errmsgbox%>
		 <%/if%>
		<%/if%>
	<%else%>
	<%if {needlogin}%>
		<%template _login%>
	<%else%>
	 <%if {infloat}==1%>
	<div class="floatbox floatbox1">
	<h3 class="float_ctrl">
		<span>
			<a href="javascript:;" class="float_close" onclick="floatwin('close_newthread');" title="关闭">关闭</a>
		</span>
	</h3>
	<div class="gateform">
	<h3>{msgbox_text}</h3>
	</div>
	</div>
	 <%else%>
	   <%template _errmsgbox%>
	 <%/if%>
	<%/if%>
	
	<%/if%>
  </div>
<%/if%>
<%if {infloat}!=1%>
<script type="text/javascript"  src="{jsdir}/template_calendar.js"></script>
<%/if%>
<%template _copyright%>
<%template _footer%>