function stopAllSound() {
    var sounds = document.embeds;
    for ( var i = 0; i < sounds.length; i ++ ) {
         try {
          sounds[i].Stop();
         } catch (e) {
         }
    }
}

function playSound(mysound) {
    stopAllSound();
 var sound = document.getElementById(mysound);
 // make an effort to stop and rewind any playback
 // already in progress so that the sound starts over.
 // Otherwise this call has no effect when the sound
 // is already in progress. You can remove these lines
 // if you don't like this behavior.
 try {
  sound.Stop();
  sound.Rewind();
 } catch (e) {
  // A player that doesn't support
  // Stop and Rewind
 }

 try {
  // For RealPlayer-enabled browsers.
  // Some versions of RealPlayer do not
  // offer a Play() function and will
  // fail to play sound if we try to
  // call Play().
  sound.DoPlay();
 } catch (e) {
  // If DoPlay doesn't work, call Play.
  // This works for all other audio
  // plug-ins.
  sound.Play();
 }
}
