/*


   Magic Zoom v3.1.13 DEMO
   Copyright 2009 Magic Toolbox
   You must buy a license to use this tool.
   Go to www.magictoolbox.com/magiczoom/


*/
var magicJS = {
    version: "1.3.1",
    $F: function () {},
    defined: function (a) {
        return (undefined != a)
    },
    exists: function (a) {
        return !! (a)
    },
    j1: function (a) {
        if (!$J.defined(a)) {
            return false
        }
        if ((a instanceof window.Object || a instanceof window.Function) && a.constructor === $J.Class) {
            return "class"
        }
        if (a instanceof window.Array) {
            return "array"
        }
        if (a instanceof window.Function) {
            return "function"
        }
        if (a instanceof window.String) {
            return "string"
        }
        if ($J.v.trident) {
            if ($J.defined(a.cancelBubble)) {
                return "event"
            }
        } else {
            if (a instanceof window.Event || a === window.event) {
                return "event"
            }
        }
        if (a instanceof window.Date) {
            return "date"
        }
        if (a instanceof window.RegExp) {
            return "regexp"
        }
        if (a === window) {
            return "window"
        }
        if (a === document) {
            return "document"
        }
        if (a.length && a.item) {
            return "collection"
        }
        if (a.length && a.callee) {
            return "arguments"
        }
        if ( !! a.nodeType) {
            if (1 == a.nodeType) {
                return "element"
            }
            if (3 == a.nodeType) {
                return "textnode"
            }
        }
        return typeof(a)
    },
    extend: function (c, b) {
        if (!magicJS.defined(c)) {
            return c
        }
        for (var a in (b || {})) {
            c[a] = b[a]
        }
        return c
    },
    implement: function (f, d) {
        if (! (f instanceof window.Array)) {
            f = [f]
        }
        for (var c = 0, a = f.length; c < a; c++) {
            if (!magicJS.defined(f[c])) {
                continue
            }
            for (var b in (d || {})) {
                if (!f[c].prototype[b]) {
                    f[c].prototype[b] = d[b]
                }
            }
        }
        return f[0]
    },
    nativize: function (c, b) {
        if (!magicJS.defined(c)) {
            return c
        }
        for (var a in (b || {})) {
            if (!c[a]) {
                c[a] = b[a]
            }
        }
        return c
    },
    $try: function () {
        for (var b = 0, a = arguments.length; b < a; b++) {
            try {
                return arguments[b]()
            } catch(c) {}
        }
        return null
    },
    $A: function (d) {
        if (!magicJS.defined(d)) {
            return []
        }
        if (d.toArray) {
            return $j(d.toArray())
        }
        if (d.item) {
            var c = d.length || 0,
                b = new Array(length);
            while (c--) {
                b[c] = d[c]
            }
            return $j(b)
        }
        return $j(Array.prototype.slice.call(d))
    },
    now: function () {
        return new Date().getTime()
    },
    detach: function (f) {
        var c;
        switch ($J.j1(f)) {
        case "object":
            c = {};
            for (var d in f) {
                c[d] = $J.detach(f[d])
            }
            break;
        case "array":
            c = [];
            for (var b = 0, a = f.length; b < a; b++) {
                c[b] = $J.detach(f[b])
            }
            break;
        default:
            return f
        }
        return c
    },
    getPageSize: function () {
        var k, g, d, i, j, h;
        var c = (!$J.v.backCompat) ? document.documentElement : document.body;
        var f = document.body;
        k = (window.innerWidth && window.scrollMaxX) ? window.innerWidth + window.scrollMaxX : (f.scrollWidth > f.offsetWidth) ? f.scrollWidth : ($J.v.trident && $J.v.backCompat) ? f.scrollWidth : f.offsetWidth;
        g = (window.innerHeight && window.scrollMaxY) ? window.innerHeight + window.scrollMaxY : (f.scrollHeight > f.offsetHeight) ? f.scrollHeight : f.offsetHeight;
        var b, a;
        b = $J.v.trident ? c.scrollWidth : (document.documentElement.clientWidth || self.innerWidth),
        a = $J.v.trident ? c.clientHeight : (document.documentElement.clientHeight || self.innerHeight);
        j = (self.pageXOffset) ? self.pageXOffset : c.scrollLeft;
        h = (self.pageYOffset) ? self.pageYOffset : c.scrollTop;
        d = (g < a) ? a : g;
        i = (k < b) ? b : k;
        return {
            pageWidth: i,
            pageHeight: d,
            width: $J.v.trident ? c.clientWidth : (document.documentElement.clientWidth || self.innerWidth),
            height: $J.v.trident ? c.clientHeight : ($J.v.opera) ? self.innerHeight : (self.innerHeight || document.documentElement.clientHeight),
            scrollX: j,
            scrollY: h,
            viewWidth: k,
            viewHeight: g
        }
    },
    $: function (b) {
        switch ($J.j1(b)) {
        case "array":
            b = $J.nativize(b, $J.Array);
            b.j14 = b.forEach;
            break;
        case "string":
            var a = document.getElementById(b);
            if ($J.defined(a)) {
                return $J.$(a)
            }
            b = null;
            break;
        case "window":
        case "document":
            b = $J.extend(b, $J.Event.Functions);
            b = $J.extend(b, $J.Doc);
            break;
        case "element":
            b = $J.extend(b, $J.Element);
            b = $J.extend(b, $J.Event.Functions);
            break;
        case "event":
            b = $J.extend(b, $J.Event.Methods);
            break;
        case "function":
        case "array":
        case "date":
        default:
            break
        }
        return b
    },
    $new: function (a, c, b) {
        return $j(document.createElement(a)).setProps(c).p(b)
    }
};
window.$J = magicJS;
window.$j = magicJS.$;
magicJS.Array = {
    indexOf: function (d, f) {
        var a = this.length;
        for (var b = this.length, c = (f < 0) ? Math.max(0, b + f) : f || 0; c < b; c++) {
            if (this[c] === d) {
                return c
            }
        }
        return -1
    },
    contains: function (a, b) {
        return this.indexOf(a, b) != -1
    },
    forEach: function (a, d) {
        for (var c = 0, b = this.length; c < b; c++) {
            if (c in this) {
                a.call(d, this[c], c, this)
            }
        }
    },
    filter: function (a, g) {
        var f = [];
        for (var d = 0, b = this.length; d < b; d++) {
            if (d in this) {
                var c = this[d];
                if (a.call(g, this[d], d, this)) {
                    f.push(c)
                }
            }
        }
        return f
    },
    map: function (a, f) {
        var d = [];
        for (var c = 0, b = this.length; c < b; c++) {
            if (c in this) {
                d[c] = a.call(f, this[c], c, this)
            }
        }
        return d
    }
};
magicJS.implement(String, {
    j19: function () {
        return this.replace(/^\s+|\s+$/g, "")
    },
    trimLeft: function () {
        return this.replace(/^\s+/g, "")
    },
    trimRight: function () {
        return this.replace(/\s+$/g, "")
    },
    j20: function (a) {
        if ("string" != $J.j1(a)) {
            return false
        }
        return (this.toString() === a.toString())
    },
    ij20: function (a) {
        if ("string" != $J.j1(a)) {
            return false
        }
        return (this.toLowerCase().toString() === a.toLowerCase().toString())
    },
    k: function () {
        return this.replace(/-\D/g, function (a) {
            return a.charAt(1).toUpperCase()
        })
    },
    dashize: function () {
        return this.replace(/[A-Z]/g, function (a) {
            return ("-" + a.charAt(0).toLowerCase())
        })
    },
    j22: function (a) {
        return parseInt(this, a || 10)
    },
    toFloat: function () {
        return parseFloat(this)
    },
    j23: function () {
        return !this.replace(/true/i, "").j19()
    },
    has: function (b, a) {
        a = a || "";
        return (a + this + a).indexOf(a + b + a) > -1
    }
});
magicJS.v = {
    features: {
        xpath: !!(document.evaluate),
        air: !!(window.runtime)
    },
    engine: (window.opera) ? "presto" : (window.attachEvent) ? "trident" : (!navigator.taintEnabled) ? "webkit" : (null != document.getBoxObjectFor) ? "gecko" : "unknown",
    version: "",
    platform: (magicJS.defined(window.orientation)) ? "ipod" : (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(),
    backCompat: document.compatMode && "backcompat" == document.compatMode.toLowerCase(),
    getDoc: function () {
        return (document.compatMode && "backcompat" == document.compatMode.toLowerCase()) ? document.body : document.documentElement
    },
    domLoaded: false
};
(function () {
    magicJS.v.version = ("presto" == magicJS.v.engine) ? ((document.getElementsByClassName) ? 950 : 925) : ("trident" == magicJS.v.engine) ? !!(window.XMLHttpRequest && window.postMessage) ? 6 : ((window.XMLHttpRequest) ? 5 : 4) : ("webkit" == magicJS.v.engine) ? ((magicJS.v.features.xpath) ? 420 : 419) : ("gecko" == magicJS.v.engine) ? ((document.getElementsByClassName) ? 19 : 18) : "";
    magicJS.v[magicJS.v.engine] = magicJS.v[magicJS.v.engine + magicJS.v.version] = true
})();
magicJS.Element = {
    j13: function (a) {
        return this.className.has(a, " ")
    },
    j2: function (a) {
        if (!this.j13(a)) {
            this.className += (this.className ? " " : "") + a
        }
        return this
    },
    j3: function (a) {
        this.className = this.className.replace(new RegExp("(^|\\s)" + a + "(?:\\s|$)"), "$1").j19();
        return this
    },
    j4: function (a) {
        return this.j13(a) ? this.j3(a) : this.j2(a)
    },
    j5: function (b) {
        b = (b == "float" && this.currentStyle) ? "styleFloat" : b.k();
        var a = null;
        if (this.currentStyle) {
            a = this.currentStyle[b]
        } else {
            if (document.defaultView && document.defaultView.getComputedStyle) {
                css = document.defaultView.getComputedStyle(this, null);
                a = css ? css.getPropertyValue([b.dashize()]) : null
            } else {
                a = this.style[b]
            }
        }
        if ("opacity" == b) {
            return $J.defined(a) ? parseFloat(a) : 1
        }
        if (/^(border(Top|Bottom|Left|Right)Width)|((padding|margin)(Top|Bottom|Left|Right))$/.test(b)) {
            a = parseInt(a) ? a : "0px"
        }
        return ("auto" == a ? null : a)
    },
    p: function (b) {
        for (var a in b) {
            try {
                if ("opacity" == a) {
                    this.g(b[a]);
                    continue
                }
                if ("float" == a) {
                    this.style[("undefined" === typeof(this.style.styleFloat)) ? "cssFloat" : "styleFloat"] = b[a];
                    continue
                }
                this.style[a.k()] = b[a] + (("number" == $J.j1(b[a]) && !$j(["zIndex", "zoom"]).contains(a.k())) ? "px" : "")
            } catch(c) {}
        }
        return this
    },
    g: function (a) {
        a = parseFloat(a);
        if (a == 0) {
            if ("hidden" != this.style.visibility) {
                this.style.visibility = "hidden"
            }
        } else {
            if (a > 1) {
                a = parseFloat(a / 100)
            }
            if ("visible" != this.style.visibility) {
                this.style.visibility = "visible"
            }
        }
        if (!this.currentStyle || !this.currentStyle.hasLayout) {
            this.style.zoom = 1
        }
        if ($J.v.trident) {
            this.style.filter = (1 == a) ? "" : "alpha(opacity=" + a * 100 + ")"
        }
        this.style.opacity = a;
        return this
    },
    s: function () {
        return this.p({
            display: "none",
            visibility: "hidden"
        })
    },
    j27: function () {
        return this.p({
            display: "block",
            visibility: "visible"
        })
    },
    j7: function () {
        return {
            width: this.offsetWidth,
            height: this.offsetHeight
        }
    },
    j10: function () {
        return {
            top: this.scrollTop,
            left: this.scrollLeft
        }
    },
    j11: function () {
        var a = this,
            b = {
            top: 0,
            left: 0
        };
        do {
            b.left += a.scrollLeft || 0;
            b.top += a.scrollTop || 0;
            a = a.parentNode
        } while (a);
        return b
    },
    j8: function () {
        if ($J.defined(document.documentElement.getBoundingClientRect)) {
            var a = this.getBoundingClientRect(),
                d = $j(document).j10(),
                g = $J.v.getDoc();
            return {
                top: a.top + d.y - g.clientTop,
                left: a.left + d.x - g.clientLeft
            }
        }
        var f = this,
            c = t = 0;
        do {
            c += f.offsetLeft || 0;
            t += f.offsetTop || 0;
            f = f.offsetParent
        } while (f && !(/^(?:body|html)$/i).test(f.tagName));
        return {
            top: t,
            left: c
        }
    },
    j9: function () {
        var b = this.j8();
        var a = this.j7();
        return {
            top: b.top,
            bottom: b.top + a.height,
            left: b.left,
            right: b.left + a.width
        }
    },
    update: function (b) {
        try {
            this.innerHTML = b
        } catch(a) {
            this.innerText = b
        }
        return this
    },
    remove: function () {
        return (this.parentNode) ? this.parentNode.removeChild(this) : this
    }
};
magicJS.Element.j30 = magicJS.Element.j5;
magicJS.Element.j31 = magicJS.Element.p;
magicJS.Doc = {
    j7: function () {
        if ($J.v.presto || $J.v.webkit) {
            return {
                width: self.innerWidth,
                height: self.innerHeight
            }
        }
        return {
            width: $J.v.getDoc().clientWidth,
            height: $J.v.getDoc().clientHeight
        }
    },
    j10: function () {
        return {
            x: self.pageXOffset || $J.v.getDoc().scrollLeft,
            y: self.pageYOffset || $J.v.getDoc().scrollTop
        }
    },
    j12: function () {
        var a = this.j7();
        return {
            width: Math.max($J.v.getDoc().scrollWidth, a.width),
            height: Math.max($J.v.getDoc().scrollHeight, a.height)
        }
    }
};
magicJS.Event = {
    Methods: {
        stop: function () {
            if (this.stopPropagation) {
                this.stopPropagation()
            } else {
                this.cancelBubble = true
            }
            if (this.preventDefault) {
                this.preventDefault()
            } else {
                this.returnValue = false
            }
            return this
        },
        j15: function () {
            return {
                x: this.pageX || this.clientX + $J.v.getDoc().scrollLeft,
                y: this.pageY || this.clientY + $J.v.getDoc().scrollTop
            }
        },
        getTarget: function () {
            var a = this.target || this.srcElement;
            while (a && a.nodeType == 3) {
                a = a.parentNode
            }
            return a
        },
        getRelated: function () {
            var a = null;
            switch (this.type) {
            case "mouseover":
                a = this.relatedTarget || this.fromElement;
                break;
            case "mouseout":
                a = this.relatedTarget || this.toElement;
                break;
            default:
                return a
            }
            while (a && a.nodeType == 3) {
                a = a.parentNode
            }
            return a
        }
    },
    Functions: {
        a: function (a, b) {
            if ((this === document || this === window) && "domready" == a) {
                if ($J.v.domLoaded) {
                    b.call(this);
                    return
                }
                $J.onDomReadyList.push(b);
                if ($J.onDomReadyList.length <= 1) {
                    $J.j33DomReady()
                }
            }
            if (this.addEventListener) {
                this.addEventListener(a, b, false)
            } else {
                this.attachEvent("on" + a, b)
            }
        },
        j26: function (a, b) {
            if (this.removeEventListener) {
                this.removeEventListener(a, b, false)
            } else {
                this.detachEvent("on" + a, b)
            }
        },
        raiseEvent: function (d, c) {
            var b = this;
            if (b === document && document.createEvent && !b.dispatchEvent) {
                b = document.documentElement
            }
            var a;
            if (document.createEvent) {
                a = document.createEvent(d);
                a.initEvent(c, true, true)
            } else {
                a = document.createEventObject();
                a.eventType = d
            }
            if (document.createEvent) {
                b.dispatchEvent(a)
            } else {
                b.fireEvent("on" + evName, a)
            }
            return a
        }
    }
};
magicJS.extend(magicJS, {
    onDomReadyList: [],
    onDomReadyTimer: null,
    onDomReady: function () {
        if ($J.v.domLoaded) {
            return
        }
        $J.v.domLoaded = true;
        if ($J.onDomReadyTimer) {
            clearTimeout($J.onDomReadyTimer);
            $J.onDomReadyTimer = null
        }
        for (var b = 0, a = $J.onDomReadyList.length; b < a; b++) {
            $J.onDomReadyList[b].apply(document)
        }
    },
    j33DomReady: function () {
        if ($J.v.webkit) {
            (function () {
                if ($j(["loaded", "complete"]).contains(document.readyState)) {
                    $J.onDomReady();
                    return
                }
                $J.onDomReadyTimer = setTimeout(arguments.callee, 50);
                return
            })()
        }
        if ($J.v.ie && window == top) {
            (function () {
                try {
                    $J.v.getDoc().doScroll("left")
                } catch(a) {
                    $J.onDomReadyTimer = setTimeout(arguments.callee, 50);
                    return
                }
                $J.onDomReady()
            })()
        }
        if ($J.v.presto) {
            $j(document).a("DOMContentLoaded", function () {
                for (var b = 0, a = document.styleSheets.length; b < a; b++) {
                    if (document.styleSheets[b].disabled) {
                        $J.onDomReadyTimer = setTimeout(arguments.callee, 50);
                        return
                    }
                    $J.onDomReady()
                }
            })
        }
        $j(document).a("DOMContentLoaded", $J.onDomReady);
        $j(window).a("load", $J.onDomReady)
    }
});
magicJS.implement(Function, {
    j33: function () {
        var b = $J.$A(arguments),
            a = this,
            c = b.shift();
        return function () {
            return a.apply(c, b.concat($J.$A(arguments)))
        }
    },
    j18: function () {
        var b = $J.$A(arguments),
            a = this,
            c = b.shift();
        return function (d) {
            return a.apply(c, [d || window.event].concat(b))
        }
    },
    j32: function () {
        var b = $J.$A(arguments),
            a = this,
            c = b.shift();
        return window.setTimeout(function () {
            return a.apply(a, b)
        },
        c || 0)
    },
    interval: function () {
        var b = $J.$A(arguments),
            a = this,
            c = b.shift();
        return window.setInterval(function () {
            return a.apply(a, b)
        },
        c || 0)
    }
});
$J.Class = function () {
    var f = null,
        b = $J.$A(arguments);
    if ("class" == $J.j1(b[0])) {
        f = b.shift()
    }
    var a = function () {
        for (var i in this) {
            this[i] = $J.detach(this[i])
        }
        if (this.constructor.$parent) {
            this.$parent = {};
            var l = this.constructor.$parent;
            for (var j in l) {
                var h = l[j];
                switch ($J.j1(h)) {
                case "function":
                    this.$parent[j] = $J.Class.wrap(this, h);
                    break;
                case "object":
                    this.$parent[j] = $J.detach(h);
                    break;
                case "array":
                    this.$parent[j] = $J.detach(h);
                    break
                }
            }
        }
        var g = (this.init) ? this.init.apply(this, arguments) : this;
        delete this.caller;
        return g
    };
    if (!a.prototype.init) {
        a.prototype.init = $J.$F
    }
    if (f) {
        var d = function () {};
        d.prototype = f.prototype;
        a.prototype = new d;
        a.$parent = {};
        for (var c in f.prototype) {
            a.$parent[c] = f.prototype[c]
        }
    } else {
        a.$parent = null
    }
    a.constructor = $J.Class;
    a.prototype.constructor = a;
    $J.extend(a.prototype, b[0]);
    $J.extend(a, {
        $J_TYPE: "class"
    });
    return a
};
magicJS.Class.wrap = function (a, b) {
    return function () {
        var d = this.caller;
        var c = b.apply(a, arguments);
        return c
    }
};
magicJS.FX = new $J.Class({
    defaults: {
        fps: 50,
        duration: 500,
        transition: function (a) {
            return - (Math.cos(Math.PI * a) - 1) / 2
        },
        onStart: $J.$F,
        onComplete: $J.$F,
        onBeforeRender: $J.$F
    },
    init: function (b, a) {
        this.el = $j(b);
        this.options = $J.extend($J.extend({},
        this.defaults), a);
        this.timer = false
    },
    start: function (a) {
        this.styles = a;
        this.state = 0;
        this.curFrame = 0;
        this.startTime = $J.now();
        this.finishTime = this.startTime + this.options.duration;
        this.timer = this.loop.j33(this).interval(Math.round(1000 / this.options.fps));
        this.options.onStart();
        return this
    },
    stop: function (a) {
        a = $J.defined(a) ? a : false;
        if (this.timer) {
            clearInterval(this.timer);
            this.timer = false
        }
        if (a) {
            this.render(1);
            setTimeout(this.options.onComplete, 10)
        }
        return this
    },
    calc: function (c, b, a) {
        return (b - c) * a + c
    },
    loop: function () {
        var b = $J.now();
        if (b >= this.finishTime) {
            if (this.timer) {
                clearInterval(this.timer);
                this.timer = false
            }
            this.render(1);
            setTimeout(this.options.onComplete, 10);
            return this
        }
        var a = this.options.transition((b - this.startTime) / this.options.duration);
        this.render(a)
    },
    render: function (a) {
        var c = {};
        for (var b in this.styles) {
            if ("opacity" === b) {
                c[b] = Math.round(this.calc(this.styles[b][0], this.styles[b][1], a) * 100) / 100
            } else {
                c[b] = Math.round(this.calc(this.styles[b][0], this.styles[b][1], a))
            }
        }
        this.options.onBeforeRender(c);
        this.el.p(c)
    }
});
magicJS.FX.Transition = {
    linear: function (a) {
        return a
    },
    sin: function (a) {
        return - (Math.cos(Math.PI * a) - 1) / 2
    },
    quadIn: function (a) {
        return Math.pow(a, 2)
    },
    quadOut: function (a) {
        return 1 - MagicTools.Transition.quadIn(1 - a)
    },
    cubicIn: function (a) {
        return Math.pow(a, 3)
    },
    cubicOut: function (a) {
        return 1 - MagicTools.Transition.cubicIn(1 - a)
    },
    backIn: function (b, a) {
        a = a || 1.618;
        return Math.pow(b, 2) * ((a + 1) * b - a)
    },
    backOut: function (b, a) {
        return 1 - MagicTools.Transition.backIn(1 - b)
    },
    elastic: function (b, a) {
        a = a || [];
        return Math.pow(2, 10 * --b) * Math.cos(20 * b * Math.PI * (a[0] || 1) / 3)
    },
    none: function (a) {
        return 0
    }
};
$J.PFX = new $J.Class($J.FX, {
    init: function (a, b) {
        this.el_arr = a;
        this.options = $J.extend($J.extend({},
        this.defaults), b);
        this.timer = false
    },
    start: function (a) {
        this.$parent.start([]);
        this.styles_arr = a;
        return this
    },
    render: function (a) {
        for (var b = 0; b < this.el_arr.length; b++) {
            this.el = $j(this.el_arr[b]);
            this.styles = this.styles_arr[b];
            this.$parent.render(a)
        }
    }
});
$J.$Ff = function () {
    return false
};
var MagicZoom = {
    version: "3.1.13",
    options: {},
    defaults: {
        opacity: 50,
        opacityReverse: false,
        smoothingSpeed: 40,
        fps: 25,
        zoomWidth: 300,
        zoomHeight: 300,
        zoomDistance: 15,
        zoomPosition: "right",
        dragMode: false,
        moveOnClick: false,
        alwaysShowZoom: false,
        preservePosition: false,
        x: -1,
        y: -1,
        clickToActivate: false,
        clickToInitialize: false,
        smoothing: true,
        showTitle: "true",
        thumbChange: "click",
        zoomFade: false,
        zoomFadeInSpeed: 400,
        zoomFadeOutSpeed: 200,
        hotspots: "",
        preloadSelectorsSmall: true,
        preloadSelectorsBig: false,
        showLoading: true,
        loadingMsg: "Loading zoom..",
        loadingOpacity: 75,
        loadingPositionX: -1,
        loadingPositionY: -1,
        selectorsMouseoverDelay: 200,
        selectorsEffect: "dissolve",
        selectorsEffectSpeed: 400,
        fitZoomWindow: true,
        entireImage: false
    },
    z40: $j([/^(opacity)(\s+)?:(\s+)?(\d+)$/i, /^(opacity-reverse)(\s+)?:(\s+)?(true|false)$/i, /^(smoothing\-speed)(\s+)?:(\s+)?(\d+)$/i, /^(fps)(\s+)?:(\s+)?(\d+)$/i, /^(zoom\-width)(\s+)?:(\s+)?(\d+)(px)?/i, /^(zoom\-height)(\s+)?:(\s+)?(\d+)(px)?/i, /^(zoom\-distance)(\s+)?:(\s+)?(\d+)(px)?/i, /^(zoom\-position)(\s+)?:(\s+)?(right|left|top|bottom|custom|inner)$/i, /^(drag\-mode)(\s+)?:(\s+)?(true|false)$/i, /^(move\-on\-click)(\s+)?:(\s+)?(true|false)$/i, /^(always\-show\-zoom)(\s+)?:(\s+)?(true|false)$/i, /^(preserve\-position)(\s+)?:(\s+)?(true|false)$/i, /^(x)(\s+)?:(\s+)?([\d.]+)(px)?/i, /^(y)(\s+)?:(\s+)?([\d.]+)(px)?/i, /^(click\-to\-activate)(\s+)?:(\s+)?(true|false)$/i, /^(click\-to\-initialize)(\s+)?:(\s+)?(true|false)$/i, /^(smoothing)(\s+)?:(\s+)?(true|false)$/i, /^(show\-title)(\s+)?:(\s+)?(true|false|top|bottom)$/i, /^(thumb\-change)(\s+)?:(\s+)?(click|mouseover)$/i, /^(zoom\-fade)(\s+)?:(\s+)?(true|false)$/i, /^(zoom\-fade\-in\-speed)(\s+)?:(\s+)?(\d+)$/i, /^(zoom\-fade\-out\-speed)(\s+)?:(\s+)?(\d+)$/i, /^(hotspots)(\s+)?:(\s+)?([a-z0-9_\-:\.]+)$/i, /^(preload\-selectors\-small)(\s+)?:(\s+)?(true|false)$/i, /^(preload\-selectors\-big)(\s+)?:(\s+)?(true|false)$/i, /^(show\-loading)(\s+)?:(\s+)?(true|false)$/i, /^(loading\-msg)(\s+)?:(\s+)?([^;]*)$/i, /^(loading\-opacity)(\s+)?:(\s+)?(\d+)$/i, /^(loading\-position\-x)(\s+)?:(\s+)?(\d+)(px)?/i, /^(loading\-position\-y)(\s+)?:(\s+)?(\d+)(px)?/i, /^(selectors\-mouseover\-delay)(\s+)?:(\s+)?(\d+)$/i, /^(selectors\-effect)(\s+)?:(\s+)?(dissolve|fade|false)$/i, /^(selectors\-effect\-speed)(\s+)?:(\s+)?(\d+)$/i, /^(fit\-zoom\-window)(\s+)?:(\s+)?(true|false)$/i, /^(entire\-image)(\s+)?:(\s+)?(true|false)$/i]),
    zooms: [],
    z1: function (b) {
        for (var a = 0; a < MagicZoom.zooms.length; a++) {
            if (MagicZoom.zooms[a].z28) {
                MagicZoom.zooms[a].j17()
            } else {
                if (MagicZoom.zooms[a].options.clickToInitialize && MagicZoom.zooms[a].initMouseEvent) {
                    MagicZoom.zooms[a].initMouseEvent = b
                }
            }
        }
    },
    stop: function (a) {
        if (a.zoom) {
            a.zoom.stop();
            return true
        }
        return false
    },
    start: function (a) {
        if (!a.zoom) {
            var b = null;
            while (b = a.firstChild) {
                if (b.tagName == "IMG") {
                    break
                }
                a.removeChild(b)
            }
            while (b = a.lastChild) {
                if (b.tagName == "IMG") {
                    break
                }
                a.removeChild(b)
            }
            if (!a.firstChild || a.firstChild.tagName != "IMG") {
                throw "Invalid Magic Zoom"
            }
            MagicZoom.zooms.push(new MagicZoom.zoom(a))
        } else {
            a.zoom.start()
        }
    },
    update: function (d, a, c, b) {
        if (d.zoom) {
            d.zoom.update(a, c, b)
        }
    },
    refresh: function () {
        $J.$A(window.document.getElementsByTagName("A")).j14(function (a) {
            if (/MagicZoom/.test(a.className)) {
                if (MagicZoom.stop(a)) {
                    MagicZoom.start.j32(100, a)
                } else {
                    MagicZoom.start(a)
                }
            }
        },
        this)
    },
    getXY: function (a) {
        if (a.zoom) {
            return {
                x: a.zoom.options.x,
                y: a.zoom.options.y
            }
        }
    },
    x7: function (c) {
        var b, a;
        b = "";
        for (a = 0; a < c.length; a++) {
            b += String.fromCharCode(14 ^ c.charCodeAt(a))
        }
        return b
    }
};
MagicZoom.z50 = function () {
    this.init.apply(this, arguments)
};
MagicZoom.z50.prototype = {
    init: function (a) {
        this.cb = null;
        this.z2 = null;
        this.onErrorHandler = this.onError.j18(this);
        this.z3 = null;
        this.width = 0;
        this.height = 0;
        this.border = {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0
        };
        this.padding = {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0
        };
        this.ready = false;
        if ("string" == $J.j1(a)) {
            this.self = $j(new Image);
            this.z4();
            this.self.src = a
        } else {
            this.self = $j(a);
            this.z4()
        }
    },
    onError: function (a) {
        if (a) {
            $j(a).stop()
        }
        if (this.cb) {
            this.cb.call(this, false)
        }
        this.unload()
    },
    z4: function (a) {
        this.z2 = null;
        if (a == true || !(this.self.src && (this.self.complete || this.self.readyState == "complete"))) {
            this.z2 = function (b) {
                this.ready = true;
                this.z6();
                if (this.cb) {
                    this.cb.call()
                }
            }.j18(this);
            this.self.a("load", this.z2);
            $j(["abort", "error"]).j14(function (b) {
                this.self.a(b, this.onErrorHandler)
            },
            this)
        } else {
            this.ready = true
        }
    },
    update: function (a) {
        this.unload();
        if (this.self.src.has(a)) {
            this.ready = true
        } else {
            this.z4(true);
            this.self.src = a
        }
    },
    z6: function () {
        this.width = this.self.width;
        this.height = this.self.height;
        $j(["Left", "Right", "Top", "Bottom"]).j14(function (a) {
            this.padding[a.toLowerCase()] = this.self.j30("padding" + a).j22();
            this.border[a.toLowerCase()] = this.self.j30("border" + a + "Width").j22()
        },
        this);
        if ($J.v.presto || ($J.v.trident && !$J.v.backCompat)) {
            this.width -= this.padding.left + this.padding.right;
            this.height -= this.padding.top + this.padding.bottom
        }
    },
    getBox: function () {
        var a = null;
        a = this.self.j9();
        return {
            top: a.top + this.border.top,
            bottom: a.bottom - this.border.bottom,
            left: a.left + this.border.left,
            right: a.right - this.border.right
        }
    },
    z5: function () {
        if (this.z3) {
            this.z3.src = this.self.src;
            this.self = null;
            this.self = this.z3
        }
    },
    load: function (a) {
        if (this.ready) {
            if (!this.width) {
                this.z6()
            }
            a.call()
        } else {
            this.cb = a
        }
    },
    unload: function () {
        if (this.z2) {
            this.self.j26("load", this.z2)
        }
        $j(["abort", "error"]).j14(function (a) {
            this.self.j26(a, this.onErrorHandler)
        },
        this);
        this.z2 = null;
        this.cb = null;
        this.width = null;
        this.ready = false
    }
};
MagicZoom.zoom = function () {
    this.construct.apply(this, arguments)
};
MagicZoom.zoom.prototype = {
    construct: function (b, a) {
        this.z25 = -1;
        this.z28 = false;
        this.ddx = 0;
        this.ddy = 0;
        this.options = $J.detach(MagicZoom.defaults);
        if (b) {
            this.c = $j(b)
        }
        this.z37(this.c.rel);
        if (a) {
            this.z37(a)
        }
        this.z48 = null;
        if (b) {
            this.z7 = this.mousedown.j18(this);
            this.z8 = this.mouseup.j18(this);
            this.z9 = this.j27.j33(this, false);
            this.z10 = this.z26.j33(this);
            this.z46Bind = this.z46.j18(this);
            this.c.a("click", function (c) {
                if (!$J.v.trident) {
                    this.blur()
                }
                $j(c).stop();
                return false
            });
            this.c.a("mousedown", this.z7);
            this.c.a("mouseup", this.z8);
            this.c.unselectable = "on";
            this.c.style.MozUserSelect = "none";
            this.c.onselectstart = $J.$Ff;
            this.c.oncontextmenu = $J.$Ff;
            this.c.p({
                position: "relative",
                display: "inline-block",
                textDecoration: "none",
                outline: "0",
                cursor: "hand"
            });
            if (this.c.j5("textAlign") == "center") {
                this.c.p({
                    margin: "auto auto"
                })
            }
            this.c.zoom = this
        } else {
            this.options.clickToInitialize = false
        }
        if (!this.options.clickToInitialize) {
            this.z11()
        }
    },
    z11: function () {
        var b, i, h, c, a;
        a = ["", "#ff0000", 10, "bold", "center", "100%"];
        if (!this.q) {
            this.q = new MagicZoom.z50(this.c.firstChild);
            this.w = new MagicZoom.z50(this.c.href)
        } else {
            this.w.update(this.c.href)
        }
        if (!this.e) {
            this.e = {
                self: $j(document.createElement("DIV")).j2("MagicZoomBigImageCont").p({
                    overflow: "hidden",
                    zIndex: 100,
                    top: "-10000px",
                    position: "absolute",
                    width: this.options.zoomWidth + "px",
                    height: this.options.zoomHeight + "px"
                }),
                zoom: this,
                z17: "0px"
            };
            this.e.s = function () {
                if (this.self.style.top != "-10000px" && !this.zoom.x.z39) {
                    this.z17 = this.self.style.top;
                    this.self.style.top = "-10000px"
                }
            };
            this.e.z18 = this.e.s.j33(this.e);
            if ($J.v.trident) {
                b = $j(document.createElement("IFRAME"));
                b.src = "javascript:''";
                b.p({
                    left: "0px",
                    top: "0px",
                    position: "absolute"
                }).frameBorder = 0;
                this.e.z19 = this.e.self.appendChild(b)
            }
            this.e.z44 = $j(document.createElement("DIV")).j2("MagicZoomHeader").p({
                position: "relative",
                zIndex: 10,
                left: "0px",
                top: "0px",
                padding: "3px"
            }).s();
            i = document.createElement("DIV");
            i.style.overflow = "hidden";
            i.appendChild(this.w.self);
            this.w.self.p({
                padding: "0px",
                margin: "0px",
                border: "0px"
            });
            if (this.options.showTitle == "bottom") {
                this.e.self.appendChild(i);
                this.e.self.appendChild(this.e.z44)
            } else {
                this.e.self.appendChild(this.e.z44);
                this.e.self.appendChild(i)
            }
            if (this.options.zoomPosition == "custom" && $j(this.c.id + "-big")) {
                $j(this.c.id + "-big").appendChild(this.e.self)
            } else {
                this.c.appendChild(this.e.self)
            }
            if ("undefined" !== typeof(a)) {
                this.e.g = $j(document.createElement("div")).p({
                    color: a[1],
                    fontSize: a[2] + "px",
                    fontWeight: a[3],
                    fontFamily: "Tahoma",
                    position: "absolute",
                    width: a[5],
                    textAlign: a[4],
                    left: "0px"
                }).update(MagicZoom.x7(a[0]));
                this.e.self.appendChild(this.e.g)
            }
        }
        if (this.options.showTitle != "false" && this.c.title != "" && this.options.zoomPosition != "inner") {
            c = this.e.z44;
            while (h = c.firstChild) {
                c.removeChild(h)
            }
            this.e.z44.appendChild(document.createTextNode(this.c.title));
            this.e.z44.j27()
        } else {
            this.e.z44.s()
        }
        if (this.c.z51 === undefined) {
            this.c.z51 = this.c.title
        }
        this.c.title = "";
        this.q.load(this.z12.j33(this))
    },
    z12: function (a) {
        if (!a && a !== undefined) {
            return
        }
        if (!this.options.opacityReverse) {
            this.q.self.g(1)
        }
        this.c.p({
            width: this.q.width + "px"
        });
        if (this.options.showLoading) {
            this.z20 = setTimeout(this.z10, 400)
        }
        if (this.options.hotspots != "" && $j(this.options.hotspots)) {
            this.z21()
        }
        if (this.c.id != "") {
            this.z22()
        }
        this.w.load(this.z13.j33(this))
    },
    z13: function (c) {
        var b, a;
        if (!c && c !== undefined) {
            clearTimeout(this.z20);
            if (this.options.showLoading && this.o) {
                this.o.s()
            }
            return
        }
        b = this.e.z44.j7();
        if (this.options.fitZoomWindow || this.options.entireImage) {
            if ((this.w.width < this.options.zoomWidth) || this.options.entireImage) {
                this.options.zoomWidth = this.w.width
            }
            if ((this.w.height < this.options.zoomHeight) || this.options.entireImage) {
                this.options.zoomHeight = this.w.height + b.height
            }
        }
        if (this.options.showTitle == "bottom") {
            this.w.self.parentNode.style.height = (this.options.zoomHeight - b.height) + "px"
        }
        this.e.self.p({
            height: this.options.zoomHeight + "px",
            width: this.options.zoomWidth + "px"
        }).g(1);
        if ($J.v.trident) {
            this.e.z19.p({
                width: this.options.zoomWidth + "px",
                height: this.options.zoomHeight + "px"
            })
        }
        a = this.q.self.j9();
        switch (this.options.zoomPosition) {
        case "custom":
            break;
        case "right":
            this.e.self.style.left = a.right - a.left + this.options.zoomDistance + "px";
            this.e.z17 = "0px";
            break;
        case "left":
            this.e.self.style.left = "-" + (this.options.zoomDistance + this.options.zoomWidth) + "px";
            this.e.z17 = "0px";
            break;
        case "top":
            this.e.self.style.left = "0px";
            this.e.z17 = "-" + (this.options.zoomDistance + this.options.zoomHeight) + "px";
            break;
        case "bottom":
            this.e.self.style.left = "0px";
            this.e.z17 = a.bottom - a.top + this.options.zoomDistance + "px";
            break;
        case "inner":
            this.e.self.p({
                left: "0px",
                height: this.q.height + "px",
                width: this.q.width + "px"
            });
            this.options.zoomWidth = this.q.width;
            this.options.zoomHeight = this.q.height;
            this.e.z17 = "0px";
            break
        }
        this.zoomViewHeight = this.options.zoomHeight - b.height;
        if (this.e.g) {
            this.e.g.p({
                top: this.options.showTitle == "bottom" ? "0px" : ((this.options.zoomHeight - 20) + "px")
            })
        }
        this.w.self.p({
            position: "relative",
            borderWidth: "0px",
            padding: "0px",
            left: "0px",
            top: "0px"
        });
        this.z23();
        if (this.options.alwaysShowZoom) {
            if (this.options.x == -1) {
                this.options.x = this.q.width / 2
            }
            if (this.options.y == -1) {
                this.options.y = this.q.height / 2
            }
            this.j27()
        } else {
            if (this.options.zoomFade) {
                this.r = new $J.FX(this.e.self)
            }
            this.e.self.p({
                top: "-10000px"
            })
        }
        if (this.options.showLoading && this.o) {
            this.o.s()
        }
        this.c.a("mousemove", this.z46Bind);
        this.c.a("mouseout", this.z46Bind);
        if (!this.options.clickToActivate || this.options.clickToInitialize) {
            this.z28 = true
        }
        if (this.options.clickToInitialize && this.initMouseEvent) {
            this.z46(this.initMouseEvent)
        }
        this.z25 = $J.now()
    },
    z26: function () {
        if (this.w.ready) {
            return
        }
        this.o = $j(document.createElement("DIV")).j2("MagicZoomLoading").g(this.options.loadingOpacity / 100).p({
            display: "block",
            overflow: "hidden",
            position: "absolute",
            visibility: "hidden",
            "z-index": 20,
            "max-width": (this.q.width - 4)
        });
        this.o.appendChild(document.createTextNode(this.options.loadingMsg));
        this.c.appendChild(this.o);
        var a = this.o.j7();
        this.o.p({
            left: (this.options.loadingPositionX == -1 ? ((this.q.width - a.width) / 2) : (this.options.loadingPositionX)) + "px",
            top: (this.options.loadingPositionY == -1 ? ((this.q.height - a.height) / 2) : (this.options.loadingPositionY)) + "px"
        });
        this.o.j27()
    },
    z22: function () {
        var d, c, a, f;
        this.selectors = $j([]);
        $J.$A(document.getElementsByTagName("A")).j14(function (b) {
            d = new RegExp("^" + this.c.id + "$");
            c = new RegExp("zoom\\-id(\\s+)?:(\\s+)?" + this.c.id + "($|;)");
            if (d.test(b.rel) || c.test(b.rel)) {
                if (!$j(b).z36) {
                    b.z36 = function (g) {
                        if (!$J.v.trident) {
                            this.blur()
                        }
                        $j(g).stop();
                        return false
                    };
                    b.a("click", b.z36)
                }
                if (!b.z34) {
                    b.z34 = function (h, g) {
                        if (h.type == "mouseout") {
                            if (this.z35) {
                                clearTimeout(this.z35)
                            }
                            this.z35 = false;
                            return
                        }
                        if (g.title != "") {
                            this.c.title = g.title
                        }
                        if (h.type == "mouseover") {
                            this.z35 = setTimeout(this.update.j33(this, g.href, g.rev, g.rel), this.options.selectorsMouseoverDelay)
                        } else {
                            this.update(g.href, g.rev, g.rel)
                        }
                    }.j18(this, b);
                    b.a(this.options.thumbChange, b.z34);
                    if (this.options.thumbChange == "mouseover") {
                        b.a("mouseout", b.z34)
                    }
                }
                b.p({
                    outline: "0"
                });
                if (this.options.preloadSelectorsSmall) {
                    f = new Image();
                    f.src = b.rev
                }
                if (this.options.preloadSelectorsBig) {
                    a = new Image();
                    a.src = b.href
                }
                this.selectors.push(b)
            }
        },
        this)
    },
    stop: function (a) {
        try {
            this.j17();
            this.c.j26("mousemove", this.z46Bind);
            this.c.j26("mouseout", this.z46Bind);
            if (undefined === a) {
                this.x.self.s()
            }
            if (this.r) {
                this.r.stop()
            }
            this.y = null;
            this.z28 = false;
            this.selectors.j14(function (c) {
                if (undefined === a) {
                    c.j26(this.options.thumbChange, c.z34);
                    if (this.options.thumbChange == "mouseover") {
                        c.j26("mouseout", c.z34)
                    }
                    c.z34 = null;
                    c.j26("click", c.z36);
                    c.z36 = null
                }
            },
            this);
            if (this.options.hotspots != "" && $j(this.options.hotspots)) {
                $j(this.options.hotspots).s();
                $j(this.options.hotspots).z30.insertBefore($j(this.options.hotspots), $j(this.options.hotspots).z31);
                if (this.c.z32) {
                    this.c.removeChild(this.c.z32)
                }
            }
            this.w.unload();
            if (this.options.opacityReverse) {
                this.c.j3("MagicZoomPup");
                this.q.self.g(1)
            }
            this.r = null;
            if (this.o) {
                this.c.removeChild(this.o)
            }
            if (undefined === a) {
                this.q.unload();
                this.c.removeChild(this.x.self);
                this.e.self.parentNode.removeChild(this.e.self);
                this.x = null;
                this.e = null;
                this.w = null;
                this.q = null
            }
            if (this.z20) {
                clearTimeout(this.z20);
                this.z20 = null
            }
            this.z48 = null;
            this.c.z32 = null;
            this.o = null;
            if (this.c.title == "") {
                this.c.title = this.c.z51
            }
            this.z25 = -1
        } catch(b) {}
    },
    start: function (a) {
        if (this.z25 != -1) {
            return
        }
        this.construct(false, a)
    },
    update: function (c, d, h) {
        var i, f, j, b, g, a;
        if ($J.now() - this.z25 < 300 || this.z25 == -1 || this.ufx) {
            i = 300 - $J.now() + this.z25;
            if (this.z25 == -1) {
                i = 300
            }
            this.z35 = setTimeout(this.update.j33(this, c, d, h), i);
            return
        }
        f = function (k) {
            if (undefined != c) {
                this.c.href = c
            }
            if (undefined === h) {
                h = ""
            }
            if (this.options.preservePosition) {
                h = "x: " + this.options.x + "; y: " + this.options.y + "; " + h
            }
            if (undefined != d) {
                this.q.update(d);
                if (k !== undefined) {
                    this.q.load(k)
                }
            }
        };
        b = this.q.width;
        g = this.q.height;
        this.stop(true);
        if (this.options.selectorsEffect != "false") {
            this.ufx = true;
            a = new MagicZoom.z50(d);
            a.self.p({
                opacity: 0,
                position: "absolute",
                left: "0px",
                top: "0px"
            });
            this.c.appendChild(a.self);
            j = function () {
                var k, m, l;
                k = {};
                l = {};
                m = {
                    opacity: [0, 1]
                };
                if (b != a.width || g != a.height) {
                    l.width = m.width = k.width = [b, a.width];
                    l.height = m.height = k.height = [g, a.height]
                }
                if (this.options.selectorsEffect == "fade") {
                    k.opacity = [1, 0]
                }
                new $J.PFX([this.c, a.self, this.c.firstChild], {
                    duration: this.options.selectorsEffectSpeed,
                    onComplete: function () {
                        f.call(this, function () {
                            a.unload();
                            this.c.removeChild(a.self);
                            a = null;
                            if (k.opacity) {
                                $j(this.c.firstChild).p({
                                    opacity: 1
                                })
                            }
                            this.ufx = false;
                            this.start(h)
                        }.j33(this))
                    }.j33(this)
                }).start([l, m, k])
            };
            a.load(j.j33(this))
        } else {
            f.call(this, function () {
                this.c.p({
                    width: this.q.width + "px",
                    height: this.q.height + "px"
                });
                this.start(h)
            }.j33(this))
        }
    },
    z37: function (b) {
        var a, f, d, c;
        a = null;
        f = [];
        d = $j(b.split(";"));
        for (c in MagicZoom.options) {
            f[c.k()] = MagicZoom.options[c]
        }
        d.j14(function (g) {
            MagicZoom.z40.j14(function (h) {
                a = h.exec(g.j19());
                if (a) {
                    switch ($J.j1(MagicZoom.defaults[a[1].k()])) {
                    case "boolean":
                        f[a[1].k()] = a[4] === "true";
                        break;
                    case "number":
                        f[a[1].k()] = parseFloat(a[4]);
                        break;
                    default:
                        f[a[1].k()] = a[4]
                    }
                }
            },
            this)
        },
        this);
        if (f.dragMode && undefined === f.alwaysShowZoom) {
            f.alwaysShowZoom = true
        }
        this.options = $J.extend(this.options, f)
    },
    z23: function () {
        var a;
        if (!this.x) {
            this.x = {
                self: $j(document.createElement("DIV")).j2("MagicZoomPup").p({
                    zIndex: 10,
                    position: "absolute",
                    overflow: "hidden"
                }).s(),
                width: 20,
                height: 20
            };
            this.c.appendChild(this.x.self)
        }
        if (this.options.entireImage) {
            this.x.self.p({
                "border-width": "0px"
            })
        }
        this.x.z39 = false;
        this.x.height = this.zoomViewHeight / (this.w.height / this.q.height);
        this.x.width = this.options.zoomWidth / (this.w.width / this.q.width);
        if (this.x.width > this.q.width) {
            this.x.width = this.q.width
        }
        if (this.x.height > this.q.height) {
            this.x.height = this.q.height
        }
        this.x.width = Math.round(this.x.width);
        this.x.height = Math.round(this.x.height);
        this.x.borderWidth = this.x.self.j30("borderLeftWidth").j22();
        this.x.self.p({
            width: (this.x.width - 2 * ($J.v.backCompat ? 0 : this.x.borderWidth)) + "px",
            height: (this.x.height - 2 * ($J.v.backCompat ? 0 : this.x.borderWidth)) + "px"
        });
        if (!this.options.opacityReverse) {
            this.x.self.g(parseFloat(this.options.opacity / 100));
            if (this.x.z45) {
                this.x.self.removeChild(this.x.z45);
                this.x.z45 = null
            }
        } else {
            this.x.self.g(1);
            if (this.x.z45) {
                this.x.z45.src = this.q.self.src
            } else {
                a = this.q.self.cloneNode(false);
                a.unselectable = "on";
                this.x.z45 = $j(this.x.self.appendChild(a)).p({
                    position: "absolute",
                    zIndex: 5
                })
            }
        }
    },
    z46: function (b, a) {
        if (!this.z28 || b === undefined) {
            return false
        }
        $j(b).stop();
        if (a === undefined) {
            a = $j(b).j15()
        }
        if (this.y === null || this.y === undefined) {
            this.y = this.q.getBox()
        }
        if (a.x > this.y.right || a.x < this.y.left || a.y > this.y.bottom || a.y < this.y.top) {
            this.j17();
            return false
        }
        if (b.type == "mouseout") {
            return false
        }
        if (this.options.dragMode && !this.z49) {
            return false
        }
        if (!this.options.moveOnClick) {
            a.x -= this.ddx;
            a.y -= this.ddy
        }
        if ((a.x + this.x.width / 2) >= this.y.right) {
            a.x = this.y.right - this.x.width / 2
        }
        if ((a.x - this.x.width / 2) <= this.y.left) {
            a.x = this.y.left + this.x.width / 2
        }
        if ((a.y + this.x.height / 2) >= this.y.bottom) {
            a.y = this.y.bottom - this.x.height / 2
        }
        if ((a.y - this.x.height / 2) <= this.y.top) {
            a.y = this.y.top + this.x.height / 2
        }
        this.options.x = a.x - this.y.left;
        this.options.y = a.y - this.y.top;
        if (this.z48 === null) {
            if ($J.v.trident) {
                this.c.style.zIndex = 1
            }
            this.z48 = setTimeout(this.z9, 10)
        }
        return true
    },
    j27: function () {
        var f, i, d, c, h, g, b, a;
        f = this.x.width / 2;
        i = this.x.height / 2;
        this.x.self.style.left = this.options.x - f + this.q.border.left + "px";
        this.x.self.style.top = this.options.y - i + this.q.border.top + "px";
        if (this.options.opacityReverse) {
            this.x.z45.style.left = "-" + (parseFloat(this.x.self.style.left) + this.x.borderWidth) + "px";
            this.x.z45.style.top = "-" + (parseFloat(this.x.self.style.top) + this.x.borderWidth) + "px"
        }
        d = (this.options.x - f) * (this.w.width / this.q.width);
        c = (this.options.y - i) * (this.w.height / this.q.height);
        if (this.w.width - d < this.options.zoomWidth) {
            d = this.w.width - this.options.zoomWidth;
            if (d < 0) {
                d = 0
            }
        }
        if (this.w.height - c < this.zoomViewHeight) {
            c = this.w.height - this.zoomViewHeight;
            if (c < 0) {
                c = 0
            }
        }
        if (document.documentElement.dir == "rtl") {
            d = (this.options.x + this.x.width / 2 - this.q.width) * (this.w.width / this.q.width)
        }
        d = Math.round(d);
        c = Math.round(c);
        if (this.options.smoothing === false || !this.x.z39) {
            this.w.self.style.left = (-d) + "px";
            this.w.self.style.top = (-c) + "px"
        } else {
            h = parseInt(this.w.self.style.left);
            g = parseInt(this.w.self.style.top);
            b = (-d - h);
            a = (-c - g);
            if (!b && !a) {
                this.z48 = null;
                return
            }
            b *= this.options.smoothingSpeed / 100;
            if (b < 1 && b > 0) {
                b = 1
            } else {
                if (b > -1 && b < 0) {
                    b = -1
                }
            }
            h += b;
            a *= this.options.smoothingSpeed / 100;
            if (a < 1 && a > 0) {
                a = 1
            } else {
                if (a > -1 && a < 0) {
                    a = -1
                }
            }
            g += a;
            this.w.self.style.left = h + "px";
            this.w.self.style.top = g + "px"
        }
        if (!this.x.z39) {
            if (this.r) {
                this.r.stop();
                this.r.options.onComplete = $J.$F;
                this.r.options.duration = this.options.zoomFadeInSpeed;
                this.e.self.g(0);
                this.r.start({
                    opacity: [0, 1]
                })
            }
            if (this.options.zoomPosition != "inner") {
                this.x.self.j27()
            }
            this.e.self.style.top = this.e.z17;
            if (this.options.opacityReverse) {
                this.c.j2("MagicZoomPup").j31({
                    "border-width": "0px"
                });
                this.q.self.g(parseFloat((100 - this.options.opacity) / 100))
            }
            this.x.z39 = true
        }
        if (this.z48) {
            this.z48 = setTimeout(this.z9, 1000 / this.options.fps)
        }
    },
    j17: function () {
        if (this.z48) {
            clearTimeout(this.z48);
            this.z48 = null
        }
        if (!this.options.alwaysShowZoom && this.x.z39) {
            this.x.z39 = false;
            this.x.self.s();
            if (this.r) {
                this.r.stop();
                this.r.options.onComplete = this.e.z18;
                this.r.options.duration = this.options.zoomFadeOutSpeed;
                var a = this.e.self.j30("opacity");
                this.r.start({
                    opacity: [a, 0]
                })
            } else {
                this.e.s()
            }
            if (this.options.opacityReverse) {
                this.c.j3("MagicZoomPup");
                this.q.self.g(1)
            }
        }
        this.y = null;
        if (this.options.clickToActivate) {
            this.z28 = false
        }
        if (this.options.dragMode) {
            this.z49 = false
        }
        if ($J.v.trident) {
            this.c.style.zIndex = 0
        }
    },
    mousedown: function (b) {
        $j(b).stop();
        if (this.options.clickToInitialize && !this.q) {
            this.initMouseEvent = b;
            this.z11();
            return
        }
        if (this.w && this.options.clickToActivate && !this.z28) {
            this.z28 = true;
            this.z46(b)
        }
        if (this.options.dragMode) {
            this.z49 = true;
            if (!this.options.moveOnClick) {
                var a = b.j15();
                this.ddx = a.x - this.options.x - this.y.left;
                this.ddy = a.y - this.options.y - this.y.top;
                if (Math.abs(this.ddx) > this.x.width / 2 || Math.abs(this.ddy) > this.x.height / 2) {
                    this.z49 = false;
                    return
                }
            }
        }
        if (this.options.moveOnClick) {
            this.z46(b)
        }
    },
    mouseup: function (a) {
        $j(a).stop();
        if (this.options.dragMode) {
            this.z49 = false
        }
    }
};
if ($J.v.trident) {
    try {
        document.execCommand("BackgroundImageCache", false, true)
    } catch(e) {}
}
$j(document).a("domready", MagicZoom.refresh);
$j(document).a("mousemove", MagicZoom.z1);
