<?
if (isset($_REQUEST[session_name()])) 
@session_start();

$base_path="../";

$bp="../";

require_once($base_path.'connect/connect.php');
include_once($base_path.'lib/lib.php');
include_once($base_path.'connect/_svod_rec.php');

if($_GET['id'])
	{
	$id=intval($_GET['id']);
	$itemm=urlencode(anti($_GET['itemm']));
	$r=mysql_query("SELECT * FROM board WHERE id='".$id."' AND zag_url='".$itemm."'");
	$nr=mysql_num_rows($r);
	}
	
if(!$nr)
	{
	header('HTTP/1.1 404 Not Found');
	header('Status: 404 Not Found');
	echo "<HTML><HEAD><meta http-equiv='Refresh' charset='utf-8' content='0; URL=".$base_path."404.php'></HEAD></HTML>";
	exit;
	}
	
$rr=mysql_fetch_array($r);

$id_catalog=$rr['id_catalog'];

$tree_reg[0]=0;
$tree_cat[0]=0;

for($i=0; $i<3; $i++)
	{
	if($rr['razdel_'.$i])
	$tree_cat[($i+1)]=$rr['razdel_'.$i];
	
	if($rr['region_'.$i])
	$tree_reg[($i+1)]=$rr['region_'.$i];
	}

$glob_region=$tree_reg[1];

$name_items=$rr['zag'];

if(file_exists($base_path.'cashe_region/_svod_region_0.php'))
include_once($base_path.'cashe_region/_svod_region_0.php'); // регионы первого уровня

if($tree_reg[1] && file_exists($base_path.'cashe_region/_svod_region_'.$tree_reg[1].'.php'))
include_once($base_path.'cashe_region/_svod_region_'.$tree_reg[1].'.php'); // наш регион

for ($i=1; $i<count($tree_reg); $i++)
{
if($i<2)
$name_region = $arr_regions[$tree_reg[($i-1)]][$tree_reg[$i]];
else
	{
	if (!($arr_rayon && in_array($tree_reg[$i],$arr_rayon)))
	$name_region .= ', '.$arr_regions[$tree_reg[($i-1)]][$tree_reg[$i]];
	else
		{
		$real_region_tree=$i-1;
		}
	}
}

if(!isset($real_region_tree))
$real_region_tree=$i-1;


include_once($base_path.'cashe_catalog/_svod_catalog.php'); // дерево каталогов

if($id_catalog)
{
if(file_exists($base_path.'cashe_catalog/_svod_catalog_'.$id_catalog.'.php'))
include_once($base_path.'cashe_catalog/_svod_catalog_'.$id_catalog.'.php');
include_once($base_path.'plugin/board/func_search_user.php'); 
include_once($base_path.'plugin/board/func_view.php');

if($arr_sp)
	{
	foreach($arr_sp as $ars)
		{
		if(file_exists($base_path.'cashe_n/_svod_element_'.$ars[0].'.php'))
		include_once($base_path.'cashe_n/_svod_element_'.$ars[0].'.php');
		
		if(file_exists($base_path.'cashe_n/_svod_element_two_'.$ars[1].'.php'))
		include_once($base_path.'cashe_n/_svod_element_two_'.$ars[1].'.php');
		}
	}
}

$title=$name_items.'. '.$name_region;
$no_title=1;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?=$title?></title>
<link rel="shortcut icon" href="<?=$bp?>icon/favicon.ico" type="image/x-icon">
<meta name="Author" content="aikuvshinov@mail.ru, http://script-ks.narod.ru" />
<link rel="stylesheet" type="text/css" href="<?=$bp?>style/style.css" />
<link rel="stylesheet" type="text/css" href="<?=$bp?>style/jquery.fancybox.css" media="screen" />
<link rel="stylesheet" href="<?=$bp?>style/template.css" type="text/css"/>

<script type="text/javascript" src="<?=$bp?>lib/flash.js"></script>
<script type="text/javascript" charset="utf-8" src="<?=$bp.'js/'?>jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<?=$bp.'js/'?>jquery.easing.1.3.js"></script>
<script type="text/javascript" src="<?=$bp.'js/'?>jquery.fancybox-1.2.1.pack.js"></script>
<script type="text/javascript" src="<?=$bp.'js/'?>fancy.js"></script>
<script type="text/javascript" src="<?=$bp.'js/'?>tabs.js"></script>

<![if !IE]>
<?
if($rru['round'])
{
?>
<script type="text/javascript" src="<?=$bp.'js/'?>jquery.corner.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".imground").corner("round");
$(".submit").corner("round");
});
</script>
<?
}
?>
<![endif]>

	
<script language="javascript">
$("#fancy_registr, #fancy_zabili, #fancy_vhod, #fancy_send_email, #fancy_zhaloba, #fancy_map, #fancy_mess, #fancy_vip1, #fancy_vip2, #fancy_vip3").live('click', function(){$(".fl_hidden").hide();});
$("#fancybox-close").live('click', function(){$(".fl_hidden").show();});
$("#fancybox-overlay").live('click', function(){$(".fl_hidden").show();});


		function send_tel(id)
			{
			$.ajax({
					type: "GET",
					url: "<?=$bp?>blok/tel.php?id="+id,
					success: function(html) {
						$("#sendtel").empty();
						$("#sendtel").append(html);
               		}
        		});
			}
			
		function scrollTo(el)
			{
			var duration = 700;
			var element = $(el).offset();
			var pos = element.top;
			$('html, body').animate({scrollTop: pos}, duration);
			}
			
</script>

</head>
<BODY 
style="MARGIN: 0px auto; POSITION: inherit; width: 1000px">
<?
include_once($base_path."blok/top_form.php"); 
?>

<table class="table" width="100%">
	<tr>
		<td >
			<table width="100%">
				<tr>
					<td valign="top" class="td" width="90%">

					<?
					include_once($base_path."blok/search_form.php"); 
					?>

					</td>
				</tr>
			</table>
		</td>
	</tr>
	
	<tr>
		<td align="center">
		<?
		//_rec ($id_catalog, 1);
		?>
		</td>
	</tr>
	
	<tr>
		<td  class="td" >
		<?
		if($rr['moder'] && !$_SESSION['ID_Glob'])
		echo '<h1><font color=orange>Ваше объявление</font><br>
		'.$rr['zag'].'
		<br><font color=orange>отправлено на модерацию</font></h1>';
		else
			{
			if($rru['typ_idv']==1)
			include_once($base_path."blok/idv.php"); 
			elseif($rru['typ_idv']==2)
			include_once($base_path."blok/idv2.php"); 
			elseif($rru['typ_idv']==3)
			include_once($base_path."blok/idv3.php"); 
			}
		?>		

		</td>
	</tr>
	
	<?
	if(!$err404)
	{
	?>
	<tr>
		<td>
			<table width="100%" cellpadding="5" cellspacing="5">
				<tr>
					<td valign="top" height="300" >
					<?
					include_once($base_path."blok/bottom_form.php"); 
					?>
					</td>
					<td>
					
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<?
	}
	?>
	
</table>
<script>
var newWin='';
</script>
</body>
</html>