$(document).scroll(function(){
var what = $("#page6").offset().top,
pos = $(window).height() + $(window).scrollTop() - 500;
if (what <= pos) {
$("body").addClass('menu-black');
} else {
$("body").removeClass('menu-black');
}
var what2 = $("#page8").offset().top,
pos2 = $(window).height() + $(window).scrollTop() - 500;
if (what2 <= pos2) {
$("body").removeClass('menu-black')
}
});
function SendNotice($p1, $p2) {
$user = R::findOne('users', 'login = ?', array($p1));
if ($user) {
$id = $user->id;
$notice = R::dispense('notices');
$notice->uid = $id;
$notice->status = 0;
$notice->data = date("H:i d:m:Y");
$notice->text = $p2;
R::store($notice);
} else {
echo 'Ошибка при добавлении оповещения!';
}
}