$(document).ready(function() {
	
	function formatText(index, panel) {
		  return index + "";
	  };
	
	var title = document.title;
	var pattern = /home/i;
	if(title.match(pattern)) {
		$(function () {

	        $('.anythingSlider').anythingSlider({
	            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
	            autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
	            delay: 3000,                    // How long between slide transitions in AutoPlay mode
	            startStopped: false,            // If autoPlay is on, this can force it to start stopped
	            animationTime: 600,             // How long the slide transition takes
	            hashTags: false,                 // Should links change the hashtag in the URL?
	            buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
	        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
	        		startText: "Go",                // Start text
			        stopText: "Stop",               // Stop text
			        navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
	        });

	        $("#slide-jump").click(function(){
	            $('.anythingSlider').anythingSlider(6);
	        });

	    });	
	}
    
	
	$("a[href^=/images/gallery]").append('<span></span>');
	
	$("a[href^=/images/gallery]").fancybox({
			'transitionIn': 'elastic',
			'transitionOut': 'elastic',
			'speedIn': 1000, 
			'speedOut': 200 
			//'overlayShow': false
	});
	$("a[href^=/images/equipment]").fancybox({
			'transitionIn': 'elastic',
			'transitionOut': 'elastic',
			'speedIn': 1000, 
			'speedOut': 200 
			//'overlayShow': false
	});
	
	$('a[title^=Gallery]').attr('rel', 'gallery');
	
	$("a[rel=gallery]").fancybox({
			'transitionIn': 'none',
			'transitionOut': 'none',
			'titlePosition': 'over',
			'overlayOpacity': '.8',
			'overlayColor': '#000',
			'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
			    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' &mdash; ' + title + '</span>';
			}
	});
	
	$(".video").fancybox({
			'width'				: 680,
			'height'			: 416,
			'autoScale' 		: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe'
	});
	
	$("a[href^=/video/]").fancybox({
			'width'				: 680,
			'height'			: 416,
			'autoScale' 		: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe'
	});

});
