/*
 * RoyalSlider  v7.9
 *
 * Copyright 2011, Dmitry Semenov
 * 
 */
(function (a) {
    function b(b, c) {
        this.slider = a(b);
        this._az = "";
        this._by = "";
        this._cx = "";
        var d = this;
        this.settings = a.extend({}, a.fn.royalSlider.defaults, c);
        this.isSlideshowRunning = false;
        this._dw = false;
        this._ev = this.slider.find(".royalSlidesContainer");
        this._fu = this._ev.wrap('<div class="royalWrapper"/>').parent();
        this.slides = this._ev.find(".royalSlide");
        this._gt = "<p class='royalPreloader'></p>";
        this._hs = false;
        this._ir = false;
        if ("ontouchstart"in window) {
            if (!this.settings.disableTranslate3d) {
                if ("WebKitCSSMatrix"in window && "m11"in new WebKitCSSMatrix) {
                    this._ev.css({"-webkit-transform-origin":"0 0", "-webkit-transform":"translateZ(0)"});
                    this._ir = true
                }
            }
            this.hasTouch = true;
            this._az = "touchstart.rs";
            this._by = "touchmove.rs";
            this._cx = "touchend.rs"
        } else {
            this.hasTouch = false;
            if (this.settings.dragUsingMouse) {
                this._az = "mousedown.rs";
                this._by = "mousemove.rs";
                this._cx = "mouseup.rs"
            } else {
                this._ev.addClass("auto-cursor")
            }
        }
        if (this.hasTouch) {
            this.settings.directionNavAutoHide = false;
            this.settings.hideArrowOnLastSlide = true
        }
        if (a.browser.msie && parseInt(a.browser.version) <= 8) {
            this._jq = true
        } else {
            this._jq = false
        }
        this.slidesArr = [];
        var e, f, g, h;
        this.slides.each(function () {
            f = a(this);
            e = {};
            e.slide = f;
            if (d.settings.blockLinksOnDrag) {
                if (!this.hasTouch) {
                    f.find("a").bind("click.rs", function (a) {
                        if (d._hs) {
                            a.preventDefault();
                            return false
                        }
                    })
                } else {
                    var b = f.find("a");
                    var c;
                    b.each(function () {
                        c = a(this);
                        c.data("royalhref", c.attr("href"));
                        c.data("royaltarget", c.attr("target"));
                        c.attr("href", "#");
                        c.bind("click", function (b) {
                            b.preventDefault();
                            if (d._hs) {
                                return false
                            } else {
                                var c = a(this).data("royalhref");
                                var e = a(this).data("royaltarget");
                                if (!e || e.toLowerCase() === "_kp") {
                                    window.location.href = c
                                } else {
                                    window.open(c)
                                }
                            }
                        })
                    })
                }
            }
            if (d.settings.nonDraggableClassEnabled) {
                f.find(".non-draggable").bind(d._az, function (a) {
                    d._hs = false;
                    a.stopImmediatePropagation()
                })
            }
            g = f.attr("data-src");
            if (g == undefined || g == "" || g == "none") {
                e.preload = false
            } else {
                e.preload = true;
                e.preloadURL = g
            }
            if (d.settings.captionAnimationEnabled) {
                e.caption = f.find(".royalCaption").css("display", "none")
            }
            d.slidesArr.push(e)
        });
        this._lo = false;
        if (this.settings.removeCaptionsOpacityInIE8) {
            if (a.browser.msie && parseInt(a.browser.version, 10) <= 8) {
                this._lo = true
            }
        }
        this.slider.css("overflow", "visible");
        this.slideWidth = 0;
        this.slideHeight = 0;
        this.slideshowTimer = "";
        this.mn = false;
        this.numSlides = this.slides.length;
        this.currentSlideId = this.settings.startSlideIndex;
        this.lastSlideId = -1;
        this.isAnimating = true;
        this.wasSlideshowPlaying = false;
        this._az1 = 0;
        this._by1 = 0;
        this._cx1 = false;
        this._dw1 = [];
        this._ev1 = [];
        this._fu1 = false;
        this._gt1 = false;
        this._hs1 = 0;
        this._ir1 = 0;
        this._jq1 = 0;
        this._kp1 = 0;
        this._lo1 = false;
        this._mn1 = false;
        if (this.settings.slideTransitionType === "fade") {
            if (this._ir || "WebKitCSSMatrix"in window && "m11"in new WebKitCSSMatrix) {
                this._az2 = true
            } else {
                this._az2 = false
            }
            this._by2 = a("<div class='fade-container'></div>").appendTo(this._fu)
        }
        if (this.settings.slideshowEnabled && this.settings.slideshowDelay > 0) {
            if (!this.hasTouch && this.settings.slideshowPauseOnHover) {
                this.slider.hover(function () {
                    d._mn1 = true;
                    d._cx2(true)
                }, function () {
                    d._mn1 = false;
                    d._dw2(true)
                })
            }
            this.slideshowEnabled = true
        } else {
            this.slideshowEnabled = false
        }
        this._ev2();
        if (this.settings.controlNavEnabled) {
            var i;
            this._fu2Container = "";
            var j;
            if (!d.settings.controlNavThumbs) {
                this._fu2Container = a('<div class="royalControlNavOverflow"><div class="royalControlNavContainer"><div class="royalControlNavCenterer"></div></div></div>');
                i = this._fu2Container.find(".royalControlNavCenterer")
            } else {
                this.slider.addClass("with-thumbs");
                if (d.settings.controlNavThumbsNavigation) {
                    j = a('<div class="thumbsAndArrowsContainer"></div>');
                    this.thumbsArrowLeft = a("<a href='#' class='thumbsArrow left'></a>");
                    this.thumbsArrowRight = a("<a href='#' class='thumbsArrow right'></a>");
                    j.append(this.thumbsArrowLeft);
                    j.append(this.thumbsArrowRight);
                    var k = parseInt(this.thumbsArrowLeft.outerWidth(), 10);
                    this._fu2Container = a('<div class="royalControlNavOverflow royalThumbs"><div class="royalControlNavThumbsContainer"></div></div>');
                    i = this._fu2Container.find(".royalControlNavThumbsContainer")
                } else {
                    this._fu2Container = a('<div class="royalControlNavOverflow royalThumbs"><div class="royalControlNavContainer"><div class="royalControlNavCenterer"></div></div></div>');
                    i = this._fu2Container.find(".royalControlNavCenterer")
                }
            }
            var l = 0;
            this.slides.each(function (b) {
                if (d.settings.controlNavThumbs) {
                    i.append('<a href="#" class="royalThumb" style="background-image:url(' + a(this).attr("data-thumb") + ')">' + (b + 1) + "</a>")					
                } else {
                    i.append('<a href="#">' + (b + 1) + "</a>")
                }
                l++
            });
            this.navItems = i.children();
            if (j) {
                j.append(this._fu2Container);
                this._fu.after(j)
            } else {
                this._fu.after(this._fu2Container)
            }
            if (d.settings.controlNavThumbs && d.settings.controlNavThumbsNavigation) {
                this._ir2 = true;
                this._jq2 = false;
                this._kp2 = i;
                if (this._ir) {
                    this._kp2.css({"-webkit-transition-duration":this.settings.controlNavThumbsSpeed + "ms", "-webkit-transition-property":"-webkit-transform", "-webkit-transition-timing-function":"ease-in-out"})
                }
                this._lo2 = l;
                var m = this.navItems.eq(0);
                this._mn2 = m.outerWidth(true);
                this._az3 = this._mn2 * this._lo2;
                this._kp2.css("width", this._az3);
                this._by3 = parseInt(m.css("marginRight"), 10);
                this._az3 -= this._by3;
                this._cx3 = 0;
                this._dw3();
                this.thumbsArrowLeft.click(function (a) {
                    a.preventDefault();
                    if (!d._ir2)d._ev3(d._cx3 + d._fu3 + d._by3)
                });
                this.thumbsArrowRight.click(function (a) {
                    a.preventDefault();
                    if (!d._jq2)d._ev3(d._cx3 - d._fu3 - d._by3)
                })
            }
            this._gt3()
        }
        if (this.settings.directionNavEnabled) {
            this._fu.after("<a href='#' class='arrow left'/>");
            this._fu.after("<a href='#' class='arrow right'/>");
            this.arrowLeft = this.slider.find("a.arrow.left");
            this.arrowRight = this.slider.find("a.arrow.right");
            if (this.arrowLeft.length < 1 || this.arrowRight.length < 1) {
                this.settings.directionNavEnabled = false
            } else if (this.settings.directionNavAutoHide) {
                this.arrowLeft.hide();
                this.arrowRight.hide();
                this.slider.one("mousemove.arrowshover", function () {
                    d.arrowLeft.fadeIn("fast");
                    d.arrowRight.fadeIn("fast")
                });
                this.slider.hover(function () {
                    d.arrowLeft.fadeIn("fast");
                    d.arrowRight.fadeIn("fast")
                }, function () {
                    d.arrowLeft.fadeOut("fast");
                    d.arrowRight.fadeOut("fast")
                })
            }
            this._hs3()
        }
        this.sliderWidth = 0;
        this.sliderHeight = 0;
        var n;
        a(window).bind("resize.rs", function () {
            if (n)clearTimeout(n);
            n = setTimeout(function () {
                d.updateSliderSize()
            }, 100)
        });
        this.updateSliderSize();
        this.settings.beforeLoadStart.call(this);
        var o = this.slidesArr[this.currentSlideId];
        if (this.currentSlideId != 0) {
            if (!this._ir) {
                this._ev.css({left:-this.currentSlideId * this.slideWidth})
            } else {
                this._ev.css({"-webkit-transition-duration":"0ms", "-webkit-transition-property":"none"});
                this._ev.css({"-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)"})
            }
        }
        if (this.settings.welcomeScreenEnabled) {
            function p(a) {
                d.settings.loadingComplete.call(d);
                if (a && d.settings.preloadNearbyImages) {
                    d._ir3(d.currentSlideId)
                }
                d.slider.find(".royalLoadingScreen").fadeOut(d.settings.welcomeScreenShowSpeed);
                setTimeout(function () {
                    d._jq3()
                }, d.settings.welcomeScreenShowSpeed + 100)
            }

            if (o.preload) {
                this._ir3(this.currentSlideId, function () {
                    p(false)
                })
            } else {
                var h = o.slide.find("img.royalImage")[0];
                if (h) {
                    if (this._kp3(h)) {
                        p(true);
                        a(h).css("opacity", 0);
                        a(h).animate({opacity:1}, "fast")
                    } else {
                        a(h).css("opacity", 0);
                        a("<img />").load(
                            function () {
                                p(true);
                                a(h).animate({opacity:1}, "fast")
                            }).attr("src", h.src)
                    }
                } else {
                    p(true)
                }
            }
        } else {
            if (o.preload) {
                this._lo3(o, function () {
                    d.settings.loadingComplete.call(d);
                    if (d.settings.preloadNearbyImages) {
                        d._ir3(d.currentSlideId)
                    }
                })
            } else {
                var h = o.slide.find("img.royalImage")[0];
                if (h) {
                    if (this._kp3(h)) {
                        a(h).css("opacity", 0).animate({opacity:1}, "fast")
                    } else {
                        a(h).css("opacity", 0);
                        a("<img />").load(
                            function () {
                                a(h).animate({opacity:1}, "fast")
                            }).attr("src", h.src)
                    }
                }
                this.settings.loadingComplete.call(this)
            }
            setTimeout(function () {
                d._jq3()
            }, 100)
        }
    }

    b.prototype = {goTo:function (a, b, c, d) {
        if (!this.isAnimating) {
            this.isAnimating = true;
            var e = this;
            this.lastSlideId = this.currentSlideId;
            this.currentSlideId = a;
            this._gt1 = true;
            this._fu1 = true;
            if (this.lastSlideId != a) {
                this._gt3(c);
                this._ir3(a)
            }
            this._hs3();
            this.settings.beforeSlideChange.call(this);
            if (this.slideshowEnabled && this.slideshowTimer) {
                this.wasSlideshowPlaying = true;
                this._cx2()
            }
            var f = !b ? this.settings.slideTransitionSpeed : 0;
            if (d || b || this.settings.slideTransitionType === "move") {
                if (!this._ir) {
                    if (parseInt(this._ev.css("left"), 10) !== -this.currentSlideId * this.slideWidth) {
                        this._ev.animate({left:-this.currentSlideId * this.slideWidth}, f, this.settings.slideTransitionEasing, function () {
                            e._mn3()
                        })
                    } else {
                        this._mn3()
                    }
                } else {
                    if (this._az4() !== -this.currentSlideId * this.slideWidth) {
                        this._ev.bind("webkitTransitionEnd", function (a) {
                            if (a.target == e._ev.get(0)) {
                                e._mn3();
                                e._ev.unbind("webkitTransitionEnd")
                            }
                        });
                        this._ev.css({"-webkit-transition-duration":f + "ms", "-webkit-transition-property":"-webkit-transform", "-webkit-transition-timing-function":"ease-in-out", "-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)"})
                    } else {
                        this._mn3()
                    }
                }
            } else {
                var g = this.slidesArr[this.lastSlideId].slide;
                var h = g.clone().appendTo(this._by2);
                if (!this._az2) {
                    this._ev.css({left:-this.currentSlideId * this.slideWidth});
                    h.animate({opacity:0}, f, this.settings.slideTransitionEasing, function () {
                        h.remove();
                        e._mn3()
                    })
                } else {
                    if (!this._ir) {
                        this._ev.css({left:-this.currentSlideId * this.slideWidth})
                    } else {
                        this._ev.css({"-webkit-transition-duration":"0", "-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)", opacity:"1"})
                    }
                    setTimeout(function () {
                        h.bind("webkitTransitionEnd", function (a) {
                            if (a.target == h.get(0)) {
                                h.unbind("webkitTransitionEnd");
                                h.remove();
                                e._mn3()
                            }
                        });
                        h.css({"-webkit-transition-duration":f + "ms", "-webkit-transition-property":"opacity", "-webkit-transition-timing-function":"ease-in-out"});
                        h.css("opacity", 0)
                    }, 100)
                }
            }
        }
    }, goToSilent:function (a) {
        this.goTo(a, true)
    }, prev:function () {
        if (this.currentSlideId <= 0) {
            this.goTo(this.numSlides - 1)
        } else {
            this._by4()
        }
    }, next:function () {
        if (this.currentSlideId >= this.numSlides - 1) {
            this.goTo(0)
        } else {
            this._cx4()
        }
    }, updateSliderSize:function () {
        var a = this;
        this.sliderWidth = this.slider.width();
        this.sliderHeight = this.slider.height();
        if (this.sliderWidth != this.slideWidth || this.sliderHeight != this.slideHeight) {
            this.slideWidth = this.sliderWidth + this.settings.slideSpacing;
            var b = this.slidesArr.length;
            var c, d;
            for (var e = 0, f = b; e < f; ++e) {
                c = this.slidesArr[e];
                d = c.slide.find("img.royalImage").eq(0);
                if (d && c.preload == false) {
                    this._fu4(d, this.sliderWidth, this.sliderHeight)
                }
                if (this.settings.slideSpacing > 0 && e < b - 1) {
                    c.slide.css({"margin-right":this.settings.slideSpacing + "px !important"})
                }
                c.slide.css({height:a.sliderHeight, width:a.sliderWidth})
            }
            if (!this._ir) {
                this._ev.css({left:-this.currentSlideId * this.slideWidth, width:this.slideWidth * this.numSlides})
            } else {
                this._ev.css({"-webkit-transition-duration":"0ms", "-webkit-transition-property":"none"});
                this._ev.css({"-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)", width:this.slideWidth * this.numSlides})
            }
            if (this.settings.controlNavThumbs && this.settings.controlNavThumbsNavigation) {
                this._dw3()
            }
        }
    }, stopSlideshow:function () {
        this._cx2();
        this.slideshowEnabled = false;
        this.wasSlideshowPlaying = false
    }, resumeSlideshow:function () {
        this.slideshowEnabled = true;
        if (!this.wasSlideshowPlaying) {
            this._dw2()
        }
    }, destroy:function () {
        this._cx2();
        this._ev.unbind(this._az);
        a(document).unbind(this._by).unbind(this._cx);
        a(window).unbind("resize.rs");
        if (this.settings.keyboardNavEnabled) {
            a(document).unbind("keydown.rs")
        }
        this.slider.remove();
        delete this.slider
    }, _ir3:function (a, b) {
        if (this.settings.preloadNearbyImages) {
            var c = this;
            this._lo3(this.slidesArr[a], function () {
                if (b) {
                    b.call()
                }
                c._lo3(c.slidesArr[a + 1], function () {
                    c._lo3(c.slidesArr[a - 1])
                })
            })
        } else {
            this._lo3(this.slidesArr[a], b)
        }
    }, _gt3:function (a) {
        if (this.settings.controlNavEnabled) {
            this.navItems.eq(this.lastSlideId).removeClass("current");
            this.navItems.eq(this.currentSlideId).addClass("current");
            if (this.settings.controlNavThumbs && this.settings.controlNavThumbsNavigation) {
                var b = this.navItems.eq(this.currentSlideId).position().left;
                var c = b - Math.abs(this._cx3);
                if (c > this._fu3 - this._mn2 * 2 - 1 - this._by3) {
                    if (!a) {
                        this._ev3(-b + this._mn2)
                    } else {
                        this._ev3(-b - this._mn2 * 2 + this._fu3 + this._by3)
                    }
                } else if (c < this._mn2 * 2 - 1) {
                    if (!a) {
                        this._ev3(-b - this._mn2 * 2 + this._fu3 + this._by3)
                    } else {
                        this._ev3(-b + this._mn2)
                    }
                }
            }
        }
    }, _hs3:function () {
        if (this.settings.directionNavEnabled) {
            if (this.settings.hideArrowOnLastSlide) {
                if (this.currentSlideId == 0) {
                    this._ir4 = true;
                    this.arrowLeft.addClass("disabled");
                    if (this._jq4) {
                        this._jq4 = false;
                        this.arrowRight.removeClass("disabled")
                    }
                } else if (this.currentSlideId == this.numSlides - 1) {
                    this._jq4 = true;
                    this.arrowRight.addClass("disabled");
                    if (this._ir4) {
                        this._ir4 = false;
                        this.arrowLeft.removeClass("disabled")
                    }
                } else {
                    if (this._ir4) {
                        this._ir4 = false;
                        this.arrowLeft.removeClass("disabled")
                    } else if (this._jq4) {
                        this._jq4 = false;
                        this.arrowRight.removeClass("disabled")
                    }
                }
            }
        }
    }, _dw2:function (a) {
        if (this.slideshowEnabled) {
            var b = this;
            if (!this.slideshowTimer) {
                this.slideshowTimer = setInterval(function () {
                    b.next()
                }, this.settings.slideshowDelay)
            }
        }
    }, _cx2:function (a) {
        if (this.slideshowTimer) {
            clearInterval(this.slideshowTimer);
            this.slideshowTimer = ""
        }
    }, _lo3:function (b, c) {
        if (b) {
            if (b.preload) {
                var d = this;
                var e = new Image;
                var f = a(e);
                f.css("opacity", 0);
                f.addClass("royalImage");
                b.slide.prepend(f);
                b.slide.prepend(this._gt);
                b.preload = false;
                f.load(
                    function () {
                        d._fu4(f, d.sliderWidth, d.sliderHeight);
                        f.animate({opacity:1}, 300, function () {
                            b.slide.find(".royalPreloader").remove()
                        });
                        if (c)c.call()
                    }).attr("src", b.preloadURL)
            } else {
                if (c)c.call()
            }
        } else {
            if (c)c.call()
        }
    }, _dw3:function () {
        this._fu3 = parseInt(this._fu2Container.width(), 10);
        this._kp4 = -(this._az3 - this._fu3);
        if (this._fu3 >= this._az3) {
            this._jq2 = true;
            this._ir2 = true;
            this.thumbsArrowRight.addClass("disabled");
            this.thumbsArrowLeft.addClass("disabled");
            this._cx1 = true;
            this._lo4(0)
        } else {
            this._cx1 = false;
            var a = this.navItems.eq(this.currentSlideId).position().left;
            this._ev3(-a + this._mn2)
        }
    }, _ev3:function (a) {
        if (!this._cx1 && a != this._cx3) {
            if (a <= this._kp4) {
                a = this._kp4;
                this._ir2 = false;
                this._jq2 = true;
                this.thumbsArrowRight.addClass("disabled");
                this.thumbsArrowLeft.removeClass("disabled")
            } else if (a >= 0) {
                a = 0;
                this._ir2 = true;
                this._jq2 = false;
                this.thumbsArrowLeft.addClass("disabled");
                this.thumbsArrowRight.removeClass("disabled")
            } else {
                if (this._ir2) {
                    this._ir2 = false;
                    this.thumbsArrowLeft.removeClass("disabled")
                }
                if (this._jq2) {
                    this._jq2 = false;
                    this.thumbsArrowRight.removeClass("disabled")
                }
            }
            this._lo4(a);
            this._cx3 = a
        }
    }, _lo4:function (a) {
        if (!this._ir) {
            this._kp2.animate({left:a}, this.settings.controlNavThumbsSpeed, this.settings.controlNavThumbsEasing)
        } else {
            this._kp2.css({"-webkit-transform":"translate3d(" + a + "px, 0, 0)"})
        }
    }, _jq3:function () {
        var b = this;
        this.slider.find(".royalLoadingScreen").remove();
        if (this.settings.controlNavEnabled) {
            this.navItems.bind("click", function (a) {
                a.preventDefault();
                if (!b._fu1)b._mn4(a)
            })
        }
        if (this.settings.directionNavEnabled) {
            this.arrowRight.click(function (a) {
                a.preventDefault();
                if (!b._jq4 && !b._fu1)b.next()
            });
            this.arrowLeft.click(function (a) {
                a.preventDefault();
                if (!b._ir4 && !b._fu1)b.prev()
            })
        }
        if (this.settings.keyboardNavEnabled) {
            a(document).bind("keydown.rs", function (a) {
                if (!b._fu1) {
                    if (a.keyCode === 37) {
                        b.prev()
                    } else if (a.keyCode === 39) {
                        b.next()
                    }
                }
            })
        }
        this.wasSlideshowPlaying = true;
        this._mn3();
        this._ev.bind(this._az, function (a) {
            if (!b._gt1) {
                b._az5(a)
            } else if (!this.hasTouch) {
                a.preventDefault()
            }
        });
        if (this.slideshowEnabled && !this.settings.slideshowAutoStart) {
            this._cx2()
        }
        this.settings.allComplete.call(this)
    }, _ev2:function () {
        this._ev.removeClass("grabbing-cursor");
        this._ev.addClass("grab-cursor")
    }, _by5:function () {
        this._ev.removeClass("grab-cursor");
        this._ev.addClass("grabbing-cursor")
    }, _cx4:function (a) {
        if (this.currentSlideId < this.numSlides - 1) {
            this.goTo(this.currentSlideId + 1, false, false, a)
        } else {
            this.goTo(this.currentSlideId, false, false, a)
        }
    }, _by4:function (a) {
        if (this.currentSlideId > 0) {
            this.goTo(this.currentSlideId - 1, false, false, a)
        } else {
            this.goTo(this.currentSlideId, false, false, a)
        }
    }, _mn4:function (b) {
        this.goTo(a(b.currentTarget).index(), false, true)
    }, _az4:function () {
        var a = window.getComputedStyle(this._ev.get(0), null).getPropertyValue("-webkit-transform");
        var b = a.replace(/^matrix\(/i, "").split(/, |\)$/g);
        return parseInt(b[4], 10)
    }, _az5:function (b) {
        if (!this._lo1) {
            var c;
            if (this.hasTouch) {
                this._cx5 = false;
                var d = b.originalEvent.touches;
                if (d && d.length > 0) {
                    c = d[0]
                } else {
                    return false
                }
            } else {
                c = b;
                b.preventDefault()
            }
            if (this.slideshowEnabled) {
                if (this.slideshowTimer) {
                    this.wasSlideshowPlaying = true;
                    this._cx2()
                } else {
                    this.wasSlideshowPlaying = false
                }
            }
            this._by5();
            this._lo1 = true;
            var e = this;
            if (this._ir) {
                e._ev.css({"-webkit-transition-duration":"0ms", "-webkit-transition-property":"none"})
            }
            a(document).bind(this._by, function (a) {
                e._dw5(a)
            });
            a(document).bind(this._cx, function (a) {
                e._ev5(a)
            });
            if (!this._ir) {
                this._kp1 = this._hs1 = parseInt(this._ev.css("left"), 10)
            } else {
                this._kp1 = this._hs1 = this._az4()
            }
            this._hs = false;
            this._ir1 = c.clientX;
            this._jq1 = c.clientY
        }
        return false
    }, _dw5:function (a) {
        var b;
        if (this.hasTouch) {
            if (this._cx5) {
                return false
            }
            var c = a.originalEvent.touches;
            if (c.length > 1) {
                return false
            }
            b = c[0];
            if (Math.abs(b.clientY - this._jq1) > Math.abs(b.clientX - this._ir1) + 3) {
                if (this.settings.lockAxis) {
                    this._cx5 = true
                }
                return false
            }
            a.preventDefault()
        } else {
            b = a;
            a.preventDefault()
        }
        this._by1 = this._az1;
        var d = b.clientX - this._ir1;
        if (this._by1 != d) {
            this._az1 = d
        }
        if (d != 0) {
            if (this.currentSlideId == 0) {
                if (d > 0) {
                    d = Math.sqrt(d) * 5
                }
            } else if (this.currentSlideId == this.numSlides - 1) {
                if (d < 0) {
                    d = -Math.sqrt(-d) * 5
                }
            }
            if (!this._ir) {
                this._ev.css("left", this._hs1 + d)
            } else {
                this._ev.css({"-webkit-transform":"translate3d(" + (this._hs1 + d) + "px, 0, 0)"})
            }
        }
        return false
    }, _ev5:function (b) {
        if (this._lo1) {
            this._lo1 = false;
            this._ev2();
            if (!this._ir) {
                this.endPos = parseInt(this._ev.css("left"), 10)
            } else {
                this.endPos = this._az4()
            }
            this.isdrag = false;
            a(document).unbind(this._by).unbind(this._cx);
            if (this.slideshowEnabled) {
                if (this.wasSlideshowPlaying) {
                    if (!this._mn1) {
                        this._dw2()
                    }
                    this.wasSlideshowPlaying = false
                }
            }
            if (this.endPos == this._kp1) {
                this._hs = false;
                return
            } else {
                this._hs = true
            }
            if (this._kp1 - this.settings.minSlideOffset > this.endPos) {
                if (this._by1 < this._az1) {
                    this.goTo(this.currentSlideId, false, false, true);
                    return false
                }
                this._cx4(true)
            } else if (this._kp1 + this.settings.minSlideOffset < this.endPos) {
                if (this._by1 > this._az1) {
                    this.goTo(this.currentSlideId, false, false, true);
                    return false
                }
                this._by4(true)
            } else {
                this.goTo(this.currentSlideId, false, false, true)
            }
        }
        return false
    }, _mn3:function () {
        var a = this;
        if (this.slideshowEnabled) {
            if (this.wasSlideshowPlaying) {
                if (!this._mn1) {
                    this._dw2()
                }
                this.wasSlideshowPlaying = false
            }
        }
        this._fu1 = false;
        this._gt1 = false;
        if (this.settings.captionAnimationEnabled && this.lastSlideId != this.currentSlideId) {
            if (this.lastSlideId != -1) {
                this.slidesArr[this.lastSlideId].caption.css("display", "none")
            }
            a._fu5(a.currentSlideId)
        }
        this.isAnimating = false;
        this.settings.afterSlideChange.call(this)
    }, _fu5:function (b) {
        var c = this.slidesArr[b].caption;
        if (c && c.length > 0) {
            c.css("display", "block");
            var d = this;
            var e, f, g, h, i, j, k, l, m, n, o, p, q;
            var r = c.children();
            if (this._dw1.length > 0) {
                for (var s = this._dw1.length - 1; s > -1; s--) {
                    clearTimeout(this._dw1.splice(s, 1))
                }
            }
            if (this._ev1.length > 0) {
                var t;
                for (var u = this._ev1.length - 1; u > -1; u--) {
                    t = this._ev1[u];
                    if (t) {
                        if (!this._ir) {
                            if (t.running) {
                                t.captionItem.stop(true, true)
                            } else {
                                t.captionItem.css(t.css)
                            }
                        }
                    }
                    this._ev1.splice(u, 1)
                }
            }
            for (var v = 0; v < r.length; v++) {
                e = a(r[v]);
                i = {};
                f = false;
                g = false;
                j = "";
                if (e.attr("data-show-effect") == undefined) {
                    k = this.settings.captionShowEffects
                } else {
                    k = e.attr("data-show-effect").split(" ")
                }
                for (var w = 0; w < k.length; w++) {
                    if (f && g) {
                        break
                    }
                    h = k[w].toLowerCase();
                    if (!f && h == "fade") {
                        f = true;
                        i["opacity"] = 1
                    } else if (g) {
                        break
                    } else if (h == "movetop") {
                        j = "margin-top"
                    } else if (h == "moveleft") {
                        j = "margin-left"
                    } else if (h == "movebottom") {
                        j = "margin-bottom"
                    } else if (h == "moveright") {
                        j = "margin-right"
                    }
                    if (j != "") {
                        i["moveProp"] = j;
                        if (!d._ir) {
                            i["moveStartPos"] = parseInt(e.css(j), 10)
                        } else {
                            i["moveStartPos"] = 0
                        }
                        g = true
                    }
                }
                m = parseInt(e.attr("data-move-offset"), 10);
                if (isNaN(m)) {
                    m = this.settings.captionMoveOffset
                }
                n = parseInt(e.attr("data-delay"), 10);
                if (isNaN(n)) {
                    n = d.settings.captionShowDelay * v
                }
                o = parseInt(e.attr("data-speed"), 10);
                if (isNaN(o)) {
                    o = d.settings.captionShowSpeed
                }
                p = e.attr("data-easing");
                if (!p) {
                    p = d.settings.captionShowEasing
                }
                l = {};
                if (g) {
                    q = i.moveProp;
                    if (q == "margin-right") {
                        q = "margin-left";
                        l[q] = i.moveStartPos + m
                    } else if (q == "margin-bottom") {
                        q = "margin-top";
                        l[q] = i.moveStartPos + m
                    } else {
                        l[q] = i.moveStartPos - m
                    }
                }
                if (!d._lo && f) {
                    e.css("opacity", 0)
                }
                if (!d._ir) {
                    e.css("visibility", "hidden");
                    e.css(l);
                    if (g) {
                        l[q] = i.moveStartPos
                    }
                    if (!d._lo && f) {
                        l.opacity = 1
                    }
                } else {
                    var x = {};
                    if (g) {
                        x["-webkit-transition-duration"] = "0";
                        x["-webkit-transition-property"] = "none";
                        x["-webkit-transform"] = "translate3d(" + (isNaN(l["margin-left"]) ? 0 : l["margin-left"] + "px") + ", " + (isNaN(l["margin-top"]) ? 0 : l["margin-top"] + "px") + ",0)";
                        delete l["margin-left"];
                        delete l["margin-top"];
                        l["-webkit-transform"] = "translate3d(0,0,0)"
                    }
                    l.visibility = "visible";
                    l.opacity = 1;
                    if (!d._lo && f) {
                        x["opacity"] = 0
                    }
                    x["visibility"] = "hidden";
                    e.css(x)
                }
                this._ev1.push({captionItem:e, css:l, running:false});
                this._dw1.push(setTimeout(function (a, b, c, e, f, g, h) {
                    return function () {
                        d._ev1[f].running = true;
                        if (!d._ir) {
                            a.css("visibility", "visible").animate(b, c, e, function () {
                                if (d._jq && g) {
                                    a.get(0).style.removeAttribute("filter")
                                }
                                delete d._ev1[f]
                            })
                        } else {
                            a.css({"-webkit-transition-duration":c + "ms", "-webkit-transition-property":"opacity" + (h ? ", -webkit-transform" : ""), "-webkit-transition-timing-function":"ease-out"});
                            a.css(b)
                        }
                    }
                }(e, l, o, p, v, f, g), n))
            }
        }
    }, _fu4:function (b, c, d) {
        var e = this.settings.imageScaleMode;
        var f = this.settings.imageAlignCenter;
        if (f || e == "fill" || e == "fit") {
            var g = false;

            function h() {
                var a, g, h, i, j;
                var k = new Image;
                k.onload = function () {
                    var k = this.width;
                    var l = this.height;
                    var m = parseInt(b.css("borderWidth"), 10);
                    m = isNaN(m) ? 0 : m;
                    if (e == "fill" || e == "fit") {
                        a = c / k;
                        g = d / l;
                        if (e == "fill") {
                            h = a > g ? a : g
                        } else if (e == "fit") {
                            h = a < g ? a : g
                        } else {
                            h = 1
                        }
                        i = parseInt(k * h, 10) - m;
                        j = parseInt(l * h, 10) - m;
                        b.attr({width:i, height:j}).css({width:i, height:j})
                    } else {
                        i = k - m;
                        j = l - m;
                        b.attr("width", i).attr("height", j)
                    }
                    if (f) {
                        b.css({"margin-left":Math.floor((c - i) / 2), "margin-top":Math.floor((d - j) / 2)})
                    }
                };
                k.src = b.attr("src")
            }

            b.removeAttr("height").removeAttr("width");
            if (!this._kp3(b.get(0))) {
                a("<img />").load(
                    function () {
                        h()
                    }).attr("src", b.attr("src"))
            } else {
                h()
            }
        }
    }, _kp3:function (a) {
        if (a) {
            if (!a.complete) {
                return false
            }
            if (typeof a.naturalWidth != "undefined" && a.naturalWidth == 0) {
                return false
            }
        } else {
            return false
        }
        return true
    }};
    a.fn.royalSlider = function (c) {
        return this.each(function () {
            var d = new b(a(this), c);
            a(this).data("royalSlider", d)
        })
    };
    a.fn.royalSlider.defaults = {lockAxis:true, preloadNearbyImages:true, imageScaleMode:"none", imageAlignCenter:false, keyboardNavEnabled:false, directionNavEnabled:true, directionNavAutoHide:false, hideArrowOnLastSlide:true, slideTransitionType:"move", slideTransitionSpeed:400, slideTransitionEasing:"easeInOutSine", captionAnimationEnabled:true, captionShowEffects:["fade", "moveleft"], captionMoveOffset:20, captionShowSpeed:400, captionShowEasing:"easeOutCubic", captionShowDelay:200, controlNavEnabled:true, controlNavThumbs:false, controlNavThumbsNavigation:true, controlNavThumbsSpeed:400, controlNavThumbsEasing:"easeInOutSine", slideshowEnabled:false, slideshowDelay:5e3, slideshowPauseOnHover:true, slideshowAutoStart:true, welcomeScreenEnabled:false, welcomeScreenShowSpeed:500, minSlideOffset:20, disableTranslate3d:false, removeCaptionsOpacityInIE8:false, startSlideIndex:0, slideSpacing:0, blockLinksOnDrag:true, nonDraggableClassEnabled:true, dragUsingMouse:true, beforeSlideChange:function () {
    }, afterSlideChange:function () {
    }, beforeLoadStart:function () {
    }, loadingComplete:function () {
    }, allComplete:function () {
    }};
    a.fn.royalSlider.settings = {}
})(jQuery);
(function (a) {
    function b(b, c) {
        this.slider = a(b);
        this._az = "";
        this._by = "";
        this._cx = "";
        var d = this;
        this.settings = a.extend({}, a.fn.royalSlider.defaults, c);
        this.isSlideshowRunning = false;
        this._dw = false;
        this._ev = this.slider.find(".royalSlidesContainer");
        this._fu = this._ev.wrap('<div class="royalWrapper"/>').parent();
        this.slides = this._ev.find(".royalSlide");
        this._gt = "<p class='royalPreloader'></p>";
        this._hs = false;
        this._ir = false;
        if ("ontouchstart"in window) {
            if (!this.settings.disableTranslate3d) {
                if ("WebKitCSSMatrix"in window && "m11"in new WebKitCSSMatrix) {
                    this._ev.css({"-webkit-transform-origin":"0 0", "-webkit-transform":"translateZ(0)"});
                    this._ir = true
                }
            }
            this.hasTouch = true;
            this._az = "touchstart.rs";
            this._by = "touchmove.rs";
            this._cx = "touchend.rs"
        } else {
            this.hasTouch = false;
            if (this.settings.dragUsingMouse) {
                this._az = "mousedown.rs";
                this._by = "mousemove.rs";
                this._cx = "mouseup.rs"
            } else {
                this._ev.addClass("auto-cursor")
            }
        }
        if (this.hasTouch) {
            this.settings.directionNavAutoHide = false;
            this.settings.hideArrowOnLastSlide = true
        }
        if (a.browser.msie && parseInt(a.browser.version) <= 8) {
            this._jq = true
        } else {
            this._jq = false
        }
        this.slidesArr = [];
        var e, f, g, h;
        this.slides.each(function () {
            f = a(this);
            e = {};
            e.slide = f;
            if (d.settings.blockLinksOnDrag) {
                if (!this.hasTouch) {
                    f.find("a").bind("click.rs", function (a) {
                        if (d._hs) {
                            a.preventDefault();
                            return false
                        }
                    })
                } else {
                    var b = f.find("a");
                    var c;
                    b.each(function () {
                        c = a(this);
                        c.data("royalhref", c.attr("href"));
                        c.data("royaltarget", c.attr("target"));
                        c.attr("href", "#");
                        c.bind("click", function (b) {
                            b.preventDefault();
                            if (d._hs) {
                                return false
                            } else {
                                var c = a(this).data("royalhref");
                                var e = a(this).data("royaltarget");
                                if (!e || e.toLowerCase() === "_kp") {
                                    window.location.href = c
                                } else {
                                    window.open(c)
                                }
                            }
                        })
                    })
                }
            }
            if (d.settings.nonDraggableClassEnabled) {
                f.find(".non-draggable").bind(d._az, function (a) {
                    d._hs = false;
                    a.stopImmediatePropagation()
                })
            }
            g = f.attr("data-src");
            if (g == undefined || g == "" || g == "none") {
                e.preload = false
            } else {
                e.preload = true;
                e.preloadURL = g
            }
            if (d.settings.captionAnimationEnabled) {
                e.caption = f.find(".royalCaption").css("display", "none")
            }
            d.slidesArr.push(e)
        });
        this._lo = false;
        if (this.settings.removeCaptionsOpacityInIE8) {
            if (a.browser.msie && parseInt(a.browser.version, 10) <= 8) {
                this._lo = true
            }
        }
        this.slider.css("overflow", "visible");
        this.slideWidth = 0;
        this.slideHeight = 0;
        this.slideshowTimer = "";
        this.mn = false;
        this.numSlides = this.slides.length;
        this.currentSlideId = this.settings.startSlideIndex;
        this.lastSlideId = -1;
        this.isAnimating = true;
        this.wasSlideshowPlaying = false;
        this._az1 = 0;
        this._by1 = 0;
        this._cx1 = false;
        this._dw1 = [];
        this._ev1 = [];
        this._fu1 = false;
        this._gt1 = false;
        this._hs1 = 0;
        this._ir1 = 0;
        this._jq1 = 0;
        this._kp1 = 0;
        this._lo1 = false;
        this._mn1 = false;
        if (this.settings.slideTransitionType === "fade") {
            if (this._ir || "WebKitCSSMatrix"in window && "m11"in new WebKitCSSMatrix) {
                this._az2 = true
            } else {
                this._az2 = false
            }
            this._by2 = a("<div class='fade-container'></div>").appendTo(this._fu)
        }
        if (this.settings.slideshowEnabled && this.settings.slideshowDelay > 0) {
            if (!this.hasTouch && this.settings.slideshowPauseOnHover) {
                this.slider.hover(function () {
                    d._mn1 = true;
                    d._cx2(true)
                }, function () {
                    d._mn1 = false;
                    d._dw2(true)
                })
            }
            this.slideshowEnabled = true
        } else {
            this.slideshowEnabled = false
        }
        this._ev2();
        if (this.settings.controlNavEnabled) {
            var i;
            this._fu2Container = "";
            var j;
            if (!d.settings.controlNavThumbs) {
                this._fu2Container = a('<div class="royalControlNavOverflow"><div class="royalControlNavContainer"><div class="royalControlNavCenterer"></div></div></div>');
                i = this._fu2Container.find(".royalControlNavCenterer")
            } else {
                this.slider.addClass("with-thumbs");
                if (d.settings.controlNavThumbsNavigation) {
                    j = a('<div class="thumbsAndArrowsContainer"></div>');
                    this.thumbsArrowLeft = a("<a href='#' class='thumbsArrow left'></a>");
                    this.thumbsArrowRight = a("<a href='#' class='thumbsArrow right'></a>");
                    j.append(this.thumbsArrowLeft);
                    j.append(this.thumbsArrowRight);
                    var k = parseInt(this.thumbsArrowLeft.outerWidth(), 10);
                    this._fu2Container = a('<div class="royalControlNavOverflow royalThumbs"><div class="royalControlNavThumbsContainer"></div></div>');
                    i = this._fu2Container.find(".royalControlNavThumbsContainer")
                } else {
                    this._fu2Container = a('<div class="royalControlNavOverflow royalThumbs"><div class="royalControlNavContainer"><div class="royalControlNavCenterer"></div></div></div>');
                    i = this._fu2Container.find(".royalControlNavCenterer")
                }
            }
            var l = 0;
            this.slides.each(function (b) {
                if (d.settings.controlNavThumbs) {
                    //i.append('<a href="#" class="royalThumb" style="background-image:url(' + a(this).attr("data-thumb") + ')">' + (b + 1) + "</a>")
					i.append('<a href="#" class="royalThumb"><img src="'+ a(this).attr("data-thumb") +'"></a>')
                } else {
                    i.append('<a href="#">' + (b + 1) + "</a>")
                }
                l++
            });
            this.navItems = i.children();
            if (j) {
                j.append(this._fu2Container);
                this._fu.after(j)
            } else {
                this._fu.after(this._fu2Container)
            }
            if (d.settings.controlNavThumbs && d.settings.controlNavThumbsNavigation) {
                this._ir2 = true;
                this._jq2 = false;
                this._kp2 = i;
                if (this._ir) {
                    this._kp2.css({"-webkit-transition-duration":this.settings.controlNavThumbsSpeed + "ms", "-webkit-transition-property":"-webkit-transform", "-webkit-transition-timing-function":"ease-in-out"})
                }
                this._lo2 = l;
                var m = this.navItems.eq(0);
                this._mn2 = m.outerWidth(true);
                this._az3 = this._mn2 * this._lo2;
                this._kp2.css("width", this._az3);
                this._by3 = parseInt(m.css("marginRight"), 10);
                this._az3 -= this._by3;
                this._cx3 = 0;
                this._dw3();
                this.thumbsArrowLeft.click(function (a) {
                    a.preventDefault();
                    if (!d._ir2)d._ev3(d._cx3 + d._fu3 + d._by3)
                });
                this.thumbsArrowRight.click(function (a) {
                    a.preventDefault();
                    if (!d._jq2)d._ev3(d._cx3 - d._fu3 - d._by3)
                })
            }
            this._gt3()
        }
        if (this.settings.directionNavEnabled) {
            this._fu.after("<a href='#' class='arrow left'/>");
            this._fu.after("<a href='#' class='arrow right'/>");
            this.arrowLeft = this.slider.find("a.arrow.left");
            this.arrowRight = this.slider.find("a.arrow.right");
            if (this.arrowLeft.length < 1 || this.arrowRight.length < 1) {
                this.settings.directionNavEnabled = false
            } else if (this.settings.directionNavAutoHide) {
                this.arrowLeft.hide();
                this.arrowRight.hide();
                this.slider.one("mousemove.arrowshover", function () {
                    d.arrowLeft.fadeIn("fast");
                    d.arrowRight.fadeIn("fast")
                });
                this.slider.hover(function () {
                    d.arrowLeft.fadeIn("fast");
                    d.arrowRight.fadeIn("fast")
                }, function () {
                    d.arrowLeft.fadeOut("fast");
                    d.arrowRight.fadeOut("fast")
                })
            }
            this._hs3()
        }
        this.sliderWidth = 0;
        this.sliderHeight = 0;
        var n;
        a(window).bind("resize.rs", function () {
            if (n)clearTimeout(n);
            n = setTimeout(function () {
                d.updateSliderSize()
            }, 100)
        });
        this.updateSliderSize();
        this.settings.beforeLoadStart.call(this);
        var o = this.slidesArr[this.currentSlideId];
        if (this.currentSlideId != 0) {
            if (!this._ir) {
                this._ev.css({left:-this.currentSlideId * this.slideWidth})
            } else {
                this._ev.css({"-webkit-transition-duration":"0ms", "-webkit-transition-property":"none"});
                this._ev.css({"-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)"})
            }
        }
        if (this.settings.welcomeScreenEnabled) {
            function p(a) {
                d.settings.loadingComplete.call(d);
                if (a && d.settings.preloadNearbyImages) {
                    d._ir3(d.currentSlideId)
                }
                d.slider.find(".royalLoadingScreen").fadeOut(d.settings.welcomeScreenShowSpeed);
                setTimeout(function () {
                    d._jq3()
                }, d.settings.welcomeScreenShowSpeed + 100)
            }

            if (o.preload) {
                this._ir3(this.currentSlideId, function () {
                    p(false)
                })
            } else {
                var h = o.slide.find("img.royalImage")[0];
                if (h) {
                    if (this._kp3(h)) {
                        p(true);
                        a(h).css("opacity", 0);
                        a(h).animate({opacity:1}, "fast")
                    } else {
                        a(h).css("opacity", 0);
                        a("<img />").load(
                            function () {
                                p(true);
                                a(h).animate({opacity:1}, "fast")
                            }).attr("src", h.src)
                    }
                } else {
                    p(true)
                }
            }
        } else {
            if (o.preload) {
                this._lo3(o, function () {
                    d.settings.loadingComplete.call(d);
                    if (d.settings.preloadNearbyImages) {
                        d._ir3(d.currentSlideId)
                    }
                })
            } else {
                var h = o.slide.find("img.royalImage")[0];
                if (h) {
                    if (this._kp3(h)) {
                        a(h).css("opacity", 0).animate({opacity:1}, "fast")
                    } else {
                        a(h).css("opacity", 0);
                        a("<img />").load(
                            function () {
                                a(h).animate({opacity:1}, "fast")
                            }).attr("src", h.src)
                    }
                }
                this.settings.loadingComplete.call(this)
            }
            setTimeout(function () {
                d._jq3()
            }, 100)
        }
    }

    b.prototype = {goTo:function (a, b, c, d) {
        if (!this.isAnimating) {
            this.isAnimating = true;
            var e = this;
            this.lastSlideId = this.currentSlideId;
            this.currentSlideId = a;
            this._gt1 = true;
            this._fu1 = true;
            if (this.lastSlideId != a) {
                this._gt3(c);
                this._ir3(a)
            }
            this._hs3();
            this.settings.beforeSlideChange.call(this);
            if (this.slideshowEnabled && this.slideshowTimer) {
                this.wasSlideshowPlaying = true;
                this._cx2()
            }
            var f = !b ? this.settings.slideTransitionSpeed : 0;
            if (d || b || this.settings.slideTransitionType === "move") {
                if (!this._ir) {
                    if (parseInt(this._ev.css("left"), 10) !== -this.currentSlideId * this.slideWidth) {
                        this._ev.animate({left:-this.currentSlideId * this.slideWidth}, f, this.settings.slideTransitionEasing, function () {
                            e._mn3()
                        })
                    } else {
                        this._mn3()
                    }
                } else {
                    if (this._az4() !== -this.currentSlideId * this.slideWidth) {
                        this._ev.bind("webkitTransitionEnd", function (a) {
                            if (a.target == e._ev.get(0)) {
                                e._mn3();
                                e._ev.unbind("webkitTransitionEnd")
                            }
                        });
                        this._ev.css({"-webkit-transition-duration":f + "ms", "-webkit-transition-property":"-webkit-transform", "-webkit-transition-timing-function":"ease-in-out", "-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)"})
                    } else {
                        this._mn3()
                    }
                }
            } else {
                var g = this.slidesArr[this.lastSlideId].slide;
                var h = g.clone().appendTo(this._by2);
                if (!this._az2) {
                    this._ev.css({left:-this.currentSlideId * this.slideWidth});
                    h.animate({opacity:0}, f, this.settings.slideTransitionEasing, function () {
                        h.remove();
                        e._mn3()
                    })
                } else {
                    if (!this._ir) {
                        this._ev.css({left:-this.currentSlideId * this.slideWidth})
                    } else {
                        this._ev.css({"-webkit-transition-duration":"0", "-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)", opacity:"1"})
                    }
                    setTimeout(function () {
                        h.bind("webkitTransitionEnd", function (a) {
                            if (a.target == h.get(0)) {
                                h.unbind("webkitTransitionEnd");
                                h.remove();
                                e._mn3()
                            }
                        });
                        h.css({"-webkit-transition-duration":f + "ms", "-webkit-transition-property":"opacity", "-webkit-transition-timing-function":"ease-in-out"});
                        h.css("opacity", 0)
                    }, 100)
                }
            }
        }
    }, goToSilent:function (a) {
        this.goTo(a, true)
    }, prev:function () {
        if (this.currentSlideId <= 0) {
            this.goTo(this.numSlides - 1)
        } else {
            this._by4()
        }
    }, next:function () {
        if (this.currentSlideId >= this.numSlides - 1) {
            this.goTo(0)
        } else {
            this._cx4()
        }
    }, updateSliderSize:function () {
        var a = this;
        this.sliderWidth = this.slider.width();
        this.sliderHeight = this.slider.height();
        if (this.sliderWidth != this.slideWidth || this.sliderHeight != this.slideHeight) {
            this.slideWidth = this.sliderWidth + this.settings.slideSpacing;
            var b = this.slidesArr.length;
            var c, d;
            for (var e = 0, f = b; e < f; ++e) {
                c = this.slidesArr[e];
                d = c.slide.find("img.royalImage").eq(0);
                if (d && c.preload == false) {
                    this._fu4(d, this.sliderWidth, this.sliderHeight)
                }
                if (this.settings.slideSpacing > 0 && e < b - 1) {
                    c.slide.css({"margin-right":this.settings.slideSpacing + "px !important"})
                }
                c.slide.css({height:a.sliderHeight, width:a.sliderWidth})
            }
            if (!this._ir) {
                this._ev.css({left:-this.currentSlideId * this.slideWidth, width:this.slideWidth * this.numSlides})
            } else {
                this._ev.css({"-webkit-transition-duration":"0ms", "-webkit-transition-property":"none"});
                this._ev.css({"-webkit-transform":"translate3d(" + -this.currentSlideId * this.slideWidth + "px, 0, 0)", width:this.slideWidth * this.numSlides})
            }
            if (this.settings.controlNavThumbs && this.settings.controlNavThumbsNavigation) {
                this._dw3()
            }
        }
    }, stopSlideshow:function () {
        this._cx2();
        this.slideshowEnabled = false;
        this.wasSlideshowPlaying = false
    }, resumeSlideshow:function () {
        this.slideshowEnabled = true;
        if (!this.wasSlideshowPlaying) {
            this._dw2()
        }
    }, destroy:function () {
        this._cx2();
        this._ev.unbind(this._az);
        a(document).unbind(this._by).unbind(this._cx);
        a(window).unbind("resize.rs");
        if (this.settings.keyboardNavEnabled) {
            a(document).unbind("keydown.rs")
        }
        this.slider.remove();
        delete this.slider
    }, _ir3:function (a, b) {
        if (this.settings.preloadNearbyImages) {
            var c = this;
            this._lo3(this.slidesArr[a], function () {
                if (b) {
                    b.call()
                }
                c._lo3(c.slidesArr[a + 1], function () {
                    c._lo3(c.slidesArr[a - 1])
                })
            })
        } else {
            this._lo3(this.slidesArr[a], b)
        }
    }, _gt3:function (a) {
        if (this.settings.controlNavEnabled) {
            this.navItems.eq(this.lastSlideId).removeClass("current");
            this.navItems.eq(this.currentSlideId).addClass("current");
            if (this.settings.controlNavThumbs && this.settings.controlNavThumbsNavigation) {
                var b = this.navItems.eq(this.currentSlideId).position().left;
                var c = b - Math.abs(this._cx3);
                if (c > this._fu3 - this._mn2 * 2 - 1 - this._by3) {
                    if (!a) {
                        this._ev3(-b + this._mn2)
                    } else {
                        this._ev3(-b - this._mn2 * 2 + this._fu3 + this._by3)
                    }
                } else if (c < this._mn2 * 2 - 1) {
                    if (!a) {
                        this._ev3(-b - this._mn2 * 2 + this._fu3 + this._by3)
                    } else {
                        this._ev3(-b + this._mn2)
                    }
                }
            }
        }
    }, _hs3:function () {
        if (this.settings.directionNavEnabled) {
            if (this.settings.hideArrowOnLastSlide) {
                if (this.currentSlideId == 0) {
                    this._ir4 = true;
                    this.arrowLeft.addClass("disabled");
                    if (this._jq4) {
                        this._jq4 = false;
                        this.arrowRight.removeClass("disabled")
                    }
                } else if (this.currentSlideId == this.numSlides - 1) {
                    this._jq4 = true;
                    this.arrowRight.addClass("disabled");
                    if (this._ir4) {
                        this._ir4 = false;
                        this.arrowLeft.removeClass("disabled")
                    }
                } else {
                    if (this._ir4) {
                        this._ir4 = false;
                        this.arrowLeft.removeClass("disabled")
                    } else if (this._jq4) {
                        this._jq4 = false;
                        this.arrowRight.removeClass("disabled")
                    }
                }
            }
        }
    }, _dw2:function (a) {
        if (this.slideshowEnabled) {
            var b = this;
            if (!this.slideshowTimer) {
                this.slideshowTimer = setInterval(function () {
                    b.next()
                }, this.settings.slideshowDelay)
            }
        }
    }, _cx2:function (a) {
        if (this.slideshowTimer) {
            clearInterval(this.slideshowTimer);
            this.slideshowTimer = ""
        }
    }, _lo3:function (b, c) {
        if (b) {
            if (b.preload) {
                var d = this;
                var e = new Image;
                var f = a(e);
                f.css("opacity", 0);
                f.addClass("royalImage");
                b.slide.prepend(f);
                b.slide.prepend(this._gt);
                b.preload = false;
                f.load(
                    function () {
                        d._fu4(f, d.sliderWidth, d.sliderHeight);
                        f.animate({opacity:1}, 300, function () {
                            b.slide.find(".royalPreloader").remove()
                        });
                        if (c)c.call()
                    }).attr("src", b.preloadURL)
            } else {
                if (c)c.call()
            }
        } else {
            if (c)c.call()
        }
    }, _dw3:function () {
        this._fu3 = parseInt(this._fu2Container.width(), 10);
        this._kp4 = -(this._az3 - this._fu3);
        if (this._fu3 >= this._az3) {
            this._jq2 = true;
            this._ir2 = true;
            this.thumbsArrowRight.addClass("disabled");
            this.thumbsArrowLeft.addClass("disabled");
            this._cx1 = true;
            this._lo4(0)
        } else {
            this._cx1 = false;
            var a = this.navItems.eq(this.currentSlideId).position().left;
            this._ev3(-a + this._mn2)
        }
    }, _ev3:function (a) {
        if (!this._cx1 && a != this._cx3) {
            if (a <= this._kp4) {
                a = this._kp4;
                this._ir2 = false;
                this._jq2 = true;
                this.thumbsArrowRight.addClass("disabled");
                this.thumbsArrowLeft.removeClass("disabled")
            } else if (a >= 0) {
                a = 0;
                this._ir2 = true;
                this._jq2 = false;
                this.thumbsArrowLeft.addClass("disabled");
                this.thumbsArrowRight.removeClass("disabled")
            } else {
                if (this._ir2) {
                    this._ir2 = false;
                    this.thumbsArrowLeft.removeClass("disabled")
                }
                if (this._jq2) {
                    this._jq2 = false;
                    this.thumbsArrowRight.removeClass("disabled")
                }
            }
            this._lo4(a);
            this._cx3 = a
        }
    }, _lo4:function (a) {
        if (!this._ir) {
            this._kp2.animate({left:a}, this.settings.controlNavThumbsSpeed, this.settings.controlNavThumbsEasing)
        } else {
            this._kp2.css({"-webkit-transform":"translate3d(" + a + "px, 0, 0)"})
        }
    }, _jq3:function () {
        var b = this;
        this.slider.find(".royalLoadingScreen").remove();
        if (this.settings.controlNavEnabled) {
            this.navItems.bind("click", function (a) {
                a.preventDefault();
                if (!b._fu1)b._mn4(a)
            })
        }
        if (this.settings.directionNavEnabled) {
            this.arrowRight.click(function (a) {
                a.preventDefault();
                if (!b._jq4 && !b._fu1)b.next()
            });
            this.arrowLeft.click(function (a) {
                a.preventDefault();
                if (!b._ir4 && !b._fu1)b.prev()
            })
        }
        if (this.settings.keyboardNavEnabled) {
            a(document).bind("keydown.rs", function (a) {
                if (!b._fu1) {
                    if (a.keyCode === 37) {
                        b.prev()
                    } else if (a.keyCode === 39) {
                        b.next()
                    }
                }
            })
        }
        this.wasSlideshowPlaying = true;
        this._mn3();
        this._ev.bind(this._az, function (a) {
            if (!b._gt1) {
                b._az5(a)
            } else if (!this.hasTouch) {
                a.preventDefault()
            }
        });
        if (this.slideshowEnabled && !this.settings.slideshowAutoStart) {
            this._cx2()
        }
        this.settings.allComplete.call(this)
    }, _ev2:function () {
        this._ev.removeClass("grabbing-cursor");
        this._ev.addClass("grab-cursor")
    }, _by5:function () {
        this._ev.removeClass("grab-cursor");
        this._ev.addClass("grabbing-cursor")
    }, _cx4:function (a) {
        if (this.currentSlideId < this.numSlides - 1) {
            this.goTo(this.currentSlideId + 1, false, false, a)
        } else {
            this.goTo(this.currentSlideId, false, false, a)
        }
    }, _by4:function (a) {
        if (this.currentSlideId > 0) {
            this.goTo(this.currentSlideId - 1, false, false, a)
        } else {
            this.goTo(this.currentSlideId, false, false, a)
        }
    }, _mn4:function (b) {
        this.goTo(a(b.currentTarget).index(), false, true)
    }, _az4:function () {
        var a = window.getComputedStyle(this._ev.get(0), null).getPropertyValue("-webkit-transform");
        var b = a.replace(/^matrix\(/i, "").split(/, |\)$/g);
        return parseInt(b[4], 10)
    }, _az5:function (b) {
        if (!this._lo1) {
            var c;
            if (this.hasTouch) {
                this._cx5 = false;
                var d = b.originalEvent.touches;
                if (d && d.length > 0) {
                    c = d[0]
                } else {
                    return false
                }
            } else {
                c = b;
                b.preventDefault()
            }
            if (this.slideshowEnabled) {
                if (this.slideshowTimer) {
                    this.wasSlideshowPlaying = true;
                    this._cx2()
                } else {
                    this.wasSlideshowPlaying = false
                }
            }
            this._by5();
            this._lo1 = true;
            var e = this;
            if (this._ir) {
                e._ev.css({"-webkit-transition-duration":"0ms", "-webkit-transition-property":"none"})
            }
            a(document).bind(this._by, function (a) {
                e._dw5(a)
            });
            a(document).bind(this._cx, function (a) {
                e._ev5(a)
            });
            if (!this._ir) {
                this._kp1 = this._hs1 = parseInt(this._ev.css("left"), 10)
            } else {
                this._kp1 = this._hs1 = this._az4()
            }
            this._hs = false;
            this._ir1 = c.clientX;
            this._jq1 = c.clientY
        }
        return false
    }, _dw5:function (a) {
        var b;
        if (this.hasTouch) {
            if (this._cx5) {
                return false
            }
            var c = a.originalEvent.touches;
            if (c.length > 1) {
                return false
            }
            b = c[0];
            if (Math.abs(b.clientY - this._jq1) > Math.abs(b.clientX - this._ir1) + 3) {
                if (this.settings.lockAxis) {
                    this._cx5 = true
                }
                return false
            }
            a.preventDefault()
        } else {
            b = a;
            a.preventDefault()
        }
        this._by1 = this._az1;
        var d = b.clientX - this._ir1;
        if (this._by1 != d) {
            this._az1 = d
        }
        if (d != 0) {
            if (this.currentSlideId == 0) {
                if (d > 0) {
                    d = Math.sqrt(d) * 5
                }
            } else if (this.currentSlideId == this.numSlides - 1) {
                if (d < 0) {
                    d = -Math.sqrt(-d) * 5
                }
            }
            if (!this._ir) {
                this._ev.css("left", this._hs1 + d)
            } else {
                this._ev.css({"-webkit-transform":"translate3d(" + (this._hs1 + d) + "px, 0, 0)"})
            }
        }
        return false
    }, _ev5:function (b) {
        if (this._lo1) {
            this._lo1 = false;
            this._ev2();
            if (!this._ir) {
                this.endPos = parseInt(this._ev.css("left"), 10)
            } else {
                this.endPos = this._az4()
            }
            this.isdrag = false;
            a(document).unbind(this._by).unbind(this._cx);
            if (this.slideshowEnabled) {
                if (this.wasSlideshowPlaying) {
                    if (!this._mn1) {
                        this._dw2()
                    }
                    this.wasSlideshowPlaying = false
                }
            }
            if (this.endPos == this._kp1) {
                this._hs = false;
                return
            } else {
                this._hs = true
            }
            if (this._kp1 - this.settings.minSlideOffset > this.endPos) {
                if (this._by1 < this._az1) {
                    this.goTo(this.currentSlideId, false, false, true);
                    return false
                }
                this._cx4(true)
            } else if (this._kp1 + this.settings.minSlideOffset < this.endPos) {
                if (this._by1 > this._az1) {
                    this.goTo(this.currentSlideId, false, false, true);
                    return false
                }
                this._by4(true)
            } else {
                this.goTo(this.currentSlideId, false, false, true)
            }
        }
        return false
    }, _mn3:function () {
        var a = this;
        if (this.slideshowEnabled) {
            if (this.wasSlideshowPlaying) {
                if (!this._mn1) {
                    this._dw2()
                }
                this.wasSlideshowPlaying = false
            }
        }
        this._fu1 = false;
        this._gt1 = false;
        if (this.settings.captionAnimationEnabled && this.lastSlideId != this.currentSlideId) {
            if (this.lastSlideId != -1) {
                this.slidesArr[this.lastSlideId].caption.css("display", "none")
            }
            a._fu5(a.currentSlideId)
        }
        this.isAnimating = false;
        this.settings.afterSlideChange.call(this)
    }, _fu5:function (b) {
        var c = this.slidesArr[b].caption;
        if (c && c.length > 0) {
            c.css("display", "block");
            var d = this;
            var e, f, g, h, i, j, k, l, m, n, o, p, q;
            var r = c.children();
            if (this._dw1.length > 0) {
                for (var s = this._dw1.length - 1; s > -1; s--) {
                    clearTimeout(this._dw1.splice(s, 1))
                }
            }
            if (this._ev1.length > 0) {
                var t;
                for (var u = this._ev1.length - 1; u > -1; u--) {
                    t = this._ev1[u];
                    if (t) {
                        if (!this._ir) {
                            if (t.running) {
                                t.captionItem.stop(true, true)
                            } else {
                                t.captionItem.css(t.css)
                            }
                        }
                    }
                    this._ev1.splice(u, 1)
                }
            }
            for (var v = 0; v < r.length; v++) {
                e = a(r[v]);
                i = {};
                f = false;
                g = false;
                j = "";
                if (e.attr("data-show-effect") == undefined) {
                    k = this.settings.captionShowEffects
                } else {
                    k = e.attr("data-show-effect").split(" ")
                }
                for (var w = 0; w < k.length; w++) {
                    if (f && g) {
                        break
                    }
                    h = k[w].toLowerCase();
                    if (!f && h == "fade") {
                        f = true;
                        i["opacity"] = 1
                    } else if (g) {
                        break
                    } else if (h == "movetop") {
                        j = "margin-top"
                    } else if (h == "moveleft") {
                        j = "margin-left"
                    } else if (h == "movebottom") {
                        j = "margin-bottom"
                    } else if (h == "moveright") {
                        j = "margin-right"
                    }
                    if (j != "") {
                        i["moveProp"] = j;
                        if (!d._ir) {
                            i["moveStartPos"] = parseInt(e.css(j), 10)
                        } else {
                            i["moveStartPos"] = 0
                        }
                        g = true
                    }
                }
                m = parseInt(e.attr("data-move-offset"), 10);
                if (isNaN(m)) {
                    m = this.settings.captionMoveOffset
                }
                n = parseInt(e.attr("data-delay"), 10);
                if (isNaN(n)) {
                    n = d.settings.captionShowDelay * v
                }
                o = parseInt(e.attr("data-speed"), 10);
                if (isNaN(o)) {
                    o = d.settings.captionShowSpeed
                }
                p = e.attr("data-easing");
                if (!p) {
                    p = d.settings.captionShowEasing
                }
                l = {};
                if (g) {
                    q = i.moveProp;
                    if (q == "margin-right") {
                        q = "margin-left";
                        l[q] = i.moveStartPos + m
                    } else if (q == "margin-bottom") {
                        q = "margin-top";
                        l[q] = i.moveStartPos + m
                    } else {
                        l[q] = i.moveStartPos - m
                    }
                }
                if (!d._lo && f) {
                    e.css("opacity", 0)
                }
                if (!d._ir) {
                    e.css("visibility", "hidden");
                    e.css(l);
                    if (g) {
                        l[q] = i.moveStartPos
                    }
                    if (!d._lo && f) {
                        l.opacity = 1
                    }
                } else {
                    var x = {};
                    if (g) {
                        x["-webkit-transition-duration"] = "0";
                        x["-webkit-transition-property"] = "none";
                        x["-webkit-transform"] = "translate3d(" + (isNaN(l["margin-left"]) ? 0 : l["margin-left"] + "px") + ", " + (isNaN(l["margin-top"]) ? 0 : l["margin-top"] + "px") + ",0)";
                        delete l["margin-left"];
                        delete l["margin-top"];
                        l["-webkit-transform"] = "translate3d(0,0,0)"
                    }
                    l.visibility = "visible";
                    l.opacity = 1;
                    if (!d._lo && f) {
                        x["opacity"] = 0
                    }
                    x["visibility"] = "hidden";
                    e.css(x)
                }
                this._ev1.push({captionItem:e, css:l, running:false});
                this._dw1.push(setTimeout(function (a, b, c, e, f, g, h) {
                    return function () {
                        d._ev1[f].running = true;
                        if (!d._ir) {
                            a.css("visibility", "visible").animate(b, c, e, function () {
                                if (d._jq && g) {
                                    a.get(0).style.removeAttribute("filter")
                                }
                                delete d._ev1[f]
                            })
                        } else {
                            a.css({"-webkit-transition-duration":c + "ms", "-webkit-transition-property":"opacity" + (h ? ", -webkit-transform" : ""), "-webkit-transition-timing-function":"ease-out"});
                            a.css(b)
                        }
                    }
                }(e, l, o, p, v, f, g), n))
            }
        }
    }, _fu4:function (b, c, d) {
        var e = this.settings.imageScaleMode;
        var f = this.settings.imageAlignCenter;
        if (f || e == "fill" || e == "fit") {
            var g = false;

            function h() {
                var a, g, h, i, j;
                var k = new Image;
                k.onload = function () {
                    var k = this.width;
                    var l = this.height;
                    var m = parseInt(b.css("borderWidth"), 10);
                    m = isNaN(m) ? 0 : m;
                    if (e == "fill" || e == "fit") {
                        a = c / k;
                        g = d / l;
                        if (e == "fill") {
                            h = a > g ? a : g
                        } else if (e == "fit") {
                            h = a < g ? a : g
                        } else {
                            h = 1
                        }
                        i = parseInt(k * h, 10) - m;
                        j = parseInt(l * h, 10) - m;
                        b.attr({width:i, height:j}).css({width:i, height:j})
                    } else {
                        i = k - m;
                        j = l - m;
                        b.attr("width", i).attr("height", j)
                    }
                    if (f) {
                        b.css({"margin-left":Math.floor((c - i) / 2), "margin-top":Math.floor((d - j) / 2)})
                    }
                };
                k.src = b.attr("src")
            }

            b.removeAttr("height").removeAttr("width");
            if (!this._kp3(b.get(0))) {
                a("<img />").load(
                    function () {
                        h()
                    }).attr("src", b.attr("src"))
            } else {
                h()
            }
        }
    }, _kp3:function (a) {
        if (a) {
            if (!a.complete) {
                return false
            }
            if (typeof a.naturalWidth != "undefined" && a.naturalWidth == 0) {
                return false
            }
        } else {
            return false
        }
        return true
    }};
    a.fn.royalSlider = function (c) {
        return this.each(function () {
            var d = new b(a(this), c);
            a(this).data("royalSlider", d)
        })
    };
    a.fn.royalSlider.defaults = {lockAxis:true, preloadNearbyImages:true, imageScaleMode:"none", imageAlignCenter:false, keyboardNavEnabled:false, directionNavEnabled:true, directionNavAutoHide:false, hideArrowOnLastSlide:true, slideTransitionType:"move", slideTransitionSpeed:400, slideTransitionEasing:"easeInOutSine", captionAnimationEnabled:true, captionShowEffects:["fade", "moveleft"], captionMoveOffset:20, captionShowSpeed:400, captionShowEasing:"easeOutCubic", captionShowDelay:200, controlNavEnabled:true, controlNavThumbs:false, controlNavThumbsNavigation:true, controlNavThumbsSpeed:400, controlNavThumbsEasing:"easeInOutSine", slideshowEnabled:false, slideshowDelay:5e3, slideshowPauseOnHover:true, slideshowAutoStart:true, welcomeScreenEnabled:false, welcomeScreenShowSpeed:500, minSlideOffset:20, disableTranslate3d:false, removeCaptionsOpacityInIE8:false, startSlideIndex:0, slideSpacing:0, blockLinksOnDrag:true, nonDraggableClassEnabled:true, dragUsingMouse:true, beforeSlideChange:function () {
    }, afterSlideChange:function () {
    }, beforeLoadStart:function () {
    }, loadingComplete:function () {
    }, allComplete:function () {
    }};
    a.fn.royalSlider.settings = {}
})(jQuery)
