/*
	//* tree.js: Funcao para criar expansao simulando um tree view.
	//* 
	//* <br>
	//* <br>
	//* Informacoes do CVS <br>
	//* $Source: /home/CVS/bdpa-web/rebae/WebContent/web/js/tree.js,v $<br>
	//* $Name:  $<br>
	//* $Revision: 1.1 $<br>
	//* $Author: isaque $<br>
	//* $Date: 2006/05/12 13:41:36 $<br>
	//*
	//* EMBRAPA/CNPTIA, Equipe AINFO, <A HREF="mailto:isaque@cnptia.embrapa.br">Isaque Vacari</A>
*/

/*
Modo de usar:
	<script language="JavaScript" src="tree.js"></script>

No HTML:
	<img src="mais.gif" name="imgmais" border="0">
	<a  href="#mais" onClick="shoh('first');" >Customer Support</a>

	<div style="display: none;" id="mais" >
			Texto expandido. 		      
	</div>
*/

imgout=new Image(9,9);
imgin=new Image(9,9);

imgout.src="web/images/mais.png";
imgin.src="web/images/menos.png";

//troca de imagens
function trocar(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}

//exibir ou ocultar elemento
function expandir(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
			trocar(("img"+id),'imgin');			
		} else {
			trocar(("img"+id),'imgout');
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				trocar(("img"+id),'imgin');
			} else {
				trocar(("img"+id),'imgout');	
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				trocar(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
}