<script language="Javascript" type="text/javascript" src="$vars_config{CGIURL}/ubb_status.cgi"></script>
is the line causing the js error
as for the repeating lines, you can set navbar_replace_right to equal the active topics link, then do a
my $header = $hf->[0];
$header =~ s/$TBB/qq~THE CODE FOR THE TABLE~/eisg;
and then replace $hf->[0] with $header.
I believe once the javascript error is fixed, the avatar and user title will work too