jQuery(function($) {

$(document).ready(function() {
  var lightbox_options = {fitToScreen: true,
   fileLoadingImage : '/wp-content/themes/meltingpot/images/lightbox/loading.gif',
   fileBottomNavCloseImage : '/wp-content/themes/meltingpot/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);
  $(".gallery a[href$='.jpg'], .gallery a[href$='.gif']").lightbox(lightbox_options);
  // $("#sidebar li a.alignright").prepend('<span class="bgl"></span><span class="bgr"></span>');
  $(".front-swapper").cycle({timeout: 5000});
	$('body').append('<div class="smcf-link" style="display:none;"></div>');
	$('.page-item-16 a').click(function(){
		$('.smcf-link').click();
		return false;
	});
	$('.content-body li').wrapInner('<span />');
});

window.onload = function(){
  level_height("#hp-features", "p");
  var contheight = $('#content').height();
  var sideheight = $('#sidebar').height();
  if ((sideheight) < contheight) {
    $('#sidebar').append('<li class="widget-filler" style="height:'+(contheight-sideheight-7)+'px;"></li>');
  }
};

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