window.onload = choosePic;

var adImages = new Array("showpics/18.JPG","showpics/1.JPG","showpics/23.jpg","showpics/27.jpg","showpics/3.JPG","showpics/4.JPG","showpics/6.JPG",
						 "showpics/8.JPG","showpics/9.JPG","showpics/2.JPG","showpics/26.jpg","showpics/10.JPG","showpics/21.JPG","showpics/11.JPG","showpics/7.JPG","showpics/13.jpg",
						 "showpics/14.JPG","showpics/24.jpg","showpics/16.JPG","showpics/28.JPG","showpics/30.JPG","showpics/17.JPG",
						 "showpics/20.JPG","showpics/25.jpg","showpics/12.JPG",
						 "showpics/15.JPG","showpics/29.JPG","showpics/5.JPG","showpics/19.JPG");
var thisAd = 0;

function choosePic() {
	thisAd = Math.floor((Math.random() * adImages.length));
	document.getElementById("slideShow").src = adImages[thisAd];
	
	rotate();
}

function rotate() {
	thisAd++;
	if (thisAd == adImages.length) {
		thisAd = 0;
	}
	document.getElementById("slideShow").src = adImages[thisAd];
	
	setTimeout(rotate, 3 * 1000);
}