/* author: Martin Roclawski */
/* Creation date: 30/07/2004 */
/* 
/* Requires 
	mrObjFuncs.js 
	mrArrayFuncs.js
*/

var sClosed = '../shared/images/more.gif';
var sOpen = '../shared/images/less.gif';

function expIsVisibleByObj(oChild)
{
	return (oChild.style.display == '');
}

function expToggle(sChildId,sImgId)
{
	var lChild = objById(sChildId);
 	var lImg = objById(sImgId);

 	if (expIsVisibleByObj(lChild))
	{
		lChild.style.display = 'none';
		lImg.src=sClosed;
  	}
  	else 
	{
    	lChild.style.display='';
   		lImg.src=sOpen;
  	};
 }

function expToggleVisibleByObj(oChild)
{
 	if (expIsVisibleByObj(oChild))
	{
		oChild.style.display = 'none';
  	}
  	else 
	{
	    	oChild.style.display='';
  	};
}
function expToggleVisibleById(sChildId)
{
	var lChild = objById(sChildId);
	

	expToggleVisibleByObj(lChild);
}

/*
	specify Parent and array of Tags to toggle display
*/
function expToggleChildren(oParent, aTags, bExclusive)
{
	for (var i = 0; i < aTags.length; i++)
	{
		var lObjs = oParent.getElementsByTagName(aTags[i]);
		//alert(lObjs.length);
		for (var j = 0; j < lObjs.length; j++)
		{
			if (!(bExclusive) || (bExclusive && (lObjs[j].parentNode == oParent))) {
				expToggleVisibleByObj(lObjs[j]);
			};
		}
	}
 } 
function expToggleSiblings(obj, aTags)
{
	expToggleChildren(obj.parentNode, aTags, true);
}

function expSetClassByObj(obj, sNewClass)
{
	if (obj && obj.className != 'undefined') 
	{
		obj.className = sNewClass;
	};
}
function expNextClass(obj, aClassArray)
{
	//alert(obj.className);
	if (obj && obj.className != 'undefined') 
	{
		var lnextClass = aClassArray[nextInArray(aClassArray, obj.className)];
		//alert(lnextClass);
		expSetClassByObj(obj, lnextClass);
	};
}