$(function() {

    $('#e3mChooser input').click(function() {
        var film = $(this).attr('id').replace(/^show/, 'film');
        $('#'+film).toggle(400);

        if ( $(this).is(':checked') ) {

            $('#arrow').show().animate({
                opacity: 0.0,
                left: '500px'
            }, 500, 'swing', function() {
                $(this).hide().css({
                    opacity: 1.0,
                    left: '160px'
                });
            });

        }

    });

    $('#e3mChooser input, #filmShowAll, #filmHideAll, #filmShowLighter').click(function() {
        $('#e3mInfo').stop().animate({ left: '1000px', opacity: 0.1}, 400, 'swing');
    });

    $('#filmShowAll').click(function() {
        $('#e3mChooser input').attr('checked','checked');
        $('div.film').show(400);
        return false;
    });

    $('#filmHideAll').click(function() {
        $('#e3mChooser input').removeAttr('checked');
        $('div.film').hide(400);
        return false;
    });

    $('#filmShowLighter').click(function() {
        if ( $(this).text() == 'Make lighter' ) {
            $('div.film img').stop().animate({opacity:0.15});
            $(this).text('Make darker');
        }
        else {
            $('div.film img').stop().animate({opacity:0.4});
            $(this).text('Make lighter');
        }
        return false;
    });

    $('#bookNow').hover(function() {
        $(this).attr('src', '/ppf/book_now_f2.gif');
    }, function() {
        $(this).attr('src', '/ppf/book_now.gif');
    });


    $('#e3mHints a').hover(function() {
        $(this).stop().animate({backgroundPosition: '20px 0px'},200,'swing');
    }, function() {
        $(this).stop().animate({backgroundPosition: '0px 0px'},400,'swing');
    }).click(function() {
        var hintId = $(this).attr('id');

        $('#e3mInfo').stop().animate({ left: '1000px', opacity: 0.1}, 100, 'swing', function() {
            $('div.e3mInfoPanel').hide();

            $('#'+ hintId.replace(/^text/,'e3m') ).show();

            $('#e3mInfo').animate({ left: '500px', opacity: 0.9}, 400, 'swing');
        });

        return false;

    });


    $('a.ppfOkBtn').click(function() {
        $('#e3mInfo').stop().animate({ left: '1000px', opacity: 0.1}, 400, 'swing');
        return false;
    });

});


var ppf = {
    init: function() {
    }
};
