// =========================================================================
// proesionales.js v.0.0.4
// =========================================================================
// This work is licensed under the Creative Commons 
// Attribution-NonCommercial-ShareAlike 2.5 Spain License. To view a copy of 
// this license, visit //http://creativecommons.org/licenses/by-nc-sa/2.5/es/ 
// or send a letter to Creative Commons, 543 Howard Street, 5th Floor, 
// San Francisco, California, 94105, USA.
// =========================================================================
// Author: Sergio Guerrero Zurita
// =========================================================================
// Update: 20/07/06
// =========================================================================

var destino = "";
var idioma = "";
var xmlDoc = null;
function importXML(xml, dest, lang){
	
	destino = dest;		//Anotamos la etiqueta de destino
	idioma = lang;		//Anotamos el idioma de la web
	var url = xml;
	
	if (document.implementation && document.implementation.createDocument){
		var myAjax = new Ajax.Request( url, { method: 'get', onComplete: mostrar });
	}
	else if (window.ActiveXObject){
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {if (xmlDoc.readyState == 4) mostrar()};
 	}
	else {
		alert('Su navegador no soporta este script');
		return;
	}
	
	if (typeof xmlDoc!="undefined" && window.ActiveXObject){
		xmlDoc.load(xml);	//Cargamos el XML
	}
}

function mostrar(originalRequest){
	if (document.implementation && document.implementation.createDocument){
		xmlDoc = (new DOMParser()).parseFromString(originalRequest.responseText, "text/xml");
	}

	<!--Secciones -->
	var seccs = xmlDoc.getElementsByTagName('seccion');	
	var nmprof = "";
	
	for (i=0;i<seccs.length;i++){
		nmprof += "<span class='Profesionales1'>";
		if (seccs[i].getAttribute('titulo_' + idioma) != "") nmprof += "<strong>" + seccs[i].getAttribute('titulo_' + idioma) + "</strong></span><BR>";
		if (seccs[i].getAttribute('subtitulo_' + idioma) != "") nmprof += "<strong>" + seccs[i].getAttribute('subtitulo_' + idioma) + "</strong><BR>";
		nmprof += "<BR>";

		<!--Profesionales -->
		var profs = seccs[i].getElementsByTagName('nombre');
		for (j=0;j<profs.length;j++){
			if (profs[j].nodeType != 1) continue;
			nmprof += "<strong>" + profs[j].firstChild.nodeValue + "</strong> " + profs[j].getAttribute('prof_' + idioma) + " Ext.: " + profs[j].getAttribute('ext') + "<BR>";
		}
		
		<!--Mails -->
		var mails = seccs[i].getElementsByTagName('mail');
		nmprof += "<p>"
		for (k=0;k<mails.length;k++){
			if (mails[k].nodeType != 1) continue;
			nmprof += "e-mail: <a href='mailto:" + mails[k].firstChild.nodeValue + "'>" + mails[k].firstChild.nodeValue + "</a><BR>";  
		}
		nmprof += "</p>"
	}
	window.document.getElementById(destino).innerHTML = nmprof; //Insertamos las etiquetas en la web
}