var elements = new Array();

//Creates a plusMinusObject, wrapping around an HTML element, with the initial state being "closed."
function plusMinusObject(id)
{
	this.id = id;
	this.state = "closed";
}


//This method searches through already-processed-elements and picks a match. If no match is found, a new plusMinusObject is created and wrapped around
function showHidePlusMinus(id)
{
	var x;
	for(x = 0; x < elements.length; x ++)
	{
		if(elements[x].id == id)
		{
			break;
		}
	}
	
	if(x == elements.length)
	{
		x = elements.length;
		elements[x] = new plusMinusObject(id);
	}
	
	elements[x].showHidePlusMinus();
}

//This can be called on a plusMinusObject to either open or close it.
plusMinusObject.prototype.showHidePlusMinus = function ()
{
	if(this.state == "closed")
	{
		this.state = "open";
		document.getElementById(this.id).src = '/images/minus.gif';
	}
	else
	{
		this.state = "closed";
		document.getElementById(this.id).src = '/images/plus.gif';
	}
};