function Sound(src) {
    this.src = src;


    var isIE = !!(window.attachEvent && !window.opera);
    if (isIE) {
        var str = "<bgsound id='sound'>";
        document.write(str);
        this.sound = document.all.sound;
    } else {
        var str = "<embed src='"+src+"' autostart='false' width='0' height='0' enablejavascript='true' id='sound'></embed>";
        document.write(str);
        this.sound = document.getElementById('sound');
    }    
}

Sound.prototype.play = function() {
    if (typeof this.sound.Play !== "undefined") {
        this.sound.Play();
    } else if (typeof document.all !== "undefined") {
        document.all.sound.src = this.src;
    } else if (typeof this.cantPlay === "function") {
        this.cantPlay.call();
    } else {
        return false;
    }
    return true;
}

Sound.prototype.stop = function() {
    if (typeof this.sound.Stop !== "undefined"){
        this.sound.Stop();
    } else if (typeof document.all !== "undefined") {
        document.all.sound.src = "";
    } else if (typeof this.cantStop === "function") {
        this.cantStop.call();
    } else {
        return false;
    }
    return true;
}