// id is the id of the tag from which the script is called. The content of this tag will be replaced by the player
  // mp3 is the id of the mp3 file

  var globalPathToFlash;

  function writePlayer(id, mp3, pathToFlash){
    globalPathToFlash = pathToFlash;

    // adapt settings for the player object created by SWFObject
    var so = new SWFObject(pathToFlash+"/opPlayer2.2.swf?id=" + mp3+ "&context=" + id, "Content_1", "25", "25", "8", "#FFF");
    so.write(id);

    if (document.getElementById("img"+id)!=null) {
      //document.styleSheets[1].disabled=true;
      showPopupByUrl(300,200,'dispatch.do?def=.noPlayer','popup');
    }
  }


  // id is the id of the tag which will be cleared and replaced by the initial link. Replace dummy.jpg and it's values by your standard Flash Player jpg
  // mp3 is the id of the mp3 file that will played from the cleared tag

  function clearPlayer(id, mp3){

    var linknode = document.createElement('a');
    var linktext = "javascript:writePlayer('" + id + "','" + mp3 + "','"+ globalPathToFlash+"' )";

    linknode.setAttribute('href', linktext);
    linknode.className = "flashLink";

    // replace the dummy.jpg by your Flash Player image
    var cont = document.createElement('img');
    cont.setAttribute('src',globalPathToFlash+'/player.jpg');
    cont.setAttribute('alt', 'Flash');

    // putting linktext into linknode and replacing the tag content
    linknode.appendChild(cont);
    document.getElementById(id).replaceChild(linknode, document.getElementById(id).childNodes[0]);

  }
