jQuery('html').addClass('js');
jQuery(document).ready(function() {

     // jQuery("#content, .sidebar").equalHeights();
     // jQuery(".sponsor_promo > p").equalHeights();

     /* jQuery('#wrapper').filter(function(index) {
          if (jQuery('.content-header', this).length > 0) {
               if (jQuery('.content-header').html().match(/[^a-zA-Z]/m) || jQuery('.content-header').is(':empty')) {
                    jQuery('.content-header').hide();
               }
          }
     }); */

     jQuery('a[rel*=facebox]').facebox();

     // This div stores navigation & information at the top of multiple BuddyPress pages.
     // If it is empty, hide it, because it takes up vertical space even when it is empty.
     jQuery(".content-header:empty").hide(); // This will hide it if it contains absolutely nothing (text or other elements)
     jQuery(".content-header").each(function() {
          // The built-in jQuery :empty filter above does not account for whitespace
          if (jQuery(this).text().match(/^[\s]+$/)) {
               jQuery(this).hide();
          }
     });
     
     jQuery('a:has(img)').css('border', '0px');

     jQuery('ul.item-list li:odd, ul.activity-list li:odd').addClass('odd');
     
     
     jQuery('ul#letter-list li').hover(
          function() {
              jQuery(this).children('a').css({
                   color:'#fff',
                   'text-shadow': '0 -1px #637d03'
               });
          },
          function() {
              jQuery(this).children('a').css({
                   color:'#fff',
                   'text-shadow': '0 -1px #6f8b04'
               });
          }
     );

     jQuery('ul#letter-list li').click(function() {
          window.location.href = jQuery(this).children('a').attr('href');
     });

     jQuery('ul.sf-menu li').hover(
          function() {
               jQuery(this).children('a').css({color: '#3481e1'});
          },
          function() {
               jQuery(this).children('a').css({color: '#949494'});
          }
     );

     jQuery('#login_button').hover(
          function() {
               jQuery(this).attr('src', stylesheet_directory + '/images/login_button_hover.png');
          },
          function() {
               jQuery(this).attr('src', stylesheet_directory + '/images/login_button.png');
          }
     );

     jQuery('.main-nav li > ul, .main-nav li').hover(
          function() {
               jQuery(this).parent().children('a').css('color', '#fff');
          },
          function() {
               jQuery(this).parent().children('a').css('color', '#5e6d16');
          }
     );

     jQuery('div.menu > ul > li:last').children('a').css('background-image', 'none');
     jQuery('div.menu > ul > li:last > a').hover(
          function() {
               jQuery(this).css('background-image', 'none');
          },
          function() {
               jQuery(this).css('background-image', 'none');
          }
     );

     jQuery('div#mtg_buttons div.generic_button').hover(
          function() {
               jQuery(this).children('a').css('color', '#3a3a3a');
          },
          function() {
               jQuery(this).children('a').css('color', '#707070');
          }
     );

     jQuery('a[href$=".pdf"]').addClass('pdf').attr('target', '_blank');
});

function equalize_columns(increment) {
     if (jQuery('div.sidebar').height() >= jQuery('#content').height()) {
          console.log(jQuery('div.sidebar').height());
          jQuery('div.sidebar').live('sidebarLoad', function() {
               jQuery('#content').height(eval(jQuery('div.sidebar').height() + increment));
          });
     }
}
