function cargarDatos(selEl) {
	var comSel = selEl.options[selEl.selectedIndex].value;
	if(comSel=="INICIO") {
		location.href="don_ant.html";
	} else {
		cargarDatos1(comSel);
	}
}

function cargarDatos1(comSel) {
	var tmpArr = new Array();
	var x = xmlDoc.getElementsByTagName('centro');
	document.getElementById("newData").innerHTML = "<h3>"+comSel+"</h3>";
	for(var i=0; i<x.length; i++) {
		if (x[i].childNodes[0].nodeType != 1) {
			if(x[i].childNodes[1].firstChild.nodeValue==comSel) {
				var tmpLink = "";
				if(x[i].childNodes[13].firstChild.nodeValue!="null")
					tmpLink = "<a href='"+x[i].childNodes[13].firstChild.nodeValue+"' target='_blank'>"+x[i].childNodes[3].firstChild.nodeValue+"</a>";
				else
					tmpLink = x[i].childNodes[3].firstChild.nodeValue;
				var tmpText = "<b>"+tmpLink+"</b><br />"+x[i].childNodes[5].firstChild.nodeValue+"<br />"+x[i].childNodes[7].firstChild.nodeValue+"<br />"+x[i].childNodes[9].firstChild.nodeValue+"<br />"+x[i].childNodes[11].firstChild.nodeValue+"<br /><br />";
				document.getElementById("newData").innerHTML += tmpText.replace(/\*\*\*\*/gi,"<br />");
			}
		} else {
			if(x[i].childNodes[0].firstChild.nodeValue==comSel) {
				var tmpLink = "";
				if(x[i].childNodes[6].firstChild.nodeValue!="null")
					tmpLink = "<a href='"+x[i].childNodes[6].firstChild.nodeValue+"' target='_blank'>"+limpiarNull(x[i].childNodes[1].firstChild.nodeValue)+"</a>";
				else
					tmpLink = limpiarNull(x[i].childNodes[1].firstChild.nodeValue);
				var tmpText = "<b>"+tmpLink+"</b><br />"+printNode(x[i])+"<br />";
				document.getElementById("newData").innerHTML += tmpText.replace(/\*\*\*\*/gi,"<br />");
			}
		}
	}
	document.getElementById("newData").innerHTML += "<br /><br /><a href='don_ant.html'><img src='img/consultarotracomunidad.gif' border='0'></a>";
	document.getElementById("imprimir_txt").innerHTML = "<nobr><a href='pdf/don_ant/antes_"+comSel.replace(/ /gi,"_").toLowerCase()+".pdf' class='a2' target='_blank'>Imprimir PDF</a>&nbsp;&nbsp;&nbsp; </nobr>";
	document.getElementById("imprimir_img").innerHTML = "<img src='img/imprimir.gif' />&nbsp; "
}

function init() {
	importXML("don_ant.xml");
}

function printNode(nodo){
	var tmpText = "";
	if (nodo.childNodes[2].firstChild.nodeValue != "null")
		tmpText += nodo.childNodes[2].firstChild.nodeValue+"<br />";
	if (nodo.childNodes[3].firstChild.nodeValue != "null")
		tmpText += nodo.childNodes[3].firstChild.nodeValue+"<br />";
	if (nodo.childNodes[4].firstChild.nodeValue != "null")
		tmpText += nodo.childNodes[4].firstChild.nodeValue+"<br />";
	if (nodo.childNodes[5].firstChild.nodeValue != "null")
		tmpText += nodo.childNodes[5].firstChild.nodeValue+"<br />";
	return tmpText;
}

function limpiarNull(texto){
	if (texto != "null")
		return texto;
	else
		return "";
}