<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="75%" valign="top">
		<?
		if($id_catalog)
		{
		if($id_firm)
		$azmm='_'.$id_firm;
		else
		$azmm='catalog';
		?>
		<table width=100% cellpadding="0" cellspacing="0"><tr><td class="tb4">
		<?
		if(!$nav_region_url)
		echo '<a class="ww" href="'.$bp.$azmm.'/">Все объявления'.$nav_region.'</a> ';
		else
		echo '<a class="ww" href="'.$bp.$azmm.'/all_0/'.$nav_region_url.'/">Все объявления'.$nav_region.'</a> ';
		
		if(!$nav_region_url) $nav_region_url='all_0';
		for ($i=1; $i<count($tree_cat); $i++)
			{
			if($tree_cat[$i])
				{
				if($i==(count($tree_cat)-1))
					{
					if(!$nav_spn)
					echo ' >> '.$arr_razdel[$tree_cat[($i-1)]][$tree_cat[$i]];
					else
						{
						echo ' >> <a class="ww" href="'.$bp.$azmm.'/'.$arr_razdel_url[$tree_cat[($i-1)]][$tree_cat[$i]].'_'.$tree_cat[$i].'/'.$nav_region_url.'/">'.$arr_razdel[$tree_cat[($i-1)]][$tree_cat[$i]].'</a> ';
						if($nav_spn[0])
						echo ' >> <a class="ww" href="'.$bp.$azmm.'/'.$arr_razdel_url[$tree_cat[($i-1)]][$tree_cat[$i]].'_'.$tree_cat[$i].'/'.$nav_region_url.'/'.$nav_sp.'">'.$nav_spn[0].'</a> ';
						echo ' >> '.$nav_spn[1];
						}
					}
				else
				echo ' >> <a class="ww" href="'.$bp.$azmm.'/'.$arr_razdel_url[$tree_cat[($i-1)]][$tree_cat[$i]].'_'.$tree_cat[$i].'/'.$nav_region_url.'/">'.$arr_razdel[$tree_cat[($i-1)]][$tree_cat[$i]].'</a> ';
				}
			}
		?>
		</td></tr></table>
		<?
		}
		
		
$maxRows_Recordset1=$rru['ob_na_str'];
$pn = 0;
if (isset($_GET['pn'])) 
	{
	$pn = intval($_GET['pn']);
	}
 
$uri=$_SERVER['REQUEST_URI'];
$uri=str_replace("&pn=".$pn, "", $uri);
$uri=str_replace("param_pn=".$pn, "", $uri);
$uri=str_replace("%5B", "[", $uri);
$uri=str_replace("%5D", "]", $uri);

if($id_firm)
$zmm='/_'.$id_firm.'/';
else
$zmm='/catalog/';

$uri2=explode("param_", $uri);

$startRow_Recordset1 = $pn * $maxRows_Recordset1;
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_array($Recordset1);

if($query_group==1)
	{
	$rm = mysql_query($query_count);
	if($rm)
		{
		$totalRows_Recordset1=0;
		
		if($arr_catalog['catalog'])
			{
			$zamena = $zmm.$arr_catalog['url'].'_'.$arr_catalog['id_catalog'];
			}
		elseif (isset($_GET['id_catalog']))
			{
			$zamena = $zmm.'all_0';
			}
		else
			{
			$zamena = $zmm;
			$zamena_2 = '/all_0/';
			}
			
		echo '<table width=100% cellpadding="2" cellspacing="2">';
	 	$i=0;
		while ($rrm = mysql_fetch_array($rm))
	 		{
			if(!$i) echo '<tr valign=top>';
			echo '<td width=33%>';
	 		//$arrw[$rrm[1]]=$rrm[0];
			if(!$zamena_2)
			echo '<a href="'.(str_replace($zamena, $zmm.$arr_razdel_url[intval($id_catalog)][$rrm[1]].'_'.$rrm[1], $uri)).'">'.$arr_razdel[intval($id_catalog)][$rrm[1]].'</a><span style="color:#858585">, '.$rrm[0].'</span><br>';
			else
			echo '<a href="'.(str_replace($zamena, $zmm.$arr_razdel_url[intval($id_catalog)][$rrm[1]].'_'.$rrm[1].$zamena_2, $uri)).'">'.$arr_razdel[intval($id_catalog)][$rrm[1]].'</a><span style="color:#858585">, '.$rrm[0].'</span><br>';
			$totalRows_Recordset1 = $totalRows_Recordset1+$rrm[0];
	 		$i++;
			if($i==3) $i=0;
			}
		echo '</table><p>';
		}
	}
	
elseif($query_group==2)
	{
	$rm = mysql_query($query_count);
	if($rm)
		{
		if($arr_catalog['stolb'])
		$stolb=$arr_catalog['stolb']; else $stolb=5;
		$stolb_sh=intval(100/$stolb);

		$totalRows_Recordset1=0;
		
		echo '<table width=100% cellpadding="2" cellspacing="2">';
	 	$i=0;
		while ($rrm = mysql_fetch_array($rm))
	 		{
			if(!$i) echo '<tr valign=top>';
			echo '<td width='.$stolb_sh.'%>';
			if(!$uri2[1])
				{
				echo '<a href="'.$uri.'param_'.$field_param_se.'[1]='.$rrm[1].'">'.$arr_element[$field_element_num][$rrm[1]].'</a><span style="color:#858585">, '.$rrm[0].'</span><br>';
				}
			else
				{
				if($spsp)
				echo '<a href="'.$uri.'&'.$field_param_se.'[2]='.$rrm[1].'">'.$arr_element_two[$field_element_num][$rrm[1]].'</a><span style="color:#858585">, '.$rrm[0].'</span><br>';
				else
				echo '<a href="'.$uri.'&'.$field_param_se.'[1]='.$rrm[1].'">'.$arr_element[$field_element_num][$rrm[1]].'</a><span style="color:#858585">, '.$rrm[0].'</span><br>';
				}
			$totalRows_Recordset1 = $totalRows_Recordset1+$rrm[0];
	 		$i++;
			if($i==$stolb) $i=0;
			}
		echo '</table><p>';
		}
	
	}
	
else
	{
	$all_Recordset1 = mysql_query($query_count);
	$arr_query_count = mysql_fetch_array($all_Recordset1);
	$totalRows_Recordset1 = $arr_query_count[0];
	}

$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

echo '&nbsp;Найдено записей: '.intval($totalRows_Recordset1);

if($totalRows_Recordset1) 
	{
	echo '<br><br><TABLE width="100%"  cellpadding="0" cellspacing="1" border="0">';

	do 
		{ 
	  	if (isset ($row_Recordset1['id'])) 
			{			
			if($row_Recordset1['vip']) $vip_fon='bgcolor="#FFFFCA"'; else $vip_fon=''; /////////////////// VIP FON
			
			echo '<tr data-href="'.$bp.'items/'.$row_Recordset1['zag_url'].'_'.$row_Recordset1['id'].'"><td '.$vip_fon.'><table width="100%" cellpadding="5" cellspacing="5" >';
			
			echo '<tr valign=top height="100" >';
			echo '<td width="50">';
			
			if(date($date_format_site, strtotime($row_Recordset1['data'])) == date($date_format_site))
			echo 'Сегодня';
			elseif(date($date_format_site, (strtotime($row_Recordset1['data']) + 24*60*60)) == date($date_format_site))
			echo 'Вчера';
			else
			echo dat_rus($row_Recordset1['data'], 1);
			//echo date("d-m", strtotime($row_Recordset1['data']));
			echo '<br><span style="color:#858585">'.date("H:i", strtotime($row_Recordset1['data'])).'</span>';
			
			echo '<td align=center valign=top width="100">';
			if($row_Recordset1['small'])
			echo '<img class="imground" src="'.$bp.$row_Recordset1['small'].'" border=0>';
			elseif ($row_Recordset1['video_host'] == 'youtu.be' || $row_Recordset1['video_host']=='youtube.com')
			echo '<img class="imground" width=100 src="http://i.ytimg.com/vi/'.$row_Recordset1['video_item'].'/1.jpg" border=0>';
			//else echo '<img class="imground" src="'.$bp.'icon/nophoto_small.png" border=0>';

			echo '<td width="70%">';
			$titt=explode("<hr>", $row_Recordset1['opis']);
			if($titt[1])
			$tit='title="'.obrez(str_replace("\n"," ", $titt[1]), 200).'"'; else $tit='';

			echo '<a style="font-size:14px" '.$tit.' href="'.$bp.'items/'.$row_Recordset1['zag_url'].'_'.$row_Recordset1['id'].'" >'.$row_Recordset1['zag'].'</a>';
			if($row_Recordset1['f_cena_'])
				{
				echo '<br>'._font($row_Recordset1['f_cena_'],1).' '.$rru['cena_valuta'];
				if($row_Recordset1['suff'])
				echo ' '.$row_Recordset1['suff'];
				}
			
			if($row_Recordset1['razdel'] && !$con_razdel)
			echo '<br><span style="color:#858585">'.$row_Recordset1['razdel'].'</span>';
			if($row_Recordset1['pols']==2) 
			echo '<br><span style="color:#858585">Компания</span>';


			if($row_Recordset1['id_gorod']==$id_region)
				{
				if($row_Recordset1['rayon'])
				echo '<br><span style="color:#858585">'.$row_Recordset1['rayon'].'</span>';
				}
			elseif (!($arr_rayon && in_array($id_region, $arr_rayon)) && $row_Recordset1['gorod'])
			echo '<br><span style="color:#858585">'.$row_Recordset1['gorod'].'</span>';

			echo '<td>';
			echo '</table>';
			}
		} while ($row_Recordset1 = mysql_fetch_array($Recordset1));
		echo '</table>';
	}

mysql_free_result($Recordset1);





$uris=explode("param_",$uri);

if($uris[1]) //есть параметы кроме pn
	{
	$dop2="&pn=";
	$map1="&map=1";
	$map2="&map=2";
	}
else
	{
	$dop2="param_pn=";
	$map1="param_map=1";
	$map2="param_map=2";
	}

pages(15, $totalPages_Recordset1, $pn, $uri, $dop2);

?>
		</td>
		
		<td valign="top" class="tdd" align="center">
		
			<?
			if($cou_map && $id_region && $id_catalog && $arr_catalog['parent_id'])
				{
				if($rru['map']=='y')
				echo '<a href="'.$uri.$map1.'">Посмотреть на карте</a>';
				elseif($rru['map']=='g')
				echo '<a href="'.$uri.$map2.'">Посмотреть на карте</a>';
				echo '<p>';
				}


			include_once($base_path.'blok/right_blok.php');
			?>
			
		</td>
	</tr>
</table>