jQuery(document).ready(function() {

	/*
	*   Gallery - images
	*/
	
	$("#halloween2010-gallery").click(function() {
		$.fancybox([
			'gallery/Halloween 2010/001.jpg',
			'gallery/Halloween 2010/002.jpg',
			'gallery/Halloween 2010/003.jpg',
			'gallery/Halloween 2010/004.jpg',
			'gallery/Halloween 2010/005.jpg',
			'gallery/Halloween 2010/006.jpg',
			'gallery/Halloween 2010/007.jpg',
			'gallery/Halloween 2010/008.jpg',
			'gallery/Halloween 2010/009.jpg',
			'gallery/Halloween 2010/010.jpg',
			'gallery/Halloween 2010/011.jpg',
			'gallery/Halloween 2010/012.jpg',
			'gallery/Halloween 2010/013.jpg',
			'gallery/Halloween 2010/014.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	$("#corporate-gallery").click(function() {
		$.fancybox([
			'gallery/Corporate/001.jpg',
			'gallery/Corporate/002.jpg',
			'gallery/Corporate/003.jpg',
			'gallery/Corporate/004.jpg',
			'gallery/Corporate/005.jpg',
			'gallery/Corporate/006.jpg',
			'gallery/Corporate/007.jpg',
			'gallery/Corporate/008.jpg',
			'gallery/Corporate/009.jpg',
			'gallery/Corporate/010.jpg',
			'gallery/Corporate/011.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	$("#ceremonies-gallery").click(function() {
		$.fancybox([
			'gallery/On Site Ceremonies/001.jpg',
			'gallery/On Site Ceremonies/002.jpg',
			'gallery/On Site Ceremonies/003.jpg',
			'gallery/On Site Ceremonies/004.jpg',
			'gallery/On Site Ceremonies/005.jpg',
			'gallery/On Site Ceremonies/006.jpg',
			'gallery/On Site Ceremonies/007.jpg',
			'gallery/On Site Ceremonies/008.jpg',
			'gallery/On Site Ceremonies/009.jpg',
			'gallery/On Site Ceremonies/010.jpg',
			'gallery/On Site Ceremonies/011.jpg',
			'gallery/On Site Ceremonies/012.jpg',
			'gallery/On Site Ceremonies/013.jpg',
			'gallery/On Site Ceremonies/014.jpg',
			'gallery/On Site Ceremonies/015.jpg',
			'gallery/On Site Ceremonies/016.jpg',
			'gallery/On Site Ceremonies/017.jpg',
			'gallery/On Site Ceremonies/018.jpg',
			'gallery/On Site Ceremonies/019.jpg',
			'gallery/On Site Ceremonies/020.jpg',
			'gallery/On Site Ceremonies/021.jpg',
			'gallery/On Site Ceremonies/022.jpg',
			'gallery/On Site Ceremonies/023.jpg',
			'gallery/On Site Ceremonies/024.jpg',
			'gallery/On Site Ceremonies/025.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	$("#alexander-gallery").click(function() {
		$.fancybox([
			'gallery/The Alexander Hall/001.jpg',
			'gallery/The Alexander Hall/002.jpg',
			'gallery/The Alexander Hall/003.jpg',
			'gallery/The Alexander Hall/004.jpg',
			'gallery/The Alexander Hall/005.jpg',
			'gallery/The Alexander Hall/006.jpg',
			'gallery/The Alexander Hall/007.jpg',
			'gallery/The Alexander Hall/008.jpg',
			'gallery/The Alexander Hall/009.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	$("#elizabeth-gallery").click(function() {
		$.fancybox([
			'gallery/The Elizabeth Hall/001.jpg',
			'gallery/The Elizabeth Hall/002.jpg',
			'gallery/The Elizabeth Hall/003.jpg',
			'gallery/The Elizabeth Hall/004.jpg',
			'gallery/The Elizabeth Hall/005.jpg',
			'gallery/The Elizabeth Hall/006.jpg',
			'gallery/The Elizabeth Hall/007.jpg',
			'gallery/The Elizabeth Hall/008.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	$("#victoria-gallery").click(function() {
		$.fancybox([
			'gallery/The Victoria Hall/001.jpg',
			'gallery/The Victoria Hall/002.jpg',
			'gallery/The Victoria Hall/003.jpg',
			'gallery/The Victoria Hall/004.jpg',
			'gallery/The Victoria Hall/005.jpg',
			'gallery/The Victoria Hall/006.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	$("#wedding-gallery").click(function() {
		$.fancybox([
			'gallery/Wedding Details/001.jpg',
			'gallery/Wedding Details/002.jpg',
			'gallery/Wedding Details/003.jpg',
			'gallery/Wedding Details/004.jpg',
			'gallery/Wedding Details/005.jpg',
			'gallery/Wedding Details/006.jpg',
			'gallery/Wedding Details/007.jpg',
			'gallery/Wedding Details/008.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	
	$("#onsite-gallery").click(function() {
		$.fancybox([
			'gallery/On Site Photography/001.jpg',
			'gallery/On Site Photography/002.jpg',
			'gallery/On Site Photography/003.jpg',
			'gallery/On Site Photography/004.jpg',
			'gallery/On Site Photography/005.jpg',
			'gallery/On Site Photography/006.jpg',
			'gallery/On Site Photography/007.jpg',
			'gallery/On Site Photography/008.jpg',
			'gallery/On Site Photography/009.jpg',
			'gallery/On Site Photography/010.jpg',
			'gallery/On Site Photography/011.jpg',
			'gallery/On Site Photography/012.jpg',
			'gallery/On Site Photography/013.jpg',
			'gallery/On Site Photography/014.jpg',
			'gallery/On Site Photography/015.jpg',
			'gallery/On Site Photography/016.jpg',
		], {
			'padding'			: 10,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image',
		});
	});
	
	
	/*
	*   Examples - images
	*/
	
	$("a#example1").fancybox({
		'titleShow'     : false
	});
		
	$("a#example2").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'
	});
	
	$("a#example3").fancybox({
	    'titleShow'     : false,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none'
	});
	
	$("a#example4").fancybox();
	
	$("a#example5").fancybox({
		'titlePosition'  : 'inside'
	});
	
	$("a#example6").fancybox({
		'titlePosition'  : 'over'
	});
	
	$("a[rel=example_group]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});
	
	/*
	*   Examples - various
	*/
	
	$("#various2").fancybox({
		'modal' : true
	});
	
	$("#various3").fancybox({
		ajax : {
		    type	: "POST",
		    data	: 'mydata=test'
		}
	});

	$("#various4").fancybox({
		ajax : {
		    type	: "POST"
		}
	});
			
	$("#various5").fancybox({
		'width'				: '370px',
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	$("#various6").fancybox({
	    'padding'           : 0,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$("#various7").fancybox({
		onStart		:	function() {
			return window.confirm('Continue?');
		},
		onCancel	:	function() {
			alert('Canceled!');
		},
		onComplete	:	function() {
            alert('Completed!');
		},
		onCleanup	:	function() {
            return window.confirm('Close?');
		},
		onClosed	:	function() {
            alert('Closed!');
		}
	});
	
	$("#various8, #various9").fancybox();
	
	/*
	*   Examples - manual call
	*/
	
	$("#event1").click(function() {
		$.fancybox({
			//'orig'			: $(this),
			'padding'			: 10,
			'href'				: 'images/events/2011_FridayMarch25_FRONT.jpg',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image'
		});
    });
	
	$("#event2").click(function() {
		$.fancybox({
			//'orig'			: $(this),
			'padding'			: 10,
			'href'				: 'images/events/2011_FridayApril8.jpg',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image'
		});
    });
	
	$("#event3").click(function() {
		$.fancybox({
			//'orig'			: $(this),
			'padding'			: 10,
			'href'				: 'images/events/2011_SaturdayMarch19.jpg',
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'              : 'image'
		});
    });
			
	/*
	*   Tips & Tricks
	*/
	
	$("#tip3").fancybox({
	    'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'titlePosition'	: 'over',
		'onComplete'	: function() {
			$("#fancybox-wrap").hover(function() {
				$("#fancybox-title").show();
			}, function() {
				$("#fancybox-title").hide();
			});
		}
	});

	$("#youtube").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			    'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});
	
	$("#youtube2").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			    'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});

    $("#tip5").fancybox({
		'scrolling' : 'no',
		'titleShow'	: false,
		'onClosed'	: function() {
		    $("#login_error").hide();
		}
	});
    
	$("#login_form").bind("submit", function() {
	
	    if ($("#login_name").val().length < 1 || $("#login_pass").val().length < 1) {
	        $("#login_error").show();
	        $.fancybox.resize();
	        return false;
	    }
	    
	    $.fancybox.showActivity();

		$.ajax({
			type	: "POST",
			cache	: false,
			url		: "/data/login.php",
			data	: $(this).serializeArray(),
			success: function(data) {
				$.fancybox(data);
			}
		});

		return false;
	});
	
	$("#tip6").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoScale'     	: false,
		'type'				: 'iframe',
		'width'				: 500,
		'height'			: 500,
		'scrolling'   		: 'no'
	});
	
	function formatTitle(title, currentArray, currentIndex, currentOpts) {
	    return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="/data/closelabel.gif" /></a></span>' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</div>';
	}

	$(".tip7").fancybox({
	    'showCloseButton'   : false,
		'titlePosition' 	: 'inside',
		'titleFormat'		: formatTitle
	});
	
	
	// Next JS snippets are only for fancybox.net
	
	/*
	*   Donate link
	*/
	$("a#donate").bind("click", function() {
		$("#donate_form").submit();
		return false;
	});

	/*
	*   Zebra-stripping table
	*/
	
	$("table.options tr:even").addClass('even');

});


