function InsertScreenshotStuff () {
var iScreenshot = 0;
var iWidth = 0;
var sGameTitle = document.getElementById('GameLogoOrBoxart').title;

  for (var i = 0; i <= document.getElementById('ScreenshotsOfGame').childNodes.length -1; i++)
    if (document.getElementById('ScreenshotsOfGame').childNodes[i].tagName == 'img' ||
        document.getElementById('ScreenshotsOfGame').childNodes[i].tagName == 'IMG')
      {
      if (iWidth == 0)
        iWidth = parseInt(document.getElementById('ScreenshotsOfGame').childNodes[i].width);

      iScreenshot++;
      document.getElementById('ScreenshotsOfGame').childNodes[i].alt = sGameTitle + ', Screenshot #' + iScreenshot;
      document.getElementById('ScreenshotsOfGame').childNodes[i].title = document.getElementById('ScreenshotsOfGame').childNodes[i].alt;
      }

  if (bIsUsingCookies == true)
    if (LoadSettingFromCookie('mpde_hidden_treasures_double_screenshotsmargin', 'no') == 'yes')
      {
      document.getElementById('ScreenshotsOfGame').style.width = ((iWidth *2) + 25) + 'px';
      document.getElementById('ScreenshotsOfGame').style.textAlign = 'left';
      }
}

function ShowPlatformFilterHeadline (cObject) {
   document.getElementById('PlatformFilterHeadline').innerHTML = sHeadlineString + '<br />' + cObject.firstChild.alt;
}

function HidePlatformFilterHeadline () {
   document.getElementById('PlatformFilterHeadline').innerHTML = sHeadlineString + '<br />' + sPlatformString;
}

function CountContentLength () {
  if (IsBrowsingOffline() == true)
    document.title = document.title + ' - ' + document.getElementById('GameLogoOrBoxart').parentNode.innerHTML.length + ' Zeichen';
  }

function CountRatedProducts (sShowOnlyForSpecificPlatform) {
var j = 0;
var sString = '@';

// NUR EINE BESTIMMTE PLATTFORM ANZEIGEN --- ANFANG!
  if (bIsUsingCookies == true)
    if (document.getElementById(sShowOnlyForSpecificPlatform) == null)
      sShowOnlyForSpecificPlatform = '_ALL_';

  if (bIsUsingCookies == true)
    {
    sPlatformString = '<span class="highlighted">' + document.getElementById(sShowOnlyForSpecificPlatform).firstChild.alt + '</span>';
    document.getElementById(sShowOnlyForSpecificPlatform).lastChild.className = 'bordered';
    }

  if (sShowOnlyForSpecificPlatform != '_ALL_')
    {
    var aTitles = new Array();
    var cOL = document;

    for (var i = 0; i <= document.getElementsByTagName('tr').length -1; i++)
      {
      cOL = document.getElementsByTagName('tr')[i];

      if (cOL.className == 'hiddentreasures')
        if (String(cOL.id) != '')

        if (String(cOL.id).indexOf(sShowOnlyForSpecificPlatform) == -1)
          aTitles[aTitles.length] = cOL.id;
      }

      if (aTitles.length > 0)
        for (var i = 0; i <= aTitles.length -1; i++)
          {
          cOL = document.getElementById(aTitles[i]).parentNode;
          if (cOL.parentNode.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].id != 'lastratedheadline')
            cOL.removeChild(document.getElementById(aTitles[i]));
          }

     var i = 0;
     while (i <= document.getElementsByTagName('table').length -1)
       {
       if (document.getElementsByTagName('table')[i].id.indexOf('list_') !=  0)
         i++
       else
         if (document.getElementsByTagName('table')[i].getElementsByTagName('tr').length > 1)
           i++
         else
           {
           cOL = document.getElementsByTagName('table')[i].parentNode;
           cOL.removeChild(document.getElementsByTagName('table')[i]);
           }
       }//WHILE-End
    } //IF "_ALL_"-End
// NUR EINE BESTIMMTE PLATTFORM ANZEIGEN --- ENDE!

  var i = 0;
  while (i <= document.getElementById('linkstolists').getElementsByTagName('span').length -1)
    {
    cOL = document.getElementById('linkstolists').getElementsByTagName('span')[i];

    if (document.getElementById('list_' + String(cOL.id).substr(11)) == null)
     document.getElementById('linkstolists').removeChild(cOL)
    else
      i++;
    }

  for (var i = 0; i <= document.getElementsByTagName('tr').length -1; i++)
    if (document.getElementsByTagName('tr')[i].className == 'hiddentreasures')
      if (document.getElementsByTagName('tr')[i].parentNode.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].id != 'lastratedheadline')
        j++;

  document.getElementById('lastratedheadline').innerHTML = 'Die ' +
                                                           (document.getElementById('lastratedlist').getElementsByTagName('tr').length -1) +
                                                           ' aktuellsten Tests und Rezensionen (insgesamt&nbsp;' +
                                                           j +
                                                           '&nbsp;für&nbsp;' +
                                                           sPlatformString +
                                                           ')';
  HidePlatformFilterHeadline();
}

function SetPlatformFilter (sPlatform) {
  SaveSettingToCookie('mpde_hidden_treasures_platform_filter', sPlatform, 365);
  document.location.reload();
}

function Trim(sText) {
  // ALLE LEEREICHEN AN ANFANG UND ENDE LÖSCHEN
  while (sText.length > 1 && sText.indexOf(' ') == 0)
    sText = sText.slice(1, sText.length);
  while (sText.length > 1 && sText.lastIndexOf(' ') == sText.length -1)
    sText = sText.slice(0, sText.length -1);
  while (sText.length > 1 && sText.indexOf('  ') != -1)
    sText = sText.replace('  ', ' ');
  return sText;
}