
<p class="forum_navi">
    {$navigation}
</p>

{if count($errors)}
<div id="error_list">
    <ul>
    {foreach from=$errors item=error}
        <li>{$error}</li>
    {/foreach}
    </ul>
</div>
{/if}
{if $smarty.request.preview==1}
<br />
<table width="100%" border="0" cellpadding="4" cellspacing="1" class="forum_tableborder">
<tr>
  <th class="forum_header_bolder">{$lang.postpreview}</th>
</tr>
<tr>
<td class="forum_post_first">{$preview_text}
</td>
</tr>
</table>
<br />
{/if}
<script language="javascript" type="text/javascript">
<!--
var postmaxchars = '{$max_post_length}';
	function checkf() {ldelim}
	closeall();
	var MessageMax = '{$maxlength_post}';
		MessageLength  = document.f.text.value.length;
		errors = "";
	{if $smarty.request.p=="newtopic"}
	if (document.f.topic.value.length < 2)
			{ldelim}
				errors = "{$lang.forum_newpost_notopic}";
				document.f.topic.focus();
			{rdelim}
	{/if}
	
		if (MessageLength < 3) {ldelim}
			 errors = "{$lang.forum_newpost_notext}";
				document.f.text.focus();
		{rdelim}
		if (MessageMax !=0) {ldelim}
			if (MessageLength > MessageMax){ldelim}
				errors = "{$lang.forum_newpost_texttolong} " + MessageLength + ". {$lang.forum_newpost_texttolong_2} " + MessageMax + "";
				document.f.text.focus();
			{rdelim}
		{rdelim}
		
		if (errors != "") {ldelim}
			alert(errors);
			return false;
		{rdelim} 
			else {ldelim}
			document.f.submit.disabled = true;
			
			return true;
		{rdelim}
{rdelim}

function beitrag(theform) {ldelim}
	if (postmaxchars != 0) message = " {$lang.max_post_length_t} "+postmaxchars+"";
	else message = "";
	alert("{$lang.post_length_t} "+theform.text.value.length+" "+message);
{rdelim}
//-->
</script>

<form action="{$action}" enctype="multipart/form-data" method="post" name="f" id="f" onsubmit="return checkf();">
    <input type="hidden" name="forum_id" value="{$forum_id}" />
    <input type="hidden" name="toid" value="{$topic_id}" />
	<input type="hidden" name="area" value="{$area|default:'1'}" />
    {$topicform}
    {$threadform}
	<input name="f_id" type="hidden" id="f_id" value="{$f_id}">
	<br />
    <table width="100%" border="0" cellpadding="4" cellspacing="1" class="forum_tableborder">
        <tr>
            <td class="row_first" style="width: 20%"></td>
          <td class="row_second">
		 <input accesskey="s" onclick="closeall();" class="button" id="submits" type="submit" value="{$lang.f_btn_submit}" />&nbsp;
		 <input name="preview" type="hidden" id="preview" value="" />
		
		 <input  type="button" class="button" value="{$lang.postpreview}" onclick="closeall();document.getElementById('preview').value=1;document.forms.f.submit();" />
		 <input onclick="beitrag(document.f);closeall()" class="button" type="button"  value="{$lang.checklength}" />
		 </td>
        </tr>
		{if ($permissions.19 == 1) || ($permissions.13 == 1)  || ($permissions.18 == 1)}
		<tr>
		 <td class="row_first">
		{$lang.select_admin_options}
		</td>
		 <td class="row_second">
		{if ($permissions.18 != 1) && ($ugroup != 1) }
		{if ($permissions.13==1) && ($aid == $userid) }
		{assign var="close" value="1"}
		{/if}
		{else}
		{assign var="close" value="1"}
		{/if}
		<select id="sa" name="subaction">
		<option value=""></option>
		{if $close == 1}
		
		  <option value="close">{$lang.close_topic_after}</option>
		
		{/if}
		{if $permissions.19 == 1}
		<option value="announce">{$lang.announce_topic_after}</option>
		<option value="attention">{$lang.attention_topic_after}</option>
		{/if}
		</select>
		
		 </td>
		</tr>
		{/if}
  </table>
  

  
  
</form>



<br />
<br />

{if $smarty.request.p != "newtopic" && $smarty.request.action != "edit"}
<table width="100%"  border="0" cellpadding="4" cellspacing="1" class="forum_tableborder">
  <tr>
    <td colspan="2" class="forum_header_bolder"><strong>{$lang.last_postings}</strong></td>
  </tr>
  {foreach from=$items item="lp"}
  <tr class="{cycle name="lastposts" values="forum_post_first,forum_post_second"}">
    <td width="20%" valign="top">
	<strong>{$lp->user}</strong><br />
	{$lang.newspost_last_postst_date} {$lp->datum|date_format:"%Y.%m.%d %H:%M"}
	</td>
    <td>
	{if $lp->title}<strong>{$lp->title|escape:"htmlall|sslash"}</strong><br /><br />{/if}
	{$lp->message}</td>
  </tr>
  {/foreach}
</table>
{/if}
