window.scrollTo = function (x, y) {
    return true;
}

function NormalAlert(_Msg, _Title, _Class) {
    $(document).ready(function () {
        $.gritter.add({
            title: _Title,
            text: _Msg,
            //image: $path_assets + '/avatars/avatar1.png',
            sticky: false,
            time: 8000,
            position: 'top-right',
            class_name: 'gritter-light ' + ' ' + _Class
        });
    });
}

var _alert;
function consume_alert() {
    if (_alert) return;
    _alert = window.alert;
    window.alert = function (message) {
        NormalAlert(message, '', 'gritter-normal');
    };
}
consume_alert();

$('.AI-errors').on('DOMNodeInserted', 'ul', function () {
    NormalAlert($(this).html(), '', 'gritter-error');
    $('.AI-errors').html('');
});


/* fix side menu */
$(document).ready(function () {
    var _hMenu_topM = 200;

    $(window).on('scroll', function () {
        if ($(this).scrollTop() > _hMenu_topM) {
            if (!$('.top-area').hasClass('fixed-top')) {
                $('.top-area').hide();
                $('.top-area').fadeIn('slow');
            }
            $('.top-area').addClass('fixed-top');
            $('.body-section').addClass('padd-top');
        }
        else {
            if ($('.top-area').hasClass('fixed-top')) {
                $('.top-area').hide();
                $('.top-area').fadeIn('slow');
            }

            $('.top-area').removeClass('fixed-top');
            $('.body-section').removeClass('padd-top');
        }
    });

});
/* */
