// Random Image JavaScript Document

var picImages = new Array("images/homepic01.jpg", "images/homepic02.jpg", "images/homepic03.jpg", "images/homepic04.jpg", "images/homepic05.jpg", "images/homepic06.jpg", "images/homepic07.jpg", "images/homepic08.jpg", "images/homepic09.jpg", "images/homepic10.jpg", "images/homepic11.jpg", "images/homepic12.jpg", "images/homepic13.jpg", "images/homepic14.jpg", "images/homepic15.jpg", "images/homepic16.jpg", "images/homepic17.jpg", "images/homepic18.jpg", "images/homepic19.jpg", "images/homepic20.jpg", "images/candyshelley.jpg", "images/daughter3.jpg", "images/epicgpt3.jpg", "images/mr80a.jpg", "images/parrotsposter.jpg", "images/workingstiffspub.jpg", "images/macandladymac1.jpg");
var thisPic = 0;

function choosePic() {
	thisPic = Math.floor((Math.random() * picImages.length));
	document.getElementById("myPicture").src = picImages[thisPic];
	
	rotate();
}

function rotate() {
	thisPic++;
	if (thisPic == picImages.length) {
		thisPic = 0;
	}
	document.getElementById("myPicture").src = picImages[thisPic];
	
	setTimeout(rotate, 3 * 1000);
}