(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);

  $(".scroll-wrap").scrollable({size:3,clickable:false});
});

window.onload = function(){
  $(".make-equal").each(function(){
    var max_height = 0;
    $(".entry", this).each(function(){
      if ($(this).height() > max_height) max_height = $(this).height();
    }).each(function(){
      $(this).height(max_height);
    });
  });
  $(window).resize(position_zigzag);
  position_zigzag();
};

function position_zigzag() {
  var offset = 25 - ( $("#footer-widgets").offset().left % 25);
  $("#zigzag").css('top', $("#footer-widgets").offset().top).show();
  var win_height = ($(window).height() > $('body').height() ? $(window).height() : $('body').height()) - $("#footer-widgets").offset().top;
  $("#zigzag").css('left', -offset).width($(window).width() + offset).height($("#footer-widgets").height() + 28);
}

})(jQuery);