
var bV=parseInt(navigator.appVersion);
NS6=(!document.all && document.getElementById) ? true : false;
NS4=(document.layers ) ? true : false;
IE4=((document.all)&&(bV>=4))?true:false;
ver4 = (NS4 || IE4 || NS6) ? true : false;
isExpanded = false;

//----------------------------------------------------------------------------------------------------------------------------
//--
//--
//----------------------------------------------------------------------------------------------------------------------------
function getIndex(el) {
    var ind = null;
	var obj = document.getElementById("layers");
	if(obj!=null){
	    for (i=0; i< obj.length; i++) {
		    var whichEl = obj[i];
			if (whichEl.id == el) {
				ind = i;
	            break;
		    }
	    }
	}
    return ind;
}

/* ORIGINAL ::
function getIndex(el) {
    ind = null;
    for (i=0; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.id == el) {
            ind = i;
            break;
        }
    }
    return ind;
}
*/
function arrange() {
	var obj = document.getElementById("layers");
	var nextY = obj[firstInd].pageY + obj[firstInd].document.height;

	if (obj!=null){
		for (i=0+1; i< obj.length; i++) {
			whichEl = obj[i];
			if (whichEl.visibility != "hide") {
				whichEl.pageY = nextY;
				nextY += whichEl.document.height;
			}
		}
	}
}

/* ORIGINAL::
function arrange() {
    nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
    for (i=0+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
}
*/


function initIt(){
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
        }
        //arrange();
    }
    else {
	if (IE4){
	        tempColl = document.all.tags("DIV");
        	for (i=0; i<tempColl.length; i++) {
	            if (tempColl(i).className == "child") tempColl(i).style.display = "none";
        	}
	}
    }
}
function showAll() {
	for (i=firstInd; i<document.layers.length; i++) {
		whichEl = document.layers[i];
		whichEl.visibility = "show";
	}
}
function expandIt(el) {
    if (!ver4) return;
    if (IE4) {
		expandIE(el);
    }else{
		if (NS4){
			expandNS(el);
		}else{
			if (NS6){
				expandNS6(el);
			}
		}
    }
}

function closeallie() {
    tempColl = document.all.tags("DIV");
    for (i=0; i<tempColl.length; i++) {
        if (tempColl(i).className == "child") {
		tempColl(i).style.display = "none";
	}
    }
    // cierra todas las imagenes
    for (i=0; i<document.images.length; i++) {
	if (document.images[i].name.indexOf("imEx") != -1){
	    document.images[i].src = dngif;
	}
    }

}

function expandIE(el) {
    tempColl = document.all.tags("DIV");
    for (i=0; i<tempColl.length; i++) {
        if (tempColl(i).className == "child") {
		tempColl(i).style.display = "none";
	}
    }
    // cierra todas las imagenes
    for (i=0; i<document.images.length; i++) {
	if (document.images[i].name.indexOf("imEx") != -1){
	    document.images[i].src = dngif;
	}
    }

    whichEl = eval(el + "Child");
    whichIm = eval("document.images['imEx" + el+"']");
    if (whichIm != null) {
        whichIm.src = upgif ;
    }


    if (whichEl.style.display == "none") {
        whichEl.style.display = "block";
	if (whichIm != null) {
        	whichIm.src = upgif;
	}
	MM_showHideLayers(el +"Child" ,'','show');
    }
    else {
        whichEl.style.display = "none";
	if (whichIm != null) {
        	whichIm.src = dngif;
	}
	MM_showHideLayers(el +"Child" ,'','hide');
    }
}
//------------------------------------------------------------------
//--
//------------------------------------------------------------------
function expandNS6(el) {
    // Cambio todas las imagenes a down
    //---------------------------------
    for (i=0; i<document.images.length; i++) {
		if (document.images[i].name.indexOf("imEx") != -1){
			document.images[i].src = dngif;
		}
    }
    // Cierro todos los div a hidden
    //-----------------------------------------
	tempColl = document.getElementsByTagName("DIV");
	for (i=0; i<tempColl.length; i++) {
		whichEl = tempColl[i].getAttribute("Id");
		if (whichEl == null){
			// nulo"
		}else{
			if (whichEl.indexOf('Child') != -1) {
				if (whichEl.indexOf('Foto') == -1) {
					//alert(whichEl+'::::'+el);
					myElement = document.getElementById(whichEl);
					myElement.style.visibility = 'hidden';
					//myElement.style.display = 'none';
				}
			}
		}
	}
    // abro imagen
    //-------------------------------------------------
    whichIm = eval("document.images['imEx" + el+"']");
	if (whichIm != null) {
	    whichIm.src = upgif;
	}
    // muestro elemento div
    //-------------------------------------------------
    myElement = document.getElementById(el + 'Child');
    myElement.style.visibility = 'visible';
/*alert(myElement.style.display)
	myElement.style.display = '';
alert(myElement.style.display)*/
}
//------------------------------------------------------------------
function expandNS(el) {
    // Cambio todas las imagenes a down
    //---------------------------------
    for (i=0; i<document.images.length; i++) {
		if (document.images[i].name.indexOf("imEx") != -1){
			document.images[i].src = dngif;
		}
    }
	//---------------------------------
   for (i=0; i<document.layers.length; i++) {
		whichEl = document.layers[i];
		if (whichEl.id.indexOf("Parent") != -1) {
			whichEl.document.images["imEx"].src = upgif;
		}
		if (whichEl.id.indexOf("Child") != -1) {
			//--whichEl.visibility =  "hide";
			whichEl.display =  "none";
		}
	}
	//---------------------------------
    whichEl = eval("document." + el + "Child");
    if (whichEl.visibility == "hide") {
        //--whichEl.visibility = "show";
		whichEl.display = "";
    }
    else {
        //--whichEl.visibility = "hide";
		whichEl.display = "none";
    }
    whichIm = eval("document.images['imEx" + el+"']");
    whichIm.src = upgif;
}
//------------------------------------------------------------------
function expandAll(isBot) {
    newSrc = (isExpanded) ? dngif : upgif;

    if (NS4) {
        document.images["imEx"].src = newSrc;
        for (i=firstInd; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Parent") != -1) {
                whichEl.document.images["imEx"].src = newSrc;
            }
            if (whichEl.id.indexOf("Child") != -1) {
                whichEl.visibility = (isExpanded) ? "hide" : "show";
            }
        }

        arrange();
        if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            if (divColl(i).className == "child") {
                divColl(i).style.display = (isExpanded) ? "none" : "block";
            }
        }
        imColl = document.images.item("imEx");
        for (i=0; i<imColl.length; i++) {
            imColl(i).src = newSrc;
        }
    }

    isExpanded = !isExpanded;
}

with (document) {
    write("<STYLE TYPE='text/css'>");
    if (NS4 || NS6) {
        write(".parent	{position:absolute; visibility:hidden}");
        write(".child	{position:absolute; visibility:hidden}");
        write(".regular {position:absolute; visibility:hidden}");
    }
    else {
        write(".child {display:none}")
    }
    write("</STYLE>");
}


if (NS6) {
		//--alert("como NS6");
        firstEl = "elOneParent";
        firstInd = getIndex(firstEl);
		if(firstInd!=null){
	        arrange();
		}

}
if (NS4) {
        firstEl = "elOneParent";
        firstInd = getIndex(firstEl);
        arrange();
}


//onload = initIt ();


