コンテンツのサイズに依存せず、下までサイドバーを伸ばすJSコード

上下が横100%のヘッダーフッターに挟まれた、縦長のメニューバーがあったんですよ。
本当はその縦長メニューバーの背景を常にフッターにくっつく形で伸ばしたくて、
しかも右側にメインコンテンツ(内容量不明)が入るってことで脆弱コーダーはてんやわんやでした。

とにかくそれが何故かコンテンツと同じ長さしか伸びなくて、グスグスしてたら
上司が「これ書いたよ」ってJSくれました!!!!
神か~~。.:*・゚ *ଘ(੭*ˊᵕˋ)੭* ੈ✩‧₊˚

でも何やってるか分からない(終了

<script type="text/javascript">
(function($){
function resizeSideMenu()
{
var windowHeight = $(window).outerHeight();
var documentHeight = $(document).outerHeight();
var baseHeight = (windowHeight < documentHeight)? documentHeight: windowHeight;
var h = baseHeight - $("#footer").outerHeight() - $("#branding").outerHeight();
$("#main").height( h );

$("#footer").css({"top":"0px"});
}

$(document).ready(function(){
resizeSideMenu();
});

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

})(jQuery);
</script>

同じhtmlの構成にしないと汎用性ないかもね。