﻿$(function () {
    sMenu.init('#slider');
});

var sMenu = {
    init: function (element) {
        sMenu.setScrolling();
        var config = { over: this.openPanel, timeout: 1000, out: this.closePanel };
        $(element).hoverIntent(config);
    },
    openPanel: function () {
        $('#slider').animate({ right: 175 }, { duration: 500, easing: 'easeOutCirc' });
    },
    closePanel: function () {
        $('#slider').animate({ right: 0 }, { duration: 500, easing: 'easeInCirc' });
    },
    setScrolling: function () {
        var top = $(window).scrollTop();
        var slider = '#side-right';
        var sliderElement = $(slider);
        // var panelElement = $('#side-right');

        $(window).scroll(function (event) {
            var y = $(this).scrollTop();
            var ntop = top + y;
            sliderElement.stop().animate({ 'top': ntop }, { duration: 500 });
            // panelElement.stop().animate({ 'top': ntop }, { duration: 500 });
        });
    }
};


$(function() {
    var y = $(this).scrollTop();
    height = y + $(window).height() - 200;
    $('#wrapperGoUp').css('top', height);
})


$(window).scroll(function (event) {
    var y = $(this).scrollTop();
    height = y + $(window).height() - 200;
    $('#wrapperGoUp').stop().animate({ 'top': height }, { duration: 650 });
});
