<?php
#Верхняя панель для авторизованных
#уведомления о сообщениях
$mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_kont` = '$user[id]' AND `read` = '0' AND `deleted` != '$user[id]' AND `deleted` != '-1' AND `flaggedTo` = 'inbox'"), 0);
$jn = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$jne = mysql_result(mysql_query("SELECT COUNT(*) FROM `events` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$jnf = mysql_result(mysql_query("SELECT COUNT(*) FROM `f_journal` WHERE `id_user` = '$user[id]' AND `read` = '0'"), 0);

$not = $jn + $jne + $jnf;
$friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends_new` WHERE `to` = '$user[id]'"), 0);

/*
echo "<div id='navi' class='horiz-menu' style='border-bottom-left-radius: 2px;border-bottom-right-radius: 2px;background-image: linear-gradient(to bottom, #$user[colorfp] 0%,#$user[colorbs] 100%);'>";
?>

<table cellspacing="0" cellpadding="0" class="horiz-menu__wrapper" width="100%"> 
    <tr width="100%">
        <td width="20%" class="horiz-menu__col">
            <a class="horiz-menu__link" data-toggle='modal' data-target='#menu_aut'>
                <font color='#<?= $user['colorlp'] ?>'>
                <i class="fa fa-bars fa-fw <?php
if ($user['icon_size'] == 0) {
    echo 'fa-lg';
} elseif ($user['icon_size'] == 1) {
    echo 'fa-2x';
} elseif ($user['icon_size'] == 2) {
    echo '';
}
?>" style="width: 21px;height: 21px;"></i>
                </font>
            </a>
        </td> 
        <td width="20%" class="horiz-menu__col"> 
            <a href="/id<?= $user['id'] ?>" class="horiz-menu__link" title="Друзья">
                <font color='#<?= $user['colorlp'] ?>'>
                <i class="fa fa-user fa-fw <?php
                if ($user['icon_size'] == 0) {
                    echo 'fa-lg';
                } elseif ($user['icon_size'] == 1) {
                    echo 'fa-2x';
                } elseif ($user['icon_size'] == 2) {
                    echo '';
                }
?>" style="width: 21px;height: 21px;"></i>
                </font>
            </a> 
        </td>
        <td width="20%" class="horiz-menu__col"> 
            <a href="/user/mail/" class="horiz-menu__link" title="Почта">
                <font color='#<?= $user['colorlp'] ?>'>
                <i class="fa fa-envelope fa-fw <?php
                if ($user['icon_size'] == 0) {
                    echo 'fa-lg';
                } elseif ($user['icon_size'] == 1) {
                    echo 'fa-2x';
                } elseif ($user['icon_size'] == 2) {
                    echo '';
                }
?>" style="width: 21px;height: 21px;"></i>

                <?php
                if ($mail > 0) {
                    echo "<span class='jewelCount'><span class='_51lp _3z_5 _5ugh' id='blink7'>$mail</span></span>";
                }
                ?>
                </font></a>
        </td>
        <?php
        if ($friends > 0) {
            ?>
            <td width="20%" class="horiz-menu__col"> 
                <a href="/user/friends/" class="horiz-menu__link" title="Друзья"><font color='#<?= $user['colorlp'] ?>'>
                    <i class="fa fa-users fa-fw <?php
        if ($user['icon_size'] == 0) {
            echo 'fa-lg';
        } elseif ($user['icon_size'] == 1) {
            echo 'fa-2x';
        } elseif ($user['icon_size'] == 2) {
            echo '';
        }
            ?>" style="width: 21px;height: 21px;"></i>
                       <?php
                       if (mysql_result(mysql_query("SELECT COUNT(*) FROM `friends_new` WHERE `to` = '$user[id]' LIMIT 1"), 0) > 0) {
                           echo "<span class='jewelCount'><span class='_51lp _3z_5 _5ugh' id='blink7'>$friends</span></span>";
                       }
                       ?>
                    </font>
                </a> 
            </td>
            <?php
        }
        ?>

        <td width="20%" class="horiz-menu__col"> <a href="/user/notification/" class="horiz-menu__link" title="Журнал"> <font color='#<?= $user['colorlp'] ?>'>
                <i class="fa fa-bell fa-fw <?php
        if ($user['icon_size'] == 0) {
            echo 'fa-lg';
        } elseif ($user['icon_size'] == 1) {
            echo 'fa-2x';
        } elseif ($user['icon_size'] == 2) {
            echo '';
        }
        ?>" style="width: 21px;height: 21px;"></i>
                   <?php
                   if ($not > 0) {
                       echo "<span class='jewelCount'><span class='_51lp _3z_5 _5ugh' id='blink7'>$not</span></span>";
                   }
                   ?>
                </font></a> 
        </td> 
        <td width="20%" class="horiz-menu__col"> 
            <a href="<?php stripcslashes(htmlspecialchars($_SERVER['REQUEST_URI'])); ?>" class="horiz-menu__link" title="Обновить"> <font color='#<?= $user['colorlp'] ?>'>
                <i class="fa fa-refresh fa-fw <?php
                   if ($user['icon_size'] == 0) {
                       echo 'fa-lg';
                   } elseif ($user['icon_size'] == 1) {
                       echo 'fa-2x';
                   } elseif ($user['icon_size'] == 2) {
                       echo '';
                   }
                   ?>" style="width: 21px;height: 21px;"></i>
                </font></a> 
        </td> 
    </tr> 
</table>

    <?php
    */
    $rekl = mysql_result(mysql_query("SELECT COUNT(*) FROM `rekl` WHERE `sel` = '1'"), 0);
    if ($rekl > 0) {
        rekl(1);
    }
    ?>

