title: HTML5 Audio - stop current play when another sound is started
body: <p>I am using this method to play audio files when you click on an image:</p>
  
  <p><a href="http://jsfiddle.net/v97Kq/3/" rel="nofollow">http://jsfiddle.net/v97Kq/3/</a></p>
  
  <pre><code>function imageSwitch(_imgID, _imgStart, _imgStop, _soundFileMp3, _soundFileOgg) {
      this.imgID = _imgID;
      this.imgStart = _imgStart;
      this.imgStop = _imgStop;
      this.song = new Audio();
      if (this.song.canPlayType("audio/mpeg"))
          this.song.src = _soundFileMp3;
      else 
          this.song.src = _soundFileOgg;
      this.song.loop = true;
  
      this.pos = 0;
      this.e;
  
      this.change = function () {
          if (this.pos == 0) {
              this.pos = 1;
              document.getElementById(this.imgID).src = this.imgStop;
              this.song.play();
          } else {
              this.pos = 0;
              document.getElementById(this.imgID).src = this.imgStart;
              this.song.pause();
          }
      }
  }
  </code></pre>
  
  <p>It works good! - but how can I get it to stop playing the currently playing sound when another link is clicked and another sound begins?</p>