var $banners = null;
var bannerShown = -1;
var rotateBannerTimeout = null;
$(document).ready(function()
{
	$banners = $("DIV.bannerItem");
	$banners.bind("mouseenter", function()
	{
		disableRotation();
	});
	$banners.bind("mouseleave", function()
	{
		enableRotation();
	});
	showNextBanner();
	enableRotation();
});
function enableRotation()
{
	if(rotateBannerTimeout == null)
	{
		rotateBannerTimeout = window.setInterval("showNextBanner()", 5000);
	}
}
function disableRotation()
{
	if(rotateBannerTimeout != null)
	{
		window.clearInterval(rotateBannerTimeout);
	}
	rotateBannerTimeout = null;
}
function showNextBanner()
{
	showBanner((++bannerShown) % $banners.length);
}
function showBanner(banner)
{
	if(banner < 0){ return; }
	if(banner >= $banners.length){ return; }
	$banners.hide();
	$($banners.get(banner)).show();
	bannerShown = banner;
}