<?
function get_search_form()
{
global $cat_fields, $ct, $HTTP_GET_VARS, $bgschcol, $fslct, $adrghtcol, $choose_one1, $choosecntr,
$tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $msg, $_REQUEST, $schopt,$slctcntr ;

#if ($ct==""){$targtsch="target=tschf";}

foreach ($HTTP_GET_VARS as $key2 => $value2 )
{
$HTTP_GET_VARS[$key2]=stripslashes($HTTP_GET_VARS[$key2]);
$HTTP_GET_VARS[$key2]=ereg_replace('\'', '&#039;', $HTTP_GET_VARS[$key2]);
}

$bgschcol=$tbclr_1;
if ($HTTP_GET_VARS['onlywithphoto']=='yes'){$onlyphocheck="checked";}
 $srch_html=$srch_html."

<table width='100%' border=0 cellspacing=0 cellpadding=4><tr><td> 
<FORM action='index.php' method='get' $targtsch> 
<input type='hidden' name='ct' value='$ct' >
<input type='hidden' name='md' value='browse'>
<input type='hidden' name='mds' value='search'>
<table  width='100%' bgcolor='$tbclr_2' border=0  cellspacing=0 cellpadding=1>
<tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='$tbclr_4' size='-1'>
&nbsp;<b> ".$msg['Search']." </b> </font>
<table  width='100%' border=0  cellspacing=0 cellpadding=2>
<tr><td bgcolor='$bgschcol' align='right'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$msg['Keyword'].":</b>
</font>
</td><td bgcolor='$bgschcol'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-1'>
<input type='text' name='brief_key' class=formst value='".$HTTP_GET_VARS['brief_key']."' size=15 STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;' >
</font>
</td>
<td bgcolor='$bgschcol' colspan='2' >
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$msg['only_for_last']."
<select name='before' class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;'>
<option>".$HTTP_GET_VARS['before']."<checked><option><option>1<option>3<option>5<option>10<option>20<option>40<option>60<option>100</select>
".$msg['days']." &nbsp; 
<input type='checkbox' name='onlywithphoto' value='yes'   STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;' $onlyphocheck> ".$msg['only_with_photos']."
</b></font> </td></tr>
";
$s346='0';
foreach ($cat_fields as $keysch => $value )
{
if (($cat_fields[$keysch][2] == 'keyword') or ($cat_fields[$keysch][2] == 'minmax'))
{
if ($_REQUEST['ct'] == ''){$kklds=1;}else{
if($s346 != '1')
{ 
$s346='1';
$srch_html=$srch_html."<TR><TD bgcolor='$bgschcol'   align='right'>";
$srch_html=$srch_html.print_sch_field($keysch);
$srch_html=$srch_html."</TD>\n";
}
else
{ $s346='0';
$srch_html=$srch_html."<TD bgcolor='$bgschcol'    align='right'>";
$srch_html=$srch_html.print_sch_field($keysch);
$srch_html=$srch_html."</TD></TR>\n";
}
}
}
 
}
if($s346 == '1'){ 
$srch_html=$srch_html."<td  bgcolor='$bgschcol' colspan=2>.</TD></TR>";
}
$srch_html=$srch_html."
</table> 
</td></tr></table>
";

$srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<INPUT type='submit' value=' ".$msg['searchsubm']." ' class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt; FONT-WEIGHT: bold;'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b> ".$msg['search_fields_optional']."  
  </b>
</font>
</FORM>
</td></tr></table>
";
if ($HTTP_GET_VARS['idemail']!="") {$srch_html="";}
if ($HTTP_GET_VARS['ratedads']=="1") {$srch_html="";}
return  $srch_html;
}


function print_sch_field($keysch)
{
global  $cat_fields, $HTTP_GET_VARS,$bgschcol,
$tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $choosecntr, $adrghtcol;
$bgschcol=$tbclr_1;
if ( ( $cat_fields[$keysch][4] == 'select') and ($cat_fields[$keysch][2] == 'keyword'))
{ 
 $srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$cat_fields[$keysch][0].":</b>
</font>
</td><td bgcolor='$bgschcol'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<select name='$keysch' size='".$cat_fields[$keysch][0]."' class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;'  >
<option>".$HTTP_GET_VARS[$keysch]."<checked>
<option>".$cat_fields[$keysch][7]."</select>
</font>
";
}


if ( ( $cat_fields[$keysch][4] == 'select2') and ($cat_fields[$keysch][2] == 'keyword'))
{ 

$fld3v=$cat_fields[$keysch][7];

 $srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$cat_fields[$keysch][0].":</b>
</font>
</td><td bgcolor='$bgschcol'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<select name='$keysch'  class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;'  
onChange=\"document.getElementById('f$fld3v').src='index.php?md=slct2&fld=$keysch&fld3=$fld3v&vl='+this.value;\"
>
<option>".$HTTP_GET_VARS[$keysch]."<checked>".sllist($keysch)."</select>
</font>
";
}

if ( ( $cat_fields[$keysch][4] == 'select3') and ($cat_fields[$keysch][2] == 'keyword'))
{ 

$dflt_value=slctgetstr($HTTP_GET_VARS[$keysch]);
$vlslct=$HTTP_GET_VARS[$cat_fields[$keysch][7]];

 $srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$cat_fields[$keysch][0].":</b>
</font>
</td><td bgcolor='$bgschcol'>
<input type='hidden' name='$keysch' id='t$keysch' value=''> 
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>

<iframe src='index.php?md=slct2&fld=".$cat_fields[$keysch][7]."&fld3=$keysch&dvalue=$dflt_value&vl=$vlslct' id='f$keysch' frameborder=0   scrolling=no 
marginwidth='0' marginheight='0'  height='24' width='100%'></iframe>
</font>
";
}



if ( ( $cat_fields[$keysch][4] == 'checkbox') and ($cat_fields[$keysch][2] == 'keyword'))
{ 
 $srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$cat_fields[$keysch][0].":</b>
</font>
</td><td bgcolor='$bgschcol'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<select name='$keysch' size='".$cat_fields[$keysch][0]."'  class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;' >
<option>".$HTTP_GET_VARS[$keysch]."<checked>
<option>".$cat_fields[$keysch][7]."</select>
</font>
";
}

if ( ( ($cat_fields[$keysch][4] == 'text') or ($cat_fields[$keysch][4] == 'textarea'))

 and ($cat_fields[$keysch][2] == 'keyword'))
{  
$srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$cat_fields[$keysch][0].":</b>
</font>
</td><td bgcolor='$bgschcol'>
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<input type='text' name='$keysch' size=15 value='".$HTTP_GET_VARS[$keysch]."' 
class=formst STYLE='font-family: Verdana,Geneva,Arial; font-size: 8pt;'>
</font>
";
}

if ( ($cat_fields[$keysch][4] == 'text') and ($cat_fields[$keysch][2] == 'minmax'))
{
$flmin=$keysch.'1';
$flmax=$keysch.'2';
$srch_html=$srch_html."
<font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
<b>".$cat_fields[$keysch][0].":</b>
</font>
</td><td bgcolor='$bgschcol'>
 <font FACE='ARIAL, HELVETICA' COLOR='$fntclr_1' size='-2'>
min:<input type='text' name='$flmin' size='5' value='".$HTTP_GET_VARS[$flmin]."' class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;' >
max:<input type='text' name='$flmax' size='5' value='".$HTTP_GET_VARS[$flmax]."'  class=formst STYLE='font-family: 
Verdana,Geneva,Arial; font-size: 8pt;'>
</font>
";
}

 
return  $srch_html;
}
?>