
		function ChangeImages(node, imgpath, imgMain, imgPlusMinusPrefix, imgPlusMinus)
		{
			bSetMainImage = (imgMain != ""); //don't set main image in text modes
			if (node.children.length > 0)
			{
				if (node.children.item(0).tagName == "IMG")
				{
					if (imgPlusMinus != "No") //"No" indicates that it is not needed Plus or Minus image
						//jtg commented out top line. not sure why this is here.
						//node.children.item(0).src = imgpath + imgPlusMinusPrefix + imgPlusMinus + ".gif";
						node.children.item(0).src = imgpath + imgMain;
					else //if is not needed Plus/Minus image
					{
						if (bSetMainImage) //if node has image that must be changed
						{
							node.children.item(0).src = imgpath + imgMain;
							bSetMainImage = false;
						}
					}									
				}			
			}
			
			// process situation <A..><Checkbox><needed image></A>
			if (bSetMainImage && node.children.length > 1)
			{
				if (node.children.item(0).tagName == "INPUT" && node.children.item(1).tagName == "IMG")
				{
					node.children.item(1).src = imgpath + imgMain;
					bSetMainImage = false;
				}
			}
			
			//process next tag
			if (bSetMainImage)
			{
				nextNode = node.nextSibling;
				if (nextNode.tagName == "INPUT") //skip checkbox
					nextNode = nextNode.nextSibling;

				if (nextNode.tagName == "IMG") //next tag is needed image
					nextNode.src = imgpath + imgMain;
				else //next tag is <A...>
					if (nextNode.children.length > 0)
					{
						pos = 0;
						if (nextNode.children.item(0).tagName == "INPUT" && nextNode.children.length > 1)	
							pos = 1; // <A..> <Checkbox> <needed image>

						if (nextNode.children.item(pos).tagName == "IMG")							
							nextNode.children.item(pos).src = imgpath + imgMain;
					}
			}		
		}
		function ExpCol(node, imgpath, imgPlusMinus, imgCollapsed, imgExpanded, nodekey)
		{
			if (node != null)
			{
				nextNode = node.nextSibling;
				bFinded = false;
				
				while (nextNode != null && bFinded == false)
				{					
					if (nextNode.tagName == "DIV")
						bFinded = true;	
					else			
					    nextNode = nextNode.nextSibling;	
				}
				
				if (nextNode != null && bFinded)
				{						
					if (nextNode.style.display == 'none')
					{
						nextNode.style.display = '';
						ChangeImages(node, imgpath, imgExpanded, 'tv_minus', imgPlusMinus);
					}
					else
					{
						nextNode.style.display = 'none';
						ChangeImages(node, imgpath, imgCollapsed, 'tv_plus', imgPlusMinus);
					}
				}				
			}
		}

//added by ucsf
function ShowHideRow(row){
	if(row.style.display=="none"){
		row.style.display=""
	}else{
		row.style.display="none"
	}
}
function BoldNodeTogglePlusMinus(id,plus,minus){
	var oimg=document.getElementById("img" +id)
	if (oimg.src.indexOf(plus)>=0){
		oimg.src=minus
	}else{
		oimg.src=plus
	}	
}


function ShowHideChildNodes(id,plus,minus){
	
	var sPrefix="tv:cop"
	var oRow
	var iCnt=1
	var bHideAll=false
	var bBoldCheck=false
	
	//exit function if from mac.
	//the expand and contract feature has been disabled for macs.
	//is mac?
	if(navigator.appVersion.indexOf("Mac")!=-1){
		//only show if it is i.e.
		if(navigator.appName.indexOf("Microsoft") !=-1){
			return false;
		}
	}
	//if id is empty then toggle all nodes.
	if (id!=null){
		sPrefix= id + "."
		//alert(window.navigator.platform.instr("Mac") )

	}else{
		bHideAll=true
	}
	
	//loop through and hide all possible rows to a number that I don't think we will reach 30
	do{
		oRow=document.getElementById(sPrefix + iCnt)	
		if (oRow!=null){
			if(bHideAll){
				ShowHideChildNodes(sPrefix + iCnt,plus,minus)
			}else{
				if(bBoldCheck!=true){
					if (bHideAll!=true){
						BoldNodeTogglePlusMinus(id,plus,minus)	
						bBoldCheck=true
					}
				}
				ShowHideRow(oRow)
			}
		}
		iCnt++;
	}while(iCnt<30);
	return false;
}
