<?
function title()
{
	global $user;	
	
	if (isset($user))
	{
		global $set;		
		
		if ($set['web'] == false)
		{			
			?><table style="width:100%" cellspacing="0" cellpadding="0"><tr><?
		
			$k_new = mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
			 LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
			 WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` IS NULL OR `users_konts`.`type` = 'common' OR `users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);
			 
			$k_new_fav = mysql_result(mysql_query("SELECT COUNT(`mail`.`id`) FROM `mail`
			 LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
			 WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0); // Почта			
			 
			 $lenta = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `tape` WHERE `id_user` = '$user[id]' AND `read` = '0' "),0); // Лента			
			 
			 $discuss = mysql_result(mysql_query("SELECT COUNT(`count`) FROM `discussions` WHERE `id_user` = '$user[id]' AND `count` > '0' "),0); // Обсуждения			
			 
			 $k_frend = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$user[id]'"), 0); // Друзья			
			 
			 $k_notif = mysql_result(mysql_query("SELECT COUNT(`read`) FROM `notification` WHERE `id_user` = '$user[id]' AND `read` = '0'"), 0); // Уведомления			 
			 
			 /* 
* Поймать добычу
*/

if (!isset($fortuna))$fortuna = 1;

if (isset($user['id']) && $fortuna == 1)
{
	$rand = rand(1,500);
	$key = rand(1111111111,9999999999);
	
	if ($rand == 10 or $rand == 20 or $rand == 30 or $rand == 40 or $rand == 50 or $rand == 60 or $rand == 70 or $rand == 80 or $rand == 90 or $rand == 100)
	{
		$_SESSION['s_code'] = $key;
		$_SESSION['s_rand'] = $rand;
		$_SESSION['s_str'] = $_SERVER['PHP_SELF'];
		echo '<div class="nav2"><img src="/style/icons/fav.gif" /> <a href="/plugins/games/zagon/fortuna.php?key=' . $key . '">Поймать добычу</a></div>';
	}
}


echo'<div class="gend"><a href="/">Главн</a> | <a href="/info.php">Анк</a> | <a href="/mail.php">Почта</a> |</div>';





			if ($k_new!=0 && $k_new_fav==0){
			
echo "<div class='link'>";

echo "<a href='/new_mess.php'><img src='/style/icons/mess0.png' alt='$k_new' />";

echo " Новое сообщение ($k_new)</a>";
				
echo "</div>";

                      }               
               			
		}
	}
}
?>