/*** Hier Content-Loader für die Boxen ***/

// globale Instanz von XMLHttpRequest
var xmlHttp = false;
// XMLHttpRequest-Instanz erstellen
// ... für Internet Explorer
try {
  xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
  try {
    xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
  } catch(e) {
    xmlHttp  = false;
  }
}
// ... für Mozilla, Opera und Safari
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

// Ergebnisse aktualisieren
function getErg( datum, oldDatum ) {
  if( xmlHttp ) {
    xmlHttp.open( 'GET', '/js/getErg.php?date='+datum+'&oldDate='+oldDatum, true );
    xmlHttp.onreadystatechange = function () {
      if ( xmlHttp.readyState == 4 )
        document.getElementById( 'erg' ).innerHTML = xmlHttp.responseText;
    };
    xmlHttp.send( null );
  }
}

// Spielberichte aktualisieren
function getBericht( datum ) {
  if( xmlHttp ) {
    xmlHttp.open( 'GET', '/js/getBericht.php?date='+datum, true );
    xmlHttp.onreadystatechange = function () {
      if ( xmlHttp.readyState == 4 )
        document.getElementById( 'bericht' ).innerHTML = xmlHttp.responseText;
    };
    xmlHttp.send( null );
  }
}

// Spiele aktualisieren
function getGame( datum ) {
  if( xmlHttp ) {
    xmlHttp.open( 'GET', '/js/getGame.php?date='+datum, true );
    xmlHttp.onreadystatechange = function () {
      if ( xmlHttp.readyState == 4 )
        document.getElementById( 'spiel' ).innerHTML = xmlHttp.responseText;
    };
    xmlHttp.send( null );
  }
}

// Turniere aktualisieren
function getTurnier( datum ) {
  if( xmlHttp ) {
    xmlHttp.open( 'GET', '/js/getTurnier.php?date='+datum, true );
    xmlHttp.onreadystatechange = function () {
      if ( xmlHttp.readyState == 4 )
        document.getElementById( 'turnier' ).innerHTML = xmlHttp.responseText;
    };
    xmlHttp.send( null );
  }
}

