/* 1st page & separate topic form add-on */
if(!isset($errorMSG)||$errorMSG==''){

if(($action==''&&$firstPageTopicForm==1)||($action=='vtopic'&&((isset($_POST['showSep'])&&$_POST['showSep']==1) || (isset($_GET['showSep'])&&$_GET['showSep']==1)))){
$l_messageABC=$l_message;

//the 3 lines of the code below is copied from index.php
if( (isset($allForumsReg) and $allForumsReg) OR ( isset($regUsrForums) and is_array($regUsrForums) and in_array($forum, $regUsrForums) and $user_id==0) ) { $l_anonTxt=$l_anonDisallowed; $anonPost=0; } else { $l_anonTxt=$l_anonAllowed; $anonPost=1; }
if($user_id==0) {
$l_anonTxt='<span class="txtSm">'.$brtag.$l_anonTxt.'</span>';
$l_sub_post_tpc=$l_enterforums.'/'.$l_sub_post_tpc;
}
else $l_anonTxt='';

if($user_id!=0) $loginLogout=ParseTpl(makeUp('user_logged_in')); else { $loginTop=0; $loginLogout=ParseTpl(makeUp('user_login_form')); }

$onChange=(isset($uploadForums)&&sizeof($uploadForums)>0)?'onchange="javascript: this.form.action.value=\'vtopic\'; this.form.submit();"':'';

if(!isset($emailCheckBox)) $emailCheckBox=emailCheckBox();

$newTopicForm="<h1 class=\"headingTitle vmTP\">{$l_new_topic} &rarr; <input type=\"hidden\" name=\"showSep\" value=\"1\">{$l_forum}: <select name=\"forum\" class=\"selectTxt\" {$onChange}>{$listForums2}</select></h1>";

$mainSep=makeUp('main_topics');
if(isset($pageNav) and $pageNav=='') $mainSep=preg_replace("#<!--pageNav-->(.*?)<!--/pageNav-->#is", '', $mainSep);

$tpl=preg_replace(array('#<!--MAINTOPICSPAGE-->(.*?)<!--/MAINTOPICSPAGE-->#is', '#<!--MAINTOPICFORUMINPUT-->(.*?)<!--/MAINTOPICFORUMINPUT-->#is') ,'', $mainSep);

$tpl=preg_replace('#<td class="(.+?)"><h1(.+?)>(.+?)<a id="newtopic">#is', '<td class="tbTransparentcell">'.$newTopicForm.'</td></tr><tr><td class="\\1"><h1\\2>\\3<a id="newtopic">', $tpl);

if($action!='vtopic'){
//dynamic BB buttons
$mpf=ParseTpl(makeUp('main_post_form'));
$mpfs=convertBBJS($mpf);
if($mpfs!='') $mainPostForm=$mpfs; else $mainPostForm=$mpf;
}
echo str_replace(array('tabindex="1"','tabindex="2"','tabindex="3"','tabindex="4"','tabindex="5"'),array('tabindex="21"','tabindex="22"','tabindex="23"','tabindex="24"','tabindex="25"'),ParseTpl($tpl));
}
//separate topic form
if(isset($_GET['showSep'])&&$_GET['showSep']==2&&isset($newTopicLink)){
$mainSep=makeUp('main_topics');
if(isset($pageNav) and $pageNav=='') $mainSep=preg_replace("#<!--pageNav-->(.*?)<!--/pageNav-->#is", '', $mainSep);
echo ParseTpl(preg_replace('#<!--MAINTOPICFORM-->(.*?)<!--/MAINTOPICFORM-->#is','',$mainSep));
}
}
/*-- 1st page & separate topic form add-on */