var switch_on = true; /* set to false if you do not wish to display javascript slideshow */
var images = new Array('slideshow/img1.jpg' , 'slideshow/img2.jpg', 'slideshow/img3.jpg'); /* set images (417 : 621 px) */
var fade_speed = 1000; /* how fast the image will fade out and fade in */
var fade_delay = 2000; /* delay between image changes */



var current_img;

function ImageSlideshow(){
	if(switch_on == true){
		current_img = getRandomInt(0 , images.length-1);
		$('#slideshow_container').css('background' , 'white');
		html = '';
		for(var i in images){
         html += '<img src="'+images[i]+'" val="'+i+'" style="position:absolute;display:none;" id="images_slideshow_image_'+i+'">';
		}
		$('#slideshow_container').html(html);
      $('#images_slideshow_image_'+current_img).fadeIn(fade_speed);
	  	setTimeout("GoOnSlider()", fade_delay+fade_speed);
	}
}

function GoOnSlider(){
	next_img = current_img + 1;
	if(next_img >= images.length){ next_img = 0; }
	$('#images_slideshow_image_'+current_img).fadeOut(fade_speed);
   $('#images_slideshow_image_'+next_img).fadeIn(fade_speed);
	current_img = next_img;
	setTimeout(function(){ GoOnSlider(); }, fade_delay+fade_speed);
}

function getRandomInt(min, max){
  return Math.floor(Math.random() * (max - min + 1)) + min;
}
