// Document ready
jQuery(document).ready(function($) {
	// Setup the slider on the home page
	$('.anythingSlider').anythingSlider({
			easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
			autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
			startStopped: false,            // If autoPlay is on, this can force it to start stopped
			delay: 3000,                    // How long between slide transitions in AutoPlay mode
			animationTime: 300,             // 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: "Start",             // Start text
			stopText: "Stop",               // Stop text
			navigationFormatter: null       // Details at the top of the file on this use (advanced use)
	});
	
	/*
	 * Fade in / Fade out images
	 */
	function imageSwitch() {
		// Image active
	    var $active = $('#slideshow img.active');
	    
	    // If the active class is missing
	    if ( $active.length == 0 ) {
	    	// Take the last image
	    	$active = $('#slideshow img:last');
	    }
	    
	    // Next image
	    var $next =  $active.next().length ? $active.next()
	        : $('#slideshow img:first');
	    
	    $active.addClass('last-active');
	    
	    // Fade in/out
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate(
	        		{opacity: 1.0},
	        		1000, // Timer
	        		function() {
	        			$active.removeClass('active last-active');
	        		}
	        );
	}
	
	// 1st slide : Start the slideshow of images
    setInterval(
    		imageSwitch,
    		6000 // Timer
    );
});
	
