function addLoadEvent(func) {
  var oldonload = window.onload;

  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function PlayMP3(sName)
{
  var x, y;
  var oDIV = document.getElementById('MP3');

  if (!oDIV)
  {
    oDIV = document.createElement('div');
    oDIV.id = 'MP3';
    oDIV.innerHTML = '<object width="200" height="20" data="/Portals/2/MP3/mp3player.swf" type="application/x-shockwave-flash"><param value="/Portals/2/MP3/mp3player.swf" name="movie" /><param name="FlashVars" value="file=/Portals/2/MP3/' + sName + '&height=20&width=200&type=mp3&showdigits=false" /></object><p><a href="javascript:HideMe()">Close Window</a></p>';
    document.getElementsByTagName('body')[0].appendChild(oDIV);
  }

  if ((document.documentElement['clientWidth']-215) > 0)
    x = (document.documentElement['clientWidth']-215)/2;
  else
    x = 0;

  if ((document.documentElement['clientHeight']-80) > 0)
    y = (document.documentElement['clientHeight']-80)/2;
  else
    y = 0;

  oDIV.style.top = y + 'px';
  oDIV.style.left = x + 'px';
  oDIV.style.display = 'block';
}

function ShowMP3List()
{
  var x, y;
  var oDIV = document.getElementById('MP3');

  if (!oDIV)
  {
    oDIV = document.createElement('div');
    oDIV.id = 'MP3';
    oDIV.style.width = '400px';
    oDIV.innerHTML = '<object width="400" height="134" data="/Portals/2/MP3/mp3player.swf" type="application/x-shockwave-flash"><param value="/Portals/2/MP3/mp3player.swf" name="movie" /><param name="FlashVars" value="height=134&width=400&file=http://www.thefeelinglife.com/Portals/2/MP3/playlist.xml&displaywidth=0" /></object><p><a href="javascript:HideMe()">Close Window</a></p>';
    document.getElementsByTagName('body')[0].appendChild(oDIV);
  }

  if ((document.documentElement['clientWidth']-215) > 0)
    x = (document.documentElement['clientWidth']-215)/2;
  else
    x = 0;

  if ((document.documentElement['clientHeight']-80) > 0)
    y = (document.documentElement['clientHeight']-80)/2;
  else
    y = 0;

  oDIV.style.top = y + 'px';
  oDIV.style.left = x + 'px';
  oDIV.style.display = 'block';
}

function HideMe()
{
  var oDIV = document.getElementById('MP3');

  if (oDIV)
    oDIV.style.display = 'none';
}
