$(function() {
    var picLt01 = $('.action-lt .set-link img');
    picLt01.hover(function() {
        $(this).attr('src', 'i/set01hovered.png')
    }, function() {
        $(this).attr('src', 'i/set01.png')
    })

    var picLt02 = $('.action-top .set-link img');
    picLt02.hover(function() {
        $(this).attr('src', 'i/set02hovered.png')
    }, function() {
        $(this).attr('src', 'i/set02.png')
    })

    var picLt03 = $('.action-rt .set-link img');
    picLt03.hover(function() {
        $(this).attr('src', 'i/set03hovered.png')
    }, function() {
        $(this).attr('src', 'i/set03.png')
    })

    var butt = $('button.item-absence');
    var shadow = $('div.shadow');
    var msg = $('.msg');
    var cls = $('.msg span');

    butt.click(function() {
        $('html, body').animate({ scrollTop: 0 }, 'fast');
        shadow.fadeTo(600, .7, function() {
            msg.show();
        })
    })

    shadow.click(function() {
        $(this).hide();
        msg.hide();
    })

    cls.click(function() {
        msg.hide();
        shadow.hide();
    })


    $(document).keydown(function(event) {
        var key = event.keyCode || event.which;
        if (key === 27) {
            shadow.fadeTo(300, 0, function() {
                $(this).hide();
            });
            msg.hide();
        }
    });


});
