/**
 * SlideDeck 1.2.5 Pro - 2011-06-01
 * Copyright (c) 2011 digital-telepathy (http://www.dtelepathy.com)
 * 
 * BY USING THIS SOFTWARE, YOU AGREE TO THE TERMS OF THE SLIDEDECK 
 * LICENSE AGREEMENT FOUND AT http://www.slidedeck.com/license. 
 * IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE THE SOFTWARE.
 * 
 * More information on this project:
 * http://www.slidedeck.com/
 * 
 * Requires: jQuery v1.3+
 * 
 * Full Usage Documentation: http://www.slidedeck.com/usage-documentation 
 * Usage:
 *     $(el).slidedeck(opts);
 * 
 * @param {HTMLObject} el    The <DL> element to extend as a SlideDeck
 * @param {Object} opts      An object to pass custom override options to
 */
var SlideDeck;
var SlideDeckSkin = {};
(function ($) {
   window.SlideDeck = function (B, C) {
      var D = this,
         B = $(B);
      var E = "1.2.5";
      this.options = {
         speed: 500,
         transition: 'swing',
         start: 1,
         activeCorner: true,
         index: true,
         scroll: true,
         keys: true,
         autoPlay: true,
         autoPlayInterval: 5000,
         hideSpines: false,
         cycle: false,
         touchThreshold: {
            x: 50,
            y: 30
         },
         touch: true,
         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 = B;
      this.spines = B.children('dt');
      this.slides = B.children('dd');
      this.controlTo = 1;
      this.session = [];
      this.disabledSlides = [];
      this.pauseAutoPlay = false;
      this.isLoaded = false;
      var F = navigator.userAgent.toLowerCase();
      this.browser = {
         chrome: F.match(/chrome/) ? true : false,
         firefox: F.match(/firefox/) ? true : false,
         firefox2: F.match(/firefox\/2/) ? true : false,
         firefox30: F.match(/firefox\/3\.0/) ? true : false,
         msie: F.match(/msie/) ? true : false,
         msie6: (F.match(/msie 6/) && !F.match(/msie 7|8/)) ? true : false,
         msie7: F.match(/msie 7/) ? true : false,
         msie8: F.match(/msie 8/) ? true : false,
         msie9: F.match(/msie 9/) ? true : false,
         chromeFrame: (F.match(/msie/) && F.match(/chrome/)) ? true : false,
         opera: F.match(/opera/) ? true : false,
         safari: (F.match(/safari/) && !F.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.chromeFrame) {
         this.browser.version = F.match(/chrome\/([0-9\.]+)/)[1]
      }
      if (this.browser.firefox === true) {
         this.browser.version = F.match(/firefox\/([0-9\.]+)/)[1]
      }
      if (this.browser.msie === true) {
         this.browser.version = F.match(/msie ([0-9\.]+)/)[1]
      }
      if (this.browser.opera === true) {
         this.browser.version = F.match(/version\/([0-9\.]+)/)[1]
      }
      if (this.browser.safari === true) {
         this.browser.version = F.match(/version\/([0-9\.]+)/)[1]
      }
      var G;
      var H;
      var I, spine_outer_width, slide_width, spine_half_width;
      var J = function (a) {
            if (D.browser.msie && !D.browser.msie9) {
               var b = a.css('background-color');
               var c = b;
               if (c == "transparent") {
                  b = "#ffffff"
               } else {
                  if (c.match('#')) {
                     if (c.length < 7) {
                        var t = "#" + c.substr(1, 1) + c.substr(1, 1) + c.substr(2, 1) + c.substr(2, 1) + c.substr(3, 1) + c.substr(3, 1);
                        b = t
                     }
                  }
               }
               b = b.replace("#", "");
               cParts = {
                  r: b.substr(0, 2),
                  g: b.substr(2, 2),
                  b: b.substr(4, 2)
               };
               var d = "#";
               var e = "01234567890ABCDEF";
               for (var k in cParts) {
                  cParts[k] = Math.max(0, (parseInt(cParts[k], 16) - 1));
                  cParts[k] = e.charAt((cParts[k] - cParts[k] % 16) / 16) + e.charAt(cParts[k] % 16);
                  d += cParts[k]
               }
               a.find('.' + D.classes.index).css({
                  'filter': 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1) chroma(color=' + d + ')',
                  backgroundColor: d
               })
            }
         };
      var K = function () {
            if (typeof (Cufon) != "undefined") {
               Cufon.DOM.ready(function () {
                  if (typeof (D.options.cufonRefresh) != "undefined") {
                     var a = [];
                     if (typeof (D.options.cufonRefresh) == "string") {
                        a.push(D.options.cufonRefresh)
                     } else {
                        a = D.options.cufonRefresh
                     }
                     for (var i = 0; i < a.length; i++) {
                        Cufon.refresh(a[i])
                     }
                  }
                  if (D.options.hideSpines === false) {
                     var b = 0;
                     if (D.browser.msie8 && !D.browser.chromeFrame) {
                        b = Math.floor(($(D.spines[0]).outerWidth() - $($(D.spines[0]).find('cufon')[0]).height()) / 2)
                     }
                     if (D.browser.safari || D.browser.chrome || D.browser.chromeFrame) {
                        if (document.doctype.publicId.toLowerCase().match(/transitional/)) {
                           b = Math.floor(($(D.spines[0]).outerHeight() - $($(D.spines[0]).find('cufon')[0]).height()) / 2)
                        }
                     }
                     D.spines.find('>cufon').css('margin-top', b)
                  }
               })
            }
         };
      var L = false;
      var M = function () {
            var a = document.getElementsByTagName('script');
            for (var i = 0; i < a.length; i++) {
               var b = a[i].src;
               if (b.match(/slidedeck\.jquery(\.(pro|profree))?(\.pack)?\.js/)) {
                  var c = b.split('?');
                  if (c.length > 1) {
                     if (c[1].match(/noping/)) {
                        L = true
                     }
                  }
               }
            }
            if (L === false) {
               L = true;
               var d = new Image();
               d.src = (document.location.protocol == "https:" ? "https:" : "http:") + "//www.slidedeck.com/6885858486f31043e5839c735d99457f045affd0/" + E + "/pro"
            }
         };
      var N = function () {
            if (D.options.controlProgress === true) {
               for (var i = 0; i < D.spines.length; i++) {
                  if (i < D.controlTo) {
                     $(D.spines[i]).removeClass(D.classes.disabled)
                  } else {
                     $(D.spines[i]).addClass(D.classes.disabled)
                  }
               }
            }
         };
      var O = function (a) {
            var b = false;
            if (typeof (D.verticalSlides) != 'undefined') {
               if (typeof (D.vertical().options) != 'undefined') {
                  if (D.vertical().options.scroll === true && $(a.target).parents('.' + D.classes.vertical).length > 0) {
                     b = true
                  }
               }
            }
            return b
         };
      var P = {
         timestamp: function () {
            var a = new Date();
            var b = a.getUTCFullYear() + "-" + a.getUTCMonth() + "-" + a.getUTCDate() + " " + a.getUTCHours() + ":" + a.getUTCMinutes() + ":" + a.getUTCSeconds();
            var c = (0 - a.getTimezoneOffset() / 60);
            var d = Math.floor(c);
            var e = "00";
            if (d != c) {
               e = (c - d) * 60
            }
            return b + d + ":" + e
         },
         track: function (a) {
            if (D.session.length === 0 || D.session[D.session.length - 1].slide != a) {
               D.session.push({
                  slide: a,
                  timestamp: this.timestamp()
               })
            }
         }
      };
      var Q = function () {
            var c = false,
               resetVertical = false;
            gotoNext = function () {
               c = false;
               if (D.pauseAutoPlay === false) {
                  if (typeof (D.vertical()) != 'undefined') {
                     if (D.vertical().navChildren) {
                        if (D.vertical().current + 1 != D.vertical().slides.length) {
                           c = true
                        }
                     }
                  }
                  var b = true;
                  if (D.options.cycle === false && D.current == D.slides.length) {
                     if (c === true) {
                        if (D.vertical().current + 1 === D.vertical().slides.length) {
                           b = false
                        }
                     } else {
                        b = false
                     }
                  }
                  if (b === false) {
                     D.pauseAutoPlay = true
                  } else {
                     if (c === true) {
                        D.vertical().next(function (a) {
                           if (typeof (a.vertical().slides) != 'undefined') {
                              if (a.vertical().current + 1 == a.vertical().slides.length) {
                                 c = false;
                                 resetVertical = a.current
                              }
                           }
                        })
                     } else {
                        D.next(function (a) {
                           if (resetVertical !== false) {
                              a.resetVertical(resetVertical);
                              resetVertical = false
                           }
                        })
                     }
                  }
               }
            };
            setInterval(gotoNext, D.options.autoPlayInterval)
         };
      var R = function () {
            if ($.inArray(B.css('position'), ['position', 'absolute', 'fixed'])) {
               B.css('position', 'relative')
            }
            B.css('overflow', 'hidden');
            for (var i = 0; i < D.slides.length; i++) {
               var d = $(D.slides[i]);
               if (D.spines.length > i) {
                  var e = $(D.spines[i])
               }
               var f = {
                  top: parseInt(d.css('padding-top'), 10),
                  right: parseInt(d.css('padding-right'), 10),
                  bottom: parseInt(d.css('padding-bottom'), 10),
                  left: parseInt(d.css('padding-left'), 10)
               };
               var g = {
                  top: parseInt(d.css('border-top-width'), 10),
                  right: parseInt(d.css('border-right-width'), 10),
                  bottom: parseInt(d.css('border-bottom-width'), 10),
                  left: parseInt(d.css('border-left-width'), 10)
               };
               for (var k in g) {
                  g[k] = isNaN(g[k]) ? 0 : g[k]
               }
               if (i < D.current) {
                  if (i == D.current - 1) {
                     if (D.options.hideSpines !== true) {
                        e.addClass(D.classes.active)
                     }
                     d.addClass(D.classes.active)
                  }
                  offset = i * spine_outer_width;
                  if (D.options.hideSpines === true) {
                     if (i == D.current - 1) {
                        offset = 0
                     } else {
                        offset = 0 - (D.options.start - i - 1) * B.width()
                     }
                  }
               } else {
                  offset = i * spine_outer_width + slide_width;
                  if (D.options.hideSpines === true) {
                     offset = (i + 1 - D.options.start) * B.width()
                  }
               }
               D.slide_width = (slide_width - f.left - f.right - g.left - g.right);
               d.css({
                  position: 'absolute',
                  left: offset,
                  zIndex: 1,
                  height: (H - f.top - f.bottom - g.top - g.bottom) + "px",
                  width: D.slide_width + "px",
                  margin: 0,
                  paddingLeft: f.left + spine_outer_width + "px"
               }).addClass(D.classes.slide).addClass(D.classes.slide + "_" + (i + 1));
               if (D.options.hideSpines !== true) {
                  var h = {
                     top: parseInt(e.css('padding-top'), 10),
                     right: parseInt(e.css('padding-right'), 10),
                     bottom: parseInt(e.css('padding-bottom'), 10),
                     left: parseInt(e.css('padding-left'), 10)
                  };
                  for (var k in h) {
                     if (h[k] < 10 && (k == "left" || k == "right")) {
                        h[k] = 10
                     }
                  }
                  var j = h.top + "px " + h.right + "px " + h.bottom + "px " + h.left + "px";
                  var l = {
                     position: 'absolute',
                     zIndex: 3,
                     display: 'block',
                     left: offset,
                     width: (H - h.left - h.right) + "px",
                     height: I + "px",
                     padding: j,
                     rotation: '270deg',
                     '-webkit-transform': 'rotate(270deg)',
                     '-webkit-transform-origin': spine_half_width + 'px 0px',
                     '-moz-transform': 'rotate(270deg)',
                     '-moz-transform-origin': spine_half_width + 'px 0px',
                     '-o-transform': 'rotate(270deg)',
                     '-o-transform-origin': spine_half_width + 'px 0px',
                     textAlign: 'right'
                  };
                  if (!D.browser.msie9) {
                     l.top = (D.browser.msie) ? 0 : (H - spine_half_width) + "px";
                     l.marginLeft = ((D.browser.msie) ? 0 : (0 - spine_half_width)) + "px";
                     l.filter = 'progid:DXImageTransform.Microsoft.BasicImage(rotation=3)'
                  }
                  e.css(l).addClass(D.classes.spine).addClass(D.classes.spine + "_" + (i + 1));
                  if (D.browser.msie9) {
                     e[0].style.msTransform = 'rotate(270deg)';
                     e[0].style.msTransformOrigin = Math.round(parseInt(B[0].style.height) / 2) + 'px ' + Math.round(parseInt(B[0].style.height) / 2) + 'px'
                  }
               } else {
                  if (typeof (e) != "undefined") {
                     e.hide()
                  }
               }
               if (i == D.slides.length - 1) {
                  d.addClass('last');
                  if (D.options.hideSpines !== true) {
                     e.addClass('last')
                  }
               }
               if (D.options.activeCorner === true && D.options.hideSpines === false) {
                  var m = document.createElement('DIV');
                  m.className = D.classes.activeCorner + ' ' + (D.classes.spine + '_' + (i + 1));
                  e.after(m);
                  e.next('.' + D.classes.activeCorner).css({
                     position: 'absolute',
                     top: '25px',
                     left: offset + spine_outer_width + "px",
                     overflow: "hidden",
                     zIndex: "20000"
                  }).hide();
                  if (e.hasClass(D.classes.active)) {
                     e.next('.' + D.classes.activeCorner).show()
                  }
               }
               if (D.options.hideSpines !== true) {
                  var n = document.createElement('DIV');
                  n.className = D.classes.index;
                  if (D.options.index !== false) {
                     var o;
                     if (typeof (D.options.index) != 'boolean') {
                        o = D.options.index[i % D.options.index.length]
                     } else {
                        o = "" + (i + 1)
                     }
                     n.appendChild(document.createTextNode(o))
                  }
                  e.append(n);
                  e.find('.' + D.classes.index).css({
                     position: 'absolute',
                     zIndex: 2,
                     display: 'block',
                     width: I + "px",
                     height: I + "px",
                     textAlign: 'center',
                     bottom: ((D.browser.msie) ? 0 : (0 - spine_half_width)) + "px",
                     left: ((D.browser.msie) ? 5 : 20) + "px",
                     rotation: "90deg",
                     '-webkit-transform': 'rotate(90deg)',
                     '-webkit-transform-origin': spine_half_width + 'px 0px',
                     '-moz-transform': 'rotate(90deg)',
                     '-moz-transform-origin': spine_half_width + 'px 0px',
                     '-o-transform': 'rotate(90deg)',
                     '-o-transform-origin': spine_half_width + 'px 0px'
                  });
                  if (D.browser.msie9) {
                     e.find('.' + D.classes.index)[0].style.msTransform = 'rotate(90deg)'
                  }
                  J(e)
               }
            }
            M();
            if (D.options.hideSpines !== true) {
               D.spines.bind('click', function (a) {
                  a.preventDefault();
                  D.goTo(D.spines.index(this) + 1)
               })
            }
            if (D.options.keys !== false) {
               $(document).bind('keydown', function (a) {
                  if ($(a.target).parents().index(D.deck) == -1) {
                     if (a.keyCode == 39) {
                        D.pauseAutoPlay = true;
                        D.next()
                     } else if (a.keyCode == 37) {
                        D.pauseAutoPlay = true;
                        D.prev()
                     }
                  }
               })
            }
            if (typeof ($.event.special.mousewheel) != "undefined") {
               B.bind("mousewheel", function (a) {
                  if (D.options.scroll !== false) {
                     if (!O(a)) {
                        var b = a.detail ? a.detail : a.wheelDelta;
                        if (D.browser.msie || D.browser.safari || D.browser.chrome) {
                           b = 0 - b
                        }
                        var c = false;
                        if ($(a.originalTarget).parents(D.deck).length) {
                           if ($.inArray(a.originalTarget.nodeName.toLowerCase(), ['input', 'select', 'option', 'textarea']) != -1) {
                              c = true
                           }
                        }
                        if (c !== true) {
                           if (b > 0) {
                              switch (D.options.scroll) {
                              case "stop":
                                 a.preventDefault();
                                 break;
                              case true:
                              default:
                                 if (D.current < D.slides.length || D.options.cycle == true) {
                                    a.preventDefault()
                                 }
                                 break
                              }
                              D.pauseAutoPlay = true;
                              D.next()
                           } else {
                              switch (D.options.scroll) {
                              case "stop":
                                 a.preventDefault();
                                 break;
                              case true:
                              default:
                                 if (D.current != 1 || D.options.cycle == true) {
                                    a.preventDefault()
                                 }
                                 break
                              }
                              D.pauseAutoPlay = true;
                              D.prev()
                           }
                        }
                     }
                  }
               })
            }
            if ((D.browser.msie !== true) && (D.options.touch != false)) {
               var p = {
                  x: 0,
                  y: 0
               };
               var q = {
                  x: 0,
                  y: 0
               };
               var r = D.options.touchThreshold;
               B[0].addEventListener('touchstart', function (a) {
                  p.x = a.targetTouches[0].pageX;
                  p.y = a.targetTouches[0].pageY
               }, false);
               B[0].addEventListener('touchmove', function (a) {
                  a.preventDefault();
                  q.x = a.targetTouches[0].pageX;
                  q.y = a.targetTouches[0].pageY
               }, false);
               B[0].addEventListener('touchend', function (a) {
                  var b = p.x - q.x;
                  var c = p.y - q.y;
                  if (q.x != 0) {
                     if (b < (0 - r.x)) {
                        D.pauseAutoPlay = true;
                        D.prev()
                     } else if (b > r.x) {
                        D.pauseAutoPlay = true;
                        D.next()
                     }
                     if (c < (0 - r.y)) {
                        D.pauseAutoPlay = true;
                        D.vertical().prev()
                     } else if (c > r.y) {
                        D.pauseAutoPlay = true;
                        D.vertical().next()
                     }
                  }
               }, false)
            }
            $(D.spines[D.current - 2]).addClass(D.classes.previous);
            $(D.spines[D.current]).addClass(D.classes.next);
            K();
            N();
            P.track(D.current);
            if (D.options.autoPlay === true) {
               Q()
            }
            D.isLoaded = true
         };
      var S = function (a) {
            a = Math.max(1, a - 1);
            if ($.inArray(a, D.disabledSlides) != -1) {
               if (a == 1) {
                  a = 1
               } else {
                  a = S(a)
               }
            }
            return a
         };
      var T = function (a) {
            a = Math.min(D.slides.length, a + 1);
            if ($.inArray(a, D.disabledSlides) != -1) {
               if (a == D.slides.length) {
                  a = D.current
               } else {
                  a = T(a)
               }
            }
            return a
         };
      var U = function (a) {
            a = Math.min(D.slides.length, Math.max(1, a));
            if ($.inArray(a, D.disabledSlides) != -1) {
               if (a < D.current) {
                  a = S(a)
               } else {
                  a = T(a)
               }
            }
            return a
         };
      var V = function (a, b) {
            a = U(a);
            if ((a <= D.controlTo || D.options.controlProgress !== true)) {
               if (typeof (D.options.before) == "function") {
                  D.options.before(D)
               }
               if (typeof (b) != "undefined") {
                  if (typeof (b.before) == "function") {
                     b.before(D)
                  }
               }
               var c = true;
               if (a < D.current) {
                  c = false
               }
               var d = [D.classes.active, D.classes.next, D.classes.previous].join(' ');
               D.current = a;
               D.spines.removeClass(d);
               D.slides.removeClass(d);
               B.find('.' + D.classes.activeCorner).hide();
               $(D.spines[D.current - 2]).addClass(D.classes.previous);
               $(D.spines[D.current]).addClass(D.classes.next);
               for (var i = 0; i < D.slides.length; i++) {
                  var e = 0;
                  if (D.options.hideSpines !== true) {
                     var f = $(D.spines[i])
                  }
                  var g = $(D.slides[i]);
                  if (i < D.current) {
                     if (i == (D.current - 1)) {
                        g.addClass(D.classes.active);
                        if (D.options.hideSpines !== true) {
                           f.addClass(D.classes.active);
                           f.next('.' + D.classes.activeCorner).show()
                        }
                        K()
                     }
                     e = i * spine_outer_width
                  } else {
                     e = i * spine_outer_width + slide_width
                  }
                  if (D.options.hideSpines === true) {
                     e = (i - D.current + 1) * B.width()
                  }
                  var h = {
                     duration: D.options.speed,
                     easing: D.options.transition
                  };
                  if (i == (c === true && D.current - 1) || i == (c === false && D.current)) {
                     var j = [];
                     if (typeof (D.options.complete) == "function") {
                        j.push(function () {
                           D.options.complete(D)
                        })
                     }
                     switch (typeof (b)) {
                     case "function":
                        j.push(function () {
                           b(D)
                        });
                        break;
                     case "object":
                        j.push(function () {
                           b.complete(D)
                        });
                        break
                     }
                     P.track(D.current);
                     if (i == 0) {
                        h.complete = function () {
                           for (var z = 0; z < j.length; z++) {
                              j[z]()
                           }
                        }
                     }
                  }
                  g.stop().animate({
                     left: e + "px",
                     width: D.slide_width + "px"
                  }, h);
                  if (D.options.hideSpines !== true) {
                     J(f);
                     if (f.css('left') != e + "px") {
                        f.stop().animate({
                           left: e + "px"
                        }, {
                           duration: D.options.speed,
                           easing: D.options.transition
                        });
                        f.next('.' + D.classes.activeCorner).stop().animate({
                           left: e + spine_outer_width + "px"
                        }, {
                           duration: D.options.speed,
                           easing: D.options.transition
                        })
                     }
                  }
               }
               M()
            }
         };
      var W = function (a, b) {
            var c = a;
            if (typeof (a) === "string") {
               c = {};
               c[a] = b
            }
            for (var d in c) {
               b = c[d];
               switch (d) {
               case "speed":
               case "start":
                  b = parseFloat(b);
                  if (isNaN(b)) {
                     b = D.options[d]
                  }
                  break;
               case "scroll":
               case "keys":
               case "activeCorner":
               case "controlProgress":
               case "hideSpines":
               case "autoPlay":
               case "cycle":
                  if (typeof (b) !== "boolean") {
                     b = D.options[d]
                  }
                  break;
               case "cufonRefresh":
               case "transition":
                  if (typeof (b) !== "string") {
                     b = D.options[d]
                  }
                  break;
               case "complete":
               case "before":
                  if (typeof (b) !== "function") {
                     b = D.options[d]
                  }
                  break;
               case "index":
                  if (typeof (b) !== "boolean") {
                     if (!$.isArray(b)) {
                        b = D.options[d]
                     }
                  }
                  break
               }
               D.options[d] = b
            }
         };
      var X = function (a) {
            if ($.inArray(a, D.disabledSlides) == -1 && a !== 1 && a !== 0) {
               D.disabledSlides.push(a)
            }
         };
      var Y = function (a) {
            var b = $.inArray(a, D.disabledSlides);
            if (b != -1) {
               D.disabledSlides.splice(b, 1)
            }
         };
      var Z = function (l, m, n) {
            var o = this;
            var l = $(l);
            var p = l.children();
            if (l[0].nodeName == "DL") {
               p = l.children('dd');
               var q = l.children('dt').hide()
            }
            var r = p.length;
            var s = l.parents('dd.slide');
            var t = l.parent();
            var u = s.innerHeight();
            var w = 100;
            if (m.deck.find('.' + m.classes.activeCorner).length) {
               w = m.deck.find('.' + m.classes.activeCorner).css('z-index') - 1
            }
            this.navParent = null;
            this.navChildren = null;
            this.current = 0;
            this.slides = p;
            this.options = {
               speed: 500,
               scroll: true,
               continueScrolling: false
            };
            if (typeof (n) == 'object') {
               for (var k in n) {
                  this.options[k] = n[k]
               }
            }
            this.classes = {
               navContainer: 'verticalSlideNav',
               arrow: 'arrow',
               prefix: 'verticalSlide'
            };
            var x = function (a, b, c) {
                  if (typeof (o.options.before) == 'function') {
                     o.options.before(o)
                  }
                  if (typeof (c) == 'object') {
                     if (typeof (c.before) == 'function') {
                        c.before(o)
                     }
                  }
                  o.current = a;
                  var d = o.options.speed;
                  if (typeof (b) != 'undefined') {
                     d = 0
                  }
                  s.find('ul.' + o.classes.navContainer + ' li.' + o.classes.arrow).stop().animate({
                     top: $(o.navChildren[o.current]).position().top + 'px'
                  }, 250);
                  o.navChildren.removeClass('active');
                  $(o.navChildren[o.current]).addClass('active');
                  l.stop().animate({
                     top: 0 - (o.current * u) + 'px'
                  }, d, function () {
                     if (typeof (o.options.complete) == 'function') {
                        o.options.complete(o)
                     }
                     if (typeof (c) == 'object') {
                        if (typeof (c.complete) == 'function') {
                           c.complete(o)
                        }
                     } else if (typeof (c) == 'function') {
                        c(m)
                     }
                  })
               };
            var y = function () {
                  var b = document.createElement('UL');
                  b.className = o.classes.navContainer;
                  b.style.position = 'absolute';
                  b.style.zIndex = w;
                  b.style.listStyleType = 'none';
                  for (a = 0; a < r; a++) {
                     var c = document.createElement('LI');
                     c.className = 'nav_' + (a + 1) + (a === 0 ? ' active' : '');
                     c.style.listStyleType = 'none';
                     var d = document.createElement('A');
                     if (p[a].id) {
                        d.href = "#" + p[a].id
                     } else {
                        d.href = "#" + (a + 1)
                     }
                     d.className = 'nav_' + (a + 1);
                     var e = "Nav " + (a + 1);
                     if (typeof (q) != 'undefined') {
                        e = q.eq(a).html()
                     }
                     d.innerHTML = e;
                     c.appendChild(d);
                     b.appendChild(c)
                  }
                  var f = document.createElement('LI');
                  f.className = o.classes.arrow;
                  f.style.top = 0;
                  f.appendChild(document.createTextNode(' '));
                  b.appendChild(f);
                  s.append(b);
                  o.navChildren = s.find('.' + b.className + ' li');
                  s.find('.' + b.className + ' li a').click(function (a) {
                     a.preventDefault();
                     x(this.className.match('nav_([0-9]+)')[1] - 1)
                  })
               };
            this.goTo = function (v, h, a) {
               v = Math.min(r - 1, Math.max(0, v - 1));
               h = Math.min(m.slides.length - 1, Math.max(0, v));
               $(m.slides[h]).find('.' + this.classes.navContainer + ' a:eq(' + v + ')').addClass(m.classes.active).siblings().removeClass(m.classes.active);
               x(v, a)
            };
            this.next = function (a) {
               x(Math.min(r - 1, o.current + 1), undefined, a)
            };
            this.prev = function (a) {
               x(Math.max(0, o.current - 1), undefined, a)
            };
            this.snapTo = function (v, a) {
               x(Math.max(0, Math.min(r - 1, v)), true, a)
            };
            var z = function () {
                  if (!s.find('.' + o.classes.navContainer).length) {
                     var f = (((m.browser.msie !== true) || m.browser.msie9) ? $(m.spines[0]).outerHeight() : $(m.spines[0]).outerWidth());
                     if (m.options.hideSpines === true) {
                        f = 0
                     }
                     l.css({
                        position: 'absolute',
                        zIndex: w - 1,
                        top: '0px',
                        left: f,
                        listStyleType: 'none',
                        padding: '0px',
                        margin: '0px',
                        width: t.innerWidth() - f,
                        height: u * r
                     });
                     var g = {
                        top: parseInt(p.css('padding-top'), 10),
                        right: parseInt(p.css('padding-right'), 10),
                        bottom: parseInt(p.css('padding-bottom'), 10),
                        left: parseInt(p.css('padding-left'), 10)
                     };
                     var h = {
                        top: parseInt(p.css('border-top-width'), 10),
                        right: parseInt(p.css('border-right-width'), 10),
                        bottom: parseInt(p.css('border-bottom-width'), 10),
                        left: parseInt(p.css('border-left-width'), 10)
                     };
                     for (var k in h) {
                        if (isNaN(h[k])) {
                           h[k] = 0
                        }
                     }
                     var i = u - g.top - g.bottom - h.top - h.bottom;
                     var j = l.width() - g.right - g.left - h.right - h.left;
                     p.each(function (a, e) {
                        $(e).css({
                           listStyleType: 'none',
                           position: 'absolute',
                           top: a * u,
                           width: j,
                           height: i
                        }).addClass(o.classes.prefix + '_' + (a + 1))
                     });
                     t.css({
                        overflow: 'hidden'
                     });
                     y();
                     if (typeof ($.event.special.mousewheel) != "undefined") {
                        l.bind("mousewheel", function (a) {
                           if (o.options.scroll !== false) {
                              var b = a.detail ? a.detail : a.wheelDelta;
                              if (m.browser.msie || m.browser.safari || m.browser.chrome) {
                                 b = 0 - b
                              }
                              var c = false;
                              if ($(a.originalTarget).parents(o.deck).length) {
                                 if ($.inArray(a.originalTarget.nodeName.toLowerCase(), ['input', 'select', 'option', 'textarea']) != -1) {
                                    c = true
                                 }
                              }
                              if (c !== true) {
                                 var d, lastSlide = false;
                                 if (o.options.continueScrolling === true) {
                                    if ((o.current + 1) == 1) {
                                       d = true
                                    } else if ((o.current + 1) == o.slides.length) {
                                       lastSlide = true
                                    }
                                 }
                                 if (b > 0) {
                                    a.preventDefault();
                                    m.pauseAutoPlay = true;
                                    if (lastSlide) {
                                       m.next();
                                       return false
                                    } else {
                                       o.next()
                                    }
                                 } else {
                                    a.preventDefault();
                                    m.pauseAutoPlay = true;
                                    if (d) {
                                       m.prev();
                                       return false
                                    } else {
                                       o.prev()
                                    }
                                 }
                              }
                           }
                        })
                     }
                  }
               };
            if (u > 0) {
               z()
            } else {
               var A;
               A = setInterval(function () {
                  l = $(l);
                  p = l.children();
                  r = p.length;
                  s = l.parents('dd.slide');
                  t = l.parent();
                  u = s.innerHeight();
                  if (u > 0) {
                     clearInterval(A);
                     z()
                  }
               }, 20)
            }
         };
      var bd = function () {
            H = B.height();
            G = B.width();
            B.css('height', H + "px");
            I = 0;
            spine_outer_width = 0;
            if (D.options.hideSpines !== true && D.spines.length > 0) {
               I = $(D.spines[0]).height();
               spine_outer_width = $(D.spines[0]).outerHeight()
            }
            slide_width = G - spine_outer_width * D.spines.length;
            if (D.options.hideSpines === true) {
               slide_width = G
            }
            spine_half_width = Math.ceil(I / 2)
         };
      var be = function (a) {
            if ((D.browser.opera && D.browser.version < "10.5") || D.browser.msie6 || D.browser.firefox2 || D.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 (a) != "undefined") {
               for (var b in a) {
                  D.options[b] = a[b]
               }
            }
            if (D.spines.length < 1) {
               D.options.hideSpines = true
            }
            if (D.options.hideSpines === true) {
               D.options.activeCorner = false
            }
            D.current = Math.min(D.slides.length, Math.max(1, D.options.start));
            if (B.height() > 0) {
               bd();
               R()
            } else {
               var c;
               c = setTimeout(function () {
                  bd();
                  if (B.height() > 0) {
                     clearInterval(c);
                     bd();
                     R()
                  }
               }, 20)
            }
         };
      var bf = function (a) {
            var b;
            b = setInterval(function () {
               if (D.isLoaded == true) {
                  clearInterval(b);
                  a()
               }
            }, 20)
         };
      this.loaded = function (a) {
         bf(a);
         return D
      };
      this.next = function (a) {
         var b = Math.min(D.slides.length, (D.current + 1));
         if (D.options.cycle === true) {
            if (D.current + 1 > D.slides.length) {
               b = 1
            }
         }
         V(b, a);
         return D
      };
      this.prev = function (a) {
         var b = Math.max(1, (D.current - 1));
         if (D.options.cycle === true) {
            if (D.current - 1 < 1) {
               b = D.slides.length
            }
         }
         V(b, a);
         return D
      };
      this.goTo = function (a, b) {
         D.pauseAutoPlay = true;
         V(Math.min(D.slides.length, Math.max(1, a)), b);
         return D
      };
      this.progressTo = function (a, b) {
         D.pauseAutoPlay = true;
         D.updateControlTo(a);
         D.goTo(a, b);
         return D
      };
      this.updateControlTo = function (a) {
         D.controlTo = a;
         N();
         return D
      };
      this.disableSlide = function (a) {
         X(a);
         return D
      };
      this.enableSlide = function (a) {
         Y(a);
         return D
      };
      this.setOption = function (a, b) {
         W(a, b);
         return D
      };
      this.vertical = function (a) {
         var b = this;
         if (typeof (this.verticalSlides) == 'undefined') {
            this.verticalSlides = {};
            for (i = 0; i < this.slides.length; i++) {
               var c = $(this.slides[i]).find('.' + this.classes.vertical);
               var v = {
                  next: function () {
                     return false
                  },
                  prev: function () {
                     return false
                  },
                  goTo: function () {
                     return false
                  }
               };
               if (c.length) {
                  v = new Z(c, this, a)
               }
               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)
      };
      be(C)
   };
   $.fn.slidedeck = function (a) {
      var b = [];
      for (var i = 0; i < this.length; i++) {
         if (!this[i].slidedeck) {
            this[i].slidedeck = new SlideDeck(this[i], a)
         }
         b.push(this[i].slidedeck)
      }
      return b.length > 1 ? b : b[0]
   }
})(jQuery);
