BrowserVersion = navigator.appName; /* Eigentlich in der loader.js, aber hier brauchen wir einen extra Switch für Opera ;) */

/* Variablen, die den reinzuladenden Source beeinflussen */
if( typeof(tag) != 'undefined'){
  liga_spieltag = tag;
}
target_path_3 = '/' + lang + '/' + liga + '/matches/'; /* Red. Artikel */
if(liga == 'liga'){
  liga        = 'bundesliga';
  swf_liga    = 'mbl';
  spieltag    = liga_spieltag;
  liga_path   = "liga";
  ticker_link = "dfl_fb_mbl";
}else{
  liga        = 'zweiteBundesliga';
  swf_liga    = 'mbl2';
  spieltag    = liga2_spieltag;
  liga_path   = "liga2";
  ticker_link = "dfl_fb_mbl2";
}

/* Texte für den Terminstatus */

extension = '.html';
extension2 = '.php';
target_window = 'sv2';
initial_value_1 = 'p1/' + spieltag;
target_path_1 = '/data/fmt/html/v/roundMenu/lang/' + lang + '/s/soccer/c/' + liga + '/h/all'; /* Dropdown */
target_path_2 = '/data/fmt/html/v/fixturesAndResults/lang/' + lang + '/s/soccer/c/' + liga + '/h/all/'; /* Übersicht */
target_path_4 = '/data/fmt/html/v/roundFixtureHeading/lang/' + lang + '/s/soccer/c/' + liga + '/h/all/p1/'; /* Aktueller Spielstand */
target_path_5 = '/data/fmt/html/v/roundFixtureHeading/lang/' + lang + '/s/soccer/c/' + liga + 'Relegation'; /* Aktueller Spielstand Relegation */

/**
 * Changes Marco Sanna 11.09.2009: Load tab navigation and
 * tooltip script
 */
if (jahr > 2009) {
  target_path_tab_days = '/inc/spieltage/spieltags_reiter.php';
} else {target_path_tab_days = '/inc/spieltage/spieltags_reiter_leer.php';  }
/****/

/**
 * Builds an attribute, returns it
 * to the calling element
 *
 * @param type the type of the attribute
 * @param the attribute value
 */
function buildAttribute(type, value) {
  var at = document.createAttribute(type);
  at.nodeValue = value;
  return at;
}

// try to load /js/spielplan_legenden.js
if ( (typeof(addLegend)!='object') || (addLegend.length==0) &&
     (typeof(legend)!='object') || (legend.length==0) ) {

  // js data array seems not to be loaded; try to load it now...
  fileref=document.createElement('script');
  fileref.setAttribute('type','text/javascript');
  fileref.setAttribute('src','/js/spielplan_legenden.js');
  document.getElementsByTagName("head")[0].appendChild(fileref);
}

var CBID = 123;
var CB_TABS_CONF = {};
CB_TABS_CONF["id_"+CBID] = {
    "style" : "std"
};

var CB_TABS = {};

function menuChanged(value) {
    // remove old cardbox if exists
    var container = document.getElementById("cb_container_"+CBID);
    if (container != null) {
        while (container.firstChild != null) container.removeChild(container.firstChild);
    }

    retrieveURL(target_path_2 + value + extension, target_window, 'parseLINKS', value);
    /**
     * Changes Marco Sanna 11.09.2009
     * rebuild the tab navigation
     */
     retrieveURL(target_path_tab_days + '?d=' + value.substring(value.indexOf("/") + 1) + '&url=' + escape('javascript:return menuChanged("p1/~url~", "roundMenuSelect")') + '&f=true&c=false', 'spieltag_reiter', 'changeMenue');
    /*****/
}

function spieltag_cb_update_tabs(data) {
    var tabs = [0, 2];
    for(index in data) {
        if (data[index]) {
            cb_activate(CBID, tabs[index]);
        }
    }
}

/* Spieltag via AJAX darstellen */
function get_spieltag(mywas, mytag, myomi){
    var opta_saison = "s"+jahr;
    if (jahr < 2008) {
        opta_saison = "s"+(jahr-1999);
    }

 /* Wir schalten gezielt den onSports-Banner (im Footer des Spieltagskastens) wieder aus, da
    wir uns nichtmehr auf der Spieltagsuebersichtsseite befinden */
 
    if(document.getElementById('banner_footer_spieltag')) {
        bannerziel = document.getElementById('banner_footer_spieltag');
        bannerziel.innerHTML = '<img src="/pics/gra_footer_linie_5spaltig.gif" id="bild" border="0" height="10" width="788" alt=""><br />';
    }

  /* Wir schalten gezielt den onSports-Skyscraper sichtbar, da wir uns nichtmehr auf der 
    Spieltagsuebersichtsseite befinden. */
    if (document.getElementById('on_sport_banner')) {
        document.getElementById('on_sport_banner').style.display = 'block'; 
    }

    // prepare hook for cardbox
    var content = document.getElementById("sv2");
    while (content.firstChild != null) content.removeChild(content.firstChild);

    var leiste = document.createElement("div");
    leiste.id = "leiste";
    content.appendChild(leiste);

    var cb_container = document.createElement("div");
    cb_container.id = "cb_container_"+CBID;
    content.parentNode.appendChild(cb_container);

    // set tabs
    CB_TABS["id_"+CBID] = [];
    if (lang == "de") {
      CB_TABS["id_"+CBID].push({
          name    : "prereport",
          label   : "Vorbericht",
          active  : false,
          first   : mywas == "v",
          type    : "url",
          source  : "/"+lang+"/"+liga_path+"/matches/"+jahr+"/"+mytag+"/v"+myomi+".php"
      });

      CB_TABS["id_"+CBID].push({
          name    : "ticker",
          label   : "Live-Ticker/Liga-Radio",
          active  : true,
          first   : false,
          type    : "popup",
          source  : "http://ticker.bundesliga.de/ticker/"+ticker_link+"/html_php/ticker_"+lang+"_"+myomi+".html",
          params  : "width=750, height=690"
      });

      CB_TABS["id_"+CBID].push({
          name    : "report",
          label   : "Spielbericht",
          active  : false,
          first   : mywas == "b",
          type    : "url",
          source  : "/"+lang+"/"+liga_path+"/matches/"+jahr+"/"+mytag+"/b"+myomi+".php"
      });

      CB_TABS["id_"+CBID].push({
          name    : "analyse",
          label   : "Analyse",
          active  : true,
          first   : mywas == "a",
          type    : "url",
          source : "/data/flash/dynamic/analysis/html_php/analyse.php?language="+lang+"&feed=dynamic&competition="+swf_liga+"&&event_id="+myomi+"&modul_id=akt_gmd6&season_id="+opta_saison
      });

      CB_TABS["id_"+CBID].push({
          name    : "gallery",
          label   : "Bildergalerie",
          active  : true,
          first   : false,
          type    : "popup",
          source  : "/"+lang+"/bildergalerie.php?file="+escape("/de/"+liga_path+"/matches/"+jahr+"/"+mytag+"/galerie.xml"),
          params  : "width=728, height=657"
      });
    } else {

      CB_TABS["id_"+CBID].push({
          name    : "report",
          label   : "Live-Ticker",
          active  : true,
          first   : false,
          type    : "popup",
          source  : "http://ticker.bundesliga.de/ticker/"+ticker_link+"/html_php/ticker_"+lang+"_"+myomi+".html",
          params  : "width=750, height=690"
      });

      CB_TABS["id_"+CBID].push({
          name    : "report",
          label   : "Details",
          active  : true,
          first   : mywas == "a",
          type    : "url",
          source : "/data/flash/dynamic/analysis/html_php/analyse.php?language="+lang+"&feed=dynamic&competition="+swf_liga+"&&event_id="+myomi+"&modul_id=akt_gmd6&season_id="+opta_saison
      });
      
    }

    // display card box
    cb_create(CBID);
    if (typeof(CB_TABS["id_"+CBID][2]) != "undefined") {
      xhr_get("/inc/check_url.php?urls[0]="+CB_TABS["id_"+CBID][0].source+"&urls[1]="+CB_TABS["id_"+CBID][2].source);
    }

    if ( mytag > 34 ) {
      // Relegation
      retrieveURL(target_path_5 + '/omi/' + myomi + extension, 'leiste');
    } else {
      retrieveURL(target_path_4 + mytag + '/omi/' + myomi + extension, 'leiste');
    }
}

/* Callback Funktion
   Achtung, closelink schlisst zum Teil den JS Aufruf
*/
function parseLINKS(req, my_id, optional_var){
	
	var browserName=navigator.appName; 
	var browserVer=parseInt(navigator.appVersion); 
	
  tag = optional_var.split('/');
  tag = tag[1];
  if(req.readyState == 4) {
    /* OK response */
    if(req.status == 200) { 
      /* DOM Struktur auslesen */
      var bereich = document.getElementById(target_window);
      var ziel = bereich.getElementsByTagName("tr");
      
      /* HTML bzw. Text Datei direkt ausgeben */
      document.getElementById(my_id).innerHTML = req.responseText;
      
      /**
       * Changes Marco Sanna 14.09.2009
       * Display Table Headlines, if german fixtures
       */
       if (lang == "de") {
        var thead = bereich.getElementsByTagName("th");
        //Bericht
        thead[thead.length - 1].innerHTML = "Bericht";
        //Analyse        
        var el = document.createElement('th');
        el.innerHTML = "Analyse";
        el.setAttributeNode(buildAttribute('class', 'tn07Small'));
        bereich.getElementsByTagName("tr")[0].appendChild(el);
        //Video        
        el = document.createElement('th');
        el.innerHTML = "Video";
        el.setAttributeNode(buildAttribute('class', 'tn07Small'));
        bereich.getElementsByTagName("tr")[0].appendChild(el);
        //Audio        
        el = document.createElement('th');
        el.innerHTML = "Audio";
        el.setAttributeNode(buildAttribute('class', 'tn07Small'));
        bereich.getElementsByTagName("tr")[0].appendChild(el);
      } else {
        //englische Analyse
        var thead = bereich.getElementsByTagName("th");
        thead[thead.length - 1].innerHTML = "Details";        
      }
      
      //Define icons, former: links[tag][names]['text']
      var iconBericht = '<img src="/pics/spieltag/bericht.gif" alt="" />';
      var iconAnalyse = '<img src="/pics/spieltag/analyse.gif" alt="" />';
      var iconAnalyseGrey = '<img src="/pics/spieltag/analyse_off.gif" alt="" />';
      
      /****/
      
      /* cycle */
      for (var i = 1; i < ziel.length; i++) {
        
        if(Browser == "WINDOOF"){
          var names = ziel[i].lastChild.id;
        }else if(Browser == "MSIE7"){
          var names = ziel[i].lastChild.id; 
				}else if(Browser == "MSIE8"){
          var names = ziel[i].lastChild.id;          
        }else if(BrowserVersion == "Opera"){
          var names = ziel[i].lastChild.id;
        }else{
        	if (browserName == "Microsoft Internet Explorer" && browserVer == "4") {
        	var names = ziel[i].lastChild.id;	
        		} else {
        			var names = ziel[i].lastChild.previousSibling.id;	
        			}
        }
        /* Abfrage */
        //--------
        //add english analysis graphics
        //Add analysis link, if 15 minutes after kickoff
        //gather date
        var kickOffDate = ziel[i].getElementsByTagName('td')[0].innerHTML;
        var kickOffTime = ziel[i].getElementsByTagName('td')[1].innerHTML;
        //modify dates
        //day
        var koDay = kickOffDate.substr(0,2);
        if (koDay.indexOf("0") == 0) {
          koDay = koDay.substr(1,1);
        }
        //month
        var koMonth = kickOffDate.substr(3,2);
        if (koMonth.indexOf("0") == 0) {
          koMonth = koMonth.substr(1,1);
        }
        //year
        var koYear = "20" + kickOffDate.substr(6,2);
        //set time
        var koHour = kickOffTime.substr(0,2);
        if (koHour.indexOf("0") == 0) {
          koHour = koHour.substr(1,1);
        }
        var koMinutes = kickOffTime.substr(3,2);
        if (koMinutes.indexOf("0") == 0) {
          koMinutes = koMinutes.substr(1,1);
        }
        //combine
        var tmpDate = new Date();
        tmpDate.setDate(koDay);
        tmpDate.setMonth(parseInt(koMonth) - 1);
        tmpDate.setFullYear(koYear);
        tmpDate.setHours(koHour);
        tmpDate.setMinutes(koMinutes);
        tmpDate.setSeconds(0);
        tmpDate.setMilliseconds(0);
        //check the date: if 15 minutes after kickoff, don't display
        var koTime = tmpDate.getTime() + (1000 * 60 * 15);
        var actTime = new Date();
          
        if (lang == "en") {
          //transform
          var ah = document.createElement('a');
          ah.setAttributeNode(buildAttribute('href', 'javascript:get_spieltag("a", ' + tag + ', ' + names + ');'));
          //class
          ah.setAttributeNode(buildAttribute('class', 'smallTip'));
          //title
          ah.setAttributeNode(buildAttribute('title', 'Details'));
          //over, out, click
          ah.setAttributeNode(buildAttribute('onmousemove', 'moveToolTip(event, this)'));
          ah.setAttributeNode(buildAttribute('onclick', 'removeToolTips()'));
          ah.setAttributeNode(buildAttribute('onmouseout', 'removeToolTips()'));
          //compound
          if (actTime.getTime() >= koTime) {
            ah.innerHTML = iconAnalyse;
            ziel[i].getElementsByTagName('td')[6].appendChild(ah);
          } else {
            ziel[i].getElementsByTagName('td')[6].innerHTML = iconAnalyseGrey;
          }
        }
        if( typeof(links) != 'undefined'){
          if( typeof(links[tag]) != 'undefined' ){
            if(typeof(links[tag][names]) != 'undefined' && typeof( links[tag][names]['href'] ) != 'undefined'){
              /* der Array ist definiert, und die Kinder sind nicht leer */
              if(Browser == "WINDOOF" || Browser == "MSIE7" || BrowserVersion == "Opera" || 
                (browserName == "Microsoft Internet Explorer" && browserVer == "4")){
                ziel[i].lastChild.innerHTML = '<a href="'+links[tag][names]['href']+'\''+tag+'\''+','+names+closelink+'" class="smallTip" onmousemove="moveToolTip(event, this)" onmouseout="removeToolTips()" onclick="removeToolTips()" title="'+links[tag][names]['text']+'">'+iconBericht+'</a>';
              } else {
              	ziel[i].lastChild.previousSibling.innerHTML = '<a href="'+links[tag][names]['href']+'\''+tag+'\''+','+names+closelink+'" class="smallTip" title="'+links[tag][names]['text']+'" onclick="removeToolTips()" onmousemove="moveToolTip(event, this)" onmouseout="removeToolTips()">'+iconBericht+'</a>';	
              }
            }else{
              /* wenn ein Array definiert, aber die Kinder leer sind */
              if(Browser == "WINDOOF" || Browser == "MSIE7" || BrowserVersion == "Opera" || 
                (browserName == "Microsoft Internet Explorer" && browserVer == "4")){
                ziel[i].lastChild.innerHTML = '<a href="'+links[0]['nothing']['href']+'\''+tag+'\''+','+names+closelink+'" class="smallTip" title="'+links[0]['nothing']['text']+'">'+iconBericht+'</a>';
              } else {
              	ziel[i].lastChild.previousSibling.innerHTML = '<a href="'+links[0]['nothing']['href']+'\''+tag+'\''+','+names+closelink+'" class="smallTip" title="'+links[0]['nothing']['text']+'">'+iconBericht+'</a>';	
              }
            }
            prepareCells(ziel[i]);
            //Add analysis link, same as english version: look for the 15 minute thing
            //--------  
            var ah = document.createElement('a');
            ah.setAttributeNode(buildAttribute('href', 'javascript:get_spieltag("a", ' + tag + ', ' + names + ');'));
            //class
            ah.setAttributeNode(buildAttribute('class', 'smallTip'));
            //title
            ah.setAttributeNode(buildAttribute('title', 'Analyse'));
            //over, out, click
            ah.setAttributeNode(buildAttribute('onmousemove', 'moveToolTip(event, this)'));
            ah.setAttributeNode(buildAttribute('onclick', 'removeToolTips()'));
            ah.setAttributeNode(buildAttribute('onmouseout', 'removeToolTips()'));
            //compound          
            if (actTime.getTime() >= koTime) {
              ah.innerHTML = iconAnalyse;
              ziel[i].getElementsByTagName('td')[7].appendChild(ah);
            } else {
              ziel[i].getElementsByTagName('td')[7].innerHTML = iconAnalyseGrey;
            }
          } else {
            prepareCells(ziel[i]);
          }
        } else {
          prepareCells(ziel[i]);
        }
      }
      // Erst beim zweiten Mal IVW holen
      if (!window.IVWAlreadyLoaded) {
        window.IVWAlreadyLoaded = 1;
      } else {
        ivw_get();
      }
    }
    /* Legende füllen */  
    generateLegende(optional_var, my_id);
    //add table cells for video and audio
    var matchday = tag;
    if (matchday < 10) matchday = "0" + matchday;
    if (lang == "de") {
      retrieveURL('/js/flv_video_cache/omi_related_video_cache_md' + matchday + '.inc.js', 'videoScript', 'attachVideo');
      retrieveURL('/js/audionews_cache/matchday_' + matchday + '.inc.js', 'audioScript', 'attachAudio');
    }    
  }
}

/**
 * Writes request content to page
 */
function attachVideo(req, id, optional) {  
  if(req.readyState == 4) {
    /* OK response */
    if(req.status == 200) { 
      eval(req.responseText);
      var iconVideo = '<img src="/pics/spieltag/video.gif" alt="" />';
      var iconAudio = '<img src="/pics/spieltag/radio.gif" alt="" />';
      //cycle the tr's, filter omis and check for audio news      
      var bereich = document.getElementById(target_window);
      var ziel = bereich.getElementsByTagName("tr");
      for (var i = 1; i < ziel.length; i++) {
        //get omi
        var omi = ziel[i].className;
        omi = omi.substr(omi.indexOf("_") + 1);
        //check in the audio array for that omi
        if (typeof(video_cache[omi]) != "undefined") {
          //some sort of information does exist
          var ah = document.createElement('a');
          //class
          ah.setAttributeNode(buildAttribute('class', 'smallTip'));
          //type
          if (typeof(video_cache[omi]["n"]) != "undefined") {
            //it is a post report
            //title
            ah.setAttributeNode(buildAttribute('title', 'Spielbericht'));
            //link
            ah.setAttributeNode(buildAttribute('href', video_cache[omi]["n"]["deeplink"]));
          } else if(typeof(video_cache[omi]["v"]) != "undefined"){
            //check for prereport
            //title
            ah.setAttributeNode(buildAttribute('title', 'Vorbericht'));
            //link
            ah.setAttributeNode(buildAttribute('href', video_cache[omi]["v"]["deeplink"]));
          } else {
            //title
            ah.setAttributeNode(buildAttribute('title', 'Sonstiges'));
            //link
            ah.setAttributeNode(buildAttribute('href', video_cache[omi]["s"]["deeplink"]));
          }
          //over, out, click
          ah.setAttributeNode(buildAttribute('onmousemove', 'moveToolTip(event, this)'));
          ah.setAttributeNode(buildAttribute('onclick', 'removeToolTips()'));
          ah.setAttributeNode(buildAttribute('onmouseout', 'removeToolTips()'));
          //compound
          ah.innerHTML = iconVideo;
          ziel[i].getElementsByTagName('td')[8].appendChild(ah);
        }
      }
    }
  }
}

/**
 * Writes request content to page
 */
function attachAudio(req, id, optional) {  
  if(req.readyState == 4) {
    /* OK response */
    if(req.status == 200) { 
      eval(req.responseText);
      var iconVideo = '<img src="/pics/spieltag/video.gif" alt="" />';
      var iconAudio = '<img src="/pics/spieltag/radio.gif" alt="" />';
      //cycle the tr's, filter omis and check for audio news      
      var bereich = document.getElementById(target_window);
      var ziel = bereich.getElementsByTagName("tr");
      for (var i = 1; i < ziel.length; i++) {
        //get omi
        var omi = ziel[i].className;
        omi = omi.substr(omi.indexOf("_") + 1);
        //check in the audio array for that omi
        if (typeof(availableAudionews[omi]) != "undefined") {
          //some sort of information does exist
          var ah = document.createElement('a');
          //class
          ah.setAttributeNode(buildAttribute('class', 'smallTip'));
          //over, out, click
          ah.setAttributeNode(buildAttribute('onmousemove', 'moveToolTip(event, this)'));
          ah.setAttributeNode(buildAttribute('onmouseout', 'removeToolTips()'));
          //compound
          ah.innerHTML = iconAudio;
          ziel[i].getElementsByTagName('td')[9].appendChild(ah);
          if (typeof(availableAudionews[omi]["nb"]) != "undefined") {
            //it is a post report
            //title
            ah.setAttributeNode(buildAttribute('title', 'Spielbericht'));
            //link
            ah.setAttributeNode(buildAttribute('href', "javascript:w=window.open('/de/bundesliga-audio/popup_audio_matchday.php?s=" + availableAudionews[omi]["nb"]["fullurl"] + "&i=Spielbericht', 'LIGARADIO', 'width=303, height=168');removeToolTips();"));
          } else {
            //check for prereport
            //title
            ah.setAttributeNode(buildAttribute('title', 'Vorbericht'));
            //link
            ah.setAttributeNode(buildAttribute('href', "javascript:w=window.open('/de/bundesliga-audio/popup_audio_matchday.php?s=" + availableAudionews[omi]["vb"]["fullurl"] + "&i=Vorbericht', 'LIGARADIO', 'width=303, height=168');removeToolTips();"));
          }
        }
      }
    }
  }
}

/**
 * Pushes td's into the existing table
 * @param el the actual table row
 */
function prepareCells(elem) {  
  //Add analysis
  var el = document.createElement('td');
  var at = document.createAttribute('class');
  at.nodeValue = "tn07Small";
  el.setAttributeNode(at);
  elem.appendChild(el);
  //add table cells for video and audio
  var vidCell = document.createElement('td');
  at = document.createAttribute('class');
  at.nodeValue = "tn07Small";
  vidCell.setAttributeNode(at);
  elem.appendChild(vidCell);
  var soundCell = document.createElement('td');
  at = document.createAttribute('class');
  at.nodeValue = "tn07Small";
  soundCell.setAttributeNode(at);
  elem.appendChild(soundCell);
}

function generateLegende(value, my_id){
  // check, whether we have all data that we need...
  if ( (typeof(addLegend)=='object') && (addLegend.length>0) &&
       (typeof(legend)=='object') && (legend.length>0) ) {
    var targetObj = document.getElementById(my_id);
    var roundDisplayed = value.split('/')[1];
    var legendString  = '';
    for (var legendAssignments in addLegend) {
      for (var legendDef in addLegend[legendAssignments] ) {
        if ( addLegend[legendAssignments][legendDef] == roundDisplayed ) {
          if ( (typeof(legend[legendAssignments][lang])!='undefined') && (legend[legendAssignments][lang].length>0) ) {
            legendString += legend[legendAssignments][lang];
    } } } }

    if ( legendString.length > 0 ) {
      targetObj.innerHTML += '<div class="font_13" style="padding: 3px 0px 0px 6px; ">' + legendString + '</div>';
} } }

function generatePDF(value){
  if(pdf[tag]['url'] != ''){
    var myPDF  = '';
    myPDF += '<a href="' + pdf[tag]['url'] + '" target="' + pdf[tag]['target'] + '" class="font_13">';
    myPDF += '  <img src="/pics/_buttons/btn_download.gif" onmouseout="this.src=\'/pics/_buttons/btn_download.gif\'" onmouseover="this.src=\'/pics/_buttons/btn_download_mo.gif\'" style="vertical-align: middle;" />';
    myPDF += '&nbsp;&nbsp;<span class="font_18">Download:</span>&nbsp;&nbsp;Spielplan.pdf ' + pdf[tag]['text'];
    myPDF += '</a>&nbsp;&nbsp;';
  }else{
    var myPDF  = '';
  }
  document.getElementById('footer_legende').innerHTML = myPDF;
}

function changeMenue(req, my_id, optional_var){
  if(req.readyState == 4) {
    /* OK response */
    if(req.status == 200) { 
      /* HTML bzw. Text Datei direkt ausgeben */
      document.getElementById(my_id).innerHTML = req.responseText;
      /* Dropdown vorauswählen */
      //document.forms["roundMenu"].elements["roundMenuSelect"].selectedIndex = (liga_spieltag-1);
    }
  }
}

//onload = function(){
function init_spielplan_now() {

    // check for user desired match day / omi (?mday=...&omi=...)
    var mday = null;
    var url_omi = null;
    var url = document.location.href.split("?");
    if (url.length > 1) {
        var params = url[1].split("&");
        for (var i=0; i<params.length; i++) {
            if (params[i].split("=")[0] == "mday") {
                mday = params[i].split("=")[1];
            }
            if (params[i].split("=")[0] == "OMI") {
                url_omi = params[i].split("=")[1];
            }
        }
    }

    if ((url_omi != null) && (mday != null)) {
        // if mday and omi are given by url, show desired match
        get_spieltag("v", mday, url_omi);

        return; 
    }

  /**
   * Changes Marco Sanna 11.09.2009: Do not load the dropdown,
   * instead display tab-driven days
   */
  //retrieveURL(target_path_1 + '/' + 'p1/1' + extension, 'sv1', 'changeMenue');
  retrieveURL(target_path_tab_days + '?d=' + spieltag + '&url=' + escape('javascript:return menuChanged("p1/~url~", "roundMenuSelect")') + '&f=true&c=false', 'spieltag_reiter', 'changeMenue');
  /*****/
  
  /* Initialisierung */
  if( typeof(omi) != 'undefined' && typeof(tag) != 'undefined' && typeof(active_reiter) != 'undefined' ){
    document.getElementById(target_window).style.display= 'block';
    get_spieltag(active_reiter, tag, omi);
  }else{
    menuChanged(initial_value_1);
    /* Die PDF Datei reinladen */
  }

}


init_spielplan_now();