; // Catches the stray unterminated line.
/**
* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/
(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(i) { var g = i || window.event, f = [].slice.call(arguments, 1), j = 0, h = true, e = 0, d = 0; i = c.event.fix(g); i.type = "mousewheel"; if (i.wheelDelta) { j = i.wheelDelta / 120 } if (i.detail) { j = -i.detail / 3 } d = j; if (g.axis !== undefined && g.axis === g.HORIZONTAL_AXIS) { d = 0; e = -1 * j } if (g.wheelDeltaY !== undefined) { d = g.wheelDeltaY / 120 } if (g.wheelDeltaX !== undefined) { e = -1 * g.wheelDeltaX / 120 } f.unshift(i, j, e, d); return c.event.handle.apply(this, f) } })(jQuery);


/**
* @author trixta
* @version 1.2
*/
(function ($) { var mwheelI = { pos: [-260, -260] }, minDif = 3, doc = document, root = doc.documentElement, body = doc.body, longDelay, shortDelay; function unsetPos() { if (this === mwheelI.elem) { mwheelI.pos = [-260, -260]; mwheelI.elem = false; minDif = 3; } } $.event.special.mwheelIntent = { setup: function () { var jElm = $(this).bind('mousewheel', $.event.special.mwheelIntent.handler); if (this !== doc && this !== root && this !== body) { jElm.bind('mouseleave', unsetPos); } jElm = null; return true; }, teardown: function () { $(this).unbind('mousewheel', $.event.special.mwheelIntent.handler).unbind('mouseleave', unsetPos); return true; }, handler: function (e, d) { var pos = [e.clientX, e.clientY]; if (this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif || Math.abs(mwheelI.pos[1] - pos[1]) > minDif) { mwheelI.elem = this; mwheelI.pos = pos; minDif = 250; clearTimeout(shortDelay); shortDelay = setTimeout(function () { minDif = 10; }, 200); clearTimeout(longDelay); longDelay = setTimeout(function () { minDif = 3; }, 1500); e = $.extend({}, e, { type: 'mwheelIntent' }); return $.event.handle.apply(this, arguments); } } }; $.fn.extend({ mwheelIntent: function (fn) { return fn ? this.bind("mwheelIntent", fn) : this.trigger("mwheelIntent"); }, unmwheelIntent: function (fn) { return this.unbind("mwheelIntent", fn); } }); $(function () { body = doc.body; $(doc).bind('mwheelIntent.mwheelIntentDefault', $.noop); }); })(jQuery);

/*
* jScrollPane - v2.0.0beta6 - 2010-12-06
* http://jscrollpane.kelvinluck.com/
*
* Copyright (c) 2010 Kelvin Luck
* Dual licensed under the MIT and GPL licenses.
*/
(function (b, a, c) {
    b.fn.jScrollPane = function (f) {
        function d(C, L) {
            var au, N = this,
                V, ah, v, aj, Q, W, y, q, av, aB, ap, i, H, h, j, X, R, al, U, t, A, am, ac, ak, F, l, ao, at, x, aq, aE, g, aA, ag = true,
                M = true,
                aD = false,
                k = false,
                Z = b.fn.mwheelIntent ? "mwheelIntent.jsp" : "mousewheel.jsp";
            aE = C.css("paddingTop") + " " + C.css("paddingRight") + " " + C.css("paddingBottom") + " " + C.css("paddingLeft");
            g = (parseInt(C.css("paddingLeft")) || 0) + (parseInt(C.css("paddingRight")) || 0);
            an(L);

            function an(aH) {
                var aL, aK, aJ, aG, aF, aI;
                au = aH;
                if (V == c) {
                    C.css({
                        overflow: "hidden",
                        padding: 0
                    });
                    ah = C.innerWidth() + g;
                    v = C.innerHeight();
                    C.width(ah);
                    V = b('<div class="jspPane" />').wrap(b('<div class="jspContainer" />').css({
                        width: ah + "px",
                        height: v + "px"
                    }));
                    C.wrapInner(V.parent());
                    aj = C.find(">.jspContainer");
                    V = aj.find(">.jspPane");
                    V.css("padding", aE)
                } else {
                    C.css("width", "");
                    aI = C.outerWidth() + g != ah || C.outerHeight() != v;
                    if (aI) {
                        ah = C.innerWidth() + g;
                        v = C.innerHeight();
                        aj.css({
                            width: ah + "px",
                            height: v + "px"
                        })
                    }
                    aA = V.innerWidth();
                    if (!aI && V.outerWidth() == Q && V.outerHeight() == W) {
                        if (aB || av) {
                            V.css("width", aA + "px");
                            C.css("width", (aA + g) + "px")
                        }
                        return
                    }
                    V.css("width", "");
                    C.css("width", (ah) + "px");
                    aj.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()
                }
                aL = V.clone().css("position", "absolute");
                aK = b('<div style="width:1px; position: relative;" />').append(aL);
                b("body").append(aK);
                Q = Math.max(V.outerWidth(), aL.outerWidth());
                aK.remove();
                W = V.outerHeight();
                y = Q / ah;
                q = W / v;
                av = q > 1;
                aB = y > 1;
                if (!(aB || av)) {
                    C.removeClass("jspScrollable");
                    V.css({
                        top: 0,
                        width: aj.width() - g
                    });
                    n();
                    D();
                    O();
                    w();
                    af()
                } else {
                    C.addClass("jspScrollable");
                    aJ = au.maintainPosition && (H || X);
                    if (aJ) {
                        aG = ay();
                        aF = aw()
                    }
                    aC();
                    z();
                    E();
                    if (aJ) {
                        K(aG);
                        J(aF)
                    }
                    I();
                    ad();
                    if (au.enableKeyboardNavigation) {
                        P()
                    }
                    if (au.clickOnTrack) {
                        p()
                    }
                    B();
                    if (au.hijackInternalLinks) {
                        m()
                    }
                }
                if (au.autoReinitialise && !aq) {
                    aq = setInterval(function () {
                        an(au)
                    }, au.autoReinitialiseDelay)
                } else {
                    if (!au.autoReinitialise && aq) {
                        clearInterval(aq)
                    }
                }
                C.trigger("jsp-initialised", [aB || av])
            }
            function aC() {
                if (av) {
                    aj.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'), b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'), b('<div class="jspDragBottom" />'))), b('<div class="jspCap jspCapBottom" />')));
                    R = aj.find(">.jspVerticalBar");
                    al = R.find(">.jspTrack");
                    ap = al.find(">.jspDrag");
                    if (au.showArrows) {
                        am = b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp", az(0, -1)).bind("click.jsp", ax);
                        ac = b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp", az(0, 1)).bind("click.jsp", ax);
                        if (au.arrowScrollOnHover) {
                            am.bind("mouseover.jsp", az(0, -1, am));
                            ac.bind("mouseover.jsp", az(0, 1, ac))
                        }
                        ai(al, au.verticalArrowPositions, am, ac)
                    }
                    t = v;
                    aj.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function () {
                        t -= b(this).outerHeight()
                    });
                    ap.hover(function () {
                        ap.addClass("jspHover")
                    }, function () {
                        ap.removeClass("jspHover")
                    }).bind("mousedown.jsp", function (aF) {
                        b("html").bind("dragstart.jsp selectstart.jsp", function () {
                            return false
                        });
                        ap.addClass("jspActive");
                        var s = aF.pageY - ap.position().top;
                        b("html").bind("mousemove.jsp", function (aG) {
                            S(aG.pageY - s, false)
                        }).bind("mouseup.jsp mouseleave.jsp", ar);
                        return false
                    });
                    o()
                }
            }
            function o() {
                al.height(t + "px");
                H = 0;
                U = au.verticalGutter + al.outerWidth();
                V.width(ah - U - g);
                if (R.position().left == 0) {
                    V.css("margin-left", U + "px")
                }
            }
            function z() {
                if (aB) {
                    aj.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'), b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'), b('<div class="jspDragRight" />'))), b('<div class="jspCap jspCapRight" />')));
                    ak = aj.find(">.jspHorizontalBar");
                    F = ak.find(">.jspTrack");
                    h = F.find(">.jspDrag");
                    if (au.showArrows) {
                        at = b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp", az(-1, 0)).bind("click.jsp", ax);
                        x = b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp", az(1, 0)).bind("click.jsp", ax);
                        if (au.arrowScrollOnHover) {
                            at.bind("mouseover.jsp", az(-1, 0, at));
                            x.bind("mouseover.jsp", az(1, 0, x))
                        }
                        ai(F, au.horizontalArrowPositions, at, x)
                    }
                    h.hover(function () {
                        h.addClass("jspHover")
                    }, function () {
                        h.removeClass("jspHover")
                    }).bind("mousedown.jsp", function (aF) {
                        b("html").bind("dragstart.jsp selectstart.jsp", function () {
                            return false
                        });
                        h.addClass("jspActive");
                        var s = aF.pageX - h.position().left;
                        b("html").bind("mousemove.jsp", function (aG) {
                            T(aG.pageX - s, false)
                        }).bind("mouseup.jsp mouseleave.jsp", ar);
                        return false
                    });
                    l = aj.innerWidth();
                    ae()
                } else {}
            }
            function ae() {
                aj.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function () {
                    l -= b(this).outerWidth()
                });
                F.width(l + "px");
                X = 0
            }
            function E() {
                if (aB && av) {
                    var aF = F.outerHeight(),
                        s = al.outerWidth();
                    t -= aF;
                    b(ak).find(">.jspCap:visible,>.jspArrow").each(function () {
                        l += b(this).outerWidth()
                    });
                    l -= s;
                    v -= s;
                    ah -= aF;
                    F.parent().append(b('<div class="jspCorner" />').css("width", aF + "px"));
                    o();
                    ae()
                }
                if (aB) {
                    V.width((aj.outerWidth() - g) + "px")
                }
                W = V.outerHeight();
                q = W / v;
                if (aB) {
                    ao = 1 / y * l;
                    if (ao > au.horizontalDragMaxWidth) {
                        ao = au.horizontalDragMaxWidth
                    } else {
                        if (ao < au.horizontalDragMinWidth) {
                            ao = au.horizontalDragMinWidth
                        }
                    }
                    h.width(ao + "px");
                    j = l - ao;
                    ab(X)
                }
                if (av) {
                    A = 1 / q * t;
                    if (A > au.verticalDragMaxHeight) {
                        A = au.verticalDragMaxHeight
                    } else {
                        if (A < au.verticalDragMinHeight) {
                            A = au.verticalDragMinHeight
                        }
                    }
                    ap.height(A + "px");
                    i = t - A;
                    aa(H)
                }
            }
            function ai(aG, aI, aF, s) {
                var aK = "before",
                    aH = "after",
                    aJ;
                if (aI == "os") {
                    aI = /Mac/.test(navigator.platform) ? "after" : "split"
                }
                if (aI == aK) {
                    aH = aI
                } else {
                    if (aI == aH) {
                        aK = aI;
                        aJ = aF;
                        aF = s;
                        s = aJ
                    }
                }
                aG[aK](aF)[aH](s)
            }
            function az(aF, s, aG) {
                return function () {
                    G(aF, s, this, aG);
                    this.blur();
                    return false
                }
            }
            function G(aH, aF, aK, aJ) {
                aK = b(aK).addClass("jspActive");
                var aI, s = function () {
                        if (aH != 0) {
                            T(X + aH * au.arrowButtonSpeed, false)
                        }
                        if (aF != 0) {
                            S(H + aF * au.arrowButtonSpeed, false)
                        }
                    },
                    aG = setInterval(s, au.arrowRepeatFreq);
                s();
                aI = aJ == c ? "mouseup.jsp" : "mouseout.jsp";
                aJ = aJ || b("html");
                aJ.bind(aI, function () {
                    aK.removeClass("jspActive");
                    clearInterval(aG);
                    aJ.unbind(aI)
                })
            }
            function p() {
                w();
                if (av) {
                    al.bind("mousedown.jsp", function (aH) {
                        if (aH.originalTarget == c || aH.originalTarget == aH.currentTarget) {
                            var aG = b(this),
                                s = setInterval(function () {
                                    var aI = aG.offset(),
                                        aJ = aH.pageY - aI.top;
                                    if (H + A < aJ) {
                                        S(H + au.trackClickSpeed)
                                    } else {
                                        if (aJ < H) {
                                            S(H - au.trackClickSpeed)
                                        } else {
                                            aF()
                                        }
                                    }
                                }, au.trackClickRepeatFreq),
                                aF = function () {
                                    s && clearInterval(s);
                                    s = null;
                                    b(document).unbind("mouseup.jsp", aF)
                                };
                            b(document).bind("mouseup.jsp", aF);
                            return false
                        }
                    })
                }
                if (aB) {
                    F.bind("mousedown.jsp", function (aH) {
                        if (aH.originalTarget == c || aH.originalTarget == aH.currentTarget) {
                            var aG = b(this),
                                s = setInterval(function () {
                                    var aI = aG.offset(),
                                        aJ = aH.pageX - aI.left;
                                    if (X + ao < aJ) {
                                        T(X + au.trackClickSpeed)
                                    } else {
                                        if (aJ < X) {
                                            T(X - au.trackClickSpeed)
                                        } else {
                                            aF()
                                        }
                                    }
                                }, au.trackClickRepeatFreq),
                                aF = function () {
                                    s && clearInterval(s);
                                    s = null;
                                    b(document).unbind("mouseup.jsp", aF)
                                };
                            b(document).bind("mouseup.jsp", aF);
                            return false
                        }
                    })
                }
            }
            function w() {
                F && F.unbind("mousedown.jsp");
                al && al.unbind("mousedown.jsp")
            }
            function ar() {
                b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");
                ap && ap.removeClass("jspActive");
                h && h.removeClass("jspActive")
            }
            function S(s, aF) {
                if (!av) {
                    return
                }
                if (s < 0) {
                    s = 0
                } else {
                    if (s > i) {
                        s = i
                    }
                }
                if (aF == c) {
                    aF = au.animateScroll
                }
                if (aF) {
                    N.animate(ap, "top", s, aa)
                } else {
                    ap.css("top", s);
                    aa(s)
                }
            }
            function aa(aF) {
                if (aF == c) {
                    aF = ap.position().top
                }
                aj.scrollTop(0);
                H = aF;
                var aI = H == 0,
                    aG = H == i,
                    aH = aF / i,
                    s = -aH * (W - v);
                if (ag != aI || aD != aG) {
                    ag = aI;
                    aD = aG;
                    C.trigger("jsp-arrow-change", [ag, aD, M, k])
                }
                u(aI, aG);
                V.css("top", s);
                C.trigger("jsp-scroll-y", [-s, aI, aG])
            }
            function T(aF, s) {
                if (!aB) {
                    return
                }
                if (aF < 0) {
                    aF = 0
                } else {
                    if (aF > j) {
                        aF = j
                    }
                }
                if (s == c) {
                    s = au.animateScroll
                }
                if (s) {
                    N.animate(h, "left", aF, ab)
                } else {
                    h.css("left", aF);
                    ab(aF)
                }
            }
            function ab(aF) {
                if (aF == c) {
                    aF = h.position().left
                }
                aj.scrollTop(0);
                X = aF;
                var aI = X == 0,
                    aH = X == j,
                    aG = aF / j,
                    s = -aG * (Q - ah);
                if (M != aI || k != aH) {
                    M = aI;
                    k = aH;
                    C.trigger("jsp-arrow-change", [ag, aD, M, k])
                }
                r(aI, aH);
                V.css("left", s);
                C.trigger("jsp-scroll-x", [-s, aI, aH])
            }
            function u(aF, s) {
                if (au.showArrows) {
                    am[aF ? "addClass" : "removeClass"]("jspDisabled");
                    ac[s ? "addClass" : "removeClass"]("jspDisabled")
                }
            }
            function r(aF, s) {
                if (au.showArrows) {
                    at[aF ? "addClass" : "removeClass"]("jspDisabled");
                    x[s ? "addClass" : "removeClass"]("jspDisabled")
                }
            }
            function J(s, aF) {
                var aG = s / (W - v);
                S(aG * i, aF)
            }
            function K(aF, s) {
                var aG = aF / (Q - ah);
                T(aG * j, s)
            }
            function Y(aR, aM, aG) {
                var aK, aH, aI, s = 0,
                    aQ = 0,
                    aF, aL, aO, aN, aP;
                try {
                    aK = b(aR)
                } catch (aJ) {
                    return
                }
                aH = aK.outerHeight();
                aI = aK.outerWidth();
                aj.scrollTop(0);
                aj.scrollLeft(0);
                while (!aK.is(".jspPane")) {
                    s += aK.position().top;
                    aQ += aK.position().left;
                    aK = aK.offsetParent();
                    if (/^body|html$/i.test(aK[0].nodeName)) {
                        return
                    }
                }
                aF = aw();
                aL = aF + v;
                if (s < aF || aM) {
                    aN = s - au.verticalGutter
                } else {
                    if (s + aH > aL) {
                        aN = s - v + aH + au.verticalGutter
                    }
                }
                if (aN) {
                    J(aN, aG)
                }
                viewportLeft = ay();
                aO = viewportLeft + ah;
                if (aQ < viewportLeft || aM) {
                    aP = aQ - au.horizontalGutter
                } else {
                    if (aQ + aI > aO) {
                        aP = aQ - ah + aI + au.horizontalGutter
                    }
                }
                if (aP) {
                    K(aP, aG)
                }
            }
            function ay() {
                return -V.position().left
            }
            function aw() {
                return -V.position().top
            }
            function ad() {
                aj.unbind(Z).bind(Z, function (aI, aJ, aH, aF) {
                    var aG = X,
                        s = H;
                    T(X + aH * au.mouseWheelSpeed * ah / (Q - ah), false);
                    S(H - aF * au.mouseWheelSpeed * v / (W - v), false);
                    return aG == X && s == H
                })
            }
            function n() {
                aj.unbind(Z)
            }
            function ax() {
                return false
            }
            function I() {
                V.unbind("focus.jsp").bind("focus.jsp", function (s) {
                    if (s.target === V[0]) {
                        return
                    }
                    Y(s.target, false)
                })
            }
            function D() {
                V.unbind("focus.jsp")
            }
            function P() {
                var aF, s;
                C.attr("tabindex", 0).unbind("keydown.jsp").bind("keydown.jsp", function (aJ) {
                    if (aJ.target !== C[0]) {
                        return
                    }
                    var aH = X,
                        aG = H,
                        aI = aF ? 2 : 16;
                    switch (aJ.keyCode) {
                    case 40:
                        S(H + aI, false);
                        break;
                    case 38:
                        S(H - aI, false);
                        break;
                    case 34:
                    case 32:
                        J(aw() + Math.max(32, v) - 16);
                        break;
                    case 33:
                        J(aw() - v + 16);
                        break;
                    case 35:
                        J(W - v);
                        break;
                    case 36:
                        J(0);
                        break;
                    case 39:
                        T(X + aI, false);
                        break;
                    case 37:
                        T(X - aI, false);
                        break
                    }
                    if (!(aH == X && aG == H)) {
                        aF = true;
                        clearTimeout(s);
                        s = setTimeout(function () {
                            aF = false
                        }, 260);
                        return false
                    }
                });
                if (au.hideFocus) {
                    C.css("outline", "none");
                    if ("hideFocus" in aj[0]) {
                        C.attr("hideFocus", true)
                    }
                } else {
                    C.css("outline", "");
                    if ("hideFocus" in aj[0]) {
                        C.attr("hideFocus", false)
                    }
                }
            }
            function O() {
                C.attr("tabindex", "-1").removeAttr("tabindex").unbind("keydown.jsp")
            }
            function B() {
                if (location.hash && location.hash.length > 1) {
                    var aG, aF;
                    try {
                        aG = b(location.hash)
                    } catch (s) {
                        return
                    }
                    if (aG.length && V.find(aG)) {
                        if (aj.scrollTop() == 0) {
                            aF = setInterval(function () {
                                if (aj.scrollTop() > 0) {
                                    Y(location.hash, true);
                                    b(document).scrollTop(aj.position().top);
                                    clearInterval(aF)
                                }
                            }, 50)
                        } else {
                            Y(location.hash, true);
                            b(document).scrollTop(aj.position().top)
                        }
                    }
                }
            }
            function af() {
                b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")
            }
            function m() {
                af();
                b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack", function () {
                    var s = this.href.split("#"),
                        aF;
                    if (s.length > 1) {
                        aF = s[1];
                        if (aF.length > 0 && V.find("#" + aF).length > 0) {
                            Y("#" + aF, true);
                            return false
                        }
                    }
                })
            }
            b.extend(N, {
                reinitialise: function (aF) {
                    aF = b.extend({}, aF, au);
                    an(aF)
                },
                scrollToElement: function (aG, aF, s) {
                    Y(aG, aF, s)
                },
                scrollTo: function (aG, s, aF) {
                    K(aG, aF);
                    J(s, aF)
                },
                scrollToX: function (aF, s) {
                    K(aF, s)
                },
                scrollToY: function (s, aF) {
                    J(s, aF)
                },
                scrollBy: function (aF, s, aG) {
                    N.scrollByX(aF, aG);
                    N.scrollByY(s, aG)
                },
                scrollByX: function (s, aG) {
                    var aF = ay() + s,
                        aH = aF / (Q - ah);
                    T(aH * j, aG)
                },
                scrollByY: function (s, aG) {
                    var aF = aw() + s,
                        aH = aF / (W - v);
                    S(aH * i, aG)
                },
                animate: function (aF, aI, s, aH) {
                    var aG = {};
                    aG[aI] = s;
                    aF.animate(aG, {
                        duration: au.animateDuration,
                        ease: au.animateEase,
                        queue: false,
                        step: aH
                    })
                },
                getContentPositionX: function () {
                    return ay()
                },
                getContentPositionY: function () {
                    return aw()
                },
                getIsScrollableH: function () {
                    return aB
                },
                getIsScrollableV: function () {
                    return av
                },
                getContentPane: function () {
                    return V
                },
                scrollToBottom: function (s) {
                    S(i, s)
                },
                hijackInternalLinks: function () {
                    m()
                }
            })
        }
        f = b.extend({}, b.fn.jScrollPane.defaults, f);
        var e;
        this.each(function () {
            var g = b(this),
                h = g.data("jsp");
            if (h) {
                h.reinitialise(f)
            } else {
                h = new d(g, f);
                g.data("jsp", h)
            }
            e = e ? e.add(g) : g
        });
        return e
    };
    b.fn.jScrollPane.defaults = {
        showArrows: false,
        maintainPosition: true,
        clickOnTrack: true,
        autoReinitialise: false,
        autoReinitialiseDelay: 500,
        verticalDragMinHeight: 0,
        verticalDragMaxHeight: 99999,
        horizontalDragMinWidth: 0,
        horizontalDragMaxWidth: 99999,
        animateScroll: false,
        animateDuration: 300,
        animateEase: "linear",
        hijackInternalLinks: false,
        verticalGutter: 4,
        horizontalGutter: 4,
        mouseWheelSpeed: 30,
        arrowButtonSpeed: 30,
        arrowRepeatFreq: 100,
        arrowScrollOnHover: false,
        trackClickSpeed: 30,
        trackClickRepeatFreq: 100,
        verticalArrowPositions: "split",
        horizontalArrowPositions: "split",
        enableKeyboardNavigation: true,
        hideFocus: false
    }
})($, this);

/*----- Equal Heights -----*/
(function ($) {
    $.fn.equalHeights = function (minHeight, maxHeight) {
        tallest = (minHeight) ? minHeight : 0;
        this.each(function () {
            if ($(this).height() > tallest) {
                tallest = $(this).height();
            }
        });
        if ((maxHeight) && tallest > maxHeight) tallest = maxHeight;
        return this.each(function () {
            $(this).height(tallest).css("overflow", "auto");
        });
    }
})(jQuery);

/*-------- Nyro Modal ---------*/
/*
* nyroModal - jQuery Plugin
* http://nyromodal.nyrodev.com
*
* Copyright (c) 2010 Cedric Nirousset (nyrodev.com)
* Licensed under the MIT license
*
* $Date: 2010-02-23 (Tue, 23 Feb 2010) $
* $version: 1.6.2
*/
jQuery(function ($) { var userAgent = navigator.userAgent.toLowerCase(); var browserVersion = (userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/) || [0, '0'])[1]; var isIE6 = (/msie/.test(userAgent) && !/opera/.test(userAgent) && parseInt(browserVersion) < 7 && (!window.XMLHttpRequest || typeof (XMLHttpRequest) === 'function')); var body = $('body'); var currentSettings; var callingSettings; var shouldResize = false; var gallery = {}; var fixFF = false; var contentElt; var contentEltLast; var modal = { started: false, ready: false, dataReady: false, anim: false, animContent: false, loadingShown: false, transition: false, resizing: false, closing: false, error: false, blocker: null, blockerVars: null, full: null, bg: null, loading: null, tmp: null, content: null, wrapper: null, contentWrapper: null, scripts: new Array(), scriptsShown: new Array() }; var resized = { width: false, height: false, windowResizing: false }; var initSettingsSize = { width: null, height: null, windowResizing: true }; var windowResizeTimeout; $.fn.nyroModal = function (settings) { if (!this) return false; return this.each(function () { var me = $(this); if (this.nodeName.toLowerCase() == 'form') { me.unbind('submit.nyroModal').bind('submit.nyroModal', function (e) { if (e.isDefaultPrevented()) return false; if (me.data('nyroModalprocessing')) return true; if (this.enctype == 'multipart/form-data') { processModal($.extend(settings, { from: this })); return true } e.preventDefault(); processModal($.extend(settings, { from: this })); return false }) } else { me.unbind('click.nyroModal').bind('click.nyroModal', function (e) { if (e.isDefaultPrevented()) return false; e.preventDefault(); processModal($.extend(settings, { from: this })); return false }) } }) }; $.fn.nyroModalManual = function (settings) { if (!this.length) processModal(settings); return this.each(function () { processModal($.extend(settings, { from: this })) }) }; $.nyroModalManual = function (settings) { processModal(settings) }; $.nyroModalSettings = function (settings, deep1, deep2) { setCurrentSettings(settings, deep1, deep2); if (!deep1 && modal.started) { if (modal.bg && settings.bgColor) currentSettings.updateBgColor(modal, currentSettings, function () { }); if (modal.contentWrapper && settings.title) setTitle(); if (!modal.error && (settings.windowResizing || (!modal.resizing && (('width' in settings && settings.width == currentSettings.width) || ('height' in settings && settings.height == currentSettings.height))))) { modal.resizing = true; if (modal.contentWrapper) calculateSize(true); if (modal.contentWrapper && modal.contentWrapper.is(':visible') && !modal.animContent) { if (fixFF) modal.content.css({ position: '' }); currentSettings.resize(modal, currentSettings, function () { currentSettings.windowResizing = false; modal.resizing = false; if (fixFF) modal.content.css({ position: 'fixed' }); if ($.isFunction(currentSettings.endResize)) currentSettings.endResize(modal, currentSettings) }) } } } }; $.nyroModalRemove = function () { removeModal() }; $.nyroModalNext = function () { var link = getGalleryLink(1); if (link) return link.nyroModalManual(getCurrentSettingsNew()); return false }; $.nyroModalPrev = function () { var link = getGalleryLink(-1); if (link) return link.nyroModalManual(getCurrentSettingsNew()); return false }; $.fn.nyroModal.settings = { debug: false, blocker: false, windowResize: true, modal: false, type: '', forceType: null, from: '', hash: '', processHandler: null, selIndicator: 'nyroModalSel', formIndicator: 'nyroModal', content: null, bgColor: '#000000', ajax: {}, swf: { wmode: 'transparent' }, width: null, height: null, minWidth: 400, minHeight: 300, resizable: true, autoSizable: true, padding: 25, regexImg: '[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$', addImageDivTitle: false, defaultImgAlt: 'Image', setWidthImgTitle: true, ltr: true, gallery: null, galleryLinks: '<a href="#" class="nyroModalPrev">Prev</a><a href="#"  class="nyroModalNext">Next</a>', galleryCounts: galleryCounts, galleryLoop: false, zIndexStart: 100, cssOpt: { bg: { position: 'absolute', overflow: 'hidden', top: 0, left: 0, height: '100%', width: '100%' }, wrapper: { position: 'absolute', top: '50%', left: '50%' }, wrapper2: {}, content: {}, loading: { position: 'absolute', top: '50%', left: '50%', marginTop: '-50px', marginLeft: '-50px'} }, wrap: { div: '<div class="wrapper"></div>', ajax: '<div class="wrapper"></div>', form: '<div class="wrapper"></div>', formData: '<div class="wrapper"></div>', image: '<div class="wrapperImg"></div>', swf: '<div class="wrapperSwf"></div>', iframe: '<div class="wrapperIframe"></div>', iframeForm: '<div class="wrapperIframe"></div>', manual: '<div class="wrapper"></div>' }, closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="close">Close</a>', title: null, titleFromIframe: true, openSelector: '.nyroModal', closeSelector: '.nyroModalClose', contentLoading: '<a href="#" class="nyroModalClose">Cancel</a>', errorClass: 'error', contentError: 'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>', handleError: null, showBackground: showBackground, hideBackground: hideBackground, endFillContent: null, showContent: showContent, endShowContent: null, beforeHideContent: null, hideContent: hideContent, showTransition: showTransition, hideTransition: hideTransition, showLoading: showLoading, hideLoading: hideLoading, resize: resize, endResize: null, updateBgColor: updateBgColor, endRemove: null }; function processModal(settings) { if (modal.loadingShown || modal.transition || modal.anim) return; debug('processModal'); modal.started = true; callingSettings = $.extend(true, settings); setDefaultCurrentSettings(settings); if (!modal.full) modal.blockerVars = modal.blocker = null; modal.error = false; modal.closing = false; modal.dataReady = false; modal.scripts = new Array(); modal.scriptsShown = new Array(); currentSettings.type = fileType(); if (currentSettings.forceType) { if (!currentSettings.content) currentSettings.from = true; currentSettings.type = currentSettings.forceType; currentSettings.forceType = null } if ($.isFunction(currentSettings.processHandler)) currentSettings.processHandler(currentSettings); var from = currentSettings.from; var url = currentSettings.url; initSettingsSize.width = currentSettings.width; initSettingsSize.height = currentSettings.height; if (currentSettings.type == 'swf') { setCurrentSettings({ overflow: 'visible' }, 'cssOpt', 'content'); currentSettings.content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + currentSettings.width + '" height="' + currentSettings.height + '"><param name="movie" value="' + url + '"></param>'; var tmp = ''; $.each(currentSettings.swf, function (name, val) { currentSettings.content += '<param name="' + name + '" value="' + val + '"></param>'; tmp += ' ' + name + '="' + val + '"' }); currentSettings.content += '<embed src="' + url + '" type="application/x-shockwave-flash" width="' + currentSettings.width + '" height="' + currentSettings.height + '"' + tmp + '></embed></object>' } if (from) { var jFrom = $(from).blur(); if (currentSettings.type == 'form') { var data = $(from).serializeArray(); data.push({ name: currentSettings.formIndicator, value: 1 }); if (currentSettings.selector) data.push({ name: currentSettings.selIndicator, value: currentSettings.selector.substring(1) }); showModal(); $.ajax($.extend({}, currentSettings.ajax, { url: url, data: data, type: jFrom.attr('method') ? jFrom.attr('method') : 'get', success: ajaxLoaded, error: loadingError })); debug('Form Ajax Load: ' + jFrom.attr('action')) } else if (currentSettings.type == 'formData') { initModal(); jFrom.attr('target', 'nyroModalIframe'); jFrom.attr('action', url); jFrom.prepend('<input type="hidden" name="' + currentSettings.formIndicator + '" value="1" />'); if (currentSettings.selector) jFrom.prepend('<input type="hidden" name="' + currentSettings.selIndicator + '" value="' + currentSettings.selector.substring(1) + '" />'); modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:\'\';"></iframe>'); $('iframe', modal.tmp).css({ width: currentSettings.width, height: currentSettings.height }).error(loadingError).load(formDataLoaded); debug('Form Data Load: ' + jFrom.attr('action')); showModal(); showContentOrLoading() } else if (currentSettings.type == 'image') { debug('Image Load: ' + url); var title = jFrom.attr('title') || currentSettings.defaultImgAlt; initModal(); modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt', title); modal.tmp.css({ lineHeight: 0 }); $('img', modal.tmp).error(loadingError).load(function () { debug('Image Loaded: ' + this.src); $(this).unbind('load'); var w = modal.tmp.width(); var h = modal.tmp.height(); modal.tmp.css({ lineHeight: '' }); resized.width = w; resized.height = h; setCurrentSettings({ width: w, height: h, imgWidth: w, imgHeight: h }); initSettingsSize.width = w; initSettingsSize.height = h; setCurrentSettings({ overflow: 'visible' }, 'cssOpt', 'content'); modal.dataReady = true; if (modal.loadingShown || modal.transition) showContentOrLoading() }).attr('src', url); showModal() } else if (currentSettings.type == 'iframeForm') { initModal(); modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>'); debug('Iframe Form Load: ' + url); $('iframe', modal.tmp).eq(0).css({ width: '100%', height: $.support.boxModel ? '99%' : '100%' }).load(iframeLoaded); modal.dataReady = true; showModal() } else if (currentSettings.type == 'iframe') { initModal(); modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>'); debug('Iframe Load: ' + url); $('iframe', modal.tmp).eq(0).css({ width: '100%', height: $.support.boxModel ? '99%' : '100%' }).load(iframeLoaded); modal.dataReady = true; showModal() } else if (currentSettings.type) { debug('Content: ' + currentSettings.type); initModal(); modal.tmp.html(currentSettings.content); var w = modal.tmp.width(); var h = modal.tmp.height(); var div = $(currentSettings.type); if (div.length) { setCurrentSettings({ type: 'div' }); w = div.width(); h = div.height(); if (contentElt) contentEltLast = contentElt; contentElt = div; modal.tmp.append(div.contents()) } initSettingsSize.width = w; initSettingsSize.height = h; setCurrentSettings({ width: w, height: h }); if (modal.tmp.html()) modal.dataReady = true; else loadingError(); if (!modal.ready) showModal(); else endHideContent() } else { debug('Ajax Load: ' + url); setCurrentSettings({ type: 'ajax' }); var data = currentSettings.ajax.data || {}; if (currentSettings.selector) { if (typeof data == "string") { data += '&' + currentSettings.selIndicator + '=' + currentSettings.selector.substring(1) } else { data[currentSettings.selIndicator] = currentSettings.selector.substring(1) } } showModal(); $.ajax($.extend(true, currentSettings.ajax, { url: url, success: ajaxLoaded, error: loadingError, data: data })) } } else if (currentSettings.content) { debug('Content: ' + currentSettings.type); setCurrentSettings({ type: 'manual' }); initModal(); modal.tmp.html($('<div/>').html(currentSettings.content).contents()); if (modal.tmp.html()) modal.dataReady = true; else loadingError(); showModal() } else { } } function setDefaultCurrentSettings(settings) { debug('setDefaultCurrentSettings'); currentSettings = $.extend(true, {}, $.fn.nyroModal.settings, settings); setMargin() } function setCurrentSettings(settings, deep1, deep2) { if (modal.started) { if (deep1 && deep2) { $.extend(true, currentSettings[deep1][deep2], settings) } else if (deep1) { $.extend(true, currentSettings[deep1], settings) } else { if (modal.animContent) { if ('width' in settings) { if (!modal.resizing) { settings.setWidth = settings.width; shouldResize = true } delete settings['width'] } if ('height' in settings) { if (!modal.resizing) { settings.setHeight = settings.height; shouldResize = true } delete settings['height'] } } $.extend(true, currentSettings, settings) } } else { if (deep1 && deep2) { $.extend(true, $.fn.nyroModal.settings[deep1][deep2], settings) } else if (deep1) { $.extend(true, $.fn.nyroModal.settings[deep1], settings) } else { $.extend(true, $.fn.nyroModal.settings, settings) } } } function setMarginScroll() { if (isIE6 && !modal.blocker) { if (document.documentElement) { currentSettings.marginScrollLeft = document.documentElement.scrollLeft; currentSettings.marginScrollTop = document.documentElement.scrollTop } else { currentSettings.marginScrollLeft = document.body.scrollLeft; currentSettings.marginScrollTop = document.body.scrollTop } } else { currentSettings.marginScrollLeft = 0; currentSettings.marginScrollTop = 0 } } function setMargin() { setMarginScroll(); currentSettings.marginLeft = -(currentSettings.width + currentSettings.borderW) / 2; currentSettings.marginTop = -(currentSettings.height + currentSettings.borderH) / 2; if (!modal.blocker) { currentSettings.marginLeft += currentSettings.marginScrollLeft; currentSettings.marginTop += currentSettings.marginScrollTop } } function setMarginLoading() { setMarginScroll(); var outer = getOuter(modal.loading); currentSettings.marginTopLoading = -(modal.loading.height() + outer.h.border + outer.h.padding) / 2; currentSettings.marginLeftLoading = -(modal.loading.width() + outer.w.border + outer.w.padding) / 2; if (!modal.blocker) { currentSettings.marginLeftLoading += currentSettings.marginScrollLeft; currentSettings.marginTopLoading += currentSettings.marginScrollTop } } function setTitle() { var title = $('h1#nyroModalTitle', modal.contentWrapper); if (title.length) title.text(currentSettings.title); else modal.contentWrapper.prepend('<h1 id="nyroModalTitle">' + currentSettings.title + '</h1>') } function initModal() { debug('initModal'); if (!modal.full) { if (currentSettings.debug) setCurrentSettings({ color: 'white' }, 'cssOpt', 'bg'); var full = { zIndex: currentSettings.zIndexStart, position: 'fixed', top: 0, left: 0, width: '100%', height: '100%' }; var contain = body; var iframeHideIE = ''; if (currentSettings.blocker) { modal.blocker = contain = $(currentSettings.blocker); var pos = modal.blocker.offset(); var w = modal.blocker.outerWidth(); var h = modal.blocker.outerHeight(); if (isIE6) { setCurrentSettings({ height: '100%', width: '100%', top: 0, left: 0 }, 'cssOpt', 'bg') } modal.blockerVars = { top: pos.top, left: pos.left, width: w, height: h }; var plusTop = (/msie/.test(userAgent) ? 0 : getCurCSS(body.get(0), 'borderTopWidth')); var plusLeft = (/msie/.test(userAgent) ? 0 : getCurCSS(body.get(0), 'borderLeftWidth')); full = { position: 'absolute', top: pos.top + plusTop, left: pos.left + plusLeft, width: w, height: h} } else if (isIE6) { body.css({ marginLeft: 0, marginRight: 0 }); var w = body.width(); var h = $(window).height() + 'px'; if ($(window).height() >= body.outerHeight()) { h = body.outerHeight() + 'px' } else w += 20; w += 'px'; body.css({ width: w, height: h, position: 'static', overflow: 'hidden' }); $('html').css({ overflow: 'hidden' }); setCurrentSettings({ cssOpt: { bg: { position: 'absolute', zIndex: currentSettings.zIndexStart + 1, height: '110%', width: '110%', top: currentSettings.marginScrollTop + 'px', left: currentSettings.marginScrollLeft + 'px' }, wrapper: { zIndex: currentSettings.zIndexStart + 2 }, loading: { zIndex: currentSettings.zIndexStart + 3}} }); iframeHideIE = $('<iframe id="nyroModalIframeHideIe" src="javascript:\'\';"></iframe>').css($.extend({}, currentSettings.cssOpt.bg, { opacity: 0, zIndex: 50, border: 'none' })) } contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide()); modal.full = $('#nyroModalFull').css(full).show(); modal.bg = $('#nyroModalBg').css($.extend({ backgroundColor: currentSettings.bgColor }, currentSettings.cssOpt.bg)).before(iframeHideIE); modal.bg.bind('click.nyroModal', clickBg); modal.loading = $('#nyroModalLoading').css(currentSettings.cssOpt.loading).hide(); modal.contentWrapper = $('#nyroModalWrapper').css(currentSettings.cssOpt.wrapper).hide(); modal.content = $('#nyroModalContent'); modal.tmp = $('#nyrModalTmp').hide(); if ($.isFunction($.fn.mousewheel)) { modal.content.mousewheel(function (e, d) { var elt = modal.content.get(0); if ((d > 0 && elt.scrollTop == 0) || (d < 0 && elt.scrollHeight - elt.scrollTop == elt.clientHeight)) { e.preventDefault(); e.stopPropagation() } }) } $(document).bind('keydown.nyroModal', keyHandler); modal.content.css({ width: 'auto', height: 'auto' }); modal.contentWrapper.css({ width: 'auto', height: 'auto' }); if (!currentSettings.blocker && currentSettings.windowResize) { $(window).bind('resize.nyroModal', function () { window.clearTimeout(windowResizeTimeout); windowResizeTimeout = window.setTimeout(windowResizeHandler, 200) }) } } } function windowResizeHandler() { $.nyroModalSettings(initSettingsSize) } function showModal() { debug('showModal'); if (!modal.ready) { initModal(); modal.anim = true; currentSettings.showBackground(modal, currentSettings, endBackground) } else { modal.anim = true; modal.transition = true; currentSettings.showTransition(modal, currentSettings, function () { endHideContent(); modal.anim = false; showContentOrLoading() }) } } function clickBg(e) { if (!currentSettings.modal) removeModal() } function keyHandler(e) { if (e.keyCode == 27) { if (!currentSettings.modal) removeModal() } else if (currentSettings.gallery && modal.ready && modal.dataReady && !modal.anim && !modal.transition) { if (e.keyCode == 39 || e.keyCode == 40) { e.preventDefault(); $.nyroModalNext(); return false } else if (e.keyCode == 37 || e.keyCode == 38) { e.preventDefault(); $.nyroModalPrev(); return false } } } function fileType() { var from = currentSettings.from; var url; if (from && from.nodeName) { var jFrom = $(from); url = jFrom.attr(from.nodeName.toLowerCase() == 'form' ? 'action' : 'href'); if (!url) url = location.href.substring(window.location.host.length + 7); currentSettings.url = url; if (jFrom.attr('rev') == 'modal') currentSettings.modal = true; currentSettings.title = jFrom.attr('title'); if (from && from.rel && from.rel.toLowerCase() != 'nofollow') { var indexSpace = from.rel.indexOf(' '); currentSettings.gallery = indexSpace > 0 ? from.rel.substr(0, indexSpace) : from.rel } var imgType = imageType(url, from); if (imgType) return imgType; if (isSwf(url)) return 'swf'; var iframe = false; if (from.target && from.target.toLowerCase() == '_blank' || (from.hostname && from.hostname.replace(/:\d*$/, '') != window.location.hostname.replace(/:\d*$/, ''))) { iframe = true } if (from.nodeName.toLowerCase() == 'form') { if (iframe) return 'iframeForm'; setCurrentSettings(extractUrlSel(url)); if (jFrom.attr('enctype') == 'multipart/form-data') return 'formData'; return 'form' } if (iframe) return 'iframe' } else { url = currentSettings.url; if (!currentSettings.content) currentSettings.from = true; if (!url) return null; if (isSwf(url)) return 'swf'; var reg1 = new RegExp("^http://|https://", "g"); if (url.match(reg1)) return 'iframe' } var imgType = imageType(url, from); if (imgType) return imgType; var tmp = extractUrlSel(url); setCurrentSettings(tmp); if (!tmp.url) return tmp.selector } function imageType(url, from) { var image = new RegExp(currentSettings.regexImg, 'i'); if (image.test(url)) { return 'image' } } function isSwf(url) { var swf = new RegExp('[^\.]\.(swf)\s*$', 'i'); return swf.test(url) } function extractUrlSel(url) { var ret = { url: null, selector: null }; if (url) { var hash = getHash(url); var hashLoc = getHash(window.location.href); var curLoc = window.location.href.substring(0, window.location.href.length - hashLoc.length); var req = url.substring(0, url.length - hash.length); if (req == curLoc || req == $('base').attr('href')) { ret.selector = hash } else { ret.url = req; ret.selector = hash } } return ret } function loadingError() { debug('loadingError'); modal.error = true; if (!modal.ready) return; if ($.isFunction(currentSettings.handleError)) currentSettings.handleError(modal, currentSettings); modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError); $(currentSettings.closeSelector, modal.loading).unbind('click.nyroModal').bind('click.nyroModal', removeModal); setMarginLoading(); modal.loading.css({ marginTop: currentSettings.marginTopLoading + 'px', marginLeft: currentSettings.marginLeftLoading + 'px' }) } function fillContent() { debug('fillContent'); if (!modal.tmp.html()) return; modal.content.html(modal.tmp.contents()); modal.tmp.empty(); wrapContent(); if (currentSettings.type == 'iframeForm') { $(currentSettings.from).attr('target', 'nyroModalIframe').data('nyroModalprocessing', 1).submit().attr('target', '_blank').removeData('nyroModalprocessing') } if (!currentSettings.modal) modal.wrapper.prepend(currentSettings.closeButton); if ($.isFunction(currentSettings.endFillContent)) currentSettings.endFillContent(modal, currentSettings); modal.content.append(modal.scripts); $(currentSettings.closeSelector, modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal', removeModal); $(currentSettings.openSelector, modal.contentWrapper).nyroModal(getCurrentSettingsNew()) } function getCurrentSettingsNew() { return callingSettings; var currentSettingsNew = $.extend(true, {}, currentSettings); if (resized.width) currentSettingsNew.width = null; else currentSettingsNew.width = initSettingsSize.width; if (resized.height) currentSettingsNew.height = null; else currentSettingsNew.height = initSettingsSize.height; currentSettingsNew.cssOpt.content.overflow = 'auto'; return currentSettingsNew } function wrapContent() { debug('wrapContent'); var wrap = $(currentSettings.wrap[currentSettings.type]); modal.content.append(wrap.children().remove()); modal.contentWrapper.wrapInner(wrap); if (currentSettings.gallery) { modal.content.append(currentSettings.galleryLinks); gallery.links = $('[rel="' + currentSettings.gallery + '"], [rel^="' + currentSettings.gallery + ' "]'); gallery.index = gallery.links.index(currentSettings.from); if (currentSettings.galleryCounts && $.isFunction(currentSettings.galleryCounts)) currentSettings.galleryCounts(gallery.index + 1, gallery.links.length, modal, currentSettings); var currentSettingsNew = getCurrentSettingsNew(); var linkPrev = getGalleryLink(-1); if (linkPrev) { var prev = $('.nyroModalPrev', modal.contentWrapper).attr('href', linkPrev.attr('href')).click(function (e) { e.preventDefault(); $.nyroModalPrev(); return false }); if (isIE6 && currentSettings.type == 'swf') { prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:\'\';"></iframe>').css({ position: prev.css('position'), top: prev.css('top'), left: prev.css('left'), width: prev.width(), height: prev.height(), opacity: 0, border: 'none' })) } } else { $('.nyroModalPrev', modal.contentWrapper).remove() } var linkNext = getGalleryLink(1); if (linkNext) { var next = $('.nyroModalNext', modal.contentWrapper).attr('href', linkNext.attr('href')).click(function (e) { e.preventDefault(); $.nyroModalNext(); return false }); if (isIE6 && currentSettings.type == 'swf') { next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:\'\';"></iframe>').css($.extend({}, { position: next.css('position'), top: next.css('top'), left: next.css('left'), width: next.width(), height: next.height(), opacity: 0, border: 'none' }))) } } else { $('.nyroModalNext', modal.contentWrapper).remove() } } calculateSize() } function getGalleryLink(dir) { if (currentSettings.gallery) { if (!currentSettings.ltr) dir *= -1; var index = gallery.index + dir; if (index >= 0 && index < gallery.links.length) return gallery.links.eq(index); else if (currentSettings.galleryLoop) { if (index < 0) return gallery.links.eq(gallery.links.length - 1); else return gallery.links.eq(0) } } return false } function calculateSize(resizing) { debug('calculateSize'); modal.wrapper = modal.contentWrapper.children('div:first'); resized.width = false; resized.height = false; if (false && !currentSettings.windowResizing) { initSettingsSize.width = currentSettings.width; initSettingsSize.height = currentSettings.height } if (currentSettings.autoSizable && (!currentSettings.width || !currentSettings.height)) { modal.contentWrapper.css({ opacity: 0, width: 'auto', height: 'auto' }).show(); var tmp = { width: 'auto', height: 'auto' }; if (currentSettings.width) { tmp.width = currentSettings.width } else if (currentSettings.type == 'iframe') { tmp.width = currentSettings.minWidth } if (currentSettings.height) { tmp.height = currentSettings.height } else if (currentSettings.type == 'iframe') { tmp.height = currentSettings.minHeight } modal.content.css(tmp); if (!currentSettings.width) { currentSettings.width = modal.content.outerWidth(true); resized.width = true } if (!currentSettings.height) { currentSettings.height = modal.content.outerHeight(true); resized.height = true } modal.contentWrapper.css({ opacity: 1 }); if (!resizing) modal.contentWrapper.hide() } if (currentSettings.type != 'image' && currentSettings.type != 'swf') { currentSettings.width = Math.max(currentSettings.width, currentSettings.minWidth); currentSettings.height = Math.max(currentSettings.height, currentSettings.minHeight) } var outerWrapper = getOuter(modal.contentWrapper); var outerWrapper2 = getOuter(modal.wrapper); var outerContent = getOuter(modal.content); var tmp = { content: { width: currentSettings.width, height: currentSettings.height }, wrapper2: { width: currentSettings.width + outerContent.w.total, height: currentSettings.height + outerContent.h.total }, wrapper: { width: currentSettings.width + outerContent.w.total + outerWrapper2.w.total, height: currentSettings.height + outerContent.h.total + outerWrapper2.h.total} }; if (currentSettings.resizable) { var maxHeight = modal.blockerVars ? modal.blockerVars.height : $(window).height() - outerWrapper.h.border - (tmp.wrapper.height - currentSettings.height); var maxWidth = modal.blockerVars ? modal.blockerVars.width : $(window).width() - outerWrapper.w.border - (tmp.wrapper.width - currentSettings.width); maxHeight -= currentSettings.padding * 2; maxWidth -= currentSettings.padding * 2; if (tmp.content.height > maxHeight || tmp.content.width > maxWidth) { if (currentSettings.type == 'image' || currentSettings.type == 'swf') { var useW = currentSettings.imgWidth ? currentSettings.imgWidth : currentSettings.width; var useH = currentSettings.imgHeight ? currentSettings.imgHeight : currentSettings.height; var diffW = tmp.content.width - useW; var diffH = tmp.content.height - useH; if (diffH < 0) diffH = 0; if (diffW < 0) diffW = 0; var calcH = maxHeight - diffH; var calcW = maxWidth - diffW; var ratio = Math.min(calcH / useH, calcW / useW); calcW = Math.floor(useW * ratio); calcH = Math.floor(useH * ratio); tmp.content.height = calcH + diffH; tmp.content.width = calcW + diffW } else { tmp.content.height = Math.min(tmp.content.height, maxHeight); tmp.content.width = Math.min(tmp.content.width, maxWidth) } tmp.wrapper2 = { width: tmp.content.width + outerContent.w.total, height: tmp.content.height + outerContent.h.total }; tmp.wrapper = { width: tmp.content.width + outerContent.w.total + outerWrapper2.w.total, height: tmp.content.height + outerContent.h.total + outerWrapper2.h.total} } } if (currentSettings.type == 'swf') { $('object, embed', modal.content).attr('width', tmp.content.width).attr('height', tmp.content.height) } else if (currentSettings.type == 'image') { $('img', modal.content).css({ width: tmp.content.width, height: tmp.content.height }) } modal.content.css($.extend({}, tmp.content, currentSettings.cssOpt.content)); modal.wrapper.css($.extend({}, tmp.wrapper2, currentSettings.cssOpt.wrapper2)); if (!resizing) modal.contentWrapper.css($.extend({}, tmp.wrapper, currentSettings.cssOpt.wrapper)); if (currentSettings.type == 'image' && currentSettings.addImageDivTitle) { $('img', modal.content).removeAttr('alt'); var divTitle = $('div', modal.content); if (currentSettings.title != currentSettings.defaultImgAlt && currentSettings.title) { if (divTitle.length == 0) { divTitle = $('<div>' + currentSettings.title + '</div>'); modal.content.append(divTitle) } if (currentSettings.setWidthImgTitle) { var outerDivTitle = getOuter(divTitle); divTitle.css({ width: (tmp.content.width + outerContent.w.padding - outerDivTitle.w.total) + 'px' }) } } else if (divTitle.length = 0) { divTitle.remove() } } if (currentSettings.title) setTitle(); tmp.wrapper.borderW = outerWrapper.w.border; tmp.wrapper.borderH = outerWrapper.h.border; setCurrentSettings(tmp.wrapper); setMargin() } function removeModal(e) { debug('removeModal'); if (e) e.preventDefault(); if (modal.full && modal.ready) { $(document).unbind('keydown.nyroModal'); if (!currentSettings.blocker) $(window).unbind('resize.nyroModal'); modal.ready = false; modal.anim = true; modal.closing = true; if (modal.loadingShown || modal.transition) { currentSettings.hideLoading(modal, currentSettings, function () { modal.loading.hide(); modal.loadingShown = false; modal.transition = false; currentSettings.hideBackground(modal, currentSettings, endRemove) }) } else { if (fixFF) modal.content.css({ position: '' }); modal.wrapper.css({ overflow: 'hidden' }); modal.content.css({ overflow: 'hidden' }); $('iframe', modal.content).hide(); if ($.isFunction(currentSettings.beforeHideContent)) { currentSettings.beforeHideContent(modal, currentSettings, function () { currentSettings.hideContent(modal, currentSettings, function () { endHideContent(); currentSettings.hideBackground(modal, currentSettings, endRemove) }) }) } else { currentSettings.hideContent(modal, currentSettings, function () { endHideContent(); currentSettings.hideBackground(modal, currentSettings, endRemove) }) } } } if (e) return false } function showContentOrLoading() { debug('showContentOrLoading'); if (modal.ready && !modal.anim) { if (modal.dataReady) { if (modal.tmp.html()) { modal.anim = true; if (modal.transition) { fillContent(); modal.animContent = true; currentSettings.hideTransition(modal, currentSettings, function () { modal.loading.hide(); modal.transition = false; modal.loadingShown = false; endShowContent() }) } else { currentSettings.hideLoading(modal, currentSettings, function () { modal.loading.hide(); modal.loadingShown = false; fillContent(); setMarginLoading(); setMargin(); modal.animContent = true; currentSettings.showContent(modal, currentSettings, endShowContent) }) } } } else if (!modal.loadingShown && !modal.transition) { modal.anim = true; modal.loadingShown = true; if (modal.error) loadingError(); else modal.loading.html(currentSettings.contentLoading); $(currentSettings.closeSelector, modal.loading).unbind('click.nyroModal').bind('click.nyroModal', removeModal); setMarginLoading(); currentSettings.showLoading(modal, currentSettings, function () { modal.anim = false; showContentOrLoading() }) } } } function ajaxLoaded(data) { debug('AjaxLoaded: ' + this.url); if (currentSettings.selector) { var tmp = {}; var i = 0; data = data.replace(/\r\n/gi, 'nyroModalLN').replace(/<script(.|\s)*?\/script>/gi, function (x) { tmp[i] = x; return '<pre style="display: none" class=nyroModalScript rel="' + (i++) + '"></pre>' }); data = $('<div>' + data + '</div>').find(currentSettings.selector).html().replace(/<pre style="display: none;?" class="?nyroModalScript"? rel="(.?)"><\/pre>/gi, function (x, y, z) { return tmp[y] }).replace(/nyroModalLN/gi, "\r\n") } modal.tmp.html(filterScripts(data)); if (modal.tmp.html()) { modal.dataReady = true; showContentOrLoading() } else loadingError() } function formDataLoaded() { debug('formDataLoaded'); var jFrom = $(currentSettings.from); jFrom.attr('action', jFrom.attr('action') + currentSettings.selector); jFrom.attr('target', ''); $('input[name=' + currentSettings.formIndicator + ']', currentSettings.from).remove(); var iframe = modal.tmp.children('iframe'); var iframeContent = iframe.unbind('load').contents().find(currentSettings.selector || 'body').not('script[src]'); iframe.attr('src', 'about:blank'); modal.tmp.html(iframeContent.html()); if (modal.tmp.html()) { modal.dataReady = true; showContentOrLoading() } else loadingError() } function iframeLoaded() { if ((window.location.hostname && currentSettings.url.indexOf(window.location.hostname) > -1) || currentSettings.url.indexOf('http://')) { var iframe = $('iframe', modal.full).contents(); var tmp = {}; if (currentSettings.titleFromIframe) { tmp.title = iframe.find('title').text(); if (!tmp.title) { try { tmp.title = iframe.find('title').html() } catch (err) { } } } var body = iframe.find('body'); if (!currentSettings.height && body.height()) tmp.height = body.height(); if (!currentSettings.width && body.width()) tmp.width = body.width(); $.extend(initSettingsSize, tmp); $.nyroModalSettings(tmp) } } function galleryCounts(nb, total, elts, settings) { if (total > 1) settings.title += (settings.title ? ' - ' : '') + nb + '/' + total } function endHideContent() { debug('endHideContent'); modal.anim = false; if (contentEltLast) { contentEltLast.append(modal.content.contents()); contentEltLast = null } else if (contentElt) { contentElt.append(modal.content.contents()); contentElt = null } modal.content.empty(); gallery = {}; modal.contentWrapper.hide().children().remove().empty().attr('style', '').hide(); if (modal.closing || modal.transition) modal.contentWrapper.hide(); modal.contentWrapper.css(currentSettings.cssOpt.wrapper).append(modal.content); showContentOrLoading() } function endRemove() { debug('endRemove'); $(document).unbind('keydown', keyHandler); modal.anim = false; modal.full.remove(); modal.full = null; if (isIE6) { body.css({ height: '', width: '', position: '', overflow: '', marginLeft: '', marginRight: '' }); $('html').css({ overflow: '' }) } if ($.isFunction(currentSettings.endRemove)) currentSettings.endRemove(modal, currentSettings) } function endBackground() { debug('endBackground'); modal.ready = true; modal.anim = false; showContentOrLoading() } function endShowContent() { debug('endShowContent'); modal.anim = false; modal.animContent = false; modal.contentWrapper.css({ opacity: '' }); fixFF = /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) && parseFloat(browserVersion) < 1.9 && currentSettings.type != 'image'; if (fixFF) modal.content.css({ position: 'fixed' }); modal.content.append(modal.scriptsShown); if (currentSettings.type == 'iframe') modal.content.find('iframe').attr('src', currentSettings.url); if ($.isFunction(currentSettings.endShowContent)) currentSettings.endShowContent(modal, currentSettings); if (shouldResize) { shouldResize = false; $.nyroModalSettings({ width: currentSettings.setWidth, height: currentSettings.setHeight }); delete currentSettings['setWidth']; delete currentSettings['setHeight'] } if (resized.width) setCurrentSettings({ width: null }); if (resized.height) setCurrentSettings({ height: null }) } function getHash(url) { if (typeof url == 'string') { var hashPos = url.indexOf('#'); if (hashPos > -1) return url.substring(hashPos) } return '' } function filterScripts(data) { if (typeof data == 'string') data = data.replace(/<\/?(html|head|body)([^>]*)>/gi, ''); var tmp = new Array(); $.each($.clean({ 0: data }, this.ownerDocument), function () { if ($.nodeName(this, "script")) { if (!this.src || $(this).attr('rel') == 'forceLoad') { if ($(this).attr('rev') == 'shown') modal.scriptsShown.push(this); else modal.scripts.push(this) } } else tmp.push(this) }); return tmp } function getOuter(elm) { elm = elm.get(0); var ret = { h: { margin: getCurCSS(elm, 'marginTop') + getCurCSS(elm, 'marginBottom'), border: getCurCSS(elm, 'borderTopWidth') + getCurCSS(elm, 'borderBottomWidth'), padding: getCurCSS(elm, 'paddingTop') + getCurCSS(elm, 'paddingBottom') }, w: { margin: getCurCSS(elm, 'marginLeft') + getCurCSS(elm, 'marginRight'), border: getCurCSS(elm, 'borderLeftWidth') + getCurCSS(elm, 'borderRightWidth'), padding: getCurCSS(elm, 'paddingLeft') + getCurCSS(elm, 'paddingRight')} }; ret.h.outer = ret.h.margin + ret.h.border; ret.w.outer = ret.w.margin + ret.w.border; ret.h.inner = ret.h.padding + ret.h.border; ret.w.inner = ret.w.padding + ret.w.border; ret.h.total = ret.h.outer + ret.h.padding; ret.w.total = ret.w.outer + ret.w.padding; return ret } function getCurCSS(elm, name) { var ret = parseInt($.curCSS(elm, name, true)); if (isNaN(ret)) ret = 0; return ret } function debug(msg) { if ($.fn.nyroModal.settings.debug || currentSettings && currentSettings.debug) nyroModalDebug(msg, modal, currentSettings || {}) } function showBackground(elts, settings, callback) { elts.bg.css({ opacity: 0 }).fadeTo(500, 0.75, callback) } function hideBackground(elts, settings, callback) { elts.bg.fadeOut(300, callback) } function showLoading(elts, settings, callback) { elts.loading.css({ marginTop: settings.marginTopLoading + 'px', marginLeft: settings.marginLeftLoading + 'px', opacity: 0 }).show().animate({ opacity: 1 }, { complete: callback, duration: 400 }) } function hideLoading(elts, settings, callback) { callback() } function showContent(elts, settings, callback) { elts.loading.css({ marginTop: settings.marginTopLoading + 'px', marginLeft: settings.marginLeftLoading + 'px' }).show().animate({ width: settings.width + 'px', height: settings.height + 'px', marginTop: settings.marginTop + 'px', marginLeft: settings.marginLeft + 'px' }, { duration: 350, complete: function () { elts.contentWrapper.css({ width: settings.width + 'px', height: settings.height + 'px', marginTop: settings.marginTop + 'px', marginLeft: settings.marginLeft + 'px' }).show(); elts.loading.fadeOut(200, callback) } }) } function hideContent(elts, settings, callback) { elts.contentWrapper.animate({ height: '50px', width: '50px', marginTop: (-(25 + settings.borderH) / 2 + settings.marginScrollTop) + 'px', marginLeft: (-(25 + settings.borderW) / 2 + settings.marginScrollLeft) + 'px' }, { duration: 350, complete: function () { elts.contentWrapper.hide(); callback() } }) } function showTransition(elts, settings, callback) { elts.loading.css({ marginTop: elts.contentWrapper.css('marginTop'), marginLeft: elts.contentWrapper.css('marginLeft'), height: elts.contentWrapper.css('height'), width: elts.contentWrapper.css('width'), opacity: 0 }).show().fadeTo(400, 1, function () { elts.contentWrapper.hide(); callback() }) } function hideTransition(elts, settings, callback) { elts.contentWrapper.hide().css({ width: settings.width + 'px', height: settings.height + 'px', marginLeft: settings.marginLeft + 'px', marginTop: settings.marginTop + 'px', opacity: 1 }); elts.loading.animate({ width: settings.width + 'px', height: settings.height + 'px', marginLeft: settings.marginLeft + 'px', marginTop: settings.marginTop + 'px' }, { complete: function () { elts.contentWrapper.show(); elts.loading.fadeOut(400, function () { elts.loading.hide(); callback() }) }, duration: 350 }) } function resize(elts, settings, callback) { elts.contentWrapper.animate({ width: settings.width + 'px', height: settings.height + 'px', marginLeft: settings.marginLeft + 'px', marginTop: settings.marginTop + 'px' }, { complete: callback, duration: 400 }) } function updateBgColor(elts, settings, callback) { if (!$.fx.step.backgroundColor) { elts.bg.css({ backgroundColor: settings.bgColor }); callback() } else elts.bg.animate({ backgroundColor: settings.bgColor }, { complete: callback, duration: 400 }) } $($.fn.nyroModal.settings.openSelector).nyroModal() }); var tmpDebug = ''; function nyroModalDebug(msg, elts, settings) { if (elts.full && elts.bg) { elts.bg.prepend(msg + '<br />' + tmpDebug); tmpDebug = '' } else tmpDebug += msg + '<br />' }

/* Template Jquery*/
(function (a) { var r = a.fn.domManip, d = "_tmplitem", q = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /, b = {}, f = {}, e, p = { key: 0, data: {} }, h = 0, c = 0, l = []; function g(e, d, g, i) { var c = { data: i || (d ? d.data : {}), _wrap: d ? d._wrap : null, tmpl: null, parent: d || null, nodes: [], calls: u, nest: w, wrap: x, html: v, update: t }; e && a.extend(c, e, { nodes: [], parent: d }); if (g) { c.tmpl = g; c._ctnt = c._ctnt || c.tmpl(a, c); c.key = ++h; (l.length ? f : b)[h] = c } return c } a.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (f, d) { a.fn[f] = function (n) { var g = [], i = a(n), k, h, m, l, j = this.length === 1 && this[0].parentNode; e = b || {}; if (j && j.nodeType === 11 && j.childNodes.length === 1 && i.length === 1) { i[d](this[0]); g = this } else { for (h = 0, m = i.length; h < m; h++) { c = h; k = (h > 0 ? this.clone(true) : this).get(); a.fn[d].apply(a(i[h]), k); g = g.concat(k) } c = 0; g = this.pushStack(g, f, i.selector) } l = e; e = null; a.tmpl.complete(l); return g } }); a.fn.extend({ tmpl: function (d, c, b) { return a.tmpl(this[0], d, c, b) }, tmplItem: function () { return a.tmplItem(this[0]) }, template: function (b) { return a.template(b, this[0]) }, domManip: function (d, l, j) { if (d[0] && d[0].nodeType) { var f = a.makeArray(arguments), g = d.length, i = 0, h; while (i < g && !(h = a.data(d[i++], "tmplItem"))); if (g > 1) f[0] = [a.makeArray(d)]; if (h && c) f[2] = function (b) { a.tmpl.afterManip(this, b, j) }; r.apply(this, f) } else r.apply(this, arguments); c = 0; !e && a.tmpl.complete(b); return this } }); a.extend({ tmpl: function (d, h, e, c) { var j, k = !c; if (k) { c = p; d = a.template[d] || a.template(null, d); f = {} } else if (!d) { d = c.tmpl; b[c.key] = c; c.nodes = []; c.wrapped && n(c, c.wrapped); return a(i(c, null, c.tmpl(a, c))) } if (!d) return []; if (typeof h === "function") h = h.call(c || {}); e && e.wrapped && n(e, e.wrapped); j = a.isArray(h) ? a.map(h, function (a) { return a ? g(e, c, d, a) : null }) : [g(e, c, d, h)]; return k ? a(i(c, null, j)) : j }, tmplItem: function (b) { var c; if (b instanceof a) b = b[0]; while (b && b.nodeType === 1 && !(c = a.data(b, "tmplItem")) && (b = b.parentNode)); return c || p }, template: function (c, b) { if (b) { if (typeof b === "string") b = o(b); else if (b instanceof a) b = b[0] || {}; if (b.nodeType) b = a.data(b, "tmpl") || a.data(b, "tmpl", o(b.innerHTML)); return typeof c === "string" ? (a.template[c] = b) : b } return c ? typeof c !== "string" ? a.template(null, c) : a.template[c] || a.template(null, q.test(c) ? c : a(c)) : null }, encode: function (a) { return ("" + a).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;") } }); a.extend(a.tmpl, { tag: { tmpl: { _default: { $2: "null" }, open: "if($notnull_1){_=_.concat($item.nest($1,$2));}" }, wrap: { _default: { $2: "null" }, open: "$item.calls(_,$1,$2);_=[];", close: "call=$item.calls();_=call._.concat($item.wrap(call,_));" }, each: { _default: { $2: "$index, $value" }, open: "if($notnull_1){$.each($1a,function($2){with(this){", close: "}});}" }, "if": { open: "if(($notnull_1) && $1a){", close: "}" }, "else": { _default: { $1: "true" }, open: "}else if(($notnull_1) && $1a){" }, html: { open: "if($notnull_1){_.push($1a);}" }, "=": { _default: { $1: "$data" }, open: "if($notnull_1){_.push($.encode($1a));}" }, "!": { open: ""} }, complete: function () { b = {} }, afterManip: function (f, b, d) { var e = b.nodeType === 11 ? a.makeArray(b.childNodes) : b.nodeType === 1 ? [b] : []; d.call(f, b); m(e); c++ } }); function i(e, g, f) { var b, c = f ? a.map(f, function (a) { return typeof a === "string" ? e.key ? a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + d + '="' + e.key + '" $2') : a : i(a, e, a._ctnt) }) : e; if (g) return c; c = c.join(""); c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/, function (f, c, e, d) { b = a(e).get(); m(b); if (c) b = j(c).concat(b); if (d) b = b.concat(j(d)) }); return b ? b : j(c) } function j(c) { var b = document.createElement("div"); b.innerHTML = c; return a.makeArray(b.childNodes) } function o(b) { return new Function("jQuery", "$item", "var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('" + a.trim(b).replace(/([\\'])/g, "\\$1").replace(/[\r\t\n]/g, " ").replace(/\$\{([^\}]*)\}/g, "{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g, function (m, l, j, d, b, c, e) { var i = a.tmpl.tag[j], h, f, g; if (!i) throw "Template command not found: " + j; h = i._default || []; if (c && !/\w$/.test(b)) { b += c; c = "" } if (b) { b = k(b); e = e ? "," + k(e) + ")" : c ? ")" : ""; f = c ? b.indexOf(".") > -1 ? b + c : "(" + b + ").call($item" + e : b; g = c ? f : "(typeof(" + b + ")==='function'?(" + b + ").call($item):(" + b + "))" } else g = f = h.$1 || "null"; d = k(d); return "');" + i[l ? "close" : "open"].split("$notnull_1").join(b ? "typeof(" + b + ")!=='undefined' && (" + b + ")!=null" : "true").split("$1a").join(g).split("$1").join(f).split("$2").join(d ? d.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g, function (d, c, b, a) { a = a ? "," + a + ")" : b ? ")" : ""; return a ? "(" + c + ").call($item" + a : d }) : h.$2 || "") + "_.push('" }) + "');}return _;") } function n(c, b) { c._wrap = i(c, true, a.isArray(b) ? b : [q.test(b) ? b : a(b).html()]).join("") } function k(a) { return a ? a.replace(/\\'/g, "'").replace(/\\\\/g, "\\") : null } function s(b) { var a = document.createElement("div"); a.appendChild(b.cloneNode(true)); return a.innerHTML } function m(o) { var n = "_" + c, k, j, l = {}, e, p, i; for (e = 0, p = o.length; e < p; e++) { if ((k = o[e]).nodeType !== 1) continue; j = k.getElementsByTagName("*"); for (i = j.length - 1; i >= 0; i--) m(j[i]); m(k) } function m(j) { var p, i = j, k, e, m; if (m = j.getAttribute(d)) { while (i.parentNode && (i = i.parentNode).nodeType === 1 && !(p = i.getAttribute(d))); if (p !== m) { i = i.parentNode ? i.nodeType === 11 ? 0 : i.getAttribute(d) || 0 : 0; if (!(e = b[m])) { e = f[m]; e = g(e, b[i] || f[i], null, true); e.key = ++h; b[h] = e } c && o(m) } j.removeAttribute(d) } else if (c && (e = a.data(j, "tmplItem"))) { o(e.key); b[e.key] = e; i = a.data(j.parentNode, "tmplItem"); i = i ? i.key : 0 } if (e) { k = e; while (k && k.key != i) { k.nodes.push(j); k = k.parent } delete e._ctnt; delete e._wrap; a.data(j, "tmplItem", e) } function o(a) { a = a + n; e = l[a] = l[a] || g(e, b[e.parent.key + n] || e.parent, null, true) } } } function u(a, d, c, b) { if (!a) return l.pop(); l.push({ _: a, tmpl: d, item: this, data: c, options: b }) } function w(d, c, b) { return a.tmpl(a.template(d), c, b, this) } function x(b, d) { var c = b.options || {}; c.wrapped = d; return a.tmpl(a.template(b.tmpl), b.data, c, b.item) } function v(d, c) { var b = this._wrap; return a.map(a(a.isArray(b) ? b.join("") : b).filter(d || "*"), function (a) { return c ? a.innerText || a.textContent : a.outerHTML || s(a) }) } function t() { var b = this.nodes; a.tmpl(null, null, null, this).insertBefore(b[0]); a(b).remove() } })(jQuery)

// unique array
    Array.prototype.unique = function() {
        var o = {}, i, l = this.length, r = [];
        for(i=0; i<l;i+=1) {
        o[this[i]] = this[i];
        }
        for(i in o){
        r.push(o[i]);
        }
        return r;
    };
    // Begin behaviors.js.

    // alphabet for listings
    var alphabet = "abcdefghijklmnopqrstuvwxyz";

jQuery.fn.exists = function () { return this.length > 0; }

Array.prototype.inArray = function (value) {
    var i=0;
    var tl=this.length;
    for (i=0; i < tl; i++) {
        if (this[i]===value) {
            return true;
        }
    }
    return false;
};

Array.prototype.removeItem = function (item) {
    var i=0;
    var tl=this.length;
    for (i=0; i < tl; i++) {
        if (this[i]===item) {
            this.splice(i, 1);
            i--;
        }
    }
}

String.prototype.trim = function () {
    var str = this.replace(/^\s+|\s+$/g, '');
    for (var i = str.length - 1; i > 0; i--) {
        if (/\S/.test(str.charAt(i))) {
            str = str.substring(0, i + 1);
            break;
        }
    }
    return str;
}

function leftNavDisplay() {
    $("#SubNavMenu * li.selected").parents().show();
}

function default_value(c)
{
    if (c.value.trim() == c.defaultValue)
        { c.value = ''; }
    c.className=c.className+' darker';
};

function new_value(c)
{
    if (c.value.trim() == '') 
        { c.value = c.defaultValue; }
    else
        { c.value = c.value.trim(); }

    if(c.className.indexOf('darker') > -1)
    {
        var classArray = c.className.split(' ');
        classArray.removeItem('darker');
        c.className = classArray.join(' ');
    }
};

$(function () {
    var filters = new Array;
    var defaultMap = $('#CampusMap').css('backgroundImage');
    leftNavDisplay();
    //Home page toast.
    $('.popup').mouseenter(function () {
        $(this).stop().animate({ top: 32 }, 500, 'linear');
    }).mouseleave(function () {
        $(this).stop().animate({ top: 104 }, 800, 'linear');
    });

    // Filter resets.
    $('#DirectoryFilters a.btn').click(function () {
        $(this).siblings('input').removeAttr("checked");
        $('#List div.clearfix').stop().animate({ backgroundColor: "#FFFFFF", padding: "0" }, "fast").removeClass('show');
    });

    $('#Filters a.btn').click(function () {
        $('#CampusMap').css({ backgroundImage: defaultMap });
        $('#CampusMap .overlay').css({ backgroundColor: '#000000', opacity: '100.0' });
        $('#Filters input').removeAttr("checked");
        filters = [];
        $('#List div.clearfix').stop().animate({ backgroundColor: "#FFFFFF", padding: "0" }, "fast").removeClass('show');
        $('#List.facility li>div').show();
        $('#CampusMap .overlay').stop().animate({ opacity: '0.15' }, "fast");
        $('#DepartmentList li').slideDown('fast');
        $('.departmentSearch').val('Search Directory');
    });

    // Filter Facility listings.
    $('#Filters input.opt').change(function () {
        var filter = $(this).attr("value");

        if ($(this).attr("checked")) {
            filters.push(filter);
        } else {
            filters.removeItem(filter);
        }

        if (filters.length == 0) {
            $('#List.facility li>div').show();
        }
        else {
            $('#List.facility li>div').hide();

            for (var i = 0; i < filters.length; i++) {
                $('#List.facility li>div.' + filters[i]).show();
            }
        }
    });

    $('.jscroller').jScrollPane({ showArrows: false });
    setTimeout(function () {
        $('.jscroller').jScrollPane({ showArrows: false });
    }, 3000);


    var copyClasses = $('.static-feature .copy');
    if (copyClasses != null) {
        $('.static-feature .copy').equalHeights();
    }

    if ($('#Aside a.modal') != null) {
        $('#Aside a.modal').nyroModal();
    }

    if ($('.faculty_item a') != null) {
        $('.faculty_item a').nyroModal({
            bgColor: '#eeeeee',
            titleFromIframe: false,
            title: null
        });
    }

    //Academics Colleges - Hide college listings on load.
    $('ol.degree li.clearfix').removeClass('selected').children('div.desc').hide();

    //Academics Colleges - Show college listings onclick.
    $('ol.degree div.head h4 a').click(function () {
        var thisLi = $(this).parent().parent().parent();
        if ($('ol.degree.databases').length) {
            DatabaseViewHack();
        }
        if (thisLi.hasClass('selected')) {
            thisLi.removeClass('selected').children('div.desc').slideUp("500", function () {
                $(this).addClass('visuallyhidden');
            });
            return false;
        }

        //Close all.
        $('ol.degree li.clearfix').removeClass('selected').children('div.desc').slideUp("500", function () {
            $(this).addClass('visuallyhidden');
        });

        //Show the clicked one. 
        thisLi.addClass('selected').children('div.desc').slideDown("fast").removeClass('visuallyhidden');

        return false;
    });


    $(function pageload() {
        $('ol.degree li').removeClass("selected");
        $('ol.degree li.clearfix:first').addClass('selected').children('div.desc').show();
        if ($('ol.degree.databases').length) {
            // this is inneficient and should have ol.databases passed down into here
            DatabaseViewHack();
            $('ol.degree.databases li.clearfix:first').removeClass('selected').children('div.desc').hide();
        }
    });

    //Hide all degree summaries on load.
    $('#DegreePrograms ol li a').removeClass('hover').siblings('div.s').hide();

    //Academics Page degree listings.
    $('#DegreePrograms ol li a.expand_button').click(function () {
        var obj = $('#DegreePrograms ol li a.expand_button');
        //Close all.
        if ($(this).hasClass("hover")) {
            $(obj).removeClass('hover').siblings('div.s').slideUp("500", function () {
                $(this).addClass('visuallyhidden');
            });
            return false;
        }

        $(obj).removeClass('hover').siblings('div.s').slideUp("500", function () {
            $(this).addClass('visuallyhidden');
        });

        //Show this one. 
        $(this).addClass('hover').siblings('div.s').slideDown("fast").removeClass('visuallyhidden');

        return false;
    });

    //CommonContacts widget.
    $('#CommonContacts li div').hide();
    $('#CommonContacts li a.dept-line').click(function () {
        $(this).siblings('div').slideToggle('fast');
    });

    /**
    * #List zoom feature.
    *    Directory: Staff listings.
    *    Maps: Facility listings. 
    */
    $('#List img.photo, #List a.fn').click(function () {
        var box = $(this).parent().parent('div.clearfix');
        if (box.hasClass('show')) {
            box.removeClass('show').stop().animate({ backgroundColor: "#FFFFFF", padding: "0" }, "fast");
            return false;
        }

        //Close all.
        $('#List div.clearfix').stop().animate({ backgroundColor: "#FFFFFF", padding: "0" }, "fast").removeClass('show');

        //Show this one. 
        $(this).parent().parent('div.clearfix').stop().animate({ backgroundColor: "#fca142", padding: "10px" }, "fast", function () {
            $(this).addClass('show');
        });

        // Animate Map on Maps page.
        if ($('#CampusMap').length > 0) {
            $('#CampusMap .overlay').css({ backgroundColor: '#000000', opacity: '100.0' });
            var mapPath = $('input:hidden:last', $(box)).val();
            $('#CampusMap').css({ backgroundImage: 'url(' + mapPath + ')' });
            $('#CampusMap .overlay').stop().animate({ opacity: '0.00' }, 1000);
        }
        return false;
    });

    $('#SubNavMenu .selected:first a:first').addClass('gray_link');
    $('#SubNavMenu .selected').each(function () {
        $('a:first', (this)).addClass('selected_link');
    });
});

function DatabaseViewHack() {
    setTimeout(function() {
        $('ol.databases > div.jspPane').width('auto');
        $('.jscroller').width('auto');
        $('.jspContainer').width('auto');
        $('.jscroller').jScrollPane({ showArrows: false });
    }, 1);
}

$(function () {
    
});

// Searching Faculty And Staff Directory

function clearAll() {
    $('#RenderedPeople li').remove();
    $('.results_container h4').text('');
}

function ResetAll() {
    $('#RenderedPeople li').remove();
    $('.results_container h4').text('')
    $("#FirstName").val('');
    $("#LastName").val('');
    $("#Department").val('all').attr('selected', true);
    $("#Staff").attr("checked", true);
    $("#Faculty").attr("checked", true);
}

function setResultTitle() {
    $('.results_container h4').text($('.person').length + " Results Found");
}

function SearchFacultyStaff(ItemsArray) {
    var peopleListing = ItemsArray;
    clearAll();

    var results = [];
    var firstNameText = $("#FirstName").val().toLowerCase();
    var lastNameText = $("#LastName").val().toLowerCase();
    var isStaff = $("#Staff").attr("checked") == true;
    var isFaculty = $("#Faculty").attr("checked") == true;

    // First Name
    if (firstNameText.length > 0) {
        var fResults = [];
        for (var i = 0; i < peopleListing.length; i++) {
            if (peopleListing[i].FirstName != null) {
                if (peopleListing[i].FirstName.toLowerCase().indexOf(firstNameText) != -1) {
                    fResults.push(peopleListing[i]);
                }
            }
        }
        peopleListing = [];
        peopleListing = fResults;
    }

    // Last Name
    if (lastNameText.length > 0) {
        var lResults = [];
        for (var i = 0; i < peopleListing.length; i++) {
            if (peopleListing[i].LastName.toLowerCase().indexOf(lastNameText) != -1) {
                lResults.push(peopleListing[i]);
            }
        }
        peopleListing = [];
        peopleListing = lResults;
    }

    // Department
    if ($("#Department").val() != "all") {
        var dResults = [];
        var dept = $("#Department").val().toLowerCase();
        for (var i = 0; i < peopleListing.length; i++) {
            if (peopleListing[i].Department.toLowerCase() == dept) {
                dResults.push(peopleListing[i]);
            }
        }
        peopleListing = [];
        peopleListing = dResults;
    }

    if (isFaculty && isStaff) {
        return peopleListing;
    }

    //Include
    if (isFaculty && !isStaff) {
        var faResults = [];
        for (var i = 0; i < peopleListing.length; i++) {
            if (peopleListing[i].Persontype.toLowerCase() == "faculty") {
                faResults.push(peopleListing[i]);
            }
        }
        peopleListing = [];
        peopleListing = faResults;
    }

    if (isStaff && !isFaculty) {
        var sResults = [];
        for (var i = 0; i < peopleListing.length; i++) {
            if (peopleListing[i].Persontype.toLowerCase() == "staff") {
                sResults.push(peopleListing[i]);
            }
        }
        peopleListing = [];
        peopleListing = sResults;
    }
    return peopleListing;
}

function GetAlphaList() {
    var letters = [
    
    ]

    for (i = 0; i > 26; i++) {
        var letter = alphabet.substr(i, 1);
        {letter:'letter'}
    }
    return ol;
}
