function iniciarCargaGeneral(){ // llamo a iniciarRequest var idChannelDoc=5310102; // Informacion de interes general var idChannelEnlace=5310106; // Enlaces de interes general iniciarRequest(idChannelDoc,idChannelEnlace,-1); } function AbrirContinente(idContinente){ var idChannelDoc=5310104; // Informacion de interes regional var idChannelEnlace=5322925; // Enlaces de interes regional iniciarRequest(idChannelDoc,idChannelEnlace,idContinente); } function AbrirPais(codPais){ var idChannelDoc=5320625; // Informacion de interes var idChannelEnlace=5322927; // Enlaces de interes iniciarRequest(idChannelDoc,idChannelEnlace,codPais); } function AbrirOfe(codPais){ //Aqui vamos a la web correspondiente var pathOfecome; pathOfecome = '/icex/cda/controller/pageOfecomes/0,5310,5280449_5282899_5283038_0,00.html'; var pathOfecomeTemp; var posRemainder = pathOfecome.indexOf(",00.html"); // Caso especial de Taiwan var pathOfecomeTaiwan = "/icex/cda/controller/pageOfecomesGen/0,,5398971_5399850_5503629_0_TAI,00.html"; if (posRemainder != -1){ pathOfecomeTemp = pathOfecome.substring(0,posRemainder); pathOfecomeTemp = pathOfecomeTemp + "_" + codPais; pathOfecomeTemp = pathOfecomeTemp + pathOfecome.substring(posRemainder,pathOfecome.length); } //Comprobamos si pinchamos sobre taiwan para redireccionar a la url con el codigo TAI if (codPais=="TW"){ pathOfecomeTemp=pathOfecomeTaiwan; } document.location.href=pathOfecomeTemp; } function iniciarRequest(idChannelDoc,idChannelEnlace,idMercado) { if (window.XMLHttpRequest) { // Mozilla, Safari, ... http_request = new XMLHttpRequest(); if(http_request.overrideMimeType){ // Comprobamos que existe el metodo. http_request.overrideMimeType('text/xml'); // Este metodo no es soportado por IE7. } } else { // IE http_request = new ActiveXObject("Microsoft.XMLHTTP"); } http_request.onreadystatechange = procesarXML; http_request.open('GET', '/icex/cda/views_DTS_Ofecomes/Ofecomes/prehome/obtenerDocsEnlacesXML?idChannelDoc=' + idChannelDoc + '&idChannelEnlace=' + idChannelEnlace + '&idMercado=' + idMercado, true); http_request.setRequestHeader("Connection", "close"); http_request.send(null); } function procesarXML(){ if (http_request !=null && http_request.readyState == 4) { // si readyState == 4, respuesta recibida if (http_request.status == 200) { // comprobamos si ha habido algun problema var mensajeInicial = http_request.responseText.substring(http_request.responseText.indexOf("+ " + nombreCanalDoc + ""; var mensErrorDoc = elementoDocumentos.attributes.getNamedItem("mensError").nodeValue; if (nDocumentos != 0){ //Pinto el nombre del canal documentosHTML = "

+ " + nombreCanalDoc + "

"; var titulo =""; var descripcion = ""; var enlace =""; var icono = ""; for( var i = 0; i < nDocumentos; i++ ) { var documento = elementoDocumentos.getElementsByTagName("documento").item(i); titulo = documento.getElementsByTagName("titulo").item(0).firstChild.nodeValue; if (documento.getElementsByTagName("descripcion_doc").item(0).firstChild != null){ descripcion = documento.getElementsByTagName("descripcion_doc").item(0).firstChild.nodeValue; } enlace = documento.getElementsByTagName("enlace_doc").item(0).firstChild.nodeValue; if (documento.getElementsByTagName("icono_doc").item(0).firstChild != null){ icono = documento.getElementsByTagName("icono_doc").item(0).firstChild.nodeValue; } documentosHTML = documentosHTML + "

"; //comprobamos que el icono no sea nulo para no mostrar la imagen vacia if (icono != ""){ documentosHTML = documentosHTML + "Descargar archivo "; } documentosHTML = documentosHTML + titulo + "

"; documentosHTML = documentosHTML + descripcion; //documentosHTML = documentosHTML + "
" + descripcion; } } else { //Pinto el mensaje de error documentosHTML = documentosHTML + "

 " + mensErrorDoc + "

"; } document.getElementById("documentos").innerHTML = documentosHTML; } //Recuperamos ENLACES var elementoEnlaces = resultados.getElementsByTagName("enlaces").item(0); if(elementoEnlaces!=null){ var nEnlaces = elementoEnlaces.getElementsByTagName("enlace").length; //alert("nEnlaces:"+nEnlaces); var nombreCanalEnl = elementoEnlaces.attributes.getNamedItem("nombreCanal").nodeValue; var mensErrorEnlaces = elementoEnlaces.attributes.getNamedItem("mensError").nodeValue; if (nEnlaces != 0){ //Pinto el nombre del canal en 'resultadosDocumentos' enlacesHTML = "

+ " + nombreCanalEnl + "

"; enlacesHTML = enlacesHTML + "

"; var tituloEnlace = ""; var url_enlace = ""; for( var i = 0; i < nEnlaces; i++ ) { var enlace = elementoEnlaces.getElementsByTagName("enlace").item(i); tituloEnlace = enlace.getElementsByTagName("titulo").item(0).firstChild.nodeValue; url_enlace = enlace.getElementsByTagName("url_enlace").item(0).firstChild.nodeValue; enlacesHTML = enlacesHTML + "" + tituloEnlace + "
"; } enlacesHTML = enlacesHTML + "

"; } document.getElementById("enlaces").innerHTML = enlacesHTML; } } } else { // Ha habido algun problema con la peticion.P.ej: un codigo de respuesta 404 (archivo no encontrado) o // un error o 500 (Internal Server Error) } } else { // readyState = 0 (no inicializada),1 (leyendo),2 (leido),3 (interactiva) } }