$(document).ready(function () {
	
	$('body').addClass('has-js');
	
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
	$('body').addClass('isiPhone');
	var isiPhone = true;
	} else {
	var isiPhone = false;
	};
	
	
	$('a.colorbox-images').colorbox({ overlayClose:false, speed:600, scalePhotos:false, innerWidth:'720px', innerHeight:'400px', initialWidth:'100px', initialHeight:'100px', slideshow:true});
	
	$('.colorbox-text').colorbox({ overlayClose:false, speed:600, scrolling:false, innerWidth:'720px', innerHeight:'400px', initialWidth:'100px', initialHeight:'100px', inline:true, href: function(){
		var textlink = $(this).attr('id');
		return '#movie-'+textlink;
	} });
	$('.colorbox-embed').colorbox({ overlayClose:false, speed:600, scrolling:false, innerWidth:'720px', innerHeight:'400px', initialWidth:'100px', initialHeight:'100px', inline:true, href: function(){
		var textlink = $(this).attr('id');
		return '#box-'+textlink;
	} });
	
	$('cite a').colorbox({ overlayClose:false, speed:600, width:"95%", height:"95%", initialWidth:'100px', initialHeight:'100px', iframe:true});
	
	$('#screenings-page .scroll-content ul li a').colorbox({ overlayClose:false, speed:600, width:"95%", height:"95%", initialWidth:'100px', initialHeight:'100px', iframe:true});
	
	
	$('.video-link').colorbox({ overlayClose:false, speed:600, scrolling:false, innerWidth:'720px', innerHeight:'400px', initialWidth:'100px', initialHeight:'100px', iframe:true });
	
	var modulewidth = '500px';	
	if ($('#module-block').attr('class') == 'left-strip') { modulewidth = '126px';}
	if ($('#module-block').attr('class') == 'left-square') { modulewidth = '360px';}
	if ($('#module-block').attr('class') == 'right-revsquare') { modulewidth = '270px';}
	
	$('#module-block').hide();
	$('#module-block .scroll-content').hide();
	$('#module-block').animate({
		opacity: 1,
		width: modulewidth
	  }, 800, function() {
		$('#module-block .scroll-content').show();
		if (isiPhone == false) {
			$('.content #module-block div.scroll-container').jScrollPane({showArrows:true, scrollbarMargin:15, arrowSize:20, wheelSpeed:5, animateTo:true}); 
		};
		$('#module-block .jScrollPaneContainer').hide();
		$('#module-block .jScrollPaneContainer').fadeIn(777);
	  });
	
});



