/**************************************************************************************/		   
/**** BEGIN  SlideShow Function on the application-easyclean10.php webpage ****/
/**************************************************************************************/
var imgs2 = [
	'images-slideshow/HG091510_0241.jpg', 
	'images-slideshow/HG091510_0203.jpg', 
	'images-slideshow/HG091510_0234.jpg',
	'images-slideshow/HG091510_0164.jpg',
	'images-slideshow/HG091510_0187.jpg'];

function preload(arrayOfImages) {
    $(arrayOfImages).each(function(){
		$('<img/>')[0].src = this;
    });
}

// Usage:
preload(imgs2);
/*preload([
	'images-slideshow-hardware/HG091510_0159.jpg',
	'images-slideshow-hardware/HG091510_0171.jpg',
	'images-slideshow-hardware/HG091510_0209.jpg',
	'images-slideshow-hardware/HG091510_0162.jpg',
	'images-slideshow-hardware/HG091510_0203.jpg',
	'images-slideshow-hardware/HG091510_0176.jpg'
]);*/
var imgs = imgs2;

$(function() {
	
		/* timerSpeed variable sets slideshow speed */
		var timerSpeed = 15000;
		var cnt = imgs.length;
		var $imageSlide = $('img[id$=imageSlide]');
		
		// set the image control to the last image
		$imageSlide.attr('src', imgs[cnt-1]);
		
		var Timer = setInterval(Slider, timerSpeed);
		function Slider() {
			$imageSlide.fadeOut("fast", function() {
				 $(this).attr('src', imgs[(imgs.length++) % cnt]).fadeIn("fast");
			});
		}

/**************************************************************************************/		   
/**** Begin  Pause/pLAY Slideshow ICON Function on the application-easyclean10.php webpage   ****/
/**************************************************************************************/

		$(".pauseBtn").toggle(function() {
		     	clearInterval(Timer);
		     	$(".pauseBtn").css({'background-image':'url(images/play-btn_over.png)'});
		      	this.title = "Play";
			
			//// Sets Hover Function for the "Play" button
			$(".pauseBtn").hover(function() {
				$(this).css({'background-color': '#FFDC89'});
				$(this).css({'background-image':'url(images/play-btn_over.png)'});	
			}, function() {
				$(this).css({'background-color': '#FDBE57'});
				$(this).css({'background-image':'url(images/play-btn.png)'});
			});
		},
		function() {
		   	Timer = setInterval(Slider, timerSpeed);
			$(".pauseBtn").css({'background-image':'url(images/pause-btn.png)'});
		     	this.title = "Pause";
			
			//// Sets Hover Function for the "Pause" button
			$(".pauseBtn").hover(function() {
				$(this).css({'background-color': '#FFDC89'});
				$(this).css({'background-image':'url(images/pause-btn_over.png)'});	
			}, function() {
				$(this).css({'background-color': '#FDBE57'});
				$(this).css({'background-image':'url(images/pause-btn.png)'});
			});
		});
		
		$(".nextBtn").click(function() {
				clearInterval(Timer);
				this.title = "Next Slide";
		    	$imageSlide.fadeOut("fast", function() {
				$(this).attr('src', imgs[(imgs.length++) % cnt]).fadeIn("fast");
			});		      
		});

/**************************************************************************************/		   
/**** END  Pause Slideshow ICON Function on the application-easyclean10.php webpage   ****/
/**************************************************************************************/

	 ////Sets Hover Function for the "Pause" button
	$(".pauseBtn").hover(function() {
		$(this).css({'background-color': '#FFDC89'});
		$(this).css({'background-image':'url(images/pause-btn_over.png)'});	
	}, function() {
		$(this).css({'background-color': '#FDBE57'});
		$(this).css({'background-image':'url(images/pause-btn.png)'});
	});

//// Sets Hover Function for the "Next" button
	$(".nextBtn").hover(function() {
		$(this).css({'background-color': '#FFDC89'});
		$(this).css({'background-image':'url(images/next-btn_over.png)'});	
	}, function() {
		$(this).css({'background-color': '#FDBE57'});
		$(this).css({'background-image':'url(images/next-btn.png)'});
	});

});


/*********************************************************************************/		   
/**** END  SlideShow Window Function on the application-easyclean10.php webpage ******/
/*********************************************************************************/

