
var photo_captions = [
  '', // leave this blank; there is no #0
  'Photo caption #1.',
  'Photo caption #2.',
  'Photo caption #3.',
  'Photo caption #4. But this one is a really, really long photo caption, only for testing purposes. Did I mention that it\'s for testing...?',
  'Photo caption #5.',
  'Photo caption #6.',
  'Photo caption #7.',
  'Photo caption #8.'
];

function resize_container_for_ie8() {

  $('#page').css('padding-bottom', 80);

  var header_height   = $('#header').height();
  var content_height  = $('#content').height();
  var window_height   = $(window).height();
  var footer_height   = $('#footer').height();
  var min_height      = header_height + content_height + footer_height + 50;

  $('#container').height( Math.max(min_height, window_height) );

}

function resize_container_for_ff() {
  return $('#page').css('padding-bottom', 109);
}

$(document).ready(function(){

  // ff bug
  if ($.browser.mozilla && /\.com\/?$/.test(location.href)) {
    resize_container_for_ff();
    $(window).resize(resize_container_for_ff);
  }

  // ie8 sticky footer
  if (($.browser.msie && $.browser.version >= 8)) {
    resize_container_for_ie8();
    $(window).resize(resize_container_for_ie8);
  }

  // photo gallery
  $('body#photo-gallery #caption').html(photo_captions[1]);
  $('body#photo-gallery #thumbs a').live('click', function() {
    var id = $(this).find('img').attr('src').replace(/\D/g, '');
    $('#big-image').attr('src', '/img/photo-gallery/large-' + id + '.jpg');
    $('#caption').html(photo_captions[id]);
  });

  // nav hover effects
  $('#content ul#nav img:not(.active-arrows), img#find-out-more').mouseover(function(){
    var $this = $(this);
    var src = $this.attr('src');
    if ($this.parents('li.active').size() === 0) {
      $this.attr('src', src.replace(/\./, '-hover.'));
    }
  }).mouseout(function(){
    var $this = $(this);
    var src = $this.attr('src');
    if ($this.parents('li.active').size() === 0) {
      $this.attr('src', src.replace(/-hover\./, '.'));
    }
  });

});


