/*
AJAX Request
© 2009 BENRIC Mediengestaltung
*/

function openCalendar(day, month, year, layer, timestamp){
 var xmlHttp = null;
 try {
  // Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
  xmlHttp = new XMLHttpRequest();
 }catch(e){
  try{
   // MS Internet Explorer (ab v6)
   xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
  }catch(e){
   try{
    // MS Internet Explorer (ab v5)
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
   }catch(e){
    xmlHttp  = null;
   }
  }
 }

 if(xmlHttp){
  xmlHttp.open('POST', 'libraries/functions/class_calendar/calendar.script.php');
  xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  
  if(layer=='kalender')
   document.getElementById(layer).style.display = "block"; 
  
  xmlHttp.onreadystatechange = function() {
   if(xmlHttp.readyState != 4){	
	document.getElementById(layer).innerHTML = '<img src="style/images/layout/loading.gif" align="center" style="margin:15px auto;" alt="ladebalken" />';
   }else if ((xmlHttp.readyState == 4) && (xmlHttp.status == 200)) {
    document.getElementById(layer).innerHTML = xmlHttp.responseText;
   }else{
    document.getElementById(layer).innerHTML = '<img src="style/images/layout/loading.gif" align="center" style="margin-top:15px;" alt="ladebalken" />';
   }
  };
  xmlHttp.send('day='+day +'&month='+month +'&year='+year +'&layer='+layer +'&timestamp='+timestamp);
 }
}
