
function getUlParent(obj){
	var p = obj.parentNode
	if(p){
		if( p.tagName == 'UL'){return(p);}
		else{return(getUlParent(p)); }
	}
	alert("El objeto "+obj.name+" no esta dentro de una forma");
	return(false);
}

function actTab(a){
	ul = getUlParent(a);
	if(ul){
		var campos = ul.getElementsByTagName( 'a' );
		for(x=0; x < campos.length; x++ )
		{
		 c = campos[x];
		 if( clase = c.getAttribute("clase")){}
		 else{ clase = c.className;
			if(clase == "activo"){clase="";}
			c.setAttribute("clase", clase);
		 }
		 c.className = c.getAttribute("clase");
		}
		a.className = "activo";
	}
	//alert(a.innerHTML);
}

function showLayer(idDiv){
	div = document.getElementById(idDiv);
	div.style.display = "block";
}

function showDiv(idPadre, idHijo){
//alert(idHijo);
	a = document.getElementById(idPadre);
	var divs = a.getElementsByTagName( 'div' );
		for(x=0; x < divs.length; x++ )
		{ div = divs[x];
		  /*if(div.id == idHijo){$("#"+div.id).show();alert(div.id);}
		  else{ $("#"+div.id).hide();alert(div.id);ç*/
		  if(a == div.parentNode ){
			  if(div.id == idHijo){div.style.display = "inline-block";}
			  else{ div.style.display = "none"; }
		  }
		}	
}

function hideCapa(idCapa, capaActiva){
 c = document.getElementById(idCapa);
 capas = c.getElementsByTagName('div');
 for(i=0;i<capas.length;i++){
  if(c == capas[i].parentNode){
    capas[i].style.display = "none";
  }
  if(capas[i].id == capaActiva){
	capas[i].style.display = "block";
  }
 }
 
}
