var maand,jaar;

function makeHttpRequest(url, callback_function, return_xml)
{
 var http_request, response, i;

 var activex_ids = [
   "MSXML2.XMLHTTP.3.0",
   "MSXML2.XMLHTTP",
   "Microsoft.XMLHTTP"
 ];

 if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+...
   http_request = new XMLHttpRequest();
   if (http_request.overrideMimeType) {
     http_request.overrideMimeType("text/xml");
   }
 } else if (window.ActiveXObject) { // IE6 and older
   for (i = 0; i < activex_ids.length; i++) {
     try {
       http_request = new ActiveXObject(activex_ids[i]);
     } 
	 catch (e) {}
   }
 }

 if (!http_request) {
   alert("Unfortunately your browser doesn’t support this feature.");
   return false;
 }

 http_request.onreadystatechange = function() {
   if (http_request.readyState !== 4) {
       return;
   }
   if (http_request.status !== 200) {
     // ready, but not OK
     alert("There was a problem with the request.(Code: " + http_request.status + ")");
     return;
   }
   if (return_xml) {
     response = http_request.responseXML;
   } else {
     response = http_request.responseText;
   }
   // invoke the callback
   callback_function(response);
 };

 http_request.open("GET", url, true);
 http_request.send(null);
}

function set_date(month, year){
	maand = month;
	jaar = year;
}

function show_kal(str){
	maand = maand + str;
	if(maand>12){
		maand = 1;
		jaar = jaar + 1;
	}
	else if(maand <1){
		maand = 12;
		jaar = jaar - 1;
	}
	makeHttpRequest("/agenda.php?maand="+maand+"&jaar="+jaar,show_stuff);
}

function show_stuff(text){
	document.getElementById("kalender").innerHTML = text;
}