(function (K)
{
    function r(a)
    {
        a = a ||
        {};
        this.left = a.left || 0;
        this.top = a.top || 0;
        this.right = a.right || 0;
        this.bottom = a.bottom || 0;
        a.hasOwnProperty("x") && (this.left = a.x);
        a.hasOwnProperty("y") && (this.top = a.y);
        a.hasOwnProperty("width") && (this.right = this.left + a.width);
        a.hasOwnProperty("height") && (this.bottom = this.top + a.height);
        this.checkDimensions()
    }

    function D()
    {
        this.map = {}
    }

    function A()
    {
        this.eventMap = {}
    }

    function E(a)
    {
        this.cookieMap = this.parseCookies()
    }

    function B()
    {}

    function v(a)
    {
        a = a ||
        {};
        this.x = a.x || 0;
        this.y = a.y ||
            0;
        this.anchorX = a.anchorX || 0;
        this.anchorY = a.anchorY || 0;
        this.parent = null
    }

    function t(a)
    {
        var b = a ||
        {};
        v.call(this, a);
        this.visible = !0;
        this.children = [];
        this.scaleX = b.scaleX || 1;
        this.scaleY = b.scaleY || 1;
        b.hasOwnProperty("scale") && (this.scaleX = this.scaleY = b.scale)
    }

    function w(a)
    {
        var b = a ||
        {};
        v.call(this, a);
        this.width = b.width || 0;
        this.height = b.height || 0;
        this.image = b.img || new Image;
        this.sourceX = b.sourceX || 0;
        this.sourceY = b.sourceY || 0;
        this.sourceWidth = b.sourceWidth || this.image.width;
        this.sourceHeight = b.sourceHeight ||
            this.image.height;
        this.angle = b.angle || 0;
        this.scaleX = b.scaleX || 1;
        this.scaleY = b.scaleY || 1;
        b.hasOwnProperty("scale") && (this.scaleX = this.scaleY = b.scale)
    }

    function z(a)
    {
        var b = a ||
        {};
        v.call(this, a);
        this.width = b.width || 0;
        this.height = b.height || 0;
        this.scaleX = b.scaleX || 1;
        this.scaleY = b.scaleY || 1;
        this.angle = b.angle || 0;
        this.pattern = b.pattern || null;
        this.offsetX = b.offsetX || 0;
        this.offsetY = b.offsetY || 0;
        this.imageWidth = b.imageWidth || 0;
        this.imageHeight = b.imageHeight || 0;
        this.imageScaleX = b.imageScaleX || 1;
        this.imageScaleY =
            b.imageScaleY || 1;
        this.imageOffsetX = b.imageOffsetX || 0;
        this.imageOffsetY = b.imageOffsetY || 0;
        b.hasOwnProperty("imageScale") && (this.imageScaleX = this.imageScaleY = b.imageScale)
    }

    function y(a)
    {
        var b = new Image;
        b.preSrc = a;
        b.onload = y.imgOnLoad;
        b.onerror = y.imgOnError;
        b.load = function (a, b)
        {
            this.onLoadFunction = a;
            this.onErrorFunction = b;
            this.src = this.preSrc
        };
        return b
    }

    function F(a)
    {
        var b = a ||
        {};
        t.call(this, a);
        this.horizontalAlign = b.horizontalAlign || "center";
        this.verticalAlign = b.verticalAlign || "middle";
        this.width = b.width ||
            0;
        this.height = b.height || 0;
        this.number = Math.floor(b.number) || 0;
        this.scaleX = b.scaleX || 1;
        this.scaleY = b.scaleY || 1;
        b.hasOwnProperty("scale") && (this.scaleX = this.scaleY = b.scale);
        this.numberImages = b.numberImages || [];
        this.updateNumber()
    }

    function q(a)
    {
        a = a ||
        {};
        this.imgs = {};
        this.imgCount = this.imgLoaded = 0;
        this.imgListObj = a.images
    }

    function x(a)
    {
        this.sounds = {};
        this.soundMap = a.sounds;
        this.enabled = createjs.WebAudioPlugin.isSupported() ? createjs.Sound.initializeDefaultPlugins() : !1;
        g.cordova && (this.enabled = !0, this.cordovaSounds = {});
        this.soundsError = this.soundsCount = this.soundsLoaded = 0
    }

    function k(a)
    {
        var b = a ||
        {};
        w.call(this, a);
        this.startY = this.y;
        this.rectWidth = b.rectWidth || this.width;
        this.rectHeight = b.rectHeight || this.height;
        this.rect = new r(
        {
            x: this.x - this.rectWidth / 2,
            y: this.y - this.rectHeight / 2,
            width: this.rectWidth,
            height: this.rectHeight
        });
        this.speedY = this.speedX = 0;
        this.stallingIndex = b.stallingIndex || 0;
        this.started = !1;
        this.imgs = b.birdImages || [];
        this.spriteSpeed = b.spriteSpeed || 150;
        this.state = k.states.cruising;
        this.previousIndex =
            0
    }

    function G(a)
    {
        var b = a ||
        {};
        t.call(this, a);
        this.gapRect = b.gapRect || new r;
        this.pipeSectionPattern = b.pipeSectionPattern || null;
        this.pipeTopImage = b.pipeTopImage || null;
        this.pipesticleHeight = b.pipesticleHeight || 0;
        this.needsToBeDestroyed = this.passed = !1;
        this.rect = new r(
        {
            left: this.x,
            top: this.y,
            right: this.x + this.gapRect.getWidth(),
            bottom: this.y + this.gapRect.getHeight()
        });
        this.pipeTiteRect = new r(
        {
            left: 0,
            top: 0,
            right: this.gapRect.getWidth(),
            bottom: this.gapRect.top
        });
        this.pipeMiteRect = new r(
        {
            left: 0,
            top: this.gapRect.bottom,
            right: this.gapRect.getWidth(),
            bottom: this.pipesticleHeight
        });
        this.pipeTiteSection = new z(
        {
            pattern: this.pipeSectionPattern,
            x: 0,
            y: 0,
            width: this.pipeTiteRect.getWidth(),
            height: this.pipeTiteRect.getHeight() - this.pipeTopImage.height
        });
        this.pipeTiteBottom = new w(
        {
            img: this.pipeTopImage,
            x: 0,
            y: this.pipeTiteRect.getHeight(),
            width: this.pipeTopImage.width,
            height: this.pipeTopImage.height,
            scaleY: -1
        });
        this.pipeMiteTop = new w(
        {
            img: this.pipeTopImage,
            x: 0,
            y: this.pipeMiteRect.top,
            width: this.pipeTopImage.width,
            height: this.pipeTopImage.height
        });
        this.pipeMiteSection = new z(
        {
            pattern: this.pipeSectionPattern,
            x: 0,
            y: this.pipeMiteRect.top + this.pipeTopImage.height,
            width: this.pipeMiteRect.getWidth(),
            height: this.pipeMiteRect.getHeight() - this.pipeTopImage.height
        });
        this.addChild(this.pipeTiteSection);
        this.addChild(this.pipeTiteBottom);
        this.addChild(this.pipeMiteTop);
        this.addChild(this.pipeMiteSection)
    }

    function d()
    {
        this.canvas = h.get("gameCanvas");
        this.context = this.canvas.getContext("2d");
        this.aspectRatio = this.canvas.width / this.canvas.height;
        this.scaleX =
            this.canvas.width / d.BASEWIDTH;
        this.scaleY = this.canvas.height / d.BASEHEIGHT;
        this.animationFrameId = -1;
        this.fixedAccumulator = this.frameCount = this.lastMainLoopTime = 0;
        this.looping = this.started = !1;
        this.state = d.states.none;
        this.changingState = !1;
        this.score = 0;
        this.bestScore = parseInt(H.getCookie(d.BESTSCORECOOKIE, "0"), 10);
        this.bestScore_name = parseInt(H.getCookie(d.BESTSCORECOOKIE_name, "0"), 10);
        this.debug = this.ignoreMouseDown = !1;
        this.debugStuff = {
            lastFrameCapture: 0,
            lastFrameCaptureTime: 0,
            output: null,
            frameCounter: null
        };
        this.patterns = {};
        this.debug && this.setupDebug();
        g.trace = f.bindFnc(this,
            this.trace);
        this.firstTap = !0;
        this.lastPipeTime = 0;
        this.keyMap = {};
        this.imgManager = new q(
        {
            images: d.IMGS
        });
        this.soundManager = new x(
        {
            sounds: d.SOUNDS
        });
        this.stage = new t(
        {
            x: 0,
            y: 0,
            scaleX: this.scaleX,
            scaleY: this.scaleY
        });
        this.updateContext = {
            scrollSpeed: 0
        };
        this.bindedMainLoop = f.bindFnc(this, this.mainLoop);
        this.bindedRequestAnimationFrame = f.bindFnc(this, function ()
        {
            g.requestAnimationFrame(this.bindedMainLoop)
        });
        (function ()
        {
            for (var a = 0, b = ["webkit", "moz"], c = 0; c < b.length && !g.requestAnimationFrame; ++c) g.requestAnimationFrame =
                g[b[c] + "RequestAnimationFrame"], g.cancelAnimationFrame = g[b[c] + "CancelAnimationFrame"] || g[b[c] + "CancelRequestAnimationFrame"];
            g.requestAnimationFrame || (g.requestAnimationFrame = function (b, c)
            {
                var m = (new Date).getTime(),
                    l = Math.max(0, 16 - (m - a)),
                    d = g.setTimeout(function ()
                    {
                        b(m + l)
                    }, l);
                a = m + l;
                return d
            });
            g.cancelAnimationFrame || (g.cancelAnimationFrame = function (a)
            {
                u(a)
            })
        })();
        this.init()
    }
    var g = K,
        p = g.document,
        I = g.location,
        s = g.setTimeout,
        u = g.clearTimeout,
        J = g.open,
        C = g.console ||
        {
            log: function () {},
            warn: function () {},
            error: function () {}
        };
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        var a = createjs.SoundJS = createjs.SoundJS ||
        {};
        a.version = "0.5.2";
        a.buildDate = "Thu, 12 Dec 2013 23:33:37 GMT"
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        var a = function () {}, b = a.prototype;
        a.initialize = function (a)
        {
            a.addEventListener = b.addEventListener;
            a.on = b.on;
            a.removeEventListener = a.off = b.removeEventListener;
            a.removeAllEventListeners = b.removeAllEventListeners;
            a.hasEventListener = b.hasEventListener;
            a.dispatchEvent = b.dispatchEvent;
            a._dispatchEvent = b._dispatchEvent;
            a.willTrigger = b.willTrigger
        };
        b._listeners = null;
        b._captureListeners = null;
        b.initialize = function () {};
        b.addEventListener = function (a, b, n)
        {
            var m;
            m = n ? this._captureListeners = this._captureListeners ||
            {} : this._listeners = this._listeners ||
            {};
            var l = m[a];
            return l && this.removeEventListener(a, b, n), l = m[a], l ? l.push(b) : m[a] = [b], b
        };
        b.on = function (a, b, n, m, l, d)
        {
            return b.handleEvent && (n = n || b, b = b.handleEvent), n = n || this, this.addEventListener(a, function (a)
            {
                b.call(n, a, l);
                m && a.remove()
            }, d)
        };
        b.removeEventListener = function (a, b,
            n)
        {
            if (n = n ? this._captureListeners : this._listeners)
            {
                var m = n[a];
                if (m)
                    for (var l = 0, d = m.length; d > l; l++)
                        if (m[l] == b)
                        {
                            1 == d ? delete n[a] : m.splice(l, 1);
                            break
                        }
            }
        };
        b.off = b.removeEventListener;
        b.removeAllEventListeners = function (a)
        {
            a ? (this._listeners && delete this._listeners[a], this._captureListeners && delete this._captureListeners[a]) : this._listeners = this._captureListeners = null
        };
        b.dispatchEvent = function (a, b)
        {
            if ("string" == typeof a)
            {
                var n = this._listeners;
                if (!n || !n[a]) return !1;
                a = new createjs.Event(a)
            }
            if (a.target = b || this,
                a.bubbles && this.parent)
            {
                for (var m = this, n = [m]; m.parent;) n.push(m = m.parent);
                for (var l = n.length, m = l - 1; 0 <= m && !a.propagationStopped; m--) n[m]._dispatchEvent(a, 1 + (0 == m));
                for (m = 1; l > m && !a.propagationStopped; m++) n[m]._dispatchEvent(a, 3)
            }
            else this._dispatchEvent(a, 2);
            return a.defaultPrevented
        };
        b.hasEventListener = function (a)
        {
            var b = this._listeners,
                n = this._captureListeners;
            return !!(b && b[a] || n && n[a])
        };
        b.willTrigger = function (a)
        {
            for (var b = this; b;)
            {
                if (b.hasEventListener(a)) return !0;
                b = b.parent
            }
            return !1
        };
        b.toString =
            function ()
            {
                return "[EventDispatcher]"
        };
        b._dispatchEvent = function (a, b)
        {
            var n, m = 1 == b ? this._captureListeners : this._listeners;
            if (a && m && (m = m[a.type]) && (n = m.length))
            {
                a.currentTarget = this;
                a.eventPhase = b;
                a.removed = !1;
                for (var m = m.slice(), l = 0; n > l && !a.immediatePropagationStopped; l++)
                {
                    var d = m[l];
                    d.handleEvent ? d.handleEvent(a) : d(a);
                    a.removed && (this.off(a.type, d, 1 == b), a.removed = !1)
                }
            }
        };
        createjs.EventDispatcher = a
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        var a = function (a, b, n)
        {
            this.initialize(a, b, n)
        }, b = a.prototype;
        b.type = null;
        b.target = null;
        b.currentTarget = null;
        b.eventPhase = 0;
        b.bubbles = !1;
        b.cancelable = !1;
        b.timeStamp = 0;
        b.defaultPrevented = !1;
        b.propagationStopped = !1;
        b.immediatePropagationStopped = !1;
        b.removed = !1;
        b.initialize = function (a, b, n)
        {
            this.type = a;
            this.bubbles = b;
            this.cancelable = n;
            this.timeStamp = (new Date).getTime()
        };
        b.preventDefault = function ()
        {
            this.defaultPrevented = !0
        };
        b.stopPropagation = function ()
        {
            this.propagationStopped = !0
        };
        b.stopImmediatePropagation = function ()
        {
            this.immediatePropagationStopped = this.propagationStopped = !0
        };
        b.remove = function ()
        {
            this.removed = !0
        };
        b.clone = function ()
        {
            return new a(this.type, this.bubbles, this.cancelable)
        };
        b.toString = function ()
        {
            return "[Event (type=" + this.type + ")]"
        };
        createjs.Event = a
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        createjs.indexOf = function (a, b)
        {
            for (var c = 0, e = a.length; e > c; c++)
                if (b === a[c]) return c;
            return -1
        }
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        createjs.proxy = function (a, b)
        {
            var c = Array.prototype.slice.call(arguments, 2);
            return function ()
            {
                return a.apply(b, Array.prototype.slice.call(arguments,
                    0).concat(c))
            }
        }
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        function a()
        {
            throw "Sound cannot be instantiated";
        }

        function b(a, b)
        {
            this.init(a, b)
        }

        function c()
        {}
        a.DELIMITER = "|";
        a.INTERRUPT_ANY = "any";
        a.INTERRUPT_EARLY = "early";
        a.INTERRUPT_LATE = "late";
        a.INTERRUPT_NONE = "none";
        a.PLAY_INITED = "playInited";
        a.PLAY_SUCCEEDED = "playSucceeded";
        a.PLAY_INTERRUPTED = "playInterrupted";
        a.PLAY_FINISHED = "playFinished";
        a.PLAY_FAILED = "playFailed";
        a.SUPPORTED_EXTENSIONS = "mp3 ogg mpeg wav m4a mp4 aiff wma mid".split(" ");
        a.EXTENSION_MAP = {
            m4a: "mp4"
        };
        a.FILE_PATTERN = /^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([/.]*?(?:[^?]+)?\/)?((?:[^/?]+)\.(\w+))(?:\?(\S+)?)?$/;
        a.defaultInterruptBehavior = a.INTERRUPT_NONE;
        a.alternateExtensions = [];
        a._lastID = 0;
        a.activePlugin = null;
        a._pluginsRegistered = !1;
        a._masterVolume = 1;
        a._masterMute = !1;
        a._instances = [];
        a._idHash = {};
        a._preloadHash = {};
        a._defaultSoundInstance = null;
        a.addEventListener = null;
        a.removeEventListener = null;
        a.removeAllEventListeners = null;
        a.dispatchEvent = null;
        a.hasEventListener = null;
        a._listeners = null;
        createjs.EventDispatcher.initialize(a);
        a._sendFileLoadEvent = function (b)
        {
            if (a._preloadHash[b])
                for (var c = 0, e = a._preloadHash[b].length; e > c; c++)
                {
                    var d = a._preloadHash[b][c];
                    if (a._preloadHash[b][c] = !0, a.hasEventListener("fileload"))
                    {
                        var f = new createjs.Event("fileload");
                        f.src = d.src;
                        f.id = d.id;
                        f.data = d.data;
                        a.dispatchEvent(f)
                    }
                }
        };
        a.getPreloadHandlers = function ()
        {
            return {
                callback: createjs.proxy(a.initLoad, a),
                types: ["sound"],
                extensions: a.SUPPORTED_EXTENSIONS
            }
        };
        a.registerPlugin = function (b)
        {
            try
            {
                C.log("createjs.Sound.registerPlugin has been deprecated. Please use registerPlugins.")
            }
            catch (c)
            {}
            return a._registerPlugin(b)
        };
        a._registerPlugin = function (b)
        {
            return a._pluginsRegistered = !0, null == b ? !1 : b.isSupported() ? (a.activePlugin = new b, !0) : !1
        };
        a.registerPlugins = function (b)
        {
            for (var c = 0, e = b.length; e > c; c++)
                if (a._registerPlugin(b[c])) return !0;
            return !1
        };
        a.initializeDefaultPlugins = function ()
        {
            return null != a.activePlugin ? !0 : a._pluginsRegistered ? !1 : a.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin]) ? !0 : !1
        };
        a.isReady = function ()
        {
            return null != a.activePlugin
        };
        a.getCapabilities = function ()
        {
            return null == a.activePlugin ?
                null : a.activePlugin._capabilities
        };
        a.getCapability = function (b)
        {
            return null == a.activePlugin ? null : a.activePlugin._capabilities[b]
        };
        a.initLoad = function (b, c, e, d, f)
        {
            b = b.replace(f, "");
            b = a.registerSound(b, e, d, !1, f);
            return null == b ? !1 : b
        };
        a.registerSound = function (c, e, l, d, f)
        {
            if (!a.initializeDefaultPlugins()) return !1;
            var g = (c instanceof Object && (f = e, e = c.id, l = c.data, c = c.src), a.alternateExtensions.length) ? a._parsePath2(c, "sound", e, l) : a._parsePath(c, "sound", e, l);
            if (null == g) return !1;
            null != f && (c = f + c, g.src = f + g.src);
            null != e && (a._idHash[e] = g.src);
            f = null;
            null != l && (isNaN(l.channels) ? isNaN(l) || (f = parseInt(l)) : f = parseInt(l.channels));
            var h = a.activePlugin.register(g.src, f);
            if (null != h && (null != h.numChannels && (f = h.numChannels), b.create(g.src, f), null != l && isNaN(l) ? l.channels = g.data.channels = f || b.maxPerChannel() : l = g.data = f || b.maxPerChannel(), null != h.tag ? g.tag = h.tag : h.src && (g.src = h.src), null != h.completeHandler && (g.completeHandler = h.completeHandler), h.type && (g.type = h.type)), 0 != d)
                if (a._preloadHash[g.src] || (a._preloadHash[g.src] = []), a._preloadHash[g.src].push(
                {
                    src: c,
                    id: e,
                    data: l
                }), 1 == a._preloadHash[g.src].length) a.activePlugin.preload(g.src, h);
                else if (1 == a._preloadHash[g.src][0]) return !0;
            return g
        };
        a.registerManifest = function (a, b)
        {
            for (var c = [], e = 0, d = a.length; d > e; e++) c[e] = createjs.Sound.registerSound(a[e].src, a[e].id, a[e].data, a[e].preload, b);
            return c
        };
        a.removeSound = function (c, e)
        {
            if (null == a.activePlugin) return !1;
            var l = (c instanceof Object && (c = c.src), c = a._getSrcById(c), a.alternateExtensions.length) ? a._parsePath2(c) : a._parsePath(c);
            if (null == l) return !1;
            null != e && (l.src = e + l.src);
            c = l.src;
            for (var d in a._idHash) a._idHash[d] == c && delete a._idHash[d];
            return b.removeSrc(c), delete a._preloadHash[c], a.activePlugin.removeSound(c), !0
        };
        a.removeManifest = function (a, b)
        {
            for (var c = [], e = 0, d = a.length; d > e; e++) c[e] = createjs.Sound.removeSound(a[e].src, b);
            return c
        };
        a.removeAllSounds = function ()
        {
            a._idHash = {};
            a._preloadHash = {};
            b.removeAll();
            a.activePlugin.removeAllSounds()
        };
        a.loadComplete = function (b)
        {
            var c = a.alternateExtensions.length ? a._parsePath2(b,
                "sound") : a._parsePath(b, "sound");
            return b = c ? a._getSrcById(c.src) : a._getSrcById(b), 1 == a._preloadHash[b][0]
        };
        a._parsePath = function (b, c, e, d)
        {
            "string" != typeof b && (b = b.toString());
            b = b.split(a.DELIMITER);
            if (1 < b.length) try
            {
                C.log('createjs.Sound.DELIMITER "|" loading approach has been deprecated. Please use the new alternateExtensions property.')
            }
            catch (f)
            {}
            c = {
                type: c || "sound",
                id: e,
                data: d
            };
            e = a.getCapabilities();
            d = 0;
            for (var g = b.length; g > d; d++)
            {
                var h = b[d],
                    k = h.match(a.FILE_PATTERN);
                if (null == k) return !1;
                var p = k[4],
                    k = k[5];
                if (e[k] && -1 < createjs.indexOf(a.SUPPORTED_EXTENSIONS, k)) return c.name = p, c.src = h, c.extension = k, c
            }
            return null
        };
        a._parsePath2 = function (b, c, e, d)
        {
            "string" != typeof b && (b = b.toString());
            var f = b.match(a.FILE_PATTERN);
            if (null == f) return !1;
            for (var g = f[4], h = f[5], k = a.getCapabilities(), p = 0; !k[h];)
                if (h = a.alternateExtensions[p++], p > a.alternateExtensions.length) return null;
            b = b.replace("." + f[5], "." + h);
            c = {
                type: c || "sound",
                id: e,
                data: d
            };
            return c.name = g, c.src = b, c.extension = h, c
        };
        a.play = function (b, c, e, d, f, g, h)
        {
            b = a.createInstance(b);
            return a._playInstance(b, c, e, d, f, g, h) || b.playFailed(), b
        };
        a.createInstance = function (c)
        {
            if (!a.initializeDefaultPlugins()) return a._defaultSoundInstance;
            var e = (c = a._getSrcById(c), a.alternateExtensions.length) ? a._parsePath2(c, "sound") : a._parsePath(c, "sound");
            c = null;
            return null != e && null != e.src ? (b.create(e.src), c = a.activePlugin.create(e.src)) : c = a._defaultSoundInstance, c.uniqueId = a._lastID++, c
        };
        a.setVolume = function (b)
        {
            if (null == Number(b)) return !1;
            if (b = Math.max(0, Math.min(1, b)), a._masterVolume = b, !this.activePlugin || !this.activePlugin.setVolume || !this.activePlugin.setVolume(b))
                for (var c = this._instances, e = 0, d = c.length; d > e; e++) c[e].setMasterVolume(b)
        };
        a.getVolume = function ()
        {
            return a._masterVolume
        };
        a.setMute = function (a)
        {
            if (null == a || void 0 == a) return !1;
            if (this._masterMute = a, !this.activePlugin || !this.activePlugin.setMute || !this.activePlugin.setMute(a))
                for (var b = this._instances, c = 0, e = b.length; e > c; c++) b[c].setMasterMute(a);
            return !0
        };
        a.getMute = function ()
        {
            return this._masterMute
        };
        a.stop = function ()
        {
            for (var a = this._instances,
                    b = a.length; b--;) a[b].stop()
        };
        a._playInstance = function (b, c, e, d, f, g, h)
        {
            if (c instanceof Object && (e = c.delay, d = c.offset, f = c.loop, g = c.volume, h = c.pan, c = c.interrupt), c = c || a.defaultInterruptBehavior, null == e && (e = 0), null == d && (d = b.getPosition()), null == f && (f = 0), null == g && (g = b.volume), null == h && (h = b.pan), 0 == e)
            {
                if (!a._beginPlaying(b, c, d, f, g, h)) return !1
            }
            else e = s(function ()
            {
                a._beginPlaying(b, c, d, f, g, h)
            }, e), b._delayTimeoutId = e;
            return this._instances.push(b), !0
        };
        a._beginPlaying = function (a, c, e, d, f, g)
        {
            return b.add(a, c) ?
                a._beginPlaying(e, d, f, g) ? !0 : (a = createjs.indexOf(this._instances, a), -1 < a && this._instances.splice(a, 1), !1) : !1
        };
        a._getSrcById = function (b)
        {
            return null == a._idHash || null == a._idHash[b] ? b : a._idHash[b]
        };
        a._playFinished = function (a)
        {
            b.remove(a);
            a = createjs.indexOf(this._instances, a); - 1 < a && this._instances.splice(a, 1)
        };
        createjs.Sound = a;
        b.channels = {};
        b.create = function (a, c)
        {
            return null == b.get(a) ? (b.channels[a] = new b(a, c), !0) : !1
        };
        b.removeSrc = function (a)
        {
            var c = b.get(a);
            return null == c ? !1 : (c.removeAll(), delete b.channels[a], !0)
        };
        b.removeAll = function ()
        {
            for (var a in b.channels) b.channels[a].removeAll();
            b.channels = {}
        };
        b.add = function (a, c)
        {
            var e = b.get(a.src);
            return null == e ? !1 : e.add(a, c)
        };
        b.remove = function (a)
        {
            var c = b.get(a.src);
            return null == c ? !1 : (c.remove(a), !0)
        };
        b.maxPerChannel = function ()
        {
            return e.maxDefault
        };
        b.get = function (a)
        {
            return b.channels[a]
        };
        var e = b.prototype;
        e.src = null;
        e.max = null;
        e.maxDefault = 100;
        e.length = 0;
        e.init = function (a, b)
        {
            this.src = a;
            this.max = b || this.maxDefault; - 1 == this.max && (this.max = this.maxDefault);
            this._instances = []
        };
        e.get = function (a)
        {
            return this._instances[a]
        };
        e.add = function (a, b)
        {
            return this.getSlot(b, a) ? (this._instances.push(a), this.length++, !0) : !1
        };
        e.remove = function (a)
        {
            a = createjs.indexOf(this._instances, a);
            return -1 == a ? !1 : (this._instances.splice(a, 1), this.length--, !0)
        };
        e.removeAll = function ()
        {
            for (var a = this.length - 1; 0 <= a; a--) this._instances[a].stop()
        };
        e.getSlot = function (b)
        {
            for (var c, e, d = 0, f = this.max; f > d; d++)
            {
                if (c = this.get(d), null == c) return !0;
                (b != a.INTERRUPT_NONE || c.playState == a.PLAY_FINISHED) && (0 != d ? c.playState ==
                    a.PLAY_FINISHED || c.playState == a.PLAY_INTERRUPTED || c.playState == a.PLAY_FAILED ? e = c : (b == a.INTERRUPT_EARLY && c.getPosition() < e.getPosition() || b == a.INTERRUPT_LATE && c.getPosition() > e.getPosition()) && (e = c) : e = c)
            }
            return null != e ? (e._interrupt(), this.remove(e), !0) : !1
        };
        e.toString = function ()
        {
            return "[Sound SoundChannel]"
        };
        a._defaultSoundInstance = new function ()
        {
            this.isDefault = !0;
            this.addEventListener = this.removeEventListener = this.removeAllEventListeners = this.dispatchEvent = this.hasEventListener = this._listeners = this._interrupt =
                this._playFailed = this.pause = this.resume = this.play = this._beginPlaying = this._cleanUp = this.stop = this.setMasterVolume = this.setVolume = this.mute = this.setMute = this.getMute = this.setPan = this.getPosition = this.setPosition = this.playFailed = function ()
                {
                    return !1
            };
            this.getVolume = this.getPan = this.getDuration = function ()
            {
                return 0
            };
            this.playState = a.PLAY_FAILED;
            this.toString = function ()
            {
                return "[Sound Default Sound Instance]"
            }
        };
        c.init = function ()
        {
            var a = g.navigator.userAgent;
            c.isFirefox = -1 < a.indexOf("Firefox");
            c.isOpera = null !=
                g.opera;
            c.isChrome = -1 < a.indexOf("Chrome");
            c.isIOS = -1 < a.indexOf("iPod") || -1 < a.indexOf("iPhone") || -1 < a.indexOf("iPad");
            c.isAndroid = -1 < a.indexOf("Android");
            c.isBlackberry = -1 < a.indexOf("Blackberry")
        };
        c.init();
        createjs.Sound.BrowserDetect = c
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        function a()
        {
            this._init()
        }
        a._capabilities = null;
        a.isSupported = function ()
        {
            var b = createjs.Sound.BrowserDetect.isIOS || createjs.Sound.BrowserDetect.isAndroid || createjs.Sound.BrowserDetect.isBlackberry;
            return "file:" != I.protocol ||
                b || this._isFileXHRSupported() ? (a._generateCapabilities(), null == a.context ? !1 : !0) : !1
        };
        a._isFileXHRSupported = function ()
        {
            var a = !0,
                b = new XMLHttpRequest;
            try
            {
                b.open("GET", "fail.fail", !1)
            }
            catch (d)
            {
                return a = !1
            }
            b.onerror = function ()
            {
                a = !1
            };
            b.onload = function ()
            {
                a = 404 == this.status || 200 == this.status || 0 == this.status && "" != this.response
            };
            try
            {
                b.send()
            }
            catch (f)
            {
                a = !1
            }
            return a
        };
        a._generateCapabilities = function ()
        {
            if (null == a._capabilities)
            {
                var b = p.createElement("audio");
                if (null == b.canPlayType) return null;
                if (g.webkitAudioContext) a.context =
                    new webkitAudioContext;
                else
                {
                    if (!g.AudioContext) return null;
                    a.context = new AudioContext
                }
                a._compatibilitySetUp();
                a.playEmptySound();
                a._capabilities = {
                    panning: !0,
                    volume: !0,
                    tracks: -1
                };
                for (var e = createjs.Sound.SUPPORTED_EXTENSIONS, d = createjs.Sound.EXTENSION_MAP, f = 0, l = e.length; l > f; f++)
                {
                    var h = e[f],
                        k = d[h] || h;
                    a._capabilities[h] = "no" != b.canPlayType("audio/" + h) && "" != b.canPlayType("audio/" + h) || "no" != b.canPlayType("audio/" + k) && "" != b.canPlayType("audio/" + k)
                }
                2 > a.context.destination.numberOfChannels && (a._capabilities.panning = !1);
                a.dynamicsCompressorNode = a.context.createDynamicsCompressor();
                a.dynamicsCompressorNode.connect(a.context.destination);
                a.gainNode = a.context.createGain();
                a.gainNode.connect(a.dynamicsCompressorNode)
            }
        };
        a._compatibilitySetUp = function ()
        {
            if (!a.context.createGain)
            {
                a.context.createGain = a.context.createGainNode;
                var b = a.context.createBufferSource();
                b.__proto__.start = b.__proto__.noteGrainOn;
                b.__proto__.stop = b.__proto__.noteOff;
                this._panningModel = 0
            }
        };
        a.playEmptySound = function ()
        {
            var a = this.context.createBuffer(1,
                1, 22050),
                b = this.context.createBufferSource();
            b.buffer = a;
            b.connect(this.context.destination);
            b.start(0, 0, 0)
        };
        var b = a.prototype;
        b._capabilities = null;
        b._volume = 1;
        b.context = null;
        b._panningModel = "equalpower";
        b.dynamicsCompressorNode = null;
        b.gainNode = null;
        b._arrayBuffers = null;
        b._init = function ()
        {
            this._capabilities = a._capabilities;
            this._arrayBuffers = {};
            this.context = a.context;
            this.gainNode = a.gainNode;
            this.dynamicsCompressorNode = a.dynamicsCompressorNode
        };
        b.register = function (a)
        {
            this._arrayBuffers[a] = !0;
            return {
                tag: new createjs.WebAudioPlugin.Loader(a,
                    this)
            }
        };
        b.isPreloadStarted = function (a)
        {
            return null != this._arrayBuffers[a]
        };
        b.isPreloadComplete = function (a)
        {
            return !(null == this._arrayBuffers[a] || 1 == this._arrayBuffers[a])
        };
        b.removeSound = function (a)
        {
            delete this._arrayBuffers[a]
        };
        b.removeAllSounds = function ()
        {
            this._arrayBuffers = {}
        };
        b.addPreloadResults = function (a, b)
        {
            this._arrayBuffers[a] = b
        };
        b._handlePreloadComplete = function ()
        {
            createjs.Sound._sendFileLoadEvent(this.src)
        };
        b.preload = function (a)
        {
            this._arrayBuffers[a] = !0;
            a = new createjs.WebAudioPlugin.Loader(a,
                this);
            a.onload = this._handlePreloadComplete;
            a.load()
        };
        b.create = function (a)
        {
            return this.isPreloadStarted(a) || this.preload(a), new createjs.WebAudioPlugin.SoundInstance(a, this)
        };
        b.setVolume = function (a)
        {
            return this._volume = a, this._updateVolume(), !0
        };
        b._updateVolume = function ()
        {
            var a = createjs.Sound._masterMute ? 0 : this._volume;
            a != this.gainNode.gain.value && (this.gainNode.gain.value = a)
        };
        b.getVolume = function ()
        {
            return this._volume
        };
        b.setMute = function ()
        {
            return this._updateVolume(), !0
        };
        b.toString = function ()
        {
            return "[WebAudioPlugin]"
        };
        createjs.WebAudioPlugin = a
    })();
    (function ()
    {
        function a(a, b)
        {
            this._init(a, b)
        }
        var b = a.prototype = new createjs.EventDispatcher;
        b.src = null;
        b.uniqueId = -1;
        b.playState = null;
        b._owner = null;
        b._offset = 0;
        b._delay = 0;
        b._volume = 1;
        try
        {
            Object.defineProperty(b, "volume",
            {
                get: function ()
                {
                    return this._volume
                },
                set: function (a)
                {
                    return null == Number(a) ? !1 : (a = Math.max(0, Math.min(1, a)), this._volume = a, this._updateVolume(), void 0)
                }
            })
        }
        catch (c)
        {}
        b._pan = 0;
        try
        {
            Object.defineProperty(b, "pan",
            {
                get: function ()
                {
                    return this._pan
                },
                set: function (a)
                {
                    return this._owner._capabilities.panning &&
                        null != Number(a) ? (a = Math.max(-1, Math.min(1, a)), this._pan = a, this.panNode.setPosition(a, 0, -0.5), void 0) : !1
                }
            })
        }
        catch (e)
        {}
        b._duration = 0;
        b._remainingLoops = 0;
        b._delayTimeoutId = null;
        b._soundCompleteTimeout = null;
        b.gainNode = null;
        b.panNode = null;
        b.sourceNode = null;
        b._sourceNodeNext = null;
        b._muted = !1;
        b._paused = !1;
        b._startTime = 0;
        b._endedHandler = null;
        b._sendEvent = function (a)
        {
            a = new createjs.Event(a);
            this.dispatchEvent(a)
        };
        b._init = function (a, b)
        {
            this._owner = b;
            this.src = a;
            this.gainNode = this._owner.context.createGain();
            this.panNode = this._owner.context.createPanner();
            this.panNode.panningModel = this._owner._panningModel;
            this.panNode.connect(this.gainNode);
            this._owner.isPreloadComplete(this.src) && (this._duration = 1E3 * this._owner._arrayBuffers[this.src].duration);
            this._endedHandler = createjs.proxy(this._handleSoundComplete, this)
        };
        b._cleanUp = function ()
        {
            this.sourceNode && this.playState == createjs.Sound.PLAY_SUCCEEDED && (this.sourceNode = this._cleanUpAudioNode(this.sourceNode), this._sourceNodeNext = this._cleanUpAudioNode(this._sourceNodeNext));
            0 != this.gainNode.numberOfOutputs && this.gainNode.disconnect(0);
            u(this._delayTimeoutId);
            u(this._soundCompleteTimeout);
            this._startTime = 0;
            null != g.createjs && createjs.Sound._playFinished(this)
        };
        b._cleanUpAudioNode = function (a)
        {
            return a && (a.stop(0), a.disconnect(this.panNode), a = null), a
        };
        b._interrupt = function ()
        {
            this._cleanUp();
            this.playState = createjs.Sound.PLAY_INTERRUPTED;
            this._paused = !1;
            this._sendEvent("interrupted")
        };
        b._handleSoundReady = function ()
        {
            if (null != g.createjs)
            {
                if (1E3 * this._offset > this.getDuration()) return this.playFailed(),
                void 0;
                0 > this._offset && (this._offset = 0);
                this.playState = createjs.Sound.PLAY_SUCCEEDED;
                this._paused = !1;
                this.gainNode.connect(this._owner.gainNode);
                var a = this._owner._arrayBuffers[this.src].duration;
                this.sourceNode = this._createAndPlayAudioNode(this._owner.context.currentTime - a, this._offset);
                this._duration = 1E3 * a;
                this._startTime = this.sourceNode.startTime - this._offset;
                this._soundCompleteTimeout = s(this._endedHandler, 1E3 * (a - this._offset));
                0 != this._remainingLoops && (this._sourceNodeNext = this._createAndPlayAudioNode(this._startTime,
                    0))
            }
        };
        b._createAndPlayAudioNode = function (a, b)
        {
            var c = this._owner.context.createBufferSource();
            return c.buffer = this._owner._arrayBuffers[this.src], c.connect(this.panNode), this._owner.context.currentTime, c.startTime = a + c.buffer.duration, c.start(c.startTime, b, c.buffer.duration - b), c
        };
        b.play = function (a, b, c, e, d, f)
        {
            this._cleanUp();
            createjs.Sound._playInstance(this, a, b, c, e, d, f)
        };
        b._beginPlaying = function (a, b, c, e)
        {
            return null != g.createjs && this.src ? (this._offset = a / 1E3, this._remainingLoops = b, this.volume = c, this.pan =
                e, this._owner.isPreloadComplete(this.src) ? (this._handleSoundReady(null), this._sendEvent("succeeded"), 1) : (this.playFailed(), void 0)) : void 0
        };
        b.pause = function ()
        {
            return this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED ? !1 : (this._paused = !0, this._offset = this._owner.context.currentTime - this._startTime, this._cleanUpAudioNode(this.sourceNode), this._cleanUpAudioNode(this._sourceNodeNext), 0 != this.gainNode.numberOfOutputs && this.gainNode.disconnect(), u(this._delayTimeoutId), u(this._soundCompleteTimeout), !0)
        };
        b.resume = function ()
        {
            return this._paused ? (this._handleSoundReady(null), !0) : !1
        };
        b.stop = function ()
        {
            return this._cleanUp(), this.playState = createjs.Sound.PLAY_FINISHED, this._offset = 0, !0
        };
        b.setVolume = function (a)
        {
            return this.volume = a, !0
        };
        b._updateVolume = function ()
        {
            var a = this._muted ? 0 : this._volume;
            return a != this.gainNode.gain.value ? (this.gainNode.gain.value = a, !0) : !1
        };
        b.getVolume = function ()
        {
            return this.volume
        };
        b.setMute = function (a)
        {
            return null == a || void 0 == a ? !1 : (this._muted = a, this._updateVolume(), !0)
        };
        b.getMute = function ()
        {
            return this._muted
        };
        b.setPan = function (a)
        {
            return this.pan = a, this.pan != a ? !1 : void 0
        };
        b.getPan = function ()
        {
            return this.pan
        };
        b.getPosition = function ()
        {
            return 1E3 * (this._paused || null == this.sourceNode ? this._offset : this._owner.context.currentTime - this._startTime)
        };
        b.setPosition = function (a)
        {
            return this._offset = a / 1E3, this.sourceNode && this.playState == createjs.Sound.PLAY_SUCCEEDED && (this._cleanUpAudioNode(this.sourceNode), this._cleanUpAudioNode(this._sourceNodeNext), u(this._soundCompleteTimeout)),
            this._paused || this.playState != createjs.Sound.PLAY_SUCCEEDED || this._handleSoundReady(null), !0
        };
        b.getDuration = function ()
        {
            return this._duration
        };
        b._handleSoundComplete = function ()
        {
            return this._offset = 0, 0 != this._remainingLoops ? (this._remainingLoops--, this._sourceNodeNext ? (this._cleanUpAudioNode(this.sourceNode), this.sourceNode = this._sourceNodeNext, this._startTime = this.sourceNode.startTime, this._sourceNodeNext = this._createAndPlayAudioNode(this._startTime, 0), this._soundCompleteTimeout = s(this._endedHandler,
                this._duration)) : this._handleSoundReady(null), this._sendEvent("loop"), void 0) : (null != g.createjs && (this._cleanUp(), this.playState = createjs.Sound.PLAY_FINISHED, this._sendEvent("complete")), void 0)
        };
        b.playFailed = function ()
        {
            null != g.createjs && (this._cleanUp(), this.playState = createjs.Sound.PLAY_FAILED, this._sendEvent("failed"))
        };
        b.toString = function ()
        {
            return "[WebAudioPlugin SoundInstance]"
        };
        createjs.WebAudioPlugin.SoundInstance = a
    })();
    (function ()
    {
        function a(a, b)
        {
            this._init(a, b)
        }
        var b = a.prototype;
        b.request =
            null;
        b.owner = null;
        b.progress = -1;
        b.src = null;
        b.originalSrc = null;
        b.result = null;
        b.onload = null;
        b.onprogress = null;
        b.onError = null;
        b._init = function (a, b)
        {
            this.originalSrc = this.src = a;
            this.owner = b
        };
        b.load = function (a)
        {
            null != a && (this.src = a);
            this.request = new XMLHttpRequest;
            this.request.open("GET", this.src, !0);
            this.request.responseType = "arraybuffer";
            this.request.onload = createjs.proxy(this.handleLoad, this);
            this.request.onError = createjs.proxy(this.handleError, this);
            this.request.onprogress = createjs.proxy(this.handleProgress,
                this);
            this.request.send()
        };
        b.handleProgress = function (a, b)
        {
            this.progress = a / b;
            null != this.onprogress && this.onprogress(
            {
                loaded: a,
                total: b,
                progress: this.progress
            })
        };
        b.handleLoad = function ()
        {
            this.owner.context.decodeAudioData(this.request.response, createjs.proxy(this.handleAudioDecoded, this), createjs.proxy(this.handleError, this))
        };
        b.handleAudioDecoded = function (a)
        {
            this.progress = 1;
            this.result = a;
            this.src = this.originalSrc;
            this.owner.addPreloadResults(this.src, this.result);
            this.onload && this.onload()
        };
        b.handleError =
            function (a)
            {
                this.owner.removeSound(this.src);
                this.onerror && this.onerror(a)
        };
        b.toString = function ()
        {
            return "[WebAudioPlugin Loader]"
        };
        createjs.WebAudioPlugin.Loader = a
    })();
    this.createjs = this.createjs ||
    {};
    (function ()
    {
        function a()
        {
            this._init()
        }
        a.MAX_INSTANCES = 30;
        a._AUDIO_READY = "canplaythrough";
        a._AUDIO_ENDED = "ended";
        a._AUDIO_SEEKED = "seeked";
        a._AUDIO_STALLED = "stalled";
        a._capabilities = null;
        a.enableIOS = !1;
        a.isSupported = function ()
        {
            if (createjs.Sound.BrowserDetect.isIOS && !a.enableIOS) return !1;
            a._generateCapabilities();
            return null == a.tag || null == a._capabilities ? !1 : !0
        };
        a._generateCapabilities = function ()
        {
            if (null == a._capabilities)
            {
                var b = a.tag = p.createElement("audio");
                if (null == b.canPlayType) return null;
                a._capabilities = {
                    panning: !0,
                    volume: !0,
                    tracks: -1
                };
                for (var e = createjs.Sound.SUPPORTED_EXTENSIONS, d = createjs.Sound.EXTENSION_MAP, f = 0, g = e.length; g > f; f++)
                {
                    var h = e[f],
                        k = d[h] || h;
                    a._capabilities[h] = "no" != b.canPlayType("audio/" + h) && "" != b.canPlayType("audio/" + h) || "no" != b.canPlayType("audio/" + k) && "" != b.canPlayType("audio/" + k)
                }
            }
        };
        var b = a.prototype;
        b._capabilities = null;
        b._audioSources = null;
        b.defaultNumChannels = 2;
        b.loadedHandler = null;
        b._init = function ()
        {
            this._capabilities = a._capabilities;
            this._audioSources = {}
        };
        b.register = function (a, b)
        {
            this._audioSources[a] = !0;
            for (var d = createjs.HTMLAudioPlugin.TagPool.get(a), f = null, g = b || this.defaultNumChannels, h = 0; g > h; h++) f = this._createTag(a), d.add(f);
            if (f.id = a, this.loadedHandler = createjs.proxy(this._handleTagLoad, this), f.addEventListener && f.addEventListener("canplaythrough", this.loadedHandler),
                null == f.onreadystatechange) f.onreadystatechange = this.loadedHandler;
            else
            {
                var k = f.onreadystatechange;
                f.onreadystatechange = function ()
                {
                    k();
                    this.loadedHandler()
                }
            }
            return {
                tag: f,
                numChannels: g
            }
        };
        b._handleTagLoad = function (a)
        {
            a.target.removeEventListener && a.target.removeEventListener("canplaythrough", this.loadedHandler);
            a.target.onreadystatechange = null;
            a.target.src != a.target.id && createjs.HTMLAudioPlugin.TagPool.checkSrc(a.target.id)
        };
        b._createTag = function (a)
        {
            var b = p.createElement("audio");
            return b.autoplay = !1, b.preload = "none", b.src = a, b
        };
        b.removeSound = function (a)
        {
            delete this._audioSources[a];
            createjs.HTMLAudioPlugin.TagPool.remove(a)
        };
        b.removeAllSounds = function ()
        {
            this._audioSources = {};
            createjs.HTMLAudioPlugin.TagPool.removeAll()
        };
        b.create = function (a)
        {
            if (!this.isPreloadStarted(a))
            {
                var b = createjs.HTMLAudioPlugin.TagPool.get(a),
                    d = this._createTag(a);
                d.id = a;
                b.add(d);
                this.preload(a,
                {
                    tag: d
                })
            }
            return new createjs.HTMLAudioPlugin.SoundInstance(a, this)
        };
        b.isPreloadStarted = function (a)
        {
            return null != this._audioSources[a]
        };
        b.preload = function (a, b)
        {
            this._audioSources[a] = !0;
            new createjs.HTMLAudioPlugin.Loader(a, b.tag)
        };
        b.toString = function ()
        {
            return "[HTMLAudioPlugin]"
        };
        createjs.HTMLAudioPlugin = a
    })();
    (function ()
    {
        function a(a, b)
        {
            this._init(a, b)
        }
        var b = a.prototype = new createjs.EventDispatcher;
        b.src = null;
        b.uniqueId = -1;
        b.playState = null;
        b._owner = null;
        b.loaded = !1;
        b._offset = 0;
        b._delay = 0;
        b._volume = 1;
        try
        {
            Object.defineProperty(b, "volume",
            {
                get: function ()
                {
                    return this._volume
                },
                set: function (a)
                {
                    null != Number(a) && (a = Math.max(0, Math.min(1,
                        a)), this._volume = a, this._updateVolume())
                }
            })
        }
        catch (c)
        {}
        b.pan = 0;
        b._duration = 0;
        b._remainingLoops = 0;
        b._delayTimeoutId = null;
        b.tag = null;
        b._muted = !1;
        b._paused = !1;
        b._endedHandler = null;
        b._readyHandler = null;
        b._stalledHandler = null;
        b.loopHandler = null;
        b._init = function (a, b)
        {
            this.src = a;
            this._owner = b;
            this._endedHandler = createjs.proxy(this._handleSoundComplete, this);
            this._readyHandler = createjs.proxy(this._handleSoundReady, this);
            this._stalledHandler = createjs.proxy(this._handleSoundStalled, this);
            this.loopHandler = createjs.proxy(this.handleSoundLoop,
                this)
        };
        b._sendEvent = function (a)
        {
            a = new createjs.Event(a);
            this.dispatchEvent(a)
        };
        b._cleanUp = function ()
        {
            var a = this.tag;
            if (null != a)
            {
                a.pause();
                a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED, this._endedHandler, !1);
                a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1);
                a.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1);
                try
                {
                    a.currentTime = 0
                }
                catch (b)
                {}
                createjs.HTMLAudioPlugin.TagPool.setInstance(this.src, a);
                this.tag = null
            }
            u(this._delayTimeoutId);
            null != g.createjs && createjs.Sound._playFinished(this)
        };
        b._interrupt = function ()
        {
            null != this.tag && (this.playState = createjs.Sound.PLAY_INTERRUPTED, this._cleanUp(), this._paused = !1, this._sendEvent("interrupted"))
        };
        b.play = function (a, b, c, d, f, g)
        {
            this._cleanUp();
            createjs.Sound._playInstance(this, a, b, c, d, f, g)
        };
        b._beginPlaying = function (a, b, c, d)
        {
            if (null == g.createjs) return -1;
            var f = this.tag = createjs.HTMLAudioPlugin.TagPool.getInstance(this.src);
            return null == f ? (this.playFailed(), -1) : (f.addEventListener(createjs.HTMLAudioPlugin._AUDIO_ENDED,
                this._endedHandler, !1), this._offset = a, this.volume = c, this.pan = d, this._updateVolume(), this._remainingLoops = b, 4 !== f.readyState ? (f.addEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), f.addEventListener(createjs.HTMLAudioPlugin._AUDIO_STALLED, this._stalledHandler, !1), f.preload = "auto", f.load()) : this._handleSoundReady(null), this._sendEvent("succeeded"), 1)
        };
        b._handleSoundStalled = function ()
        {
            this._cleanUp();
            this._sendEvent("failed")
        };
        b._handleSoundReady = function ()
        {
            if (null != g.createjs)
            {
                if (this._duration =
                    1E3 * this.tag.duration, this.playState = createjs.Sound.PLAY_SUCCEEDED, this._paused = !1, this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_READY, this._readyHandler, !1), this._offset >= this.getDuration()) return this.playFailed(), void 0;
                0 < this._offset && (this.tag.currentTime = 0.001 * this._offset); - 1 == this._remainingLoops && (this.tag.loop = !0);
                0 != this._remainingLoops && (this.tag.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1), this.tag.loop = !0);
                this.tag.play()
            }
        };
        b.pause = function ()
        {
            return this._paused ||
                this.playState != createjs.Sound.PLAY_SUCCEEDED || null == this.tag ? !1 : (this._paused = !0, this.tag.pause(), u(this._delayTimeoutId), !0)
        };
        b.resume = function ()
        {
            return this._paused && null != this.tag ? (this._paused = !1, this.tag.play(), !0) : !1
        };
        b.stop = function ()
        {
            return this._offset = 0, this.pause(), this.playState = createjs.Sound.PLAY_FINISHED, this._cleanUp(), !0
        };
        b.setMasterVolume = function ()
        {
            return this._updateVolume(), !0
        };
        b.setVolume = function (a)
        {
            return this.volume = a, !0
        };
        b._updateVolume = function ()
        {
            if (null != this.tag)
            {
                var a =
                    this._muted || createjs.Sound._masterMute ? 0 : this._volume * createjs.Sound._masterVolume;
                return a != this.tag.volume && (this.tag.volume = a), !0
            }
            return !1
        };
        b.getVolume = function ()
        {
            return this.volume
        };
        b.setMasterMute = function ()
        {
            return this._updateVolume(), !0
        };
        b.setMute = function (a)
        {
            return null == a || void 0 == a ? !1 : (this._muted = a, this._updateVolume(), !0)
        };
        b.getMute = function ()
        {
            return this._muted
        };
        b.setPan = function ()
        {
            return !1
        };
        b.getPan = function ()
        {
            return 0
        };
        b.getPosition = function ()
        {
            return null == this.tag ? this._offset : 1E3 *
                this.tag.currentTime
        };
        b.setPosition = function (a)
        {
            if (null == this.tag) this._offset = a;
            else
            {
                this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1);
                try
                {
                    this.tag.currentTime = 0.001 * a
                }
                catch (b)
                {
                    return !1
                }
                this.tag.addEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1)
            }
            return !0
        };
        b.getDuration = function ()
        {
            return this._duration
        };
        b._handleSoundComplete = function ()
        {
            this._offset = 0;
            null != g.createjs && (this.playState = createjs.Sound.PLAY_FINISHED, this._cleanUp(), this._sendEvent("complete"))
        };
        b.handleSoundLoop = function ()
        {
            this._offset = 0;
            this._remainingLoops--;
            0 == this._remainingLoops && (this.tag.loop = !1, this.tag.removeEventListener(createjs.HTMLAudioPlugin._AUDIO_SEEKED, this.loopHandler, !1));
            this._sendEvent("loop")
        };
        b.playFailed = function ()
        {
            null != g.createjs && (this.playState = createjs.Sound.PLAY_FAILED, this._cleanUp(), this._sendEvent("failed"))
        };
        b.toString = function ()
        {
            return "[HTMLAudioPlugin SoundInstance]"
        };
        createjs.HTMLAudioPlugin.SoundInstance = a
    })();
    (function ()
    {
        function a(a, b)
        {
            this._init(a,
                b)
        }
        var b = a.prototype;
        b.src = null;
        b.tag = null;
        b.preloadTimer = null;
        b.loadedHandler = null;
        b._init = function (a, b)
        {
            if (this.src = a, this.tag = b, this.preloadTimer = setInterval(createjs.proxy(this.preloadTick, this), 200), this.loadedHandler = createjs.proxy(this.sendLoadedEvent, this), this.tag.addEventListener && this.tag.addEventListener("canplaythrough", this.loadedHandler), null == this.tag.onreadystatechange) this.tag.onreadystatechange = createjs.proxy(this.sendLoadedEvent, this);
            else
            {
                var d = this.tag.onreadystatechange;
                this.tag.onreadystatechange =
                    function ()
                    {
                        d();
                        this.tag.onreadystatechange = createjs.proxy(this.sendLoadedEvent, this)
                }
            }
            this.tag.preload = "auto";
            this.tag.load()
        };
        b.preloadTick = function ()
        {
            var a = this.tag.buffered,
                b = this.tag.duration;
            0 < a.length && a.end(0) >= b - 1 && this.handleTagLoaded()
        };
        b.handleTagLoaded = function ()
        {
            clearInterval(this.preloadTimer)
        };
        b.sendLoadedEvent = function ()
        {
            this.tag.removeEventListener && this.tag.removeEventListener("canplaythrough", this.loadedHandler);
            this.tag.onreadystatechange = null;
            createjs.Sound._sendFileLoadEvent(this.src)
        };
        b.toString = function ()
        {
            return "[HTMLAudioPlugin Loader]"
        };
        createjs.HTMLAudioPlugin.Loader = a
    })();
    (function ()
    {
        function a(a)
        {
            this._init(a)
        }
        a.tags = {};
        a.get = function (b)
        {
            var e = a.tags[b];
            return null == e && (e = a.tags[b] = new a(b)), e
        };
        a.remove = function (b)
        {
            var e = a.tags[b];
            return null == e ? !1 : (e.removeAll(), delete a.tags[b], !0)
        };
        a.removeAll = function ()
        {
            for (var b in a.tags) a.tags[b].removeAll();
            a.tags = {}
        };
        a.getInstance = function (b)
        {
            b = a.tags[b];
            return null == b ? null : b.get()
        };
        a.setInstance = function (b, e)
        {
            var d = a.tags[b];
            return null ==
                d ? null : d.set(e)
        };
        a.checkSrc = function (b)
        {
            b = a.tags[b];
            return null == b ? null : (b.checkSrcChange(), void 0)
        };
        var b = a.prototype;
        b.src = null;
        b.length = 0;
        b.available = 0;
        b.tags = null;
        b._init = function (a)
        {
            this.src = a;
            this.tags = []
        };
        b.add = function (a)
        {
            this.tags.push(a);
            this.length++;
            this.available++
        };
        b.removeAll = function ()
        {
            for (; this.length--;) delete this.tags[this.length];
            this.src = null;
            this.tags.length = 0
        };
        b.get = function ()
        {
            if (0 == this.tags.length) return null;
            this.available = this.tags.length;
            var a = this.tags.pop();
            return null ==
                a.parentNode && p.body.appendChild(a), a
        };
        b.set = function (a)
        {
            -1 == createjs.indexOf(this.tags, a) && this.tags.push(a);
            this.available = this.tags.length
        };
        b.checkSrcChange = function ()
        {
            for (var a = this.tags.length - 1, b = this.tags[a].src; a--;) this.tags[a].src = b
        };
        b.toString = function ()
        {
            return "[HTMLAudioPlugin TagPool]"
        };
        createjs.HTMLAudioPlugin.TagPool = a
    })();
    r.doRectsIntersect = function (a, b)
    {
        return 2 * Math.abs(a.getCenterX() - b.getCenterX()) < a.getWidth() + b.getWidth() && 2 * Math.abs(a.getCenterY() - b.getCenterY()) < a.getHeight() +
            b.getHeight()
    };
    r.prototype = {
        getCenter: function ()
        {
            return {
                x: this.getCenterX(),
                y: this.getCenterY()
            }
        },
        getCenterX: function ()
        {
            return (this.left + this.right) / 2
        },
        getCenterY: function ()
        {
            return (this.top + this.bottom) / 2
        },
        setX: function (a)
        {
            var b = this.getWidth();
            this.left = a;
            this.right = a + b
        },
        setY: function (a)
        {
            var b = this.getHeight();
            this.top = a;
            this.bottom = a + b
        },
        setPosition: function (a, b)
        {
            this.setX(a);
            this.setY(b)
        },
        checkDimensions: function ()
        {
            var a;
            this.left > this.right && (a = this.left, this.left = this.right, this.right = a);
            this.top >
                this.bottom && (a = this.top, this.top = this.bottom, this.bottom = a)
        },
        translate: function (a, b)
        {
            this.translateX(a);
            this.translateY(b)
        },
        translateX: function (a)
        {
            this.left += a;
            this.right += a
        },
        translateY: function (a)
        {
            this.top += a;
            this.bottom += a
        },
        getWidth: function ()
        {
            return this.right - this.left
        },
        getHeight: function ()
        {
            return this.bottom - this.top
        },
        containsPoint: function (a, b)
        {
            return a >= this.left && a < this.right && b >= this.top && b < this.bottom
        },
        intersectsRect: function (a)
        {
            return r.doRectsIntersect(this, a)
        }
    };
    var f;
    (function ()
    {
        f = {
            getDigits: function (a)
            {
                var b = [];
                if (0 === a) b.push(0);
                else if (0 < a)
                    for (; 0 < a;) b.unshift(a % 10), a = Math.floor(a / 10);
                return b
            },
            makeUnselectable: function (a, b)
            {
                if (a && (1 === a.nodeType && a.setAttribute("unselectable", "on"), b))
                    for (var c = a.firstChild; c;) f.makeUnselectable(c, b), c = c.nextSibling
            },
            addClass: function (a, b)
            {
                var c = a.hasOwnProperty("className"),
                    e = c ? a.className : a.getAttribute("class"),
                    d = [],
                    f = "object" === typeof b && "number" === typeof b.length ? b : [b],
                    g;
                "string" === typeof e && 0 < e.length && (d = e.split(" "));
                for (g = 0; g < f.length; g += 1) e = f[g], -1 === d.indexOf(e) &&
                    d.push(e);
                c ? a.className = d.join(" ") : a.setAttribute("class", d.join(" "))
            },
            removeClass: function (a, b)
            {
                var c = a.hasOwnProperty("className"),
                    e = c ? a.className : a.getAttribute("class"),
                    d = [],
                    f, g = "object" === typeof b && "number" === typeof b.length ? b : [b];
                "string" === typeof e && 0 < e.length && (d = e.split(" "));
                for (e = 0; e < g.length; e += 1) f = g[e], f = d.indexOf(f), -1 !== f && d.splice(f, 1);
                c ? a.className = d.join(" ") : a.setAttribute("class", d.join(" "))
            },
            hasClass: function (a, b)
            {
                var c, e = [];
                return a.getAttribute ? (c = a.getAttribute("class"),
                    "string" === typeof c && 0 < c.length && (e = c.split(" ")), -1 !== e.indexOf(b)) : !1
            },
            countProps: function (a)
            {
                var b = 0,
                    c;
                for (c in a) a.hasOwnProperty(c) && (b += 1);
                return b
            },
            cloneObject: function (a, b)
            {
                var c, e;
                if ("string" === typeof a) c = a;
                else
                    for (e in c = {}, a) a.hasOwnProperty(e) && (c[e] = b && "object" === typeof a[e] ? f.cloneObject(a[e], b) : a[e]);
                return c
            },
            extendObj: function (a, b, c)
            {
                var e;
                b = f.cloneObject(b, c);
                for (e in a) a.hasOwnProperty(e) && (c && b.hasOwnProperty(e) && "object" === typeof b[e] && "object" === typeof a[e] && (b[e] = f.extendObj(a[e],
                    b[e], c)), b.hasOwnProperty(e) || (f.isNativeObject(a[e]) ? b[e] = a[e] ? f.cloneObject(a[e], c) : null : b[e] = a[e]));
                return b
            },
            inherit: function ()
            {
                var a, b, c, e;
                for (b = 0; b < arguments.length; b += 1)
                    if (e = null, "function" === typeof arguments[b] ? e = new arguments[b] : "object" === typeof arguments[b] && (e = arguments[b]), e)
                        if (a)
                            for (c in e) e.hasOwnProperty(c) && (a[c] = e[c]);
                        else a = e;
                return a
            },
            objectToParamString: function (a)
            {
                var b, c = [];
                for (b in a) a.hasOwnProperty(b) && c.push(b + "=" + a[b]);
                return c.join("&")
            },
            paramStringToObject: function (a)
            {
                var b = {}, c, e, d;
                if (a && "string" === typeof a && 1 < a.length)
                    for ("?" === a[0] && (a = a.substr(1)), a = a.split("&"), c = 0; c < a.length; c += 1) e = a[c].split("=", 2), 2 === e.length && (d = e[0], e = e[1], d && e && (b[d] = e));
                return b
            },
            ajaxBaseUrl: "",
            ajax: function (a)
            {
                if ("object" === typeof a && "string" === typeof a.url)
                {
                    var b, c, e, d, g, h, k, r, q, t;
                    e = a && a.params && "object" === typeof a.params ? a.params : null;
                    g = a && a.headers && "object" === typeof a.headers ? a.headers : null;
                    c = f.ajaxBaseUrl + a.url;
                    if (JSON && JSON.parse)
                    {
                        b = new XMLHttpRequest;
                        d = null;
                        h = "function" === typeof a.success ?
                            a.success : null;
                        d = "function" === typeof a.fail ? a.fail : null;
                        k = "function" === typeof a.error ? a.error : d;
                        r = "function" === typeof a.abort ? a.abort : d;
                        e && (d = f.objectToParamString(e), c += "?" + d);
                        b.open("GET", c);
                        if (g)
                            for (t in g) g.hasOwnProperty(t) && b.setRequestHeader(t, g[t]);
                        b.onload = function ()
                        {
                            if (h)
                            {
                                var a = null;
                                try
                                {
                                    a = JSON.parse(this.responseText)
                                }
                                catch (b)
                                {
                                    a = null
                                }
                                a ? h(a) : k && k(
                                {
                                    status: "error",
                                    statusCode: this.status,
                                    message: "JSON parse error"
                                })
                            }
                        };
                        b.onerror = function ()
                        {
                            k && k(
                            {
                                status: "error",
                                statusCode: this.status
                            })
                        };
                        b.onabort =
                            function ()
                            {
                                r && r(
                                {
                                    status: "abort"
                                })
                        };
                        b.send()
                    }
                    else "string" === typeof a.jsonp && (e || (e = {}), e.callback = a.callback, d = f.objectToParamString(e), q = f.createScript(c + "?" + d), p.body.appendChild(q), s(function ()
                    {
                        q.parentNode && q.parentNode.removeChild(q)
                    }, 10))
                }
            },
            createScript: function (a, b)
            {
                var c = p.createElement("script");
                c.type = "text/javascript";
                a && (c.src = a);
                b && (c.innerHTML = b);
                return c
            },
            isPropertySupported: function (a)
            {
                var b = ["Webkit", "Khtml", "Moz", "O", "ms"],
                    c = (p.body || p.documentElement).style,
                    e = a.charAt(0).toUpperCase() +
                        a.substring(1);
                if ("string" === typeof c[a]) return !0;
                for (a = 0; a < b.length; a += 1)
                    if ("undefined" !== typeof c[b[a] + e]) return !0;
                return !1
            },
            getPrefixedProperty: function (a, b)
            {
                var c = ["Webkit", "Khtml", "Moz", "O", "ms"],
                    e = b.style,
                    d = a.charAt(0).toUpperCase() + a.substring(1),
                    f;
                if ("string" === typeof e[a]) return a;
                for (f = 0; f < c.length; f += 1)
                    if ("undefined" !== typeof e[c[f] + d]) return c[f] + d;
                return a
            },
            addOnClick: function (a, b, c)
            {
                a.onclick = b;
                c && a.addEventListener("touchstart", function (a)
                {
                    a.currentTarget.onclick(a);
                    a.preventDefault();
                    a.stopPropagation();
                    return !1
                }, !1)
            },
            isMobile:
            {
                Android: function ()
                {
                    return navigator.userAgent.match(/Android/i)
                },
                FirefoxOS: function ()
                {
                    return -1 == navigator.userAgent.indexOf("Android") && 0 <= navigator.userAgent.indexOf("Firefox") && 0 <= navigator.userAgent.indexOf("Mobile")
                },
                BlackBerry: function ()
                {
                    return navigator.userAgent.match(/BlackBerry/i)
                },
                iOS: function ()
                {
                    return navigator.userAgent.match(/iPhone|iPad|iPod/i)
                },
                iPod: function ()
                {
                    return navigator.userAgent.match(/iPod/i)
                },
                iPhone: function ()
                {
                    return navigator.userAgent.match(/iPhone/i)
                },
                iPad: function ()
                {
                    return navigator.userAgent.match(/iPad/i)
                },
                Opera: function ()
                {
                    return navigator.userAgent.match(/Opera Mini/i)
                },
                Windows: function ()
                {
                    return navigator.userAgent.match(/IEMobile/i)
                },
                any: function ()
                {
                    return f.isMobile.Android() || f.isMobile.BlackBerry() || f.isMobile.iOS() || f.isMobile.Opera() || f.isMobile.Windows() || f.isMobile.FirefoxOS()
                },
                Safari: function ()
                {
                    return f.isMobile.iOS() && !f.isMobile.ChromeIOS() && navigator.userAgent.match(/AppleWebKit/i)
                },
                iPhoneSafari: function ()
                {
                    return (f.isMobile.iPhone() ||
                        f.isMobile.iPod()) && !f.isMobile.ChromeIOS() && navigator.userAgent.match(/AppleWebKit/i)
                },
                ChromeIOS: function ()
                {
                    return f.isMobile.iOS() && navigator.userAgent.match("CriOS")
                },
                ChromeAndroid: function ()
                {
                    return navigator.userAgent.match(/Android.+Chrome|CrMo/i)
                }
            },
            getIOSVersion: function ()
            {
                var a = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),
                    a = [parseInt(a[1], 10), parseInt(a[2], 10), parseInt(a[3] || 0, 10)];
                return parseFloat(a.join("."))
            },
            visibility:
            {
                MAP:
                {
                    hidden: "visibilitychange",
                    mozHidden: "mozvisibilitychange",
                    msHidden: "msvisibilitychange",
                    webkitHidden: "webkitvisibilitychange"
                },
                mIsSupported: !1,
                mCheckedIfSupported: !1,
                mHidden: null,
                mVisibilityChange: null,
                mOnChangeFunctions: [],
                addOnChange: function (a)
                {
                    return this.isSupported() && -1 === this.mOnChangeFunctions.indexOf(a) ? (p.addEventListener(this.mVisibilityChange, a, !1), !0) : !1
                },
                removeOnChange: function (a)
                {
                    if (this.isSupported())
                    {
                        var b = this.mOnChangeFunctions.indexOf(a);
                        if (-1 !== b) return p.removeEventListener(this.mVisibilityChange, a), this.mOnChangeFunctions.splice(b,
                            1), !0
                    }
                    return !1
                },
                getOnChangeFunctions: function ()
                {
                    return this.mOnChangeFunctions
                },
                isSupported: function ()
                {
                    if (!this.mCheckedIfSupported)
                    {
                        for (var a in this.MAP)
                            if (this.MAP.hasOwnProperty(a) && "undefined" !== typeof p[a])
                            {
                                this.mHidden = a;
                                this.mVisibilityChange = this.MAP[a];
                                this.mIsSupported = !0;
                                break
                            }
                        this.mCheckedIfSupported = !0
                    }
                    return this.mIsSupported
                },
                isHidden: function ()
                {
                    return this.isSupported() ? p[this.mHidden] : !1
                }
            },
            bindFnc: function (a, b)
            {
                return function ()
                {
                    return b.apply(a, arguments)
                }
            }
        }
    })();
    D.prototype = {
        get: function (a)
        {
            var b =
                this.map[a];
            b || (this.map[a] = b = p.getElementById(a));
            return b
        },
        create: function (a, b, c, e)
        {
            a = p.createElement(a);
            var d;
            b && (a.hasOwnProperty("id") ? a.id = b : a.setAttribute("id", b));
            c && (a.hasOwnProperty("className") ? a.className = c : a.setAttribute("class", c));
            if (e)
                for (d in e) e.hasOwnProperty(d) && (a.hasOwnProperty(d) ? a[d] = e[d] : a.setAttribute(d, e[d]));
            return a
        }
    };
    var h = new D;
    A.prototype = {
        addEventListener: function (a, b)
        {
            return "function" === typeof b && (this.eventMap.hasOwnProperty(a) || (this.eventMap[a] = []), -1 === this.eventMap[a].indexOf(b)) ?
                (this.eventMap[a].push(b), !0) : !1
        },
        removeEventListener: function (a, b)
        {
            if ("function" === typeof b && this.eventMap[a])
            {
                var c = this.eventMap[a].indexOf(b);
                if (-1 !== c) return this.eventMap[a].splice(c, 1), !0
            }
            return !1
        },
        removeAllEventListeners: function (a)
        {
            if (this.eventMap[a])
            {
                for (a = this.eventMap[a]; 0 < a.length;) a.pop();
                return !0
            }
            return !1
        },
        dispatch: function (a, b)
        {
            var c = {
                source: this,
                name: a,
                data: b
            }, d, f;
            if (this.eventMap[a])
            {
                f = this.eventMap[a];
                for (d = 0; d < f.length; d += 1) f[d](c);
                return !0
            }
            return !1
        }
    };
    E.prototype = {
        getCookie: function (a,
            b, c)
        {
            if (this.cookieMap[a]) return this.cookieMap[a];
            c && this.setCookie(a, b, c);
            return b
        },
        setCookie: function (a, b, c)
        {
            var d = new Date;
            d.setSeconds(d.getSeconds() + c);
            p.cookie = a + "=" + b + "; expires=" + d.toUTCString();
            this.cookieMap[a] = b
        },
        parseCookies: function ()
        {
            return p.cookie.split(";").map(function (a)
            {
                return a.trim().split("=")
            }).reduce(function (a, b)
            {
                a[b[0]] = b[1];
                return a
            },
            {})
        }
    };
    var H = new E;
    B.prototype = {
        update: function (a, b, c, d) {}
    };
    v.prototype = {
        draw: function (a) {}
    };
    t.prototype = f.inherit(new v,
    {
        addChild: function (a)
        {
            return -1 ===
                this.children.indexOf(a) ? (a.parent = this, this.children.push(a), !0) : !1
        },
        removeChild: function (a)
        {
            var b = this.children.indexOf(a);
            return -1 !== b ? (a.parent = null, this.children.splice(b, 1), a) : null
        },
        removeChildAt: function (a)
        {
            return a < this.children.length ? (this.children[a].parent = null, this.children.splice(a, 1)) : null
        },
        removeAllChilds: function ()
        {
            for (; 0 < this.children.length;) this.removeChildAt(0)
        },
        draw: function (a)
        {
            if (this.visible)
            {
                var b;
                for (b = 0; b < this.children.length; b += 1) a.save(), a.translate(this.x - this.anchorX,
                    this.y - this.anchorY), a.scale(this.scaleX, this.scaleY), this.children[b].draw(a), a.restore()
            }
        }
    });
    w.prototype = f.inherit(new v,
    {
        draw: function (a)
        {
            a.save();
            a.translate(this.x, this.y);
            a.scale(this.scaleX, this.scaleY);
            a.rotate(this.angle);
            a.drawImage(this.image, this.sourceX, this.sourceY, this.sourceWidth, this.sourceHeight, -this.anchorX, -this.anchorY, this.width, this.height);
            a.restore()
        }
    });
    z.prototype = f.inherit(new v,
    {
        draw: function (a)
        {
            var b = 0 !== this.imageWidth ? this.offsetX % this.imageWidth : this.offsetX,
                c = 0 !==
                    this.imageHeight ? this.offsetY % this.imageHeight : this.offsetY;
            a.save();
            a.translate(this.x, this.y);
            a.scale(this.imageScaleX, this.imageScaleY);
            a.rotate(this.angle);
            a.translate(b / this.imageScaleX + this.imageOffsetX, c / this.imageScaleY + this.imageOffsetY);
            a.fillStyle = this.pattern;
            a.fillRect(-b / this.imageScaleX - this.imageOffsetX, -c / this.imageScaleY - this.imageOffsetY, this.width * this.scaleX / this.imageScaleX, this.height * this.scaleY / this.imageScaleY);
            a.restore()
        }
    });
    y.imgOnLoad = function (a)
    {
        if (this.onLoadFunction) this.onLoadFunction(this)
    };
    y.imgOnError = function (a)
    {
        if (this.onErrorFunction) this.onErrorFunction(this)
    };
    F.prototype = f.inherit(new t,
    {
        setNumber: function (a)
        {
            this.number = Math.floor(a);
            this.updateNumber()
        },
        updateNumber: function ()
        {
            var a, b = f.getDigits(this.number),
                c = [],
                d = 0,
                g = 0,
                h = 0,
                l;
            this.removeAllChilds();
            for (l = 0; l < b.length; l += 1) a = b[l], c.push(new w(
            {
                img: this.numberImages[a],
                width: this.numberImages[a].width * this.scaleX,
                height: this.numberImages[a].height * this.scaleY
            })), g += this.numberImages[a].width * this.scaleX, ("middle" === this.verticalAlign ||
                "bottom" === this.verticalAlign) && this.numberImages[l].height > h && (h = this.numberImages[a].height * this.scaleY);
            for (l = 0; l < c.length; l += 1)
            {
                b = a = 0;
                switch (this.horizontalAlign)
                {
                case "left":
                    a = d;
                    break;
                case "center":
                    a = -g / 2 + d;
                    break;
                case "right":
                    a = -g + d
                }
                d += c[l].width;
                switch (this.verticalAlign)
                {
                case "top":
                    b = h / 2 - c[l].height / 2;
                    break;
                case "middle":
                    b = -c[l].height / 2;
                    break;
                case "bottom":
                    b = -h / 2 - c[l].height / 2
                }
                c[l].x = a;
                c[l].y = b;
                this.addChild(c[l])
            }
        }
    });
    q.events = {
        imageLoad: "imageload",
        imageError: "imageerror",
        allImagesLoad: "allimagesload"
    };
    q.prototype = f.inherit(new A,
    {
        startLoading: function ()
        {
            var a, b = f.bindFnc(this, this.imageLoaded),
                c = f.bindFnc(this, this.imageErrored);
            for (a in this.imgListObj) this.imgListObj.hasOwnProperty(a) && (this.imgs[a] = this.imgs[this.imgListObj[a]] = new y(this.imgListObj[a]), this.imgCount += 1, this.imgs[a].imgName = a, this.imgs[a].load(b, c));
            0 === this.imgCount && this.dispatch(q.events.allImagesLoad,
            {
                loaded: this.imgLoaded,
                total: this.imgCount
            })
        },
        imageLoaded: function (a)
        {
            this.imgLoaded += 1;
            this.dispatch(q.events.imageLoad,
            {
                img: a,
                loaded: this.imgLoaded,
                total: this.imgCount
            });
            this.imgLoaded >= this.imgCount && this.dispatch(q.events.allImagesLoad,
            {
                loaded: this.imgLoaded,
                total: this.imgCount
            })
        },
        imageErrored: function (a)
        {
            this.imgLoaded += 1;
            this.dispatch(q.events.imageError,
            {
                img: a,
                loaded: this.imgLoaded,
                total: this.imgCount
            })
        },
        get: function (a)
        {
            return this.imgs[a]
        }
    });
    x.events = {
        soundLoad: "soundload",
        soundError: "sounderror",
        allSoundsLoad: "allsoundsload"
    };
    x.prototype = f.inherit(new A,
    {
        startLoading: function ()
        {
            var a, b = [];
            for (a in this.soundMap) this.soundMap.hasOwnProperty(a) &&
                (b.push(
            {
                id: a,
                src: this.soundMap[a]
            }), this.soundsCount += 1, g.cordova && (this.cordovaSounds[this.soundMap[a]] = new Media("file:///android_asset/www/" + this.soundMap[a], function () {}, function ()
            {
                C.log("Error while playing " + this.src)
            })));
            if (g.cordova)
                for (a in this.soundMap) this.soundLoaded();
            else createjs.Sound.addEventListener("fileload", f.bindFnc(this, this.soundLoaded)), createjs.Sound.registerManifest(b, "")
        },
        soundLoaded: function (a)
        {
            this.soundsLoaded += 1;
            this.dispatch(x.events.soundLoad,
            {
                loaded: this.soundsLoaded,
                total: this.soundsCount
            });
            this.soundsLoaded >= this.soundsCount && this.dispatch(x.events.allSoundsLoad,
            {
                loaded: this.soundsLoaded,
                total: this.soundsCount
            })
        },
        soundErrored: function (a)
        {
            this.soundsError += 1
        },
        get: function (a)
        {
            return this.sounds[a]
        },
        play: function (a)
        {
            this.enabled && (g.cordova ? this.cordovaSounds[a].play() : createjs.Sound.play(a))
        },
        stop: function (a)
        {
            this.enabled && !g.cordova && createjs.Sound.stop(a)
        }
    });
    k.gravity = 2500;
    k.cruisingOscPeriod = 800;
    k.cruisingOscHeight = 10;
    k.states = {
        cruising: "cruising",
        flapping: "flapping",
        stalling: "stalling",
        flyingDead: "flyingdead",
        groundDead: "grounddead"
    };
    k.spriteSpeeds = {
        cruising: 150,
        flapping: 50,
        stalling: 0,
        flyingDead: 0,
        groundDead: 0
    };
    k.PI2 = 2 * Math.PI;
    k.prototype = f.inherit(new w, new B,
    {
        setX: function (a)
        {
            this.x = a
        },
        setY: function (a)
        {
            this.y = a
        },
        setPosition: function (a, b)
        {
            this.setX(a);
            this.setY(b)
        },
        isAlive: function ()
        {
            return this.state !== k.states.flyingDead && this.state !== k.states.groundDead
        },
        update: function (a, b, c, d)
        {
            a = 0;
            switch (this.state)
            {
            case k.states.cruising:
                a = Math.floor(c / k.spriteSpeeds.cruising) %
                    this.imgs.length;
                break;
            case k.states.flapping:
                a = Math.floor(c / k.spriteSpeeds.flapping) % this.imgs.length;
                break;
            case k.states.stalling:
            case k.states.flyingDead:
            case k.states.groundDead:
                a = this.stallingIndex
            }
            this.previousIndex !== a && (this.image = this.imgs[a], this.previousIndex = a);
            this.started ? (this.state !== k.states.groundDead && (this.speedY += k.gravity * b, this.x += this.speedX * b, this.y += this.speedY * b, 0 > this.y && (this.y = 0), this.rect.setPosition(this.x - this.rectWidth / 2, this.y - this.rectHeight / 2)), 200 <= this.speedY ?
                (this.angle += 4 * Math.PI / 3 * b, this.isAlive() && (this.state = k.states.stalling), this.angle > Math.PI / 2 && (this.angle = Math.PI / 2)) : 200 > this.speedY && (this.angle -= 3 * Math.PI * b, this.isAlive() && (this.state = k.states.flapping), this.angle < -Math.PI / 8 && (this.angle = -Math.PI / 8))) : this.state === k.states.cruising && (this.y = this.startY + Math.sin(c % k.cruisingOscPeriod * k.PI2 / k.cruisingOscPeriod) * k.cruisingOscHeight)
        },
        flap: function ()
        {
            this.speedY = -700
        }
    });
    G.prototype = f.inherit(new t, new B,
    {
        update: function (a, b, c, d)
        {
            this.x += -d.scrollSpeed *
                b;
            this.rect.setX(this.x);
            this.gapRect.setX(this.x);
            this.pipeTiteRect.setX(this.x);
            this.pipeMiteRect.setX(this.x);
            0 > this.rect.right && (this.needsToBeDestroyed = !0)
        },
        passes: function (a)
        {
            return this.gapRect.containsPoint(a.getCenterX(), a.getCenterY())
        },
        collides: function (a)
        {
            return this.pipeTiteRect.intersectsRect(a) || this.pipeMiteRect.intersectsRect(a)
        },
        draw: function (a)
        {
            t.prototype.draw.call(this, a)
        }
    });
    d.BASEWIDTH = 640;
    d.BASEHEIGHT = 940;
    d.BESTSCORECOOKIE = "fl_hs";
    d.BESTSCORECOOKIE_name = "fl_name";
    d.BESTSCORECOOKIETTL = 31536E4;
    d.FIXEDDTM = 1E3 /
        60;
    d.FIXEDDTS = d.FIXEDDTM / 1E3;
    d.MAXCYCLES = 5;
    d.MINFRAMEDELAY = 1E3 / 60;
    d.MAXFRAMEDELAY = 200;
    d.scrollSpeed = 250;
    d.pipeGap = 200;
    d.pipeSpacing = 1400;
    d.IMGS = {
        dayBg: "imgs/BG_day.png",
        nightBg: "imgs/BG_night.png",
        ground: "imgs/ground.png",
        flappyYellow: "imgs/Flappy_yellow.png",
        flappyYellow2: "imgs/Flappy_yellow2.png",
        flappyYellow3: "imgs/Flappy_yellow3.png",
        flappyBlue: "imgs/Flappy_blue.png",
        flappyBlue2: "imgs/Flappy_blue2.png",
        flappyBlue3: "imgs/Flappy_blue3.png",
        flappyRed: "imgs/Flappy_red.png",
        flappyRed2: "imgs/Flappy_red2.png",
        flappyRed3: "imgs/Flappy_red3.png",
        pipeTop: "imgs/pipe_top.png",
        pipeSection: "imgs/pipe_section.png",
        num0: "imgs/num_0.png",
        num1: "imgs/num_1.png",
        num2: "imgs/num_2.png",
        num3: "imgs/num_3.png",
        num4: "imgs/num_4.png",
        num5: "imgs/num_5.png",
        num6: "imgs/num_6.png",
        num7: "imgs/num_7.png",
        num8: "imgs/num_8.png",
        num9: "imgs/num_9.png"
    };
    d.SOUNDS = {
        menu: "sounds/Menu.wav",
        point: "sounds/Point.wav",
        crash: "sounds/Sound_crash.wav",
        fall: "sounds/Crash.wav",
        fly: "sounds/Tap.wav"
    };
    d.states = {
        none: "none",
        loading: "loading",
        mainMenu: "mainmenu",
        instructions: "instructions",
        playing: "playing",
        showingBoard: "showingboard",
        end: "end"
    };
    d.prototype = {
        init: function ()
        {
            this.imgManager.addEventListener(q.events.imageLoad, f.bindFnc(this, this.imageLoaded));
            this.imgManager.addEventListener(q.events.allImagesLoad, f.bindFnc(this, this.allImagesLoaded));
            this.soundManager.addEventListener(x.events.soundLoad, f.bindFnc(this, this.soundLoaded));
            this.soundManager.addEventListener(x.events.allSoundsLoad, f.bindFnc(this, this.allSoundsLoaded));
            h.get("startPlayButton").addEventListener("click",
                f.bindFnc(this, function ()
                {
                    this.state !== d.states.mainMenu && this.state !== d.states.end || this.changeToState(d.states.instructions)
                }), !1);
            h.get("gameOverPlayButton").addEventListener("click", f.bindFnc(this, function ()
            {
                this.state !== d.states.mainMenu && this.state !== d.states.end || this.changeToState(d.states.instructions)
            }), !1);
            
            /*
            h.get("gameOverTweetButton").addEventListener("click", f.bindFnc(this, function ()
            {
                var a = {
                    text: encodeURIComponent("I just scored " + this.score + " on FlappyBird on Firefox OS! Try to beat my score at http://flappylives.com. #FlappyLives")
                },
                    a = "https://twitter.com/intent/tweet?" + f.objectToParamString(a);
                J(a, g.cordova ? "_blank" : "shareTwitterWindow", "width=480,height=480,scrollbars=yes,location=" + (g.cordova ? "yes" : "no"))
            }), !1);
	
            h.get("gameOverFBButton").addEventListener("click", f.bindFnc(this, function ()
            {
                var a = {
                    t: encodeURIComponent("I just scored " + this.score + " on FlappyBird on Firefox OS! Try to beat my score at http://flappylives.com. #FlappyLives"),
                    u: encodeURIComponent(("https:" === I.protocol ? "https:" : "http:") + "//www.flappylives.com/")
                }, a = "https://www.facebook.com/sharer.php?" +
                        f.objectToParamString(a);
                J(a, g.cordova ? "_blank" : "shareFacebookWindow", "width=626,height=436,scrollbars=yes,location=" + (g.cordova ? "yes" : "no"))
            }), !1);
            */
            h.get("touchOverlay").addEventListener("mousedown", f.bindFnc(this, this.birdFlap), !1);
            h.get("touchOverlay").addEventListener("touchstart", f.bindFnc(this, this.birdFlap), !1);
            //g.addEventListener("keydown", f.bindFnc(this, this.keyDown), !1);
            //g.addEventListener("keyup", f.bindFnc(this, this.keyUp), !1);
            f.makeUnselectable(h.get("mainCon"), !0);
            g.addEventListener("resize",
                f.bindFnc(this, this.windowResize));
            this.bindedResizeCanvas = f.bindFnc(this, this.resizeCanvas);
            s(this.bindedResizeCanvas, 100);
            this.resizeCanvas();
            this.state = d.states.loading;
            this.imgManager.startLoading();
            this.soundManager.startLoading();
            f.addClass(h.get("loadingScreen"), "show");
            var a = h.get("gameOverKikButton");
            if (a)
                if (g.cards && cards.kik)
                {
                    var b = h.get("gameOverShareButtons");
                    b && (b.style.display = "none");
                    a.addEventListener("touchstart", f.bindFnc(this, this.sendKik), !1)
                }
                else a.style.display = "none"
        },
        setupDebug: function ()
        {
            this.debugStuff.output =
                h.create("div", "debugOutput", "debugOutput");
            this.debugStuff.output.style.position = "absolute";
            this.debugStuff.output.style.top = "0";
            this.debugStuff.output.style.left = "0";
            this.debugStuff.output.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
            this.debugStuff.output.style.color = "#000000";
            this.debugStuff.output.style.padding = "3px";
            this.debugStuff.output.style.zIndex = Math.pow(2, 32) - 1;
            h.get("mainCon").appendChild(this.debugStuff.output);
            this.debugStuff.frameCounter = h.create("div", "frameCounter", "frameCounter");
            this.debugStuff.frameCounter.style.position = "absolute";
            this.debugStuff.frameCounter.style.bottom = "0";
            this.debugStuff.frameCounter.style.left = "0";
            this.debugStuff.frameCounter.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
            this.debugStuff.frameCounter.style.color = "#000000";
            this.debugStuff.frameCounter.style.padding = "3px";
            this.debugStuff.frameCounter.style.zIndex = Math.pow(2, 32) - 1;
            h.get("mainCon").appendChild(this.debugStuff.frameCounter)
        },
        changeToState: function (a)
        {
            switch (a)
            {
            case d.states.mainMenu:
                this.changingState = !0;
                this.doFadeTransition(f.bindFnc(this, function ()
                {
                    this.changingState = !1;
                    f.removeClass(h.get("loadingScreen"), "show");
                    f.addClass(h.get("startScreen"), "show");
                    this.state = a;
                    this.start()
                }));
                break;
            case d.states.instructions:
                this.changingState = !0;
                this.soundManager.play(d.SOUNDS.menu);
                this.doFadeTransition(f.bindFnc(this, function ()
                {
                    this.changingState = !1;
                    f.removeClass(h.get("startScreen"), "show");
                    f.removeClass(h.get("endScreen"), "show");
                    f.removeClass(h.get("gameOverText"), "show");
                    f.removeClass(h.get("gameOverBoard"),
                        "show");
                    f.removeClass(h.get("gameOverButtons"), "show");
                    f.addClass(h.get("instructionsScreen"), "show");
                    this.state = a;
                    this.beginGame()
                }));
                break;
            case d.states.playing:
                f.removeClass(h.get("instructionsScreen"), "show");
                this.state = a;
                break;
            case d.states.showingBoard:
                this.changingState = !0;
                this.doFlashTransition(f.bindFnc(this, function ()
                {
                    this.changingState = !1;
                    this.state = a;
                    this.endGame();
                    //f.addClass(h.get("endScreen"), "show")
                }));
                break;
            default:
                this.state = a
            }
        },
        doFadeTransition: function (a)
        {
            var b = h.get("transitionOverlay");
            f.addClass(b, "show");
            s(f.bindFnc(this, function ()
            {
                f.addClass(b, "fadeToBlack");
                f.addClass(b, "activate")
            }), 1);
            s(f.bindFnc(this, function ()
            {
                f.removeClass(b, "activate");
                a && a()
            }), 500);
            s(f.bindFnc(this, function ()
            {
                f.removeClass(b, "fadeToBlack");
                f.removeClass(b, "show")
            }), 1E3)
        },
        doFlashTransition: function (a)
        {
            var b = h.get("transitionOverlay");
            f.addClass(b, ["flashWhite", "show"]);
            s(f.bindFnc(this, function ()
            {
                f.addClass(b, "activate");
                a && a()
            }), 1);
            s(f.bindFnc(this, function ()
                {
                    f.removeClass(b, ["flashWhite", "show", "activate"])
                }),
                500)
        },
        trace: function ()
        {
            var a = "",
                a = Array.prototype.slice.call(arguments),
                b = g.console ||
                {
                    log: function () {}
                }, a = a.join(" ");
            this.debugStuff.output && (this.debugStuff.output.innerHTML = a);
            b.log(a)
        },
        windowResize: function (a)
        {
            this.bindedResizeCanvas();
            s(this.bindedResizeCanvas, 100)
        },
        resizeCanvas: function ()
        {
            var a = h.get("mainCon"),
                b = h.get("limitCon"),
                c = h.get("canvasCon"),
                d = h.get("startScreen"),
                f = h.get("instructionsScreen"),
                k = g.getComputedStyle(a),
                a = parseInt(k.width, 10),
                k = parseInt(k.height, 10);
            a / k >= this.aspectRatio ?
                (c.style.height = k + "px", c.style.width = Math.floor(k * this.aspectRatio) + "px") : (c.style.width = a + "px", c.style.height = Math.floor(a / this.aspectRatio) + "px");
            b.style.width = c.style.width;
            b.style.height = k + "px";
            d.style.width = f.style.width = c.style.width;
            d.style.height = f.style.height = c.style.height
        },
        keyDown: function (a)
        {
            if (a)
            {
                var b = a.keyCode.toString();
                if (!this.keyMap[b]) switch (this.keyMap[b] = !0, a.keyCode)
                {
                case 32:
                case 65:
                case 87:
                case 38:
                    this.defaultKeyPressBehavior(a)
                }
            }
        },
        keyUp: function (a)
        {
            a && (this.keyMap[a.keyCode.toString()] = !1)
        },
        defaultKeyPressBehavior: function (a)
        {
            if (!this.changingState) switch (this.state)
            {
            case d.states.mainMenu:
                this.changeToState(d.states.instructions);
                break;
            case d.states.instructions:
            case d.states.playing:
                this.birdFlap(a);
                break;
            case d.states.end:
                this.changeToState(d.states.instructions)
            }
        },
        imageLoaded: function (a)
        {
            this.checkLoaded()
        },
        allImagesLoaded: function (a)
        {
            this.checkLoaded()
        },
        soundLoaded: function (a)
        {
            this.checkLoaded()
        },
        allSoundsLoaded: function (a)
        {
            this.checkLoaded()
        },
        checkLoaded: function ()
        {
            var a =
                this.imgManager.imgLoaded,
                b = this.imgManager.imgCount;
            this.soundManager.enabled && (a += this.soundManager.soundsLoaded, b += this.soundManager.soundsCount);
            this.updatePercentLoaded(a, b);
            a >= b && this.changeToState(d.states.mainMenu)
        },
        updatePercentLoaded: function (a, b)
        {
            var c = a / b * 100;
            h.get("progressPercent").innerHTML = Math.floor(c) + "%";
            h.get("progressLoad").style.width = c + "%"
        },
        getRandomBirdColor: function ()
        {
            var a = Math.floor(3 * Math.random());
            return this.flappySprites[a]
        },
        start: function ()
        {
            if (!this.started)
            {
                this.started = !0;
                var a = this.imgManager.get(d.IMGS.ground),
                    b = this.imgManager.get(d.IMGS.pipeSection);
                h.get("canvasCon");
                Math.random();
                f.removeClass(h.get("loadingScreen"), "show");
                f.addClass(h.get("startScreen"), "show");
                this.patterns[d.IMGS.ground] = this.context.createPattern(a, "repeat");
                this.patterns[d.IMGS.pipeSection] = this.context.createPattern(b, "repeat");
                this.flappySprites = [
                {
                    base: this.imgManager.get(d.IMGS.flappyYellow),
                    sequence: [this.imgManager.get(d.IMGS.flappyYellow2), this.imgManager.get(d.IMGS.flappyYellow),
                        this.imgManager.get(d.IMGS.flappyYellow3), this.imgManager.get(d.IMGS.flappyYellow)
                    ]
                },
                {
                    base: this.imgManager.get(d.IMGS.flappyBlue2),
                    sequence: [this.imgManager.get(d.IMGS.flappyBlue3), this.imgManager.get(d.IMGS.flappyBlue2), this.imgManager.get(d.IMGS.flappyBlue), this.imgManager.get(d.IMGS.flappyBlue2)]
                },
                {
                    base: this.imgManager.get(d.IMGS.flappyRed),
                    sequence: [this.imgManager.get(d.IMGS.flappyRed2), this.imgManager.get(d.IMGS.flappyRed), this.imgManager.get(d.IMGS.flappyRed3), this.imgManager.get(d.IMGS.flappyRed)]
                }];
                this.numberImages = [this.imgManager.get(d.IMGS.num0), this.imgManager.get(d.IMGS.num1), this.imgManager.get(d.IMGS.num2), this.imgManager.get(d.IMGS.num3), this.imgManager.get(d.IMGS.num4), this.imgManager.get(d.IMGS.num5), this.imgManager.get(d.IMGS.num6), this.imgManager.get(d.IMGS.num7), this.imgManager.get(d.IMGS.num8), this.imgManager.get(d.IMGS.num9)];
                for (b = 0; b < this.numberImages.length; b += 1) f.addClass(this.numberImages[b], "num-" + b);
                this.background = new w(
                {
                    img: this.imgManager.get(d.IMGS.dayBg),
                    x: 0,
                    y: 0,
                    width: 640,
                    height: 891
                });
                this.stage.addChild(this.background);
                this.pipes = [];
                this.pipesContainer = new t(
                {
                    x: 0,
                    y: 0
                });
                this.stage.addChild(this.pipesContainer);
                b = this.getRandomBirdColor();
                this.bird = new k(
                {
                    x: d.BASEWIDTH / 2,
                    y: d.BASEHEIGHT / 2,
                    anchorX: 38,
                    anchorY: 27,
                    width: 76,
                    height: 53,
                    rectWidth: 53,
                    rectHeight: 53,
                    img: b.base,
                    birdImages: b.sequence,
                    stallingIndex: 1
                });
                this.stage.addChild(this.bird);
                this.ground = new z(
                {
                    pattern: this.patterns[d.IMGS.ground],
                    x: 0,
                    y: 891,
                    width: 640,
                    height: 50,
                    imageWidth: a.width,
                    imageHeight: a.height
                });
                this.ground.rect = new r(
                {
                    x: this.ground.x,
                    y: this.ground.y,
                    width: this.ground.width,
                    height: this.ground.height
                });
                this.stage.addChild(this.ground);
                this.scoreboard = new F(
                {
                    x: d.BASEWIDTH / 2,
                    y: 180,
                    horizontalAlign: "center",
                    verticalAlign: "middle",
                    number: 0,
                    numberImages: this.numberImages
                });
                this.scoreboard.visible = !1;
                this.stage.addChild(this.scoreboard);
                this.updateContext.scrollSpeed = d.scrollSpeed;
                this.looping = !0;
                this.animationFrameId = g.requestAnimationFrame(this.bindedMainLoop)
            }
        },
        beginGame: function (a)
        {
            h.get("canvasCon");
            a = 0.5 < Math.random() ? this.imgManager.get(d.IMGS.dayBg) : this.imgManager.get(d.IMGS.nightBg);
            var b = this.getRandomBirdColor();
            this.score = 0;
            this.scoreboard.setNumber(this.score);
            this.scoreboard.visible = !0;
            this.pipes = [];
            this.pipesContainer.removeAllChilds();
            this.background.image = a;
            this.ignoreMouseDown = !1;
            this.firstTap = !0;
            this.bird.image = b.base;
            this.bird.imgs = b.sequence;
            this.bird.started = !1;
            this.bird.startY = 500;
            this.bird.setPosition(200, 500);
            this.bird.angle = 0;
            this.bird.state = k.states.cruising;
            this.updateContext.scrollSpeed =
                d.scrollSpeed;
            g.cancelAnimationFrame(this.animationFrameId);
            this.animationFrameId = g.requestAnimationFrame(this.bindedMainLoop)
        },
        mainLoop: function (a)
        {
            this.looping ? this.animationFrameId = g.requestAnimationFrame(this.bindedMainLoop) : g.cancelAnimationFrame(this.animationFrameId);
            var b = a - this.lastMainLoopTime,
                c, e;
            b < d.MINFRAMEDELAY && (b = d.MINFRAMEDELAY);
            b > d.MAXFRAMEDELAY && (b = d.MAXFRAMEDELAY);
            c = b / 1E3;
            this.fixedAccumulator += b;
            for (e = 0; this.fixedAccumulator >= d.FIXEDDTM && e < d.MAXCYCLES; e += 1) this.updateLoop(d.FIXEDDTM,
                d.FIXEDDTS, a), this.fixedAccumulator -= d.FIXEDDTM;
            this.renderLoop(b, c, a);
            this.debug && 1E3 <= a - this.debugStuff.lastFrameCaptureTime && (this.debugStuff.frameCounter.innerHTML = "FPS-count: " + Math.round((this.frameCount - this.debugStuff.lastFrameCapture) / ((a - this.debugStuff.lastFrameCaptureTime) / 1E3)) + "<br />FPS-time: " + Math.round(1E3 / b), this.debugStuff.lastFrameCapture = this.frameCount, this.debugStuff.lastFrameCaptureTime = a);
            this.frameCount += 1;
            this.lastMainLoopTime = a
        },
        updateLoop: function (a, b, c)
        {
            this.lastPipeTime +=
                a;
            if (!this.firstTap && this.bird.isAlive() && this.lastPipeTime > d.pipeSpacing)
            {
                var e = this.createRandomPipes();
                this.pipes.push(e);
                this.pipesContainer.addChild(e);
                this.lastPipeTime = 0
            }
            this.bird.update(a, b, c, this.updateContext);
            if (!this.firstTap)
                for (i = 0; i < this.pipes.length; i += 1) this.pipes[i].needsToBeDestroyed ? (this.pipesContainer.removeChild(this.pipes[i]), this.pipes.splice(i, 1), i -= 1) : (this.pipes[i].update(a, b, c, this.updateContext), this.bird.isAlive() && this.pipes[i].collides(this.bird.rect) && (this.bird.state =
                    k.states.flyingDead, this.soundManager.play(d.SOUNDS.crash), this.soundManager.play(d.SOUNDS.fall)), this.bird.isAlive() && !this.pipes[i].passed && this.pipes[i].passes(this.bird.rect) && (this.pipes[i].passed = !0, this.score += 1, this.scoreboard.setNumber(this.score), this.soundManager.play(d.SOUNDS.point)));
            !this.firstTap && this.bird.state !== k.states.groundDead && this.bird.rect.bottom > this.ground.rect.top && (this.bird.y = this.ground.rect.top - 26, this.bird.isAlive() && this.soundManager.play(d.SOUNDS.crash), this.bird.state =
                k.states.groundDead);
            this.bird.isAlive() || (this.updateContext.scrollSpeed = 0, this.state !== d.states.end && this.state !== d.states.showingBoard && this.changeToState(d.states.showingBoard));
            this.ground.offsetX -= b * this.updateContext.scrollSpeed
        },
        renderLoop: function (a, b, c)
        {
            this.context.save();
            this.context.fillStyle = "#ded895";
            this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
            this.context.restore();
            this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
            this.stage.draw(this.context);
            if (this.debug)
            {
                for (a =
                    0; a < this.pipes.length; a += 1) this.debugDrawRects(this.pipes[a].gapRect, "#0000ff"), this.debugDrawRects(this.pipes[a].pipeTiteRect, "#ff0000"), this.debugDrawRects(this.pipes[a].pipeMiteRect, "#ff0000");
                this.debugDrawRects(this.bird.rect, "#000000");
                this.debugDrawRects(this.ground.rect, "#ffffff")
            }
        },
        debugDrawRects: function (a, b)
        {
            this.context.save();
            this.context.scale(this.scaleX, this.scaleY);
            this.context.lineWidth = 2;
            this.context.strokeStyle = b;
            this.context.strokeRect(a.left, a.top, a.getWidth(), a.getHeight());
            this.context.restore()
        },
        createRandomPipes: function ()
        {
            var a = Math.random() * (791 - d.pipeGap - 100) + 100,
                a = new r(
                {
                    left: 0,
                    top: a,
                    right: 112,
                    bottom: a + d.pipeGap
                });
            return new G(
            {
                x: 640,
                y: 0,
                gapRect: a,
                pipeSectionPattern: this.patterns[d.IMGS.pipeSection],
                pipeTopImage: this.imgManager.get(d.IMGS.pipeTop),
                pipesticleHeight: 891
            })
        },
        birdFlap: function (a)
        {
            "touchstart" === a.type && (this.ignoreMouseDown = !0);
            if (!this.ignoreMouseDown || this.ignoreMouseDown && "mousedown" !== a.type)
                if (this.state === d.states.instructions || this.state ===
                    d.states.playing) this.firstTap && (this.bird.started = !0, this.firstTap = !1, this.lastPipeTime = -1E3, this.changeToState(d.states.playing)), this.bird.isAlive() && (this.bird.flap(), this.soundManager.play(d.SOUNDS.fly))
        },
        endGame: function ()
        {
            var a = h.get("gameOverScore"),
                b = h.get("gameOverBest"),
                b_name = h.get("gameOverBest_name"),
                c = h.get("gameOverMedal"),
                e, g;

                this.score > this.bestScore && (this.bestScore = this.score, H.setCookie(d.BESTSCORECOOKIE, this.bestScore.toString(), d.BESTSCORECOOKIETTL), 
                (
                    function()
                    {
                        h.get("name_of_winner").value = (H.getCookie(d.BESTSCORECOOKIE_name, "Flappy Bird 1"));
                        h.get("gameOverBest_name").style.display = 'none';
                        h.get("updateScore").style.display = 'block';
                        h.get("saveScore").onclick = function()
                        {
                            H.setCookie(d.BESTSCORECOOKIE_name, h.get("name_of_winner").value, d.BESTSCORECOOKIETTL);                       
                            g_name = (H.getCookie(d.BESTSCORECOOKIE_name, "Flappy Bird 1"));
                            b_name.innerHTML = g_name;
                        h.get("gameOverBest_name").style.display = 'block';
                        h.get("updateScore").style.display = 'none';
                        }
                    } 
                )()
            );


            
            e = f.getDigits(this.score);
            g = f.getDigits(this.bestScore);

            a.innerHTML ="";
            b.innerHTML = "";
            g_name = (H.getCookie(d.BESTSCORECOOKIE_name, "0"));
            b_name.innerHTML = g_name;
            
            f.removeClass(c, ["bronze", "silver", "gold"]);
            10 <= this.score && 50 > this.score ? f.addClass(c, "bronze") : 50 <= this.score && 100 > this.score ? f.addClass(c, "silver") : 100 <= this.score && f.addClass(c, "gold");
            for (c = 0; c < e.length; c += 1) a.appendChild(this.numberImages[e[c]].cloneNode());
            
            for (c = 0; c < g.length; c += 1) b.appendChild(this.numberImages[g[c]].cloneNode());
            s(f.bindFnc(this, function ()
            {
                this.scoreboard.visible = !1;
                f.addClass(h.get("gameOverText"), "show");
                this.soundManager.play(d.SOUNDS.menu)
            }), 1E3);
            s(f.bindFnc(this,
                function ()
                {
                    f.addClass(h.get("gameOverBoard"), "show");
                    this.soundManager.play(d.SOUNDS.menu)
                }), 2E3);
            s(f.bindFnc(this, function ()
            {
                f.addClass(h.get("gameOverButtons"), "show");
                this.state = d.states.end
            }), 2750);
                f.addClass(h.get("endScreen"), "show");
        }
        
    };
    g.init = function ()
    {
        new d
    }
})(window);