	function nscarousel_initCallback(carousel) {
		jQuery('.ns-carousel-numbers-box a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval(((jQuery(this).text()*5)-4)));
			return false;
		});
	}
	function nscarousel_itemLastInCallback(carousel, item, idx, state) {
		var numberLinkStatusClass= ".ns-carousel-numbers-box a#number-link-" + Math.ceil((idx - 5)/5);
		$('.ns-carousel-numbers-box a').removeClass('current-carousel-link');
		$(numberLinkStatusClass).addClass('current-carousel-link');
	};
	function cscarousel_initCallback(carousel) {
		jQuery('.cs-carousel-numbers-box a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval(((jQuery(this).text()*5)-4)));
			return false;
		});
	}
	function cscarousel_itemLastInCallback(carousel, item, idx, state) {
		var numberLinkStatusClass= ".cs-carousel-numbers-box a#number-link-" + Math.ceil((idx - 5)/5);
		$('.cs-carousel-numbers-box a').removeClass('current-carousel-link');
		$(numberLinkStatusClass).addClass('current-carousel-link');
	};


jQuery(document).ready(function() {
//Home page
	//Carousels
	
	jQuery('#coming-soon-carousel').jcarousel({ scroll:3,initCallback: cscarousel_initCallback,itemLastInCallback: cscarousel_itemLastInCallback});
	jQuery('#now-showing-carousel').jcarousel({ scroll:3,initCallback: nscarousel_initCallback,itemLastInCallback: nscarousel_itemLastInCallback}); //called before it is hidden to make chrome happy
	jQuery('#coming-soon').addClass('hidden');
				
	jQuery('#coming-soon-link-li>a.r2load').click( function (){
		jQuery('#coming-soon-link-li>a').removeClass('r2load');
		//changed the way this worked to make chrome happy
		//jQuery('#coming-soon-carousel').jcarousel({ scroll:5,initCallback: cscarousel_initCallback,itemLastInCallback: cscarousel_itemLastInCallback});
		

	});
	
//Details page
	jQuery('a.changeLocationScroll').click( function () {
		jQuery.scrollTo(0,0,{duration:1000, onAfter:function(){ jQuery('.location-switcher').addClass('hoverstate');jQuery('.location-switcher > .change-location > form > input').animate({opacity: 1.0}, 1000).effect("highlight", {color: "#FF7800"}, 1000);}});
		return false;
	});
	
	//Accordians
	jQuery('#showtmes-nearby').accordion({ header: 'h4', collapsible: true, autoHeight: false });
	
	//Carousels
	jQuery('#movieImagesCarousel').jcarousel({scroll:2});
	
	
	if( jQuery('.movieImagesCarousel').length>0 ) {
       jQuery('.movieImagesCarousel').jcarousel({
			scroll:2
		});
	}

	
	
});
