<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="75%">

<?

$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);

$Recordset1 = mysql_query($query);


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>';
			echo '<td width=25%>';
	 		//$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==4) $i=0;
			}
		echo '</table><p>';
		}
	}
	
elseif($query_group==2)
	{
	$rm = mysql_query($query_count);
	if($rm)
		{
		$totalRows_Recordset1=0;
		
		echo '<table width=100% cellpadding="2" cellspacing="2">';
	 	$i=0;
		while ($rrm = mysql_fetch_array($rm))
	 		{
			if(!$i) echo '<tr>';
			echo '<td width=16%>';
			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==6) $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];
	}


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

if($tab_map==1)
include_once($base_path."blok/tab_map_y.php");
elseif($tab_map==2)
include_once($base_path."blok/tab_map_g.php");
//include_once($base_path."blok/_gmap5.php");


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

if($tab_map)
	{
	if($uris[1]) //есть параметы кроме map
		{
		$uri=str_replace("&map=".$tab_map, "", $uri);
		$uri=str_replace("map=".$tab_map."&", "", $uri);
		}
	else
		{
		$uri=str_replace("param_map=".$tab_map, "", $uri);
		}
	}

?>
		</td>
		
		<td valign="top" align="center" class="tdd">
		
			<a href="<?=$uri?>">Таблица</a><p>
			
			
			<?
			include_once($base_path.'blok/right_blok.php');
			?>


			
		</td>
	</tr>
</table>