// Funciones para mostrar u ocultar texto dinamicamente (DHTML)

//Muestra u oculta un texto cambiando también el texto del link (se usa un texto distinto para el link)
function muestraLeer(idTexto, idLink) {
	var texto = document.getElementById(idTexto);
	var link = document.getElementById(idLink);
	var mostrar = "Leer más";
	var ocultar = "Ocultar";
	if (texto.style.display == '') {
		texto.style.display = 'none';
		link.innerText = mostrar;
	} else {
		texto.style.display = '';
		link.innerText = ocultar;
	}
}

//Muestra u oculta un texto (se usa el mismo link para mostrar y ocutar)
function muestraLink(idTexto) {
	var texto = document.getElementById(idTexto);
	if (texto.style.display == '') texto.style.display = 'none'
	else texto.style.display = '';
}

//Muestra u oculta un texto cambiando la imagen del link (se usa una imagen distinta para el link)
function muestraImg(idTexto, idImg) {
	var texto = document.getElementById(idTexto);
	var img = document.getElementById(idImg);
	var imgMas = "mas.gif";
	var imgMenos = "menos.gif";
	if (texto.style.display == '') {
		texto.style.display = 'none';
		img.outerHTML = replaceCharacters(img.outerHTML, imgMenos, imgMas);
	} else {
		texto.style.display = '';
		img.outerHTML = replaceCharacters(img.outerHTML, imgMas, imgMenos);
	}
}

//Funcion para sustituir el nombre de la imagen en el HTML dinamico
function replaceCharacters(conversionString,inChar,outChar)
{
  var convertedString = conversionString.split(inChar);
  convertedString = convertedString.join(outChar);
  return convertedString;
}
