
var j$ = jQuery.noConflict();


 j$(document).ready(function() {
							 

var zIndexNumber = 1000;
j$('div').each(function() {
	j$(this).css('zIndex', zIndexNumber);
	zIndexNumber -= 10;
});

  var spacing = 310;
  
  
  j$('#featured-films').css({
    'width': '880px',
    'height': '280px',
    'overflow': 'hidden'
  }).find('.covers p').css({
    'float': 'none',
    'position': 'absolute',
    'left': 1000
  });
  
 

  var setUpCovers = function() {
    var $covers = j$('#featured-films .covers p');
	
    $covers.unbind('click mouseenter mouseleave hover');
	
	$covers.removeClass();
    

    // Left image; scroll right (to view images on left).
    $covers.eq(0)
      .css('left', 0)
      .click(function(event) {
			j$('#featured-films p span.description').hide();					  
      		$covers.eq(1).removeClass("here");
			$covers.eq(0).removeClass("first");
			$covers.eq(2).removeClass("third");
         	$covers.eq(0).animate({'left': spacing}, 'slow');
         	$covers.eq(1).animate({'left': spacing * 2}, 'slow');
         	$covers.eq(2).animate({'left': spacing * 3}, 'slow');
         	$covers.eq($covers.length - 1)
           .css('left', -spacing)
           .animate({'left': 0}, 'slow', function() {												  
             j$(this).prependTo('#featured-films .covers');
             setUpCovers();
           });
        event.preventDefault();
      });
      
      


   // Right image; scroll left (to view images on right).
    $covers.eq(2)
      .css('left', spacing * 2)
      .click(function(event) {
			j$('#featured-films p span.description').hide();
     		$covers.eq(1).removeClass("here");
			$covers.eq(0).removeClass("first");
			$covers.eq(2).removeClass("third");
         	$covers.eq(0)
           .animate({'left': -spacing}, 'slow', function() {											 
             j$(this).appendTo('#featured-films .covers');
             setUpCovers();
           });
         	$covers.eq(1).animate({'left': 0}, 'slow');
         	$covers.eq(2).animate({'left': spacing}, 'slow');
         	$covers.eq(3)
         	.css('left', spacing * 3)
           .animate({'left': spacing * 2}, 'slow');
         event.preventDefault();
      });
             
       

   // Center image.
   
   	$covers.removeClass();
   
    $covers.eq(1)
      .css('left', spacing).addClass("here"); 
	  $covers.eq(0).addClass("first"); 
	  $covers.eq(2).addClass("third");
	j$('#featured-films p.here span.description').show();	  	
  };

  setUpCovers();
  
 }); 
  
 
 j$(document).ready(function() {

  
 	j$('#featured-films .covers p').append('<span class="moreLeft"><em>More Films</em></span><span class="moreRight"><em>More Films</em></span>'); 
	
	j$('#featured-films').prepend('<div id="fadeout"></div>'); 
	
	j$('#featured-films .shadow').show(); 
	
	j$('#fadeout').css('z-index','980'); 
	
	j$('#navigation li ul').css('z-index','1800');	
	
	j$('#cover').css('z-index','0'); 	
	
	j$('#player').css('z-index','0');
	
	j$('#featured-films p span.description').hide();	
	
	j$('#featured-films p.here span.description').delay(800).slideDown('slow');
	

	
//centering popup
function centerPopup(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var popupWidth = j$("#video-popup").width();
//centering
j$("#video-popup").css({
"left": windowWidth/2-popupWidth/2
});
//only need force for IE6

}	

centerPopup();


//centering popup
function centerMap(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var popupWidth = j$("#map").width();
//centering
j$("#map").css({
"left": windowWidth/2-popupWidth/2
});
//only need force for IE6

}	




	j$('#featured-films a.standard').click(function() {
		j$('#video-popup').empty();													
		var vid1 = j$(this).attr("href");
		j$('#video-popup').load(vid1);
		j$('#video-popup').show();
		j$('#video-popup').css('z-index','2000');	
		j$('#cover').addClass('TB_overlayBG');
		j$('#cover').css('z-index','1100');	
		return false;
	});
	
	
	j$('#featured-films a.high').click(function() {
		j$('#video-popup').empty();
		var vid2 = j$(this).attr("href");	
		j$('#video-popup').load(vid2);
		j$('#video-popup').show();	
		j$('#video-popup').css('z-index','2000');		
		j$('#cover').addClass('TB_overlayBG');	
		j$('#cover').css('z-index','1100');
		return false;
	});	


	j$('#cover').click(function() {
		j$('#video-popup').empty();
		j$('#video-popup').hide();
		j$('#video-popup').css('z-index','0');			
		j$('#map').css('left','-9999px');
		j$('#cover').removeClass('TB_overlayBG');
		j$('#cover').css('z-index','0');		
		j$('#video-popup').empty();
		return false;		
	});	


	j$('#content .map a').click(function() {
		centerMap();
		j$('#map').css('z-index','2000');
		j$('#map div').css('z-index','2200');	
		j$('#cover').addClass('TB_overlayBG');	
		j$('#cover').css('z-index','1100');			
		return false;		
	});	
	
	

});