
$$('.samples a').invoke('observe', 'click', observer);

function observer(e) {
  //alert("In observer: " + window.location.hash);
  //if (!window.location.hash) return;
  e.stop();
  e.element().blur();
  var currentPlaying = $$('.playing')[0];
  if (currentPlaying) currentPlaying.removeClassName('playing');
  if (currentPlaying == e.element()) {
    //alert("Playing, branch if");
    Sound.play('null', {replace: true});
  }
  else {
    //alert("Playing, branch else");
    e.element().addClassName('playing');
    var songName = e.element().href.split('#').pop();
    Sound.play('/vo_samples/' + songName + '.mp3', { replace: true });
  }
}

