/* Needed for layout fix? */
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() {

  equalHeight($(".holder"));

  if ($('#main .options .watch, .seetrailer').length) {
    $('#main .options .watch a, .seetrailer').bind('click', function(event) {
      event.preventDefault();

      var input = '';
      if(FlashDetect.versionAtLeast(9) == false) {
        input = '<p>Opps! It appears you don\'t have Adobe Flash installed or are using an old version.</p>'
          +'<p>Please <a href="http://www.adobe.com/go/getflashplayer" title="Get the latest Flash player" target="_blank">'
          +'get the latest Flash player</a>'
          +' now to watch this trailer.</p>';
      } else {
         input = window.trailers[($(this).attr('href').split('/'))[5]];
      }
      
      $.facebox(input);

      return false;
    });
  }

  $('input[type="text"], textarea').bind({
    focus: function () {
      var field = $(this);
      if (field.val() === field.attr('title')) {
        field.val('');
      }
    },
    blur: function () {
      var field = $(this);
      if (field.val() === '') {
        field.val(field.attr('title'));
      }
    }
  }).each(function () {
    var field = $(this);
    if (field.val() === '') {
      field.val(field.attr('title'));
    }
  });

  $('#review, .comment-form').submit(function() {
    $.each($(this).find('input[type="text"], textarea'), function() {
      var field = $(this);
      if (field.val() === field.attr('title')) {
        field.val('');
      }
    });
  });

//  $('#photos').galleryView({
//    panel_width: 691,
//    panel_height: 267,
//    frame_width: 100,
//    frame_height: 38,
//    transition_speed: 1200,
//    background_color: 'transparent',
//    border: 'none',
//    easing: 'easeInOutBack',
//    pause_on_hover: true,
//    nav_theme: 'custom',
//    overlay_height: 52,
//    filmstrip_position: 'bottom',
//    overlay_position: 'none'
//  });

});
