/* code for expanding/contacting boxes */

var triOver = "images/"; 
var triUp = "images/";
var triDown = "images/";


// Flip a box between expanded and contracted
// toggleDisplay
function t(groupId, itemId, whichOne)
{
	detail = document.all(groupId + "_d" + itemId);
	button = document.all(groupId + "_b" + itemId);
	
	isExpanded =  ((detail.style.display == "") || (detail.style.display == "none"));
	setExpanded(detail, button, isExpanded, whichOne);

	return false;
}

function setExpanded(detail, button, isExpanded, whichOne)
{
	if (isExpanded) {
		detail.style.display = "block";
		button.src = triDown + "arrow_V_" + whichOne + ".gif";
		
	} else {
		detail.style.display = "none";
		button.src = triUp + "arrow_H_" + whichOne + ".gif";
	}
}

// Expand/contract all the boxes in the group
function toggleAll(groupId)
{
	
	var row;
	var i = 0;
	var expand;
	
	/*
	if( document.all(groupId + "_e").AllExpand == null )
		expand = true;
	else
		expand = ! document.all(groupId + "_e").AllExpand;
	*/
	
	while(true)
	{
		detail = document.all(groupId + "_d" + i);
		button = document.all(groupId + "_b" + i);
		
		if (detail == null) {
			break;
		}
		
		setExpanded(detail, button, expand);
		i++;
	}
	
	/*
	document.all(groupId + "_e").innerText = (expand == true ? "Contract all" : "Expand all");
	document.all(groupId + "_e").AllExpand = expand;
	*/
}

// OverHeaderBar
function v(groupId, itemId, cssClass, whichOne)
{
	
	var img;
	if (document.all(groupId + "_d" + itemId).style.display == "block")
		img = triUp + "arrow_H_" + whichOne + ".gif";
	else 
		img = triDown + "arrow_V_" + whichOne + ".gif";
		
	document.all(groupId + "_t" + itemId).className = cssClass;
	document.all(groupId + "_b" + itemId).src = img;
}	



// outHeaderBar
function u(groupId, itemId, cssClass, whichOne)
{
	var img;
		
	// if the associated item is displayed, show the down error, otherwise the up arrow
	if (document.all(groupId + "_d" + itemId).style.display == "block")
		img = triDown + "arrow_V_" + whichOne + ".gif";
	else 
		img = triUp + "arrow_H_" + whichOne + ".gif";
	
	document.all(groupId + "_t" + itemId).className = cssClass;
	document.all(groupId + "_b" + itemId).src = img;
}


/* function used for sub navigation menu system */

/* level 1 */
var base = "../../../materials/image/general/"; 

// MouseOver function
function over(itemImg, itemBar, itemCell, whichOne)
{
	
	var img = base + "arrow_H_" + whichOne + "_subMenu2" + ".gif";
	var cssBar = "menuBar_" + whichOne;
	var cssCell = "menuCell_" + whichOne;
	
	document.all(itemBar).className = cssBar;
	//document.all(itemCell).className = cssCell;
	document.all(itemImg).src = img;
}	



// outHeaderBar
function out(itemImg, itemBar, itemCell)
{
	var img = base + "square_pixel_1_1.gif";
	
	document.all(itemBar).className = "";
	//document.all(itemCell).className = "";
	document.all(itemImg).src = img;
}

/* level 2 */

var base2 = "../../../../materials/image/general/"; 

// MouseOver function
function over2(itemImg, itemBar, itemCell, whichOne)
{
	
	var img = base2 + "arrow_H_" + whichOne + "_subMenu2" + ".gif"; // arrow_H_Myworks_subMenu2
	var cssBar = "menuBar_" + whichOne;
	var cssCell = "menuCell_" + whichOne;
	
	document.all(itemBar).className = cssBar;
	//document.all(itemCell).className = cssCell;
	document.all(itemImg).src = img;
}	



// outHeaderBar
function out2(itemImg, itemBar, itemCell)
{
	var img = base2 + "square_pixel_1_1.gif";
	
	document.all(itemBar).className = "";
	//document.all(itemCell).className = "";
	document.all(itemImg).src = img;
}




/* a set of functions used for expanding and contracting screenshots panel */


// mouseclick
function screenClick(item)
{
	screenDiv = document.all(item);
	
	isExpanded =  ((screenDiv.style.display == "") || (screenDiv.style.display == "none"));
	setScreenExpanded(screenDiv, isExpanded);

	return false;
}

function setScreenExpanded(screenDiv, isExpanded)
{
	
	if (isExpanded) {
		screenDiv.style.display = "block";
		
		
	} else {
		screenDiv.style.display = "none";
		
	}
}
