function c_communicate(p_aProperties){

  //Default: General properties
  this.url    = window.location.href;
  this.method = 'post';
  this.type   = 'form';
  this.fields = {}
  
  //Default: Ajax-specific properties
  this.onresult      = function(){};
  this.onerror       = function(){};
  this.onstatechange = function(){};
  
  //Load properties from arguments
  for(var t_sPropertie in p_aProperties){
    this[t_sPropertie] = p_aProperties[t_sPropertie];
  }
  
  this.f_send = function(){
    if(this.type == 'form'){
      this.f_sendForm();
    }
    else if(this.type == 'ajax'){
      this.f_sendAjax();
    }
  }
  
  this.f_sendForm = function(){
    var t_oForm = document.createElement('form');
    t_oForm.action = this.url;
    t_oForm.method = this.method;
    t_oForm.style.display = 'none';
    
    for(var i in this.fields){
      var t_oInput   = document.createElement('input');
      t_oInput.type  = 'hidden';
      t_oInput.name  = i;
      t_oInput.value = this.fields[i];
      t_oForm.appendChild(t_oInput);
    }
    document.body.appendChild(t_oForm);
    t_oForm.submit();
  }
  
  this.f_sendAjax = function(){
    this.method = this.method.toUpperCase();
    var w_oHttpRequest                = this._f_ajaxGetObject();
    var w_sData                       = this._f_ajaxGetData();
    w_oHttpRequest._onresult          = this.onresult;
    w_oHttpRequest._onerror           = this.onerror;
    w_oHttpRequest._onstatechange     = this.onstatechange;
    w_oHttpRequest.communicate        = this;
    w_oHttpRequest.onreadystatechange = function(){
      if(this.readyState == 4){
        if (this.status == 200) {
            if(this.getResponseHeader("Content-Type") == 'text/json'){
              try{
                this.responseJSON = eval('('+this.responseText+')');
              }
              catch(e){
                this.responseJSON = false;
              }
            }
            this._onresult();
        } else {
            this._onerror();
        }
      }
      else{
        this._onstatechange();
      }
    };
    w_oHttpRequest.open(this.method, this.url+(this.method == 'GET' ? '?' + w_sData : ''), true);
    w_oHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    w_oHttpRequest.send((this.method == 'POST' ? w_sData : null));
  }

  this._f_ajaxGetObject = function(){
    var w_oHttpRequest; 
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
      w_oHttpRequest = new XMLHttpRequest();
      if (w_oHttpRequest.overrideMimeType) {
        w_oHttpRequest.overrideMimeType('text/xml');
      }
    }
    else if(window.ActiveXObject) { // IE
      try {
          w_oHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
      } 
      catch (e) {
          try {
              w_oHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
          } 
          catch (e) {}
      }
    }
    return w_oHttpRequest;
  }
  
  this._f_ajaxGetData = function(){
    var r_aData = [];
    for(var i in this.fields){
      r_aData[r_aData.length] = i + '=' + this.fields[i];
    }
    return r_aData.join('&');
  }
}

