var imgPlus = new Image();		imgPlus.src = 		"../images/plus.gif";
var imgMinus = new Image();		imgMinus.src = 		"../images/minus.gif";
var imgArrow = new Image();		imgArrow.src = 		"../images/arrow.png";


function expandCollapseAll(direction)
{
	var allDivs = document.getElementsByTagName("div");
	for (var i=0; i<allDivs.length; i++)
	{
		if (allDivs[i].className != null && allDivs[i].className.indexOf("expanderBlock") != -1)
			expandCollapse(allDivs[i], direction);
	}
}

function expandCollapse(expanderNode, direction)
{
	if (expanderNode.className == null || expanderNode.className.indexOf("expanderBlock") == -1)
		return;

	var imgNodes = expanderNode.getElementsByTagName("img");
	if (imgNodes.length == 0)
		return;
	var imgExpander = imgNodes[0];

	if (direction == -1 || (direction == 0 && imgExpander.src.indexOf("minus") >= 0))
	{
		imgExpander.src = imgExpander.src.replace("minus", "plus");
		for (var i=0; i<expanderNode.childNodes.length; i++)
		{
			if (expanderNode.childNodes[i].className == null
				||	expanderNode.childNodes[i].className.indexOf("expanderTitle") == -1)
			{
				if (expanderNode.childNodes[i].style)
					expanderNode.childNodes[i].style.display = "none";
			}
		}
	}
	else if (direction == 1 || (direction == 0 && imgExpander.src.indexOf("plus") >= 0))
	{
		imgExpander.src = imgExpander.src.replace("plus", "minus");
		for (var i=0; i<expanderNode.childNodes.length; i++)
		{
			if (expanderNode.childNodes[i].className == null
				||	expanderNode.childNodes[i].className.indexOf("expanderTitle") == -1)
			{
				if (expanderNode.childNodes[i].style)
					expanderNode.childNodes[i].style.display = "block";
			}
		}
	}
}

function renderExpandCollapseAllControl()
{
	document.write('<span class="expandContract">[ <a href="javascript:" onclick="javascript:expandCollapseAll(-1); return false;">collapse all</a> | <a href="javascript:" onclick="javascript:expandCollapseAll(1); return false;">expand all</a> ]</span>');
}
