if (!hs) {
    var hs = {
        lang: {
            cssDirection: "ltr",
            loadingText: "Loading...",
            loadingTitle: "Click to cancel",
            focusTitle: "Click to bring to front",
            fullExpandTitle: "Expand to actual size (f)",
            creditsText: "Powered by <i>Highslide JS</i>",
            creditsTitle: "Go to the Highslide JS homepage",
            previousText: "Previous",
            nextText: "Next",
            moveText: "Move",
            closeText: "Close",
            closeTitle: "Close (esc)",
            resizeTitle: "Resize",
            playText: "Play",
            playTitle: "Play slideshow (spacebar)",
            pauseText: "Pause",
            pauseTitle: "Pause slideshow (spacebar)",
            previousTitle: "Previous (arrow left)",
            nextTitle: "Next (arrow right)",
            moveTitle: "Move",
            fullExpandText: "1:1",
            restoreTitle: "Click to close image, click and drag to move. Use arrow keys for next and previous."
        },
        graphicsDir: "highslide/graphics/",
        expandCursor: "zoomin.cur",
        restoreCursor: "zoomout.cur",
        expandDuration: 250,
        restoreDuration: 250,
        marginLeft: 15,
        marginRight: 15,
        marginTop: 15,
        marginBottom: 15,
        zIndexCounter: 1001,
        loadingOpacity: 0.75,
        allowMultipleInstances: true,
        numberOfImagesToPreload: 5,
        outlineWhileAnimating: 2,
        outlineStartOffset: 3,
        padToMinWidth: false,
        fullExpandPosition: "bottom right",
        fullExpandOpacity: 1,
        showCredits: true,
        creditsHref: "http://highslide.com/",
        creditsTarget: "_self",
        enableKeyListener: true,
        openerTagNames: ["a"],
        allowWidthReduction: false,
        allowHeightReduction: true,
        preserveContent: true,
        objectLoadTime: "before",
        cacheAjax: true,
        dragByHeading: true,
        minWidth: 200,
        minHeight: 200,
        allowSizeReduction: true,
        outlineType: "drop-shadow",
        skin: {
            contentWrapper: '<div class="highslide-header"><ul><li class="highslide-previous"><a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)"><span>{hs.lang.previousText}</span></a></li><li class="highslide-next"><a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)"><span>{hs.lang.nextText}</span></a></li><li class="highslide-move"><a href="#" title="{hs.lang.moveTitle}" onclick="return false"><span>{hs.lang.moveText}</span></a></li><li class="highslide-close"><a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)"><span>{hs.lang.closeText}</span></a></li></ul></div><div class="highslide-body"></div><div class="highslide-footer"><div><span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span></div></div>'
        },
        preloadTheseImages: [],
        continuePreloading: true,
        expanders: [],
        overrides: ["allowSizeReduction", "useBox", "outlineType", "outlineWhileAnimating", "captionId", "captionText", "captionEval", "captionOverlay", "headingId", "headingText", "headingEval", "headingOverlay", "creditsPosition", "dragByHeading", "width", "height", "contentId", "allowWidthReduction", "allowHeightReduction", "preserveContent", "maincontentId", "maincontentText", "maincontentEval", "objectType", "cacheAjax", "objectWidth", "objectHeight", "objectLoadTime", "swfOptions", "wrapperClassName", "minWidth", "minHeight", "maxWidth", "maxHeight", "pageOrigin", "slideshowGroup", "easing", "easingClose", "fadeInOut", "src"],
        overlays: [],
        idCounter: 0,
        oPos: {
            x: ["leftpanel", "left", "center", "right", "rightpanel"],
            y: ["above", "top", "middle", "bottom", "below"]
        },
        mouse: {},
        headingOverlay: {},
        captionOverlay: {},
        swfOptions: {
            flashvars: {},
            params: {},
            attributes: {}
        },
        timers: [],
        pendingOutlines: {},
        sleeping: [],
        preloadTheseAjax: [],
        cacheBindings: [],
        cachedGets: {},
        clones: {},
        onReady: [],
        uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8: parseFloat((navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1]),
        ie: document.all && !window.opera,
        safari: /Safari/.test(navigator.userAgent),
        geckoMac: /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),
        $: function(a) {
            if (a) return document.getElementById(a)
        },
        push: function(a, b) {
            a[a.length] = b
        },
        createElement: function(a, b, c, d, e) {
            a = document.createElement(a);
            b && hs.extend(a, b);
            e && hs.setStyles(a, {
                padding: 0,
                border: "none",
                margin: 0
            });
            c && hs.setStyles(a, c);
            d && d.appendChild(a);
            return a
        },
        extend: function(a, b) {
            for (var c in b) a[c] = b[c];
            return a
        },
        setStyles: function(a, b) {
            for (var c in b) if (hs.ie && c == "opacity") if (b[c] > 0.99) a.style.removeAttribute("filter");
            else a.style.filter = "alpha(opacity=" + b[c] * 100 + ")";
            else a.style[c] = b[c]
        },
        animate: function(a, b, c) {
            var d,
            e,
            g;
            if (typeof c != "object" || c === null) {
                d = arguments;
                c = {
                    duration: d[2],
                    easing: d[3],
                    complete: d[4]
                }
            }
            if (typeof c.duration != "number") c.duration = 250;
            c.easing = Math[c.easing] || Math.easeInQuad;
            c.curAnim = hs.extend({},
            b);
            for (var i in b) {
                var s = new hs.fx(a, c, i);
                d = parseFloat(hs.css(a, i)) || 0;
                e = parseFloat(b[i]);
                g = i != "opacity" ? "px": "";
                s.custom(d, e, g)
            }
        },
        css: function(a, b) {
            if (a.style[b]) return a.style[b];
            else if (document.defaultView) return document.defaultView.getComputedStyle(a, null).getPropertyValue(b);
            else {
                if (b == "opacity") b = "filter";
                var c = a.currentStyle[b.replace(/\-(\w)/g,
                function(d, e) {
                    return e.toUpperCase()
                })];
                if (b == "filter") c = c.replace(/alpha\(opacity=([0-9]+)\)/,
                function(d, e) {
                    return e / 100
                });
                return c === "" ? 1: c
            }
        },
        getPageSize: function() {
            var a = document,
            b = a.compatMode && a.compatMode != "BackCompat" ? a.documentElement: a.body;
            hs.page = {
                width: hs.ie ? b.clientWidth: a.documentElement.clientWidth || self.innerWidth,
                height: hs.ie ? b.clientHeight: self.innerHeight,
                scrollLeft: hs.ie ? b.scrollLeft: pageXOffset,
                scrollTop: hs.ie ? b.scrollTop: pageYOffset
            };
            return hs.page
        },
        getPosition: function(a) {
            for (var b = {
                x: a.offsetLeft,
                y: a.offsetTop
            }; a.offsetParent;) {
                a = a.offsetParent;
                b.x += a.offsetLeft;
                b.y += a.offsetTop;
                if (a != document.body && a != document.documentElement) {
                    b.x -= a.scrollLeft;
                    b.y -= a.scrollTop
                }
            }
            return b
        },
        expand: function(a, b, c, d) {
            a || (a = hs.createElement("a", null, {
                display: "none"
            },
            hs.container));
            if (typeof a.getParams == "function") return b;
            if (d == "html") {
                for (var e = 0; e < hs.sleeping.length; e++) if (hs.sleeping[e] && hs.sleeping[e].a == a) {
                    hs.sleeping[e].awake();
                    hs.sleeping[e] = null;
                    return false
                }
                hs.hasHtmlExpanders = true
            }
            try {
                new hs.Expander(a, b, c, d);
                return false
            } catch(g) {
                return true
            }
        },
        htmlExpand: function(a, b, c) {
            return hs.expand(a, b, c, "html")
        },
        getSelfRendered: function() {
            return hs.createElement("div", {
                className: "highslide-html-content",
                innerHTML: hs.replaceLang(hs.skin.contentWrapper)
            })
        },
        getElementByClass: function(a, b, c) {
            a = a.getElementsByTagName(b);
            for (b = 0; b < a.length; b++) if (RegExp(c).test(a[b].className)) return a[b];
            return null
        },
        replaceLang: function(a) {
            a = a.replace(/\s/g, " ");
            var b = /{hs\.lang\.([^}]+)\}/g,
            c = a.match(b),
            d;
            if (c) for (var e = 0; e < c.length; e++) {
                d = c[e].replace(b, "$1");
                if (typeof hs.lang[d] != "undefined") a = a.replace(c[e], hs.lang[d])
            }
            return a
        },
        getCacheBinding: function(a) {
            for (var b = 0; b < hs.cacheBindings.length; b++) if (hs.cacheBindings[b][0] == a) {
                a = hs.cacheBindings[b][1];
                hs.cacheBindings[b][1] = a.cloneNode(1);
                return a
            }
            return null
        },
        preloadAjax: function() {
            for (var a = hs.getAnchors(), b = 0; b < a.htmls.length; b++) {
                var c = a.htmls[b];
                hs.getParam(c, "objectType") == "ajax" && hs.getParam(c, "cacheAjax") && hs.push(hs.preloadTheseAjax, c)
            }
            hs.preloadAjaxElement(0)
        },
        preloadAjaxElement: function(a) {
            if (hs.preloadTheseAjax[a]) {
                var b = hs.preloadTheseAjax[a],
                c = hs.getNode(hs.getParam(b, "contentId"));
                c || (c = hs.getSelfRendered());
                var d = new hs.Ajax(b, c, 1);
                d.onError = function() {};
                d.onLoad = function() {
                    hs.push(hs.cacheBindings, [b, c]);
                    hs.preloadAjaxElement(a + 1)
                };
                d.run()
            }
        },
        focusTopmost: function() {
            for (var a = 0, b = -1, c = hs.expanders, d, e = 0; e < c.length; e++) if (d = c[e]) if ((d = d.wrapper.style.zIndex) && d > a) {
                a = d;
                b = e
            }
            if (b == -1) hs.focusKey = -1;
            else c[b].focus()
        },
        getParam: function(a, b) {
            a.getParams = a.onclick;
            var c = a.getParams ? a.getParams() : null;
            a.getParams = null;
            return c && typeof c[b] != "undefined" ? c[b] : typeof hs[b] != "undefined" ? hs[b] : null
        },
        getSrc: function(a) {
            var b = hs.getParam(a, "src");
            if (b) return b;
            return a.href
        },
        getNode: function(a) {
            var b = hs.$(a),
            c = hs.clones[a];
            if (!b && !c) return null;
            if (c) return c.cloneNode(true);
            else {
                c = b.cloneNode(true);
                c.id = "";
                hs.clones[a] = c;
                return b
            }
        },
        discardElement: function(a) {
            a && hs.garbageBin.appendChild(a);
            hs.garbageBin.innerHTML = ""
        },
        transit: function(a, b) {
            var c = b || hs.getExpander();
            b = c;
            if (hs.upcoming) return false;
            else hs.last = c;
            hs.removeEventListener(document, window.opera ? "keypress": "keydown", hs.keyHandler);
            try {
                hs.upcoming = a;
                a.onclick()
            } catch(d) {
                hs.last = hs.upcoming = null
            }
            try {
                b.close()
            } catch(e) {}
            return false
        },
        previousOrNext: function(a, b) {
            var c = hs.getExpander(a);
            return c ? hs.transit(c.getAdjacentAnchor(b), c) : false
        },
        previous: function(a) {
            return hs.previousOrNext(a, -1)
        },
        next: function(a) {
            return hs.previousOrNext(a, 1)
        },
        keyHandler: function(a) {
            if (!a) a = window.event;
            if (!a.target) a.target = a.srcElement;
            if (typeof a.target.form != "undefined") return true;
            var b = hs.getExpander(),
            c = null;
            switch (a.keyCode) {
            case 70:
                b && b.doFullExpand();
                return true;
            case 32:
            case 34:
            case 39:
            case 40:
                c = 1;
                break;
            case 8:
            case 33:
            case 37:
            case 38:
                c = -1;
                break;
            case 27:
            case 13:
                c = 0
            }
            if (c !== null) {
                hs.removeEventListener(document, window.opera ? "keypress": "keydown", hs.keyHandler);
                if (!hs.enableKeyListener) return true;
                if (a.preventDefault) a.preventDefault();
                else a.returnValue = false;
                if (b) {
                    c == 0 ? b.close() : hs.previousOrNext(b.key, c);
                    return false
                }
            }
            return true
        },
        registerOverlay: function(a) {
            hs.push(hs.overlays, hs.extend(a, {
                hsId: "hsId" + hs.idCounter++
            }))
        },
        getWrapperKey: function(a, b) {
            var c,
            d = /^highslide-wrapper-([0-9]+)$/;
            for (c = a; c.parentNode;) {
                if (c.id && d.test(c.id)) return c.id.replace(d, "$1");
                c = c.parentNode
            }
            if (!b) for (c = a; c.parentNode;) {
                if (c.tagName && hs.isHsAnchor(c)) for (d = 0; d < hs.expanders.length; d++) {
                    var e = hs.expanders[d];
                    if (e && e.a == c) return d
                }
                c = c.parentNode
            }
            return null
        },
        getExpander: function(a, b) {
            if (typeof a == "undefined") return hs.expanders[hs.focusKey] || null;
            if (typeof a == "number") return hs.expanders[a] || null;
            if (typeof a == "string") a = hs.$(a);
            return hs.expanders[hs.getWrapperKey(a, b)] || null
        },
        isHsAnchor: function(a) {
            return a.onclick && a.onclick.toString().replace(/\s/g, " ").match(/hs.(htmlE|e)xpand/)
        },
        reOrder: function() {
            for (var a = 0; a < hs.expanders.length; a++) hs.expanders[a] && hs.expanders[a].isExpanded && hs.focusTopmost()
        },
        mouseClickHandler: function(a) {
            if (!a) a = window.event;
            if (a.button > 1) return true;
            if (!a.target) a.target = a.srcElement;
            for (var b = a.target; b.parentNode && !/highslide-(image|move|html|resize)/.test(b.className);) b = b.parentNode;
            var c = hs.getExpander(b);
            if (c && (c.isClosing || !c.isExpanded)) return true;
            if (c && a.type == "mousedown") {
                if (a.target.form) return true;
                var d = b.className.match(/highslide-(image|move|resize)/);
                if (d) {
                    hs.dragArgs = {
                        exp: c,
                        type: d[1],
                        left: c.x.pos,
                        width: c.x.size,
                        top: c.y.pos,
                        height: c.y.size,
                        clickX: a.clientX,
                        clickY: a.clientY
                    };
                    hs.addEventListener(document, "mousemove", hs.dragHandler);
                    a.preventDefault && a.preventDefault();
                    if (/highslide-(image|html)-blur/.test(c.content.className)) {
                        c.focus();
                        hs.hasFocused = true
                    }
                    return false
                } else if (/highslide-html/.test(b.className) && hs.focusKey != c.key) {
                    c.focus();
                    c.doShowHide("hidden")
                }
            } else if (a.type == "mouseup") {
                hs.removeEventListener(document, "mousemove", hs.dragHandler);
                if (hs.dragArgs) {
                    if (hs.styleRestoreCursor && hs.dragArgs.type == "image") hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
                    a = hs.dragArgs.hasDragged;
                    if (!a && !hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) c.close();
                    else if (a || !a && hs.hasHtmlExpanders) hs.dragArgs.exp.doShowHide("hidden");
                    if (hs.dragArgs.exp.releaseMask) hs.dragArgs.exp.releaseMask.style.display = "none";
                    hs.hasFocused = false;
                    hs.dragArgs = null
                } else if (/highslide-image-blur/.test(b.className)) b.style.cursor = hs.styleRestoreCursor
            }
            return false
        },
        dragHandler: function(a) {
            if (!hs.dragArgs) return true;
            if (!a) a = window.event;
            var b = hs.dragArgs,
            c = b.exp;
            if (c.iframe) {
                if (!c.releaseMask) c.releaseMask = hs.createElement("div", null, {
                    position: "absolute",
                    width: c.x.size + "px",
                    height: c.y.size + "px",
                    left: c.x.cb + "px",
                    top: c.y.cb + "px",
                    zIndex: 4,
                    background: hs.ie ? "white": "none",
                    opacity: 0.01
                },
                c.wrapper, true);
                if (c.releaseMask.style.display == "none") c.releaseMask.style.display = ""
            }
            b.dX = a.clientX - b.clickX;
            b.dY = a.clientY - b.clickY;
            var d = Math.sqrt(Math.pow(b.dX, 2) + Math.pow(b.dY, 2));
            if (!b.hasDragged) b.hasDragged = b.type != "image" && d > 0 || d > (hs.dragSensitivity || 5);
            if (b.hasDragged && a.clientX > 5 && a.clientY > 5) if (b.type == "resize") c.resize(b);
            else {
                c.moveTo(b.left + b.dX, b.top + b.dY);
                if (b.type == "image") c.content.style.cursor = "move"
            }
            return false
        },
        wrapperMouseHandler: function(a) {
            try {
                if (!a) a = window.event;
                var b = /mouseover/i.test(a.type);
                if (!a.target) a.target = a.srcElement;
                if (hs.ie) a.relatedTarget = b ? a.fromElement: a.toElement;
                var c = hs.getExpander(a.target);
                if (c.isExpanded) if (! (!c || !a.relatedTarget || hs.getExpander(a.relatedTarget, true) == c || hs.dragArgs)) for (var d = 0; d < c.overlays.length; d++)(function() {
                    var g = hs.$("hsId" + c.overlays[d]);
                    if (g && g.hideOnMouseOut) {
                        b && hs.setStyles(g, {
                            visibility: "visible",
                            display: ""
                        });
                        hs.animate(g, {
                            opacity: b ? g.opacity: 0
                        },
                        g.dur)
                    }
                })()
            } catch(e) {}
        },
        addEventListener: function(a, b, c) {
            a == document && b == "ready" && hs.push(hs.onReady, c);
            try {
                a.addEventListener(b, c, false)
            } catch(d) {
                try {
                    a.detachEvent("on" + b, c);
                    a.attachEvent("on" + b, c)
                } catch(e) {
                    a["on" + b] = c
                }
            }
        },
        removeEventListener: function(a, b, c) {
            try {
                a.removeEventListener(b, c, false)
            } catch(d) {
                try {
                    a.detachEvent("on" + b, c)
                } catch(e) {
                    a["on" + b] = null
                }
            }
        },
        preloadFullImage: function(a) {
            if (hs.continuePreloading && hs.preloadTheseImages[a] && hs.preloadTheseImages[a] != "undefined") {
                var b = document.createElement("img");
                b.onload = function() {
                    b = null;
                    hs.preloadFullImage(a + 1)
                };
                b.src = hs.preloadTheseImages[a]
            }
        },
        preloadImages: function(a) {
            if (a && typeof a != "object") hs.numberOfImagesToPreload = a;
            a = hs.getAnchors();
            for (var b = 0; b < a.images.length && b < hs.numberOfImagesToPreload; b++) hs.push(hs.preloadTheseImages, hs.getSrc(a.images[b]));
            if (hs.outlineType) new hs.Outline(hs.outlineType,
            function() {
                hs.preloadFullImage(0)
            });
            else hs.preloadFullImage(0);
            hs.restoreCursor && hs.createElement("img", {
                src: hs.graphicsDir + hs.restoreCursor
            })
        },
        init: function() {
            if (!hs.container) {
                hs.getPageSize();
                hs.ieLt7 = hs.ie && hs.uaVersion < 7;
                hs.ie6SSL = hs.ieLt7 && location.protocol == "https:";
                for (var a in hs.langDefaults) if (typeof hs[a] != "undefined") hs.lang[a] = hs[a];
                else if (typeof hs.lang[a] == "undefined" && typeof hs.langDefaults[a] != "undefined") hs.lang[a] = hs.langDefaults[a];
                hs.container = hs.createElement("div", {
                    className: "highslide-container"
                },
                {
                    position: "absolute",
                    left: 0,
                    top: 0,
                    width: "100%",
                    zIndex: hs.zIndexCounter,
                    direction: "ltr"
                },
                document.body, true);
                hs.loading = hs.createElement("a", {
                    className: "highslide-loading",
                    title: hs.lang.loadingTitle,
                    innerHTML: hs.lang.loadingText,
                    href: "javascript:;"
                },
                {
                    position: "absolute",
                    top: "-9999px",
                    opacity: hs.loadingOpacity,
                    zIndex: 1
                },
                hs.container);
                hs.garbageBin = hs.createElement("div", null, {
                    display: "none"
                },
                hs.container);
                hs.clearing = hs.createElement("div", null, {
                    clear: "both",
                    paddingTop: "1px"
                },
                null, true);
                Math.linearTween = function(b, c, d, e) {
                    return d * b / e + c
                };
                Math.easeInQuad = function(b, c, d, e) {
                    return d * (b /= e) * b + c
                };
                hs.hideSelects = hs.ieLt7;
                hs.hideIframes = window.opera && hs.uaVersion < 9 || navigator.vendor == "KDE" || hs.ie && hs.uaVersion < 5.5
            }
        },
        ready: function() {
            if (!hs.isReady) {
                hs.isReady = true;
                for (var a = 0; a < hs.onReady.length; a++) hs.onReady[a]()
            }
        },
        updateAnchors: function() {
            for (var a, b, c = [], d = [], e = [], g = {},
            i, s = 0; s < hs.openerTagNames.length; s++) {
                b = document.getElementsByTagName(hs.openerTagNames[s]);
                for (var w = 0; w < b.length; w++) {
                    a = b[w];
                    if (i = hs.isHsAnchor(a)) {
                        hs.push(c, a);
                        if (i[0] == "hs.expand") hs.push(d, a);
                        else i[0] == "hs.htmlExpand" && hs.push(e, a);
                        i = hs.getParam(a, "slideshowGroup") || "none";
                        g[i] || (g[i] = []);
                        hs.push(g[i], a)
                    }
                }
            }
            hs.anchors = {
                all: c,
                groups: g,
                images: d,
                htmls: e
            };
            return hs.anchors
        },
        getAnchors: function() {
            return hs.anchors || hs.updateAnchors()
        },
        close: function(a) { (a = hs.getExpander(a)) && a.close();
            return false
        }
    };
    hs.fx = function(a, b, c) {
        this.options = b;
        this.elem = a;
        this.prop = c;
        if (!b.orig) b.orig = {}
    };
    hs.fx.prototype = {
        update: function() { (hs.fx.step[this.prop] || hs.fx.step._default)(this);
            this.options.step && this.options.step.call(this.elem, this.now, this)
        },
        custom: function(a, b, c) {
            function d(g) {
                return e.step(g)
            }
            this.startTime = (new Date).getTime();
            this.start = a;
            this.end = b;
            this.unit = c;
            this.now = this.start;
            this.pos = this.state = 0;
            var e = this;
            d.elem = this.elem;
            if (d() && hs.timers.push(d) == 1) hs.timerId = setInterval(function() {
                for (var g = hs.timers, i = 0; i < g.length; i++) g[i]() || g.splice(i--, 1);
                g.length || clearInterval(hs.timerId)
            },
            13)
        },
        step: function(a) {
            var b = (new Date).getTime();
            if (a || b >= this.options.duration + this.startTime) {
                this.now = this.end;
                this.pos = this.state = 1;
                this.update();
                a = this.options.curAnim[this.prop] = true;
                for (var c in this.options.curAnim) if (this.options.curAnim[c] !== true) a = false;
                a && this.options.complete && this.options.complete.call(this.elem);
                return false
            } else {
                c = b - this.startTime;
                this.state = c / this.options.duration;
                this.pos = this.options.easing(c, 0, 1, this.options.duration);
                this.now = this.start + (this.end - this.start) * this.pos;
                this.update()
            }
            return true
        }
    };
    hs.extend(hs.fx, {
        step: {
            opacity: function(a) {
                hs.setStyles(a.elem, {
                    opacity: a.now
                })
            },
            _default: function(a) {
                try {
                    if (a.elem.style && a.elem.style[a.prop] != null) a.elem.style[a.prop] = a.now + a.unit;
                    else a.elem[a.prop] = a.now
                } catch(b) {}
            }
        }
    });
    hs.Outline = function(a, b) {
        this.onLoad = b;
        this.outlineType = a;
        var c = hs.uaVersion,
        d;
        this.hasAlphaImageLoader = hs.ie && c >= 5.5 && c < 7;
        if (a) {
            hs.init();
            this.table = hs.createElement("table", {
                cellSpacing: 0
            },
            {
                visibility: "hidden",
                position: "absolute",
                borderCollapse: "collapse",
                width: 0
            },
            hs.container, true);
            c = hs.createElement("tbody", null, null, this.table, 1);
            this.td = [];
            for (var e = 0; e <= 8; e++) {
                if (e % 3 == 0) d = hs.createElement("tr", null, {
                    height: "auto"
                },
                c, true);
                this.td[e] = hs.createElement("td", null, null, d, true);
                hs.setStyles(this.td[e], e != 4 ? {
                    lineHeight: 0,
                    fontSize: 0
                }: {
                    position: "relative"
                })
            }
            this.td[4].className = a + " highslide-outline";
            this.preloadGraphic()
        } else b && b()
    };
    hs.Outline.prototype = {
        preloadGraphic: function() {
            var a = hs.graphicsDir + (hs.outlinesDir || "outlines/") + this.outlineType + ".png";
            this.graphic = hs.createElement("img", null, {
                position: "absolute",
                top: "-9999px"
            },
            hs.safari && hs.uaVersion < 525 ? hs.container: null, true);
            var b = this;
            this.graphic.onload = function() {
                b.onGraphicLoad()
            };
            this.graphic.src = a
        },
        onGraphicLoad: function() {
            for (var a = this.offset = this.graphic.width / 4, b = [[0, 0], [0, -4], [ - 2, 0], [0, -8], 0, [ - 2, -8], [0, -2], [0, -6], [ - 2, -2]], c = {
                height: 2 * a + "px",
                width: 2 * a + "px"
            },
            d = 0; d <= 8; d++) if (b[d]) {
                if (this.hasAlphaImageLoader) {
                    var e = d == 1 || d == 7 ? "100%": this.graphic.width + "px",
                    g = hs.createElement("div", null, {
                        width: "100%",
                        height: "100%",
                        position: "relative",
                        overflow: "hidden"
                    },
                    this.td[d], true);
                    hs.createElement("div", null, {
                        filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='" + this.graphic.src + "')",
                        position: "absolute",
                        width: e,
                        height: this.graphic.height + "px",
                        left: b[d][0] * a + "px",
                        top: b[d][1] * a + "px"
                    },
                    g, true)
                } else hs.setStyles(this.td[d], {
                    background: "url(" + this.graphic.src + ") " + b[d][0] * a + "px " + b[d][1] * a + "px"
                });
                if (window.opera && (d == 3 || d == 5)) hs.createElement("div", null, c, this.td[d], true);
                hs.setStyles(this.td[d], c)
            }
            this.graphic = null;
            hs.pendingOutlines[this.outlineType] && hs.pendingOutlines[this.outlineType].destroy();
            hs.pendingOutlines[this.outlineType] = this;
            this.onLoad && this.onLoad()
        },
        setPosition: function(a, b, c) {
            var d = this.exp;
            b = b || 0;
            a = a || {
                x: d.x.pos + b,
                y: d.y.pos + b,
                w: d.x.get("wsize") - 2 * b,
                h: d.y.get("wsize") - 2 * b
            };
            if (c) this.table.style.visibility = a.h >= 4 * this.offset ? "visible": "hidden";
            hs.setStyles(this.table, {
                left: a.x - this.offset + "px",
                top: a.y - this.offset + "px",
                width: a.w + 2 * this.offset + "px"
            });
            a.w -= 2 * this.offset;
            a.h -= 2 * this.offset;
            hs.setStyles(this.td[4], {
                width: a.w >= 0 ? a.w + "px": 0,
                height: a.h >= 0 ? a.h + "px": 0
            });
            if (this.hasAlphaImageLoader) this.td[3].style.height = this.td[5].style.height = this.td[4].style.height
        },
        destroy: function(a) {
            if (a) this.table.style.visibility = "hidden";
            else hs.discardElement(this.table)
        }
    };
    hs.Dimension = function(a, b) {
        this.exp = a;
        this.dim = b;
        this.ucwh = b == "x" ? "Width": "Height";
        this.wh = this.ucwh.toLowerCase();
        this.uclt = b == "x" ? "Left": "Top";
        this.lt = this.uclt.toLowerCase();
        this.ucrb = b == "x" ? "Right": "Bottom";
        this.rb = this.ucrb.toLowerCase();
        this.p1 = this.p2 = 0
    };
    hs.Dimension.prototype = {
        get: function(a) {
            switch (a) {
            case "loadingPos":
                return this.tpos + this.tb + (this.t - hs.loading["offset" + this.ucwh]) / 2;
            case "wsize":
                return this.size + 2 * this.cb + this.p1 + this.p2;
            case "fitsize":
                return this.clientSize - this.marginMin - this.marginMax;
            case "maxsize":
                return this.get("fitsize") - 2 * this.cb - this.p1 - this.p2;
            case "opos":
                return this.pos - (this.exp.outline ? this.exp.outline.offset: 0);
            case "osize":
                return this.get("wsize") + (this.exp.outline ? 2 * this.exp.outline.offset: 0);
            case "imgPad":
                return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0
            }
        },
        calcBorders: function() {
            this.cb = (this.exp.content["offset" + this.ucwh] - this.t) / 2;
            this.marginMax = hs["margin" + this.ucrb]
        },
        calcThumb: function() {
            this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : this.exp.el["offset" + this.ucwh];
            this.tpos = this.exp.tpos[this.dim];
            this.tb = (this.exp.el["offset" + this.ucwh] - this.t) / 2;
            if (this.tpos == 0 || this.tpos == -1) this.tpos = hs.page[this.wh] / 2 + hs.page["scroll" + this.uclt]
        },
        calcExpanded: function() {
            var a = this.exp;
            this.justify = "auto";
            this.pos = this.tpos - this.cb + this.tb;
            if (this.maxHeight && this.dim == "x") a.maxWidth = Math.min(a.maxWidth || this.full, a.maxHeight * this.full / a.y.full);
            this.size = Math.min(this.full, a["max" + this.ucwh] || this.full);
            this.minSize = a.allowSizeReduction ? Math.min(a["min" + this.ucwh], this.full) : this.full;
            if (a.isImage && a.useBox) {
                this.size = a[this.wh];
                this.imgSize = this.full
            }
            if (this.dim == "x" && hs.padToMinWidth) this.minSize = a.minWidth;
            this.marginMin = hs["margin" + this.uclt];
            this.scroll = hs.page["scroll" + this.uclt];
            this.clientSize = hs.page[this.wh]
        },
        setSize: function(a) {
            var b = this.exp;
            if (b.isImage && (b.useBox || hs.padToMinWidth)) {
                this.imgSize = a;
                this.size = Math.max(this.size, this.imgSize);
                b.content.style[this.lt] = this.get("imgPad") + "px"
            } else this.size = a;
            b.content.style[this.wh] = a + "px";
            b.wrapper.style[this.wh] = this.get("wsize") + "px";
            b.outline && b.outline.setPosition();
            if (b.releaseMask) b.releaseMask.style[this.wh] = a + "px";
            if (this.dim == "y" && b.iDoc && b.body.style.height != "auto") try {
                b.iDoc.body.style.overflow = "auto"
            } catch(c) {}
            if (b.isHtml) {
                a = b.scrollerDiv;
                if (this.sizeDiff === undefined) this.sizeDiff = b.innerContent["offset" + this.ucwh] - a["offset" + this.ucwh];
                a.style[this.wh] = this.size - this.sizeDiff + "px";
                if (this.dim == "x") b.mediumContent.style.width = "auto";
                if (b.body) b.body.style[this.wh] = "auto"
            }
            this.dim == "x" && b.overlayBox && b.sizeOverlayBox(true)
        },
        setPos: function(a) {
            this.pos = a;
            this.exp.wrapper.style[this.lt] = a + "px";
            this.exp.outline && this.exp.outline.setPosition()
        }
    };
    hs.Expander = function(a, b, c, d) {
        if (document.readyState && hs.ie && !hs.isReady) hs.addEventListener(document, "ready",
        function() {
            new hs.Expander(a, b, c, d)
        });
        else {
            this.a = a;
            this.custom = c;
            this.contentType = d || "image";
            this.isHtml = d == "html";
            this.isImage = !this.isHtml;
            hs.continuePreloading = false;
            this.overlays = [];
            hs.init();
            for (var e = this.key = hs.expanders.length, g = 0; g < hs.overrides.length; g++) {
                var i = hs.overrides[g];
                this[i] = b && typeof b[i] != "undefined" ? b[i] : hs[i]
            }
            if (!this.src) this.src = a.href;
            i = b && b.thumbnailId ? hs.$(b.thumbnailId) : a;
            i = this.thumb = i.getElementsByTagName("img")[0] || i;
            this.thumbsUserSetId = i.id || a.id;
            for (g = 0; g < hs.expanders.length; g++) if (hs.expanders[g] && hs.expanders[g].a == a) {
                hs.expanders[g].focus();
                return false
            }
            if (!hs.allowSimultaneousLoading) for (g = 0; g < hs.expanders.length; g++) hs.expanders[g] && hs.expanders[g].thumb != i && !hs.expanders[g].onLoadStarted && hs.expanders[g].cancelLoading();
            hs.expanders[e] = this;
            if (!hs.allowMultipleInstances && !hs.upcoming) {
                hs.expanders[e - 1] && hs.expanders[e - 1].close();
                typeof hs.focusKey != "undefined" && hs.expanders[hs.focusKey] && hs.expanders[hs.focusKey].close()
            }
            this.el = i;
            this.tpos = this.pageOrigin || hs.getPosition(i);
            hs.getPageSize(); (this.x = new hs.Dimension(this, "x")).calcThumb(); (this.y = new hs.Dimension(this, "y")).calcThumb();
            this.wrapper = hs.createElement("div", {
                id: "highslide-wrapper-" + this.key,
                className: "highslide-wrapper " + this.wrapperClassName
            },
            {
                visibility: "hidden",
                position: "absolute",
                zIndex: hs.zIndexCounter += 2
            },
            null, true);
            this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
            if (this.contentType == "image" && this.outlineWhileAnimating == 2) this.outlineWhileAnimating = 0;
            if (this.outlineType) if (hs.pendingOutlines[this.outlineType]) {
                this.connectOutline();
                this[this.contentType + "Create"]()
            } else {
                this.showLoading();
                var s = this;
                new hs.Outline(this.outlineType,
                function() {
                    s.connectOutline();
                    s[s.contentType + "Create"]()
                })
            } else this[this.contentType + "Create"]();
            return true
        }
    };
    hs.Expander.prototype = {
        error: function(a) {
            if (hs.debug) alert("Line " + a.lineNumber + ": " + a.message);
            else window.location.href = this.src
        },
        connectOutline: function() {
            var a = this.outline = hs.pendingOutlines[this.outlineType];
            a.exp = this;
            a.table.style.zIndex = this.wrapper.style.zIndex - 1;
            hs.pendingOutlines[this.outlineType] = null
        },
        showLoading: function() {
            if (! (this.onLoadStarted || this.loading)) {
                this.loading = hs.loading;
                var a = this;
                this.loading.onclick = function() {
                    a.cancelLoading()
                };
                a = this;
                var b = this.x.get("loadingPos") + "px",
                c = this.y.get("loadingPos") + "px";
                setTimeout(function() {
                    a.loading && hs.setStyles(a.loading, {
                        left: b,
                        top: c,
                        zIndex: hs.zIndexCounter++
                    })
                },
                100)
            }
        },
        imageCreate: function() {
            var a = this,
            b = document.createElement("img");
            this.content = b;
            b.onload = function() {
                hs.expanders[a.key] && a.contentLoaded()
            };
            if (hs.blockRightClick) b.oncontextmenu = function() {
                return false
            };
            b.className = "highslide-image";
            hs.setStyles(b, {
                visibility: "hidden",
                display: "block",
                position: "absolute",
                maxWidth: "9999px",
                zIndex: 3
            });
            b.title = hs.lang.restoreTitle;
            hs.safari && hs.uaVersion < 525 && hs.container.appendChild(b);
            if (hs.ie && hs.flushImgSize) b.src = null;
            b.src = this.src;
            this.showLoading()
        },
        htmlCreate: function() {
            this.content = hs.getCacheBinding(this.a);
            if (!this.content) this.content = hs.getNode(this.contentId);
            if (!this.content) this.content = hs.getSelfRendered();
            this.getInline(["maincontent"]);
            if (this.maincontent) {
                var a = hs.getElementByClass(this.content, "div", "highslide-body");
                a && a.appendChild(this.maincontent);
                this.maincontent.style.display = "block"
            }
            a = this.innerContent = this.content;
            /(swf|iframe)/.test(this.objectType) && this.setObjContainerSize(a);
            hs.container.appendChild(this.wrapper);
            hs.setStyles(this.wrapper, {
                position: "static",
                padding: "0 " + hs.marginRight + "px 0 " + hs.marginLeft + "px"
            });
            this.content = hs.createElement("div", {
                className: "highslide-html"
            },
            {
                position: "relative",
                zIndex: 3,
                height: 0,
                overflow: "hidden"
            },
            this.wrapper);
            this.mediumContent = hs.createElement("div", null, null, this.content, 1);
            this.mediumContent.appendChild(a);
            hs.setStyles(a, {
                position: "relative",
                display: "block",
                direction: hs.lang.cssDirection || ""
            });
            if (this.width) a.style.width = this.width + "px";
            this.height && hs.setStyles(a, {
                height: this.height + "px",
                overflow: "hidden"
            });
            if (a.offsetWidth < this.minWidth) a.style.width = this.minWidth + "px";
            if (this.objectType == "ajax" && !hs.getCacheBinding(this.a)) {
                this.showLoading();
                var b = this;
                a = new hs.Ajax(this.a, a);
                a.src = this.src;
                a.onLoad = function() {
                    hs.expanders[b.key] && b.contentLoaded()
                };
                a.onError = function() {
                    location.href = b.src
                };
                a.run()
            } else this.objectType == "iframe" && this.objectLoadTime == "before" ? this.writeExtendedContent() : this.contentLoaded()
        },
        contentLoaded: function() {
            try {
                if (this.content) {
                    this.content.onload = null;
                    if (!this.onLoadStarted) {
                        this.onLoadStarted = true;
                        var a = this.x,
                        b = this.y;
                        if (this.loading) {
                            hs.setStyles(this.loading, {
                                top: "-9999px"
                            });
                            this.loading = null
                        }
                        if (this.isImage) {
                            a.full = this.content.width;
                            b.full = this.content.height;
                            hs.setStyles(this.content, {
                                width: a.t + "px",
                                height: b.t + "px"
                            });
                            this.wrapper.appendChild(this.content);
                            hs.container.appendChild(this.wrapper)
                        } else this.htmlGetSize && this.htmlGetSize();
                        a.calcBorders();
                        b.calcBorders();
                        hs.setStyles(this.wrapper, {
                            left: a.tpos + a.tb - a.cb + "px",
                            top: b.tpos + a.tb - b.cb + "px"
                        });
                        this.getOverlays();
                        var c = a.full / b.full;
                        a.calcExpanded();
                        this.justify(a);
                        b.calcExpanded();
                        this.justify(b);
                        this.isHtml && this.htmlSizeOperations();
                        this.overlayBox && this.sizeOverlayBox(0, 1);
                        if (this.allowSizeReduction) {
                            this.isImage ? this.correctRatio(c) : this.fitOverlayBox();
                            if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) {
                                this.createFullExpand();
                                this.overlays.length == 1 && this.sizeOverlayBox()
                            }
                        }
                        this.show()
                    }
                }
            } catch(d) {
                this.error(d)
            }
        },
        setObjContainerSize: function(a) {
            a = hs.getElementByClass(a, "DIV", "highslide-body");
            if (/(iframe|swf)/.test(this.objectType)) {
                if (this.objectWidth) a.style.width = this.objectWidth + "px";
                if (this.objectHeight) a.style.height = this.objectHeight + "px"
            }
        },
        writeExtendedContent: function() {
            if (!this.hasExtendedContent) {
                this.body = hs.getElementByClass(this.innerContent, "DIV", "highslide-body");
                if (this.objectType == "iframe") {
                    this.showLoading();
                    var a = hs.clearing.cloneNode(1);
                    this.body.appendChild(a);
                    this.newWidth = this.innerContent.offsetWidth;
                    if (!this.objectWidth) this.objectWidth = a.offsetWidth;
                    a = this.innerContent.offsetHeight - this.body.offsetHeight;
                    a = this.objectHeight || hs.page.height - a - hs.marginTop - hs.marginBottom;
                    var b = this.objectLoadTime == "before" ? ' onload="if (hs.expanders[' + this.key + "]) hs.expanders[" + this.key + '].contentLoaded()" ': "";
                    this.body.innerHTML += '<iframe name="hs' + (new Date).getTime() + '" frameborder="0" key="' + this.key + '" style="width:' + this.objectWidth + "px; height:" + a + 'px" ' + b + ' src="' + this.src + '" ></iframe>';
                    this.ruler = this.body.getElementsByTagName("div")[0];
                    this.iframe = this.body.getElementsByTagName("iframe")[0];
                    this.objectLoadTime == "after" && this.correctIframeSize()
                }
                if (this.objectType == "swf") {
                    this.body.id = this.body.id || "hs-flash-id-" + this.key;
                    a = this.swfOptions;
                    if (!a.params) a.params = {};
                    if (typeof a.params.wmode == "undefined") a.params.wmode = "transparent";
                    if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, a.version || "7", a.expressInstallSwfurl, a.flashvars, a.params, a.attributes)
                }
                this.hasExtendedContent = true
            }
        },
        htmlGetSize: function() {
            if (this.iframe && !this.objectHeight) this.iframe.style.height = this.body.style.height = this.getIframePageHeight() + "px";
            this.innerContent.appendChild(hs.clearing);
            if (!this.x.full) this.x.full = this.innerContent.offsetWidth;
            this.y.full = this.innerContent.offsetHeight;
            this.innerContent.removeChild(hs.clearing);
            if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) this.newHeight = parseInt(this.innerContent.currentStyle.height);
            hs.setStyles(this.wrapper, {
                position: "absolute",
                padding: "0"
            });
            hs.setStyles(this.content, {
                width: this.x.t + "px",
                height: this.y.t + "px"
            })
        },
        getIframePageHeight: function() {
            var a;
            try {
                var b = this.iDoc = this.iframe.contentDocument || this.iframe.contentWindow.document,
                c = b.createElement("div");
                c.style.clear = "both";
                b.body.appendChild(c);
                a = c.offsetTop;
                if (hs.ie) a += parseInt(b.body.currentStyle.marginTop) + parseInt(b.body.currentStyle.marginBottom) - 1
            } catch(d) {
                a = 300
            }
            return a
        },
        correctIframeSize: function() {
            var a = this.innerContent.offsetWidth - this.ruler.offsetWidth;
            hs.discardElement(this.ruler);
            if (a < 0) a = 0;
            var b = this.innerContent.offsetHeight - this.iframe.offsetHeight;
            if (this.iDoc && !this.objectHeight && !this.height && this.y.size == this.y.full) try {
                this.iDoc.body.style.overflow = "hidden"
            } catch(c) {}
            hs.setStyles(this.iframe, {
                width: Math.abs(this.x.size - a) + "px",
                height: Math.abs(this.y.size - b) + "px"
            });
            hs.setStyles(this.body, {
                width: this.iframe.style.width,
                height: this.iframe.style.height
            });
            this.scrollerDiv = this.scrollingContent = this.iframe
        },
        htmlSizeOperations: function() {
            this.setObjContainerSize(this.innerContent);
            this.objectType == "swf" && this.objectLoadTime == "before" && this.writeExtendedContent();
            if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full;
            if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full;
            this.scrollerDiv = this.innerContent;
            hs.setStyles(this.mediumContent, {
                position: "relative",
                width: this.x.size + "px"
            });
            hs.setStyles(this.innerContent, {
                border: "none",
                width: "auto",
                height: "auto"
            });
            var a = hs.getElementByClass(this.innerContent, "DIV", "highslide-body");
            if (a && !/(iframe|swf)/.test(this.objectType)) {
                var b = a;
                a = hs.createElement(b.nodeName, null, {
                    overflow: "hidden"
                },
                null, true);
                b.parentNode.insertBefore(a, b);
                a.appendChild(hs.clearing);
                a.appendChild(b);
                var c = this.innerContent.offsetWidth - a.offsetWidth,
                d = this.innerContent.offsetHeight - a.offsetHeight;
                a.removeChild(hs.clearing);
                var e = hs.safari || navigator.vendor == "KDE" ? 1: 0;
                hs.setStyles(a, {
                    width: this.x.size - c - e + "px",
                    height: this.y.size - d + "px",
                    overflow: "auto",
                    position: "relative"
                });
                if (e && b.offsetHeight > a.offsetHeight) a.style.width = parseInt(a.style.width) + e + "px";
                this.scrollerDiv = this.scrollingContent = a
            }
            this.iframe && this.objectLoadTime == "before" && this.correctIframeSize();
            if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content;
            if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) this.x.size += 17;
            this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight && setTimeout("try { hs.expanders[" + this.key + "].scrollerDiv.style.overflow = 'auto'; } catch(e) {}", hs.expandDuration)
        },
        justify: function(a, b) {
            var c = a == this.x ? "x": "y",
            d = false,
            e = a.exp.allowSizeReduction;
            a.pos = Math.round(a.pos - (a.get("wsize") - a.t) / 2);
            if (a.pos < a.scroll + a.marginMin) {
                a.pos = a.scroll + a.marginMin;
                d = true
            }
            if (!b && a.size < a.minSize) {
                a.size = a.minSize;
                e = false
            }
            if (a.pos + a.get("wsize") > a.scroll + a.clientSize - a.marginMax) if (!b && d && e) a.size = Math.min(a.size, a.get(c == "y" ? "fitsize": "maxsize"));
            else if (a.get("wsize") < a.get("fitsize")) a.pos = a.scroll + a.clientSize - a.marginMax - a.get("wsize");
            else {
                a.pos = a.scroll + a.marginMin;
                if (!b && e) a.size = a.get(c == "y" ? "fitsize": "maxsize")
            }
            if (!b && a.size < a.minSize) {
                a.size = a.minSize;
                e = false
            }
            if (a.pos < a.marginMin) {
                c = a.pos;
                a.pos = a.marginMin;
                if (e && !b) a.size -= a.pos - c
            }
        },
        correctRatio: function(a) {
            var b = this.x,
            c = this.y,
            d = false,
            e = Math.min(b.full, b.size),
            g = Math.min(c.full, c.size),
            i = this.useBox || hs.padToMinWidth;
            if (e / g > a) {
                e = g * a;
                if (e < b.minSize) {
                    e = b.minSize;
                    g = e / a
                }
                d = true
            } else if (e / g < a) {
                g = e / a;
                d = true
            }
            if (hs.padToMinWidth && b.full < b.minSize) {
                b.imgSize = b.full;
                c.size = c.imgSize = c.full
            } else if (this.useBox) {
                b.imgSize = e;
                c.imgSize = g
            } else {
                b.size = e;
                c.size = g
            }
            d = this.fitOverlayBox(this.useBox ? null: a, d);
            if (i && c.size < c.imgSize) {
                c.imgSize = c.size;
                b.imgSize = c.size * a
            }
            if (d || i) {
                b.pos = b.tpos - b.cb + b.tb;
                b.minSize = b.size;
                this.justify(b, true);
                c.pos = c.tpos - c.cb + c.tb;
                c.minSize = c.size;
                this.justify(c, true);
                this.overlayBox && this.sizeOverlayBox()
            }
        },
        fitOverlayBox: function(a, b) {
            var c = this.x,
            d = this.y;
            if (this.overlayBox && (this.isImage || this.allowHeightReduction)) for (; d.size > this.minHeight && c.size > this.minWidth && d.get("wsize") > d.get("fitsize");) {
                d.size -= 10;
                if (a) c.size = d.size * a;
                this.sizeOverlayBox(0, 1);
                b = true
            }
            return b
        },
        show: function() {
            var a = this.x,
            b = this.y;
            this.doShowHide("hidden");
            this.changeSize(1, {
                wrapper: {
                    width: a.get("wsize"),
                    height: b.get("wsize"),
                    left: a.pos,
                    top: b.pos
                },
                content: {
                    left: a.p1 + a.get("imgPad"),
                    top: b.p1 + b.get("imgPad"),
                    width: a.imgSize || a.size,
                    height: b.imgSize || b.size
                }
            },
            hs.expandDuration)
        },
        changeSize: function(a, b, c) {
            if (this.outline && !this.outlineWhileAnimating) a ? this.outline.setPosition() : this.outline.destroy(this.isHtml && this.preserveContent);
            a || this.destroyOverlays();
            var d = this,
            e = d.x,
            g = d.y,
            i = this.easing;
            a || (i = this.easingClose || i);
            var s = a ?
            function() {
                if (d.outline) d.outline.table.style.visibility = "visible";
                setTimeout(function() {
                    d.afterExpand()
                },
                50)
            }: function() {
                d.afterClose()
            };
            a && hs.setStyles(this.wrapper, {
                width: e.t + "px",
                height: g.t + "px"
            });
            a && this.isHtml && hs.setStyles(this.wrapper, {
                left: e.tpos - e.cb + e.tb + "px",
                top: g.tpos - g.cb + g.tb + "px"
            });
            if (this.fadeInOut) {
                hs.setStyles(this.wrapper, {
                    opacity: a ? 0: 1
                });
                hs.extend(b.wrapper, {
                    opacity: a
                })
            }
            hs.animate(this.wrapper, b.wrapper, {
                duration: c,
                easing: i,
                step: function(w, A) {
                    if (d.outline && d.outlineWhileAnimating && A.prop == "top") {
                        var y = a ? A.pos: 1 - A.pos;
                        y = {
                            w: e.t + (e.get("wsize") - e.t) * y,
                            h: g.t + (g.get("wsize") - g.t) * y,
                            x: e.tpos + (e.pos - e.tpos) * y,
                            y: g.tpos + (g.pos - g.tpos) * y
                        };
                        d.outline.setPosition(y, 0, 1)
                    }
                    if (d.isHtml) {
                        if (A.prop == "left") d.mediumContent.style.left = e.pos - w + "px";
                        if (A.prop == "top") d.mediumContent.style.top = g.pos - w + "px"
                    }
                }
            });
            hs.animate(this.content, b.content, c, i, s);
            if (a) {
                this.wrapper.style.visibility = "visible";
                this.content.style.visibility = "visible";
                if (this.isHtml) this.innerContent.style.visibility = "visible";
                this.a.className += " highslide-active-anchor"
            }
        },
        afterExpand: function() {
            this.isExpanded = true;
            this.focus();
            this.isHtml && this.objectLoadTime == "after" && this.writeExtendedContent();
            if (this.iframe) {
                try {
                    var a = this;
                    hs.addEventListener(this.iframe.contentDocument || this.iframe.contentWindow.document, "mousedown",
                    function() {
                        hs.focusKey != a.key && a.focus()
                    })
                } catch(b) {}
                if (hs.ie && typeof this.isClosing != "boolean") this.iframe.style.width = this.objectWidth - 1 + "px"
            }
            if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
            this.prepareNextOutline();
            var c = hs.page,
            d = hs.mouse.x + c.scrollLeft;
            c = hs.mouse.y + c.scrollTop;
            this.mouseIsOver = this.x.pos < d && d < this.x.pos + this.x.get("wsize") && this.y.pos < c && c < this.y.pos + this.y.get("wsize");
            this.overlayBox && this.showOverlays()
        },
        prepareNextOutline: function() {
            var a = this.key;
            new hs.Outline(this.outlineType,
            function() {
                try {
                    hs.expanders[a].preloadNext()
                } catch(b) {}
            })
        },
        preloadNext: function() {
            var a = this.getAdjacentAnchor(1);
            a && a.onclick.toString().match(/hs\.expand/) && hs.createElement("img", {
                src: hs.getSrc(a)
            })
        },
        getAdjacentAnchor: function(a) {
            var b = this.getAnchorIndex(),
            c = hs.anchors.groups[this.slideshowGroup || "none"];
            return c && c[b + a] || null
        },
        getAnchorIndex: function() {
            var a = hs.getAnchors().groups[this.slideshowGroup || "none"];
            if (a) for (var b = 0; b < a.length; b++) if (a[b] == this.a) return b;
            return null
        },
        cancelLoading: function() {
            hs.discardElement(this.wrapper);
            hs.expanders[this.key] = null;
            if (this.loading) hs.loading.style.left = "-9999px"
        },
        writeCredits: function() {
            this.credits = hs.createElement("a", {
                href: hs.creditsHref,
                target: hs.creditsTarget,
                className: "highslide-credits",
                innerHTML: hs.lang.creditsText,
                title: hs.lang.creditsTitle
            });
            this.createOverlay({
                overlayId: this.credits,
                position: this.creditsPosition || "top left"
            })
        },
        getInline: function(a, b) {
            for (var c = 0; c < a.length; c++) {
                var d = a[c],
                e = null;
                if (!this[d + "Id"] && this.thumbsUserSetId) this[d + "Id"] = d + "-for-" + this.thumbsUserSetId;
                if (this[d + "Id"]) this[d] = hs.getNode(this[d + "Id"]);
                if (!this[d] && !this[d + "Text"] && this[d + "Eval"]) try {
                    e = eval(this[d + "Eval"])
                } catch(g) {}
                if (!this[d] && this[d + "Text"]) e = this[d + "Text"];
                if (!this[d] && !e) {
                    this[d] = hs.getNode(this.a["_" + d + "Id"]);
                    if (!this[d]) for (var i = this.a.nextSibling; i && !hs.isHsAnchor(i);) {
                        if (RegExp("highslide-" + d).test(i.className || null)) {
                            if (!i.id) this.a["_" + d + "Id"] = i.id = "hsId" + hs.idCounter++;
                            this[d] = hs.getNode(i.id);
                            break
                        }
                        i = i.nextSibling
                    }
                }
                if (!this[d] && e) this[d] = hs.createElement("div", {
                    className: "highslide-" + d,
                    innerHTML: e
                });
                if (b && this[d]) {
                    e = {
                        position: d == "heading" ? "above": "below"
                    };
                    for (var s in this[d + "Overlay"]) e[s] = this[d + "Overlay"][s];
                    e.overlayId = this[d];
                    this.createOverlay(e)
                }
            }
        },
        doShowHide: function(a) {
            hs.hideSelects && this.showHideElements("SELECT", a);
            hs.hideIframes && this.showHideElements("IFRAME", a);
            hs.geckoMac && this.showHideElements("*", a)
        },
        showHideElements: function(a, b) {
            for (var c = document.getElementsByTagName(a), d = a == "*" ? "overflow": "visibility", e = 0; e < c.length; e++) if (d == "visibility" || document.defaultView.getComputedStyle(c[e], "").getPropertyValue("overflow") == "auto" || c[e].getAttribute("hidden-by") != null) {
                var g = c[e].getAttribute("hidden-by");
                if (b == "visible" && g) {
                    g = g.replace("[" + this.key + "]", "");
                    c[e].setAttribute("hidden-by", g);
                    if (!g) c[e].style[d] = c[e].origProp
                } else if (b == "hidden") {
                    var i = hs.getPosition(c[e]);
                    i.w = c[e].offsetWidth;
                    i.h = c[e].offsetHeight;
                    var s = i.x + i.w < this.x.get("opos") || i.x > this.x.get("opos") + this.x.get("osize");
                    i = i.y + i.h < this.y.get("opos") || i.y > this.y.get("opos") + this.y.get("osize");
                    var w = hs.getWrapperKey(c[e]);
                    if (!s && !i && w != this.key) if (g) g.indexOf("[" + this.key + "]") == -1 && c[e].setAttribute("hidden-by", g + "[" + this.key + "]");
                    else {
                        c[e].setAttribute("hidden-by", "[" + this.key + "]");
                        c[e].origProp = c[e].style[d];
                        c[e].style[d] = "hidden"
                    } else if ((g == "[" + this.key + "]" || hs.focusKey == w) && w != this.key) {
                        c[e].setAttribute("hidden-by", "");
                        c[e].style[d] = c[e].origProp || ""
                    } else g && g.indexOf("[" + this.key + "]") > -1 && c[e].setAttribute("hidden-by", g.replace("[" + this.key + "]", ""))
                }
            }
        },
        focus: function() {
            this.wrapper.style.zIndex = hs.zIndexCounter += 2;
            for (var a = 0; a < hs.expanders.length; a++) if (hs.expanders[a] && a == hs.focusKey) {
                var b = hs.expanders[a];
                b.content.className += " highslide-" + b.contentType + "-blur";
                if (b.isImage) {
                    b.content.style.cursor = hs.ie ? "hand": "pointer";
                    b.content.title = hs.lang.focusTitle
                }
            }
            if (this.outline) this.outline.table.style.zIndex = this.wrapper.style.zIndex - 1;
            this.content.className = "highslide-" + this.contentType;
            if (this.isImage) {
                this.content.title = hs.lang.restoreTitle;
                if (hs.restoreCursor) {
                    hs.styleRestoreCursor = window.opera ? "pointer": "url(" + hs.graphicsDir + hs.restoreCursor + "), pointer";
                    if (hs.ie && hs.uaVersion < 6) hs.styleRestoreCursor = "hand";
                    this.content.style.cursor = hs.styleRestoreCursor
                }
            }
            hs.focusKey = this.key;
            hs.addEventListener(document, window.opera ? "keypress": "keydown", hs.keyHandler)
        },
        moveTo: function(a, b) {
            this.x.setPos(a);
            this.y.setPos(b)
        },
        resize: function(a) {
            var b,
            c = a.width / a.height;
            b = Math.max(a.width + a.dX, Math.min(this.minWidth, this.x.full));
            if (this.isImage && Math.abs(b - this.x.full) < 12) b = this.x.full;
            a = this.isHtml ? a.height + a.dY: b / c;
            if (a < Math.min(this.minHeight, this.y.full)) {
                a = Math.min(this.minHeight, this.y.full);
                if (this.isImage) b = a * c
            }
            this.resizeTo(b, a)
        },
        resizeTo: function(a, b) {
            this.y.setSize(b);
            this.x.setSize(a);
            this.wrapper.style.height = this.y.get("wsize") + "px"
        },
        close: function() {
            if (! (this.isClosing || !this.isExpanded)) {
                this.isClosing = true;
                hs.removeEventListener(document, window.opera ? "keypress": "keydown", hs.keyHandler);
                try {
                    this.isHtml && this.htmlPrepareClose();
                    this.content.style.cursor = "default";
                    this.changeSize(0, {
                        wrapper: {
                            width: this.x.t,
                            height: this.y.t,
                            left: this.x.tpos - this.x.cb + this.x.tb,
                            top: this.y.tpos - this.y.cb + this.y.tb
                        },
                        content: {
                            left: 0,
                            top: 0,
                            width: this.x.t,
                            height: this.y.t
                        }
                    },
                    hs.restoreDuration)
                } catch(a) {
                    this.afterClose()
                }
            }
        },
        htmlPrepareClose: function() {
            if (hs.geckoMac) {
                if (!hs.mask) hs.mask = hs.createElement("div", null, {
                    position: "absolute"
                },
                hs.container);
                hs.setStyles(hs.mask, {
                    width: this.x.size + "px",
                    height: this.y.size + "px",
                    left: this.x.pos + "px",
                    top: this.y.pos + "px",
                    display: "block"
                })
            }
            if (this.objectType == "swf") try {
                hs.$(this.body.id).StopPlay()
            } catch(a) {}
            this.objectLoadTime == "after" && !this.preserveContent && this.destroyObject();
            if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) this.scrollerDiv.style.overflow = "hidden"
        },
        destroyObject: function() {
            if (hs.ie && this.iframe) try {
                this.iframe.contentWindow.document.body.innerHTML = ""
            } catch(a) {}
            this.objectType == "swf" && swfobject.removeSWF(this.body.id);
            this.body.innerHTML = ""
        },
        sleep: function() {
            if (this.outline) this.outline.table.style.display = "none";
            this.releaseMask = null;
            this.wrapper.style.display = "none";
            this.isExpanded = false;
            hs.push(hs.sleeping, this)
        },
        awake: function() {
            try {
                hs.expanders[this.key] = this;
                if (!hs.allowMultipleInstances && hs.focusKey != this.key) try {
                    hs.expanders[hs.focusKey].close()
                } catch(a) {}
                var b = {
                    display: "",
                    zIndex: hs.zIndexCounter++
                };
                hs.setStyles(this.wrapper, b);
                this.isClosing = false;
                var c = this.outline || 0;
                if (c) {
                    if (!this.outlineWhileAnimating) b.visibility = "hidden";
                    hs.setStyles(c.table, b)
                }
                this.show()
            } catch(d) {}
        },
        createOverlay: function(a) {
            var b = a.overlayId;
            if (typeof b == "string") b = hs.getNode(b);
            if (a.html) b = hs.createElement("div", {
                innerHTML: a.html
            });
            if (! (!b || typeof b == "string")) {
                b.style.display = "block";
                this.genOverlayBox();
                var c = a.width && /^[0-9]+(px|%)$/.test(a.width) ? a.width: "auto";
                if (/^(left|right)panel$/.test(a.position) && !/^[0-9]+px$/.test(a.width)) c = "200px";
                c = hs.createElement("div", {
                    id: "hsId" + hs.idCounter++,
                    hsId: a.hsId
                },
                {
                    position: "absolute",
                    visibility: "hidden",
                    width: c,
                    direction: hs.lang.cssDirection || "",
                    opacity: 0
                },
                this.overlayBox, true);
                c.appendChild(b);
                hs.extend(c, {
                    opacity: 1,
                    offsetX: 0,
                    offsetY: 0,
                    dur: a.fade === 0 || a.fade === false || a.fade == 2 && hs.ie ? 0: 250
                });
                hs.extend(c, a);
                if (this.gotOverlays) {
                    this.positionOverlay(c);
                    if (!c.hideOnMouseOut || this.mouseIsOver) hs.animate(c, {
                        opacity: c.opacity
                    },
                    c.dur)
                }
                hs.push(this.overlays, hs.idCounter - 1)
            }
        },
        positionOverlay: function(a) {
            var b = a.position || "middle center",
            c = a.offsetX,
            d = a.offsetY;
            a.parentNode != this.overlayBox && this.overlayBox.appendChild(a);
            if (/left$/.test(b)) a.style.left = c + "px";
            /center$/.test(b) && hs.setStyles(a, {
                left: "50%",
                marginLeft: c - Math.round(a.offsetWidth / 2) + "px"
            });
            if (/right$/.test(b)) a.style.right = -c + "px";
            if (/^leftpanel$/.test(b)) {
                hs.setStyles(a, {
                    right: "100%",
                    marginRight: this.x.cb + "px",
                    top: -this.y.cb + "px",
                    bottom: -this.y.cb + "px",
                    overflow: "auto"
                });
                this.x.p1 = a.offsetWidth
            } else if (/^rightpanel$/.test(b)) {
                hs.setStyles(a, {
                    left: "100%",
                    marginLeft: this.x.cb + "px",
                    top: -this.y.cb + "px",
                    bottom: -this.y.cb + "px",
                    overflow: "auto"
                });
                this.x.p2 = a.offsetWidth
            }
            if (/^top/.test(b)) a.style.top = d + "px";
            /^middle/.test(b) && hs.setStyles(a, {
                top: "50%",
                marginTop: d - Math.round(a.offsetHeight / 2) + "px"
            });
            if (/^bottom/.test(b)) a.style.bottom = -d + "px";
            if (/^above$/.test(b)) {
                hs.setStyles(a, {
                    left: -this.x.p1 - this.x.cb + "px",
                    right: -this.x.p2 - this.x.cb + "px",
                    bottom: "100%",
                    marginBottom: this.y.cb + "px",
                    width: "auto"
                });
                this.y.p1 = a.offsetHeight
            } else if (/^below$/.test(b)) {
                hs.setStyles(a, {
                    position: "relative",
                    left: -this.x.p1 - this.x.cb + "px",
                    right: -this.x.p2 - this.x.cb + "px",
                    top: "100%",
                    marginTop: this.y.cb + "px",
                    width: "auto"
                });
                this.y.p2 = a.offsetHeight;
                a.style.position = "absolute"
            }
        },
        getOverlays: function() {
            this.getInline(["heading", "caption"], true);
            if (this.heading && this.dragByHeading) this.heading.className += " highslide-move";
            hs.showCredits && this.writeCredits();
            for (var a = 0; a < hs.overlays.length; a++) {
                var b = hs.overlays[a],
                c = b.thumbnailId,
                d = b.slideshowGroup;
                if (!c && !d || c && c == this.thumbsUserSetId || d && d === this.slideshowGroup) if (this.isImage || this.isHtml && b.useOnHtml) this.createOverlay(b)
            }
            c = [];
            for (a = 0; a < this.overlays.length; a++) {
                b = hs.$("hsId" + this.overlays[a]);
                /panel$/.test(b.position) ? this.positionOverlay(b) : hs.push(c, b)
            }
            for (a = 0; a < c.length; a++) this.positionOverlay(c[a]);
            this.gotOverlays = true
        },
        genOverlayBox: function() {
            if (!this.overlayBox) this.overlayBox = hs.createElement("div", {
                className: this.wrapperClassName
            },
            {
                position: "absolute",
                width: (this.x.size || (this.useBox ? this.width: null) || this.x.full) + "px",
                height: (this.y.size || this.y.full) + "px",
                visibility: "hidden",
                overflow: "hidden",
                zIndex: hs.ie ? 4: "auto"
            },
            hs.container, true)
        },
        sizeOverlayBox: function(a, b) {
            var c = this.overlayBox,
            d = this.x,
            e = this.y;
            hs.setStyles(c, {
                width: d.size + "px",
                height: e.size + "px"
            });
            if (a || b) for (var g = 0; g < this.overlays.length; g++) {
                var i = hs.$("hsId" + this.overlays[g]),
                s = hs.ieLt7 || document.compatMode == "BackCompat";
                if (i && /^(above|below)$/.test(i.position)) {
                    if (s) i.style.width = c.offsetWidth + 2 * d.cb + d.p1 + d.p2 + "px";
                    e[i.position == "above" ? "p1": "p2"] = i.offsetHeight
                }
                if (i && s && /^(left|right)panel$/.test(i.position)) i.style.height = c.offsetHeight + 2 * e.cb + "px"
            }
            if (a) {
                hs.setStyles(this.content, {
                    top: e.p1 + "px"
                });
                hs.setStyles(c, {
                    top: e.p1 + e.cb + "px"
                })
            }
        },
        showOverlays: function() {
            var a = this.overlayBox;
            a.className = "";
            hs.setStyles(a, {
                top: this.y.p1 + this.y.cb + "px",
                left: this.x.p1 + this.x.cb + "px",
                overflow: "visible"
            });
            if (hs.safari) a.style.visibility = "visible";
            this.wrapper.appendChild(a);
            for (a = 0; a < this.overlays.length; a++) {
                var b = hs.$("hsId" + this.overlays[a]);
                b.style.zIndex = b.zIndex || 4;
                if (!b.hideOnMouseOut || this.mouseIsOver) {
                    b.style.visibility = "visible";
                    hs.setStyles(b, {
                        visibility: "visible",
                        display: ""
                    });
                    hs.animate(b, {
                        opacity: b.opacity
                    },
                    b.dur)
                }
            }
        },
        destroyOverlays: function() {
            if (this.overlays.length) if (this.isHtml && this.preserveContent) {
                this.overlayBox.style.top = "-9999px";
                hs.container.appendChild(this.overlayBox)
            } else hs.discardElement(this.overlayBox)
        },
        createFullExpand: function() {
            this.fullExpandLabel = hs.createElement("a", {
                href: "javascript:hs.expanders[" + this.key + "].doFullExpand();",
                title: hs.lang.fullExpandTitle,
                className: "highslide-full-expand"
            });
            this.createOverlay({
                overlayId: this.fullExpandLabel,
                position: hs.fullExpandPosition,
                hideOnMouseOut: true,
                opacity: hs.fullExpandOpacity
            })
        },
        doFullExpand: function() {
            try {
                this.fullExpandLabel && hs.discardElement(this.fullExpandLabel);
                this.focus();
                var a = this.x.size;
                this.resizeTo(this.x.full, this.y.full);
                var b = this.x.pos - (this.x.size - a) / 2;
                if (b < hs.marginLeft) b = hs.marginLeft;
                this.moveTo(b, this.y.pos);
                this.doShowHide("hidden")
            } catch(c) {
                this.error(c)
            }
        },
        afterClose: function() {
            this.a.className = this.a.className.replace("highslide-active-anchor", "");
            this.doShowHide("visible");
            if (this.isHtml && this.preserveContent) this.sleep();
            else {
                this.outline && this.outlineWhileAnimating && this.outline.destroy();
                hs.discardElement(this.wrapper)
            }
            if (hs.mask) hs.mask.style.display = "none";
            hs.expanders[this.key] = null;
            hs.reOrder()
        }
    };
    hs.Ajax = function(a, b, c) {
        this.a = a;
        this.content = b;
        this.pre = c
    };
    hs.Ajax.prototype = {
        run: function() {
            var a;
            if (!this.src) this.src = hs.getSrc(this.a);
            if (this.src.match("#")) {
                var b = this.src.split("#");
                this.src = b[0];
                this.id = b[1]
            }
            if (hs.cachedGets[this.src]) {
                this.cachedGet = hs.cachedGets[this.src];
                this.id ? this.getElementContent() : this.loadHTML()
            } else {
                try {
                    a = new XMLHttpRequest
                } catch(c) {
                    try {
                        a = new ActiveXObject("Msxml2.XMLHTTP")
                    } catch(d) {
                        try {
                            a = new ActiveXObject("Microsoft.XMLHTTP")
                        } catch(e) {
                            this.onError()
                        }
                    }
                }
                var g = this;
                a.onreadystatechange = function() {
                    if (g.xhr.readyState == 4) g.id ? g.getElementContent() : g.loadHTML()
                };
                b = this.src;
                this.xhr = a;
                if (hs.forceAjaxReload) b = b.replace(/$/, (/\?/.test(b) ? "&": "?") + "dummy=" + (new Date).getTime());
                a.open("GET", b, true);
                a.setRequestHeader("X-Requested-With", "XMLHttpRequest");
                a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                a.send(null)
            }
        },
        getElementContent: function() {
            hs.init();
            this.iframe = hs.createElement("iframe", window.opera || hs.ie6SSL ? {
                src: "about:blank"
            }: null, {
                position: "absolute",
                top: "-9999px"
            },
            hs.container);
            this.loadHTML()
        },
        loadHTML: function() {
            var a = this.cachedGet || this.xhr.responseText,
            b;
            if (this.pre) hs.cachedGets[this.src] = a;
            if (!hs.ie || hs.uaVersion >= 5.5) {
                a = a.replace(RegExp("<link[^>]*>", "gi"), "").replace(RegExp("<script[^>]*>.*?<\/script>", "gi"), "");
                if (this.iframe) {
                    b = this.iframe.contentDocument;
                    if (!b && this.iframe.contentWindow) b = this.iframe.contentWindow.document;
                    if (!b) {
                        var c = this;
                        setTimeout(function() {
                            c.loadHTML()
                        },
                        25);
                        return
                    }
                    b.open();
                    b.write(a);
                    b.close();
                    try {
                        a = b.getElementById(this.id).innerHTML
                    } catch(d) {
                        try {
                            a = this.iframe.document.getElementById(this.id).innerHTML
                        } catch(e) {}
                    }
                    hs.discardElement(this.iframe)
                } else {
                    b = /(<body[^>]*>|<\/body>)/ig;
                    if (b.test(a)) a = a.split(b)[hs.ie ? 1: 2]
                }
            }
            hs.getElementByClass(this.content, "DIV", "highslide-body").innerHTML = a;
            this.onLoad();
            for (var g in this) this[g] = null
        }
    };
    hs.langDefaults = hs.lang;
    var HsExpander = hs.Expander;
    hs.ie && window == window.top &&
    function() {
        try {
            document.documentElement.doScroll("left")
        } catch(a) {
            setTimeout(arguments.callee, 50);
            return
        }
        hs.ready()
    } ();
    hs.addEventListener(document, "DOMContentLoaded", hs.ready);
    hs.addEventListener(window, "load", hs.ready);
    hs.addEventListener(document, "ready",
    function() {
        if (hs.expandCursor) {
            var a = hs.createElement("style", {
                type: "text/css"
            },
            null, document.getElementsByTagName("HEAD")[0]),
            b = function(c, d) {
                if (hs.ie) {
                    var e = document.styleSheets[document.styleSheets.length - 1];
                    typeof e.addRule == "object" && e.addRule(c, d)
                } else a.appendChild(document.createTextNode(c + " {" + d + "}"))
            };
            hs.expandCursor && b(".highslide img", "cursor: url(" + hs.graphicsDir + hs.expandCursor + "), pointer !important;")
        }
    });
    hs.addEventListener(window, "resize",
    function() {
        hs.getPageSize()
    });
    hs.addEventListener(document, "mousemove",
    function(a) {
        hs.mouse = {
            x: a.clientX,
            y: a.clientY
        }
    });
    hs.addEventListener(document, "mousedown", hs.mouseClickHandler);
    hs.addEventListener(document, "mouseup", hs.mouseClickHandler);
    hs.addEventListener(document, "ready", hs.getAnchors);
    hs.addEventListener(window, "load", hs.preloadImages);
    hs.addEventListener(window, "load", hs.preloadAjax)
}
var swfobject = function() {
    function a() {
        if (!H) {
            try {
                var f = p.getElementsByTagName("body")[0].appendChild(p.createElement("span"));
                f.parentNode.removeChild(f)
            } catch(h) {
                return
            }
            H = true;
            f = M.length;
            for (var l = 0; l < f; l++) M[l]()
        }
    }
    function b(f) {
        if (H) f();
        else M[M.length] = f
    }
    function c(f) {
        if (typeof x.addEventListener != t) x.addEventListener("load", f, false);
        else if (typeof p.addEventListener != t) p.addEventListener("load", f, false);
        else if (typeof x.attachEvent != t) fa(x, "onload", f);
        else if (typeof x.onload == "function") {
            var h = x.onload;
            x.onload = function() {
                h();
                f()
            }
        } else x.onload = f
    }
    function d() {
        var f = p.getElementsByTagName("body")[0],
        h = p.createElement(B);
        h.setAttribute("type", N);
        var l = f.appendChild(h);
        if (l) {
            var m = 0; (function() {
                if (typeof l.GetVariable != t) {
                    var n = l.GetVariable("$version");
                    if (n) {
                        n = n.split(" ")[1].split(",");
                        o.pv = [parseInt(n[0], 10), parseInt(n[1], 10), parseInt(n[2], 10)]
                    }
                } else if (m < 10) {
                    m++;
                    setTimeout(arguments.callee, 10);
                    return
                }
                f.removeChild(h);
                l = null;
                e()
            })()
        } else e()
    }
    function e() {
        var f = E.length;
        if (f > 0) for (var h = 0; h < f; h++) {
            var l = E[h].id,
            m = E[h].callbackFn,
            n = {
                success: false,
                id: l
            };
            if (o.pv[0] > 0) {
                var q = z(l);
                if (q) if (O(E[h].swfVersion) && !(o.wk && o.wk < 312)) {
                    I(l, true);
                    if (m) {
                        n.success = true;
                        n.ref = g(l);
                        m(n)
                    }
                } else if (E[h].expressInstall && i()) {
                    n = {};
                    n.data = E[h].expressInstall;
                    n.width = q.getAttribute("width") || "0";
                    n.height = q.getAttribute("height") || "0";
                    if (q.getAttribute("class")) n.styleclass = q.getAttribute("class");
                    if (q.getAttribute("align")) n.align = q.getAttribute("align");
                    var r = {};
                    q = q.getElementsByTagName("param");
                    for (var u = q.length, v = 0; v < u; v++) if (q[v].getAttribute("name").toLowerCase() != "movie") r[q[v].getAttribute("name")] = q[v].getAttribute("value");
                    s(n, r, l, m)
                } else {
                    w(q);
                    m && m(n)
                }
            } else {
                I(l, true);
                if (m) {
                    if ((l = g(l)) && typeof l.SetVariable != t) {
                        n.success = true;
                        n.ref = l
                    }
                    m(n)
                }
            }
        }
    }
    function g(f) {
        var h = null;
        if ((f = z(f)) && f.nodeName == "OBJECT") if (typeof f.SetVariable != t) h = f;
        else if (f = f.getElementsByTagName(B)[0]) h = f;
        return h
    }
    function i() {
        return ! P && O("6.0.65") && (o.win || o.mac) && !(o.wk && o.wk < 312)
    }
    function s(f, h, l, m) {
        P = true;
        V = m || null;
        X = {
            success: false,
            id: l
        };
        var n = z(l);
        if (n) {
            if (n.nodeName == "OBJECT") {
                K = A(n);
                Q = null
            } else {
                K = n;
                Q = l
            }
            f.id = Y;
            if (typeof f.width == t || !/%$/.test(f.width) && parseInt(f.width, 10) < 310) f.width = "310";
            if (typeof f.height == t || !/%$/.test(f.height) && parseInt(f.height, 10) < 137) f.height = "137";
            p.title = p.title.slice(0, 47) + " - Flash Player Installation";
            m = o.ie && o.win ? "ActiveX": "PlugIn";
            m = "MMredirectURL=" + x.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + m + "&MMdoctitle=" + p.title;
            if (typeof h.flashvars != t) h.flashvars += "&" + m;
            else h.flashvars = m;
            if (o.ie && o.win && n.readyState != 4) {
                m = p.createElement("div");
                l += "SWFObjectNew";
                m.setAttribute("id", l);
                n.parentNode.insertBefore(m, n);
                n.style.display = "none"; (function() {
                    n.readyState == 4 ? n.parentNode.removeChild(n) : setTimeout(arguments.callee, 10)
                })()
            }
            y(f, h, l)
        }
    }
    function w(f) {
        if (o.ie && o.win && f.readyState != 4) {
            var h = p.createElement("div");
            f.parentNode.insertBefore(h, f);
            h.parentNode.replaceChild(A(f), h);
            f.style.display = "none"; (function() {
                f.readyState == 4 ? f.parentNode.removeChild(f) : setTimeout(arguments.callee, 10)
            })()
        } else f.parentNode.replaceChild(A(f), f)
    }
    function A(f) {
        var h = p.createElement("div");
        if (o.win && o.ie) h.innerHTML = f.innerHTML;
        else if (f = f.getElementsByTagName(B)[0]) if (f = f.childNodes) for (var l = f.length, m = 0; m < l; m++) ! (f[m].nodeType == 1 && f[m].nodeName == "PARAM") && f[m].nodeType != 8 && h.appendChild(f[m].cloneNode(true));
        return h
    }
    function y(f, h, l) {
        var m,
        n = z(l);
        if (o.wk && o.wk < 312) return m;
        if (n) {
            if (typeof f.id == t) f.id = l;
            if (o.ie && o.win) {
                var q = "",
                r;
                for (r in f) if (f[r] != Object.prototype[r]) if (r.toLowerCase() == "data") h.movie = f[r];
                else if (r.toLowerCase() == "styleclass") q += ' class="' + f[r] + '"';
                else if (r.toLowerCase() != "classid") q += " " + r + '="' + f[r] + '"';
                r = "";
                for (var u in h) if (h[u] != Object.prototype[u]) r += '<param name="' + u + '" value="' + h[u] + '" />';
                n.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + q + ">" + r + "</object>";
                R[R.length] = f.id;
                m = z(f.id)
            } else {
                u = p.createElement(B);
                u.setAttribute("type", N);
                for (q in f) if (f[q] != Object.prototype[q]) if (q.toLowerCase() == "styleclass") u.setAttribute("class", f[q]);
                else q.toLowerCase() != "classid" && u.setAttribute(q, f[q]);
                for (var v in h) if (h[v] != Object.prototype[v]) if (v.toLowerCase() != "movie") {
                    f = u;
                    l = v;
                    m = h[v];
                    q = p.createElement("param");
                    q.setAttribute("name", l);
                    q.setAttribute("value", m);
                    f.appendChild(q)
                }
                n.parentNode.replaceChild(u, n);
                m = u
            }
        }
        return m
    }
    function Z(f) {
        var h = z(f);
        if (h && h.nodeName == "OBJECT") if (o.ie && o.win) {
            h.style.display = "none"; (function() {
                if (h.readyState == 4) {
                    var l = f;
                    if (l = z(l)) {
                        for (var m in l) if (typeof l[m] == "function") l[m] = null;
                        l.parentNode.removeChild(l)
                    }
                } else setTimeout(arguments.callee, 10)
            })()
        } else h.parentNode.removeChild(h)
    }
    function z(f) {
        var h = null;
        try {
            h = p.getElementById(f)
        } catch(l) {}
        return h
    }
    function fa(f, h, l) {
        f.attachEvent(h, l);
        J[J.length] = [f, h, l]
    }
    function O(f) {
        var h = o.pv;
        f = f.split(".");
        f[0] = parseInt(f[0], 10);
        f[1] = parseInt(f[1], 10) || 0;
        f[2] = parseInt(f[2], 10) || 0;
        return h[0] > f[0] || h[0] == f[0] && h[1] > f[1] || h[0] == f[0] && h[1] == f[1] && h[2] >= f[2] ? true: false
    }
    function ba(f, h, l, m) {
        if (! (o.ie && o.mac)) {
            var n = p.getElementsByTagName("head")[0];
            if (n) {
                l = l && typeof l == "string" ? l: "screen";
                if (m) W = C = null;
                if (!C || W != l) {
                    m = p.createElement("style");
                    m.setAttribute("type", "text/css");
                    m.setAttribute("media", l);
                    C = n.appendChild(m);
                    if (o.ie && o.win && typeof p.styleSheets != t && p.styleSheets.length > 0) C = p.styleSheets[p.styleSheets.length - 1];
                    W = l
                }
                if (o.ie && o.win) C && typeof C.addRule == B && C.addRule(f, h);
                else C && typeof p.createTextNode != t && C.appendChild(p.createTextNode(f + " {" + h + "}"))
            }
        }
    }
    function I(f, h) {
        if (ca) {
            h = h ? "visible": "hidden";
            if (H && z(f)) z(f).style.visibility = h;
            else ba("#" + f, "visibility:" + h)
        }
    }
    function da(f) {
        return /[\\\"<>\.;]/.exec(f) != null && typeof encodeURIComponent != t ? encodeURIComponent(f) : f
    }
    var t = "undefined",
    B = "object",
    N = "application/x-shockwave-flash",
    Y = "SWFObjectExprInst",
    x = window,
    p = document,
    F = navigator,
    ea = false,
    M = [function() {
        ea ? d() : e()
    }],
    E = [],
    R = [],
    J = [],
    K,
    Q,
    V,
    X,
    H = false,
    P = false,
    C,
    W,
    ca = true,
    o = function() {
        var f = typeof p.getElementById != t && typeof p.getElementsByTagName != t && typeof p.createElement != t,
        h = F.userAgent.toLowerCase(),
        l = F.platform.toLowerCase(),
        m = l ? /win/.test(l) : /win/.test(h);
        l = l ? /mac/.test(l) : /mac/.test(h);
        h = /webkit/.test(h) ? parseFloat(h.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false;
        var n = !+"\u000b1",
        q = [0, 0, 0],
        r = null;
        if (typeof F.plugins != t && typeof F.plugins["Shockwave Flash"] == B) {
            if ((r = F.plugins["Shockwave Flash"].description) && !(typeof F.mimeTypes != t && F.mimeTypes[N] && !F.mimeTypes[N].enabledPlugin)) {
                ea = true;
                n = false;
                r = r.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
                q[0] = parseInt(r.replace(/^(.*)\..*$/, "$1"), 10);
                q[1] = parseInt(r.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
                q[2] = /[a-zA-Z]/.test(r) ? parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0
            }
        } else if (typeof x.ActiveXObject != t) try {
            var u = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
            if (u) if (r = u.GetVariable("$version")) {
                n = true;
                r = r.split(" ")[1].split(",");
                q = [parseInt(r[0], 10), parseInt(r[1], 10), parseInt(r[2], 10)]
            }
        } catch(v) {}
        return {
            w3: f,
            pv: q,
            wk: h,
            ie: n,
            win: m,
            mac: l
        }
    } (); (function() {
        if (o.w3) {
            if (typeof p.readyState != t && p.readyState == "complete" || typeof p.readyState == t && (p.getElementsByTagName("body")[0] || p.body)) a();
            if (!H) {
                typeof p.addEventListener != t && p.addEventListener("DOMContentLoaded", a, false);
                if (o.ie && o.win) {
                    p.attachEvent("onreadystatechange",
                    function() {
                        if (p.readyState == "complete") {
                            p.detachEvent("onreadystatechange", arguments.callee);
                            a()
                        }
                    });
                    x == top &&
                    function() {
                        if (!H) {
                            try {
                                p.documentElement.doScroll("left")
                            } catch(f) {
                                setTimeout(arguments.callee, 0);
                                return
                            }
                            a()
                        }
                    } ()
                }
                o.wk &&
                function() {
                    H || (/loaded|complete/.test(p.readyState) ? a() : setTimeout(arguments.callee, 0))
                } ();
                c(a)
            }
        }
    })(); (function() {
        o.ie && o.win && window.attachEvent("onunload",
        function() {
            for (var f = J.length, h = 0; h < f; h++) J[h][0].detachEvent(J[h][1], J[h][2]);
            f = R.length;
            for (h = 0; h < f; h++) Z(R[h]);
            for (var l in o) o[l] = null;
            o = null;
            for (var m in swfobject) swfobject[m] = null;
            swfobject = null
        })
    })();
    return {
        registerObject: function(f, h, l, m) {
            if (o.w3 && f && h) {
                var n = {};
                n.id = f;
                n.swfVersion = h;
                n.expressInstall = l;
                n.callbackFn = m;
                E[E.length] = n;
                I(f, false)
            } else m && m({
                success: false,
                id: f
            })
        },
        getObjectById: function(f) {
            if (o.w3) return g(f)
        },
        embedSWF: function(f, h, l, m, n, q, r, u, v, L) {
            var S = {
                success: false,
                id: h
            };
            if (o.w3 && !(o.wk && o.wk < 312) && f && h && l && m && n) {
                I(h, false);
                b(function() {
                    l += "";
                    m += "";
                    var G = {};
                    if (v && typeof v === B) for (var D in v) G[D] = v[D];
                    G.data = f;
                    G.width = l;
                    G.height = m;
                    D = {};
                    if (u && typeof u === B) for (var T in u) D[T] = u[T];
                    if (r && typeof r === B) for (var U in r) if (typeof D.flashvars != t) D.flashvars += "&" + U + "=" + r[U];
                    else D.flashvars = U + "=" + r[U];
                    if (O(n)) {
                        T = y(G, D, h);
                        G.id == h && I(h, true);
                        S.success = true;
                        S.ref = T
                    } else if (q && i()) {
                        G.data = q;
                        s(G, D, h, L);
                        return
                    } else I(h, true);
                    L && L(S)
                })
            } else L && L(S)
        },
        switchOffAutoHideShow: function() {
            ca = false
        },
        ua: o,
        getFlashPlayerVersion: function() {
            return {
                major: o.pv[0],
                minor: o.pv[1],
                release: o.pv[2]
            }
        },
        hasFlashPlayerVersion: O,
        createSWF: function(f, h, l) {
            if (o.w3) return y(f, h, l)
        },
        showExpressInstall: function(f, h, l, m) {
            o.w3 && i() && s(f, h, l, m)
        },
        removeSWF: function(f) {
            o.w3 && Z(f)
        },
        createCSS: function(f, h, l, m) {
            o.w3 && ba(f, h, l, m)
        },
        addDomLoadEvent: b,
        addLoadEvent: c,
        getQueryParamValue: function(f) {
            var h = p.location.search || p.location.hash;
            if (h) {
                if (/\?/.test(h)) h = h.split("?")[1];
                if (f == null) return da(h);
                h = h.split("&");
                for (var l = 0; l < h.length; l++) if (h[l].substring(0, h[l].indexOf("=")) == f) return da(h[l].substring(h[l].indexOf("=") + 1))
            }
            return ""
        },
        expressInstallCallback: function() {
            if (P) {
                var f = z(Y);
                if (f && K) {
                    f.parentNode.replaceChild(K, f);
                    if (Q) {
                        I(Q, true);
                        if (o.ie && o.win) K.style.display = "block"
                    }
                    V && V(X)
                }
                P = false
            }
        }
    }
} (),
Validator = Class.create();
Validator.prototype = {
    initialize: function(a, b, c, d) {
        if (typeof c == "function") {
            this.options = $H(d);
            this._test = c
        } else {
            this.options = $H(c);
            this._test = function() {
                return true
            }
        }
        this.error = b || "Validation failed.";
        this.className = a
    },
    test: function(a, b) {
        return this._test(a, b) && this.options.all(function(c) {
            return Validator.methods[c.key] ? Validator.methods[c.key](a, b, c.value) : true
        })
    }
};
Validator.methods = {
    pattern: function(a, b, c) {
        return Validation.get("IsEmpty").test(a) || c.test(a)
    },
    minLength: function(a, b, c) {
        return a.length >= c
    },
    maxLength: function(a, b, c) {
        return a.length <= c
    },
    min: function(a, b, c) {
        return a >= parseFloat(c)
    },
    max: function(a, b, c) {
        return a <= parseFloat(c)
    },
    notOneOf: function(a, b, c) {
        return $A(c).all(function(d) {
            return a != d
        })
    },
    oneOf: function(a, b, c) {
        return $A(c).any(function(d) {
            return a == d
        })
    },
    is: function(a, b, c) {
        return a == c
    },
    isNot: function(a, b, c) {
        return a != c
    },
    equalToField: function(a, b, c) {
        return a == $F(c)
    },
    notEqualToField: function(a, b, c) {
        return a != $F(c)
    },
    include: function(a, b, c) {
        return $A(c).all(function(d) {
            return Validation.get(d).test(a, b)
        })
    }
};
var Validation = Class.create();
Validation.prototype = {
    initialize: function(a, b) {
        this.options = Object.extend({
            onSubmit: true,
            stopOnFirst: false,
            immediate: false,
            focusOnError: true,
            useTitles: false,
            onFormValidate: function() {},
            onElementValidate: function() {}
        },
        b || {});
        this.form = $(a);
        this.options.onSubmit && Event.observe(this.form, "submit", this.onSubmit.bind(this), false);
        if (this.options.immediate) {
            var c = this.options.useTitles,
            d = this.options.onElementValidate;
            Form.getElements(this.form).each(function(e) {
                Event.observe(e, "blur",
                function(g) {
                    Validation.validate(Event.element(g), {
                        useTitle: c,
                        onElementValidate: d
                    })
                })
            })
        }
    },
    onSubmit: function(a) {
        this.validate() || Event.stop(a)
    },
    validate: function() {
        var a = false,
        b = this.options.useTitles,
        c = this.options.onElementValidate;
        a = this.options.stopOnFirst ? Form.getElements(this.form).all(function(d) {
            return Validation.validate(d, {
                useTitle: b,
                onElementValidate: c
            })
        }) : Form.getElements(this.form).collect(function(d) {
            return Validation.validate(d, {
                useTitle: b,
                onElementValidate: c
            })
        }).all(); ! a && this.options.focusOnError && Form.getElements(this.form).findAll(function(d) {
            return $(d).hasClassName("validation-failed")
        }).first().focus();
        this.options.onFormValidate(a, this.form);
        return a
    },
    reset: function() {
        Form.getElements(this.form).each(Validation.reset)
    }
};
Object.extend(Validation, {
    validate: function(a, b) {
        b = Object.extend({
            useTitle: false,
            onElementValidate: function() {}
        },
        b || {});
        a = $(a);
        return result = a.classNames().all(function(c) {
            c = Validation.test(c, a, b.useTitle);
            b.onElementValidate(c, a);
            return c
        })
    },
    test: function(a, b, c) {
        var d = Validation.get(a),
        e = "__advice" + a.camelize();
        try {
            if (Validation.isVisible(b) && !d.test($F(b), b)) {
                if (!b[e]) {
                    var g = Validation.getAdvice(a, b);
                    if (g == null) {
                        var i = c ? b && b.title ? b.title: d.error: d.error;
                        g = '<small id="advice-' + a + "-" + Validation.getElmID(b) + '" style="display:none">' + i + "</small>";
                        switch (b.type.toLowerCase()) {
                        case "checkbox":
                        case "radio":
                            var s = b.parentNode;
                            if (s) new Insertion.Bottom(s, g);
                            else new Insertion.After(b, g);
                            break;
                        default:
                            new Insertion.After(b, g)
                        }
                        g = Validation.getAdvice(a, b)
                    }
                    if (typeof Effect == "undefined") g.style.display = "block";
                    else new Effect.Appear(g, {
                        duration: 1
                    })
                }
                b[e] = true;
                b.removeClassName("validation-passed");
                b.addClassName("validation-failed");
                return false
            } else {
                g = Validation.getAdvice(a, b);
                g != null && g.hide();
                b[e] = "";
                b.removeClassName("validation-failed");
                b.addClassName("validation-passed");
                return true
            }
        } catch(w) {
            throw w;
        }
    },
    isVisible: function(a) {
        for (; a.tagName != "BODY";) {
            if (!$(a).visible()) return false;
            a = a.parentNode
        }
        return true
    },
    getAdvice: function(a, b) {
        return $("advice-" + a + "-" + Validation.getElmID(b)) || $("advice-" + Validation.getElmID(b))
    },
    getElmID: function(a) {
        return a.id ? a.id: a.name
    },
    reset: function(a) {
        a = $(a);
        a.classNames().each(function(b) {
            var c = "__advice" + b.camelize();
            if (a[c]) {
                Validation.getAdvice(b, a).hide();
                a[c] = ""
            }
            a.removeClassName("validation-failed");
            a.removeClassName("validation-passed")
        })
    },
    add: function(a, b, c, d) {
        var e = {};
        e[a] = new Validator(a, b, c, d);
        Object.extend(Validation.methods, e)
    },
    addAllThese: function(a) {
        var b = {};
        $A(a).each(function(c) {
            b[c[0]] = new Validator(c[0], c[1], c[2], c.length > 3 ? c[3] : {})
        });
        Object.extend(Validation.methods, b)
    },
    get: function(a) {
        return Validation.methods[a] ? Validation.methods[a] : Validation.methods._LikeNoIDIEverSaw_
    },
    methods: {
        _LikeNoIDIEverSaw_: new Validator("_LikeNoIDIEverSaw_", "", {})
    }
});
Validation.add("IsEmpty", "",
function(a) {
    return a == null || a.length == 0
});
Validation.addAllThese([["required", "This is a required field.",
function(a) {
    return ! Validation.get("IsEmpty").test(a)
}], ["validate-number", "Please enter a valid number in this field.",
function(a) {
    return Validation.get("IsEmpty").test(a) || !isNaN(a) && !/^\s+$/.test(a)
}], ["validate-digits", "Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.",
function(a) {
    return Validation.get("IsEmpty").test(a) || !/[^\d]/.test(a)
}], ["validate-alpha", "Please use letters only (a-z) in this field.",
function(a) {
    return Validation.get("IsEmpty").test(a) || /^[a-zA-Z\- ]+$/.test(a)
}], ["validate-alphanum", "Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.",
function(a) {
    return Validation.get("IsEmpty").test(a) || !/\W/.test(a)
}], ["validate-date", "Please enter a valid date.",
function(a) {
    var b = new Date(a);
    return Validation.get("IsEmpty").test(a) || !isNaN(b)
}], ["validate-email", "Please enter a valid email address. For example fred@domain.com .",
function(a) {
    return Validation.get("IsEmpty").test(a) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(a)
}], ["validate-url", "Please enter a valid URL.",
function(a) {
    return Validation.get("IsEmpty").test(a) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(a)
}], ["validate-date-au", "Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.",
function(a) {
    if (Validation.get("IsEmpty").test(a)) return true;
    var b = /^(\d{2})\/(\d{2})\/(\d{4})$/;
    if (!b.test(a)) return false;
    a = new Date(a.replace(b, "$2/$1/$3"));
    return parseInt(RegExp.$2, 10) == 1 + a.getMonth() && parseInt(RegExp.$1, 10) == a.getDate() && parseInt(RegExp.$3, 10) == a.getFullYear()
}], ["validate-date-eu", "Please use this date format: dd-mm-yyyy. For example 22-07-1973 for the 22nd of July, 1973.",
function(a) {
    if (Validation.get("IsEmpty").test(a)) return true;
    var b = /^(\d{2})\-(\d{2})\-(\d{4})$/;
    if (!b.test(a)) return false;
    a = new Date(a.replace(b, "$3, $2, $1"));
    return parseInt(RegExp.$2, 10) == 1 + a.getMonth() && parseInt(RegExp.$1, 10) == a.getDate() && parseInt(RegExp.$3, 10) == a.getFullYear()
}], ["validate-currency-dollar", "Please enter a valid $ amount. For example $100.00 .",
function(a) {
    return Validation.get("IsEmpty").test(a) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(a)
}], ["validate-selection", "Please make a selection",
function(a, b) {
    return b.options ? b.selectedIndex > 0: !Validation.get("IsEmpty").test(a)
}], ["validate-one-required", "Please select one of the above options.",
function(a, b) {
    var c = b.parentNode.getElementsByTagName("INPUT");
    return $A(c).any(function(d) {
        return $F(d)
    })
}]]);
Validation.addAllThese([["validate-password", "Your password must be more than 6 characters and not be 'password'", {
    minLength: 7,
    notOneOf: ["password", "PASSWORD"]
}], ["validate-password-confirm", "Your confirmation password does not match your first password, please try again.", {
    equalToField: "password"
}], ['validate-screen-name', 'Your screen name must between 3 and 12 characters.', {
    minLength: 3,
    maxLength: 12
}]]);
var europeandate = true,
alternate_row_colors = false;
addEvent(window, "load", sortables_init);
var SORT_COLUMN_INDEX,
thead = false;
function sortables_init() {
    if (document.getElementsByTagName) {
        tbls = document.getElementsByTagName("table");
        for (ti = 0; ti < tbls.length; ti++) {
            thisTbl = tbls[ti]; (" " + thisTbl.className + " ").indexOf("sortable") != -1 && thisTbl.id && ts_makeSortable(thisTbl)
        }
    }
}
function ts_makeSortable(a) {
    if (a.rows && a.rows.length > 0) if (a.tHead && a.tHead.rows.length > 0) {
        var b = a.tHead.rows[a.tHead.rows.length - 1];
        thead = true
    } else b = a.rows[0];
    if (b) {
        for (var c = 0; c < b.cells.length; c++) {
            var d = b.cells[c],
            e = d.innerHTML,
            g = e.indexOf("<img ") != -1 ? " no_margin": "";
            if (d.className != "unsortable" && d.className.indexOf("unsortable") == -1) {
                d.innerHTML = '<a href="#" class="image_none' + g + '" onclick="ts_resortTable(this, ' + c + ');return false;">' + e + "</a>";
                if (e.indexOf("<img ") != -1) {
                    e = d.getAttribute("class", "hide_cell") ? "no_margin hide_cell": "no_margin";
                    d.setAttribute("class", e)
                }
            }
        }
        alternate_row_colors && alternate(a)
    }
}
function ts_getInnerText(a) {
    if (typeof a == "string") return a;
    if (typeof a == "undefined") return a;
    if (a.innerText) return a.innerText;
    var b = "";
    a = a.childNodes;
    for (var c = a.length, d = 0; d < c; d++) switch (a[d].nodeType) {
    case 1:
        b += ts_getInnerText(a[d]);
        break;
    case 3:
        b += a[d].nodeValue
    }
    return b
}
function ts_resortTable(a, b) {
    var c = a.parentNode,
    d = b || c.cellIndex;
    c = getParent(c, "TABLE");
    if (! (c.rows.length <= 1)) {
        for (var e = "", g = 0; e == "" && g < c.tBodies[0].rows.length;) {
            e = ts_getInnerText(c.tBodies[0].rows[g].cells[d]);
            e = trim(e);
            if (e.substr(0, 4) == "<!--" || e.length == 0) e = "";
            g++
        }
        if (e != "") {
            sortfn = ts_sort_caseinsensitive;
            if (e.match(/^\d\d[\/\.-][a-zA-z][a-zA-Z][a-zA-Z][\/\.-]\d\d\d\d$/)) sortfn = ts_sort_date;
            if (e.match(/^\d\d[\/\.-]\d\d[\/\.-]\d\d\d{2}?$/)) sortfn = ts_sort_date;
            if (e.match(/^-?[\ufffd$\ufffd\ufffd]\d/)) sortfn = ts_sort_numeric;
            if (e.match(/^-?(\d+[,\.]?)+(E[-+][\d]+)?%?$/)) sortfn = ts_sort_numeric;
            SORT_COLUMN_INDEX = d;
            e = [];
            for (k = 0; k < c.tBodies.length; k++) for (g = 0; g < c.tBodies[k].rows[0].length; g++);
            for (k = 0; k < c.tBodies.length; k++) if (thead) for (j = 0; j < c.tBodies[k].rows.length; j++) e[j] = c.tBodies[k].rows[j];
            else for (j = 1; j < c.tBodies[k].rows.length; j++) e[j - 1] = c.tBodies[k].rows[j];
            e.sort(sortfn);
            if (a.getAttribute("class") == "image_down") {
                e.reverse();
                d = "image_up"
            } else d = "image_down";
            for (g = 0; g < e.length; g++) if (!e[g].className || e[g].className && e[g].className.indexOf("sortbottom") == -1) c.tBodies[0].appendChild(e[g]);
            for (g = 0; g < e.length; g++) e[g].className && e[g].className.indexOf("sortbottom") != -1 && c.tBodies[0].appendChild(e[g]);
            g = document.getElementsByTagName("th");
            for (e = 0; e < g.length; e++) g[e].childNodes[0].className && g[e].childNodes[0].className.indexOf("image_") != -1 && getParent(g[e], "table") == getParent(a, "table") && g[e].childNodes[0].setAttribute("class", "image_none");
            a.setAttribute("class", d);
            alternate(c)
        }
    }
}
function getParent(a, b) {
    return a == null ? null: a.nodeType == 1 && a.tagName.toLowerCase() == b.toLowerCase() ? a: getParent(a.parentNode, b)
}
function sort_date(a) {
    dt = "00000000";
    if (a.length == 11) {
        mtstr = a.substr(3, 3);
        mtstr = mtstr.toLowerCase();
        switch (mtstr) {
        case "jan":
            var b = "01";
            break;
        case "feb":
            b = "02";
            break;
        case "mar":
            b = "03";
            break;
        case "apr":
            b = "04";
            break;
        case "may":
            b = "05";
            break;
        case "jun":
            b = "06";
            break;
        case "jul":
            b = "07";
            break;
        case "aug":
            b = "08";
            break;
        case "sep":
            b = "09";
            break;
        case "oct":
            b = "10";
            break;
        case "nov":
            b = "11";
            break;
        case "dec":
            b = "12"
        }
        return dt = a.substr(7, 4) + b + a.substr(0, 2)
    } else if (a.length == 10) return dt = europeandate == false ? a.substr(6, 4) + a.substr(0, 2) + a.substr(3, 2) : a.substr(6, 4) + a.substr(3, 2) + a.substr(0, 2);
    else if (a.length == 8) {
        yr = a.substr(6, 2);
        yr = parseInt(yr) < 50 ? "20" + yr: "19" + yr;
        return dt = europeandate == true ? yr + a.substr(3, 2) + a.substr(0, 2) : yr + a.substr(0, 2) + a.substr(3, 2)
    }
    return dt
}
function ts_sort_date(a, b) {
    dt1 = sort_date(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
    dt2 = sort_date(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]));
    if (dt1 == dt2) return 0;
    if (dt1 < dt2) return - 1;
    return 1
}
function ts_sort_numeric(a, b) {
    var c = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
    c = clean_num(c);
    var d = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
    d = clean_num(d);
    return compare_numeric(c, d)
}
function compare_numeric(a, b) {
    a = parseFloat(a);
    a = isNaN(a) ? 0: a;
    b = parseFloat(b);
    b = isNaN(b) ? 0: b;
    return a - b
}
function ts_sort_caseinsensitive(a, b) {
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
    if (aa == bb) return 0;
    if (aa < bb) return - 1;
    return 1
}
function ts_sort_default(a, b) {
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
    if (aa == bb) return 0;
    if (aa < bb) return - 1;
    return 1
}
function addEvent(a, b, c, d) {
    if (a.addEventListener) {
        a.addEventListener(b, c, d);
        return true
    } else if (a.attachEvent) return a.attachEvent("on" + b, c);
    else alert("Handler could not be removed")
}
function clean_num(a) {
    return a.replace(RegExp(/[^-?0-9.]/g), "")
}
function trim(a) {
    return a.replace(/^\s+|\s+$/g, "")
}
function alternate(a) {
    a = a.getElementsByTagName("tbody");
    for (var b = 0; b < a.length; b++) for (var c = a[b].getElementsByTagName("tr"), d = 0; d < c.length; d++) if (d % 2 == 0) if (c[d].className.indexOf("even") != -1) c[d].className = c[d].className.replace("even", "odd");
    else {
        if (c[d].className.indexOf("odd") == -1) c[d].className += " odd"
    } else if (c[d].className.indexOf("odd") != -1) c[d].className = c[d].className.replace("odd", "even");
    else if (c[d].className.indexOf("even") == -1) c[d].className += " even"
}
Event.observe(window, "load", init, false);

document.observe('click', function(e, el) {
  if (el = e.findElement('form')) {
	var id    = el.id.sub('frm_signup_', '');
	var valid = new Validation('frm_signup_' + id);
	$('signup_action_' + id).enable();
	Event.observe('frm_signup_' + id, 'submit', function(event){
		var result = valid.validate();
		if(result){
			$('signup_action_' + id).disable();
			set_user_quick_signup(id);
		}
		Event.stop(event);
	});
  }
});

var my_tabs = null,
cycle_id = 0;
function init() {
    if ($("tournament_filter")) {
        $("buy_in_from") && Event.observe("buy_in_from", "change", ajax_tournament_filter, false);
        $("buy_in_to") && Event.observe("buy_in_to", "change", ajax_tournament_filter, false);
        Event.observe("client", "change", ajax_tournament_filter, false);
        Event.observe("game_type", "change", ajax_tournament_filter, false);
        $("default").firstChild.toggleClassName("image_down")
    }
    $("alert") && new Effect.Highlight("alert");
    if ($("tabs")) {
        my_tabs = new Control.Tabs("tabs");
        cycle_id = setInterval("cycleTab(my_tabs)", 5E3);
        Event.observe("tabs", "click",
        function() {
            clearInterval(cycle_id)
        })
    }
    if ($("catfish")) {
        cookiearray = document.cookie.split(/;\s*/);
        for (entry in cookiearray) if (cookiearray[entry] == "PFF_ANNOUNCEMENT_1") {
            var a = true;
            break
        }
        if (!a) {
            new Effect.SlideDown("catfish", {
                delay: 2,
                duration: 2
            });
            Event.observe("catfish_close", "click",
            function() {
                new Effect.SlideUp("catfish", {
                    duration: 2
                })
            });
            Event.observe("catfish_close_no_show", "click",
            function() {
                var b = new Date;
                b.setTime(b.getTime() + 2592E3);
                document.cookie = "PFF_ANNOUNCEMENT_1; expires=" + b.toGMTString() + "; path=/";
                new Effect.SlideUp("catfish", {
                    duration: 2
                })
            })
        }
    }
    $("frm_contact") && new Validation("frm_contact");
    $("frm_login") && new Validation("frm_login");
    $("frm_password") && new Validation("frm_password");
    $("frm_register") && new Validation("frm_register");
    $("frm_screen_name") && new Validation("frm_screen_name");
    $("comment") && new Validation("comment");
    $("testimonial") && new Validation("testimonial")
}
function set_user_quick_signup(id){
	var myTarget = 'frm_container_' + id;
	var myUrl    = '/execute/set_user_quick_signup.php';
	new Ajax.Updater(
		myTarget,
		myUrl, {
			method: 'post',
			parameters: {
				signup_email:      escape($F('signup_email_' + id)),
				signup_screenname: escape($F('signup_screenname_' + id)),
				signup_offer_id:   escape($F('signup_offer_id_' + id))
			},
			onComplete: function() {
				new Effect.Highlight('alert');
			}
		}
	);
}
function cycleTab() {
    my_tabs.activeContainer.id == "tab_4" ? my_tabs.first() : my_tabs.next()
}
function ajax_tournament_filter() {
    $("loader") && Ajax.Responders.register({
        onCreate: function() {
            Element.appear("loader")
        },
        onComplete: function() {
            Ajax.activeRequestCount == 0 && Element.fade("loader")
        }
    });
    var a = $("buy_in_from") ? escape($F("buy_in_from")) : 0,
    b = $("buy_in_to") ? escape($F("buy_in_to")) : 0,
    c = $F("ajax_url");
    a = "buy_in_from=" + a + "&buy_in_to=" + b + "&client_id=" + escape($F("client")) + "&game_type=" + escape($F("game_type"));
    new Ajax.Updater("tournaments", c, {
        method: "get",
        parameters: a
    })
}
function createRequestObject() {
    return navigator.appName == "Microsoft Internet Explorer" ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest
}
function ajax(a, b) {
    var c = createRequestObject();
    c.open("get", b);
    c.onreadystatechange = function() {
        if (c.readyState == 4) a.innerHTML = c.responseText
    };
    c.send(null)
}
function toggleColumn(a, b, c) {
    a = a.checked == "on" ? "show_cell": "hide_cell";
    b = document.getElementById(b).rows;
    for (var d = 0; d < b.length; d++) for (var e = 0; e < b[d].cells.length; e++) if (e == c) {
        b[d].cells[e].id = "tmp_id";
        $("tmp_id").toggleClassName(a);
        b[d].cells[e].id = ""
    }
    toggleCheckboxes()
}
function toggleCheckboxes() {
    for (var a = $("payment_method_filter").elements, b = 0, c = 0; c < a.length; c++) b += a[c].checked == true ? 1: 0;
    for (c = 0; c < a.length; c++) a[c].disabled = a[c].checked == true && b == 3 ? true: a[c].checked == false && b == 5 ? true: false
}
function writeLink(a, b, c, d, e, g) {
    var i = document.createElement("a");
    i.innerHTML = c;
    i.setAttribute("href", b);
    i.setAttribute("onclick", d);
    i.setAttribute("title", e);
    i.setAttribute("onmouseover", g);
    i.setAttribute("onmouseout", "window.status='';return true;");
    i.setAttribute("rel", "nofollow");
    $(a).replace(i)
}
hs.registerOverlay({
    thumbnailId: null,
    overlayId: "controlbar",
    position: "top right",
    hideOnMouseOut: true
});
hs.graphicsDir = "http://images1.pokerkamers.nl/images/highslide/";
hs.outlineType = "rounded-white";
hs.captionEval = "this.thumb.title";
hs.showCredits = false;
window.onload = function() {
    hs.preloadImages(5)
};
var RecaptchaOptions = {
    theme: "white",
    lang: "nl"
};
