function ieMenuFix() {
    $('li.main').hover(
        function () {
            $('#masthead').css('z-index', '-1');
            $(this).addClass('hover');
        },
        function() {
            $(this).removeClass('hover');
            $('#masthead').css('z-index', '1');
        }
    );
}

if ( $.browser.msie && $.browser.version <= 7 ) {
    $(document).ready( function () {
        ieMenuFix();
    });
}


function showFlashWindow() {
    $('#mastheadMask').show();
    $('#mastheadMask').animate({ opacity: 0.9 }, 700, function() {
        $('#flashWindow').show().animate({ opacity: 1 }, 450);
    });
}

function hideFlashWindow() {
    $('#flashWindow').animate({ opacity: 0 }, 450, function() {
        $('#mastheadMask').animate({ opacity: 0 }, 850, function() {
            $('#mastheadMask').hide();
            $('#flashWindow').hide();
        });
    });
}

function bindFlashControls() {
    $('#mastheadMask').animate({ opacity: 0 });
    $('#flashWindow').animate({ opacity: 0 });
    $('#showFlashWindow').click( function() {
        showFlashWindow();
        return false;
    });
    $('#hideFlashWindow').click( function() {
        hideFlashWindow();
        return false;
    });
}

$(document).ready( function () {
    bindFlashControls();
});

