<table class="title">

<tr>

<td class='p_m2'>
<table align="right">
<tr>
<?if (isset($user)){?>
<td class='buttom'><?
echo '<a href="/">Моя стр.</a>';
?></td>


<td class='buttom'><?
$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);


 if ($k_new!=0 && $k_new_fav==0){
 
echo "<a href='/new_mess.php'><img src='/style/icons/new_mess.gif' alt='S'/> Почта (<font color=\"#ff0000\">+$k_new</font>)</a>";

}else{
echo "<a href='/konts.php'>Почта</a>";
}
?></td>
<td class='buttom'><?
$lenta = mysql_result(mysql_query("SELECT COUNT(*) FROM `tape` WHERE `id_user` = '$user[id]' AND `read` = '0' "),0);

echo "<a href='/user/tape/index.php'><center>Лента";
$k_l = $lenta;
if($k_l>0)echo " <font color=\"#ff0000\">(+$k_l)</font>";
echo "</a>";
?></td>


<td class='buttom'><?
$k_f = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$user[id]' LIMIT 1"), 0);
if ($k_f>0)
echo "<a href='/user/frends/new.php'>Друзья (<font color='red'>+$k_f</font>)</a>";
else 
echo '<a href="/user/frends/?id='.$user['id'].'">Друзья</a>';
?></td>

<td class='buttom'><?
echo '<a href="'.$_SERVER['REQUEST_URI'].'">Обновить</a>';
?></td>

<?}else{

	echo "<form method='post' action='/login.php'><table style=' float:right;vertical-align:top;padding-right:12%;'><tr><td>
		Логин:<br /><input type='text' name='nick' maxlength='32' /></td>
		<td>Пароль:<br /><input type='password' name='pass' maxlength='32' /> <td><br /><input type='submit' value='Войти' /></td>
		</td></tr><td>
		<label><input type='checkbox' name='aut_save' value='1' /> Запомнить меня</label></td><td> <a href='/pass.php'>Забыл пароль?</a><br /></tr></table></form>";

			echo "<br />";


echo '<div id="reg" style="display:none;">';
echo "<form method='post' action='/reg.php?$passgen'>\n";
echo "Выберите ник [A-zА-я0-9 -_]:<br /><input type='text' name='nick' maxlength='32' /><br />\n";
echo "Регистрируясь, Вы автоматически соглашаетесь с <a href='/rules.php'>правилами</a> сайта<br />\n";
echo "<input type='submit' value='Продолжить' />\n";
echo "</form><br />\n";
echo'</div>';

?></td>

<?}?>
</tr>
</table>
</td>

</tr>

</table>
<table class="bottom2" cellspacing="0" cellpadding="0">
<tr>
<td>
<table align="center">
<?if (isset($set['title']))echo $set['title'];?>
</td>
</tr>
</table>
</table>