function cargarXML(date,date2){
	if (window.XMLHttpRequest)
	{
/* 		xmlDoc=new window.XMLHttpRequest(); */

/* 		var url="events.xml"; */

     var xmlDoc = null;
     try{
         xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
     }catch(expeption){
         xmlDoc = new XMLHttpRequest();
     }

/*  		var url="http://todopalma.hostdvision.com/events.xml?date="+date;  */
/* 		alert(url); */
		var url="events.xml?date="+date;
		var url_mod ='php_proxy2.php?dst=' + encodeURIComponent(url);
		xmlDoc.open("GET",url_mod,false);
		xmlDoc.send(null);
		xmlDoc=xmlDoc.responseXML;
	}


var x=xmlDoc.getElementsByTagName("event");
var titulo = new Array();
var subtitulo = new Array();
var texto = new Array();
var categoria = new Array();
var lugar = new Array();
var hora = new Array();
var link = new Array();
var link2 = new Array();
var image = new Array();
var fin = new Array();
var precio = new Array();

var fecha = new Array();
var mes = new String();

txt = "<table class='tablaCalendario' width='600px;'>";

for (i=0;i<x.length;i++)
{
	titulo[i] = x[i].getElementsByTagName("titulo")[0].childNodes[0].nodeValue;
	subtitulo[i] = x[i].getElementsByTagName("subtitulo")[0].childNodes[0].nodeValue;
 	texto[i] = x[i].getElementsByTagName("texto")[0].childNodes[0].nodeValue;
	categoria[i] = x[i].getElementsByTagName("categoria")[0].childNodes[0].nodeValue;
	lugar[i] = x[i].getElementsByTagName("lugar")[0].childNodes[0].nodeValue;
	hora[i] = x[i].getElementsByTagName("hora")[0].childNodes[0].nodeValue;
	//link[i] = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue;
	//link2[i] = x[i].getElementsByTagName("link2")[0].childNodes[0].nodeValue;
	image[i] = x[i].getElementsByTagName("image")[0].childNodes[0].nodeValue;
	fin[i] = x[i].getElementsByTagName("publish_end")[0].childNodes[0].nodeValue;
	precio[i] = x[i].getElementsByTagName("precio")[0].childNodes[0].nodeValue;
	


fecha = fin[i].split("-");

if (fecha[1] == "09"){ mes = "Septiembre" } 
else if (fecha[1] == "01"){ mes = "Enero" } 
else if (fecha[1] == "02"){ mes = "Febrero" } 
else if (fecha[1] == "03"){ mes = "Marzo" } 
else if (fecha[1] == "04"){ mes = "Abril" } 
else if (fecha[1] == "05"){ mes = "Mayo" } 
else if (fecha[1] == "06"){ mes = "Junio" } 
else if (fecha[1] == "07"){ mes = "Julio" } 
else if (fecha[1] == "08"){ mes = "Agosto" } 
else if (fecha[1] == "10"){ mes = "Octubre" } 
else if (fecha[1] == "11"){ mes = "Noviembre" }  
else { mes = "Diciembre" }


/*
txt +="<tr><td width='115px;' style='padding:10px 0px 0px 5px;'><img src='http://todopalma.hostdvision.com"+ image[i] +"' alt=''></td>";
txt +="<td align='left' valign='bottom' class='textoTituloRutas2'><b>" + categoria[i] + "<b><br>";
txt +="<b>" + titulo[i] + "</b></td></tr>";
if (texto[i] == '' ){ } else { txt +="<tr><td colspan='2' class='textoTapeo'>" + texto[i] + "</td></tr>"; }
txt +="<tr><td colspan='2' class='textoTapeo'>" + lugar[i];
if (hora[i] == '' ){ } else { txt +=", " + hora[i]; }
txt +=", hasta " + fecha[2]+ " de " + mes + "</td></tr>"; 
if (precio[i] == '' ){ } else { txt +="<tr><td class='textoTapeo'>" + precio[i] + "</td></tr>"; }
if (link[i] == '' ){ } else { txt +="<tr><td colspan='2' class='textoTapeo'><a href='http://" + link[i] + "' target='_blank'>http://" + link[i] + "</td></tr>"; }
if (link2[i] == '' ){ } else { txt +="<tr><td colspan='2' class='textoTapeo'><a href='http://" + link2[i] + "' target='_blank'>http://" + link2[i] + "</td></tr>"; }
txt +="<tr><td colspan='2'><img src='images/imagenLinea.jpg'></td>";
*/


txt +="<tr><td width='115px;' style='padding-bottom:10px;' valign='top'><img src='http://todopalma.info"+ image[i] +"' alt=''></td>";
txt +="<td><table style='margin-left:10px;border-collapse: collapse;width:300px;margin-top:-5px;' class='textoAgenda2'><tr><td><b>" + categoria[i] + "<b></td></tr>";
txt +="<tr><td><b style='font-size:13px;'>" + titulo[i] + "</b></td></tr>";
if (subtitulo[i] == '' ){ txt+="<tr><td></td></tr>"; } else { txt +="<tr><td><b>" + subtitulo[i] + "</b></td></tr>"; }
txt +="<tr><td>" + lugar[i];
if (hora[i] == '' ){ txt+="<tr><td></td></tr>"; } else { txt +=", " + hora[i]; }
if (fecha[2] == '' ){ txt +="<tr><td>, hasta " + mes + "</td></tr>"; } else { txt +="<tr><td>, hasta " + fecha[2]+ " de " + mes + "</td></tr>"; } 
/* txt +=", hasta " + fecha[2]+ " de " + mes + "</td></tr>"; */
if (precio[i] == '' ){ txt+="<tr><td></td></tr>"; } else { txt +="<tr><td>" + precio[i] + "</td></tr>"; }
//if (link[i] == '' ){ txt+="<tr><td></td></tr>"; } else { txt +="<tr><td><a href='http://" + link[i] + "' target='_blank'>" + link[i] + "</td></tr>"; }
//if (link2[i] == '' ){ txt+="<tr><td></td></tr>"; } else { txt +="<tr><td><a href='http://" + link2[i] + "' target='_blank'>" + link2[i] + "</td></tr>"; }
txt +="</table></td></tr>";
//txt +="<tr><td colspan='2'><img src='images/imagenLinea.jpg'></td>";

}
txt +="</tr></table>"
document.getElementById("mostrarEventos").innerHTML=txt;
document.getElementById("fechaCalendario").innerHTML=date2;
}

	
