// JavaScript Document
function imageSlideshow(){
	//jQuery dot click function!!!!!!!//
			$('#dots li a').click(function(){
			$(this).addClass('Selected');
			$('#dots li a').not(this).removeClass('Selected');
			$('#dots li a.Selected div').removeClass('dotdefault').addClass('dotactive');
			$('#dots li a div').not('#dots li a.Selected div').removeClass('dotactive').addClass('dotdefault');
			
			var getRel = $('#dots li a.Selected').attr("rel") -1;
			$('#counter').html(getRel);
			var normalRel = $('#dots li a.Selected').attr("rel");
			var clickSrc = "images/picture"+normalRel+".png";
			var currentClickSrc = $('.infront img').attr("src");
			$('.behind img').attr("src", currentClickSrc);
			$('.infront img').attr("src", clickSrc);
			$('.infront').fadeIn(100);
			return false;
			});
	//End of jQuery dot click function!!!!!!!!!!!!!//
			
	var photosInShow = "5";
	var currentPhoto = $('#counter').html();
	currentPhoto = parseInt(currentPhoto);
	
	if(currentPhoto == photosInShow){
		var nextPhoto = 1;
		} 
		else{
			var nextPhoto = currentPhoto + 1;
			};
			
			
		var currentSrc = $('.infront img').attr("src");
		var nextSrc = "images/picture"+nextPhoto+".png";
		
	$('.behind img').attr("src", currentSrc);
	$('.infront').css("display" , "none");
	
	$('.infront img').attr("src", nextSrc);
	$('.infront').fadeIn(800);
	
	$('#counter').html( nextPhoto );
	//!!IMPORTANT!!//
	//Down intill end describes the dot jQuery rules!!!!!!!!!!!//
	var currentNum = $('#counter').html();
		currentNum = parseInt( currentNum );
		$("div[id*="+currentNum+"]").removeClass('dotdefault').addClass('dotactive');
		$('li a div').not("div[id*="+currentNum+"]").removeClass('dotactive').addClass('dotdefault');
		

	
	setTimeout("imageSlideshow()", 4000);

		};
