function InlinePlayer() {
    var A = this;
    var C = this;
    var D = soundManager;
    this.links = [];
    this.sounds = [];
    this.soundsByURL = [];
    this.indexByURL = [];
    this.lastSound = null;
    this.soundCount = 0;
    var B = (navigator.userAgent.match(/msie/i));
    this.config = {playNext:false,autoPlay:false};
    this.css = {sDefault:"sm2_link",sLoading:"sm2_loading",sPlaying:"sm2_playing",sPaused:"sm2_paused"};
    this.addEventHandler = function(G, F, E) {
        typeof(attachEvent) == "undefined" ? G.addEventListener(F, E, false) : G.attachEvent("on" + F, E)
    };
    this.removeEventHandler = function(G, F, E) {
        typeof(attachEvent) == "undefined" ? G.removeEventListener(F, E, false) : G.detachEvent("on" + F, E)
    };
    this.classContains = function(F, E) {
        return(typeof(F.className) != "undefined" ? F.className.indexOf(E) + 1 : false)
    };
    this.addClass = function(F, E) {
        if (!F || !E || A.classContains(F, E)) {
            return false
        }
        F.className = (F.className ? F.className + " " : "") + E
    };
    this.removeClass = function(F, E) {
        if (!F || !E || !A.classContains(F, E)) {
            return false
        }
        F.className = F.className.replace(new RegExp("( " + E + ")|(" + E + ")", "g"), "")
    };
    this.getSoundByURL = function(E) {
        return(typeof A.soundsByURL[E] != "undefined" ? A.soundsByURL[E] : null)
    };
    this.events = {play:function() {
        C.removeClass(this._data.oLink, this._data.className);
        this._data.className = C.css.sPlaying;
        C.addClass(this._data.oLink, this._data.className)
    },stop:function() {
        C.removeClass(this._data.oLink, this._data.className);
        this._data.className = ""
    },pause:function() {
        C.removeClass(this._data.oLink, this._data.className);
        this._data.className = C.css.sPaused;
        C.addClass(this._data.oLink, this._data.className)
    },resume:function() {
        C.removeClass(this._data.oLink, this._data.className);
        this._data.className = C.css.sPlaying;
        C.addClass(this._data.oLink, this._data.className)
    },finish:function() {
        C.removeClass(this._data.oLink, this._data.className);
        this._data.className = "";
        if (C.config.playNext) {
            var E = (C.indexByURL[this._data.oLink.href] + 1);
            if (E < C.links.length) {
                C.handleClick({target:C.links[E]})
            }
        }
    }};
    this.stopEvent = function(E) {
        if (typeof E != "undefined" && typeof E.preventDefault != "undefined") {
            E.preventDefault()
        } else {
            if (typeof event != "undefined" && typeof event.returnValue != "undefined") {
                event.returnValue = false
            }
        }
        return false
    };
    this.getTheDamnLink = (B) ? function(E) {
        return(E && E.target ? E.target : window.event.srcElement)
    } : function(E) {
        return E.target
    };
    this.handleClick = function(G) {
        var I = A.getTheDamnLink(G);
        var F = I.getAttribute("href");
        if (!I.href || !I.href.match(/\.mp3/i)) {
            if (B && I.onclick) {
                return false
            }
            return true
        }
        D._writeDebug("handleClick()");
        var H = (I.href);
        var E = A.getSoundByURL(H);
        if (E) {
            if (E == A.lastSound) {
                E.togglePause()
            } else {
                E.togglePause();
                D._writeDebug("sound different than last sound: " + A.lastSound.sID);
                if (A.lastSound) {
                    A.stopSound(A.lastSound)
                }
            }
        } else {
            E = D.createSound({id:"mp3Sound" + (A.soundCount++),url:H,onplay:A.events.play,onstop:A.events.stop,onpause:A.events.pause,onresume:A.events.resume,onfinish:A.events.finish});
            E._data = {oLink:I,className:A.css.sPlaying};
            A.soundsByURL[H] = E;
            A.sounds.push(E);
            if (A.lastSound) {
                A.stopSound(A.lastSound)
            }
            E.play()
        }
        A.lastSound = E;
        if (typeof G != "undefined" && typeof G.preventDefault != "undefined") {
            G.preventDefault()
        } else {
            event.returnValue = false
        }
        return false
    };
    this.stopSound = function(E) {
        soundManager.stop(E.sID);
        soundManager.unload(E.sID)
    };
    this.init = function() {
        D._writeDebug("inlinePlayer.init()");
        var G = document.getElementsByTagName("a");
        var F = 0;
        for (var E = 0; E < G.length; E++) {
            if (G[E].href.match(/\.mp3/i)) {
                A.addClass(G[E], A.css.sDefault);
                A.links[F] = (G[E]);
                A.indexByURL[G[E].href] = F;
                F++
            }
        }
        if (F > 0) {
            A.addEventHandler(document, "click", A.handleClick);
            if (A.config.autoPlay) {
                A.handleClick({target:A.links[0],preventDefault:function() {
                }})
            }
        }
        D._writeDebug("inlinePlayer.init(): Found " + F + " relevant items.")
    };
    this.init()
}
;