jQuery(document).ready(function($){
	var onMouseOutOpacity = 0.4;
	$('.gallery-container ul.thumbs li').opacityrollover({
		mouseOutOpacity:   onMouseOutOpacity,
		mouseOverOpacity:  1.0,
		fadeSpeed:         'fast',
		exemptionSelector: '.selected'
	});


	// FANCYBOX CALLS
	$(".fancy-gallery, .fancy-sidenav").fancybox({ 
		'overlayColor' 	 : '#FFF'
		,'overlayOpacity': 0.65
		,'titleShow'	 : false
		,'autoDimensions': false
		,'height'		 : 560
		,'width'		 : 750
		,'padding'		 : 0
		,'type'			 : 'inline'
		,'onStart'	: function() {  
			$("#photo-gallery").css('display', 'block'); 
			$("#photo-gallery .gallery-close").click( $.fancybox.close );
		}
		,'onClosed'	: function() {  
			$("#photo-gallery").css('display', 'none'); 
			$("#photo-gallery").parent().css('display', 'none'); 
		}
	});
	$(".fancy-maps-sidenav").fancybox({ 
		'overlayColor' 	 : '#FFF'
		,'overlayOpacity': 0.65
		,'titleShow'	 : false
		,'autoDimensions': true
		//,'autoScale'	 : false
		//,'height'		 : 671
		//,'width'		 : 750
		,'padding'		 : 0
		,'type'			 : 'inline'
		,'onStart'	: function() {  
			$("#maps-gallery").css('display', 'block'); 
			$("#maps-gallery .gallery-close").click( $.fancybox.close );
		}
		,'onClosed'	: function() {  
			$("#maps-gallery").css('display', 'none'); 
			$("#maps-gallery").parent().css('display', 'none'); 
		}
	});


	// NEIGHBORHOOD PHOTO GALLERY
	$('#photo-gallery').galleriffic({
		numThumbs:				12,
		imageContainerSel:      '#slideshow',
		controlsContainerSel:   '#controls',
		captionContainerSel:	'#caption',
		renderSSControls: 		false,
		prevPageLinkText: 		'&laquo; back',
        nextPageLinkText: 		'more &raquo;',
		onSlideChange: 			function(prevIndex, nextIndex) {
			// 'this' refers to the gallery, which is an extension of $('#thumbs')
			this.find('ul.thumbs').children()
			.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
			.eq(nextIndex).fadeTo('fast', 1.0);
		}
	});
	$("#photo-gallery").css('display', 'none'); 

	
});
