// JavaScript Document

function imageControllorClass()
{
	
	var currentImage = null;
	var currentImageID = null;
	
	this.createImageObject = function(imageID)
	{	
		var imageName = imageID;
		imageName = new Image();
		imageName.src = "images/buttons/" + imageID + ".gif";
		return imageName;
		
	}

	this.imageOn = function(imgName)
	{
		if (document.all) 
		{
			currentImage = document.all[imgName].src.substr(document.all[imgName].src.lastIndexOf("/"));
			//if (isAlreadyOn(imgName)){return false;}
			document.all[imgName].src = eval(imgName + "_on.src");
		} else if (document.getElementById) {
			currentImage = document.getElementById(imgName).src.substr(document.getElementById(imgName).src.lastIndexOf("/"));
			//if (isAlreadyOn(imgName)){return false;}
			document.getElementById(imgName).src = eval(imgName + "_on.src");
		}
	}
	
	this.imageOff = function(imgName)
	{
		if (document.all) 
		{
			//if (isAlreadyOn(imgName)){return false;}
			document.all[imgName].src = eval(imgName + "_off.src");
		} else if (document.getElementById) {
			//if (isAlreadyOn(imgName)){return false;}
			document.getElementById(imgName).src = eval(imgName + "_off.src");
		}
	}
	
	this.isAlreadyOn = function(aValue)
	{
		var stringB = eval(imgName + "_on.src").substr(eval(imgName + "_on.src").lastIndexOf("/"));
	 	return (stringB == currentImage);
	}
	
	this.setCurrentImage = function(id)
	{
		if (document.all) 
		{
			currentImage = document.all[id].src.substr(document.all[id].src.lastIndexOf("/"));
			currentImageID = id;
		} else if (document.getElementById) {
			var newID = document.getElementById(id);
			currentImage = newID.src.substr(newID.src.lastIndexOf("/"));
			currentImageID = id;
		}
	}
			
	this.isCurrentImageSelected = function(id)
	{
		if (document.all) 
		{
			return currentImage == document.all[id].src.substr(document.all[id].src.lastIndexOf("/"));
		} else if (document.getElementById) {
			var newID = document.getElementById(id);
			return currentImage == newID.src.substr(newID.src.lastIndexOf("/"));
		}
	}
	
	this.displayInStatusBar = function(aMessage){window.status = aMessage;}
}