$(document).ready(function () {
		// Set arrays for images, new images and image names go here. THE ORDER MATTERS
        var img = new Array()
			img[0] = 'images/slideshow/1.jpg'
			img[1] = 'images/slideshow/2.jpg' 
			img[2] = 'images/slideshow/3.jpg';
		// Set title text arrays.
		var title = new Array()
			title[0] = ''
			title[1] = ''
			title[2] = '';
		
		// Set variables
		var imginterval = 5500;
		var imgfadeout = 650;
		var imgcount = img.length;
		var titlecount = title.length;
		//var rand = Math.floor(Math.random()*(img.length)); // For random picture load
		imgcount++;
		titlecount++;
		
		
		// Set first picture/title for page load (Set to random starting point)
		/*
		$(function() {
			$("#slideshow").attr('src', img[rand]);
			$("#slideshow").attr('title', title[rand]);
			imgcount += rand;
			titlecount += rand;
		});
		*/
		
		// Starts slideshow on page load
        $(function ShowTimer() {
            Show_Interval = setInterval(Show, imginterval);
        });
		
		// On hover, stop slideshow
		$("#SlideShow").hover(function () {
			clearInterval(Show_Interval);
		}, function () {
			Show_Interval = setInterval(Show, imginterval);
			//Show();
		});
		
		// On click, next image
		$("#SlideShow").click(Show);

		// Cycles through images
        function Show() {
			$('#SlideShow').fadeOut(imgfadeout, function() {
				$(this).attr('src', img[(imgcount++) % img.length]).fadeIn(imgfadeout);
				$(this).attr('title', title[(titlecount++) % title.length]);
		});
		}
		
		
});