function myAjax()
{ 

	var xmlhttp=false;
	try
	{
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			// Creacion del objet AJAX para IE
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E)
		{
			if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
		}
	}
	return xmlhttp; 
}

function calendario(ruta){

		//creamos objeto ajax 
		var contenedor=document.getElementById("calendario");
		var ajax=myAjax();			
		ajax.open("GET", "../includes/calendario/index_ajax.php"+ruta, true);
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1) {
            	contenedor.innerHTML="<img style='margin:50px 50px 50px 120px' src='../includes/calendario/loading_verde.gif' /> ";
         	}
         	else if (ajax.readyState==4){
                   if(ajax.status==200){
                      contenedor.innerHTML=ajax.responseText;
                   }
                   else if(ajax.status==404)
                                             {

                            contenedor.innerHTML = "La direccion no existe";
                                             }
                                             else
                                             {
                            contenedor.innerHTML = "Error: ".ajax.status;
                                             }
           }                  
		}
		ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.send(null);
}
