// © 1999, Andrew Danylchenko 
// e-mail  : anry@bigfoot.com
// homepage: www.bigfoot.com/~anry

function Item(anID, aTitle) {
	this.ID    = anID;
	this.Title = aTitle || "";
}

function ItemsIterator_findItem(anID) {
	for(i=0; i < this.items.length; i++) {
		if(this.items[i].ID == anID) {
			loadItem(this.items[this.currItem = i]);
			return;
		}
	}
	loadItem(this.items[this.currItem = 0]);
}

function ItemsIterator_nextItem() {
	this.currItem = (this.currItem >= this.items.length - 1) ? 0 : this.currItem + 1;
	loadItem(this.items[this.currItem]);
}

function ItemsIterator_prevItem() {
	this.currItem = (this.currItem <= 0) ? this.items.length -1 : this.currItem - 1;
	loadItem(this.items[this.currItem]);
}

function ItemsIterator(anItemsArray, aLoadItemFunction) {
	this.items    = anItemsArray;
	this.currItem = 0;
	this.loadItem = aLoadItemFunction;

	this.findItem = ItemsIterator_findItem;
	this.nextItem = ItemsIterator_nextItem;
	this.prevItem = ItemsIterator_prevItem;
}

function RollOver_onMouseOut() {
	this.image.src = this.outImage.src;
	this.overFlag = false;
}

function RollOver_onMouseOver() {
	if(this.overFlag)
		return;
	else {
		this.image.src = this.overImage.src;
		this.overFlag = true;		
	}
		
}                              

function RollOver(anImageObject, anOutImage, anOverImage) {
	this.image     = anImageObject;

	this.outImage  = anOutImage;
	this.overImage = anOverImage;

	this.overFlag  = false;

	this.onMouseOut  = RollOver_onMouseOut;
	this.onMouseOver = RollOver_onMouseOver;
}

function cashImage(anImageFileName) {
	image     = new Image();
	image.src = anImageFileName;

	return image;
}