function setDivHeight(divId)
{
  content_margin_top = parseInt($('#content').css('margin-top'));

  content_top_height = $('#content_top').height();

  content_body_padding_top = parseInt($('#content_body').css('padding-top'));
  
  content_body_padding_bottom = parseInt($('#content_body').css('padding-bottom'));

  footer_height = $('#content_top').height() + parseInt($('#footer').css('padding-top')) + parseInt($('#footer').css('padding-bottom')) + parseInt($('#footer').css('margin-top')) + parseInt($('#footer').css('margin-bottom'));

  viewport_height = $(window).height();

  //alert(content_margin_top + "; " + content_top_height + "; " + content_body_padding_top + "; " + content_body_padding_bottom + "; " + viewport_height + "; ");

  necessary_height = viewport_height - (content_margin_top + content_top_height + content_body_padding_top + content_body_padding_bottom + footer_height);
  necessary_height = necessary_height -7; //non riesco a capire perché questa riduzione di 7 pixel è necessaria
  //alert(necessary_height + " - " + $("#" + divId).height());
  
  if($("#" + divId).height() < necessary_height)
  {
    $("#" + divId).height(necessary_height);
  }
}


$(document).load(function(){

  setDivHeight("content_body");

});

$(window).resize(function(){

  setDivHeight("content_body");

});
