// MAIN FADING PAGE TRANSITIONS
$('#logo a').click(function(e){
     e.preventDefault();
       $.modal.close();
     $('.visible').animate({opacity:'0'}, 500, 'linear', function() {
       $('.visible').removeClass('visible').addClass('hidden_left');
       $('#home').delay(50).removeClass('hidden_left').addClass('visible').animate({opacity:'1'}, 500);
       $.scrollTo(0);
     });
     if ($('video').length) { // implies *not* zero
     var videlement = document.getElementById('html5video');
     videlement.pause();
     };
     return false;
  });
	
$("#nav a.local").click(function (e) {
     e.preventDefault();
     $.modal.close();
     foo = this.hash;
       $('#home .visible').removeClass('visible').animate({opacity:'0'}, 500).addClass('hidden_left'); 
     $('.visible').animate({opacity:'0'}, 500, 'linear', function() {
       $('.visible').removeClass('visible').addClass('hidden_left');
       $(foo).delay(50).removeClass('hidden_left').addClass('visible').animate({opacity:'1'}, 500);
       $.scrollTo(0);
     });
     if ($('video').length) { // implies *not* zero
     var videlement = document.getElementById('html5video');
     videlement.pause();
     };
     return false;
    });
    
// CREW SCRIPTS
$('#crew_list li a').click(function (e){
  e.preventDefault();
  $.modal.close();
  crewmember = this.hash;
  crewmember = crewmember.substring(1)
  modalloc = '#modal_' + crewmember;
  window.setTimeout(function() {
    $(modalloc).modal({
		  overlayClose:true,
		  modal:false,
		  position: [65,600],
		  opacity:0,
	    overlayCss: {backgroundColor:"#aaa"},
	    onOpen: function (dialog) {
	      dialog.overlay.fadeIn('slow', function () {
	        dialog.data.hide();
	        dialog.container.fadeIn('slow', function () {
	          dialog.data.slideDown('slow');
	        });
	      });
	    }
	  });
	}, 50);
	return false;
});

//TRAILERS SCRIPTS
$("#trailers_carousel li a").click(function (e) {
  e.preventDefault();
  vid = this.hash;
  vid = vid.substring(1)
  $("#trailer_player div.wrap").empty().html('<img class="ajax-loader" src="./SiteAssets_2011/images/ajax-loader3.gif" />');
  loc = "./SiteAssets_2011/trailer.php?vid=" + vid;
  $("#trailer_player div.wrap").load(loc);
  return false;
});

// Carousel with screen / only 3 items
$("#trailers_carousel").carousel( { dispItems: 5, pagination: true } );
