window.onload = initBannerLink;

var thisAd = 0;

function initBannerLink() {
	if (document.getElementById("adBanner").parentNode.tagName == "A") {
		document.getElementById("adBanner").parentNode.onclick = newLocation;
	}
	rotate();
}

/* =============================================
DO NOT CHANGE ANYTHING ABOVE THIS LINE**********
To change banners simply add or subtract 
from the arrays listed below (example: adURL[0])
(0 is the first digit not 1)
============================================= */

function newLocation() {
	var adURL = new Array()
	adURL[0] = 'jesterscourttattoos.com/tattoo-artists/sean/sean.htm'
	adURL[1] = 'jesterscourttattoos.com/tattoo-artists/sean/sean.htm'
	adURL[2] = 'steelcityderbydemons.com'
	adURL[3] = 'jesterscourttattoos.com/tattoo-artists/shannon/shannon.htm'
	adURL[4] = 'hotrodpiercingcompany.com'
	adURL[5] = 'jesterscourttattoos.com/tattoo-artists/michael/michael.htm'
	adURL[6] = 'toonbrian.com'
	adURL[7] = 'jesterscourttattoos.com/tattoo-artists/caktis/caktis.htm'
	adURL[8] = 'jesterscourttattoos.com/tattoo-artists/greg/greg.htm'
	adURL[9] = 'jesterscourttattoos.com'
	if (thisAd == 2 || thisAd == 4 || thisAd == 6) {
	var newWindow=window.open();
	newWindow.document.location.href = "http://www." + adURL[thisAd];
	} else {
	document.location.href = "http://www." + adURL[thisAd];
	}
	
	return false;
}

function rotate() {
	var adImages = new Array()
	adImages[0] = '../images/Jesters-Court-Headline-1.jpg'
	adImages[1] = '../images/Jesters-Court-Headline-2.jpg'
	adImages[2] = '../images/Jesters-Court-Ad-1.jpg'
	adImages[3] = '../images/Jesters-Court-Headline-3.jpg'
	adImages[4] = '../images/Jesters-Court-Ad-2.jpg'
	adImages[5] = '../images/Jesters-Court-Headline-4.jpg'
	adImages[6] = '../images/Jesters-Court-Ad-3.jpg'
	adImages[7] = '../images/Jesters-Court-Headline-5.jpg'
	adImages[8] = '../images/Jesters-Court-Headline-6.jpg'
	adImages[9] = '../images/Jesters-Court-Headline-7.jpg'

/* =============================================
DO NOT CHANGE ANYTHING BELOW THIS LINE**********
============================================= */

	thisAd++;
	if (thisAd == adImages.length) {
		thisAd = 0;
	}
	
	document.getElementById("adBanner").src = adImages[thisAd];
	setTimeout(rotate, 4 * 1000);
}
