function calendar_show(year ,month) {
  http.open("GET", "/calendar.php?y="+year+"&m="+month, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('calendario').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function calendar_next() {
	month = month + 1;
	if (month > 12) { month = 1; year = year + 1; }
	document.getElementById('loading').style.display = 'block';
	calendar_show(year, month);
}
function calendar_prev() {
	month = month - 1;
	if (month < 1) { month = 12; year = year - 1; }
	document.getElementById('loading').style.display = 'block';
	calendar_show(year, month);
}
function calendar_actual() {
	month = actual_month;
	year = actual_year;
	document.getElementById('loading').style.display = 'block';
	calendar_show(year, month);
}
function init()
{
	// quit if this function has already been called
	if (arguments.callee.done) return;
	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;
	// create the "page loaded" message

	if(navigator.appName == "Microsoft Internet Explorer")
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	} else
	{
		http = new XMLHttpRequest();
	} 
	calendar_show(year,month);
};

   /* for Mozilla */
   if (document.addEventListener) {
       document.addEventListener("DOMContentLoaded", init, false);
   }

   /* for Internet Explorer */
   /*@cc_on @*/
   /*@if (@_win32)
       document.write("<script defer src=ie_onload.js><"+"/script>");
   /*@end @*/

   /* for other browsers */
   window.onload = init;
