// The banner rotation function
function newBanner()
{
	// Check if the banner is present
	if(document.getElementById('banner') != undefined && document.getElementById('banner') != null)
	{
		// Prevent index out of bounds exception
		currentElem = currentElem % banners.length;
		
		// Rewrite the banner attributes
		$('banner').writeAttribute({
			'src'  : banners[currentElem].img,
			'alt'  : banners[currentElem].text,
			'title': banners[currentElem].text
		});
		
		$('banner_href').writeAttribute({
			'href': banners[currentElem].href,
			'target': banners[currentElem].target
		});
		
		// Increment the current element and make sure our function will be called again
		currentElem++;
		setTimeout('newBanner();', bannerDuration);
	}
}
