﻿function imageRotator(imageID, interval)
{
	this.ID			= imageID;
	this.images		= new Array();
	this.interval	= interval;
	this.count		= 0;
	this.current	= 0;
	this.add		= imageRotator_add;
	this.swap		= imageRotator_swap;
	this.go			= imageRotator_go;
}
function imageRotator_add(newImage)
{
	this.images[this.count]	= newImage;
	this.count++;
}

function imageRotator_swap()
{
	this.current = (this.current+1)%this.count;
	document.getElementById(this.ID).src = this.images[this.current];
	window.setTimeout(this.ID + '.swap();',this.interval);
}
function imageRotator_go()
{		
	this.swap();		
}
