<?
@session_start();
$bp="../";	

if ($_GET['car'])
	{
	if(!$_SESSION['cart'] || ($_SESSION['cart'] && !in_array($_GET['car'], $_SESSION['cart'])))
	$_SESSION['cart'][]=$_GET['car'];
	else
		{
		foreach($_SESSION['cart'] as $index=>$crt)
			{
			if($crt == $_GET['car']) {$in=$index; break;}
			}
		if(isset($in)) unset($_SESSION['cart'][$in]);
		}
	}

if ($_GET['car'])
	{ 
	if (!$_SESSION['cart'] || !in_array($_GET['car'], $_SESSION['cart']))
	echo '<a href="javascript:send_cart('.$_GET['car'].')" ><img border=0 src="'.$bp.'icon/Edit_Yes.png"> Добавить в блокнот</a>';
	elseif($_SESSION['cart'] && in_array($_GET['car'], $_SESSION['cart']))
	echo '<a href="javascript:send_cart('.$_GET['car'].')" ><img border=0 src="'.$bp.'icon/Edit_No.png"> Удалить из блокнота</a>';
	}
	
if($_SESSION['cart'])
	{
	?>
	<script language="javascript">
	document.getElementById('blok_col').innerHTML = '(<?=count($_SESSION['cart'])?>)'; 
	</script>				
	<?
	}
else
	{
	?>
	<script language="javascript">
	document.getElementById('blok_col').innerHTML = ''; 
	</script>				
	<?
	}
?>	
