<div class="share42init"></div>
<script type="text/javascript" src="http://vroyale.ru/share42/share42.js"></script>
<script type="text/javascript">share42('http://vroyale.ru/share42/',150,20)</script>



<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' /> Сообщений (<font color=\"#ff0000\">+$k_new</font>)</a>";

}else{
echo "<a href='/konts.php'>Сообщения</a>";
}
?></td>
<td class='buttom'><?
$lenta_komm = mysql_result(mysql_query("SELECT COUNT(*) FROM `lenta_komm` WHERE `id_kont` = '$user[id]' AND `read` = '0' "),0);
$lenta = mysql_result(mysql_query("SELECT COUNT(*) FROM `lenta` WHERE `id_kont` = '$user[id]' AND `read` = '0' "),0);

echo "<a href='/user/lenta/index.php'><center>Лента друзей";
$k_l = $lenta+$lenta_komm;
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/frend_new.php'>Новый друг (<font color='red'>+$k_f</font>)</a>";
else 
echo '<a href="/user/frends/frend.php?id='.$user['id'].'">Мои друзья</a>';
?></td>

<td class='buttom'><?
echo "<a href=\"/jurnal.php\" title=\"Журнал\">Журнал $nj</a><br/>\n";
?></td>


<td class='buttom'><?
echo '<a href="/exit.php">Выйти</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' />
		<input type='submit' value='Войти' />
		</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 "<a href='http://api.vkontakte.ru/oauth/authorize?client_id=3077769&scope=offline&redirect_uri=vroyale.ru%2Fvklogin.php&response_type=code&display=touch'><img
src='/img/enter_vk.gif'></a><br />\n";

			echo "<br />";


echo '<div id="reg" style="display:none;">';
echo "<form method='post' action='/reg.php?$passgen'>\n";
echo "Твой ник? :<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>