/* FancyBox - page elements settings
*/


$(document).ready(function() {
						   
						   
/* Gallery / Photo settings */


		$("a.gallery").fancybox({
			'titlePosition'	: 'over'
		});

		$("a[rel=gallery_group]").fancybox({
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});
		
		
/* Newsletter sign up settings */

		
		$("#signup_error").hide();
		
		$("a.newsletter_signup").fancybox({
			'scrolling'		: 'no',
			'titleShow'		: false,    
			'onClosed'		: function() {
				$("#signup_error").hide();
				$("#signup_name").val("");
				$("#signup_email").val("");
			}
		});
		
		$("#signup").bind("submit", function() {
		
			if ($("#signup_name").val().length < 1 || $("#signup_email").val().length < 1) {
				$("#signup_error").show();
				$.fancybox.resize();
				return false;
			}
		
			$.fancybox.showActivity();
		
			$.ajax({
				type		: "POST",
				cache	: false,
				url		: "newsletter_signup.php",
				data		: $(this).serializeArray(),
				success: function(data) {
					$.fancybox(data);
				}
			});
		
			return false;
		});
		

/* iFrame / Google maps settings */


		$(".iframe").fancybox({
			'width'				: '90%',
			'height'			: '90%',
			'autoScale'			: false,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
		});
		
		
/* Panoramics settings */


		$(".pano").fancybox({
			'autoScale'			: false,
			'height'			: 327,
			'width'				: 643,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'swf',
			'titleShow'			: false,	    
			'showCloseButton'   : true,
			'swf'			: {
			   	 'allowfullscreen'	: 'true'
			}
		});
		

		
/* Video player settings */
		
		
		$(".video").fancybox({
			'autoScale'			: false,
			'height'			: 396,
			'width'				: 528,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'swf',
			'titleShow'			: false,	    
			'showCloseButton'   : true,
			'swf'			: {
			   	 'allowfullscreen'	: 'true'
			}
		});
		
	});