﻿
 (function(b) {
    var a = function(k, r) {
        var h = b.extend({},
        b.fn.nivoSlider.defaults, r);
        var n = {
            currentSlide: 0,
            currentImage: "",
            totalSlides: 0,
            randAnim: "",
            running: false,
            paused: false,
            stop: false
        };
        var e = b(k);
        e.data("nivo:vars", n);
        e.css("position", "relative");
        e.addClass("nivoSlider");
        var f = e.children();
        f.each(function() {
            var u = b(this);
            var t = "";
            if (!u.is("img")) {
                if (u.is("a")) {
                    u.addClass("nivo_imageLink");
                    t = u
                }
                u = u.find("img:first")
            }
            var s = u.width();
            if (s == 0) {
                s = u.attr("width")
            }
            var i = u.height();
            if (i == 0) {
                i = u.attr("height")
            }
            if (s > e.width()) {
                e.width(s)
            }
            if (i > e.height()) {
                e.height(i)
            }
            if (t != "") {
                t.css("display", "none")
            }
            u.css("display", "none");
            n.totalSlides++
        });
        if (h.startSlide > 0) {
            if (h.startSlide >= n.totalSlides) {
                h.startSlide = n.totalSlides - 1
            }
            n.currentSlide = h.startSlide
        }
        if (b(f[n.currentSlide]).is("img")) {
            n.currentImage = b(f[n.currentSlide])
        } else {
            n.currentImage = b(f[n.currentSlide]).find("img:first")
        }
        if (b(f[n.currentSlide]).is("a")) {
            b(f[n.currentSlide]).css("display", "block")
        }
        e.css("background", 'url("' + n.currentImage.attr("src") + '") no-repeat');
        for (var l = 0; l < h.slices; l++) {
            var p = Math.round(e.width() / h.slices);
            if (l == h.slices - 1) {
                e.append(b('<div class="nivo_slice"></div>').css({
                    left: (p * l) + "px",
                    width: (e.width() - (p * l)) + "px"
                }))
            } else {
                e.append(b('<div class="nivo_slice"></div>').css({
                    left: (p * l) + "px",
                    width: p + "px"
                }))
            }
        }
        e.append(b('<div class="nivo_caption"><p></p></div>').css({
            display: "none",
            opacity: h.captionOpacity
        }));
        if (n.currentImage.attr("title") != "") {
            var o = n.currentImage.attr("title");
            if (o.substr(0, 1) == "#") {
                o = b(o).html()
            }
            b(".nivo_caption p", e).html(o);
            b(".nivo_caption", e).fadeIn(h.animSpeed)
        }
        var d = 0;
        if (!h.manualAdvance && f.length > 1) {
            d = setInterval(function() {
                q(e, f, h, false)
            },
            h.pauseTime)
        }
        if (h.directionNav) {
            e.append('<div class="nivo_directionNav"><a class="nivo_prevNav">Prev</a><a class="nivo_nextNav">Next</a></div>');
            if (h.directionNavHide) {
                b(".nivo_directionNav", e).hide();
                e.hover(function() {
                    b(".nivo_directionNav", e).show()
                },
                function() {
                    b(".nivo_directionNav", e).hide()
                })
            }
            b("a.nivo_prevNav", e).live("click", 
            function() {
                if (n.running) {
                    return false
                }
                clearInterval(d);
                d = "";
                n.currentSlide -= 2;
                q(e, f, h, "prev")
            });
            b("a.nivo_nextNav", e).live("click", 
            function() {
                if (n.running) {
                    return false
                }
                clearInterval(d);
                d = "";
                q(e, f, h, "next")
            })
        }
        if (h.controlNav) {
            var m = b('<div class="nivo_controlNav"></div>');
            e.append(m);
            for (var l = 0; l < f.length; l++) {
                if (h.controlNavThumbs) {
                    var g = f.eq(l);
                    if (!g.is("img")) {
                        g = g.find("img:first")
                    }
                    if (h.controlNavThumbsFromRel) {
                        m.append('<a class="nivo_control" rel="' + l + '"><img src="' + g.attr("rel") + '" alt="" /></a>')
                    } else {
                        m.append('<a class="nivo_control" rel="' + l + '"><img src="' + g.attr("src").replace(h.controlNavThumbsSearch, h.controlNavThumbsReplace) + '" alt="" /></a>')
                    }
                } else {
                    m.append('<a class="nivo_control" rel="' + l + '">' + (l + 1) + "</a>")
                }
            }
            b(".nivo_controlNav a:eq(" + n.currentSlide + ")", e).addClass("active");
            b(".nivo_controlNav a", e).live("click", 
            function() {
                if (n.running) {
                    return false
                }
                if (b(this).hasClass("active")) {
                    return false
                }
                clearInterval(d);
                d = "";
                e.css("background", 'url("' + n.currentImage.attr("src") + '") no-repeat');
                n.currentSlide = b(this).attr("rel") - 1;
                q(e, f, h, "control")
            })
        }
        if (h.keyboardNav) {
            b(window).keypress(function(i) {
                if (i.keyCode == "37") {
                    if (n.running) {
                        return false
                    }
                    clearInterval(d);
                    d = "";
                    n.currentSlide -= 2;
                    q(e, f, h, "prev")
                }
                if (i.keyCode == "39") {
                    if (n.running) {
                        return false
                    }
                    clearInterval(d);
                    d = "";
                    q(e, f, h, "next")
                }
            })
        }
        if (h.pauseOnHover) {
            e.hover(function() {
                n.paused = true;
                clearInterval(d);
                d = ""
            },
            function() {
                n.paused = false;
                if (d == "" && !h.manualAdvance) {
                    d = setInterval(function() {
                        q(e, f, h, false)
                    },
                    h.pauseTime)
                }
            })
        }
        e.bind("nivo:animFinished", 
        function() {
            n.running = false;
            b(f).each(function() {
                if (b(this).is("a")) {
                    b(this).css("display", "none")
                }
            });
            if (b(f[n.currentSlide]).is("a")) {
                b(f[n.currentSlide]).css("display", "block")
            }
            if (d == "" && !n.paused && !h.manualAdvance) {
                d = setInterval(function() {
                    q(e, f, h, false)
                },
                h.pauseTime)
            }
            h.afterChange.call(this)
        });
        var c = function(u, t) {
            var v = b(".nivo_slice", u);
            var s = 0;
            v.each(function() {
                var w = b(this);
                var i = Math.round(u.width() / t.slices);
                if (s == t.slices - 1) {
                    w.css("width", (u.width() - (i * s)) + "px")
                } else {
                    w.css("width", i + "px")
                }
                s++
            })
        };
        var q = function(s, t, w, z) {
            var A = s.data("nivo:vars");
            if (A && (A.currentSlide == A.totalSlides - 1)) {
                w.lastSlide.call(this)
            }
            if ((!A || A.stop) && !z) {
                return false
            }
            w.beforeChange.call(this);
            if (!z) {
                s.css("background", 'url("' + A.currentImage.attr("src") + '") no-repeat')
            } else {
                if (z == "prev") {
                    s.css("background", 'url("' + A.currentImage.attr("src") + '") no-repeat')
                }
                if (z == "next") {
                    s.css("background", 'url("' + A.currentImage.attr("src") + '") no-repeat')
                }
            }
            A.currentSlide++;
            if (A.currentSlide == A.totalSlides) {
                A.currentSlide = 0;
                w.slideshowEnd.call(this)
            }
            if (A.currentSlide < 0) {
                A.currentSlide = (A.totalSlides - 1)
            }
            if (b(t[A.currentSlide]).is("img")) {
                A.currentImage = b(t[A.currentSlide])
            } else {
                A.currentImage = b(t[A.currentSlide]).find("img:first")
            }
            if (w.controlNav) {
                b(".nivo_controlNav a", s).removeClass("active");
                b(".nivo_controlNav a:eq(" + A.currentSlide + ")", s).addClass("active")
            }
            if (A.currentImage.attr("title") != "") {
                var B = A.currentImage.attr("title");
                if (B.substr(0, 1) == "#") {
                    B = b(B).html()
                }
                if (b(".nivo_caption", s).css("display") == "block") {
                    b(".nivo_caption p", s).fadeOut(w.animSpeed, 
                    function() {
                        b(this).html(B);
                        b(this).fadeIn(w.animSpeed)
                    })
                } else {
                    b(".nivo_caption p", s).html(B)
                }
                b(".nivo_caption", s).fadeIn(w.animSpeed)
            } else {
                b(".nivo_caption", s).fadeOut(w.animSpeed)
            }
            var y = 0;
            b(".nivo_slice", s).each(function() {
                var i = Math.round(s.width() / w.slices);
                b(this).css({
                    height: "0px",
                    opacity: "0",
                    background: 'url("' + A.currentImage.attr("src") + '") no-repeat -' + ((i + (y * i)) - i) + "px 0%"
                });
                y++
            });
            if (w.effect == "random") {
                var C = new Array("sliceDownRight", "sliceDownLeft", "sliceUpRight", "sliceUpLeft", "sliceUpDown", "sliceUpDownLeft", "fold", "fade", "slideInRight", "slideInLeft");
                A.randAnim = C[Math.floor(Math.random() * (C.length + 1))];
                if (A.randAnim == undefined) {
                    A.randAnim = "fade"
                }
            }
            if (w.effect.indexOf(",") != -1) {
                var C = w.effect.split(",");
                A.randAnim = C[Math.floor(Math.random() * (C.length))];
                if (A.randAnim == undefined) {
                    A.randAnim = "fade"
                }
            }
            A.running = true;
            if (w.effect == "sliceDown" || w.effect == "sliceDownRight" || A.randAnim == "sliceDownRight" || w.effect == "sliceDownLeft" || A.randAnim == "sliceDownLeft") {
                var u = 0;
                var y = 0;
                c(s, w);
                var E = b(".nivo_slice", s);
                if (w.effect == "sliceDownLeft" || A.randAnim == "sliceDownLeft") {
                    E = b(".nivo_slice", s)._reverse()
                }
                E.each(function() {
                    var i = b(this);
                    i.css({
                        top: "0px"
                    });
                    if (y == w.slices - 1) {
                        setTimeout(function() {
                            i.animate({
                                height: "100%",
                                opacity: "1.0"
                            },
                            w.animSpeed, "", 
                            function() {
                                s.trigger("nivo:animFinished")
                            })
                        },
                        (100 + u))
                    } else {
                        setTimeout(function() {
                            i.animate({
                                height: "100%",
                                opacity: "1.0"
                            },
                            w.animSpeed)
                        },
                        (100 + u))
                    }
                    u += 50;
                    y++
                })
            } else {
                if (w.effect == "sliceUp" || w.effect == "sliceUpRight" || A.randAnim == "sliceUpRight" || w.effect == "sliceUpLeft" || A.randAnim == "sliceUpLeft") {
                    var u = 0;
                    var y = 0;
                    c(s, w);
                    var E = b(".nivo_slice", s);
                    if (w.effect == "sliceUpLeft" || A.randAnim == "sliceUpLeft") {
                        E = b(".nivo_slice", s)._reverse()
                    }
                    E.each(function() {
                        var i = b(this);
                        i.css({
                            bottom: "0px"
                        });
                        if (y == w.slices - 1) {
                            setTimeout(function() {
                                i.animate({
                                    height: "100%",
                                    opacity: "1.0"
                                },
                                w.animSpeed, "", 
                                function() {
                                    s.trigger("nivo:animFinished")
                                })
                            },
                            (100 + u))
                        } else {
                            setTimeout(function() {
                                i.animate({
                                    height: "100%",
                                    opacity: "1.0"
                                },
                                w.animSpeed)
                            },
                            (100 + u))
                        }
                        u += 50;
                        y++
                    })
                } else {
                    if (w.effect == "sliceUpDown" || w.effect == "sliceUpDownRight" || A.randAnim == "sliceUpDown" || w.effect == "sliceUpDownLeft" || A.randAnim == "sliceUpDownLeft") {
                        var u = 0;
                        var y = 0;
                        var D = 0;
                        c(s, w);
                        var E = b(".nivo_slice", s);
                        if (w.effect == "sliceUpDownLeft" || A.randAnim == "sliceUpDownLeft") {
                            E = b(".nivo_slice", s)._reverse()
                        }
                        E.each(function() {
                            var i = b(this);
                            if (y == 0) {
                                i.css("top", "0px");
                                y++
                            } else {
                                i.css("bottom", "0px");
                                y = 0
                            }
                            if (D == w.slices - 1) {
                                setTimeout(function() {
                                    i.animate({
                                        height: "100%",
                                        opacity: "1.0"
                                    },
                                    w.animSpeed, "", 
                                    function() {
                                        s.trigger("nivo:animFinished")
                                    })
                                },
                                (100 + u))
                            } else {
                                setTimeout(function() {
                                    i.animate({
                                        height: "100%",
                                        opacity: "1.0"
                                    },
                                    w.animSpeed)
                                },
                                (100 + u))
                            }
                            u += 50;
                            D++
                        })
                    } else {
                        if (w.effect == "fold" || A.randAnim == "fold") {
                            var u = 0;
                            var y = 0;
                            c(s, w);
                            b(".nivo_slice", s).each(function() {
                                var i = b(this);
                                var v = i.width();
                                i.css({
                                    top: "0px",
                                    height: "100%",
                                    width: "0px"
                                });
                                if (y == w.slices - 1) {
                                    setTimeout(function() {
                                        i.animate({
                                            width: v,
                                            opacity: "1.0"
                                        },
                                        w.animSpeed, "", 
                                        function() {
                                            s.trigger("nivo:animFinished")
                                        })
                                    },
                                    (100 + u))
                                } else {
                                    setTimeout(function() {
                                        i.animate({
                                            width: v,
                                            opacity: "1.0"
                                        },
                                        w.animSpeed)
                                    },
                                    (100 + u))
                                }
                                u += 50;
                                y++
                            })
                        } else {
                            if (w.effect == "fade" || A.randAnim == "fade") {
                                var x = b(".nivo_slice:first", s);
                                x.css({
                                    height: "100%",
                                    width: s.width() + "px"
                                });
                                x.animate({
                                    opacity: "1.0"
                                },
                                (w.animSpeed * 2), "", 
                                function() {
                                    s.trigger("nivo:animFinished")
                                })
                            } else {
                                if (w.effect == "slideInRight" || A.randAnim == "slideInRight") {
                                    var x = b(".nivo_slice:first", s);
                                    x.css({
                                        height: "100%",
                                        width: "0px",
                                        opacity: "1"
                                    });
                                    x.animate({
                                        width: s.width() + "px"
                                    },
                                    (w.animSpeed * 2), "", 
                                    function() {
                                        s.trigger("nivo:animFinished")
                                    })
                                } else {
                                    if (w.effect == "slideInLeft" || A.randAnim == "slideInLeft") {
                                        var x = b(".nivo_slice:first", s);
                                        x.css({
                                            height: "100%",
                                            width: "0px",
                                            opacity: "1",
                                            left: "",
                                            right: "0px"
                                        });
                                        x.animate({
                                            width: s.width() + "px"
                                        },
                                        (w.animSpeed * 2), "", 
                                        function() {
                                            x.css({
                                                left: "0px",
                                                right: ""
                                            });
                                            s.trigger("nivo:animFinished")
                                        })
                                    }
                                }
                            }
                        }
                    }
                }
            }
        };
        var j = function(i) {
            if (this.console && typeof console.log != "undefined") {
                console.log(i)
            }
        };
        this.stop = function() {
            if (!b(k).data("nivo:vars").stop) {
                b(k).data("nivo:vars").stop = true;
                j("Stop Slider")
            }
        };
        this.start = function() {
            if (b(k).data("nivo:vars").stop) {
                b(k).data("nivo:vars").stop = false;
                j("Start Slider")
            }
        };
        h.afterLoad.call(this)
    };
    b.fn.nivoSlider = function(c) {
        return this.each(function() {
            var d = b(this);
            if (d.data("nivoslider")) {
                return
            }
            var e = new a(this, c);
            d.data("nivoslider", e)
        })
    };
    b.fn.nivoSlider.defaults = {
        effect: "random",
        slices: 15,
        animSpeed: 500,
        pauseTime: 3000,
        startSlide: 0,
        directionNav: true,
        directionNavHide: true,
        controlNav: true,
        controlNavThumbs: false,
        controlNavThumbsFromRel: false,
        controlNavThumbsSearch: ".jpg",
        controlNavThumbsReplace: "_thumb.jpg",
        keyboardNav: true,
        pauseOnHover: true,
        manualAdvance: true,
        captionOpacity: 0.8,
        beforeChange: function() {},
        afterChange: function() {},
        slideshowEnd: function() {},
        lastSlide: function() {},
        afterLoad: function() {}
    };
    b.fn._reverse = [].reverse
})(jQuery);


/**
 * @name 		:	carousel
 * @type		:	plugin
 * @explain		:	
 */
 (function(d) {
    d.fn.carousel = function(e) {
        e = d.extend({
            btnPrev: null,
            btnNext: null,
            btnGo: null,
            mouseWheel: false,
            auto: null,
            speed: 200,
            easing: null,
            vertical: false,
            circular: true,
            visible: 3,
            start: 0,
            scrolls: 1,
            beforeStart: null,
            afterEnd: null
        },
        e || {});
        return this.each(function() {
            var n = false,
            l = e.vertical ? "top": "left",
            g = e.vertical ? "height": "width";
            var f = d(this),
            p = d("ul", f),
            i = d("li:visible", p),
            t = i.size(),
            s = e.visible;
            if (e.circular) {
                p.prepend(i.slice(t - s - 1 + 1).clone()).append(i.slice(0, s).clone());
                e.start += s
            }
            var r = d("li:visible", p),
            o = r.size(),
            u = e.start;
            f.css("visibility", "visible");
            r.css({
                overflow: "hidden",
                "float": e.vertical ? "none": "left"
            });
            p.css({
                margin: "0",
                padding: "0",
                position: "relative",
                "list-style-type": "none",
                "z-index": "1"
            });
            f.css({
                overflow: "hidden",
                position: "relative",
                "z-index": "2",
                left: "0px"
            });
            var k = e.vertical ? a(r) : c(r);
            var q = k * o;
            var m = k * s;
            r.css({
                width: r.width(),
                height: r.height()
            });
            p.css(g, q + "px").css(l, -(u * k));
            f.css(g, m + "px");
            d((u - e.scrolls < 0 && e.btnPrev)).addClass("prev_disabled");
            d((u + e.scrolls > o - s && e.btnNext)).addClass("next_disabled");
            d(e.btnPrev).hover(function() {
                if (!d(e.btnPrev).hasClass("prev_disabled")) {
                    d(e.btnPrev).addClass("prev_hover")
                }
            },
            function() {
                d(e.btnPrev).removeClass("prev_hover")
            });
            d(e.btnNext).hover(function() {
                if (!d(e.btnNext).hasClass("next_disabled")) {
                    d(e.btnNext).addClass("next_hover")
                }
            },
            function() {
                d(e.btnNext).removeClass("next_hover")
            });
            if (e.btnPrev) {
                d(e.btnPrev).click(function() {
                    return j(u - e.scrolls)
                })
            }
            if (e.btnNext) {
                d(e.btnNext).click(function() {
                    return j(u + e.scrolls)
                })
            }
            if (e.btnGo) {
                d.each(e.btnGo, 
                function(v, w) {
                    d(w).click(function() {
                        return j(e.circular ? e.visible + v: v)
                    })
                })
            }
            if (e.mouseWheel && f.mousewheel) {
                f.mousewheel(function(v, w) {
                    return w > 0 ? j(u - e.scrolls) : j(u + e.scrolls)
                })
            }
            if (e.auto) {
                setInterval(function() {
                    j(u + e.scrolls)
                },
                e.auto + e.speed)
            }
            function h() {
                return r.slice(u).slice(0, s)
            }
            function j(v) {
                if (!n) {
                    if (e.beforeStart) {
                        e.beforeStart.call(this, h())
                    }
                    if (e.circular) {
                        if (v <= e.start - s - 1) {
                            p.css(l, -((o - (s * 2)) * k) + "px");
                            u = v == e.start - s - 1 ? o - (s * 2) - 1: o - (s * 2) - e.scrolls
                        } else {
                            if (v >= o - s + 1) {
                                p.css(l, -((s) * k) + "px");
                                u = v == o - s + 1 ? s + 1: s + e.scrolls
                            } else {
                                u = v
                            }
                        }
                    } else {
                        if (v < 0 || v > o - s) {
                            return
                        } else {
                            u = v
                        }
                    }
                    n = true;
                    p.animate(l == "left" ? {
                        left: -(u * k)
                    }: {
                        top: -(u * k)
                    },
                    e.speed, e.easing, 
                    function() {
                        if (e.afterEnd) {
                            e.afterEnd.call(this, h())
                        }
                        n = false
                    });
                    if (!e.circular) {
                        d(e.btnPrev).removeClass("prev_disabled");
                        d(e.btnNext).removeClass("next_disabled");
                        d((u - e.scrolls < 0 && e.btnPrev)).addClass("prev_disabled");
                        d((u + e.scrolls > o - s && e.btnNext)).addClass("next_disabled")
                    }
                }
                return false
            }
        })
    };
    function b(e, f) {
        return parseInt(d.css(e[0], f)) || 0
    }
    function c(e) {
        return e[0].offsetWidth + b(e, "marginLeft") + b(e, "marginRight")
    }
    function a(e) {
        return e[0].offsetHeight + b(e, "marginTop") + b(e, "marginBottom")
    }
})(jQuery);


/**
 * @name 		:	mousewheel
 * @type		:	plugin
 * @explain		:	
 */
 (function(c) {
    var a = ["DOMMouseScroll", "mousewheel"];
    c.event.special.mousewheel = {
        setup: function() {
            if (this.addEventListener) {
                for (var d = a.length; d;) {
                    this.addEventListener(a[--d], b, false)
                }
            } else {
                this.onmousewheel = b
            }
        },
        teardown: function() {
            if (this.removeEventListener) {
                for (var d = a.length; d;) {
                    this.removeEventListener(a[--d], b, false)
                }
            } else {
                this.onmousewheel = null
            }
        }
    };
    c.fn.extend({
        mousewheel: function(d) {
            return d ? this.bind("mousewheel", d) : this.trigger("mousewheel")
        },
        unmousewheel: function(d) {
            return this.unbind("mousewheel", d)
        }
    });
    function b(f) {
        var d = [].slice.call(arguments, 1),
        g = 0,
        e = true;
        f = c.event.fix(f || window.event);
        f.type = "mousewheel";
        if (f.wheelDelta) {
            g = f.wheelDelta / 120
        }
        if (f.detail) {
            g = -f.detail / 3
        }
        d.unshift(f, g);
        return c.event.handle.apply(this, d)
    }
})(jQuery);


/**
 * @name 		:	zoom-1.1-min.js
 * @type		:	plugin
 * @explain		:	
 */
 (function(a) {
    a.fn.zoom = function(b) {
        var d = {
            xzoom: 300,
            yzoom: 300,
            offset: 10,
            offsetTop: 0,
            position: "right",
            lens: 1
        };
        if (b) {
            a.extend(d, b)
        }
        var c = "";
        a(this).hover(function() {
            var f = a(this).offset().left;
            var e = a(this).offset().top;
            var m = a(this).children(".picbox").children("img").offset().left;
            var h = a(this).children(".picbox").children("img").offset().top;
            var k = a(this).width();
            var i = a(this).height();
            var l = a(this).children(".picbox").children("img").get(0).offsetWidth;
            var j = a(this).children(".picbox").children("img").get(0).offsetHeight;
            c = a(this).children(".picbox").children("img").attr("alt");
            var g = a(this).children(".picbox").children("img").attr("big");
            a(this).children(".picbox").children("img").attr("alt", "");
            if ((l < k) && (j < i)) {} else {
                if (a("div.zoomdiv").get().length == 0) {
                    a(this).after("<div class='zoomdiv'><img class='bigimg' src='" + g + "'/></div>");
                    a(this).append("<div class='handle'>&nbsp;</div>")
                }
                a("div.zoomdiv").css({
                    top: d.offsetTop,
                    left: k + d.offset
                });
                a("div.zoomdiv").width(d.xzoom);
                a("div.zoomdiv").height(d.yzoom);
                a("div.zoomdiv").show();
                if (!d.lens) {
                    a(this).css("cursor", "crosshair")
                }
                a(document.body).mousemove(function(q) {
                    mouse = new MouseEvent(q);
                    var r = a(".bigimg").get(0).offsetWidth;
                    var p = a(".bigimg").get(0).offsetHeight;
                    var n = "x";
                    var o = "y";
                    if (isNaN(o) | isNaN(n)) {
                        var o = (r / l);
                        var n = (p / j);
                        a("div.handle").width((d.xzoom) / o);
                        a("div.handle").height((d.yzoom) / n);
                        if (d.lens) {
                            a("div.handle").css("visibility", "visible")
                        }
                    }
                    xpos = mouse.x - a("div.handle").width() / 2 - m;
                    ypos = mouse.y - a("div.handle").height() / 2 - h;
                    if (d.lens) {
                        xpos = (mouse.x - a("div.handle").width() / 2 < m) ? 0 + (m - f - 2) : ((mouse.x + a("div.handle").width() / 2 > l + m) ? (l - a("div.handle").width() + (m - f) - 2) : xpos + (m - f - 2));
                        ypos = (mouse.y - a("div.handle").height() / 2 < h) ? 0 + (h - e - 2) : ((mouse.y + a("div.handle").height() / 2 > j + h) ? (j - a("div.handle").height() + (h - e) - 2) : ypos + (h - e - 2))
                    }
                    if (d.lens) {
                        a("div.handle").css({
                            top: ypos,
                            left: xpos
                        })
                    }
                    scrolly = ypos - (h - e - 2);
                    a("div.zoomdiv").get(0).scrollTop = scrolly * n;
                    scrollx = xpos - (m - f - 2);
                    a("div.zoomdiv").get(0).scrollLeft = (scrollx) * o
                })
            }
        },
        function() {
            a(this).children("img").attr("alt", c);
            a(document.body).unbind("mousemove");
            if (d.lens) {
                a("div.handle").remove()
            }
            a("div.zoomdiv").remove()
        })
    }
})(jQuery);
function MouseEvent(a) {
    this.x = a.pageX;
    this.y = a.pageY
};


/**
 * @name 		:	loadthumb
 * @type		:	plugin
 * @explain		:	preload,center,resize
 */
jQuery.fn.loadthumb = function(c) {
    c = $.extend({
        src: "",
        imgId: "myImgs",
        parentId: "CRviewer"
    },
    c);
    var a = this;
    a.hide();
    var b = new Image();
    $(b).load(function() {
        imgDem = {};
        imgDem.w = b.width;
        imgDem.h = b.height;
        imgDem = $.imgResize({
            w: $("#" + c.parentId).width(),
            h: $("#" + c.parentId).height()
        },
        {
            w: imgDem.w,
            h: imgDem.h
        });
        var d = $.imgCenter({
            w: $("#" + c.parentId).width(),
            h: $("#" + c.parentId).height()
        },
        {
            w: imgDem.w,
            h: imgDem.h
        });
        $("#" + c.imgId).css({
            width: imgDem.w,
            height: imgDem.h,
            marginLeft: d.l,
            marginTop: d.t
        });
        a.attr("src", c.src);
        a.fadeIn("slow")
    }).attr("src", c.src);
    return a
};
jQuery.imgResize = function(c, b) {
    if (b.w > 0 && b.h > 0) {
        var a = (c.w / b.w < c.h / b.h) ? c.w / b.w: c.h / b.h;
        if (a <= 1) {
            b.w = b.w * a;
            b.h = b.h * a
        } else {
            b.w = b.w;
            b.h = b.h
        }
    }
    return b
};
jQuery.imgCenter = function(d, a) {
    var c = (d.w - a.w) * 0.5;
    var b = (d.h - a.h) * 0.5;
    return {
        l: c,
        t: b
    }
};


/**
 * @name 		:	jquery-validate
 * @type		:	plugin
 * @explain		:	
 */
 (function($) {
    $.extend($.fn, {
        validate: function(options) {
            if (!this.length) {
                options && options.debug && window.console && console.warn("nothing selected, can't validate, returning nothing");
                return;
            }
            var validator = $.data(this[0], 'validator');
            if (validator) {
                return validator;
            }
            validator = new $.validator(options, this[0]);
            $.data(this[0], 'validator', validator);
            if (validator.settings.onsubmit) {
                this.find("input, button").filter(".cancel").click(function() {
                    validator.cancelSubmit = true;
                });
                if (validator.settings.submitHandler) {
                    this.find("input, button").filter(":submit").click(function() {
                        validator.submitButton = this;
                    });
                }
                this.submit(function(event) {
                    if (validator.settings.debug) event.preventDefault();
                    function handle() {
                        if (validator.settings.submitHandler) {
                            if (validator.submitButton) {
                                var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
                            }
                            validator.settings.submitHandler.call(validator, validator.currentForm);
                            if (validator.submitButton) {
                                hidden.remove();
                            }
                            return false;
                        }
                        return true;
                    }
                    if (validator.cancelSubmit) {
                        validator.cancelSubmit = false;
                        return handle();
                    }
                    if (validator.form()) {
                        if (validator.pendingRequest) {
                            validator.formSubmitted = true;
                            return false;
                        }
                        return handle();
                    } else {
                        validator.focusInvalid();
                        return false;
                    }
                });
            }
            return validator;
        },
        valid: function() {
            if ($(this[0]).is('form')) {
                return this.validate().form();
            } else {
                var valid = true;
                var validator = $(this[0].form).validate();
                this.each(function() {
                    valid &= validator.element(this);
                });
                return valid;
            }
        },
        removeAttrs: function(attributes) {
            var result = {},
            $element = this;
            $.each(attributes.split(/\s/), 
            function(index, value) {
                result[value] = $element.attr(value);
                $element.removeAttr(value);
            });
            return result;
        },
        rules: function(command, argument) {
            var element = this[0];
            if (command) {
                var settings = $.data(element.form, 'validator').settings;
                var staticRules = settings.rules;
                var existingRules = $.validator.staticRules(element);
                switch (command) {
                case "add":
                    $.extend(existingRules, $.validator.normalizeRule(argument));
                    staticRules[element.name] = existingRules;
                    if (argument.messages) settings.messages[element.name] = $.extend(settings.messages[element.name], argument.messages);
                    break;
                case "remove":
                    if (!argument) {
                        delete staticRules[element.name];
                        return existingRules;
                    }
                    var filtered = {};
                    $.each(argument.split(/\s/), 
                    function(index, method) {
                        filtered[method] = existingRules[method];
                        delete existingRules[method];
                    });
                    return filtered;
                }
            }
            var data = $.validator.normalizeRules($.extend({},
            $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element)), element);
            if (data.required) {
                var param = data.required;
                delete data.required;
                data = $.extend({
                    required: param
                },
                data);
            }
            return data;
        }
    });
    $.extend($.expr[":"], {
        blank: function(a) {
            return ! $.trim("" + a.value);
        },
        filled: function(a) {
            return !! $.trim("" + a.value);
        },
        unchecked: function(a) {
            return ! a.checked;
        }
    });
    $.validator = function(options, form) {
        this.settings = $.extend(true, {},
        $.validator.defaults, options);
        this.currentForm = form;
        this.init();
    };
    $.validator.format = function(source, params) {
        if (arguments.length == 1) return function() {
            var args = $.makeArray(arguments);
            args.unshift(source);
            return $.validator.format.apply(this, args);
        };
        if (arguments.length > 2 && params.constructor != Array) {
            params = $.makeArray(arguments).slice(1);
        }
        if (params.constructor != Array) {
            params = [params];
        }
        $.each(params, 
        function(i, n) {
            source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
        });
        return source;
    };
    $.extend($.validator, {
        defaults: {
            messages: {},
            groups: {},
            rules: {},
            errorClass: "error",
            validClass: "valid",
            errorElement: "label",
            focusInvalid: true,
            errorContainer: $([]),
            errorLabelContainer: $([]),
            onsubmit: true,
            ignore: [],
            ignoreTitle: false,
            onfocusin: function(element) {
                this.lastActive = element;
                if (this.settings.focusCleanup && !this.blockFocusCleanup) {
                    this.settings.unhighlight && this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass);
                    this.errorsFor(element).hide();
                }
            },
            onfocusout: function(element) {
                if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {
                    this.element(element);
                }
            },
            onkeyup: function(element) {
                if (element.name in this.submitted || element == this.lastElement) {
                    this.element(element);
                }
            },
            onclick: function(element) {
                if (element.name in this.submitted) this.element(element);
                else if (element.parentNode.name in this.submitted) this.element(element.parentNode);
            },
            highlight: function(element, errorClass, validClass) {
                $(element).addClass(errorClass).removeClass(validClass);
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).removeClass(errorClass).addClass(validClass);
            }
        },
        setDefaults: function(settings) {
            $.extend($.validator.defaults, settings);
        },
        messages: {
            required: "This field is required.",
            remote: "Please fix this field.",
            email: "Please enter a valid email address.",
            url: "Please enter a valid URL.",
            date: "Please enter a valid date.",
            dateISO: "Please enter a valid date (ISO).",
            number: "Please enter a valid number.",
            digits: "Please enter only digits.",
            creditcard: "Please enter a valid credit card number.",
            equalTo: "Please enter the same value again.",
            accept: "Please enter a value with a valid extension.",
            maxlength: $.validator.format("Please enter no more than {0} characters."),
            minlength: $.validator.format("Please enter at least {0} characters."),
            rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
            range: $.validator.format("Please enter a value between {0} and {1}."),
            max: $.validator.format("Please enter a value less than or equal to {0}."),
            min: $.validator.format("Please enter a value greater than or equal to {0}.")
        },
        autoCreateRanges: false,
        prototype: {
            init: function() {
                this.labelContainer = $(this.settings.errorLabelContainer);
                this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
                this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer);
                this.submitted = {};
                this.valueCache = {};
                this.pendingRequest = 0;
                this.pending = {};
                this.invalid = {};
                this.reset();
                var groups = (this.groups = {});
                $.each(this.settings.groups, 
                function(key, value) {
                    $.each(value.split(/\s/), 
                    function(index, name) {
                        groups[name] = key;
                    });
                });
                var rules = this.settings.rules;
                $.each(rules, 
                function(key, value) {
                    rules[key] = $.validator.normalizeRule(value);
                });
                function delegate(event) {
                    var validator = $.data(this[0].form, "validator"),
                    eventType = "on" + event.type.replace(/^validate/, "");
                    validator.settings[eventType] && validator.settings[eventType].call(validator, this[0]);
                }
                $(this.currentForm).validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate).validateDelegate(":radio, :checkbox, select, option", "click", delegate);
                if (this.settings.invalidHandler) $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
            },
            form: function() {
                this.checkForm();
                $.extend(this.submitted, this.errorMap);
                this.invalid = $.extend({},
                this.errorMap);
                if (!this.valid()) $(this.currentForm).triggerHandler("invalid-form", [this]);
                this.showErrors();
                return this.valid();
            },
            checkForm: function() {
                this.prepareForm();
                for (var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++) {
                    this.check(elements[i]);
                }
                return this.valid();
            },
            element: function(element) {
                element = this.clean(element);
                this.lastElement = element;
                this.prepareElement(element);
                this.currentElements = $(element);
                var result = this.check(element);
                if (result) {
                    delete this.invalid[element.name];
                } else {
                    this.invalid[element.name] = true;
                }
                if (!this.numberOfInvalids()) {
                    this.toHide = this.toHide.add(this.containers);
                }
                this.showErrors();
                return result;
            },
            showErrors: function(errors) {
                if (errors) {
                    $.extend(this.errorMap, errors);
                    this.errorList = [];
                    for (var name in errors) {
                        this.errorList.push({
                            message: errors[name],
                            element: this.findByName(name)[0]
                        });
                    }
                    this.successList = $.grep(this.successList, 
                    function(element) {
                        return ! (element.name in errors);
                    });
                }
                this.settings.showErrors ? this.settings.showErrors.call(this, this.errorMap, this.errorList) : this.defaultShowErrors();
            },
            resetForm: function() {
                if ($.fn.resetForm) $(this.currentForm).resetForm();
                this.submitted = {};
                this.prepareForm();
                this.hideErrors();
                this.elements().removeClass(this.settings.errorClass);
            },
            numberOfInvalids: function() {
                return this.objectLength(this.invalid);
            },
            objectLength: function(obj) {
                var count = 0;
                for (var i in obj) count++;
                return count;
            },
            hideErrors: function() {
                this.addWrapper(this.toHide).hide();
            },
            valid: function() {
                return this.size() == 0;
            },
            size: function() {
                return this.errorList.length;
            },
            focusInvalid: function() {
                if (this.settings.focusInvalid) {
                    try {
                        $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus().trigger("focusin");
                    } catch(e) {}
                }
            },
            findLastActive: function() {
                var lastActive = this.lastActive;
                return lastActive && $.grep(this.errorList, 
                function(n) {
                    return n.element.name == lastActive.name;
                }).length == 1 && lastActive;
            },
            elements: function() {
                var validator = this,
                rulesCache = {};
                return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function() { ! this.name && validator.settings.debug && window.console && console.error("%o has no name assigned", this);
                    if (this.name in rulesCache || !validator.objectLength($(this).rules())) return false;
                    rulesCache[this.name] = true;
                    return true;
                });
            },
            clean: function(selector) {
                return $(selector)[0];
            },
            errors: function() {
                return $(this.settings.errorElement + "." + this.settings.errorClass, this.errorContext);
            },
            reset: function() {
                this.successList = [];
                this.errorList = [];
                this.errorMap = {};
                this.toShow = $([]);
                this.toHide = $([]);
                this.currentElements = $([]);
            },
            prepareForm: function() {
                this.reset();
                this.toHide = this.errors().add(this.containers);
            },
            prepareElement: function(element) {
                this.reset();
                this.toHide = this.errorsFor(element);
            },
            check: function(element) {
                element = this.clean(element);
                if (this.checkable(element)) {
                    element = this.findByName(element.name)[0];
                }
                var rules = $(element).rules();
                var dependencyMismatch = false;
                for (method in rules) {
                    var rule = {
                        method: method,
                        parameters: rules[method]
                    };
                    try {
                        var result = $.validator.methods[method].call(this, element.value.replace(/\r/g, ""), element, rule.parameters);
                        if (result == "dependency-mismatch") {
                            dependencyMismatch = true;
                            continue;
                        }
                        dependencyMismatch = false;
                        if (result == "pending") {
                            this.toHide = this.toHide.not(this.errorsFor(element));
                            return;
                        }
                        if (!result) {
                            this.formatAndAdd(element, rule);
                            return false;
                        }
                    } catch(e) {
                        this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
                        + ", check the '" + rule.method + "' method", e);
                        throw e;
                    }
                }
                if (dependencyMismatch) return;
                if (this.objectLength(rules)) this.successList.push(element);
                return true;
            },
            customMetaMessage: function(element, method) {
                if (!$.metadata) return;
                var meta = this.settings.meta ? $(element).metadata()[this.settings.meta] : $(element).metadata();
                return meta && meta.messages && meta.messages[method];
            },
            customMessage: function(name, method) {
                var m = this.settings.messages[name];
                return m && (m.constructor == String ? m: m[method]);
            },
            findDefined: function() {
                for (var i = 0; i < arguments.length; i++) {
                    if (arguments[i] !== undefined) return arguments[i];
                }
                return undefined;
            },
            defaultMessage: function(element, method) {
                return this.findDefined(this.customMessage(element.name, method), this.customMetaMessage(element, method), !this.settings.ignoreTitle && element.title || undefined, $.validator.messages[method], "<strong>Warning: No message defined for " + element.name + "</strong>");
            },
            formatAndAdd: function(element, rule) {
                var message = this.defaultMessage(element, rule.method),
                theregex = /\$?\{(\d+)\}/g;
                if (typeof message == "function") {
                    message = message.call(this, rule.parameters, element);
                } else if (theregex.test(message)) {
                    message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters);
                }
                this.errorList.push({
                    message: message,
                    element: element
                });
                this.errorMap[element.name] = message;
                this.submitted[element.name] = message;
            },
            addWrapper: function(toToggle) {
                if (this.settings.wrapper) toToggle = toToggle.add(toToggle.parent(this.settings.wrapper));
                return toToggle;
            },
            defaultShowErrors: function() {
                for (var i = 0; this.errorList[i]; i++) {
                    var error = this.errorList[i];
                    this.settings.highlight && this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass);
                    this.showLabel(error.element, error.message);
                }
                if (this.errorList.length) {
                    this.toShow = this.toShow.add(this.containers);
                }
                if (this.settings.success) {
                    for (var i = 0; this.successList[i]; i++) {
                        this.showLabel(this.successList[i]);
                    }
                }
                if (this.settings.unhighlight) {
                    for (var i = 0, elements = this.validElements(); elements[i]; i++) {
                        this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass);
                    }
                }
                this.toHide = this.toHide.not(this.toShow);
                this.hideErrors();
                this.addWrapper(this.toShow).show();
            },
            validElements: function() {
                return this.currentElements.not(this.invalidElements());
            },
            invalidElements: function() {
                return $(this.errorList).map(function() {
                    return this.element;
                });
            },
            showLabel: function(element, message) {
                var label = this.errorsFor(element);
                if (label.length) {
                    label.removeClass().addClass(this.settings.errorClass);
                    label.attr("generated") && label.html(message);
                } else {
                    label = $("<" + this.settings.errorElement + "/>").attr({
                        "for": this.idOrName(element),
                        generated: true
                    }).addClass(this.settings.errorClass).html(message || "");
                    if (this.settings.wrapper) {
                        label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
                    }
                    if (!this.labelContainer.append(label).length) this.settings.errorPlacement ? this.settings.errorPlacement(label, $(element)) : label.insertAfter(element);
                }
                if (!message && this.settings.success) {
                    label.text("");
                    typeof this.settings.success == "string" ? label.addClass(this.settings.success) : this.settings.success(label);
                }
                this.toShow = this.toShow.add(label);
            },
            errorsFor: function(element) {
                var name = this.idOrName(element);
                return this.errors().filter(function() {
                    return $(this).attr('for') == name;
                });
            },
            idOrName: function(element) {
                return this.groups[element.name] || (this.checkable(element) ? element.name: element.id || element.name);
            },
            checkable: function(element) {
                return /radio|checkbox/i.test(element.type);
            },
            findByName: function(name) {
                var form = this.currentForm;
                return $(document.getElementsByName(name)).map(function(index, element) {
                    return element.form == form && element.name == name && element || null;
                });
            },
            getLength: function(value, element) {
                switch (element.nodeName.toLowerCase()) {
                case 'select':
                    return $("option:selected", element).length;
                case 'input':
                    if (this.checkable(element)) return this.findByName(element.name).filter(':checked').length;
                }
                return value.length;
            },
            depend: function(param, element) {
                return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
            },
            dependTypes: {
                "boolean": function(param, element) {
                    return param;
                },
                "string": function(param, element) {
                    return !! $(param, element.form).length;

                },
                "function": function(param, element) {
                    return param(element);
                }
            },
            optional: function(element) {
                return ! $.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
            },
            startRequest: function(element) {
                if (!this.pending[element.name]) {
                    this.pendingRequest++;
                    this.pending[element.name] = true;
                }
            },
            stopRequest: function(element, valid) {
                this.pendingRequest--;
                if (this.pendingRequest < 0) this.pendingRequest = 0;
                delete this.pending[element.name];
                if (valid && this.pendingRequest == 0 && this.formSubmitted && this.form()) {
                    $(this.currentForm).submit();
                    this.formSubmitted = false;
                } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
                    $(this.currentForm).triggerHandler("invalid-form", [this]);
                    this.formSubmitted = false;
                }
            },
            previousValue: function(element) {
                return $.data(element, "previousValue") || $.data(element, "previousValue", {
                    old: null,
                    valid: true,
                    message: this.defaultMessage(element, "remote")
                });
            }
        },
        classRuleSettings: {
            required: {
                required: true
            },
            email: {
                email: true
            },
            url: {
                url: true
            },
            date: {
                date: true
            },
            dateISO: {
                dateISO: true
            },
            dateDE: {
                dateDE: true
            },
            number: {
                number: true
            },
            numberDE: {
                numberDE: true
            },
            digits: {
                digits: true
            },
            creditcard: {
                creditcard: true
            }
        },
        addClassRules: function(className, rules) {
            className.constructor == String ? this.classRuleSettings[className] = rules: $.extend(this.classRuleSettings, className);
        },
        classRules: function(element) {
            var rules = {};
            var classes = $(element).attr('class');
            classes && $.each(classes.split(' '), 
            function() {
                if (this in $.validator.classRuleSettings) {
                    $.extend(rules, $.validator.classRuleSettings[this]);
                }
            });
            return rules;
        },
        attributeRules: function(element) {
            var rules = {};
            var $element = $(element);
            for (method in $.validator.methods) {
                var value = $element.attr(method);
                if (value) {
                    rules[method] = value;
                }
            }
            if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
                delete rules.maxlength;
            }
            return rules;
        },
        metadataRules: function(element) {
            if (!$.metadata) return {};
            var meta = $.data(element.form, 'validator').settings.meta;
            return meta ? $(element).metadata()[meta] : $(element).metadata();
        },
        staticRules: function(element) {
            var rules = {};
            var validator = $.data(element.form, 'validator');
            if (validator.settings.rules) {
                rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
            }
            return rules;
        },
        normalizeRules: function(rules, element) {
            $.each(rules, 
            function(prop, val) {
                if (val === false) {
                    delete rules[prop];
                    return;
                }
                if (val.param || val.depends) {
                    var keepRule = true;
                    switch (typeof val.depends) {
                    case "string":
                        keepRule = !!$(val.depends, element.form).length;
                        break;
                    case "function":
                        keepRule = val.depends.call(element, element);
                        break;
                    }
                    if (keepRule) {
                        rules[prop] = val.param !== undefined ? val.param: true;
                    } else {
                        delete rules[prop];
                    }
                }
            });
            $.each(rules, 
            function(rule, parameter) {
                rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
            });
            $.each(['minlength', 'maxlength', 'min', 'max'], 
            function() {
                if (rules[this]) {
                    rules[this] = Number(rules[this]);
                }
            });
            $.each(['rangelength', 'range'], 
            function() {
                if (rules[this]) {
                    rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
                }
            });
            if ($.validator.autoCreateRanges) {
                if (rules.min && rules.max) {
                    rules.range = [rules.min, rules.max];
                    delete rules.min;
                    delete rules.max;
                }
                if (rules.minlength && rules.maxlength) {
                    rules.rangelength = [rules.minlength, rules.maxlength];
                    delete rules.minlength;
                    delete rules.maxlength;
                }
            }
            if (rules.messages) {
                delete rules.messages;
            }
            return rules;
        },
        normalizeRule: function(data) {
            if (typeof data == "string") {
                var transformed = {};
                $.each(data.split(/\s/), 
                function() {
                    transformed[this] = true;
                });
                data = transformed;
            }
            return data;
        },
        addMethod: function(name, method, message) {
            $.validator.methods[name] = method;
            $.validator.messages[name] = message != undefined ? message: $.validator.messages[name];
            if (method.length < 3) {
                $.validator.addClassRules(name, $.validator.normalizeRule(name));
            }
        },
        methods: {
            required: function(value, element, param) {
                if (!this.depend(param, element)) return "dependency-mismatch";
                switch (element.nodeName.toLowerCase()) {
                case 'select':
                    var val = $(element).val();
                    return val && val.length > 0;
                case 'input':
                    if (this.checkable(element)) return this.getLength(value, element) > 0;
                default:
                    return $.trim(value).length > 0;
                }
            },
            remote: function(value, element, param) {
                if (this.optional(element)) return "dependency-mismatch";
                var previous = this.previousValue(element);
                if (!this.settings.messages[element.name]) this.settings.messages[element.name] = {};
                previous.originalMessage = this.settings.messages[element.name].remote;
                this.settings.messages[element.name].remote = previous.message;
                param = typeof param == "string" && {
                    url: param
                } || param;
                if (previous.old !== value) {
                    previous.old = value;
                    var validator = this;
                    this.startRequest(element);
                    var data = {};
                    data[element.name] = value;
                    $.ajax($.extend(true, {
                        url: param,
                        mode: "abort",
                        port: "validate" + element.name,
                        dataType: "json",
                        data: data,
                        success: function(response) {
                            validator.settings.messages[element.name].remote = previous.originalMessage;
                            var valid = response === true;
                            if (valid) {
                                var submitted = validator.formSubmitted;
                                validator.prepareElement(element);
                                validator.formSubmitted = submitted;
                                validator.successList.push(element);
                                validator.showErrors();
                            } else {
                                var errors = {};
                                var message = (previous.message = response || validator.defaultMessage(element, "remote"));
                                errors[element.name] = $.isFunction(message) ? message(value) : message;
                                validator.showErrors(errors);
                            }
                            previous.valid = valid;
                            validator.stopRequest(element, valid);
                        }
                    },
                    param));
                    return "pending";
                } else if (this.pending[element.name]) {
                    return "pending";
                }
                return previous.valid;
            },
            minlength: function(value, element, param) {
                return this.optional(element) || this.getLength($.trim(value), element) >= param;
            },
            maxlength: function(value, element, param) {
                return this.optional(element) || this.getLength($.trim(value), element) <= param;
            },
            rangelength: function(value, element, param) {
                var length = this.getLength($.trim(value), element);
                return this.optional(element) || (length >= param[0] && length <= param[1]);
            },
            min: function(value, element, param) {
                return this.optional(element) || value >= param;
            },
            max: function(value, element, param) {
                return this.optional(element) || value <= param;
            },
            range: function(value, element, param) {
                return this.optional(element) || (value >= param[0] && value <= param[1]);
            },
            email: function(value, element) {
                return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
            },
            url: function(value, element) {
                return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
            },
            date: function(value, element) {
                return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
            },
            dateISO: function(value, element) {
                return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
            },
            number: function(value, element) {
                return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
            },
            digits: function(value, element) {
                return this.optional(element) || /^\d+$/.test(value);
            },
            creditcard: function(value, element) {
                if (this.optional(element)) return "dependency-mismatch";
                if (/[^0-9-]+/.test(value)) return false;
                var nCheck = 0,
                nDigit = 0,
                bEven = false;
                value = value.replace(/\D/g, "");
                for (var n = value.length - 1; n >= 0; n--) {
                    var cDigit = value.charAt(n);
                    var nDigit = parseInt(cDigit, 10);
                    if (bEven) {
                        if ((nDigit *= 2) > 9) nDigit -= 9;
                    }
                    nCheck += nDigit;
                    bEven = !bEven;
                }
                return (nCheck % 10) == 0;
            },
            accept: function(value, element, param) {
                param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
                return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
            },
            equalTo: function(value, element, param) {
                var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", 
                function() {
                    $(element).valid();
                });
                return value == target.val();
            }
        }
    });
    $.format = $.validator.format;
})(jQuery);; (function($) {
    var ajax = $.ajax;
    var pendingRequests = {};
    $.ajax = function(settings) {
        settings = $.extend(settings, $.extend({},
        $.ajaxSettings, settings));
        var port = settings.port;
        if (settings.mode == "abort") {
            if (pendingRequests[port]) {
                pendingRequests[port].abort();
            }
            return (pendingRequests[port] = ajax.apply(this, arguments));
        }
        return ajax.apply(this, arguments);
    };
})(jQuery);; (function($) {
    if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
        $.each({
            focus: 'focusin',
            blur: 'focusout'
        },
        function(original, fix) {
            $.event.special[fix] = {
                setup: function() {
                    this.addEventListener(original, handler, true);
                },
                teardown: function() {
                    this.removeEventListener(original, handler, true);
                },
                handler: function(e) {
                    arguments[0] = $.event.fix(e);
                    arguments[0].type = fix;
                    return $.event.handle.apply(this, arguments);
                }
            };
            function handler(e) {
                e = $.event.fix(e);
                e.type = fix;
                return $.event.handle.call(this, e);
            }
        });
    };
    $.extend($.fn, {
        validateDelegate: function(delegate, type, handler) {
            return this.bind(type, 
            function(event) {
                var target = $(event.target);
                if (target.is(delegate)) {
                    return handler.apply(target, arguments);
                }
            });
        }
    });
})(jQuery);


/**
 * @name 		:	jquery-lightbox-0.5.js
 * @type		:	plugin
 * @explain		:	Leandro Vieira Pinho - http://leandrovieira.com
 */
 (function(a) {
    a.fn.lightBox = function(p) {
        p = jQuery.extend({
            overlayBgColor: "#000",
            overlayOpacity: 0.8,
            fixedNavigation: false,
            imageLoading: "images/lightbox-ico-loading.gif",
            imageBtnPrev: "images/lightbox-btn-prev.gif",
            imageBtnNext: "images/lightbox-btn-next.gif",
            imageBtnClose: "images/lightbox-btn-close.gif",
            imageBlank: "images/lightbox-blank.gif",
            containerBorderSize: 10,
            containerResizeSpeed: 400,
            txtImage: "Image",
            txtOf: "of",
            keyToClose: "c",
            keyToPrev: "p",
            keyToNext: "n",
            imageArray: [],
            activeImage: 0
        },
        p);
        var i = this;
        function r() {
            o(this, i);
            return false
        }
        function o(v, u) {
            a("embed, object, select").css({
                visibility: "hidden"
            });
            c();
            p.imageArray.length = 0;
            p.activeImage = 0;
            if (u.length == 1) {
                p.imageArray.push(new Array(v.getAttribute("href"), v.getAttribute("title")))
            } else {
                for (var t = 0; t < u.length; t++) {
                    p.imageArray.push(new Array(u[t].getAttribute("href"), u[t].getAttribute("title")))
                }
            }
            while (p.imageArray[p.activeImage][0] != v.getAttribute("href")) {
                p.activeImage++
            }
            l()
        }
        function c() {
            a("body").append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + p.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + p.imageBtnClose + '"></a></div></div></div></div>');
            var t = f();
            a("#jquery-overlay").css({
                backgroundColor: p.overlayBgColor,
                opacity: p.overlayOpacity,
                width: t[0],
                height: t[1]
            }).fadeIn();
            var u = h();
            a("#jquery-lightbox").css({
                top: u[1] + (t[3] / 10),
                left: u[0]
            }).show();
            a("#jquery-overlay,#jquery-lightbox").click(function() {
                b()
            });
            a("#lightbox-loading-link,#lightbox-secNav-btnClose").click(function() {
                b();
                return false
            });
            a(window).resize(function() {
                var v = f();
                a("#jquery-overlay").css({
                    width: v[0],
                    height: v[1]
                });
                var w = h();
                a("#jquery-lightbox").css({
                    top: w[1] + (v[3] / 10),
                    left: w[0]
                })
            })
        }
        function l() {
            a("#lightbox-loading").show();
            if (p.fixedNavigation) {
                a("#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber").hide()
            } else {
                a("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber").hide()
            }
            var t = new Image();
            t.onload = function() {
                a("#lightbox-image").attr("src", p.imageArray[p.activeImage][0]);
                j(t.width, t.height);
                t.onload = function() {}
            };
            t.src = p.imageArray[p.activeImage][0]
        }
        function j(w, z) {
            var t = a("#lightbox-container-image-box").width();
            var y = a("#lightbox-container-image-box").height();
            var x = (w + (p.containerBorderSize * 2));
            var v = (z + (p.containerBorderSize * 2));
            var u = t - x;
            var A = y - v;
            a("#lightbox-container-image-box").animate({
                width: x,
                height: v
            },
            p.containerResizeSpeed, 
            function() {
                g()
            });
            if ((u == 0) && (A == 0)) {
                if (a.browser.msie) {
                    n(250)
                } else {
                    n(100)
                }
            }
            a("#lightbox-container-image-data-box").css({
                width: w
            });
            a("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css({
                height: z + (p.containerBorderSize * 2)
            })
        }
        function g() {
            a("#lightbox-loading").hide();
            a("#lightbox-image").fadeIn(function() {
                k();
                s()
            });
            q()
        }
        function k() {
            a("#lightbox-container-image-data-box").slideDown("fast");
            a("#lightbox-image-details-caption").hide();
            if (p.imageArray[p.activeImage][1]) {
                a("#lightbox-image-details-caption").html(p.imageArray[p.activeImage][1]).show()
            }
            if (p.imageArray.length > 1) {
                a("#lightbox-image-details-currentNumber").html(p.txtImage + " " + (p.activeImage + 1) + " " + p.txtOf + " " + p.imageArray.length).show()
            }
        }
        function s() {
            a("#lightbox-nav").show();
            a("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css({
                background: "transparent url(" + p.imageBlank + ") no-repeat"
            });
            if (p.activeImage != 0) {
                if (p.fixedNavigation) {
                    a("#lightbox-nav-btnPrev").css({
                        background: "url(" + p.imageBtnPrev + ") left 15% no-repeat"
                    }).unbind().bind("click", 
                    function() {
                        p.activeImage = p.activeImage - 1;
                        l();
                        return false
                    })
                } else {
                    a("#lightbox-nav-btnPrev").unbind().hover(function() {
                        a(this).css({
                            background: "url(" + p.imageBtnPrev + ") left 15% no-repeat"
                        })
                    },
                    function() {
                        a(this).css({
                            background: "transparent url(" + p.imageBlank + ") no-repeat"
                        })
                    }).show().bind("click", 
                    function() {
                        p.activeImage = p.activeImage - 1;
                        l();
                        return false
                    })
                }
            }
            if (p.activeImage != (p.imageArray.length - 1)) {
                if (p.fixedNavigation) {
                    a("#lightbox-nav-btnNext").css({
                        background: "url(" + p.imageBtnNext + ") right 15% no-repeat"
                    }).unbind().bind("click", 
                    function() {
                        p.activeImage = p.activeImage + 1;
                        l();
                        return false
                    })
                } else {
                    a("#lightbox-nav-btnNext").unbind().hover(function() {
                        a(this).css({
                            background: "url(" + p.imageBtnNext + ") right 15% no-repeat"
                        })
                    },
                    function() {
                        a(this).css({
                            background: "transparent url(" + p.imageBlank + ") no-repeat"
                        })
                    }).show().bind("click", 
                    function() {
                        p.activeImage = p.activeImage + 1;
                        l();
                        return false
                    })
                }
            }
            m()
        }
        function m() {
            a(document).keydown(function(t) {
                d(t)
            })
        }
        function e() {
            a(document).unbind()
        }
        function d(t) {
            if (t == null) {
                keycode = event.keyCode;
                escapeKey = 27
            } else {
                keycode = t.keyCode;
                escapeKey = t.DOM_VK_ESCAPE
            }
            key = String.fromCharCode(keycode).toLowerCase();
            if ((key == p.keyToClose) || (key == "x") || (keycode == escapeKey)) {
                b()
            }
            if ((key == p.keyToPrev) || (keycode == 37)) {
                if (p.activeImage != 0) {
                    p.activeImage = p.activeImage - 1;
                    l();
                    e()
                }
            }
            if ((key == p.keyToNext) || (keycode == 39)) {
                if (p.activeImage != (p.imageArray.length - 1)) {
                    p.activeImage = p.activeImage + 1;
                    l();
                    e()
                }
            }
        }
        function q() {
            if ((p.imageArray.length - 1) > p.activeImage) {
                objNext = new Image();
                objNext.src = p.imageArray[p.activeImage + 1][0]
            }
            if (p.activeImage > 0) {
                objPrev = new Image();
                objPrev.src = p.imageArray[p.activeImage - 1][0]
            }
        }
        function b() {
            a("#jquery-lightbox").remove();
            a("#jquery-overlay").fadeOut(function() {
                a("#jquery-overlay").remove()
            });
            a("embed, object, select").css({
                visibility: "visible"
            })
        }
        function f() {
            var v,
            t;
            if (window.innerHeight && window.scrollMaxY) {
                v = window.innerWidth + window.scrollMaxX;
                t = window.innerHeight + window.scrollMaxY
            } else {
                if (document.body.scrollHeight > document.body.offsetHeight) {
                    v = document.body.scrollWidth;
                    t = document.body.scrollHeight
                } else {
                    v = document.body.offsetWidth;
                    t = document.body.offsetHeight
                }
            }
            var u,
            w;
            if (self.innerHeight) {
                if (document.documentElement.clientWidth) {
                    u = document.documentElement.clientWidth
                } else {
                    u = self.innerWidth
                }
                w = self.innerHeight
            } else {
                if (document.documentElement && document.documentElement.clientHeight) {
                    u = document.documentElement.clientWidth;
                    w = document.documentElement.clientHeight
                } else {
                    if (document.body) {
                        u = document.body.clientWidth;
                        w = document.body.clientHeight
                    }
                }
            }
            if (t < w) {
                pageHeight = w
            } else {
                pageHeight = t
            }
            if (v < u) {
                pageWidth = v
            } else {
                pageWidth = u
            }
            arrayPageSize = new Array(pageWidth, pageHeight, u, w);
            return arrayPageSize
        }
        function h() {
            var u,
            t;
            if (self.pageYOffset) {
                t = self.pageYOffset;
                u = self.pageXOffset
            } else {
                if (document.documentElement && document.documentElement.scrollTop) {
                    t = document.documentElement.scrollTop;
                    u = document.documentElement.scrollLeft
                } else {
                    if (document.body) {
                        t = document.body.scrollTop;
                        u = document.body.scrollLeft
                    }
                }
            }
            arrayPageScroll = new Array(u, t);
            return arrayPageScroll
        }
        function n(v) {
            var u = new Date();
            t = null;
            do {
                var t = new Date()
            }
            while (t - u < v)
        }
        return this.unbind("click").click(r)
    }
})(jQuery); (
function(a) {
    a.fn.extend({
        banner_thaw: function(b) {
            b = a.extend({
                thumbObj: null,
                botPrev: null,
                botNext: null,
                thumbNowClass: "hover",
                thumbOverEvent: true,
                slideTime: 1000,
                autoChange: true,
                clickFalse: true,
                overStop: true,
                changeTime: 5000,
                delayTime: 300
            },
            b || {});
            var h = a(this);
            var k;
            var m = h.size();
            var e = 0;
            var g;
            var c;
            var f;
            function d() {
                if (e != g) {
                    if (b.thumbObj != null) {
                        a(b.thumbObj).removeClass(b.thumbNowClass).eq(g).addClass(b.thumbNowClass)
                    }
                    if (b.slideTime <= 0) {
                        h.eq(e).hide();
                        h.eq(g).show()
                    } else {
                        h.eq(e).fadeOut(b.slideTime);
                        h.eq(g).fadeIn(b.slideTime)
                    }
                    e = g;
                    if (b.autoChange == true) {
                        clearInterval(c);
                        c = setInterval(l, b.changeTime)
                    }
                }
            }
            function l() {
                g = (e + 1) % m;
                d()
            }
            h.hide().eq(0).show();
            if (b.thumbObj != null) {
                k = a(b.thumbObj);
                k.removeClass(b.thumbNowClass).eq(0).addClass(b.thumbNowClass);
                k.click(function() {
                    g = k.index(a(this));
                    d();
                    if (b.clickFalse == true) {
                        return false
                    }
                });
                if (b.thumbOverEvent == true) {
                    k.mouseenter(function() {
                        g = k.index(a(this));
                        f = setTimeout(d, b.delayTime)
                    });
                    k.mouseleave(function() {
                        clearTimeout(f)
                    })
                }
            }
            if (b.botNext != null) {
                a(b.botNext).click(function() {
                    if (h.queue().length < 1) {
                        l()
                    }
                    return false
                })
            }
            if (b.botPrev != null) {
                a(b.botPrev).click(function() {
                    if (h.queue().length < 1) {
                        g = (e + m - 1) % m;
                        d()
                    }
                    return false
                })
            }
            if (b.autoChange == true) {
                c = setInterval(l, b.changeTime);
                if (b.overStop == true) {
                    h.mouseenter(function() {
                        clearInterval(c)
                    });
                    h.mouseleave(function() {
                        c = setInterval(l, b.changeTime)
                    })
                }
            }
        }
    })
})(jQuery);
var zoomOverlayVeto = false;
var zoomOverlayOn = false;
var posx = 0;
var posy = 0;
var myWidth = 0,
myHeight = 0;
showZoom = function(h) {
    if (!h) {
        var h = window.event
    }
    if (h.pageX || h.pageY) {
        posx = h.pageX;
        posy = h.pageY
    } else {
        if (h.clientX || h.clientY) {
            posx = h.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            posy = h.clientY + document.body.scrollTop + document.documentElement.scrollTop
        }
    }
    var l = $("#picture").offset();
    var k = $("#picture").width();
    var g = $("#picture").height();
    if (!zoomOverlayVeto && (posx > l.left && posx < (l.left + k) && posy > l.top && posy < (l.top + g))) {
        $("#zoom_image_box").css("left", "365px");
        $("#zoom_image_box").css("top", "00px");
        var f = (posx - l.left);
        var b = (posy - l.top);
        var d = (f / k) * 100;
        var c = (b / g) * 100;
        var a = d + "% " + c + "%";
        $("#zoom_image").css("background-position", a);
        $("#zoom_image_box").show();
        zoomOverlayOn = true
    } else {
        $("#zoom_image_box").hide();
        zoomOverlayOn = false
    }
};
