/*** image rotator ***/

function image_rotator_obj(imageObj, imageRotatorObj) {
	this.delay=10;
	this.currentImageIndex=0;
	this.images=new image_preloader_obj();
	this.image=imageObj;
	this.self=imageRotatorObj;
	this.addImage=image_rotator_addImage;
	this.rotate=image_rotator_rotate;
	this.start=image_rotator_start;
}

function image_rotator_addImage(imageName) {
	this.images.addImage(imageName);
}

function image_rotator_rotate() {
	if(++this.currentImageIndex>this.images.image_array.length-1) {this.currentImageIndex=0;}
	if(this.images.isImageIndexLoaded(this.currentImageIndex)) {
		this.image.src=this.images.image_array[this.currentImageIndex].src;
	}
}

function image_rotator_start() {
	setInterval(this.self + ".rotate();", 1000*this.delay);
}