Shadowbox.init({
   skipSetup: true
});
(function($){
	$(document).ready(function(){
		setupMainNav();
		$('#newslb').click(function() {
			$(this).blur();
			return openNewsLightbox(this.href + '?lid=16');
		});
		$('.lightboxYouTube,.lightboxSwf').click(function() {
			Shadowbox.open({
				content: this.href,
				player: 'swf',
				title: this.title || '',
				width: 480,
				height: 360
			});
			return false;
		});
		$('.lightboxFlv').click(function() {
			Shadowbox.open({
				content: this.href,
				player: 'flv',
				title: this.title || '',
				width: 480,
				height: 360
			});
			return false;
		});
		$('.lightboxQuickTime').click(function() {
			Shadowbox.open({
				content: this.href,
				player: 'qt',
				title: this.title || '',
				width: 480,
				height: 360
			});
			return false;
		});
		$('.lightboxWmv').click(function() {
	        Shadowbox.open({
		        content: this.href,
		        player: 'wmp',
		        title: this.title || '',
		        width: 480,
		        height: 360
	        });
	        return false;
		});
		$('.lightboxImage').click(function() {
	        Shadowbox.open({
		        content: this.href,
		        player: 'img',
		        title: this.title || ''
	        });
	        return false;
		});
	});

	function setupMainNav() {
		$('#main-nav ul').children().each(function(i) {
			var li = $(this);
			li.hover(
				function() {
					li.addClass('hover');
				},
				function() {
					li.removeClass('hover');
				}
			);
		});
	};
})(jQuery);

function openNewsLightbox(url) {
	var w = $(window).width();
	var h = $(window).height();
	if (w > 786 && h > 560) {
		Shadowbox.open({
			content: url,
			player: 'iframe',
			title: '<img src="/layout/images/bam-news.gif" width="180" height="25" alt="BAM News" style="margin: 10px 0 0 10px;" />',
			width: 786,
			height: 560
		});
		return false;
	} else {
		return true;
	}
}
/** used for image slider **/
function openLightbox(url, caption, type) {
	type = type || 'img';
	Shadowbox.open({
		content: url,
		player: type,
		title: caption
	});
}
