// how many seconds an ad will be shown
showAd = 30;

// declare and initilize image array
imgAdArray = new Array ("http://www.kindergoth.com/images/ads/468x60-KG-panels-ad.gif", "http://www.kindergoth.com/images/ads/468x60-KG-panels-ad.gif");

// declare and initilize url array
urlAdArray = new Array ("http://www.kindergoth.com", "http://www.kindergoth.com");

// set the number of the ad that is visible right now
var adVisible = 0;
						
// calculate the average duration time in miliseconds for each ad
durationPerAd = (Math.round (showAd)) * 1000;

// functions that is updating the ad
function updateAdImage ()
{
	// if ad that will be shown next in the range of the array?
	if ( adVisible == imgAdArray.length - 1 )
	{
		// no, set it to the beginning of the array range
		adVisible = 0;
	}
	else
	{
		// yes, increase the ad number by one
		adVisible++;
	}
	// rotate the add
	document.images["rotator"].src = imgAdArray[adVisible];
	// set the timer for the next call
	setTimeout ( 'updateAdImage();', durationPerAd );
}

// function that is jumping to the clicked ad's url
function rotatorJump ()
{
	window.open (urlAdArray[adVisible]);
}

// start the rotation
setTimeout ( 'updateAdImage();', durationPerAd );
// write out the link and img of the ad rotator
document.write ('<a href="javascript:rotatorJump();" name="rotatorlink"><img src="' +imgAdArray[adVisible]+ '" name="rotator" width="468" height="60" border="0" alt="Ad Rotation"></a>');		
