/*
* jQuery Orbit Plugin 1.2.3
*/

$(window).load(function () {
    $('#gallery').orbit({
        animation: 'fade',                  // fade, horizontal-slide, vertical-slide, horizontal-push
        advanceSpeed: 3000, 		 // if timer is enabled, time between transitions 
        pauseOnHover: true, 		 // if you hover pauses the slider
        startClockOnMouseOut: true, 	 // if clock should start on MouseOut
        startClockOnMouseOutAfter: 500 	 // how long after MouseOut should the timer start again
    });
});

(function (d) {
    d.fn.orbit = function (a) {
        a = d.extend({ animation: "horizontal-push", animationSpeed: 600, timer: !0, advanceSpeed: 4E3, pauseOnHover: !1, startClockOnMouseOut: !1, startClockOnMouseOutAfter: 1E3, directionalNav: !1, captions: !0, captionAnimation: "fade", captionAnimationSpeed: 600, bullets: !0, bulletThumbs: !1, bulletThumbLocation: "", afterSlideChange: function () { } }, a); return this.each(function () {
            function q() {
                if (!a.timer || a.timer == "false") return !1; else r.is(":hidden") ? s = setInterval(function () { l("next") }, a.advanceSpeed) :
(o = !0, x.removeClass("active"), s = setInterval(function () { var a = "rotate(" + m + "deg)"; m += 2; t.css({ "-webkit-transform": a, "-moz-transform": a, "-o-transform": a }); m > 180 && (t.addClass("move"), z.addClass("move")); m > 360 && (t.removeClass("move"), z.removeClass("move"), m = 0, l("next")) }, a.advanceSpeed / 180))
            } function n() { if (!a.timer || a.timer == "false") return !1; else o = !1, clearInterval(s), x.addClass("active") } function A() {
                if (!a.captions || a.captions == "false") return !1; else {
                    var y = e.eq(b).data("caption"); (_captionHTML = d(y).html()) ?
(j.attr("id", y).html(_captionHTML), a.captionAnimation == "none" && j.show(), a.captionAnimation == "fade" && j.fadeIn(a.captionAnimationSpeed), a.captionAnimation == "slideOpen" && j.slideDown(a.captionAnimationSpeed)) : (a.captionAnimation == "none" && j.hide(), a.captionAnimation == "fade" && j.fadeOut(a.captionAnimationSpeed), a.captionAnimation == "slideOpen" && j.slideUp(a.captionAnimationSpeed))
                } 
            } function B() { if (a.bullets) D.children("li").removeClass("active").eq(b).addClass("active"); else return !1 } function l(d) {
                function c() {
                    e.eq(f).css({ "z-index": 1 });
                    u = !1; a.afterSlideChange.call(this)
                } var f = b, g = d; if (f == g) return !1; if (e.length == "1") return !1; u || (u = !0, d == "next" ? (b++, b == p && (b = 0)) : d == "prev" ? (b--, b < 0 && (b = p - 1)) : (b = d, f < b ? g = "next" : f > b && (g = "prev")), B(), e.eq(f).css({ "z-index": 2 }), a.animation == "fade" && e.eq(b).css({ opacity: 0, "z-index": 3 }).animate({ opacity: 1 }, a.animationSpeed, c), a.animation == "horizontal-slide" && (g == "next" && e.eq(b).css({ left: h, "z-index": 3 }).animate({ left: 0 }, a.animationSpeed, c), g == "prev" && e.eq(b).css({ left: -h, "z-index": 3 }).animate({ left: 0 }, a.animationSpeed,
c)), a.animation == "vertical-slide" && (g == "prev" && e.eq(b).css({ top: v, "z-index": 3 }).animate({ top: 0 }, a.animationSpeed, c), g == "next" && e.eq(b).css({ top: -v, "z-index": 3 }).animate({ top: 0 }, a.animationSpeed, c)), a.animation == "horizontal-push" && (g == "next" && (e.eq(b).css({ left: h, "z-index": 3 }).animate({ left: 0 }, a.animationSpeed, c), e.eq(f).animate({ left: -h }, a.animationSpeed)), g == "prev" && (e.eq(b).css({ left: -h, "z-index": 3 }).animate({ left: 0 }, a.animationSpeed, c), e.eq(f).animate({ left: h }, a.animationSpeed))), A())
            } var b = 0,
p = 0, h, v, u, f = d(this).addClass("orbit"), c = f.wrap('<div class="orbit-wrapper" />').parent(); f.add(h).width("1px").height("1px"); var e = f.children("img, a, div"); e.each(function () { var a = d(this), b = a.width(), a = a.height(); b > f.width() && (f.add(c).width(b), h = f.width()); a > f.height() && (f.add(c).height(a), v = f.height()); p++ }); if (e.length == 1) a.directionalNav = !1, a.timer = !1, a.bullets = !1; e.eq(b).css({ "z-index": 3 }).fadeIn(0, function () { e.css({ display: "block" }) }); if (a.timer) {
                c.append('<div class="timer"><span class="mask"><span class="rotator"></span></span><span class="pause"></span></div>');
                var r = d("div.timer"), o; if (r.length != 0) { var t = d("div.timer span.rotator"), z = d("div.timer span.mask"), x = d("div.timer span.pause"), m = 0, s; q(); r.click(function () { o ? n() : q() }); if (a.startClockOnMouseOut) { var C; c.mouseleave(function () { C = setTimeout(function () { o || q() }, a.startClockOnMouseOutAfter) }); c.mouseenter(function () { clearTimeout(C) }) } } 
            } a.pauseOnHover && c.mouseenter(function () { n() }); if (a.captions) { c.parent().append('<div class="orbit-caption"></div>'); var j = c.parent().children(".orbit-caption"); A() } if (a.directionalNav) {
                if (a.directionalNav ==
"false") return !1; c.append('<div class="slider-nav"><span class="right">Right</span><span class="left">Left</span></div>'); var k = c.children("div.slider-nav").children("span.left"), w = c.children("div.slider-nav").children("span.right"); k.click(function () { n(); l("prev") }); w.click(function () { n(); l("next") })
            } if (a.bullets) {
                c.parent().append('<ul class="orbit-bullets"></ul>'); var D = d("ul.orbit-bullets"); for (i = 0; i < p; i++) {
                    k = d("<li>" + (i + 1) + "</li>"); if (a.bulletThumbs && (w = e.eq(i).data("thumb"))) k = d('<li class="has-thumb">' +
i + "</li>"), k.css({ background: "url(" + a.bulletThumbLocation + w + ") no-repeat" }); d("ul.orbit-bullets").append(k); k.data("index", i); k.click(function () { n(); l(d(this).data("index")) })
                } B()
            } 
        })
    } 
})(jQuery);
