document.observe("dom:loaded", function() {
  nextImage();
});
var imageQty = 4;
var current = Math.floor(Math.random()*imageQty) + 1;
var t=setTimeout("nextImage()",6000);
function nextImage() {
	clearTimeout(t);
	current++;
	if(current == (imageQty+1)) {
		current = 1;
	}
	showImage();
	t=setTimeout("nextImage()",6000);
}
function showImage() {
	for(i = 1; i <= imageQty; i++) {
		if(i == current) {
			$(i + '-green').hide();
			$(i + '-red').show();
			$('banner_' + i).show();
		} else {
			$(i + '-green').show();
			$(i + '-red').hide();
			$('banner_' + i).hide();
		}
	}
}
function swap(i) {
	current = i;
	showImage();
}