var pages = '';

function view_forum_topic_top()
{
       var strtime = fdata[16].split('.');
       pages = PageLinks(fdata[15],0);
       
       ForumTop();
       
       // Search
       
       d.write('<table cellpadding="0" cellspacing="0" width="98%" align="center" border="0">');
       d.write('<tr><td width="24"><img src="/images/fb1.gif" width="24" height="24" border="0"></td><td class="fbg1">&nbsp;</td><td width="24"><img src="/images/fb2.gif" width="24" height="24" border="0"></td></tr>');
       d.write('</table>');
       
       d.write('<table cellpadding="0" cellspacing="0" width="98%" align="center" border="0">');
       d.write('<tr><td class="ftitleBg"><table cellpadding="0" cellspacing="0" border="0"><tr><td width="24"><img src="/images/fb3.gif" width="24" height="30" border="0"></td><td width="20" align="center"><img src="/images/spacer.gif" width="20" height="1" border="0"></td><td width="100%"><div class="fTitle">'+ForumPath(1)+'</div></td><td width="24"><img src="/images/fb4.gif" width="24" height="30" border="0"></td></tr></table></td></tr><tr><td bgcolor="#000000" height="1"><img src="/images/hr1.gif" width="6" height="1" border="0" class="img-left"><img src="/images/hr2.gif" width="6" height="1" border="0" class="img-right"></td></tr><tr><td><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td width="6" class="lBg"><img src="/images/spacer.gif" width="1" height="1" border="0"></td><td class="forTdIn"><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td class="fTd" width="190" bgcolor="#4e524b">'+(fdata[11] == 0 ? '' : '<p><img src="/images/avatars/av'+fdata[11]+'.jpg" width="82" height="110" border="0" class="fAva"></p>')+'<p>'+Nickname(fdata[7],fdata[8],fdata[9],fdata[10],fdata[12],1)+'</p><p><small>'+strtime[0]+' '+mo[strtime[1]]+' '+strtime[2]+'</small></p>'+(fmain[4] & 128 ? '[ <a href="/action/?act=12&n='+fdata[7]+'" class="fact">Молчанка на 24 ч</a> ]' : '')+'</td><td width=2></td><td class="fTd" bgcolor="#4e524b"><p><strong>'+fdata[4]+'</strong></p><p>'+fdata[14]+'</p>'+(!fdata[6] ? '' : '<br><p><span class=nick><font color=#bb0000><B>Тема закрыта</B></font></span></p>')+(!fmain[4] ? '' : TopicAct(fmain[2],fdata[6],1))+'</td></tr></table></td><td width="6" class="rBg"><img src="/images/rbg.gif" width="6" height="39" border="0"></td></tr></table></td></tr>');
}

function view_forum_topic_bottom()
{
       d.write('<tr><td><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td width="13"><img src="/images/fleft.gif" width="13" height="13" border="0"></td><td class="fdbg1"><img src="/images/spacer.gif" width="1" height="13" border="0"></td><td width="13"><img src="/images/fright.gif" width="13" height="13" border="0"></td></tr></tr></table></td></tr></table>'+(!pages ? '<p>&nbsp;</p>' : '<div id="pagesPlace">Страницы: '+pages+'</div><p><br>&nbsp;</p>'));
       if(fmain[4] & 1) d.write('<table cellpadding="0" align="center" cellspacing="0" width="588" border="0"><form action="/action/" method=POST><input type=hidden name=act value=1><input type=hidden name=subact value=2><input type=hidden name=f value='+fmain[0]+'><input type=hidden name=p value='+fmain[1]+'><input type=hidden name=id value='+fmain[2]+'><input type=hidden name=tp value='+fmain[3]+'><input type=hidden name=messid value="'+fmain[6]+'"><tr><td width="15"><img src="/images/m1.gif" width="15" height="15" border="0"></td><td width="100%" class="mbg1"><img src="/images/spacer.gif" width="1" height="15" border="0"></td><td width="15"><img src="/images/m2.gif" width="15" height="15" border="0"></td></tr><tr><td class="mbg2"><img src="/images/spacer.gif" width="15" height="15" border="0"></td><td bgcolor="#2a2c28"><table cellpadding="0" cellspacing="5" border="0" width="100%"><tr><td width="80"><font color="#c7a45a"><strong>Заголовок:</strong></font></td><td><input type="text" value="Re: '+fdata[4]+'" name="reply_subj" class="inpStd" style="width: 98%" id="MTITLE"></td></tr><tr><td colspan="2"><font color="#c7a45a"><strong>Сообщение:</strong></font></td></tr><tr><td colspan="2"><div style="position: relative; width: 100%; height: auto;"><div id="SMILES" style="display:none" onmouseover="ClearTime(); return true;" onmouseout="CloseSmiles(); return true;"></div><textarea class="inpStd" cols="50" style="width: 99%" rows="7" name="reply_mess" id="MESSAGE"></textarea></div></td></tr></table></td><td class="mbg3"><img src="/images/spacer.gif" width="15" height="15" border="0"></td></tr><tr><td colspan="3" class="mesBg" valign="top"><table cellpadding="5" cellspacing="0" border="0" align="center" style="padding-top: 6px;"><tr><td align="center"><img src="/images/b_smile.gif" width="22" height="19" border="0" onmouseover="HideSmiles(); ShowSmiles(); ClearTime(); return true;" onmouseout="CloseSmiles(); return true;"></td><td align="center"><img src="/images/b_bold.gif" width="22" height="19" border="0" onClick="BBTags(0);"></td><td align="center"><img src="/images/b_italic.gif" width="22" height="19" border="0" onClick="BBTags(1);"></td><td align="center"><img src="/images/b_under.gif" width="22" height="19" border="0" onClick="BBTags(2);"></td><td align="center"><img src="/images/b_url.gif" width="41" height="19" border="0" onClick="BBTags(3);"></td><td align="center"><img src="/images/b_trans.gif" width="41" height="19" border="0" onClick="translate();"></td><td align="center"><input type=image src="/images/b_ok.gif" width="82" height="19" border="0" id="SUBBUT"></td></tr></table></td></tr></form></table><p>&nbsp;</p>');
       ForumBottom();
       d.write('</div>');
       d.write('<div id="bBackground"></div>');
}

function view_forum_topic()
{
       var i;
       var all_data = fdata.length - 1;
       var strtime;
       var nick_a;
       var bgc; 
       view_forum_topic_top();
       if((all_data - 16) > 0)
       {
              for(i=17; i<=all_data; i++)
              {
		     strtime = fdata[i][8].split('.');
		     bgc = (i % 2) ? '4e524b' : '5c6159';		     
		     d.write('<tr><td><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td width="6" class="lBg"><img src="/images/spacer.gif" width="1" height="1" border="0"></td><td class="forTdIn2"><table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td class="fTd" width="190" bgcolor="#'+bgc+'">'+(fdata[i][6] == 0 ? '' : '<p><img src="/images/avatars/av'+fdata[i][6]+'.jpg" width="82" height="110" border="0" class="fAva"></p>')+'<p>'+Nickname(fdata[i][2],fdata[i][3],fdata[i][4],fdata[i][5],fdata[i][7],1)+'</p><p><small>'+strtime[0]+' '+mo[strtime[1]]+' '+strtime[2]+'</small></p>'+(fmain[4] & 128 ? '[ <a href="/action/?act=12&n='+fdata[i][2]+'" class="fact">Молчанка на 24 ч</a> ]' : '')+'</td><td width=2></td><td class="fTd" bgcolor="#'+bgc+'"><p><strong>'+fdata[i][9]+'</strong></p><p>'+fdata[i][10]+'</p>'+(!fdata[i][16] ? '' : '<p><span class="nick">'+Nickname(fdata[i][11],fdata[i][12],fdata[i][13],fdata[i][14],fdata[i][15],1))+(!fmain[4] ? '' : ReplyAct(fdata[i][16],fdata[i][0]))+'</td></tr></table></td><td width="6" class="rBg"><img src="/images/rbg.gif" width="6" height="39" border="0"></td></tr></table></td></tr>');
              }
       }
       view_forum_topic_bottom();
       if(fmain[7]) Unlock(fmain[7]);
}
