<? function big_search_form($text,$start,$end,$type,$mode,$user='',$dsc=0) {
  if (!$text) {
    $_POST['a']="do_post";
    $_POST['res']="post";
    $_POST['o']="relevancy";
  }  ?>
<script type="text/javascript"><!--
function ch(st) {
e=document.srchforum.elements['fs[]'];
for (i=0;i<e.options.length;i++) e.options[i].selected=st;
}
function sbm() {
f=0; e=document.srchforum.elements['fs[]'];
for (i=0;i<e.options.length;i++) if (e.options[i].selected) f++;
if (!f) alert('<?=MSG_search_noforums;?>');
return (f!=0);
}
--></script>
<form action="index.php" name=srchforum method=POST onSubmit="return sbm();">
<table class="innertable" width="100%" cellspacing=1><tr>
<td class="tablehead" colspan=2><?=MSG_search;?>
<tr><td width="50%">
<?=MSG_search_text;?>:
<input type=text name=text size=50 maxlength=255 value="<?=htmlspecialchars($text);?>"><td>
<?=MSG_search_user2;?>:
<input type=text name=username size=40 maxlength=255 value="<?=htmlspecialchars($user);?>">
<tr><td><?=MSG_search_starttime;?>:
<td><?=build_date_field("start",$start);?>
<tr><td><?=MSG_search_endtime;?>:
<td><?=build_date_field("end",$end);?>
<tr><td><?=MSG_search_where;?>:<br>
<label><input type=radio name=a value=do_post <?=check($type==0);?>><?=MSG_search_posts;?></label><br>
<label><input type=radio name=a value=do_topic <?=check($type==1);?>><?=MSG_search_topics;?></label><br>
<td><?=MSG_search_results_out;?>:<br>
<label><input type=radio name=res value=post <?=check($mode==0);?>><?=MSG_search_asposts;?></label><br>
<label><input type=radio name=res value=topic <?=check($mode==1);?>><?=MSG_search_astopic;?></label><br>

<tr><td><?=MSG_search_sortby;?>:
<td><input type=radio name=o value=relevancy <?=check(getvar('o')=="relevancy");?>><?=MSG_search_relevancy;?> &nbsp;
<label><input type=radio name=o value=p__time <?=check(getvar('o')=="p__time");?>><?=MSG_search_date;?></label><br>
<label><input type=checkbox name=desc value=1 <?=check($dsc);?>><?=MSG_search_reverse;?></label><br>
<input type=checkbox name=nogrp value=1 <?=check(getvar('nogrp')!='');?>><?=MSG_search_nogrp;?>

<tr><td class="tablehead" colspan=2><?=MSG_search_forums;?>
<tr><td colspan=2 style="text-align: center"><select style="width: 90%" name='fs[]' multiple size=10><?=build_search_select();?></select>
<tr><td class="tablehead" colspan=2>
<input type=hidden name=m value=search>
<input type=button onClick="ch(true)" value="<?=MSG_selectall;?>">
<input type=button onClick="ch(false)" value="<?=MSG_unselectall;?>">
<input type=submit value="<?=MSG_searchdo;?>">

<? if ($GLOBALS['opt_search_ext']==1) { ?><tr><td colspan=2 class=descr><b><?=MSG_search_help;?></b>:<br>
<?=MSG_search_help_plus;?><br>
<?=MSG_search_help_minus;?><br>
<?=MSG_search_help_trunc;?><br>
<?=MSG_search_help_tilde;?><br>
<?=MSG_search_help_quotas;?><br>
<?=MSG_search_help_bracket;?><br>
<?=MSG_search_tooshort;?>.<? } ?>

</table></form>
<? }

function search_result_start($pages) { ?>
<script type="text/javascript"><!--
function ch_img(img) {
<? if ($GLOBALS['opt_imglimit_x']) {?>
if (img.width><?=$GLOBALS['opt_imglimit_x'];?>) { img.width=<?=$GLOBALS['opt_imglimit_x'];?>; }
<? }
if ($GLOBALS['opt_imglimit_y']) { ?>
if (img.height><?=$GLOBALS['opt_imglimit_y'];?>) { img.height=<?=$GLOBALS['opt_imglimit_y'];?>; }
<? } ?>
}
//--></script>
<table class="innertable posttable" width="100%" cellspacing=1>
<tr class="tablehead"><td><?=MSG_search_results;?><div style="float: right; text-align: right; width: 30%"><?=$pages;?>
<? }

function search_result_forum(&$entry) { ?>
<tr class="category"><td><h3>&raquo; <a class="inverse" href="index.php?f=<?=$entry['f_id'];?>"><?=$entry['f_title'];?></a></h3>
<? }

function search_result_topic(&$entry,$text) { ?>
<tr><td><h5><a href="index.php?t=<?=$entry['t_id'];?>&amp;hl=<?=urlencode($text);?>"><?=$entry['t_title'];?></a></h5>

<? }

function search_result_post(&$entry,$text) {
  static $counter;
  if ($counter % 2 == 1) $class="postentry2";
  else $class="postentry";
  $counter++;
  ?>
<tr><td class="<?=$class;?>"><div class="postlinks"><?=MSG_topic;?>: <?
if ($GLOBALS['opt_hurl']) { ?>
<a href="<?=build_url($entry).'p'.$entry['p_id'].'.htm?hl='.urlencode($text);?>#pp<?=$entry['p_id'];?>">
<? } else { ?>
<a href="index.php?t=<?=$entry['p_tid'];?>&amp;p=<?=$entry['p_id'];?>&amp;hl=<?=urlencode($text);?>#pp<?=$entry['p_id'];?>"><? } ?>
<?=$entry['t_title'];?></a><br>
<?=long_date_out($entry['p__time']);?>&nbsp; &nbsp;
<?=user_out($entry['p_uname'],$entry['p_uid']);?></div>
<?=textout($entry['p_text'],$entry['p__html'],$entry['p__bcode'],$entry['p__smiles'],$pdata['p_tid'],$pdata['p_id']);?>
<tr><td style="padding: 0">
<? }

function search_not_found() { ?>
<tr><td align=center><?=MSG_search_none;?>
<? }

function search_result_more() { ?>
<tr><td align=center><?=MSG_search_more1;?> <?=format_word($GLOBALS['opt_search_count'],MSG_p1,MSG_p2,MSG_p3);?>.
<?=MSG_search_more2;?>.
<? }

function search_result_end($pages) { ?>
<tr><td class="tablehead" style="text-align: right"><?=$pages;?>
</table><br>
<? }
