var stateTOC = 'ON'; function toggleTOC() { if (stateTOC == 'ON') { stateTOC = 'OFF' document.getElementById('TOC').style.display = "none"; } else { stateTOC = 'ON' document.getElementById('TOC').style.display = "inline"; } } function buildTOC() { validTagList = '. H1 H2 H3 H4 H5 H6 .'; if (document.body.childNodes) { allTags = getObjects(); } else if (document.all) { allTags = document.all; } else if (document.layers) { alert('Netscape layers? What to do, what to do ....'); } var tagDetail = new Array(1); j = 0; aNum = 0; for(i = 0; i < allTags.length; i++) { if (validTagList.indexOf(' '+allTags[i].tagName+' ') > 0) { aNum = aNum + 1; var aNode = document.createElement("A"); aNode.id = 'Z'+aNum; allTags[i].appendChild(aNode); tagDetail[j] = allTags[i].tagName + "|"; tagDetail[j] = tagDetail[j]+aNum + "|"; if (allTags[i].childNodes.length > 0) { if(allTags[i].childNodes[0].nodeValue == null) { tagDetail[j] = tagDetail[j]+allTags[i].childNodes[1].nodeValue; } else { tagDetail[j] = tagDetail[j]+allTags[i].childNodes[0].nodeValue; } } ; j = j + 1; } } var ulNode = document.createElement("UL"); tocId = document.getElementById('TOC'); tocId.appendChild(ulNode); var total = (tagDetail.length/2)-1; for(i = 0; i < tagDetail.length; i++) { thisDetail = tagDetail[i].split("|"); var liNode = document.createElement("LI"); liNode.className = thisDetail[0]; ulNode.appendChild(liNode); var aNode = document.createElement("A"); aNode.className = thisDetail[0]; aNode.href = '#Z'+thisDetail[1]; liNode.appendChild(aNode); aNode.innerHTML = thisDetail[2]; // parche para que en IE no se muestre duplicado if (total == i && navigator.appName == "Microsoft Internet Explorer") break; } } function getObjects() { var obj = new Array(1); j = 0; obj[j] = document.documentElement; traverse( document.documentElement ); function traverse(node) { obj[j] = node; j = j + 1; if (node.childNodes != null) { for (var i=0; i < node.childNodes.length; i++) { traverse(node.childNodes.item(i)); } } } return obj; } // FIN TOC - tabla de contenidos // Busqueda function tipoDoc(tipo) { if (tipo == "PageContent") { document.busquedas.PageContent.value = document.busquedas.termino.value; document.busquedas.PageName.value = null; } else { document.busquedas.PageName.value = document.busquedas.termino.value; document.busquedas.PageContent.value = null; } } // Editor secciones superiores function editaSeccion(valor,texto,idcat) { if (texto == "seleccione...") { alert('Seleccione una opción válida'); } else { var URL_indice = valor.split('|'); // valor contiene la URL y el elemento del índice a eliminar del vector php document.seccionesup.URL.value = URL_indice[0]; document.seccionesup.TEXTO.value = texto; document.seccionesup.idcat.value = idcat; document.seccionesup.indicec.value = URL_indice[1]; } } function confirmaBorrar(pagina) { var msg = "żEstas seguro de borrar esta página?\n"+pagina; if ( confirm(msg) ) { window.location = 'php/modificar_contenidos.php?borrar='+pagina; } }