
  function createXMLHttpRequest()
  {
    try
    {
      return new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {}

    try
    {
      return new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)
    {}

    try
    {
      return new XMLHttpRequest();
    }
    catch(e)
    {}

    alert('XMLHttpRequest not supported');
    return null;
  }

  var xmlHTTP = createXMLHttpRequest();

  function calendar(rok, mesic)
  {
    if (xmlHTTP.readyState == 4 || xmlHTTP.readyState == 0)
    {
      xmlHTTP.open('GET',  '/rpc/cal.php?rok=' + decodeURIComponent(rok) + "&mesic=" + decodeURIComponent(mesic), true);
      xmlHTTP.onreadystatechange = calendarResponse;
      xmlHTTP.send(null);
    }
    else
    {
      setTimeout('calendar(' + rok + ', ' + mesic + ')', 1000);
    }
  }

  function calendarResponse()
  {
    if (xmlHTTP.readyState == 4 && xmlHTTP.status == 200)
    {
      var div = document.getElementById('dCalendar');
      div.innerHTML = xmlHTTP.responseText;
    }
    else
    {
      //alert(xmlHTTP.readyState + ' ' + xmlHTTP.status);
    }
  }

  function den(datum)
  {
      document.getElementById('datum').value=datum;
      document.getElementById('formular-mapa').submit();

  }

  function denResponse()
  {
    if (xmlHTTP.readyState == 4 && xmlHTTP.status == 200)
    {
      var div = document.getElementById('dHodiny');
      div.innerHTML = xmlHTTP.responseText;
    }
    else
    {
      //alert(xmlHTTP.readyState + ' ' + xmlHTTP.status);
    }
  }

