
	var seccionActual;

	var bloques = document.getElementsByTagName('div');
	var j = 0;
	for (var i = 0; i < bloques.length; i++)
	{
		if (bloques[i].getAttribute('id') == 'seccion')
		{
			if (j == pest_activa)
			{
				bloques[i].id = secciones[j];
				bloques[i].style.display = 'block';
				seccionActual = bloques[i];
			}
			else
			{
				bloques[i].setAttribute('id', secciones[j]);
				bloques[i].style.display = 'none';
			}
			j++;
		}
	}
	
	function intercambiar(seccion, td)
	{
		seccionActual.style.display = 'none';
		seccionActual = document.getElementById(seccion);
		seccionActual.style.display = 'block';
		
		var celdas = document.getElementsByTagName('td');
		for (var i = 0; i < celdas.length; i++)
		{
			if (celdas[i].getAttribute('name') != null)
			{
				if (celdas[i].getAttribute('name') == 'TD' + seccion)
				{
					imagen = celdas[i].style.backgroundImage;
					nombreImagen = imagen.substring(imagen.indexOf('(') + 1, imagen.lastIndexOf('.gif'));
					if (nombreImagen.lastIndexOf('2') != -1)
					{
						celdas[i].style.backgroundImage = 'url(' + nombreImagen.substring(0, nombreImagen.length - 1) + ".gif)";
						if (nombreImagen.indexOf('centro') != -1)
						{
							activar(celdas[i], true);
						}
					}
				}
				else if (celdas[i].getAttribute('name').indexOf('TD') == 0)
				{
					imagen = celdas[i].style.backgroundImage;
					nombreImagen = imagen.substring(imagen.indexOf('(') + 1, imagen.lastIndexOf('.gif'));
					if (nombreImagen.lastIndexOf('2') == -1)
					{
						celdas[i].style.backgroundImage = 'url(' + nombreImagen + "2.gif)";
						if (nombreImagen.indexOf('centro') != -1)
						{
							activar(celdas[i], false);
						}
					}
				}
			}
		}

	}

	function activar(objeto, hacerlo)
	{
		if (!hacerlo)
		{
			objeto.style.fontWeight = '';
			objeto.style.cursor = 'pointer';
			objeto.setAttribute('activo', 'false');
		}
		else
		{	
			objeto.style.fontWeight = 'bold';
			objeto.style.cursor = '';
			objeto.setAttribute('activo', 'true');
		}
		desunderlinear(objeto);
	}

	function underlinear(objeto)
	{
		if (objeto.getAttribute('activo') == 'true')
		{
			objeto.style.textDecoration = 'none';
		}
		else
		{
			objeto.style.textDecoration = 'underline';
		}
	}

	function desunderlinear(objeto)
	{
		objeto.style.textDecoration = 'none';
	}
