Minimize this script? It doens't work on FF but works on chrome

Can someone look at this and show me how to boil it down into a few lines… it should probably only be 10 lines or so… not 40…

Also, the script works fine in chrome but it seems to not work in Firefox.

Thanks for your help!

        $(document).ready(function () {
            if ($(window).width() < 1150){
                /* hide comment bar if window too small */
                jQuery.event.add(window, "load", resizeFrame1);
                jQuery.event.add(window, "resize", resizeFrame1);
                function resizeFrame1()
                {
                    $('#right-wrapper').hide();
                    $("#left-wrapper").css('width',  $(window).width());
                }
            }else{
                /* resize the left-wrapper to make room for the right-wrapper */
                jQuery.event.add(window, "load", resizeFrame2);
                jQuery.event.add(window, "resize", resizeFrame2);
                function resizeFrame2()
                {
                    $('#right-wrapper').show();
                    $("#left-wrapper").css('width',($(window).width()-$("#right-wrapper").width()));
                }
            }
        });
        $(window).resize(function () {
            if ($(window).width() < 1150){
                /* hide comment bar if window too small */
                jQuery.event.add(window, "load", resizeFrame3);
                jQuery.event.add(window, "resize", resizeFrame3);
                function resizeFrame3()
                {
                    $('#right-wrapper').hide();
                    $("#left-wrapper").css('width',  $(window).width());
                }
            }else{
                /* resize the left-wrapper to make room for the right-wrapper */
                jQuery.event.add(window, "load", resizeFrame4);
                jQuery.event.add(window, "resize", resizeFrame4);
                function resizeFrame4()
                {
                    $('#right-wrapper').show();
                    $("#left-wrapper").css('width',($(window).width()-$("#right-wrapper").width()));
                }
            }
        });

Nevermind… here’s the fix:


            $(document).ready(function () {
                $(window).resize(function () {
                    if ($(window).width() < 1150){
                        $(window).bind("load resize", function() {
                            $('#right-wrapper').hide();
                            $("#left-wrapper").css('width',  $(window).width());
                        }
                    )}
                    else{
                       $(window).bind("load resize", function() {
                            $('#right-wrapper').show();
                            $("#left-wrapper").css('width',($(window).width()-$("#right-wrapper").width()));
                        });
                    }
                });
                $(window).trigger('resize');
            });