// imgId -> color set used
// ex: if imgId is 1, files used are expand1.gif, curve1_mo.gif, ...
//	   if imgId is 2, files used are expand2.gif, curve2_mo.gif, ...

var current_id = '';	// current block opened

// this function is usefull when you want to close previous opened block after selecting a new one
// arguments: id, imgId of currently selected block and if the window position is reset to the the top
function closeContent(id, imgId, resetPosition)
{
	// if a block was previously selectd and it is not the current
	if (current_id != "" && current_id != id)
	{
		var oContent = MM_findObj(id + "-content");

		var oContentCurrent = MM_findObj(current_id + "-content");
		var oSetaCurrent = MM_findObj(current_id + "-seta");

		if (oContent.style.display == "")	// if seleted block is visible
		{
			oContentCurrent.style.display = "none";
			oSetaCurrent.src = "/javascript/images/expand" + imgId + ".gif";

			if (resetPosition)	// reset window position
			{
				self.scrollTo(0,0);
			}
		}
	}
}

// close or open content of selected block
// arguments: id, imgId of selected block
//			  wheter previous is closed and if the window position is reset to the the top
function showHideContent(id, imgId, closePrevious, resetPosition)
{
	var oContent = MM_findObj(id + "-content");
	var oSeta = MM_findObj(id + "-seta");
	var showStatus;

	if (oContent.style.display == "none")
	{
		oContent.style.display = "";
		oSeta.src = "/javascript/images/collapse" +  imgId + "_mo.gif";
		showStatus = true;
	}
	else
	{
		oContent.style.display = "none";
		oSeta.src = "/javascript/images/expand" + imgId + "_mo.gif";
		showStatus = false;
	}

	if (closePrevious)
	{
		closeContent(id, imgId, resetPosition);
	}

	current_id = id;
	return showStatus;
}

// changes the look of the block during a mouse event
function setBorder(id, imgId, isMouseOver, className)
{
	var oContent = MM_findObj(id + "-content");
	var oTopo = MM_findObj(id + "-topo");
	var oEsq = MM_findObj(id + "-esq");
	var oSeta = MM_findObj(id + "-seta");

	// if a specific class name is passed, uses it, otherwise, uses the object id to build the class name to use
	className = (arguments.length == 4 ? className : id)

	if (oContent.style.display != "none")	// fixes NS6 display bug (only sets class if content area is visible)
	{
		oContent.className = className + "-content" + (isMouseOver ? "-mo" : "");
	}

	if (oTopo)
	{
		oTopo.className = className + "-topo" + (isMouseOver ? "-mo" : "");
	}

	if (oEsq)
	{
		oEsq.src = "/javascript/images/curve" + imgId + (isMouseOver ? "_mo" : "") + ".gif";
	}

	oSeta.src = "/javascript/images/" + (oContent.style.display == "none" ? "expand" : "collapse") + imgId + (isMouseOver ? "_mo" : "") + ".gif";
}