<?
$r_menu_=mysql_query("SELECT id_catalog, catalog, catalog_typ, logo FROM catalog WHERE id_catalog > 0 AND parent_id='".intval($id_catalog)."' AND top=0 ORDER BY num");

	$i=0;
	$j=0;
	$n=array();
	echo '<table width=100%  cellpadding="3" cellspacing="3">';
	while($rr_menu_=mysql_fetch_array($r_menu_))
		{
		$j++;
		if($i==0)
		echo '<tr>';
		echo '<td width=33% valign=middle>';
		echo '<table><tr><td width=48>';
		if($rr_menu_['logo'])
		echo '<a href="'.$base_path.'d_'.$rr_menu_['id_catalog'].'/"><img border=0 src="'.$base_path.$rr_menu_['logo'].'"></a><br>';
		else
		echo '<a href="'.$base_path.'d_'.$rr_menu_['id_catalog'].'/"><img border=0 src="'.$base_path.'icon/editnews.gif"></a><br>';
		echo '<td>';
		echo ' <a href="'.$base_path.'d_'.$rr_menu_['id_catalog'].'/">'.$rr_menu_['catalog'].'</a>';
		echo '</td></tr></table>';
		if($rr_menu_['catalog_typ']=='board')
		$n[]=$rr_menu_['id_catalog'];
		$i++;
		if($i==3) $i=0;
		}
echo '</table><br><br>';

if($_SERVER['QUERY_STRING'] && $n)
	{
	$nn=implode(",",$n);
	////////////////
	$query = "SELECT * FROM board 
	WHERE id_catalog IN (".$nn.") AND
	activ !=1 
	ORDER BY id DESC LIMIT 10";	

	$Recordset1 = mysql_query($query);
	$row_Recordset1 = mysql_fetch_array($Recordset1);
	if($row_Recordset1) echo '<p align="center"><font size="+1" >Последние объявления в рубрике '.$title.'</font></p>';

	do { 
		if (isset ($row_Recordset1['id'])) 
			{ 
			if(strtotime($row_Recordset1['vip_data'])>time()) $color='bgcolor=#F7E6DB'; else $color='';
			echo '<table width=100%><tr><td class=tb2>';
			echo '<table width=100%><tr><td colspan=2 align=left '.$color.'>';

			if($row_Recordset1['zag'])
			$zag=$row_Recordset1['zag'];
			else
			$zag='Объявление '.$row_Recordset1['id'];

			if($row_Recordset1['kol_doc'])
			echo '<img src="'.$base_path.'icon/excel.gif" border=0> '; 
	
			if($row_Recordset1['video_item'])
			echo '<img src="'.$base_path.'icon/slide.png" border=0> '; 
	
			if($row_Recordset1['map_x'] && $row_Recordset1['map_y'])
			echo '<img src="'.$base_path.'icon/world.png" border=0> ';
	
			echo '<a target=_blank href="'.$base_path.'d_'.$row_Recordset1['id_catalog'].'/i_'.$row_Recordset1['id'].'"><font size=+1>'.$zag.'</font></a>';
			echo '<br>';
	
			echo '<font color=#8A0000>'.date($date_format_site, strtotime($row_Recordset1['data'])).'</font> ';
	
			echo '<tr><td valign=top>';
			if($row_Recordset1['small'] && file_exists($bp.$row_Recordset1['small']))
			echo '<img src="'.$base_path.$row_Recordset1['small'].'" border=0>';
			echo '</td>';
			echo '<td width=100% valign=top>';
			echo $row_Recordset1['opis'];
			echo '</table>';
			echo '</table><p>';
			}
		} while ($row_Recordset1 = mysql_fetch_array($Recordset1));

		mysql_free_result($Recordset1);
	//////////////////
	}

?>