
function init_ajax() {
var xmlHttp = false;

// try to create a new instance of the xmlhttprequest object        
try
   {
    // Internet Explorer
   if( window.ActiveXObject )
     {
       for( var i = 5; i; i-- )
         {
           try
              {
                // loading of a newer version of msxml dll (msxml3 - msxml5) failed
                // use fallback solution
                // old style msxml version independent, deprecated
                if( i == 2 )
                {
                    xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );    
                }
                // try to use the latest msxml dll
                else
                {
                    xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
                }
                break;
              }
              catch( excNotLoadable )
              {                        
                  xmlHttp = false;
              }
          }
      }
      // Mozilla, Opera und Safari
      else if( window.XMLHttpRequest )
      {
          xmlHttp = new XMLHttpRequest();
      }
  }
  // loading of xmlhttp object failed
  catch( excNotLoadable )
  {
      xmlHttp = false;
  }
      return xmlHttp;
}


xmlHttp1 = init_ajax(); //für Ticker
xmlHttp3 = init_ajax(); //für aktuellen Satzstand
xmlHttp4 = init_ajax(); //für Aufstellung Heim
xmlHttp5 = init_ajax(); //für Aufstellung Gast

// aktuelle Daten laden
loadData();

// alle xx Sekunden neue Daten holen
setInterval("loadData()",15000);

function loadData()
{
 if (xmlHttp1) {
     xmlHttp1.open('GET', 'getdata.php', true);
     xmlHttp1.onreadystatechange = function () {
         if (xmlHttp1.readyState == 4) {
             document.getElementById("ticker_inner").innerHTML = xmlHttp1.responseText;
         }
     };
     xmlHttp1.send(null);
 }
 if (xmlHttp3) {
     xmlHttp3.open('GET', 'score.php', true);
     xmlHttp3.onreadystatechange = function () {
         if (xmlHttp3.readyState == 4) {
             document.getElementById("satzstand_inner").innerHTML = xmlHttp3.responseText;
         }
     };
     xmlHttp3.send(null);
 }
 if (xmlHttp4) {
     xmlHttp4.open('GET', 'get_lineup_home.php', true);
     xmlHttp4.onreadystatechange = function () {
         if (xmlHttp4.readyState == 4) {
             document.getElementById("aufstellung_inner_heim").innerHTML = xmlHttp4.responseText;
         }
     };
     xmlHttp4.send(null);
 }
 if (xmlHttp5) {
     xmlHttp5.open('GET', 'get_lineup_away.php', true);
     xmlHttp5.onreadystatechange = function () {
         if (xmlHttp5.readyState == 4) {
             document.getElementById("aufstellung_inner_gast").innerHTML = xmlHttp5.responseText;
         }
     };
     xmlHttp5.send(null);
 }
 }
