loader = {
    init: function() {
        $('.game_container').hide();
        $('#loader').show();
        $('#loader .play.bar').hide();

        $('#bar').animate({
            width: '230px'
        }, {
            duration: 20000,
            step: this.step,
            complete: this.complete
        });

        $('#play').click( function() {
            $('#loader').hide();
            $('div.game_container').show();
        });
    },
    step: function() {        
        var s = new String($(this).css('width'));
        s = s.replace( /px/, '' );
        var num = new Number( s );
        num /= 230;
        num *= 100;
        $('#label').text( Math.round(num) + " %" );
    },
    complete: function() {
        $('#loader .load.bar').hide();
        $('#loader .text').hide();
        $('#loader .play.bar').show();
    }
}

$(document).ready( function() {
    loader.init();
});  

