jQuery(function($) {
$(document).ready(function() {
  // var lightbox_options = {fitToScreen: true,
  // 		fileLoadingImage : '/wp-content/themes/sca/images/lightbox/loading.gif',
  // 		fileBottomNavCloseImage : '/wp-content/themes/sca/images/lightbox/closelabel.gif'};
  // $(".entry a[href$='.jpg'], .wp-caption a[href$='.jpg'], .entry a[href$='.gif'], .wp-caption a[href$='.gif'], .gallery-icon a").lightbox(lightbox_options);
	if ($('.cycle').length) $('.cycle').cycle({timeout: 5000});
	
	// (AdvertHeight + AdvertBorderTopAndBottom) - (PodHeaderPad + PodBodyPad + PodBorder + PodHeaderHeight)
	$('.row-advert .body').height( (298+20+20) - ( 19 + 22 + 1 + $('.row-advert h2').height() ) );
	$('.ad-gallery').adGallery({
	  loader_image: '/wp-content/themes/newoptimist/images/loader.gif',
    slideshow: {
      enable: true,
      autostart: true,
      speed: 5000
    }
	});
});

window.onload = function(){
	level_pods();
};


function level_pods() {
  containers = $('.row');
  containers.each(function(){
    var max_height = 0;
    $('.body', this).each(function(){
      if ($(this).height() > max_height) max_height = $(this).height();
    }).each(function(){
      $(this).height(max_height);
    });
  });
}
});
