// $(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);
// });
// 
// window.onload = function(){
//   $('#right-bar').height($('#footer-right').offset().top - $('#menu').offset().top - $('#menu').height());
//   $('#left-column').height($('#container').height() - $('#footer').height())
//   var containers = $(".make-equal");
//   containers.each(function(){
//     var max_height = 0;
//     $(".hp-post", this).each(function(){
//       if ($(this).height() > max_height) max_height = $(this).height();
//     }).each(function(){
//       $(this).height(max_height);
//     });
//   });
// };
jQuery(function($) {

$(document).ready(function() {
    // $("#map").gMap({ markers: [{ latitude: 52.490501,
    //                               longitude: -1.90603 }], zoom: 15 });
  $("#sidebar li a.alignright").prepend('<span class="bgl"></span><span class="bgr"></span>');
  $(".template-home .entry").cycle({
    timeout: 8000
  });
  $('#servicescatlist').submit(function(){
    window.location = $('#cat_path').val();
    return false;
  });
  $('.gallery .gallery-icon a').click(function(){return false;});
});

window.onload = function(){
  level_height("#hp-features", "p");
  var containerheight = $('#container').height() - 12;
  var contheight = $('#content').height();
  var sideheight = $('#sidebar').height();
  // alert(contheight);
  // alert(containerheight);
  if ((sideheight + 21) < containerheight) {
    $('#sidebar').append('<li class="widget-last"><div class="entry-border" style="height:'+(containerheight-sideheight-18)+'px;"></div></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);
    });
  });
}
});
