// Check if we're dealing with a small screen
if (screen.width < 700) {
  $('body').addClass("xs-screen");
}
if (screen.width < 970) {
  $('body').addClass("s-screen");
}

// Center the navigation menu on the homepage
$(window).resize(function() {
    var navwidth = 0;
    $(".home .navigation-menu ul").children().each(function(){
        navwidth += $(this).width()+1;
    });
    $(".home .navigation-menu ul").width(navwidth);
});
$(window).resize();

// Slideshow of feature images
$('.slideshow').cycle({ fx: 'fade', speed: 1000, timeout: 7000 });

// Create columns in the categories and archive widgets
$(".widget_categories ul").columns(2);
$(".widget_archive ul").columns(2);
$(".storelisting-categories").columns(3);

// Create movie showtime tooltips
$('.showtime-time').tipsy({gravity: 'sw',delayIn: 500});
$('.showtime-label').tipsy({gravity: 'sw',delayIn: 500});
$('.display').tipsy({gravity: 'sw',delayIn: 500});
$('.age').tipsy({gravity: 'sw',delayIn: 500});
$('.map').tipsy({gravity: 's',delayIn: 500});
$("ul.jqt_tabs").tabs("div.jqt_panes > ul", {effect: 'fade'});

// Enable map lightbox
$('.map_popup_button').click(function(e) {
    $('.map_popup').lightbox_me({ centered: true });
    e.preventDefault();
});

// Enable video player
VideoJS.setupAllWhenReady();
$(document).ready(function () {
	$(".video-poster").hide();		
		if( $.browser.msie || ($.browser.mozilla && $.browser.version.slice(0,3) == "1.9" ) )  {
			$("video").hide();
			flowplayer("player", {src: flowplayer_lib_path + '/flowplayer-3.2.7.swf', wmode: 'opaque'},  {
				clip: {
					autoPlay: false, 
					autoBuffering: false
				}
			});
			$(".video-player").show();			
		} else {
			$(".video-player").remove();
			$(".video-html5").show();
		}
});
