$(document).ready(function() {
    //hide all divs with class of HideIfEmpty
    $("div.HideIfEmpty").each(function() {
        if($(this).html().replace(/^\s+|\s+$/g, '').replace('<p></p>','').length == 0) {
            $(this).css("display","none");
        }
    });
});
