function handleHttpResponse() {
	if (http.readyState == 4) {
		if (http.responseText.indexOf('invalid') == -1) {
			var response = http.responseXML;
			div=response.getElementsByTagName('div').item(0).firstChild.data;
			if(document.getElementById(div).innerHTML != null){
				document.getElementById(div).innerHTML="";
				document.getElementById(div).innerHTML = response.getElementsByTagName('data').item(0).firstChild.data;
			}
            isWorking = false;
		}
    }
}

var isWorking = false;
function calendario_noticias(fech)
{
    http = new XMLHttpRequest();
    document.getElementById("calendario_noticias").innerHTML = "";
    if (!isWorking && http)
    {
        if (!fech)
        {
            alert("El parametro recibido no es el correcto, si el problema persiste, pongase en contacto con el administrador del sistema");
        }
        else
        {
            var url = "/inc/calendario_noticias.php?date="+fech;
            http.open("GET", url, true);
            http.onreadystatechange = handleHttpResponse;
            isWorking = true;
            http.send(null);
        }
   }
}

function calendario_noticias2(fech){
	
    http = new XMLHttpRequest();
    document.getElementById("calendario_noticias").innerHTML = "";
    if (!isWorking && http)
    {
        if (!fech)
        {
            alert("El parametro recibido no es el correcto, si el problema persiste, pongase en contacto con el administrador del sistema");
        }
        else
        {
            var url = "/inc/calendario_noticias.php?date="+fech;
            http.open("GET", url, true);
            http.onreadystatechange = handleHttpResponse;
            isWorking = true;
            http.send(null);
        }
   }
}


function calendario_conciertos(fech)
{
    http = new XMLHttpRequest();
    document.getElementById("calendario_conciertos").innerHTML = "";
    if (!isWorking && http)
    {
        if (!fech)
        {
            alert("El parametro recibido no es el correcto, si el problema persiste, pongase en contacto con el administrador del sistema");
        }
        else
        {
            var url = "/inc/calendario_conciertos.php?date="+fech;
            http.open("GET", url, true);
            http.onreadystatechange = handleHttpResponse;
            isWorking = true;
            http.send(null);
        }
   }
}

function calendario_conciertos2(fech){
	
    http = new XMLHttpRequest();
    document.getElementById("calendario_conciertos").innerHTML = "";
    if (!isWorking && http)
    {
        if (!fech)
        {
            alert("El parametro recibido no es el correcto, si el problema persiste, pongase en contacto con el administrador del sistema");
        }
        else
        {
            var url = "/inc/calendario_conciertos.php?date="+fech;
            http.open("GET", url, true);
            http.onreadystatechange = handleHttpResponse;
            isWorking = true;
            http.send(null);
        }
   }
}

function calendario_blog(fech)
{
    http = new XMLHttpRequest();
    document.getElementById("calendario_blog").innerHTML = "";
    if (!isWorking && http)
    {
        if (!fech)
        {
            alert("El parametro recibido no es el correcto, si el problema persiste, pongase en contacto con el administrador del sistema");
        }
        else
        {
            var url = "/inc/calendario_blog.php?date="+fech;
            http.open("GET", url, true);
            http.onreadystatechange = handleHttpResponse;
            isWorking = true;
            http.send(null);
        }
   }
}

function calendario_blog2(fech){
	
    http = new XMLHttpRequest();
    document.getElementById("calendario_blog").innerHTML = "";
    if (!isWorking && http)
    {
        if (!fech)
        {
            alert("El parametro recibido no es el correcto, si el problema persiste, pongase en contacto con el administrador del sistema");
        }
        else
        {
            var url = "/inc/calendario_blog.php?date="+fech;
            http.open("GET", url, true);
            http.onreadystatechange = handleHttpResponse;
            isWorking = true;
            http.send(null);
        }
   }
}
