function grillaAbreCierra(t, img)
{
	tab = buscarObjeto(t);
	i = buscarObjeto(img);
	if (tab.style)
		tab = tab.style;
	if (i == undefined || i.nivel == undefined) {
		ch_menos = '../images/boton_grilla_abre.gif';
		ch_mas = '../images/boton_grilla_cierra.gif';
	} else {
		ch_menos = '../images/boton_grilla_abre_n' + i.nivel + '.gif';
		ch_mas = '../images/boton_grilla_cierra_n' + i.nivel + '.gif';
	}
	if (tab.display == 'none') {
		if (document.all) {
			tab.display = 'inline';
		} else {
			tab.display = 'table';
		}
		if (i != undefined)
			i.src = ch_menos;
	} else {
		tab.display = 'none';
		if (i != undefined)
			i.src = ch_mas;
	}
}

function grillaCierra(t, img)
{
	tab = buscarObjeto(t);
	i = buscarObjeto(img);
	if (tab.style)
		tab = tab.style;
	if (i.nivel == undefined) {
		ch_menos = '../images/boton_grilla_abre.gif';
		ch_mas = '../images/boton_grilla_cierra.gif';
	} else {
		ch_menos = '../images/boton_grilla_abre_n' + i.nivel + '.gif';
		ch_mas = '../images/boton_grilla_cierra_n' + i.nivel + '.gif';
	}
	if (tab.display == 'inline') {
		tab.display = 'none';
		i.src = ch_mas;
	} 
}

function switchTrs(idsec, cant)
{
	for (i=1; i<=cant; i++) {
		objname2 = "tr_sec" + idsec + "_" + i;
		switchObj(objname2);
		objname2 = "tr_2sec" + idsec + "_" + i;
		switchObj(objname2);
	}
	objencname = "tr_sec" + idsec + "_head";
	switchObj(objencname);
	objencname = "tr_sec" + idsec + "_head_b";
	switchObj(objencname);
	imgname = "boton_" + idsec;
	/*imgobj = buscarObjeto(imgname);
	if (imgobj.src.indexOf("boton_mas")>1)
		imgobj.src = "../images/boton_menos.gif";
	else
		imgobj.src = "../images/boton_mas.gif";*/
}

function switchObj(objname) {
	obj = buscarObjeto(objname);
	if (!obj) {
		alert(objname);
		return;
	}
	if (obj.style.display=="none") {
		
		obj.style.display = "inline";

	} else {
		obj.style.display = "none";
	}
}

function buscarObjeto(nombre)
{
	if (document.layers) {
		obj = document.layers[nombre];
	} else if (document.all) {
		obj = document.all[nombre];
	} else if (document.getElementById) {
		obj = document.getElementById(nombre);
	}
	return obj;
}

