var images = Array(); var imageIndex = 0; images[images.length] = "images/home/00000002.jpg"; images[images.length] = "images/home/DSCN0009.jpg"; images[images.length] = "images/home/DSCN0252.jpg"; images[images.length] = "images/home/DSCN9807.jpg"; images[images.length] = "images/home/DSCN9948.jpg"; images[images.length] = "images/home/ENGLE-AFTER-018.jpg"; function slideshow_next() { // next image $("#slideshow-image img").fadeTo(900, .01, function() { imageIndex++; if (imageIndex > images.length - 1) { imageIndex = 0; } $(this).attr('src', images[imageIndex]); a = setTimeout('slideshow_next()', 3000); }); } $(document).ready( function() { // insert first image $('#slideshow-image').append(''); $("#slideshow-image img").bind("load", function() { $(this).fadeTo(900, 1); }); setTimeout('slideshow_next()', 4000); });