window.onload = choosePic;

var adImages = new Array("Images/new1.png","Images/new2.png","Images/new3.png","Images/new4.png");
var thisAd = 0;

function choosePic() {
	thisAd = Math.floor((Math.random() * adImages.length));
	document.getElementById("newad").src = adImages[thisAd];
	
	rotate();
}

function rotate() {
	thisAd++;
	if (thisAd == adImages.length) {
		thisAd = 0;
	}
	document.getElementById("newad").src = adImages[thisAd];

	setTimeout(rotate, 2 * 200);
}
