$(document).ready(function(){
    var wHeight = Math.round($(window).height() * 0.8);
    var photoHeight = $('.photo').height()+5;
    $('.page').height(wHeight-40);
    var scrollerHeight = Math.round(wHeight * 0.66);
    var scrollerModulo = scrollerHeight % 139;
    var scrollerHeight = scrollerHeight - scrollerModulo;
    $('.scroller').height(scrollerHeight);
    //$('.scroller').height(Math.round(wHeight * 0.66));
    $('.scroller').scrollTop(0);
    $('img[alt="team"]').height(Math.round(wHeight * 0.30));
    var pHeight = $('.photoImage img').height();
    $('.photoImage .photoCover').height(pHeight);
    $('.moreLink').height(pHeight);
    
    // reakce na změnu velikosti okna
    $(window).resize(function(){
        var wHeight = Math.round($(window).height() * 0.73);
        $('.page').height(wHeight);
    var scrollerHeight = Math.round(wHeight * 0.66);
    var scrollerModulo = scrollerHeight % 139;
    var scrollerHeight = scrollerHeight - scrollerModulo;
    $('.scroller').height(scrollerHeight);
        $('img[alt="team"]').height(Math.round(wHeight * 0.30));
    });
    
    $('#scrollDown').click(function(){
    
            var scTop = $('.scroller').scrollTop();
            for(i = 0; i < 140; i++)
           {
               scTop += 1;
               setTimeout("$('.scroller').scrollTop("+scTop+");", 300);
           }

    });
    
    $('#scrollUp').click(function(){
    
            var scTop = $('.scroller').scrollTop();
            for(i = 0; i < 140; i++)
           {
               scTop -= 1;
               setTimeout("if("+scTop+" > 0) { $('.scroller').scrollTop("+scTop+"); }", 300);
           }
           
    });
    
    $('.photoImage').hover(function()
    {
        $(this).children('.photoDesc').fadeIn('slow');
        $(this).children('.photoCover').fadeIn('slow');
    }, 
    function()
    {
        $(this).children('.photoDesc').fadeOut('slow');
        $(this).children('.photoCover').fadeOut('slow');
    });
});
