$(document).ready(function(){
	
	// Navigation
	$('ul.sf-menu').superfish();
	
	// Tabs
	$('#tabs').tabs( { fx: { opacity:'toggle' } } );
	$('#tabsheight').tabs( { fx: { opacity:'toggle', height:'toggle' } } );
	
	$('#email').defuscate();
	
	// Random home images
	$('#1').cycle({
		fx: 'fade',
		delay: 3000,
		speed: 500,
		random: 1
		});
	
	/*$("#random").PikaChoose( { user_thumbs:true,
								show_captions: false,
								auto_play: true,
								show_prev_next:false,
								thumb_width:10,
								thumb_height:10
								} );
	
	$("#photos").PikaChoose( { show_captions: true,
								auto_play: true,
								show_prev_next: false
								} );*/
	
	// Gallery JS	
	var onMouseOutOpacity = 0.67;
	/*$('#thumbs-adv ul.thumbs li').css('opacity',onMouseOutOpacity)
		.hover(
			function () {
				$(this).not('.selected').fadeTo('fast',1.0);
			},
			function () {
				$(this).not('.selected').fadeTo('fast',onMouseOutOpacity);
			}
		);*/
	
	$('#thumbs ul.thumbs li').opacityrollover( {
		mouseOutOpacity:	onMouseOutOpacity,
		mouseOverOpacity:	1.0,
		fadeSpeed:			'fast',
		exemptionSelector:	'.selected'
	} );
	
	$('#thumbs2 ul.thumbs li').opacityrollover( {
		mouseOutOpacity:	onMouseOutOpacity,
		mouseOverOpacity:	1.0,
		fadeSpeed:			'fast',
		exemptionSelector:	'.selected'
	} );
	
	$('#thumbs3 ul.thumbs li').opacityrollover( {
		mouseOutOpacity:	onMouseOutOpacity,
		mouseOverOpacity:	1.0,
		fadeSpeed:			'fast',
		exemptionSelector:	'.selected'
	} );
	
	$('#thumbs4 ul.thumbs li').opacityrollover( {
		mouseOutOpacity:	onMouseOutOpacity,
		mouseOverOpacity:	1.0,
		fadeSpeed:			'fast',
		exemptionSelector:	'.selected'
	} );
	
	var gallery = $('#thumbs').galleriffic({
		delay:					3000,
		numThumbs:				7,
		preloadAhead:			1,
		enableHistory:			false,
		imageContainerSel:		'#slideshow',
		controlsContainerSel:	'#controls',
		captionContainerSel:	'#caption',
		loadingContainerSel:	'#loading',
		onSlideChange:			function(prevIndex, nextIndex) {
			this.find('ul.thumbs').children()
				.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
				.eq(nextIndex).fadeTo('fast', 1.0);
		},
		onPageTransitionOut:	function(callback) {
			this.fadeTo('fast', 0.0, callback);
		},
		onPageTransitionIn:		function() {
			this.fadeTo('fast', 1.0);
		}
	});
	
	var gallery2 = $('#thumbs2').galleriffic({
		delay:					3000,
		numThumbs:				7,
		preloadAhead:			1,
		enableHistory:			false,
		imageContainerSel:		'#slideshow2',
		controlsContainerSel:	'#controls2',
		captionContainerSel:	'#caption2',
		loadingContainerSel:	'#loading2',
		onSlideChange:			function(prevIndex, nextIndex) {
			this.find('ul.thumbs').children()
				.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
				.eq(nextIndex).fadeTo('fast', 1.0);
		},
		onPageTransitionOut:	function(callback) {
			this.fadeTo('fast', 0.0, callback);
		},
		onPageTransitionIn:		function() {
			this.fadeTo('fast', 1.0);
		}
	});
	
	var gallery3 = $('#thumbs3').galleriffic({
		delay:					3000,
		numThumbs:				7,
		preloadAhead:			1,
		enableHistory:			false,
		imageContainerSel:		'#slideshow3',
		controlsContainerSel:	'#controls3',
		captionContainerSel:	'#caption3',
		loadingContainerSel:	'#loading3',
		onSlideChange:			function(prevIndex, nextIndex) {
			this.find('ul.thumbs').children()
				.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
				.eq(nextIndex).fadeTo('fast', 1.0);
		},
		onPageTransitionOut:	function(callback) {
			this.fadeTo('fast', 0.0, callback);
		},
		onPageTransitionIn:		function() {
			this.fadeTo('fast', 1.0);
		}
	});
		
	var gallery4 = $('#thumbs4').galleriffic({
		delay:					3000,
		numThumbs:				7,
		preloadAhead:			1,
		enableHistory:			false,
		imageContainerSel:		'#slideshow4',
		controlsContainerSel:	'#controls4',
		captionContainerSel:	'#caption4',
		loadingContainerSel:	'#loading4',
		onSlideChange:			function(prevIndex, nextIndex) {
			this.find('ul.thumbs').children()
				.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
				.eq(nextIndex).fadeTo('fast', 1.0);
		},
		onPageTransitionOut:	function(callback) {
			this.fadeTo('fast', 0.0, callback);
		},
		onPageTransitionIn:		function() {
			this.fadeTo('fast', 1.0);
		}
	});
			
			
			
			
			
			
			
			
			
});