/*
Calls the Slidesjs plugin and handles custom fade in/out of the prev/next arrows on mouse-over.
*/

 $(document).ready(function(){
 	// Set starting slide to 1
		var startSlide = 1;
		// Get slide number if it exists
		if (window.location.hash) {
			startSlide = window.location.hash.replace('#', '');
		}
		// Initialize Slides
		$('#slides').slides({
			preload: true,
			preloadImage: 'img/loading.gif',
			generatePagination: true,
			play: 6000,
			pause: 2500,
			hoverPause: true,
			// Get the starting slide
			start: startSlide,
			animationComplete: function(current){
				// Set the slide number as a hash
				window.location.hash = '#' + current;
			}

		});

			$(".prev, .next").fadeTo("fast", 0);
			
			$(".prev, .next").hover(function(){
				$(this).fadeTo("fast", 0.6);
			}, function(){
				$(this).fadeTo("fast", 0.3);
			});
			
			$(".prev, .next").mousedown(function(){
				$(this).fadeTo(50, 1);
			});
			$(".prev, .next").mouseup(function(){
				$(this).fadeTo(50, 0.6);
			});
			
			$("#slides").hover(function(){
				$(".prev, .next").fadeTo("slow", 0.3);
			}, function(){
				$(".prev, .next").fadeTo("slow", 0);
});

	});
