function animateMenuOpen() {
    $('#logo-rollover').delay(400).animate({width: '100%'}, 300);
}
function animateMenuClose() {
    $('#logo-rollover').animate({width: '0'}, 200);
}


$('#logo .hitarea').mouseenter(animateMenuOpen);
$('#logo .hitarea').click(animateMenuOpen);

$('#logo-rollover').click(animateMenuClose);
$('#logo-rollover').mouseleave(animateMenuClose);

function handleResize() {
    // move stuff to center
    $('#logo-rollover > *').css('left', $(window).width() / 2 - $('#main').width() / 2 + 35 + 'px');
}

function setLabels() {
    $('#page .column .arrow').each(function() {
        var arrow = $(this);

        var arrowHeight = arrow.find('.rollover').height();
        arrow.find('h2').css('marginTop', arrowHeight / 2 - arrow.find('h2').height() / 2 - 5);

        var imageHeight = arrow.find('img').height();

        var marginTop = imageHeight / 2 - arrowHeight / 2;
        arrow.find('.rollover').css('marginTop', marginTop + 'px');

       // arrow.find('.rollover').hide();
    });

    $('.arrow').mouseenter(function() {
        $(this).find('.rollover').animate({opacity: '1'}, 200);
    });

    $('.arrow').mouseleave(function() {
        $(this).find('.rollover').delay(300).animate({opacity: '0'}, 400);
    });
    
}

$('#page .column .arrow').each(function() {
    $(this).find('.rollover').css('opacity','0');
});

setTimeout(setLabels, 500);

$(window).resize(handleResize);
handleResize();
