function startList() {
    if (document.all&&document.getElementById) {
        navRoot = document.getElementById("nav");
        for (i=0; i<navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName=="li") {
                node.onmouseover=function() {
                    this.className+=" on";
                }
                node.onmouseout=function() {
					this.className=this.className.replace(" on", "");
                }
            }
        }
    }
}

function ShowLayer(sId)
{
	var oLayer = document.getElementById (sId);
	if(oLayer != null)
	{		
		oLayer.style.visibility = "visible";
		oLayer.style.display	= "block";
	}
}

function HideLayer(sId)
{
	var oLayer = document.getElementById (sId);
	if(oLayer != null)
	{		
		oLayer.style.visibility = "hidden";
		oLayer.style.display	= "none";
	}
}

/* ------------------------------- */
/* Menu interno.				   */
/* ------------------------------- */
var sMENU_ANTERIOR = "";

function MenuNivel1Name(id)
{
	var iId  = Number(id) - 1;
	var aIds = new Array("austral", "perfiles", "facultad");
//	alert(iId);
	return(aIds[iId]);
}

function Estilo(sId, sStyle)
{
	var obj = document.getElementById (sId);
	if(obj != null){obj.className = sStyle;}
}

function ShowMenu(sId)
{
	var i1, i2, i3;
	var arrActual   = sId.split ("-");
	var arrAnterior = sMENU_ANTERIOR.split ("-");
	var aIds 	    = new Array("austral", "perfiles", "facultad");

	// Anterior.
	switch(arrAnterior.length)
	{
		// Nivel 1.
		case 1:
		{
			Estilo(MenuNivel1Name(sMENU_ANTERIOR), "");
			HideLayer("ul_" + sMENU_ANTERIOR);
			break;
		}
		// Nivel 2.		
		case 2:
		{
			HideLayer("ul_" + sMENU_ANTERIOR);
			break;
		}
		// Nivel 3.
		case 3:
		{
			Estilo("li_" + sMENU_ANTERIOR, "");
			// Nivel 2.
			HideLayer("ul_" + arrAnterior[0] + "-" + arrAnterior[1]);
			// Nivel 3.
			HideLayer("ul_" + sMENU_ANTERIOR);
			break;
		}
	}

	// Actual.
	switch(arrActual.length)
	{
		// Nivel 1.
		case 1:
		{
			Estilo(MenuNivel1Name(sId), "sel");
			break;
		}
		// Nivel 2.		
		case 2:
		{
			ShowLayer("ul_" + arrActual[0]); // Nivel 1.
			break;
		}
		// Nivel 3.
		case 3:
		{
			// Nivel 1.
			Estilo(MenuNivel1Name(arrActual[0]), "sel"); 
			ShowLayer("ul_" + arrActual[0]); 
			// Nivel 2.
			ShowLayer("ul_" + arrActual[0] + "-" + arrActual[1]); 
			// Nivel 3.
			Estilo("li_" + sId, "sub-sub-sel");
			break;
		}
	}

	sMENU_ANTERIOR = sId;
	ShowLayer("ul_" + sId);
}
/* ------------------------------- */

/* ------------------------------- */
/* Flechitas					   */
/* ------------------------------- */
var iID_ANTERIOR = 0;

function abrirItem(iItem)
{
	var oLink;

	// Anterior.
	if(iID_ANTERIOR != 0)
	{
		oLink = document.getElementById ("a_item_" + iID_ANTERIOR);
		oLink.className = "btn";
		HideLayer("div_item_" + iID_ANTERIOR);
	}
	
	if(iItem == iID_ANTERIOR)
		iID_ANTERIOR = 0
	else
	{
		// Actual.
		oLink = document.getElementById ("a_item_" + iItem);
		oLink.className = "btn2";
		ShowLayer("div_item_" + iItem);
		iID_ANTERIOR = iItem;
	}
}
/* ------------------------------- */