var layout = {
    fix_wrapper_height: function() {

        var wrap = $('#wrapper');
        var top = $('#top');
        var menu = $('#menu');
        var content = $('#content');
        var left = $('#left');

        if (wrap != null && top != null && menu != null && content != null && left != null && (wrap.height() < $(window).height())) {
            wrap.height($(window).height());

            var content_padding = (content) ? content.css("padding-top").substr(0, content.css("padding-top").length - 2) : 0;
            var full_height = $(window).height() - top.height() - menu.height() - content_padding;

            content.height(full_height);
            left.height(full_height);
        }
    },
    border_wrap: function() {
        var wrap = $('#wrapper');
        if (wrap != null && wrap.width() >= 1280) {
            wrap.css('border-left', '1px solid #202121');
            wrap.css('border-right', '1px solid #202121');
        }
        else {
            wrap.css('border', 0);
        }
    }
}

$(document).ready(function() {
    layout.fix_wrapper_height();
    //layout.border_wrap();
    
    $(window).bind('resize', function() {
            layout.fix_wrapper_height();
            //layout.border_wrap();
        }
    );
});
