
function initMenu()
{
    initMenuList()
    RPMenu();

    clearClick = false;
    $('#menu-bg').stop(true, true).animate({'opacity':'0.7'}, 0, function()
    {
        $('#menu').stop(true, true).animate({'margin-left':0}, 800, 'easeOutQuad', function(){clearClick = true;});
    });
}

function initMenuList()
{
    var HTML = '<li><a href="javascript:void(0)" id="hotel">'+HOTEL+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="gallery">'+GALLERY+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="st-barts">'+ST_BARTS+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="guestbook">'+GUESTBOOK+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="events">'+EVENTS+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="newsletter">'+NEWSLETTER+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="rates">'+RATES+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="press">'+PRESS+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="credits">'+CREDITS+'</a></li>';
    HTML += '<li><a href="javascript:void(0)" id="contact">'+CONTACT+'</a></li>';
    
    $('#menu-list-content').html(HTML);

    $('a', '#menu-list-content').click(function()
    {
        if (clearClick)
        {
            $('a', '#menu-list-content').removeClass('selected');
            $(this).addClass('selected');

            if ($(this).attr('id') == 'hotel' && currentPage != $(this).attr('id')) displayHotel();
            if ($(this).attr('id') == 'gallery' && currentPage != $(this).attr('id')) displayGallery();
            if ($(this).attr('id') == 'st-barts' && currentPage != $(this).attr('id')) displayStBarts();
            if ($(this).attr('id') == 'guestbook' && currentPage != $(this).attr('id')) displayGuestbook();
            if ($(this).attr('id') == 'events' && currentPage != $(this).attr('id')) displayEvents();
            if ($(this).attr('id') == 'newsletter' && currentPage != $(this).attr('id')) displayNewsletter();
            if ($(this).attr('id') == 'rates' && currentPage != $(this).attr('id')) displayRates();
            if ($(this).attr('id') == 'press' && currentPage != $(this).attr('id')) displayPress();
            if ($(this).attr('id') == 'credits' && currentPage != $(this).attr('id')) displayCredits();
            if ($(this).attr('id') == 'contact' && currentPage != $(this).attr('id')) displayContact();

            currentPage = $(this).attr('id');

            if (lastPageEvents)
            {
                lastPageEvents = false;
                initVideoBg();
            }
        }
    });
}

function RPMenu()
{
    $('#menu-bg').height($(window).height());
    $('#menu-list').height($(window).height()-$('#menu-logo').height()-$('#menu-social-icons').height()-77);
    initScroll();
}
