/* ------------------------------------------------------------------------
    jQuery Photo Slide Show with Slick Caption
     	
	Website: http://www.queness.com/post/1450/jquery-photo-slide-show-with-slick-caption-tutorial-revisited/
	
	Copyright: The effects and techniques demonstrated in tutorials on Queness can be used in whatever manner you wish without attribution.
	           You cannot copy whole tutorials (unless permission is given), either in English or translated to another language.

			   
	Code altered by Chris Stuckey - Line 18: Removed <h3></h3> before <p></p> / Line 31: .7 to .9 / Line 65: 300 to 600 / Line 68: 500 to 1000 / Added line 68 commented out 66,67 
	  		   
------------------------------------------------------------------------- */

function slideShow(speed) {

	//append a LI item to the UL list for displaying caption
	$('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><p></p></div></li>');

	//Set the opacity of all images to 0
	$('ul.slideshow li').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	//$('#slideshow-caption h3').html($('ul.slideshow a:first').find('img').attr('title'));
	$('#slideshow-caption p').html($('ul.slideshow a:first').find('img').attr('alt'));
		
	//Display the caption
	$('#slideshow-caption').css({opacity: .9, bottom:0});
	
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery()',speed);
	
	//pause the slideshow on mouse over
	$('ul.slideshow').hover(
		function () {
			clearInterval(timer);	
		}, 	
		function () {
			timer = setInterval('gallery()',speed);			
		}
	);
	
}

function gallery() {

	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));
		
	//Get next image caption
	var title = next.find('img').attr('title');	
	var desc = next.find('img').attr('alt');	

	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	
	//Hide the caption first, and then set and display the caption
	$('#slideshow-caption').slideToggle(1500, function () { 
		//$('#slideshow-caption h3').html(title); 
		//$('#slideshow-caption p').html(desc); 
		$('#slideshow-caption p').html(title); 
		$('#slideshow-caption').slideToggle(1500); 
	});		

	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show');

}

function slideShow468a(speed) {

	//append a LI item to the UL list for displaying caption
	$('ul.slideshow468a').append('<li id="slideshow-caption468a" class="caption468a"><div class="slideshow-caption-container468a"><p></p></div></li>');

	//Set the opacity of all images to 0
	$('ul.slideshow468a li').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow468a li:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	//$('#slideshow-caption468a h3').html($('ul.slideshow a:first').find('img').attr('title'));
	$('#slideshow-caption468a p').html($('ul.slideshow468a a:first').find('img').attr('alt'));
		
	//Display the caption
	$('#slideshow-caption468a').css({opacity: .9, bottom:0});
	
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery468a()',speed);
	
	//pause the slideshow on mouse over
	$('ul.slideshow468a').hover(
		function () {
			clearInterval(timer);	
		}, 	
		function () {
			timer = setInterval('gallery468a()',speed);			
		}
	);
	
}

function gallery468a() {

	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow468a li.show468a')?  $('ul.slideshow468a li.show468a') : $('#ul.slideshow468a li:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption468a')? $('ul.slideshow468a li:first') :current.next()) : $('ul.slideshow468a li:first'));
		
	//Get next image caption
	var title = next.find('img').attr('title');	
	var desc = next.find('img').attr('alt');	

	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show468a').animate({opacity: 1.0}, 1000);
	
	//Hide the caption first, and then set and display the caption
	$('#slideshow-caption468a').slideToggle(1500, function () { 
		//$('#slideshow-caption468a h3').html(title); 
		//$('#slideshow-caption468a p').html(desc); 
		$('#slideshow-caption468a p').html(title); 
		$('#slideshow-caption468a').slideToggle(1500); 
	});		

	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show468a');

}

function slideShow120a(speed) {

	//append a LI item to the UL list for displaying caption
	$('ul.slideshow120a').append('<li id="slideshow-caption120a" class="caption120a"><div class="slideshow-caption-container120a"><p></p></div></li>');

	//Set the opacity of all images to 0
	$('ul.slideshow120a li').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow120a li:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	//$('#slideshow-caption120a h3').html($('ul.slideshow120a a:first').find('img').attr('title'));
	$('#slideshow-caption120a p').html($('ul.slideshow120a a:first').find('img').attr('alt'));
		
	//Display the caption
	$('#slideshow-caption120a').css({opacity: .9, bottom:0});
	
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery120a()',speed);
	
	//pause the slideshow on mouse over
	$('ul.slideshow120a').hover(
		function () {
			clearInterval(timer);	
		}, 	
		function () {
			timer = setInterval('gallery120a()',speed);			
		}
	);
	
}

function gallery120a() {

	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow120a li.show120a')?  $('ul.slideshow120a li.show120a') : $('#ul.slideshow120a li:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption120a')? $('ul.slideshow120a li:first') :current.next()) : $('ul.slideshow120a li:first'));
		
	//Get next image caption
	var title = next.find('img').attr('title');	
	var desc = next.find('img').attr('alt');	

	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show120a').animate({opacity: 1.0}, 1000);
	
	//Hide the caption first, and then set and display the caption
	$('#slideshow-caption120a').slideToggle(1500, function () { 
		//$('#slideshow-caption120a h3').html(title); 
		//$('#slideshow-caption120a p').html(desc); 
		$('#slideshow-caption120a p').html(title); 
		$('#slideshow-caption120a').slideToggle(1500); 
	});		

	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show120a');

}

