$(document).ready(function(){

  $('#nav').superfish();

  var $sb = $('#sidebar');
  if ($sb.find('.bottom').length === 0) {
    $sb.addClass('bottomless')
  }
  $('.row').each(function(){
    var $me = $(this);
    $me.children('.cell').each(function(){
        var $child = $(this)
        var height = ($me.height() - 
             parseInt($(this).css('padding-top')) - 
             parseInt($(this).css('padding-bottom')));
        $child.css('height', height);
        var $content = $child.find('#content');
        if ($content.length === 1) {
            if ( $.browser.msie && parseInt($.browser.version, 10) === 8 ) {
                $content.css('height', (
                    height - 
                    $child.find('#nav').height() - 
                    parseInt($content.css('padding-bottom')) - 
                    parseInt($content.css('border-bottom-width'))) - 24).parents('.wrap').css('padding-bottom', 35);
            } else {
	            $content.css('height', (
	                height - 
	                $child.find('#nav').height() - 
	                parseInt($content.css('padding-bottom')) - 
	                parseInt($content.css('border-bottom-width'))));				
			};

        };
    });
  });
});
