// EVENT_AJAX class
function EVENT_AJAX(i)
  {  
  // the url that should be called
  EVENT_AJAX.prototype._url = "/php/ajax.php?id=";
  // the id of the html element whose content should be replaced by the servers answer
  EVENT_AJAX.prototype._elem = "innen";
  // the id of the html element which should be set visible (can be same als _elem)
  EVENT_AJAX.prototype._outerelem = "aussen";  
  
  // variable to store http_request object
  EVENT_AJAX.prototype._request = false;  
  // variable to store the supplied id of the event
  EVENT_AJAX.prototype._id = i;
  // get a reference to self
  _this = this;
  
  // create http_request object
  EVENT_AJAX.prototype._init = function()
    {
    // create, mozilla-style
    if (window.XMLHttpRequest)
      {
      this._request = new XMLHttpRequest();
      // some mozillas need 'text/xml'
      if (this._request.overrideMimeType)
        {
	this._request.overrideMimeType('text/xml');
	}
      } // end of create, mozilla-style
    // create, IE-style
    else
      {
      try
        {
	// try newer DLL
	this._request = new ActiveXObject("Msxml2.XMLHTTP");
	} // end of outer try
      catch (e)
        {
        try
          {
	  // try older DLL
	  this._request = new ActiveXObject("Microsoft.XMLHTTP");
	  }
        catch (e)
	  {
	  // give up
	  return false;
	  } // end of inner catch
        } // end of outer catch
      } // end of create, IE-style
      
    // set callback function that handles changes of ready state
    this._request.onreadystatechange = function()
      {
      _this._handleReadyState();
      }
    } // end of function init
    
  // handle different ready states of server calls
  // i. e., handle server response
  EVENT_AJAX.prototype._handleReadyState = function()
    {
    // wait for ready state to reach 'complete'
    if (this._request.readyState == 4)
      {
      document.getElementById(this._elem).innerHTML = this._request.responseText;
      delete this._request;
      document.getElementById(this._outerelem).style.display = "block";
      }
    } // end of function _handleReadyState
    
  // do the server call itself
  this._init();
  this._request.open("GET", this._url+this._id, true);
  this._request.send(null);    
      
  } // end of class

