/*
swf player in a borderless popup window
*/


      var swf = false;

      function addSwf(file, width, height, id)
      {
        clearSwf();
          
        var top = gid(id).style.top * 1;  
        if((id != '') && (id != undefined))
        { // alert('The '+gid(id).nodeName+' element with id="' + id + '"\nTop: '+gid(id).style.top + '\nLeft: ' +gid(id).style.left );
        
          gid('playercontainer').style.top = ((gid(id).style.top.replace( 'px', '') * 1) - 538) + 'px'; // alert('1: '+gid('playercontainer').style.top  );
          if( (gid('playercontainer').style.top.replace( 'px', '') * 1) < 120) { gid('playercontainer').style.top = '120px'; }
          gid('playercontainer').style.left = '108px';
          setTimeout("swf = true;", 1000); // alert('New nTop: '+gid('playercontainer').style.top + '\nLeft: ' +gid('playercontainer').style.left );
        }
        else
        {
          gid('playercontainer').style.top  = 'px';
          gid('playercontainer').style.left = 'px';
          setTimeout("swf = true;", 1000);
        }

        gid('playercontainer').innerHTML='<a id="player"class="player"href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe Flash Player</a><div><input type="button" style="width:'+width+'px;" value="--  C L O S E  --" onclick="clearSwf(); return false;"></div>';

        var flashvars =
        {
          'file':                                   file,
          'frontcolor':                            'd3d3d3',
          'backcolor':                             '000000',
          'lightcolor':                            '6d6c6b',
          'screencolor':                           '373737',
          'id':                                    'playerID',
          'autostart':                             'true'
        };

        var params =
        {
          'allowfullscreen':                       'true',
          'allowscriptaccess':                     'always',
          'wmode':                                 'opaque',
          'bgcolor':                               '#FFFFFF'
        };

        var attributes =
        {
          'id':                                    'playerID',
          'name':                                  'playerID'
        };

        swfobject.embedSWF('player.swf', 'player', width, height, '9.0.124', false, flashvars, params, attributes);
      };
      

      function clearSwf()
      {
       if(swf)
       {
         swfobject.removeSWF('playerID');
         gid('playercontainer').innerHTML = '';
         swf = false;
       }
      };


      function gid(name)
      {
        return document.getElementById(name);
      };

