function cStart() {
	with (this) {
		if (document.images && timerId == null) {turn();}
	}
}


function cStop() {
	with (this) {
		if (document.images && timerId) {
			clearTimeout(timeId);
			timerId = null;
		}
	}
}


function cTurn() {
	with (this) {
		if (document.images) {
			frame = ++frame % imagi.length;
			document.images[imageName].src = imagi[frame].src;
			timerId = setTimeout(name + ".turn()", speed);
			if (isActive) {mouseOver();}
		}
	}
}


function cMouseOver() {
	with (this) {
		if (document.images) {top.status = statuss[frame];}
		isActive = true;
	}
}


function cMouseOut() {
	with (this) {
		if (document.images) {top.status = "";}
		isActive = false;
	}
}


function cClick() {
	with (this) {
		if (document.images) {self.location.href = anchors[frame];}
	}
}


function Carousel(name, imageSrcs, anchors, statuss, width, height, speed) {
	this.name = name;
	this.imagi = new Array(imageSrcs.length);
	this.anchors = anchors;
	this.statuss = statuss;
	this.width = width;
	this.height = height;
	this.speed = speed;
	
	this.frame = imageSrcs.length;
	this.timerId = null;
	this.isActive = false;
	
	this.start = cStart;
	this.stop = cStop;
	this.turn = cTurn;
	this.mouseOver = cMouseOver;
	this.mouseOut = cMouseOut;
	this.click = cClick;
	
	this.imageName = name + "Image";

	with (this) {
		if (document.images) {	
			for(i = 0; i < imagi.length; i++) {
				imagi[i] = new Image(width, height);
				imagi[i].src = imageSrcs[i];
			}
		}
	}
}