(function($){
  $(document).ready(function() {
    var lightbox_options = {fitToScreen: true,
  		fileLoadingImage : '/wp-content/themes/huffpuff/images/lightbox/loading.gif',
  		fileBottomNavCloseImage : '/wp-content/themes/huffpuff/images/lightbox/closelabel.gif'};
    $(".entry a[href$='.jpg'], .wp-caption a[href$='.jpg'], .entry a[href$='.gif'], .wp-caption a[href$='.gif']").lightbox(lightbox_options);
    
    $(".bottom>li:last-child, .bottom .the-content p:last-child, #bottom-5 .entry-inner p:last-child, #richtext-6 p:last-child").addClass('last');
    $("#suckerfishnav li:first-child a").addClass('first');
    $("input[type='text']").addClass('text');
    $('#post-home ul').cycle({timeout: 5000});
  });

  window.onload = function(){
    level_height(".bottom", ".the-content")
    level_height("#top-two", ".entry")
    level_height(".bottom", "h3")
    level_height(".bottom", ".entry-inner")
    level_height("#bottom-2", ".entry")
  };

  function level_height(containers, inner) {
    containers = $(containers);
    containers.each(function(){
      var max_height = 0;
      $(inner, this).each(function(){
        if ($(this).height() > max_height) max_height = $(this).height();
      }).each(function(){
        $(this).height(max_height);
      });
    });
  }
})(jQuery);
