var SlideDeck;
(function($) {
    SlideDeck = function(d, f) {
        var self = this,
		d = $(d);
        var j = "1.2.1";
        this.options = {
            speed: 500,
            transition: 'swing',
            start: 1,
            activeCorner: true,
            index: true,
            scroll: true,
            keys: true,
            autoPlay: false,
            autoPlayInterval: 5000,
            hideSpines: false,
            cycle: false,
            controlProgress: false
        };
        this.classes = {
            slide: 'slide',
            spine: 'spine',
            label: 'label',
            index: 'index',
            active: 'active',
            indicator: 'indicator',
            activeCorner: 'activeCorner',
            disabled: 'disabled',
            vertical: "slidesVertical",
            previous: 'previous',
            next: 'next'
        };
        this.current = 1;
        this.deck = d;
        this.spines = d.children('dt');
        this.slides = d.children('dd');
        this.controlTo = 1;
        this.session = [];
        this.disabledSlides = [];
        this.pauseAutoPlay = false;
        this.isLoaded = false;
        var l = navigator.userAgent.toLowerCase();
        this.browser = {
            chrome: l.match(/chrome/) ? true : false,
            firefox: l.match(/firefox/) ? true : false,
            firefox2: l.match(/firefox\/2/) ? true : false,
            firefox30: l.match(/firefox\/3\.0/) ? true : false,
            msie: l.match(/msie/) ? true : false,
            msie6: (l.match(/msie 6/) && !l.match(/msie 7|8/)) ? true : false,
            msie7: l.match(/msie 7/) ? true : false,
            msie8: l.match(/msie 8/) ? true : false,
            chromeFrame: (l.match(/msie/) && l.match(/chrome/)) ? true : false,
            opera: l.match(/opera/) ? true : false,
            safari: (l.match(/safari/) && !l.match(/chrome/)) ? true : false
        };
        for (var b in this.browser) {
            if (this.browser[b] === true) {
                this.browser._this = b;
            }
        }
        if (this.browser.chrome === true) {
            this.browser.version = l.match(/chrome\/([0-9\.]+)/)[1];
        }
        if (this.browser.firefox === true) {
            this.browser.version = l.match(/firefox\/([0-9\.]+)/)[1];
        }
        if (this.browser.msie === true) {
            this.browser.version = l.match(/msie ([0-9\.]+)/)[1];
        }
        if (this.browser.opera === true) {
            this.browser.version = l.match(/version\/([0-9\.]+)/)[1];
        }
        if (this.browser.safari === true) {
            this.browser.version = l.match(/version\/([0-9\.]+)/)[1];
        }
        var m;
        var n;
        var o, p, q, s;
        var u = function(spine) {
            if (self.browser.msie && !self.browser.chromeFrame) {
                var S = spine.css("background-color");
                var T = S;
                if (T == "transparent") {
                    S = "#ffffff";
                } else {
                    if (T.match('\x23')) {
                        if (T.length < 7) {
                            var t = "\x23" + T.substr(1, 1) + T.substr(1, 1) + T.substr(2, 1) + T.substr(2, 1) + T.substr(3, 1) + T.substr(3, 1);
                            S = t;
                        }
                    }
                }
                S = S.replace("\x23", "");
                cParts = {
                    r: S.substr(0, 2),
                    g: S.substr(2, 2),
                    b: S.substr(4, 2)
                };
                var U = "\x23";
                var V = "01234567890ABCDEF";
                for (var k in cParts) {
                    cParts[k] = Math.max(0, (parseInt(cParts[k], 16) - 1));
                    cParts[k] = V.charAt((cParts[k] - cParts[k] % 16) / 16) + V.charAt(cParts[k] % 16);
                    U += cParts[k];
                }
                spine.find('\x2e' + self.classes.index).css({
                    'filter': "progid:DXImageTransform.Microsoft.BasicImage(rotation=1) chroma(color=" + U + '\x29',
                    backgroundColor: U
                });
            }
        };
        var w = function() {
            if (typeof (Cufon) != "undefined") {
                Cufon.DOM.ready(function() {
                    if (typeof (self.options.cufonRefresh) != "undefined") {
                        var S = [];
                        if (typeof (self.options.cufonRefresh) == "string") {
                            S.push(self.options.cufonRefresh);
                        } else {
                            S = self.options.cufonRefresh;
                        }
                        for (var i = 0; i < S.length; i++) {
                            Cufon.refresh(S[i]);
                        }
                    }
                    if (self.options.hideSpines === false) {
                        var T = 0;
                        if (self.browser.msie8 && !self.browser.chromeFrame) {
                            T = Math.floor(($(self.spines[0]).outerWidth() - $($(self.spines[0]).find('cufon')[0]).height()) / 2);
                        }
                        if (self.browser.safari || self.browser.chrome || self.browser.chromeFrame) {
                            if (document.doctype.publicId.toLowerCase().match(/transitional/)) {
                                T = Math.floor(($(self.spines[0]).outerHeight() - $($(self.spines[0]).find('cufon')[0]).height()) / 2);
                            }
                        }
                        self.spines.find('>cufon').css('margin-top', T);
                    }
                });
            }
        };
        var C = function() {
            if (self.options.controlProgress === true) {
                for (var i = 0; i < self.spines.length; i++) {
                    if (i < self.controlTo) {
                        $(self.spines[i]).removeClass(self.classes.disabled);
                    } else {
                        $(self.spines[i]).addClass(self.classes.disabled);
                    }
                }
            }
        };
        var D = function(event) {
            var S = false;
            if (typeof (self.verticalSlides) != 'undefined') {
                if (typeof (self.vertical().options) != 'undefined') {
                    if (self.vertical().options.scroll === true && $(event.target).parents('\x2e' + self.classes.vertical).length > 0) {
                        S = true;
                    }
                }
            }
            return S;
        };
        var E = {
            timestamp: function() {
                var S = new Date();
                var T = S.getUTCFullYear() + "\x2d" + S.getUTCMonth() + "\x2d" + S.getUTCDate() + "\x20" + S.getUTCHours() + "\x3a" + S.getUTCMinutes() + "\x3a" + S.getUTCSeconds();
                var U = (0 - S.getTimezoneOffset() / 60);
                var V = Math.floor(U);
                var W = "00";
                if (V != U) {
                    W = (U - V) * 60;
                }
                return T + V + "\x3a" + W;
            },
            track: function(S) {
                if (self.session.length === 0 || self.session[self.session.length - 1].slide != S) {
                    self.session.push({
                        slide: S,
                        timestamp: this.timestamp()
                    });
                }
            }
        };
        var F = function() {
            var S = false,
			T = false;
            gotoNext = function() {
                S = false;
                if (self.pauseAutoPlay === false) {
                    if (typeof (self.vertical()) != 'undefined') {
                        if (self.vertical().navChildren) {
                            if (self.vertical().current + 1 != self.vertical().slides.length) {
                                S = true;
                            }
                        }
                    }
                    var U = true;
                    if (self.options.cycle === false && self.current == self.slides.length) {
                        if (S === true) {
                            if (self.vertical().current + 1 === self.vertical().slides.length) {
                                U = false;
                            }
                        } else {
                            U = false;
                        }
                    }
                    if (U === false) {
                        self.pauseAutoPlay = true;
                    } else {
                        if (S === true) {
                            self.vertical().next(function(V) {
                                if (typeof (V.vertical().slides) != 'undefined') {
                                    if (V.vertical().current + 1 == V.vertical().slides.length) {
                                        S = false;
                                        T = V.current;
                                    }
                                }
                            });
                        } else {
                            self.next(function(V) {
                                if (T !== false) {
                                    V.resetVertical(T);
                                    T = false;
                                }
                            });
                        }
                    }
                }
            };
            setInterval(gotoNext, self.options.autoPlayInterval);
        };
        var G = function() {
            if ($.inArray(d.css('position'), ['position', 'absolute', 'fixed'])) {
                d.css('position', 'relative');
            }
            d.css('overflow', 'hidden');
            for (var i = 0; i < self.slides.length; i++) {
                var S = $(self.slides[i]);
                if (self.spines.length > i) {
                    var spine = $(self.spines[i]);
                }
                var T = {
                    top: parseInt(S.css('padding-top'), 10),
                    right: parseInt(S.css("padding-right"), 10),
                    bottom: parseInt(S.css("padding-bottom"), 10),
                    left: parseInt(S.css("padding-left"), 10)
                };
                var U = {
                    top: parseInt(S.css("border-top-width"), 10),
                    right: parseInt(S.css("border-right-width"), 10),
                    bottom: parseInt(S.css("border-bottom-width"), 10),
                    left: parseInt(S.css("border-left-width"), 10)
                };
                for (var k in U) {
                    U[k] = isNaN(U[k]) ? 0 : U[k];
                }
                if (i < self.current) {
                    if (i == self.current - 1) {
                        if (self.options.hideSpines !== true) {
                            spine.addClass(self.classes.active);
                        }
                        S.addClass(self.classes.active);
                    }
                    offset = i * p;
                    if (self.options.hideSpines === true) {
                        if (i == self.current - 1) {
                            offset = 0;
                        } else {
                            offset = 0 - (self.options.start - i - 1) * d.width();
                        }
                    }
                } else {
                    offset = i * p + q;
                    if (self.options.hideSpines === true) {
                        offset = (i + 1 - self.options.start) * d.width();
                    }
                }
                self.slide_width = (q - T.left - T.right - U.left - U.right);
                S.css({
                    position: 'absolute',
                    left: offset,
                    zIndex: 1,
                    height: (n - T.top - T.bottom - U.top - U.bottom) + "px",
                    width: self.slide_width + "px",
                    margin: 0,
                    paddingLeft: T.left + p + "px"
                }).addClass(self.classes.slide).addClass(self.classes.slide + "\x5f" + (i + 1));
                if (self.options.hideSpines !== true) {
                    var V = {
                        top: parseInt(spine.css('padding-top'), 10),
                        right: parseInt(spine.css("padding-right"), 10),
                        bottom: parseInt(spine.css("padding-bottom"), 10),
                        left: parseInt(spine.css("padding-left"), 10)
                    };
                    for (var k in V) {
                        if (V[k] < 10 && (k == "left" || k == "right")) {
                            V[k] = 10;
                        }
                    }
                    var W = V.top + "px " + V.right + "px " + V.bottom + "px " + V.left + "px";
                    spine.css({
                        position: 'absolute',
                        zIndex: 3,
                        display: 'block',
                        left: offset,
                        width: (n - V.left - V.right) + "px",
                        height: o + "px",
                        padding: W,
                        rotation: '270deg',
                        '-webkit-transform': "rotate(270deg)",
                        '-webkit-transform-origin': s + 'px 0px',
                        '-moz-transform': "rotate(270deg)",
                        '-moz-transform-origin': s + 'px 0px',
                        '-o-transform': "rotate(270deg)",
                        '-o-transform-origin': s + 'px 0px',
                        textAlign: 'right',
                        top: (self.browser.msie && !self.browser.chromeFrame) ? 0 : (n - s) + "px",
                        marginLeft: ((self.browser.msie && !self.browser.chromeFrame) ? 0 : (0 - s)) + "px",
                        filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"
                    }).addClass(self.classes.spine).addClass(self.classes.spine + "\x5f" + (i + 1));
                } else {
                    if (typeof (spine) != "undefined") {
                        spine.hide();
                    }
                }
                if (i == self.slides.length - 1) {
                    S.addClass('last');
                    if (self.options.hideSpines !== true) {
                        spine.addClass('last');
                    }
                }
                if (self.options.activeCorner === true && self.options.hideSpines === false) {
                    var X = document.createElement('DIV');
                    X.className = self.classes.activeCorner + '\x20' + (self.classes.spine + '\x5f' + (i + 1));
                    spine.after(X);
                    spine.next('\x2e' + self.classes.activeCorner).css({
                        position: 'absolute',
                        top: '25px',
                        left: offset + p + "px",
                        overflow: "hidden",
                        zIndex: "20000"
                    }).hide();
                    if (spine.hasClass(self.classes.active)) {
                        spine.next('\x2e' + self.classes.activeCorner).show();
                    }
                }
                if (self.options.hideSpines !== true) {
                    var Y = document.createElement('DIV');
                    Y.className = self.classes.index;
                    if (self.options.index !== false) {
                        var Z;
                        if (typeof (self.options.index) != 'boolean') {
                            Z = self.options.index[i % self.options.index.length];
                        } else {
                            Z = "" + (i + 1);
                        }
                        Y.appendChild(document.createTextNode(Z));
                    }
                    spine.append(Y);
                    spine.find('\x2e' + self.classes.index).css({
                        position: 'absolute',
                        zIndex: 2,
                        display: 'block',
                        width: o + "px",
                        height: o + "px",
                        textAlign: 'center',
                        bottom: ((self.browser.msie && !self.browser.chromeFrame) ? 0 : (0 - s)) + "px",
                        left: ((self.browser.msie && !self.browser.chromeFrame) ? 5 : 20) + "px",
                        rotation: "90deg",
                        '-webkit-transform': "rotate(90deg)",
                        '-webkit-transform-origin': s + 'px 0px',
                        '-moz-transform': "rotate(90deg)",
                        '-moz-transform-origin': s + 'px 0px',
                        '-o-transform': "rotate(90deg)",
                        '-o-transform-origin': s + 'px 0px'
                    });
                    u(spine);
                }
            }
            if (self.options.hideSpines !== true) {
                self.spines.bind('click', function(event) {
                    event.preventDefault();
                    self.goTo(self.spines.index(this) + 1);
                });
            }
            if (self.options.keys !== false) {
                $(document).bind('keydown', function(event) {
                    if ($(event.target).parents().index(self.deck) == -1) {
                        if (event.keyCode == 39) {
                            self.pauseAutoPlay = true;
                            self.next();
                        } else if (event.keyCode == 37) {
                            self.pauseAutoPlay = true;
                            self.prev();
                        }
                    }
                });
            }
            if (typeof ($.event.special.mousewheel) != "undefined") {
                d.bind("mousewheel", function(event) {
                    if (self.options.scroll !== false) {
                        if (!D(event)) {
                            var ad = event.detail ? event.detail : event.wheelDelta;
                            if (self.browser.msie || self.browser.safari || self.browser.chrome) {
                                ad = 0 - ad;
                            }
                            var ae = false;
                            if ($(event.originalTarget).parents(self.deck).length) {
                                if ($.inArray(event.originalTarget.nodeName.toLowerCase(), ['input', 'select', 'option', 'textarea']) != -1) {
                                    ae = true;
                                }
                            }
                            if (ae !== true) {
                                if (ad > 0) {
                                    switch (self.options.scroll) {
                                        case "stop":
                                            event.preventDefault();
                                            break;
                                        case true:
                                        default:
                                            if (self.current < self.slides.length || self.options.cycle == true) {
                                                event.preventDefault();
                                            }
                                            break;
                                    }
                                    self.pauseAutoPlay = true;
                                    self.next();
                                } else {
                                    switch (self.options.scroll) {
                                        case "stop":
                                            event.preventDefault();
                                            break;
                                        case true:
                                        default:
                                            if (self.current != 1 || self.options.cycle == true) {
                                                event.preventDefault();
                                            }
                                            break;
                                    }
                                    self.pauseAutoPlay = true;
                                    self.prev();
                                }
                            }
                        }
                    }
                });
            }
            if (self.browser.msie !== true) {
                var aa = {
                    x: 0,
                    y: 0
                };
                var ab = {
                    x: 0,
                    y: 0
                };
                var ac = {
                    x: 50,
                    y: 30
                };
                d[0].addEventListener('touchstart', function(event) {
                    aa.x = event.targetTouches[0].pageX;
                    aa.y = event.targetTouches[0].pageY;
                },
				false);
                d[0].addEventListener('touchmove', function(event) {
                    event.preventDefault();
                    ab.x = event.targetTouches[0].pageX;
                    ab.y = event.targetTouches[0].pageY;
                },
				false);
                d[0].addEventListener('touchend', function(event) {
                    var ad = aa.x - ab.x;
                    var ae = aa.y - ab.y;
                    if (ad < (0 - ac.x)) {
                        self.pauseAutoPlay = true;
                        self.prev();
                    } else if (ad > ac.x) {
                        self.pauseAutoPlay = true;
                        self.next();
                    }
                    if (ae < (0 - ac.y)) {
                        self.pauseAutoPlay = true;
                        self.vertical().prev();
                    } else if (ae > ac.y) {
                        self.pauseAutoPlay = true;
                        self.vertical().next();
                    }
                },
				false);
            }
            $(self.spines[self.current - 2]).addClass(self.classes.previous);
            $(self.spines[self.current]).addClass(self.classes.next);
            w();
            C();
            E.track(self.current);
            if (self.options.autoPlay === true) {
                F();
            }
            self.isLoaded = true;
        };
        var H = function(S) {
            S = Math.max(1, S - 1);
            if ($.inArray(S, self.disabledSlides) != -1) {
                if (S == 1) {
                    S = 1;
                } else {
                    S = H(S);
                }
            }
            return S;
        };
        var I = function(S) {
            S = Math.min(self.slides.length, S + 1);
            if ($.inArray(S, self.disabledSlides) != -1) {
                if (S == self.slides.length) {
                    S = self.current;
                } else {
                    S = I(S);
                }
            }
            return S;
        };
        var J = function(S) {
            S = Math.min(self.slides.length, Math.max(1, S));
            if ($.inArray(S, self.disabledSlides) != -1) {
                if (S < self.current) {
                    S = H(S);
                } else {
                    S = I(S);
                }
            }
            return S;
        };
        var K = function(S, T) {
            S = J(S);
            if ((S <= self.controlTo || self.options.controlProgress !== true)) {
                if (typeof (self.options.before) == "function") {
                    self.options.before(self);
                }
                if (typeof (T) != "undefined") {
                    if (typeof (T.before) == "function") {
                        T.before(self);
                    }
                }
                var U = true;
                if (S < self.current) {
                    U = false;
                }
                var V = [self.classes.active, self.classes.next, self.classes.previous].join('\x20');
                self.current = S;
                self.spines.removeClass(V);
                self.slides.removeClass(V);
                d.find('\x2e' + self.classes.activeCorner).hide();
                $(self.spines[self.current - 2]).addClass(self.classes.previous);
                $(self.spines[self.current]).addClass(self.classes.next);
                for (var i = 0; i < self.slides.length; i++) {
                    var W = 0;
                    if (self.options.hideSpines !== true) {
                        var spine = $(self.spines[i]);
                    }
                    var X = $(self.slides[i]);
                    if (i < self.current) {
                        if (i == (self.current - 1)) {
                            X.addClass(self.classes.active);
                            if (self.options.hideSpines !== true) {
                                spine.addClass(self.classes.active);
                                spine.next('\x2e' + self.classes.activeCorner).show();
                            }
                            w();
                        }
                        W = i * p;
                    } else {
                        W = i * p + q;
                    }
                    if (self.options.hideSpines === true) {
                        W = (i - self.current + 1) * d.width();
                    }
                    var Y = {
                        duration: self.options.speed,
                        easing: self.options.transition
                    };
                    if (i == (U === true && self.current - 1) || i == (U === false && self.current)) {
                        var Z = [];
                        if (typeof (self.options.complete) == "function") {
                            Z.push(function() {
                                self.options.complete(self);
                            });
                        }
                        switch (typeof (T)) {
                            case "function":
                                Z.push(function() {
                                    T(self);
                                });
                                break;
                            case "object":
                                Z.push(function() {
                                    T.complete(self);
                                });
                                break;
                        }
                        E.track(self.current);
                        if (i == 0) {
                            Y.complete = function() {
                                for (var z = 0; z < Z.length; z++) {
                                    Z[z]();
                                }
                            };
                        }
                    }
                    X.stop().animate({
                        left: W + "px",
                        width: self.slide_width + "px"
                    },
					Y);
                    if (self.options.hideSpines !== true) {
                        u(spine);
                        if (spine.css('left') != W + "px") {
                            spine.stop().animate({
                                left: W + "px"
                            },
							{
							    duration: self.options.speed,
							    easing: self.options.transition
							});
                            spine.next('\x2e' + self.classes.activeCorner).stop().animate({
                                left: W + p + "px"
                            },
							{
							    duration: self.options.speed,
							    easing: self.options.transition
							});
                        }
                    }
                }
            }
        };
        var L = function(S, T) {
            var U = S;
            if (typeof (S) === "string") {
                U = {};
                U[S] = T;
            }
            for (var V in U) {
                T = U[V];
                switch (V) {
                    case "speed":
                    case "start":
                        T = parseFloat(T);
                        if (isNaN(T)) {
                            T = self.options[V];
                        }
                        break;
                    case "scroll":
                    case "keys":
                    case "activeCorner":
                    case "controlProgress":
                    case "hideSpines":
                    case "autoPlay":
                    case "cycle":
                        if (typeof (T) !== "boolean") {
                            T = self.options[V];
                        }
                        break;
                    case "cufonRefresh":
                    case "transition":
                        if (typeof (T) !== "string") {
                            T = self.options[V];
                        }
                        break;
                    case "complete":
                    case "before":
                        if (typeof (T) !== "function") {
                            T = self.options[V];
                        }
                        break;
                    case "index":
                        if (typeof (T) !== "boolean") {
                            if (!$.isArray(T)) {
                                T = self.options[V];
                            }
                        }
                        break;
                }
                self.options[V] = T;
            }
        };
        var M = function(S) {
            if ($.inArray(S, self.disabledSlides) == -1 && S !== 1 && S !== 0) {
                self.disabledSlides.push(S);
            }
        };
        var N = function(S) {
            var T = $.inArray(S, self.disabledSlides);
            if (T != -1) {
                self.disabledSlides.splice(T, 1);
            }
        };
        var O = function(S, T, U) {
            var self = this;
            var S = $(S);
            var V = S.children();
            var W = V.length;
            var X = S.parents('dd.slide');
            var Y = S.parent();
            var Z = X.innerHeight();
            var aa = 100;
            if (T.deck.find('\x2e' + T.classes.activeCorner).length) {
                aa = T.deck.find('\x2e' + T.classes.activeCorner).css('z-index') - 1;
            }
            this.navParent = null;
            this.navChildren = null;
            this.current = 0;
            this.slides = V;
            this.options = {
                speed: 500,
                scroll: true,
                continueScrolling: false
            };
            if (typeof (U) == 'object') {
                for (var k in U) {
                    this.options[k] = U[k];
                }
            }
            this.classes = {
                navContainer: "verticalSlideNav",
                arrow: 'arrow',
                prefix: "verticalSlide"
            };
            var ab = function(af, ag, ah) {
                if (typeof (self.options.before) == 'function') {
                    self.options.before(self);
                }
                if (typeof (ah) == 'object') {
                    if (typeof (ah.before) == 'function') {
                        ah.before(self);
                    }
                }
                self.current = af;
                var ai = self.options.speed;
                if (typeof (ag) != 'undefined') {
                    ai = 0;
                }
                X.find('ul.' + self.classes.navContainer + ' li.' + self.classes.arrow).stop().animate({
                    top: $(self.navChildren[self.current]).position().top + 'px'
                },
				250);
                self.navChildren.removeClass('active');
                $(self.navChildren[self.current]).addClass('active');
                S.stop().animate({
                    top: 0 - (self.current * Z) + 'px'
                },
				ai, function() {
				    if (typeof (self.options.complete) == 'function') {
				        self.options.complete(self);
				    }
				    if (typeof (ah) == 'object') {
				        if (typeof (ah.complete) == 'function') {
				            ah.complete(self);
				        }
				    } else if (typeof (ah) == 'function') {
				        ah(T);
				    }
				});
            };
            var ac = function() {
                var af = document.createElement('UL');
                af.className = self.classes.navContainer;
                af.style.position = 'absolute';
                af.style.zIndex = aa;
                af.style.listStyleType = 'none';
                for (a = 0; a < W; a++) {
                    var ag = document.createElement('LI');
                    ag.className = 'nav_' + (a + 1) + (a === 0 ? ' active' : '');
                    ag.style.listStyleType = 'none';
                    var ah = document.createElement('\x41');
                    ah.href = "\x23" + (a + 1);
                    ah.appendChild(document.createTextNode('Nav ' + (a + 1)));
                    ag.appendChild(ah);
                    af.appendChild(ag);
                }
                var ai = document.createElement('LI');
                ai.className = self.classes.arrow;
                ai.style.top = 0;
                ai.appendChild(document.createTextNode('\x20'));
                af.appendChild(ai);
                X.append(af);
                self.navChildren = X.find('\x2e' + af.className + ' li');
                X.find('\x2e' + af.className + ' li a').click(function(event) {
                    event.preventDefault();
                    ab(this.href.split('\x23')[1] - 1);
                });
            };
            this.goTo = function(v, h, af) {
                v = Math.min(W - 1, Math.max(0, v - 1));
                h = Math.min(T.slides.length - 1, Math.max(0, v));
                $(T.slides[h]).find('\x2e' + this.classes.navContainer + ' a:eq(' + v + '\x29').addClass(T.classes.active).siblings().removeClass(T.classes.active);
                ab(v, af);
            };
            this.next = function(af) {
                ab(Math.min(W - 1, self.current + 1), undefined, af);
            };
            this.prev = function(af) {
                ab(Math.max(0, self.current - 1), undefined, af);
            };
            this.snapTo = function(v, af) {
                ab(Math.max(0, Math.min(W - 1, v)), true, af);
            };
            var ad = function() {
                if (!X.find('\x2e' + self.classes.navContainer).length) {
                    var af = ((T.browser.msie !== true || T.browser.chromeFrame) ? $(T.spines[0]).outerHeight() : $(T.spines[0]).outerWidth());
                    if (T.options.hideSpines === true) {
                        af = 0;
                    }
                    S.css({
                        position: 'absolute',
                        zIndex: aa - 1,
                        top: '0px',
                        left: af,
                        listStyleType: 'none',
                        padding: '0px',
                        margin: '0px',
                        width: Y.innerWidth() - af,
                        height: Z * W
                    });
                    var ag = {
                        top: parseInt(V.css('padding-top'), 10),
                        right: parseInt(V.css("padding-right"), 10),
                        bottom: parseInt(V.css("padding-bottom"), 10),
                        left: parseInt(V.css("padding-left"), 10)
                    };
                    var ah = {
                        top: parseInt(V.css("border-top-width"), 10),
                        right: parseInt(V.css("border-right-width"), 10),
                        bottom: parseInt(V.css("border-bottom-width"), 10),
                        left: parseInt(V.css("border-left-width"), 10)
                    };
                    for (var k in ah) {
                        if (isNaN(ah[k])) {
                            ah[k] = 0;
                        }
                    }
                    var ai = Z - ag.top - ag.bottom - ah.top - ah.bottom;
                    var aj = S.width() - ag.right - ag.left - ah.right - ah.left;
                    V.each(function(ak, e) {
                        $(e).css({
                            listStyleType: 'none',
                            position: 'absolute',
                            top: ak * Z,
                            width: aj,
                            height: ai
                        }).addClass(self.classes.prefix + '\x5f' + (ak + 1));
                    });
                    Y.css({
                        overflow: 'hidden'
                    });
                    ac();
                    if (typeof ($.event.special.mousewheel) != "undefined") {
                        S.bind("mousewheel", function(event) {
                            if (self.options.scroll !== false) {
                                var ak = event.detail ? event.detail : event.wheelDelta;
                                if (T.browser.msie || T.browser.safari || T.browser.chrome) {
                                    ak = 0 - ak;
                                }
                                var al = false;
                                if ($(event.originalTarget).parents(self.deck).length) {
                                    if ($.inArray(event.originalTarget.nodeName.toLowerCase(), ['input', 'select', 'option', 'textarea']) != -1) {
                                        al = true;
                                    }
                                }
                                if (al !== true) {
                                    var am, an = false;
                                    if (self.options.continueScrolling === true) {
                                        if ((self.current + 1) == 1) {
                                            am = true;
                                        } else if ((self.current + 1) == self.slides.length) {
                                            an = true;
                                        }
                                    }
                                    if (ak > 0) {
                                        event.preventDefault();
                                        T.pauseAutoPlay = true;
                                        if (an) {
                                            T.next();
                                            return false;
                                        } else {
                                            self.next();
                                        }
                                    } else {
                                        event.preventDefault();
                                        T.pauseAutoPlay = true;
                                        if (am) {
                                            T.prev();
                                            return false;
                                        } else {
                                            self.prev();
                                        }
                                    }
                                }
                            }
                        });
                    }
                }
            };
            if (Z > 0) {
                ad();
            } else {
                var ae;
                ae = setInterval(function() {
                    S = $(S);
                    V = S.children();
                    W = V.length;
                    X = S.parents('dd.slide');
                    Y = S.parent();
                    Z = X.innerHeight();
                    if (Z > 0) {
                        clearInterval(ae);
                        ad();
                    }
                },
				20);
            }
        };
        var P = function() {
            n = d.height();
            m = d.width();
            d.css('height', n + "px");
            o = 0;
            p = 0;
            if (self.options.hideSpines !== true && self.spines.length > 0) {
                o = $(self.spines[0]).height();
                p = $(self.spines[0]).outerHeight();
            }
            q = m - p * self.spines.length;
            if (self.options.hideSpines === true) {
                q = m;
            }
            s = Math.ceil(o / 2);
        };
        var Q = function(S) {
            if ((self.browser.opera && self.browser.version < "10.5") || self.browser.msie6 || self.browser.firefox2 || self.browser.firefox30) {
                if (typeof (console) != "undefined") {
                    if (typeof (console.error) == "function") {
                        console.error("This web browser is not supported by SlideDeck. Please view this page in a modern, CSS3 capable browser or a current version of Inernet Explorer");
                    }
                }
                return false;
            }
            if (typeof (S) != "undefined") {
                for (var T in S) {
                    self.options[T] = S[T];
                }
            }
            if (self.spines.length < 1) {
                self.options.hideSpines = true;
            }
            if (self.options.hideSpines === true) {
                self.options.activeCorner = false;
            }
            self.current = Math.min(self.slides.length, Math.max(1, self.options.start));
            if (d.height() > 0) {
                P();
                G();
            } else {
                var U;
                U = setTimeout(function() {
                    P();
                    if (d.height() > 0) {
                        clearInterval(U);
                        P();
                        G();
                    }
                },
				20);
            }
        };
        var R = function(S) {
            var T;
            T = setInterval(function() {
                if (self.isLoaded == true) {
                    clearInterval(T);
                    S();
                }
            },
			20);
        };
        this.loaded = function(S) {
            R(S);
            return self;
        };
        this.next = function(S) {
            var T = Math.min(self.slides.length, (self.current + 1));
            if (self.options.cycle === true) {
                if (self.current + 1 > self.slides.length) {
                    T = 1;
                }
            }
            K(T, S);
            return self;
        };
        this.prev = function(S) {
            var T = Math.max(1, (self.current - 1));
            if (self.options.cycle === true) {
                if (self.current - 1 < 1) {
                    T = self.slides.length;
                }
            }
            K(T, S);
            return self;
        };
        this.goTo = function(S, T) {
            self.pauseAutoPlay = true;
            K(Math.min(self.slides.length, Math.max(1, S)), T);
            return self;
        };
        this.progressTo = function(S, T) {
            self.pauseAutoPlay = true;
            self.updateControlTo(S);
            self.goTo(S, T);
            return self;
        };
        this.updateControlTo = function(S) {
            self.controlTo = S;
            C();
            return self;
        };
        this.disableSlide = function(S) {
            M(S);
            return self;
        };
        this.enableSlide = function(S) {
            N(S);
            return self;
        };
        this.setOption = function(S, T) {
            L(S, T);
            return self;
        };
        this.vertical = function(S) {
            var self = this;
            if (typeof (this.verticalSlides) == 'undefined') {
                this.verticalSlides = {};
                for (i = 0; i < this.slides.length; i++) {
                    var T = $(this.slides[i]).find('\x2e' + this.classes.vertical);
                    var v = {
                        next: function() {
                            return false;
                        },
                        prev: function() {
                            return false;
                        },
                        goTo: function() {
                            return false;
                        }
                    };
                    if (T.length) {
                        v = new O(T, this, S);
                    }
                    this.verticalSlides[i] = v;
                }
            } else {
                return this.verticalSlides[this.current - 1];
            }
        };
        this.goToVertical = function(v, h) {
            if (typeof (h) != 'undefined') {
                if (this.verticalSlides[h - 1] !== false) {
                    if (this.current == h) {
                        this.vertical().goTo(v);
                    } else {
                        this.verticalSlides[h - 1].goTo(v, h, true);
                        this.goTo(h);
                    }
                }
            } else {
                this.vertical().goTo(v);
            }
        };
        this.resetVertical = function(h) {
            if (typeof (h) == 'undefined') {
                h = this.current;
            }
            this.verticalSlides[h - 1].snapTo(0);
        };
        Q(f);
    };
    $.fn.slidedeck = function(d) {
        var f = [];
        for (var i = 0; i < this.length; i++) {
            if (!this[i].slidedeck) {
                this[i].slidedeck = new SlideDeck(this[i], d);
            }
            f.push(this[i].slidedeck);
        }
        return f.length > 1 ? f : f[0];
    };
})(jQuery);
