//
// REQUIRES - Library Base Functions (library.js)
//

function ImageCache()
{
	this.classType = "Isometriq Image Cache";
	this.toString  = function() { return( this.classType ); }
	this.valueOf   = function() { return( this           ); }
	
	this.Images = new Object();
}

ImageCache.method( "Register", function( src, id )
{
	if (id == null)
		id = src;
	
	image = new Image();
	image.src = src;
	this.Images[id] = image;
});

ImageCache.method( "GetImage", function( id, returnobj )
{
	if (image = this.Images[id])
		return returnobj ? image : image.src;
	else
		return "";
});

ImageCache.method( "ShowImage", function( id, target )
{
	if ((typeof target) == "string")
		target = window.document.images[target];
	
	if ((target == null) || (this.Images[id] == null))
		return;
	
	target.src = this.Images[id].src;
});

ImageCache = new ImageCache();