$(document).ready(function() {

    function staticNav() {
        var winHeight = $(window).height(); 
        var winWidth = $(window).width();
        var barHeight = $("#sidebar").height(); 
        var browserIE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;

        if (browserIE6) { //if IE6...
            $("#sidebar").css({'position' : 'absolute'}); 
        } else { //if not IE6...
            $("#sidebar").css({'position' : 'fixed'});
        }

        if (980 > winWidth || barHeight > winHeight) { 
            $("#sidebar").css({'position' : 'static'});
        }
    }

    staticNav(); 

    $(window).resize(function () { 
        staticNav();
    });

});
