<h1 class="con_heading" id="thread_title">{$thread.title}</h1>

<div class="forum_navbar" id="thread_description" {if !$thread.description}style="display: none"{/if}>{$thread.description}</div>

{if $user_id}
<table width="100%" cellspacing="0" cellpadding="5"  class="forum_toolbar"><tr>
    <td width="5">&nbsp;</td>
    <td class="forum_toollinks">
        {include file='com_forum_toolbar.tpl'}
    </td>
</tr></table>
{/if}

{if $thread_poll}
    <div id="thread_poll">{include file='com_forum_thread_poll.tpl'}</div>
{/if}

<table class="posts_table" width="100%" cellspacing="2" cellpadding="5" border="0" bordercolor="#999999">
    {foreach key=pid item=post from=$posts}
        <tr class="posts_table_tr">
            <td class="post_usercell" width="140" align="center" valign="top" height="150">
                <div>
                    <a class="post_userlink" href="javascript:addNickname('{$post.nickname|escape:html}');" title="{$LANG.ADD_NICKNAME}"/>{$post.nickname|escape:html}</a>
                </div>
                <div class="post_userrank">
                    {if $post.userrank.group}
                        <span class="{$post.userrank.class}">{$post.userrank.group}</span>
                    {/if}
                    {if $post.userrank.rank}
                        <span class="{$post.userrank.class}">{$post.userrank.rank}</span>
                    {/if}
                </div>
                <div class="post_userimg">
                    <a href="{profile_url login=$post.login}" title="{$LANG.GOTO_PROFILE}"><img border="0" class="usr_img_small" src="{$post.avatar_url}" alt="{$post.nickname|escape:html}" /></a>
                    {if $post.user_awards}
                        <div class="post_userawards">
                            {foreach key=aid item=award from=$post.user_awards}
                                <img src="/images/icons/award.gif" border="0" alt="{$award.title|escape:html}" title="{$award.title|escape:html}"/>
                            {/foreach}
                        </div>
                    {/if}
                </div>
                <div class="post_usermsgcnt">{$LANG.MESSAGES}: {$post.post_count}</div>
                <div>{$post.flogdate}</div>
            </td>
            <td width="" class="post_msgcell" align="left" valign="top">

                <table width="100%" class="post_date"><tr>
                        <td><strong><a name="{$post.id}" href="/forum/thread{$thread.id}-{$page}.html#{$post.id}">#{$num}</a></strong> - {$post.fpubdate}, {$post.wday}</td>
                <td align="right">
                {if $user_id && !$thread.closed}
                    <table cellpadding="2" cellspacing="0" border="0" class="msg_links">
                        <tr>
                            <td width="18"><img src="/templates/{template}/images/icons/forum/toolbar/post-quote.gif"/></td>
                            <td><a href="javascript:forum.addQuoteText('{$post.nickname|escape:html}')" class="ajaxlink" title="{$LANG.ADD_SELECTED_QUOTE}">{$LANG.ADD_QUOTE_TEXT}</a></td>
                            <td width="18"><img src="/templates/{template}/images/icons/forum/toolbar/post-reply.gif"/></td>
                            <td><a href="/forum/thread{$thread.id}-quote{$post.id}.html" title="{$LANG.REPLY_FULL_QUOTE}">{$LANG.REPLY}</a></td>
                            {if $is_admin || $is_moder || $post.is_author_can_edit}
                                <td width="18"><img src="/templates/{template}/images/icons/forum/toolbar/post-edit.gif"/></td>
                                <td><a href="/forum/editpost{$post.id}-{$page}.html">{$LANG.EDIT}</a></td>
                                {if $num > 1}
                                    <td width="18"><img src="/templates/{template}/images/icons/forum/toolbar/post-delete.gif"/></td>
                                    <td><a href="javascript:" class="ajaxlink" onclick="forum.deletePost({$post.id}, '{csrf_token}', {$page});">{$LANG.DELETE}</a></td>
                                {/if}
                            {/if}
                        </tr>
                    </table>
                {/if}
                </td></tr></table>

                <div class="post_content">{$post.content_html}</div>
                {if $post.attached_files && $cfg.fa_on}
                    <div id="attached_files_{$post.id}">
                    {include file='com_forum_attached_files.tpl'}
                    </div>
                {/if}
                {if $post.edittimes}
                    <div class="post_editdate">{$LANG.EDITED}: {$post.edittimes|spellcount:$LANG.COUNT1:$LANG.COUNT2:$LANG.COUNT1} ({$LANG.LAST_EDIT}: {$post.peditdate})</div>
                {/if}
                {if $post.signature_html}
                    <div class="post_signature">{$post.signature_html}</div>
                {/if}
            </td>
        </tr>
        {assign var="num" value=`$num+1`}
    {/foreach}
</table>
{if $page == $lastpage}<a name="new"></a>{/if}

{if $user_id}
<table width="100%" cellspacing="0" cellpadding="5"  class="forum_toolbar"><tr>
    <td><a href="#">{$LANG.GOTO_BEGIN_PAGE}</a></td>
    <td class="forum_toollinks">
        {include file='com_forum_toolbar.tpl'}
    </td>
</tr>
</table>
{/if}

<div class="forum_navbar">
    <table width="100%"><tr>
        <td align="left">
            <table cellpadding="5" cellspacing="0" border="0" align="left" style="margin-left:auto;margin-right:auto"><tr>
                {if $prev_thread}
                    <td align="right" width="">
                        <div>&larr; <a href="/forum/thread{$prev_thread.id}.html" title="{$LANG.PREVIOUS_THREAD}">{$prev_thread.title|truncate:30}</a></div>
                    </td>
                {/if}
                {if $prev_thread && $next_thread}<td>|</td>{/if}
                {if $next_thread}
                    <td align="left" width="">
                        <div><a href="/forum/thread{$next_thread.id}.html" title="{$LANG.NEXT_THREAD}">{$next_thread.title|truncate:30}</a> &rarr;</div>
                    </td>
                {/if}
            </tr></table>
        </td>
        <td width="150" align="right">{$LANG.GOTO_FORUM}: </td>
        <td width="220" align="right">
            <select name="goforum" id="goforum" style="width:220px; margin:0px" onchange="window.location.href = '/forum/' + $(this).attr('value');">
            {foreach key=fid item=item from=$forums}
                {if $item.cat_title != $last_cat_title}
                    {if $last_cat_title}</optgroup>{/if}
                    <optgroup label="{$item.cat_title|escape:html}">
                {/if}
                <option value="{$item.id}" {if $item.id == $forum.id} selected="selected" {/if}>{$item.title}</option>
                {if $item.sub_forums}
                    {foreach key=sid item=sub_forum from=$item.sub_forums}
                        <option value="{$sub_forum.id}" {if $sub_forum.id == $forum.id} selected="selected" {/if}>--- {$sub_forum.title}</option>
                    {/foreach}
                {/if}
                {assign var="last_cat_title" value=$item.cat_title}
            {/foreach}
            </optgroup>
            </select>
        </td>
    </tr></table>
</div>

<div style="float: right;margin: 8px 0 0;">{$pagebar}</div>

{if $cfg.fast_on && !$thread.closed}
<div class="forum_fast">
    <div class="forum_fast_header">{$LANG.FAST_ANSWER}</div>
    {if $user_id}
        {if $cfg.fast_bb}
            <div class="usr_msg_bbcodebox">
                {$bb_toolbar}
            </div>
            {$smilies}
        {/if}
        <div class="forum_fast_form">
            <form action="/forum/reply{$thread.id}.html" method="post">
                <div class="cm_editor">
                    <textarea id="message" name="message" rows="5"></textarea>
                </div>
                <div class="forum_fast_submit" style="float:right;padding:5px;"><input type="submit" name="gosend" value="{$LANG.SEND}"/></div>
                {if $is_admin || $is_moder || $thread.is_mythread}
                    <div style="float:right;padding:8px;">
                        <label><input type="checkbox" name="fixed" value="1" /> {$LANG.TOPIC_FIXED_LABEL}</label>
                    </div>
                {/if}
            </form>
        </div>
    {else}
        <div style="padding:5px">{$LANG.FOR_WRITE_ON_FORUM}, <a href="/registration">{$LANG.REGISTER}</a> {$LANG.OR_LOGIN}.</div>
    {/if}
</div>
{/if}

{if $user_id}
{literal}
<script type="text/javascript" language="JavaScript">
    $(document).ready(function(){
        $('.posts_table_tr .msg_links').css({opacity:0.4, filter:'alpha(opacity=40)'});
        $('.posts_table_tr').hover(
            function() {
                $(this).find('.msg_links').css({opacity:1.0, filter:'alpha(opacity=100)'});
            },
            function() {
                $(this).find('.msg_links').css({opacity:0.4, filter:'alpha(opacity=40)'});
            }
        );
    });
</script>
{/literal}
{/if}