
// FancyBox Functions

jQuery(document).ready(function() {
	
var preventClick=false;

	$("a.image").fancybox({
	        'type'				: 'image',
	        'transitionIn'		: 'fade',
			'transitionOut'		: 'elastic',
			'autoScale'			: false,
			'titleShow'			: false,
			'centerOnScroll'	: true,
			'speedIn' 			: 150,
			'speedOut'			: 150,
			'zoomSpeedIn'		: 300,
			'zoomSpeedOut'		: 300,
			'overlayShow'		: true,
			'overlayOpacity'	: 0.8,
			'overlayColor'		: "#000000"			
		
	});
	
	$("a.iframe").each(function(){  
		var dWidth  = parseInt($(this).attr('href').match(/width=[0-9]+/i)[0].replace('width=',''));  
		var dHeight     =  parseInt($(this).attr('href').match(/height=[0-9]+/i)[0].replace('height=',''));  
	$(this).fancybox({  
			'type'				: 'iframe',
	        'transitionIn'		: 'fade',
			'transitionOut'		: 'elastic',
			'autoScale'			: false,
			'titleShow'			: false,
			'centerOnScroll'	: true,
			'speedIn' 			: 150,
			'speedOut'			: 150,
			'zoomSpeedIn'		: 300,
			'zoomSpeedOut'		: 300,
			'overlayShow'		: true,
			'overlayOpacity'	: 0.8,
			'width'				: dWidth,  
			'height'			: dHeight,
			'overlayColor'		: "#000000"
		});  
	});

	$("a.youtube").click(function() {
		$.fancybox({
			'type'				: 'swf',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'elastic',
			'autoScale'			: false,
			'titleShow'			: false,
		   	'centerOnScroll'	: true,
			'speedIn' 			: 150,
			'speedOut'			: 150,
			'zoomSpeedIn'		: 300,
			'zoomSpeedOut'		: 300,
			'overlayShow'		: true,
			'overlayOpacity'	: 0.8,
			'overlayColor'		: "#000000",
			'autoScale'			: false,
			'width'				: 680,
			'height'			: 495,
			'href'				: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'swf'				: {
			'wmode'				: 'transparent',
			'allowfullscreen'	: 'true'	
			}
		});

		return false;
	});

// Force FancyBox on hash

if(location.hash.indexOf('#popup-')!=-1)

{
	$(location.hash+' a.image').click();
	$(location.hash+' a.iframe').click();
	$(location.hash+' a.youtube').click();
}

});

// Carousel Functions

	function mycarousel_initCallback(carousel) {
		jQuery('.jcarousel-control a').bind('click', function() {
			carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
			return false;
		});
	
		jQuery('.jcarousel-scroll select').bind('change', function() {
			carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
			return false;
		});
	
		jQuery('#mycarousel-next').bind('click', function() {
			carousel.next();
			return false;
		});
	
		jQuery('#mycarousel-prev').bind('click', function() {
			carousel.prev();
			return false;
		});
	};

	jQuery(document).ready(function() {
		jQuery("#mycarousel").jcarousel({
			scroll: 3,
			initCallback: mycarousel_initCallback 
		});
	});
	
// Drop Down Site Switcher

	function loadPage(list) {
		location.href=list.options[list.selectedIndex].value
	}

// External SSP Controls

		function sspLoadAlbum(album) {
	    	thisMovie("ssp").sspLoadAlbum(album);
		}
		
		function thisMovie(movieName) {
			if (navigator.appName.indexOf("Microsoft") != -1) {
				return window[movieName]
			} else {
			    return document[movieName]
			}
		}
		

