	var _gaq = [],
    CountersCallCount = 0;
	Counters = function() {}, Counters.init = function() {
        CountersCallCount++;
    },
    function() {
        function a(a) {
            return document.querySelector(a)
        }

        function b(a) {
            return a && "undefined" != typeof a ? parseInt(a.offsetLeft) + b(a.offsetParent) : 0
        }

        function o() {
            var a = new m;
            a.bind(), a.loadPlaylist(), a.load(), window.addEventListener("ajaxLoad", function() {
                a.loadPlaylist()
            }), window.addEventListener("ajaxLoadMore", function() {
                var b = a.playlistPos;
                a.loadPlaylist(), a.playlistPos = b
            }), window.addEventListener("ajaxPlay", function() {
                a.waitForPlay && (a.load(), a.player.play(), a.waitForPlay = !1)
            })
        }

        var d = [],
            m = function() {
                this.uid = Math.random(), this.createPlayer()
            };
        m.prototype.createPlayer = function() {
            var a = document.createElement("audio");
            a.style.display = "none", a.preload = "none", a.id = "audioPlayer", document.body.appendChild(a), this.player = a
        }, m.prototype.loadPlaylist = function() {
            var b = document.querySelectorAll(".playlist li:not(.playlist-ad)"),
                c = null;
            this.playlist && this.playlist[this.playlistPos] && (c = this.playlist[this.playlistPos].el), this.playlist = [], this.playlistPos = 0;
            var d = this,
                e = 0;
            Array.prototype.forEach.call(b, function(a) {
                var b = {};
                c == a && (d.playlistPos = e), b.el = a, b.link = a.querySelector("a.playlist-play").getAttribute("data-url"), b.artist = a.querySelector("ul.playlist > li .playlist-name-artist").innerText, b.title = a.querySelector("ul.playlist > li .playlist-name-title").innerText, b.pos = e++, d.playlist.push(b)
            }), this.playlist.forEach(function(a, b) {
                var c = a.el.querySelector(".playlist-play");
                c.addEventListener("click", function(b) {
                    b.preventDefault(), b.stopPropagation(), d.isPremode = !1, d.player.src != a.link ? (d.playlist[d.playlistPos].el.className = "", d.playlistPos = a.pos, d.playlist[d.playlistPos].el.className = "plays", d.load(), d.player.play()) : d.player.paused ? d.player.play() : d.player.pause()
                })
            });
			
			
            
           
        }, m.prototype.load = function() {
            var a = !this.player.paused;
            this.artist = this.playlist[this.playlistPos].artist, this.title = this.playlist[this.playlistPos].title, this.player.src = this.playlist[this.playlistPos].link, a && this.player.play()
        }, m.prototype.prev = function() {
            this.isPremode || (this.playlist[this.playlistPos].el.className = "", this.playlistPos--, this.playlist[this.playlistPos].el.className = "pausing", this.playlistPos < 0 && (this.playlistPos = 0), this.load())
        }, m.prototype.next = function() {
             if (!this.isPremode) return this.playlist[this.playlistPos].el.className = "", this.playlistPos++, this.playlistPos >= this.playlist.length ? (this.waitForPlay = !0, a(".listalka") && "false" !== a(".listalka").getAttribute("data-next-page") ? (i(a(".playlist").getAttribute("data-urlnext")), !1) : (this.playlistPos = 0, this.load(), !0)) : (this.playlist[this.playlistPos].el.className = "pausing", this.load(), !0)
        }, m.prototype.shufflePlaylist = function() {
            var a = [],
                b = this.playlist[this.playlistPos];
            b.pos = 0, a.push(b), this.playlist.splice(this.playlistPos, 1), this.playlistPos = 0;
            for (var c = this.playlist.length, d = 0; d < c; d++) {
                var e = Math.round(Math.random() * (this.playlist.length - 1));
                this.playlist[e].pos = d, a.push(this.playlist[e]), this.playlist.splice(e, 1)
            }
            this.playlist = a
        }, m.prototype.onPause = function() {
            this.isPremode || this.playlist[this.playlistPos].link != this.player.src ? this.playlist[this.playlistPos].el.className = "" : this.playlist[this.playlistPos].el.className = "pausing"
        }, m.prototype.onPlay = function() {
            this.isPremode || this.playlist[this.playlistPos].link != this.player.src ? this.playlist[this.playlistPos].el.className = "" : this.playlist[this.playlistPos].el.className = "plays"
        }, m.prototype.bind = function() {
            function v() {
                k.innerHTML = "<b>" + c.artist + "</b> <i>&mdash;</i> <em>" + c.title + "</em>"
            }

            function w(a) {
                u && (clearTimeout(u), u = null), l.innerHTML = a, k.parentNode.style.display = "none", u = setTimeout(function() {
                    k.parentNode.style.display = "block"
                }, 3e3)
            }

            function B(a) {
                a || (a = 0);
                var b = Math.floor(a / 60),
                    c = Math.round(a % 60);
                return c < 10 && (c = "0" + c), b + ":" + c
            }

            function C(b) {
                i.innerText = B(c.player.currentTime), j.innerText = B(c.player.duration), n.style.width = c.player.currentTime / c.player.duration * 100 + "%";
                var d = 0;
                c.player.buffered.length && (d = c.player.buffered.end(c.player.buffered.length - 1) / c.player.duration * 100), m.style.width = d + "%";
                
            }
            var c = this,
                d = a("#fixplayer #fixplayer-volume"),
                e = a("#fixplayer #fixplayer-volume #fixplayer-volume-x"),
                f = a("#fixplayer a#fixplayer-sound"),
                g = a("#fixplayer a#fixplayer-pv"),
                h = a("#fixplayer a#fixplayer-b_play"),
                i = a("#fixplayer #fixplayer-time b"),
                j = a("#fixplayer #fixplayer-time em"),
                k = a("#fixplayer #fixplayer-lcd #fixplayer-title span"),
                l = a("#fixplayer #fixplayer-lcd #fixplayer-notification"),
                m = a("#fixplayer #fixplayer-prok-sk"),
                n = a("#fixplayer #fixplayer-prok-pr"),
                o = a("#fixplayer a#fixplayer-b_back"),
                p = a("#fixplayer a#fixplayer-b_next"),
                q = a("#fixplayer #fixplayer-prok"),
                r = 0,
                s = ["js__line", "js__shuffle", "js__repeat"],
                t = ["По очереди", "Случайный", "Повторять трек"];
            h.className = "js__off", m.style.width = 0, n.style.width = 0, this.artist = "name", this.title = "title";
            var u = null;
            g.classList.remove("js__line", "js__shuffle", "js__repeat"), g.classList.add(s[r]), g.addEventListener("click", function() {
                switch (r++, r > 2 && (r = 0), g.classList.remove("js__line", "js__shuffle", "js__repeat"), g.classList.add(s[r]), w(t[r]), r) {
                    case 0:
                    case 2:
                        c.loadPlaylist();
                        break;
                    case 1:
                        c.shufflePlaylist()
                }
            }), p.addEventListener("click", function() {
                c.next()
            }), o.addEventListener("click", function() {
                c.prev()
            }), h.addEventListener("click", function(a) {
                c.player.paused ? c.player.play() : c.player.pause()
            }), this.player.addEventListener("playing", function() {
                h.className = "js__on", c.onPlay(), window.localStorage.setItem("playback", c.uid)
            }), this.player.addEventListener("play", function() {
                 h.className = "js__on", c.onPlay(), window.localStorage.setItem("playback", c.uid)
            }), this.player.addEventListener("pause", function() {
                h.className = "js__off", c.onPause()
            });
            var x;
            (x = window.sessionStorage.getItem("volume")) && (c.player.volume = x, 0 == x && (f.classList.add("js__off"), f.classList.remove("js__on"))), e.style.width = 100 * c.player.volume + "%", this.player.addEventListener("volumechange", function() {
                e.style.width = 100 * c.player.volume + "%", 0 == c.player.volume ? (f.classList.add("js__off"), f.classList.remove("js__on")) : (f.classList.remove("js__off"), f.classList.add("js__on")), window.sessionStorage.setItem("volume", c.player.volume), w("Громкость: " + Math.round(100 * c.player.volume) + "%")
            });
            var y = 0;
            d.addEventListener("mousedown", function(a) {
                var e = a.clientX - b(d);
                c.player.volume = e / d.offsetWidth, y = !0
            }), window.addEventListener("mouseup", function() {
                y = !1
            }), d.addEventListener("mousemove", function(a) {
                if (y) {
                    var e = a.clientX - b(d);
                    c.player.volume = e / d.offsetWidth
                }
            });
            var z = 1;
            f.addEventListener("click", function() {
                c.player.volume ? (z = c.player.volume, c.player.volume = 0) : c.player.volume = z
            });
            var A = 0;
            return q.addEventListener("mousedown", function(a) {
                var d = a.clientX - b(q);
                c.player.currentTime = c.player.duration * d / q.offsetWidth, y = !0
            }), window.addEventListener("mouseup", function() {
                A = !1
            }), q.addEventListener("mousemove", function(a) {
                if (y) {
                    var d = a.clientX - b(q);
                    c.player.currentTime = c.player.duration * d / q.offsetWidth
                }
            }), this.player.addEventListener("timeupdate", C), this.player.addEventListener("progress", C), this.player.addEventListener("loadstart", function(a) {
                v(), m.style.width = 0, n.style.width = 0, c.player.paused ? h.className = "js__off" : h.className = "js__on"
            }), this.player.addEventListener("ended", function(a) {
                2 != r ? c.next() && c.player.play() : (c.player.currentTime = 0, c.player.play())
            }), window.addEventListener("storage", function(a) {
                a.newValue == c.uid || c.player.paused || c.player.pause()
            }), !0
        }, window.addEventListener("DOMContentLoaded", function() {
            Counters.init(),  o()
        })
    }();