function emptyQueue(skope) {
	var queue = Effect.Queues.get(skope);
	queue.each(function(effect) { effect.cancel(); });
}
function advanceRotation(r, move) {
	//emptyQueue(r);
	var skope = $(r).id
	
	var cs = $(r).select('.rotation-cell')
	cs.each( function(c) {		
		if (c.getStyle('display') == "block") {
			var moveTo = cs.indexOf(c) + move;
			if (moveTo >= cs.size()) moveTo = 0
			if (moveTo < 0) moveTo = cs.size() - 1
			Effect.Fade(c, {duration: 0.2, queue: {position: 'end', scope: skope}})
			Effect.Appear(cs[moveTo], {duration: .2, queue: {position: 'end', scope: skope}})			
		}
	});
}

function manuallyAdvanceRotation(r, move) {
	emptyQueue(r);
	var skope = $(r).id
	
	var cs = $(r).select('.rotation-cell')
	cs.each( function(c) {		
		if (c.getStyle('display') == "block") {
			var moveTo = cs.indexOf(c) + move;
			if (moveTo >= cs.size()) moveTo = 0
			if (moveTo < 0) moveTo = cs.size() - 1
			Effect.Fade(c, {duration: .2, queue: {position: 'end', scope: skope}})
			Effect.Appear(cs[moveTo], {duration: .2, queue: {position: 'end', scope: skope}})
			new Effect.Opacity(cs[moveTo], {from: 1.0, to: 1.0, duration: 15.2, queue: {position: 'end', scope: skope} });
		}
	});
}

function fireRotation(){
	var pause = 200;
	var thisObj = this;
	// turn this into a loop for an array:
	setTimeout(function() { thisObj.advanceRotation($$('.rotator')[0].id, 1); }, pause);
	setTimeout(function() { thisObj.advanceRotation($$('.rotator')[1].id, 1); }, pause * 2);
	setTimeout(function() { thisObj.advanceRotation($$('.rotator')[2].id, 1); }, pause * 3);
	setTimeout(function() { thisObj.advanceRotation($$('.rotator')[3].id, 1); }, pause * 4);
	setTimeout(function() { thisObj.advanceRotation($$('.rotator')[4].id, 1); }, pause * 4);
	setTimeout(function() { thisObj.advanceRotation($$('.rotator')[5].id, 1); }, pause * 4);
}

function startFiring(){
	var thisObj = this;
	thisObj.fireRotation();
	setInterval(function() { thisObj.fireRotation()}, 25000);
}

Event.observe(window, 'load', function() {

	setTimeout("startFiring()", 25000);

});