jQuery(document).ready(function() {

	/*
	*   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
	*/
	
	$("#bikecourse").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade'
	});
	$("#racedaymap").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade'
	});
	$("#swimcourse").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade'
	});
	$("#runcourse").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade'
	});
	
	$("#various2").fancybox({
		'modal' : true
	});
	
	$("#various3").fancybox({
		ajax : {
		    type	: "POST",
		    data	: 'mydata=test'
		}
	});

	$("#various4").fancybox({
		ajax : {
		    type	: "POST"
		}
	});
	$("#raceresults1").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#newgallery").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'overlayOpacity'    : 0.7,
		'overlayColor'      : '#000',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'scrolling'		    : 'no',
		'type'				: 'iframe'
	});
	$("#raceresults2").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor1").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor2").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor3").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor4").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor5").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor6").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sponsor7").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#map1").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sitenav1").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sitenav2").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#sitenav3").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results1").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results2").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results3").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results4").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results5").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results6").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results7").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results8").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results9").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results10").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results11").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results12").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#results13").fancybox({
		'width'				: '95%',
		'height'			: '95%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#respage1").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#respage2").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#respage3").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#respage4").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site1").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site2").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site3").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#gallery2010").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site4").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site5").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site6").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site7").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site8").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site9").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#site10").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#racevids").fancybox({
		'width'				: 1003,
		'height'			: 767,
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#racepics").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#racevidsb").fancybox({
		'width'				: 1003,
		'height'			: 767,
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'type'				: 'iframe'
	});
	$("#racepicsb").fancybox({
		'width'				: '95%',
		'height'			: '98%',
		'padding'			: 0,
        'autoScale'     	: false,
        'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'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
	*/

	$("#manual1").click(function() {
		$.fancybox({
			//'orig'			: $(this),
			'padding'		: 0,
			'href'			: 'http://farm3.static.flickr.com/2687/4220681515_cc4f42d6b9.jpg',
			'title'   		: 'Lorem ipsum dolor sit amet',
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
		});
    });
    
    $("#manual2").click(function() {
		$.fancybox([
			'http://farm5.static.flickr.com/4044/4286199901_33844563eb.jpg',
			'http://farm3.static.flickr.com/2687/4220681515_cc4f42d6b9.jpg',
			{
				'href'	: 'http://farm5.static.flickr.com/4005/4213562882_851e92f326.jpg',
				'title'	: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
			}
		], {
			'padding'			: 0,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'              : 'image',
			'changeFade'        : 0
		});
	});
			
	/*
	*   Tips & Tricks
	*/
	
	$("#tip3").fancybox({
	    'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'titlePosition'	: 'over',
		'onComplete'	: function() {
			$("#fancybox-wrap").hover(function() {
				$("#fancybox-title").show();
			}, function() {
				$("#fancybox-title").hide();
			});
		}
	});

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

		return false;
	});
	$("#tip6").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'title'			: this.title,
			'width'			: 844,
			'height'		: 500,
			'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'
	});
	$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_two").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_three").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_four").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_five").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_six").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_seven").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_eight").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_nine").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_ten").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_eleven").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_twelve").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_thirteen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });

$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_fourteen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });

$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_fiveteen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_sixteen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_seventeen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_eighteen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_nineteen").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
$(document).ready(function() { 
	 /* This is basic - uses default settings */ 
	 $("a#single_image_twenty").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': true });
	 
	 
	 });
	
	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');

});
