
function RolloverManager(imgDataSequence, defaultMenuID) {
	this.imgDataSequence = imgDataSequence;
	this.defaultMenuID = defaultMenuID;
	this.timerID = null;
	
	// Functions
	
	this.getImageMetaData = function(image) {
		var metaData = null;
		if(imgDataSequence) {
			for(var i = 0; i < imgDataSequence.length; i++) {
				if(imgDataSequence[i].id == image.id) {
					metaData = imgDataSequence[i];
					break;
				}
			}
		} else {
			alert('No imgDataSequence in RolloverManager');
		}
		return metaData;
	}
	
	this.showRolloverByID = function(id) {
		var image = document.getElementById(id);
		this.showRollover(image);
	}
	
	this.hideRolloverByID = function(id) {
		var image = document.getElementById(id);
		this.hideRollover(image);
	}
	
	this.showRollover = function(image) {
		var metaData = this.getImageMetaData(image);
		if(metaData) {
			image.src = metaData.rolloverSrc;
		} else {
			alert('In showRollover(): metaData not found. image id: '+image.id);
		}
	}
	
	this.hideRollover = function(image) {
		var metaData = this.getImageMetaData(image);
		if(metaData) {
			image.src = metaData.imageSrc;
		} else {
			alert('In hideRollover(): metaData not found. image id: '+image.id);
		}
	}
	
	this.showMenuRollover = function(image) {
		if(this.timerID) {
			clearTimeout(this.timerID);
		}
		
		this.showRollover(image);
		
		if(this.defaultMenuID && image.id != this.defaultMenuID) {
			var defaultMenuImage = document.getElementById(this.defaultMenuID);
			this.hideRollover(defaultMenuImage);
		}
	}
	
	this.hideMenuRollover = function(image) {
		if(image.id != this.defaultMenuID) {
			this.hideRollover(image);
			// Delay the display of the rollover for the current page by 250 milliseconds
			// to help keep the flicker away when moving between menu items.
			if(this.defaultMenuID) {
				this.timerID = setTimeout('rolloverManager.showRolloverByID("' + this.defaultMenuID + '")', 250);
			}
		}
	}
	
	this.showMenuRolloverByID = function(id) {
		var image = document.getElementById(id);
		this.showMenuRollover(image);
	}
	
	this.hideMenuRolloverByID = function(id) {
		var image = document.getElementById(id);
		this.hideMenuRollover(image);
	}
}




