window.onscroll = function(e) {
	//if (!ms.allowScrolling) window.scroll(0,window.pageYOffset);
}
var ms = window.ms || {};
ms.Utilities = ms.Utilities || {
    AddEventHandler: function (b, a) {
        return function () {
            if (b) {
                b()
            }
            a()
        }
    },
    showAllKeys: function (c) {
        var b = "";
        for (var a in c) {
            b += " " + a
        }
        alert(b)
    },
    findNearestParentWithTag: function (c, b) {
        var a = c.parentNode;
        if (a.tagName.toLowerCase() == "body") {
            return null
        }
        if (a.tagName.toLowerCase() == b.toLowerCase()) {
            return a
        } else {
            return ms.Utilities.findNearestParentWithTag(a, b)
        }
    },
    findNearestParentWithTagAndClass: function (d, b, c) {
        var a = d.parentNode;
        if (!a.tagName) {
            return null
        }
        if (a.tagName.toLowerCase() == "body") {
            return null
        }
        if (a.tagName.toLowerCase() == b.toLowerCase() && a.className.indexOf(c) >= 0) {
            return a
        } else {
            return ms.Utilities.findNearestParentWithTagAndClass(a, b, c)
        }
    },
    isAChildOf: function (e, b) {
        var d = $(e);
        var c = $(b);
        if (d == c) {
            return false
        }
        var a = false;
        while (d.parentNode && d.parentNode.tagName != "BODY" && d.parentNode != c) {
            d = d.parentNode
        }
        return d.parentNode == c
    },
    getMoneyUnformatted: function (a) {
        if (a) {
            a = a.toString();
            var b = a.indexOf("$");
            if (b > 0) {
                a = a.substring(b);
                a = parseFloat(a).toFixed(2)
            }
        }
        return a
    },
    findKeys: function (c) {
        var b = "";
        for (var a in c) {
            b += a + "|"
        }
        return b
    },
    findRelativePos: function (d, c) {
        var a = ms.Utilities.findPos(d);
        var b = ms.Utilities.findPos(c);
        return [a[0] - b[0], a[1] - b[1]]
    },
    findPos: function (a) {
        var b = curtop = 0;
        if (a.offsetParent) {
            do {
                b += a.offsetLeft;
                curtop += a.offsetTop
            } while (a = a.offsetParent)
        }
        return [b, curtop]
    },
    findSize: function (b) {
        var a = {};
        if (b.getHeight && b.getWidth) {
            a.height = b.getHeight();
            a.width = b.getWidth()
        } else {
            a.height = b.offsetHeight;
            a.width = b.offsetWidth
        }
        return a
    },
    SetOpacity: function (b, c) {
        var a = c;
        if (c > 100) {
            c = a = 100
        } else {
            if (c < 0) {
                c = a = 0
            }
        }
        a /= 100;
        if (c < 1) {
            c = 1
        }
        b.style.opacity = (a);
        b.style.filter = "alpha(opacity=" + c + ")"
    },
    isOverlapping: function (k, i, g, c) {
        var l = ms.Utilities.findSize(k);
        var h = ms.Utilities.findSize(i);
        var n = ms.Utilities.findPos(k);
        var j = ms.Utilities.findPos(i);
        if (g) {
            n[0] += g
        }
        if (c) {
            n[1] += c
        }
        var e = {
            left: n[0],
            right: n[0] + l.width,
            top: n[1],
            bottom: n[1] + l.height
        };
        var d = {
            left: j[0],
            right: j[0] + h.width,
            top: j[1],
            bottom: j[1] + h.height
        };
        var f = (e.top > d.bottom && e.top < d.top) || (e.bottom > d.bottom && e.bottom < d.top);
        var m = (e.right > d.left && e.right < d.right) || (e.left > d.right && e.left < d.right);
        return f && m
    },
    trimPx: function (b) {
        var a = b;
        if (b.indexOf("px") > 0) {
            a = b.substring(0, b.indexOf("px"))
        }
        try {
            a = parseInt(a)
        } catch (c) {}
        return a
    },
    arrayContains: function (a, b) {
        for (var d = 0; d < a.length; d++) {
            if (a[d] == b) {
                return true
            }
        }
        return false
    },
    getIntegerPixelValue: function (a) {
        return parseInt(a.replace("px", ""))
    },
    getThickness: function (a) {
        return a.replace("medium", "1").replace("thin", "1").replace("thick", "3").replace("px", "")
    },
    setDisplayValue: function (a, b) {
        if (!b) {
            b = ""
        }
        if (a) {
            if (!a.style) {
                a.style = {}
            }
            a.style.display = b
        }
    },
    replaceClass: function (h, b, g) {
        var f = h.className;
        var a = f.split(" ");
        var d = "";
        for (var c = 0; c < a.length; c++) {
            var e = a[c];
            if (e == b) {
                e = g
            }
            d += (c > 0 ? " " : "") + e
        }
        h.className = d
    },
    endsWith: function (b, a) {
        return b.substring(b.length - a.length) == a
    },
    getQueryParameter: function (a, b) {
        var c = window.top.location.search.substring(1);
        if (b && b === true) {
            c = window.location.search.substring(1)
        }
        var a = a + "=";
        if (c.length > 0) {
            begin = c.indexOf(a);
            if (begin != -1) {
                begin += a.length;
                end = c.indexOf("&", begin);
                if (end == -1) {
                    end = c.length
                }
                return unescape(c.substring(begin, end))
            }
        }
        return "null"
    },
    array2json: function (a) {
        var f = [];
        var b = (Object.prototype.toString.apply(a) === "[object Array]");
        for (var d in a) {
            var e = typeof a[d] == "string" ? a[d].replace(/\"/g, '\\"').replace(/\s+/g, " ") : a[d];
            if (typeof e == "object") {
                if (b) {
                    f.push(ms.Utilities.array2json(e))
                } else {
                    f.push('"' + d + '":' + ms.Utilities.array2json(e))
                }
            } else {
                if (a[d]) {
                    var g = "";
                    if (!b) {
                        g = '"' + d + '":'
                    }
                    if (typeof e == "number") {
                        g += e
                    } else {
                        if (e === false) {
                            g += "false"
                        } else {
                            if (e === true) {
                                g += "true"
                            } else {
                                g += '"' + e + '"'
                            }
                        }
                    }
                    if (g && typeof g != "undefined") {
                        f.push(g)
                    }
                }
            }
        }
        var c = f.join(",");
        if (b) {
            return "[" + c + "]"
        }
        return "{" + c + "}"
    },
    ensureNumeric: function (a) {
        var e = a || window.event;
        var b = e.keyCode || e.which;
        keyVal = String.fromCharCode(b);
        var c = /[0-9]|\.|\+|-/;
        var d = c.test(keyVal) || b == 8 || b == 9 || b == 46 || b == 37 || b == 39;
        if (!d) {
            e.returnValue = false;
            if (e.preventDefault) {
                e.preventDefault()
            }
        }
    }
};
ms.menu = ms.menu || {
    DDSPEED: 10,
    DDTIMER: 15,
    ddMenu: function (f, b) {
        var a = document.getElementById(f + "-ddheader");
        var e = document.getElementById(f + "-ddcontent");
        clearInterval(e.timer);
        if (b == 1) {
            clearTimeout(a.timer);
            if (e.maxh && e.maxh <= e.offsetHeight) {
                return
            } else {
                if (!e.maxh) {
                    e.style.display = "block";
                    e.style.height = "auto";
                    e.maxh = e.offsetHeight;
                    e.style.height = "0px"
                }
            }
            e.timer = setInterval(function () {
                ms.menu.ddSlide(e, 1)
            }, ms.menu.DDTIMER)
        } else {
            a.timer = setTimeout(function () {
                ms.menu.ddCollapse(e)
            }, 50)
        }
    },
    ddCollapse: function (a) {
        a.timer = setInterval(function () {
            ms.menu.ddSlide(a, -1)
        }, ms.menu.DDTIMER)
    },
    cancelHide: function (d) {
        var a = document.getElementById(d + "-ddheader");
        var b = document.getElementById(d + "-ddcontent");
        clearTimeout(a.timer);
        clearInterval(b.timer);
        if (b.offsetHeight < b.maxh) {
            b.timer = setInterval(function () {
                ms.menu.ddSlide(b, 1)
            }, ms.menu.DDTIMER)
        }
    },
    ddSlide: function (f, e) {
        var b = f.offsetHeight;
        var a;
        if (e == 1) {
            a = (Math.round((f.maxh - b) / ms.menu.DDSPEED))
        } else {
            a = (Math.round(b / ms.menu.DDSPEED))
        }
        if (a <= 1 && e == 1) {
            a = 1
        }
        f.style.height = b + (a * e) + "px";
        hfac = b / f.maxh;
        if (hfac < 0.1) {
            hfac = 0
        }
        f.style.opacity = hfac;
        f.style.filter = "alpha(opacity=" + (hfac * 100) + ")";
        if ((b < 2 && e != 1) || (b > (f.maxh - 2) && e == 1)) {
            clearInterval(f.timer)
        }
    }
};
ms.controls = ms.controls || {};
ms.controls.clubSelector = ms.controls.clubSelector || {
    sliderIsOut: false,
    dismiss: function (a) {
        $(ms.controls.clubSelector.containerId).style.display = "none"
    },
    isOverTab: function (g, h) {
        var d = g.pageY ? g.pageY : g.clientY;
        var c = Position.page(h);
        var b = d > c[1];
        var f = d < (c[1] + parseInt(h.getStyle("height").replace("px", "")));
        var a = b && f;
        return a
    },
    slideSelectorOut: function () {
        if (ms.controls.clubSelector.sliderIsOut === false) {
            new Effect.Move(ms.controls.clubSelector.containerId, {
                x: 214,
                y: 216,
                mode: "absolute",
                beforeStart: function (a) {
                    ms.controls.clubSelector.sliderIsOut = true
                }
            })
        }
    },
    slideSelectorIn: function (c) {
        if (!c) {
            var c = window.event
        }
        if (!c) {
            return
        }
        var b = (window.event) ? c.srcElement : c.target;
        var a = ms.Utilities.isAChildOf(b, $(ms.controls.clubSelector.containerId));
        if (ms.controls.clubSelector.sliderIsOut === true && a === false) {
            new Effect.Move(ms.controls.clubSelector.containerId, {
                x: 0,
                y: 216,
                mode: "absolute",
                beforeStart: function (d) {
                    ms.controls.clubSelector.sliderIsOut = false
                }
            })
        }
    }
};
ms.controls.eventSelector = ms.controls.eventSelector || {
    esliderIsOut: false,
    isOverSliderEl: false,
    startMargins: {},
    dismiss: function(a) {
        var s = $$('.ms-selector-slider');
        for (var j = 0; j < s.length; j++)
            s[j].style.display = "none"
    },
    isOverTab: function(g, h) {
        var d = g.pageY ? g.pageY : g.clientY;
        h = $(h);
        if (!h) return false;
        var c = h.viewportOffset();
        var b = d > c[1];
        var t = h.getStyle("height");
        if (t)
            t = t.replace("px", "");
        var f = d < (c[1] + parseInt(t));
        var a = b && f;
        return a
    },
    isOverSliderEl: function(c) {
        var d = $("divestab");
        var e = $("eventlist");
        return ms.controls.eventSelector.isOverTab(c, d) || ms.controls.eventSelector.isOverTab(c, e);
    },
    slideEventSelectorOut: function(c) {
        if (!c) {
            var c = window.event
        }
        if (!c) {
            return
        }

        var a = (window.event) ? c.srcElement : c.target;
        isOverSliderEl = (a.className || '').indexOf('ms-selector-slider') >= 0;
        var d = $("divestab");
        var e = $("eventlist");
        var b = ms.controls.eventSelector.isOverSliderEl(c);
        if (ms.controls.eventSelector.esliderIsOut === false && b === true) {
            var sliders = $$('.ms-selector-slider');
            for (var c = 0; c < sliders.length; c++) {
                new Effect.Morph(sliders[c], {
                    style: {
                        right: "230px"
                    },
                    beforeStart: function(g) {
                        ms.controls.eventSelector.startMargins[g.element.id] = g.element.style.marginRight;
                        ms.controls.eventSelector.esliderIsOut = true
                    }
                })
            }
        }
    },
    slideEventSelectorIn: function(d) {
        if (!d) {
            var d = window.event
        }
        if (!d) {
            return
        }
        var c = (window.event) ? d.srcElement : d.target;
        var a = ms.Utilities.isAChildOf(c, $(ms.controls.eventSelector.containerId));
        var b = ms.controls.eventSelector.isOverSliderEl(d);
        if (ms.controls.eventSelector.esliderIsOut === true && a === false && b === false) {
            var sliders = $$('.ms-selector-slider');
            for (var c = 0; c < sliders.length; c++) {
                new Effect.Morph(sliders[c], {
                    style: {
                        right: "1px"
                    },
                    beforeStart: function(g) {
                        var e = ms.controls.eventSelector.isOverSliderEl(g.element);
                        if (e) {
                            this.cancel()
                        } else {
                            ms.controls.eventSelector.esliderIsOut = false
                        }
                    },
                    afterFinish: function(g) {
                        g.element.style.right = "0";
                    }
                })
            }
        }
    },
    refresh: function(f) {
        var s = $$('.ms-selector-slider');
        for (var j = 0; j < s.length; j++) {
            var c = s[j];
            c.onmouseover = ms.controls.eventSelector.slideEventSelectorOut;
            c.onmouseout = ms.controls.eventSelector.slideEventSelectorIn;
        }
        $(document).observe("mousemove", ms.controls.eventSelector.slideEventSelectorIn);
        var d = $$(".eventlistshadow");
        var e = $$(".esbtmshadow");
        var a = $$(".eventlist");
        if (d.length > 0 && e.length > 0 && a.length > 0) {
            d[0].style.height = (a[0].getHeight() - 7) + "px";
            e[0].style.top = (a[0].getHeight() + 247) + "px";
        }
    }
};
if (screen.width < 1180) {
    ms.controls.eventSelector.dismiss()
};
