function ajax2(ajax_object)
{
  // BEISPIELAUFRUF:
  // ajax2(
  //   {
  //     url:'test2.txt', // MUSS
  //     cont_id:'mein_div', // optional
  //     add:'front', // optional. "back" oder "front", wenn NICHT mitgeliefert, wird NICHT angehängt!
  //     loader:'fa', // optional. "fa" für FontAwesome, "default" für MBSol-Grafik oder eigene URL
  //     loader_size:'10%' // optional.
  //   }
  // );


  if(!ajax_object.url)return console.log("ajax2: no url given!");

  // Options Standard-Werte:
  var url=ajax_object.url;
  var anhaengen=0;
  var cont_id="";
  var loader_fontawesome='<div style="width:100px;margin:auto;font-size:100px;"><i class="fa fa-spinner fa-spin fa-fw"></i></div>';
  var loader_size="50%";
  var loader_default="<center class=loader><img src=\"https://mbsol.de/libs/loader.gif\" width="+loader_size+"></center>";

  // Options auslesen (und überschreiben)
  if(ajax_object.cont_id)cont_id=ajax_object.cont_id;

  if(ajax_object.add=="front")anhaengen=1;
  if(ajax_object.add=="back")anhaengen=2;

  if(ajax_object.loader)
  {
    if(ajax_object.loader=="default")loader=loader_default;
    else if(ajax_object.loader=="fa")loader=loader_fontawesome;
    else{loader=ajax_object.loader;} // Custom-URL!

    if(ajax_object.loader_size && ajax_object.loader!="fa")loader=loader.replace(/width=(.*)>/,"width="+ajax_object.loader_size+">");
  }
  else
  {
    loader="";
  }
  // Ende Options

  console.log('Ajax2:Lade: '+url);

  if(cont_id)
  {
    if(_(cont_id))
    {
      // if(anhaengen==0 && loader!="")_(cont_id).innerHTML = loader;
      if(anhaengen==0)_(cont_id).innerHTML = loader;
      _z(cont_id);
      console.log('Ajax2:in div: '+cont_id);
    }
    else
    {
      console.log("Ajax2:Layer "+cont_id+" existiert nicht!");
    }
  }

  // Erstellen des Requests
  var req = null;

  try {
    req = new XMLHttpRequest();
  } catch (ms) {
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (nonms) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        req = null;
      }
    }
  }

  //if(req == null)alert("Error creating request object!");

  //anfrage erstellen (method,url,asynchron)
  req.open("GET", url, true);

  //Beim Abschließen des request wird diese Funktion ausgeführt
  req.onreadystatechange = function()
  {
    //console.log("Ajax:State:",req.readyState,req.status);

    if(req.status==200)
    {
      if(req.readyState==4)
      {
        // dann ist er Fertig.
        // Führe dann alle JS darin aus:
        var script = "";
        var scripts = "";

        scripts = req.responseText.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function() {
          if (scripts !== null)
          {
            //bindet die gefundenen inhalte an eine Vairable
            script += arguments[1] + "\n";
          }
        });
        //if(script)(window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
        if (script)
        {
          eval(script);
        }

        //schreibe die Antwort in den div container mit der id, FALLS er existiert!
        if(cont_id)
        {
          if(_(cont_id))
          {
            if(anhaengen==2) //back
            {
              _(cont_id).insertAdjacentHTML('beforeend', req.responseText);
              // mögliche Positionen: beforebegin, afterbegin, beforeend, afterend
              console.log("Ajax2: hänge HINTEN an!");
            }
            if(anhaengen==1) //front
            {
              _(cont_id).insertAdjacentHTML('afterbegin', req.responseText);
              console.log("Ajax2: hänge DAVOR!");
            }
            if(anhaengen==0)
            {
              _(cont_id).innerHTML = req.responseText;
            }
          }
        }
      }
    }
    else
    {
      console.log('Ajax2:Fehler Status:'+req.status);
    }
  }
  req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-2");
  req.send(null);
}


function ajax(ajax_cont_id, ajax_url, options)
{
  // Options Standard-Werte:
  var anhaengen=0;
  loader_fontawesome='<div style="width:100px;margin:auto;font-size:100px;"><i class="fa fa-spinner fa-spin fa-fw"></i></div>';
  loader_size="50%";
  loader="<center class=loader><img src=\"https://mbsol.de/libs/loader.gif\" width="+loader_size+"></center>";

  // Options auslesen (und überschreiben)
  if(typeof(options)=="object")
  {
    if(options.anhaengen==1)anhaengen=1;
    if(options.loader=="fa")loader=loader_fontawesome;
    if(options.loader_custom)loader=options.loader_custom;
    if(options.loader==0)loader="";
    if(options.loader_size)loader=loader.replace(/width=(.*)>/,"width="+options.loader_size+">");
  }
  if(typeof(options)=="number")
  {
    // vorher wurde "anhaengen" als drittes Argument (Zahl) mitgegeben mit 1 oder 0:
    if(options==1)anhaengen=1;
  }
  // Ende Options

  console.log('Ajax:Lade: '+ajax_url);

  if (_(ajax_cont_id))
  {
//    if (_(ajax_cont_id).style.display == "none" || _(ajax_cont_id).style.display == "")
//    {
//       _(ajax_cont_id).style.display = "block";
//    }
    zeigen(ajax_cont_id);

//    if(anhaengen!=1 && loader!="")_(ajax_cont_id).innerHTML = loader;
    if(anhaengen!=1)_(ajax_cont_id).innerHTML = loader;

    //erstellen des requests
    var req = null;

    try {
      req = new XMLHttpRequest();
    } catch (ms) {
      try {
        req = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (nonms) {
        try {
          req = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (failed) {
          req = null;
        }
      }
    }

    //if(req == null)alert("Error creating request object!");

    //anfrage erstellen (method,url,asynchron)
    req.open("GET", ajax_url, true);

    //Beim Abschließen des request wird diese Funktion ausgeführt
    req.onreadystatechange = function()
    {
      //console.log("Ajax:State:",req.readyState,req.status);

      if(req.status==200)
      {
        if(req.readyState==4)
        {
          // dann ist er Fertig.
          // Führe dann alle JS darin aus:
          var script = "";
          var scripts = "";

          scripts = req.responseText.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function() {
            if (scripts !== null)
            {
              //bindet die gefundenen inhalte an eine Vairable
              script += arguments[1] + "\n";
            }
          });
          //if(script)(window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
          if (script)
          {
            eval(script);
          }

          //schreibe die Antwort in den div container mit der id
          if(anhaengen==1)
          {
            _(ajax_cont_id).insertAdjacentHTML('beforeend', req.responseText);
            // mögliche Positionen: beforebegin, afterbegin, beforeend, afterend
            // console.log("hänge an!");
          }
          else
          {
            _(ajax_cont_id).innerHTML = req.responseText;
          }
        }
      }
      else
      {
        console.log('Ajax:Fehler Status:'+req.status);
      }
    };
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-2");
    req.send(null);
  }
  else
  {
    console.log("Ajax:Layer "+ajax_cont_id+" existiert nicht!");
  }
}
