/*
 * sameHeights plugin
 */
(function($) {
    $.fn.sameHeights = function(options) {
        var opts = $.extend({
            useMargin: false
        },options);
        var maxHt = 0;
        this.each(function(){
            maxHt = $(this).height() > maxHt ? $(this).height() : maxHt;
        });
        return this.each(function(){
            if (opts.useMargin) {
                $(this).css({ 'margin-bottom':(maxHt - $(this).height()) + 'px' });
            } else {
                $(this).height(maxHt);
            }
        });
    };
})(jQuery);


jQuery(document).ready(function(){

  // Filter navigation
  $("#nav-filter .filter").accordion({
    header: 'h3',
    autoHeight: false,
    navigation: true,
    collapsible: true,
    active: false
  });


  // Deal Entries Paragraphs - trim and remove if empty
  $('div.entry p').each(function(){
    $(this).html($.trim($(this).html().replace(/&nbsp;/g,'')));
    if( $(this).html() == '' ) $(this).remove();
  });


  // Prefooter
  $('#prefooter').each(function(){
    $(this).html($.trim($(this).html().replace(/&nbsp;/g,'')));
    if( $(this).html() == '' ) $(this).css({'padding':'0'});
  });

  
  $('body.home div.entry').sameHeights();

});

