GAP = (function($) {
    
    function bg_resize() {
        $('#bg img').each(function() {
            var ratio = Math.max($(window).width() / $(this).width(), $(window).height() / $(this).height()); 
            
            $(this).css({
                width: Math.max(800, ($(this).width() * ratio)) + 'px',
                left: ($(window).width() - $(this).width() * ratio) / 2 + 'px'
            });
        });
        
        $('#wrap, #bg').css({
            height: Math.max(500, $(window).height()) + 'px',
            width: Math.max(800, $(window).width()) + 'px'
        });
        $('#static').css({
            maxHeight: ($('#wrap').height() - 170) + 'px'
        });
    };
    
    $(function() {
        
        
        $(window).resize(bg_resize);
        
    });
    
    $(bg_resize);
    $(window).load(bg_resize);
    
    return {
        bg_resize: bg_resize
    }
    
})(jQuery);
