diff --git a/assets/js/rocksolid-slider.js b/assets/js/rocksolid-slider.js index b8cf5cd..bd82973 100644 --- a/assets/js/rocksolid-slider.js +++ b/assets/js/rocksolid-slider.js @@ -1,4 +1,4 @@ -/*! rocksolid-slider v1.5.2 */ +/*! rocksolid-slider v1.5.3 */ (function($, window, document) { var Rst = {}; @@ -266,8 +266,10 @@ Rst.Slide = (function() { * @var object regular expressions for video URLs */ Slide.prototype.videoRegExp = { - youtube: /^https?:\/\/(?:www\.youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\?|#|\/)(?:(?:.*[?&#]|)t=([0-9hms]+))?/i, - vimeo: /^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)(?:.*#t=([0-9hms]+))?/i + youtube: /^https?:\/\/(?:(?:www\.)?youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\?|#|\/)(?:(?:.*[?&#]|)t=([0-9hms]+))?/i, + youtubePlayer: /^https?:\/\/(?:www\.)?youtube\.com\/embed\/[0-9a-z_\-]{11}/i, + vimeo: /^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)(?:.*#t=([0-9hms]+))?/i, + vimeoPlayer: /^https?:\/\/player\.vimeo\.com\/video\/[0-9]+/i }; /** @@ -660,7 +662,7 @@ Rst.Slide = (function() { Slide.prototype.startVideo = function() { var self = this; - var videoId, apiCallback, matches, time; + var videoId, apiCallback, matches, time, src; if (this.isVideoPlaying) { return; @@ -690,14 +692,28 @@ Rst.Slide = (function() { time[2] = parseInt(time[2] || 0, 10); time = time[0] + (time[1] * 60) + (time[2] * 60 * 60); } + + src = 'https://www.youtube.com/embed/' + videoId; + if (this.data.video.match(this.videoRegExp.youtubePlayer)) { + src = this.data.video; + } + + if (!src.match(/[?&]autoplay=/i)) { + src += (src.match(/\?/) ? '&' : '?') + 'autoplay=1'; + } + if (!src.match(/[?&]enablejsapi=/i)) { + src += '&enablejsapi=1'; + } + if (!src.match(/[?&]wmode=/i)) { + src += '&wmode=opaque'; + } + if (time && !src.match(/[?&]start=/i)) { + src += '&start=' + time; + } + this.videoElement = $(document.createElement('iframe')) .addClass(this.slider.options.cssPrefix + 'video-iframe') - .attr('src', - 'http://www.youtube.com/embed/' + - videoId + - '?autoplay=1&enablejsapi=1&wmode=opaque' + - (time ? '&start=' + time : '') - ) + .attr('src', src) .attr('frameborder', 0) .attr('allowfullscreen', 'allowfullscreen') .appendTo(this.element); @@ -736,14 +752,25 @@ Rst.Slide = (function() { videoId = matches[1]; time = matches[2]; + + src = 'https://player.vimeo.com/video/' + videoId; + if (this.data.video.match(this.videoRegExp.vimeoPlayer)) { + src = this.data.video; + } + + if (!src.match(/[?&]autoplay=/i)) { + src += (src.match(/\?/) ? '&' : '?') + 'autoplay=1'; + } + if (!src.match(/[?&]api=/i)) { + src += '&api=1'; + } + if (time && !src.match(/#t=/i)) { + src += '#t=' + time; + } + this.videoElement = $(document.createElement('iframe')) .addClass(this.slider.options.cssPrefix + 'video-iframe') - .attr('src', - 'http://player.vimeo.com/video/' + - videoId + - '?autoplay=1&api=1' + - (time ? '#t=' + time : '') - ) + .attr('src', src) .attr('frameborder', 0) .attr('allowfullscreen', 'allowfullscreen') .appendTo(this.element); @@ -987,8 +1014,6 @@ Rst.Slider = (function() { .appendTo(this.elements.main); } - this.autoplay(); - this.preloadSlides(this.slideIndex); // Sets active states this.cleanupSlides(); @@ -1000,6 +1025,8 @@ Rst.Slider = (function() { // Resize again for edge cases when combineItems changed the nav height this.resize(); + this.autoplay(); + $(window).on('domready.rsts load.rsts', function(){ if (self.windowSizeHasChanged()) { self.resize(); @@ -1452,7 +1479,7 @@ Rst.Slider = (function() { var self = this; - if (!this.options.autoplay) { + if (!this.options.autoplay || this.getVisibleCount() >= this.slides.length) { return; } @@ -2534,9 +2561,14 @@ Rst.Slider = (function() { if (this.getVisibleCount() >= this.slides.length) { this.nav.hide(); + this.stopAutoplay(true); } else { this.nav.show(); + if (visibleCountBefore >= this.slides.length) { + // restart autoplay + this.stopAutoplay(); + } } if (visibleCountBefore !== this.getVisibleCount()) { diff --git a/assets/js/rocksolid-slider.min.js b/assets/js/rocksolid-slider.min.js index 545e97c..e8d2f1b 100644 --- a/assets/js/rocksolid-slider.min.js +++ b/assets/js/rocksolid-slider.min.js @@ -1,5 +1,5 @@ -/*! rocksolid-slider v1.5.2 */ -(function(d,c,a){var b={};b.Slide=(function(){function e(g,h){var f=this;this.slider=h;this.element=d(a.createElement("div")).addClass(h.options.cssPrefix+"slide");this.data={name:undefined,sliderClasses:[]};this.backgrounds=d([]);if(g.nodeName.toLowerCase()==="script"&&g.type==="text/html"){this.contentHtml=g.innerHTML.replace(/\\(.)/gi,"$1");this.data.thumbUrl=d(g).attr("data-rsts-thumb")||undefined}else{this.init(g)}this.setState("inactive")}e.prototype.init=function(i){var h=this;if(this.isInitialized()){return}if(!i&&this.contentHtml){i=d(this.contentHtml)[0];delete this.contentHtml}this.content=d(i);var j=this.content.attr("data-rsts-class");this.data.name=this.content.attr("data-rsts-name")||this.content.attr("title");this.data.sliderClasses=(j&&j.split(" "))||[];if(this.content.attr("data-rsts-autoplay")){this.data.autoplay=parseFloat(this.content.attr("data-rsts-autoplay"))}if(i.nodeName.toLowerCase()==="img"||i.nodeName.toLowerCase()==="picture"){this.type="image"}if(i.nodeName.toLowerCase()==="video"){this.type="video"}this.type=this.content.attr("data-rsts-type")||this.type||"default";this.centerContent=this.content.attr("data-rsts-center")!==undefined?this.content.attr("data-rsts-center"):this.slider.options.centerContent;if(this.centerContent!=="x"&&this.centerContent!=="y"){this.centerContent=!!this.centerContent}if(this.type==="image"||this.type==="video"){this.centerContent=false}this.element.addClass(this.slider.options.cssPrefix+"slide-"+this.type).append(i);if(!a.createElement("video").canPlayType||this.slider.device==="iPhone"||this.slider.device==="iPod"){this.element.find("video[data-rsts-background]").each(function(){var k=d(this);if(k.attr("poster")){d(a.createElement("img")).attr("src",k.attr("poster")).attr("data-rsts-background","").attr("data-rsts-position",k.attr("data-rsts-position")).attr("data-rsts-scale-mode",k.attr("data-rsts-scale-mode")).insertBefore(k)}k.detach()})}if(this.type==="video"&&!this.content.attr("data-rsts-video")&&!a.createElement("video").canPlayType){this.element.find("video").each(function(){var k=d(this);if(!k.find("img").length){d(a.createElement("img")).attr("src",k.attr("poster")).attr("data-rsts-position",k.attr("data-rsts-position")).attr("data-rsts-scale-mode",k.attr("data-rsts-scale-mode")).appendTo(k)}});this.type="image"}this.backgrounds=[];this.element.find("[data-rsts-background]").each(function(){var k=d(this);if(k.is("img")&&k.parent().is("picture")){k=k.parent()}if(k.is("video")){k.attr("autoplay",true).attr("loop",true)}k.css({position:"absolute",top:0,left:0});h.backgrounds.push(k[0])});this.backgrounds=d(this.backgrounds).prependTo(this.element);if(this.backgrounds.length){this.element.children().last().css({position:"relative"});if(this.backgrounds.filter("video").length){this.element.children().last().css({"-webkit-transform":"translateZ(0)"})}}this.element.find("video[autoplay]").each(function(){if(this.pause){this.pause()}});if(this.content.attr("data-rsts-thumb")){this.data.thumbUrl=this.content.attr("data-rsts-thumb")}if(this.type==="image"){this.data.name=this.data.name||this.element.find("img").last().attr("alt");if(this.element.find("img").last().attr("data-rsts-thumb")){this.data.thumbUrl=this.element.find("img").last().attr("data-rsts-thumb")}if(!this.data.thumbUrl){this.data.thumbUrl=this.element.find("img").last().attr("src")}}if(!this.data.thumbUrl&&this.type==="video"){if(!this.content.attr("data-rsts-video")&&this.element.find("video").last().attr("poster")){this.data.thumbUrl=this.element.find("video").last().attr("poster")}else{if(this.element.find("img").last().length){this.data.thumbUrl=this.element.find("img").last().attr("data-rsts-thumb")||this.element.find("img").last().attr("src")}}}if(this.data.name&&this.slider.options.captions){d(a.createElement("div")).addClass(this.slider.options.cssPrefix+"caption").text(this.data.name).appendTo(this.element)}var g=function(){h.slider.resize(h.data.index);if(h.slider.css3Supported){h.slider.elements.crop.css("transform","");h.slider.elements.crop.css("transform");h.slider.elements.crop.css("transform","translateZ(0)")}};this.element.find("img").on("load",g);this.element.find("video").on("loadedmetadata",g);var f=this.element.find("h1,h2,h3,h4,h5,h6");if(!this.data.name&&f.length){this.data.name=f.text()}if(this.type==="video"){this.data.video=this.content.attr("data-rsts-video");this.videoStartButton=d(a.createElement("a")).attr("href",this.data.video||"").text("play").addClass(this.slider.options.cssPrefix+"video-play").on("click",function(k){k.preventDefault();h.startVideo()}).appendTo(this.element);if(!this.data.video&&this.element.find("video").last().length){this.element.find("video").last()[0].controls=false;this.element.find("video").last().on("ended",function(){h.stopVideo(true)})}}};e.prototype.videoRegExp={youtube:/^https?:\/\/(?:www\.youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\?|#|\/)(?:(?:.*[?&#]|)t=([0-9hms]+))?/i,vimeo:/^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)(?:.*#t=([0-9hms]+))?/i};e.prototype.isInjected=function(){return !!(this.element.get(0).parentNode&&this.element.get(0).parentNode.tagName)};e.prototype.isInitialized=function(){return !!this.content};e.prototype.isMediaLoaded=function(){var f=true;this.element.find("img").each(function(){if(this.complete===false){f=false;return false}});return f};e.prototype.size=function(f,h,g){this.updateResponsiveImages(true);if(f&&!h){this.slider.modify(this.element,{width:f,height:""});this.scaleContent(f,h);if(g||this.backgrounds.length){h=this.element.outerHeight()}}else{if(h&&!f){this.slider.modify(this.element,{height:h,width:""});this.scaleContent(f,h);if(g||this.backgrounds.length){f=this.element.outerWidth()}}else{if(f&&h){this.slider.modify(this.element,{width:f,height:h});this.scaleContent(f,h)}else{this.scaleContent(f,h);f=this.element.outerWidth();h=this.element.outerHeight()}}}this.scaleBackground(f,h);return{x:f,y:h}};e.prototype.updateResponsiveImages=function(g){var f=c.picturefill||c.respimage;if(!f){return}f({elements:this.element.find("img").get(),reevaluate:!!g})};e.prototype.scaleContent=function(f,h){if(this.centerContent){if(this.content.css("display")==="inline"){this.content.css("display","inline-block")}var g={"margin-top":"","margin-left":""};if(this.centerContent!=="y"&&f){g["margin-left"]=Math.round((f-this.content.outerWidth())/2)}if(this.centerContent!=="x"&&h){g["margin-top"]=Math.round((h-this.content.outerHeight())/2)}this.content.css(g)}if(this.type==="video"&&!this.data.video){this.element.find("video").last().css({width:f,height:h,display:"block"})}else{if(this.type==="image"||this.type==="video"){this.scaleImage(this.element.find("img").last(),f,h)}}};e.prototype.scaleBackground=function(f,h){var g=this;this.backgrounds.each(function(){var i=d(this);if(i.is("picture")){i=i.find("img").first()}g.scaleImage(i,f,h)})};e.prototype.scaleImage=function(f,m,l){var n=f.attr("data-rsts-scale-mode")||this.slider.options.scaleMode;var g=f.attr("data-rsts-position")||this.slider.options.imagePosition;var i=this.getOriginalSize(f);if(!i.x||!i.y){return}var j=i.x/i.y;if(m&&!l){l=m/j}else{if(l&&!m){m=l*j}else{if(!m&&!l){m=i.x;l=i.y}}}var k=m/l;var h={display:"block",width:i.x,height:i.y,"min-width":0,"min-height":0,"max-width":"none","max-height":"none"};if(n==="fit"||n==="crop"){if((j>=k&&n==="fit")||(j<=k&&n==="crop")){h.width=m;h.height=m/j}else{h.width=l*j;h.height=l}}else{if(n==="scale"){h.width=m;h.height=l}}h["margin-top"]=(l-h.height)/2;h["margin-left"]=(m-h.width)/2;if(g==="top"||g==="top-left"||g==="top-right"){h["margin-top"]=0}else{if(g==="bottom"||g==="bottom-left"||g==="bottom-right"){h["margin-top"]=l-h.height}}if(g==="left"||g==="top-left"||g==="bottom-left"){h["margin-left"]=0}else{if(g==="right"||g==="top-right"||g==="bottom-right"){h["margin-left"]=m-h.width}}f.css(h)};e.prototype.getOriginalSize=function(h){h=d(h);var g={};if(h[0].nodeName.toLowerCase()==="img"){if("naturalWidth" in new Image()){g.x=h[0].naturalWidth;g.y=h[0].naturalHeight}else{var f=new Image();f.src=h[0].src;g.x=f.width;g.y=f.height}}else{if(h[0].nodeName.toLowerCase()==="video"){g.x=h[0].videoWidth;g.y=h[0].videoHeight}}if(!g.x||!g.y){if(h.attr("width")||h.attr("height")){g.x=parseFloat(h.attr("width")||h.attr("height"));g.y=parseFloat(h.attr("height")||h.attr("width"))}else{g.x=g.y=0}}return g};e.prototype.setState=function(g){if(g==="active"&&g!==this.state&&this.state!=="preactive"){this.setState("preactive");this.element.css("opacity")}if(this.type==="video"&&this.state&&g==="inactive"&&g!==this.state){this.stopVideo()}if(this.type==="video"&&this.state&&g==="active"&&g!==this.state&&this.slider.options.videoAutoplay){this.startVideo()}if((g==="preactive"||g==="active")&&g!==this.state){this.element.find("video[autoplay]").each(function(){if(this.play){this.play()}})}else{if(g!=="active"&&g!=="preactive"&&(this.state==="active"||this.state==="preactive")){this.element.find("video").each(function(){if(this.pause){this.pause()}})}}this.state=g;var f=this.slider.options.cssPrefix;this.element.removeClass(f+"active").removeClass(f+"inactive").removeClass(f+"preactive").removeClass(f+"postactive").addClass(f+g)};e.prototype.stopVideo=function(h,g){if(!this.isVideoPlaying){return}this.isVideoPlaying=false;if(this.eventNamespace){d(c).off("message."+this.eventNamespace);delete this.eventNamespace}if(!this.data.video){var f=this.element.find("video").last();f[0].controls=false;f[0].pause();f[0].currentTime=0;if(f[0].poster){f[0].src="";f.removeAttr("src")}}if(this.videoElement){this.videoElement.attr("src","");this.videoElement.remove();delete this.videoElement}if(this.videoStopButton){this.videoStopButton.remove();delete this.videoStopButton}if(this.videoStartButton){this.videoStartButton.css("display","")}this.slider.elements.main.removeClass(this.slider.options.cssPrefix+"video-playing");if(h&&this.slider.options.autoplayRestart){this.slider.autoplay(200)}else{if(g){this.slider.stopAutoplay()}}};e.prototype.startVideo=function(){var f=this;var k,g,i,j;if(this.isVideoPlaying){return}this.isVideoPlaying=true;this.slider.stopAutoplay(true);if(!this.data.video){var h=this.element.find("video").last();h[0].controls=true;h[0].play();this.videoStartButton.css("display","none")}else{if((i=this.data.video.match(this.videoRegExp.youtube))){this.element.addClass(this.slider.options.cssPrefix+"video-youtube");k=i[1];j=i[2];if(j){j=j.split(/[hm]/).reverse();j[0]=parseInt(j[0]||0,10);j[1]=parseInt(j[1]||0,10);j[2]=parseInt(j[2]||0,10);j=j[0]+(j[1]*60)+(j[2]*60*60)}this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src","http://www.youtube.com/embed/"+k+"?autoplay=1&enablejsapi=1&wmode=opaque"+(j?"&start="+j:"")).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);g=function(){if(f.videoElement&&c.YT){new YT.Player(f.videoElement.get(0),{events:{onStateChange:function(l){if(l.data===YT.PlayerState.ENDED){f.stopVideo(true)}}}})}};if(c.YT&&YT.Player){g()}else{d(a.createElement("script")).attr("src","//www.youtube.com/iframe_api").appendTo(a.head);c.onYouTubeIframeAPIReady=function(){delete c.onYouTubeIframeAPIReady;g()}}}else{if((i=this.data.video.match(this.videoRegExp.vimeo))){this.element.addClass(this.slider.options.cssPrefix+"video-vimeo");k=i[1];j=i[2];this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src","http://player.vimeo.com/video/"+k+"?autoplay=1&api=1"+(j?"#t="+j:"")).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);this.eventNamespace="rsts"+new Date().getTime();d(c).on("message."+this.eventNamespace,function(l){var m=JSON.parse(l.originalEvent.data);if(m&&m.event){if(m.event==="ready"){f.videoElement.get(0).contentWindow.postMessage('{"method":"addEventListener","value":"finish"}',f.videoElement.attr("src").split("?")[0])}else{if(m.event==="finish"){f.stopVideo(true)}}}})}else{this.element.addClass(this.slider.options.cssPrefix+"video-unknown");this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src",this.data.video).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element)}}}if(this.slider.device==="iPad"){this.element.addClass(this.slider.options.cssPrefix+"video-ipad")}this.videoStopButton=d(a.createElement("a")).attr("href",this.data.video||"").text("stop").addClass(this.slider.options.cssPrefix+"video-stop").on("click",function(l){l.preventDefault();f.stopVideo(false,true)}).appendTo(this.element);this.slider.elements.main.addClass(this.slider.options.cssPrefix+"video-playing")};e.prototype.setIndex=function(f){this.data.index=f};e.prototype.getData=function(){return this.data};e.prototype.getThumbUrl=function(){return this.data.thumbUrl||"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="};return e})();b.Slider=(function(){function e(i,h){var g=this;this.slides=[];this.elements={};this.elements.main=i;this.options=d.extend(true,{},this.defaultOptions,h);if(this.options.height==="auto"&&this.options.direction==="y"){throw new Error('height "auto" with direction "y" ist not possible')}if(this.options.type!=="slide"){this.options.visibleArea=1;this.options.visibleAreaMax=0;this.options.slideMaxCount=0;this.options.slideMinSize=0;this.options.slideMaxSize=0;this.options.rowMaxCount=0;this.options.rowMinSize=0;this.options.rowSlideRatio=0}this.checkCss3Support();this.readSlides();if(this.options.random){this.slides.sort(function(){return Math.random()-0.5})}d.each(this.slides,function(k){this.setIndex(k)});this.slideIndex=this.getIndexFromUrl();if(this.slideIndex===false){this.slideIndex=0}this.activeSlideOffset=0;d(c).on("hashchange.rsts",function(){var k=g.getIndexFromUrl();if(k!==false&&k!==g.slideIndex){g.goTo(k)}});this.elements.main.addClass(this.options.cssPrefix+"main").addClass(this.options.cssPrefix+"direction-"+this.options.direction).addClass(this.options.cssPrefix+"type-"+this.options.type).addClass(this.options.cssPrefix+"skin-"+this.options.skin);if(this.options.direction==="x"&&this.options.height==="normalize"){this.normalizeSize=true;this.options.height="auto"}else{if(this.options.direction==="x"&&(this.options.height==="auto"||(this.options.height==="css"&&this.elements.main.height()<1))){this.autoSize=true}else{if(this.options.direction==="y"&&this.options.width==="normalize"){this.normalizeSize=true;this.options.width="auto"}else{if(this.options.direction==="y"&&(this.options.width==="auto"||(this.options.width==="css"&&this.elements.main.width()<1))){this.autoSize=true}}}}var j=this.options.width.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.width;this.elements.main.css({width:"auto"})}j=this.options.height.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.height;this.elements.main.css({height:"auto"})}if(this.options.width&&this.options.width!=="css"){this.elements.main.css({width:this.options.width});if(this.options.width==="auto"){this.options.width="css"}}if(this.options.height&&this.options.height!=="css"){this.elements.main.css({height:this.options.height})}if(this.elements.header){this.elements.header.addClass(this.options.cssPrefix+"header").appendTo(this.elements.main)}this.elements.view=d(a.createElement("div")).addClass(this.options.cssPrefix+"view").appendTo(this.elements.main);this.elements.crop=d(a.createElement("div")).addClass(this.options.cssPrefix+"crop").on("scroll",function(){d(this).scrollLeft(0).scrollTop(0)}).appendTo(this.elements.view);this.elements.slides=d(a.createElement("div")).addClass(this.options.cssPrefix+"slides").appendTo(this.elements.crop);if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress=d(a.createElement("div")).addClass(this.options.cssPrefix+"progress").appendTo(this.elements.view);this.elements.progressBar=d(a.createElement("div")).appendTo(this.elements.progress)}if(this.options.visibleArea<1||this.options.visibleAreaMax){this.elements.overlayPrev=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-prev").appendTo(this.elements.view);this.elements.overlayNext=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-next").appendTo(this.elements.view)}this.nav=new b.SliderNav(this);if(this.elements.footer){this.elements.footer.addClass(this.options.cssPrefix+"footer").appendTo(this.elements.main)}this.autoplay();this.preloadSlides(this.slideIndex);this.cleanupSlides();d(c).on("resize.rsts",function(){g.resize()});this.resize();this.nav.combineItems();this.resize();d(c).on("domready.rsts load.rsts",function(){if(g.windowSizeHasChanged()){g.resize()}});if(this.options.type==="slide"){this.setDragEvents()}else{this.modify(this.slides[this.slideIndex].element,{opacity:1})}if(this.css3Supported){this.elements.slides.on("transitionend webkitTransitionEnd oTransitionEnd msTransitionEnd",function(k){if((g.options.type==="slide"&&k.target===g.elements.slides.get(0))||(g.options.type!=="slide"&&k.target.parentNode===g.elements.slides.get(0))){g.cleanupSlides()}});this.elements.crop.css({transform:"translateZ(0)"})}if(this.options.pauseAutoplayOnHover){this.elements.view.on("mouseenter",function(){if(!g.isTouch){g.pauseAutoplay()}});this.elements.view.on("mouseleave",function(){g.playAutoplay()})}this.isVisible=true;d(a).on("visibilitychange webkitvisibilitychange",function(k){g.checkVisibility()});var f;d(c).on("scroll",function(k){clearTimeout(f);f=setTimeout(function(){g.checkVisibility()},100)});this.checkVisibility();if(this.options.keyboard){d(a.body).on("keydown.rsts",function(m){var l=g.options.direction==="x"?37:38;var k=g.options.direction==="x"?39:40;if((m.which===l||m.which===k)&&(m.target===a.body||d(m.target).closest(g.elements.main).length)){if(m.which===l){g.prev()}else{g.next()}}})}}e.prototype.defaultOptions={type:"slide",direction:"x",visibleArea:1,visibleAreaMax:0,random:false,loop:false,cssPrefix:"rsts-",skin:"default",width:"css",height:"css",preloadSlides:2,slideMaxCount:0,slideMinSize:0,slideMaxSize:0,rowMaxCount:0,rowMinSize:0,rowSlideRatio:0,combineNavItems:true,prevNextSteps:0,centerContent:false,gapSize:20,duration:400,autoplay:false,videoAutoplay:false,autoplayRestart:false,autoplayProgress:false,pauseAutoplayOnHover:false,navType:"bullets",controls:true,scaleMode:"fit",imagePosition:"center",deepLinkPrefix:false,keyboard:true,captions:true,thumbs:{cssPrefix:"rsts-thumbs-",navType:"none",slideMaxSize:50,preloadSlides:10,gapSize:5,width:"100%",height:"1x1",scaleMode:"crop",keyboard:false,captions:false}};e.prototype.goTo=function(l,o,j){var r=this;if(!j){this.stopAutoplay()}var m=this.getVisibleCount();var k=this.getVisibleRowsCount();var s=false;var v=0;var g=this.slideIndex;var w=l-this.slideIndex<0?-1:l===this.slideIndex?0:1;if((l<0||l>this.slides.length-1)&&this.options.loop){v=l-this.slideIndex;l=this.getSlideIndex(l)}else{if((l<0||l>this.slides.length-m)&&!this.options.loop){if(this.options.type!=="slide"){return}s=l<0?-1:1;l=l<0?0:this.slides.length-m}}if(!s&&this.slideIndex===l&&!o){return}var x=[];for(var u=this.slideIndex;u<=this.slideIndex+m-1;u++){x.push(this.getSlideIndex(u))}var t=[];for(u=l;u<=l+m-1;u++){t.push(this.getSlideIndex(u))}d.each(x,function(y,z){if(d.inArray(z,t)===-1){r.slides[z].setState("postactive")}});d.each(t,function(y,z){if(d.inArray(z,x)===-1){r.slides[z].setState("preactive")}});var h=this.slideSize+this.getGapSize();if(v){this.activeSlideOffset=this.getSlideOffset(this.slideIndex+v)}else{if(l>this.slideIndex&&l-this.slideIndex-m>this.options.preloadSlides*k*2){this.activeSlideOffset+=(this.options.preloadSlides*k*2+m)*h/k}else{if(lthis.options.preloadSlides*k*2){this.activeSlideOffset-=(this.options.preloadSlides*k*2+m)*h/k}else{this.activeSlideOffset=this.getSlideOffset(l)}}}this.slideIndex=l;var n=true;if(!o){n=false}else{d.each(t,function(y,z){if(!r.slides[z].isInjected()||Math.round(r.slides[z].element.position()[{x:"left",y:"top"}[r.options.direction]])!==Math.round(r.getSlideOffset(r.slideIndex+y))){n=false;return false}})}if(n){this.preloadOnCleanup=true}else{this.preloadSlides(l,g)}var q=this.getViewSize(l);var p;var f=-this.getSlideOffset(l)+Math.round(q[this.options.direction]*(1-this.visibleAreaRate)/2);if(o&&!s){p=Math.abs((this.getOffset(this.elements.slides)-f)/h)}else{if(o&&s){p=0.7}}if(this.options.type==="slide"){this.modify(this.elements.slides,{offset:f},true,p,o,!o&&s)}else{if(this.options.type==="fade"){this.modify(this.slides[this.slideIndex].element,{opacity:1},true)}else{if(this.options.type==="side-slide"){this.modify(this.slides[this.slideIndex].element,{offset:w*this.slideSize});this.slides[this.slideIndex].element.position();this.modify(this.slides[this.slideIndex].element,{offset:0},true)}else{this.modify(this.slides[this.slideIndex].element,{},true)}}}this.nav.setActive(t);if(this.autoSize){this.modify(this.elements.crop,{width:q.x,height:q.y},true,p,o)}this.elements.main.trigger({type:"rsts-slidestart",rstSlider:this})};e.prototype.getIndexFromUrl=function(){if(!this.options.deepLinkPrefix){return false}var f="#"+this.options.deepLinkPrefix;if(c.location.hash.substr(0,f.length)===f){var g=Math.abs(parseInt(c.location.hash.substr(f.length),10));if(g){if(g>this.slides.length){g=this.slides.length}return g-1}}return 0};e.prototype.stopAutoplay=function(g){var f=this;clearTimeout(this.autoplayTimeout);this.autoplayStopped=true;if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress.removeClass(this.options.cssPrefix+"progress-active")}if(this.options.autoplayRestart&&!g){this.autoplayTimeout=setTimeout(function(){f.autoplay()},this.options.autoplayRestart-this.options.autoplay+(this.options.duration*2))}};e.prototype.pauseAutoplay=function(){if(!this.options.autoplay||this.autoplayPaused){return}if(!this.autoplayStopped){clearTimeout(this.autoplayTimeout)}this.autoplayPaused=true;if(this.options.autoplay&&this.options.autoplayProgress&&!this.autoplayStopped){this.pauseAutoplayProgressBar()}};e.prototype.playAutoplay=function(){if(!this.options.autoplay||!this.autoplayPaused){return}this.autoplayPaused=false;if(!this.autoplayStopped){this.autoplay((1-(this.options.autoplayProgress?this.elements.progressBar.outerWidth()/this.elements.progress.width():0))*(this.slides[this.slideIndex].getData().autoplay||this.options.autoplay))}};e.prototype.autoplay=function(g){var f=this;if(!this.options.autoplay){return}clearTimeout(this.autoplayTimeout);this.autoplayStopped=false;if(this.autoplayPaused){this.pauseAutoplayProgressBar(0);return}g=(g||g===0)?g:((this.slides[this.slideIndex].getData().autoplay||this.options.autoplay)-this.options.duration);this.startAutoplayProgressBar(g);var h=function(){var k=f.getVisibleCount();var j=f.slideIndex+(Math.min(f.options.prevNextSteps*f.getVisibleRowsCount(),k)||k);if(j>f.slides.length-k&&!f.options.loop){if(f.slideIndexthis.slides.length-g&&this.slideIndex0){f=0}this.goTo(f)};e.prototype.readSlides=function(){var f=this;this.elements.main.children().each(function(){var g=d(this);if(g.is('h1, h2, h3, h4, h5, h6, [data-rsts-type="header"]')){if(!f.elements.header){f.elements.header=d(a.createElement("div"))}g.appendTo(f.elements.header)}else{if(g.is('[data-rsts-type="footer"]')){if(!f.elements.footer){f.elements.footer=d(a.createElement("div"))}g.appendTo(f.elements.footer)}else{f.slides.push(new b.Slide(this,f))}}});this.elements.main.empty();if(this.slides.length===0){throw new Error("No slides found")}};e.prototype.preloadSlides=function(k,l){var p=this;var q=this.getViewSizeFixed();q[this.options.direction]=this.slideSize;if(this.getVisibleRowsCount()>1){q[this.options.direction==="x"?"y":"x"]=this.rowSize}var o=this.getVisibleCount();var f=0;if(this.options.loop){f=Math.min(Math.floor((this.slides.length-o)/2),this.options.preloadSlides*this.getVisibleRowsCount())}else{f=this.options.preloadSlides*this.getVisibleRowsCount()}var n=this.getActiveSlides(k);var j=0;var h,m;for(var g=k-f;g<=k+f+o-1;g++){m=this.getSlideIndex(g);h=this.slides[m];if(!this.options.loop&&(g<0||g>=this.slides.length)){continue}if(!h.isInitialized()){h.init();j++}if(p.options.type!=="slide"&&g!==k){continue}if(p.options.type==="slide"){if(l!==undefined&&d.inArray(m,n)===-1&&(g<0||g>=this.slides.length)&&h.isInjected()){this.preloadOnCleanup=true;continue}p.modify(h.element,{offset:p.getSlideOffset(g),rowOffset:p.getRowOffset(g)})}if(!h.isInjected()){if(p.options.type==="fade"){p.modify(h.element,{opacity:0})}p.elements.slides.append(h.element);h.size(q.x,q.y)}else{if(p.options.type!=="slide"&&g===p.slideIndex&&h.element.next().length){if(p.options.type==="fade"){if(h.element.next().length===1){p.modify(h.element,{opacity:1-h.element.next().css("opacity")});p.modify(h.element.next(),{opacity:1})}else{p.modify(h.element,{opacity:0})}}p.elements.slides.append(h.element)}}}if(this.normalizeSize&&j){this.resize()}};e.prototype.getActiveSlides=function(j){j=j!==undefined?j:this.slideIndex;var h=[];var g=this.getVisibleCount();for(var f=j;f<=j+g-1;f++){h.push(this.getSlideIndex(f))}return h};e.prototype.cleanupSlides=function(){clearTimeout(this.cleanupSlidesTimeout);var o=this;var n=this.getVisibleCount();var g=this.options.type==="slide"?this.options.preloadSlides*this.getVisibleRowsCount():0;var k=[];var m=[];var h=[];var f=[];for(var j=this.slideIndex-g;j<=this.slideIndex+g+n-1;j++){k.push(this.getSlideIndex(j))}for(j=this.slideIndex;j<=this.slideIndex+n-1;j++){m.push(this.getSlideIndex(j))}d.each(this.slides,function(q,p){d.merge(h,p.data.sliderClasses);if(p.isInjected()&&d.inArray(q,k)===-1){if(o.options.type==="fade"&&o.slides[o.slideIndex].element.css("opacity")<1){return}if(o.options.type==="side-slide"){var r=o.options.direction==="x"?"left":"top";if(o.slides[o.slideIndex].element.position()[r]!==0){return}}p.element.detach()}if(d.inArray(q,m)===-1&&p.state!=="inactive"){p.setState("inactive")}});this.nav.setActive(m);d.each(m,function(p,q){o.slides[q].setState("active");d.merge(f,o.slides[q].data.sliderClasses)});this.elements.main.removeClass(d.grep(h,function(i){return d.inArray(i,f)===-1}).join(" "));this.elements.main.addClass(f.join(" "));if(this.options.deepLinkPrefix&&this.getIndexFromUrl()!==this.slideIndex){if(this.slideIndex){c.location.hash="#"+this.options.deepLinkPrefix+(this.slideIndex+1)}else{if(c.history&&c.history.pushState){c.history.pushState("",a.title,c.location.pathname+c.location.search)}else{var l={x:d(c).scrollLeft(),y:d(c).scrollTop()};c.location.hash="";d(c).scrollLeft(l.x);d(c).scrollTop(l.y)}}}if(this.preloadOnCleanup){this.preloadOnCleanup=false;this.preloadSlides(this.slideIndex)}if(this.windowSizeHasChanged()){this.resize()}this.elements.main.trigger({type:"rsts-slidestop",rstSlider:this})};e.prototype.getSlideOffset=function(f){var g=this.getViewSizeFixed(true);var j=this.getVisibleSlidesCount();var h=this.getVisibleRowsCount();var k=this.getGapSize();var i=(this.slideSize+k)-(((g[this.options.direction]*this.visibleAreaRate)+k)/j);return Math.floor((f-this.slideIndex)/h)*(this.slideSize+k)-Math.round(i*Math.floor((f-this.slideIndex)/h))+this.activeSlideOffset};e.prototype.getRowOffset=function(l){var n=this.getViewSizeFixed(true);var k=this.getVisibleRowsCount();var o=((((l-this.slideIndex)%k)+k)%k);var h=0;var m=this.options.direction==="x"?"y":"x";var f=this.getGapSize();if(this.autoSize){var p={};p[this.options.direction]=this.slideSize;for(var j=l-o;jthis.options.slideMaxSize)){g=Math.ceil((f+h)/(this.options.slideMaxSize+h))}return Math.min(this.slides.length,Math.max(1,g))};e.prototype.getVisibleRowsCount=function(){if(!this.options.rowMaxCount&&!this.options.rowMinSize&&!this.options.rowSlideRatio){return 1}var f=this.getViewSizeFixed(true)[this.options.direction==="x"?"y":"x"];var i=this.getGapSize();var h=this.getVisibleSlidesCount();var g=0;if(this.options.rowSlideRatio){g=Math.floor(h*this.options.rowSlideRatio)}if(this.options.rowMaxCount&&(!g||g>this.options.rowMaxCount)){g=this.options.rowMaxCount}if(f&&!this.normalizeSize&&this.options.rowMinSize&&(!g||(f-(i*(g-1)))/gthis.options.visibleAreaMax){this.visibleAreaRate=this.options.visibleAreaMax/(this.options.direction==="x"?f:k)}if(this.options.slideMaxSize&&(this.options.direction==="x"?f:k)*this.visibleAreaRate>this.slides.length*(this.options.slideMaxSize+j)-j){this.visibleAreaRate=(this.slides.length*(this.options.slideMaxSize+j)-j)/(this.options.direction==="x"?f:k)}var h=this.getVisibleSlidesCount();var i=this.getVisibleRowsCount();if(!this.options.width&&this.proportion){f=this.viewSizeFixedCache.x=Math.round((((((((k+j)/i)-j)*this.proportion)+j)*h)-j)/this.visibleAreaRate)}if(!this.options.height&&this.proportion){k=this.viewSizeFixedCache.y=Math.round(((Math.round(((((f*this.visibleAreaRate)+j)/h)-j)/this.proportion)+j)*i)-j)}if(this.normalizeSize&&this.normalizedSize){if(this.options.direction==="x"){k=this.viewSizeFixedCache.y=((this.normalizedSize+j)*i)-j}else{f=this.viewSizeFixedCache.x=((this.normalizedSize+j)*i)-j}}this.slideSize=(j>0?Math.round:Math.ceil)((((this.options.direction==="x"?f:k)*this.visibleAreaRate)-(j*(h-1)))/h);if(this.options.direction==="x"?k:f){this.rowSize=(j>0?Math.round:Math.ceil)(((this.options.direction==="x"?k:f)-(j*(i-1)))/i)}else{this.rowSize=undefined}return d.extend({},this.viewSizeFixedCache)};e.prototype.getViewSize=function(j){j=j||0;var p=this.getViewSizeFixed();var q=p[this.options.direction];p[this.options.direction]=this.slideSize;if(!p.x||!p.y){var m=this.getVisibleSlidesCount();var l=this.getVisibleRowsCount();var f=this.getGapSize();var n=!p.x?"x":"y";var i=0;var g,o,h,k;for(g=0;g=this.slides.length){this.nav.hide()}else{this.nav.show()}if(f!==this.getVisibleCount()){this.nav.combineItems();this.cleanupSlides()}this.checkVisibility();this.windowSizeHasChanged()};e.prototype.checkVisibility=function(){var g=!(a.hidden||a.webkitHidden);var h=false;var f=this.elements.main;var j=f.offset();var i=d(c);if(g&&j.lefti.scrollLeft()&&j.topi.scrollTop()){h=true}if(this.isVisible!==h){this.isVisible=h;if(h){this.playAutoplay()}else{this.pauseAutoplay()}}};e.prototype.getSlides=function(){return this.slides};e.prototype.getSlide=function(f){return this.slides[this.getSlideIndex(f)]};e.prototype.getSlideIndex=function(f){return((f%this.slides.length)+this.slides.length)%this.slides.length};e.prototype.setTouch=function(f){if(f!==this.isTouch){if(f){this.elements.main.addClass(this.options.cssPrefix+"touch").removeClass(this.options.cssPrefix+"no-touch")}else{this.elements.main.addClass(this.options.cssPrefix+"no-touch").removeClass(this.options.cssPrefix+"touch")}}if(f){this.lastTouchTime=new Date().getTime()}this.isTouch=f};e.prototype.setDragEvents=function(){var f=this;this.lastTouchTime=0;this.setTouch(false);var g={start:"mousedown",stop:"mouseup",move:"mousemove"};if(c.navigator.pointerEnabled&&c.navigator.maxTouchPoints){g={start:"pointerdown",stop:"pointerup",move:"pointermove"};this.elements.crop.css("touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("pointerdown",function(h){if(h.originalEvent.pointerType==="touch"){f.setTouch(true)}})}else{if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){g={start:"MSPointerDown",stop:"MSPointerUp",move:"MSPointerMove"};this.elements.crop.css("-ms-touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("MSPointerDown",function(h){if(h.originalEvent.pointerType===h.originalEvent.MSPOINTER_TYPE_TOUCH){f.setTouch(true)}})}else{if("ontouchstart" in c||"ontouchend" in a){g={start:g.start+" touchstart",stop:g.stop+" touchend touchcancel",move:g.move+" touchmove"};this.elements.main.on("touchstart",function(h){f.setTouch(true)})}}}this.elements.crop.on(g.start,function(h){return f.onDragStart(h)});d(a).on(g.stop+".rsts",function(h){return f.onDragStop(h)});d(a).on(g.move+".rsts",function(h){return f.onDragMove(h)});this.elements.crop.on("dragstart",function(h){if(f.isDragging){h.preventDefault()}});if(this.elements.crop[0].addEventListener){this.elements.crop[0].addEventListener("click",function(h){return f.onClickCapturing(d.event.fix(h))},true)}};e.prototype.onDragStart=function(f){if(this.isDragging||(f.type==="mousedown"&&f.which!==1)){return}this.dragLastDiff=0;this.touchAxis="";if(d(f.target).closest("."+this.options.cssPrefix+"no-drag",this.elements.slides).length){return}if(c.navigator.pointerEnabled&&c.navigator.maxTouchPoints){this.setTouch(f.originalEvent.pointerType==="touch")}else{if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){this.setTouch(f.originalEvent.pointerType===f.originalEvent.MSPOINTER_TYPE_TOUCH)}else{this.setTouch(f.type!=="mousedown"||new Date().getTime()-this.lastTouchTime<1000)}}var g=this.getPositionFromEvent(f);this.isDragging=true;this.isDraggingStarted=false;this.dragStartPos={x:g.x-this.elements.slides.offset().left+this.elements.crop.offset().left,y:g.y-this.elements.slides.offset().top+this.elements.crop.offset().top};this.dragLastPos=g[this.options.direction];this.rawStartPos=g;this.modify(this.elements.slides,{offset:g[this.options.direction]-this.dragStartPos[this.options.direction]});this.onDragMove(f)};e.prototype.onDragStop=function(f){if(!this.isDragging){return}this.isDragging=false;this.isDraggingStarted=false;this.elements.main.removeClass(this.options.cssPrefix+"dragging");if(this.dragLastDiff===0||this.dragLastDiff===undefined){return}var g=this.slideIndex+(Math.floor((-Math.round(this.getOffset(this.elements.slides))-this.activeSlideOffset+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))/(this.slideSize+this.getGapSize()))*this.getVisibleRowsCount());if(this.dragLastDiff<=0){this.goTo(g,true)}else{this.goTo(g+this.getVisibleRowsCount(),true)}};e.prototype.onDragMove=function(j){if(!this.isDragging||(this.isTouch&&j.type==="mousemove")){return}if(j.originalEvent.touches&&j.originalEvent.touches[1]){return this.onDragStop()}var k=this.getPositionFromEvent(j);var g;if(!this.touchAxis){g=Math.abs(k.x-this.rawStartPos.x)-Math.abs(k.y-this.rawStartPos.y);if(g>(this.isTouch?4:2)){this.touchAxis="x"}else{if(g<-(this.isTouch?4:2)){this.touchAxis="y"}}}if(this.touchAxis===this.options.direction){j.preventDefault();this.stopAutoplay()}else{if(!this.touchAxis){return}else{return this.onDragStop()}}if(!this.isDraggingStarted){this.isDraggingStarted=true;this.elements.main.addClass(this.options.cssPrefix+"dragging");(function(){var l=(c.getSelection&&c.getSelection())||a.selection||{};(l.empty||l.removeAllRanges||function(){}).apply(l)})()}var f=this.dragLastPos-k[this.options.direction];var i=k[this.options.direction]-this.dragStartPos[this.options.direction];var h=this.getVisibleCount();if(!this.options.loop){if(i>-this.getSlideOffset(0)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(0)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}if(i<-this.getSlideOffset(this.slides.length-h)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(this.slides.length-h)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}}this.modify(this.elements.slides,{offset:i});if(f<0||f>0){this.dragLastDiff=f}this.dragLastPos=k[this.options.direction]};e.prototype.onClickCapturing=function(f){if(this.dragLastDiff!==0&&typeof this.dragLastDiff!=="undefined"){f.stopPropagation();f.preventDefault()}};e.prototype.getPositionFromEvent=function(f){var g={x:f.pageX,y:f.pageY};if(typeof g.x!=="number"){g={x:f.originalEvent.pageX,y:f.originalEvent.pageY}}if(f.originalEvent.touches&&f.originalEvent.touches[0]){g={x:f.originalEvent.touches[0].pageX,y:f.originalEvent.touches[0].pageY}}return g};return e})();b.SliderNav=(function(){function e(h){var g=this;this.slider=h;this.elements={};if(h.options.controls){this.elements.prev=d(a.createElement("a")).attr("href","").text("prev").addClass(h.options.cssPrefix+"prev").on("click",function(i){i.preventDefault();g.slider.prev()});this.elements.next=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).addClass(h.options.cssPrefix+"next");h.elements.view.append(this.elements.prev).append(this.elements.next)}if(h.options.navType!=="none"){this.elements.main=d(a.createElement("div")).addClass(h.options.cssPrefix+"nav "+h.options.cssPrefix+"nav-"+h.options.navType);if(h.options.navType==="thumbs"){this.elements.thumbs=d(a.createElement("div"));d.each(this.slider.getSlides(),function(k,j){g.createThumb(k,j).appendTo(g.elements.thumbs)});this.elements.main.append(this.elements.thumbs);h.elements.main.append(this.elements.main);this.thumbsSlider=new b.Slider(this.elements.thumbs,d.extend({visibleArea:h.options.visibleArea,visibleAreaMax:h.options.visibleAreaMax,loop:h.options.loop,duration:h.options.duration,controls:h.options.controls},h.options.thumbs||{}));this.setActive([0])}else{this.elements.mainPrev=d(a.createElement("a")).attr("href","").text("prev").on("click",function(i){i.preventDefault();g.slider.prev()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-prev"));this.elements.mainNext=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-next"));var f=a.createElement("ul");d.each(this.slider.getSlides(),function(k,j){g.elements[k]=g.createNavItem(k,j.getData()).appendTo(f)});this.elements.mainPrev.parent().prependTo(f);this.elements.mainNext.parent().appendTo(f);this.elements.main.append(f);h.elements.main.append(this.elements.main)}}}e.prototype.setActive=function(g){var f=this;var j=this.slider.getSlides();if(this.slider.options.navType==="thumbs"){var h=this.thumbsSlider.getVisibleCount();var i=this.thumbsSlider.getVisibleRowsCount();var k=g[Math.floor((g.length-1)/2)]-Math.floor((h-1)/2);if(!this.thumbsSlider.options.loop){k=Math.min(this.thumbsSlider.slides.length-h,Math.max(0,k))}else{k=this.thumbsSlider.getSlideIndex(k);k=this.getNearestIndex(k,this.thumbsSlider.slideIndex,this.thumbsSlider.getSlides().length)}k-=((((k+Math.floor(i/2)-this.thumbsSlider.slideIndex)%i)+i)%i)-Math.floor(i/2);d.each(this.activeIndexes||[],function(n,m){f.thumbsSlider.getSlide(m).element.removeClass(f.thumbsSlider.options.cssPrefix+"active-thumb")});d.each(g,function(n,m){f.thumbsSlider.getSlide(m).element.addClass(f.thumbsSlider.options.cssPrefix+"active-thumb")});this.thumbsSlider.resize();this.thumbsSlider.goTo(k)}if(this.activeIndexes){d.each(this.activeIndexes,function(n,m){if(!f.elements[m]){return}f.elements[m].children("a").removeClass("active")})}if(this.elements[j.length]&&d.inArray(j.length-1,g)!==-1){g=[j.length]}this.activeIndexes=g;var l=false;d.each(this.activeIndexes,function(n,m){if(!f.elements[m]){return}if(f.elements[m][0].style.display!=="none"){l=true}f.elements[m].children("a").addClass("active")});if(!l&&this.elements[j.length]){d.each(this.activeIndexes,function(n,m){if(!f.elements[m]){return}f.elements[m].children("a").removeClass("active")});this.activeIndexes=[j.length];this.elements[j.length].children("a").addClass("active")}};e.prototype.getNearestIndex=function(h,f,g){if(Math.abs(h-f)>Math.abs(h-g-f)){h-=g}else{if(Math.abs(h-f)>Math.abs(h+g-f)){h+=g}}return h};e.prototype.combineItems=function(){if(!this.elements[0]){return}var h=this.slider.getVisibleCount();var j=this.slider.getSlides();if(this.elements[j.length]){this.elements[j.length].remove();delete this.elements[j.length]}d.each(this.elements,function(){this.css("display","")});if(h<2||!this.slider.options.combineNavItems){return}var k;for(var g=0;this.elements[g];g++){if((g-Math.floor((h-1)/2))%h||(g-Math.floor((h-1)/2))>j.length-h){this.elements[g].css("display","none")}else{k=g}}if(j.length%h===0){this.elements[j.length-h+Math.floor((h-1)/2)].css("display","")}else{var f=j.length-(j.length%h||h)+Math.floor((h-1)/2);this.elements[j.length]=this.createNavItem(f,j[f>=j.length?j.length-1:f].getData()).insertAfter(this.elements[j.length-1])}};e.prototype.show=function(){d([]).add(this.elements.prev).add(this.elements.next).add(this.elements.main).css("display","")};e.prototype.hide=function(){d([]).add(this.elements.prev).add(this.elements.next).add(this.elements.main).css("display","none")};e.prototype.createNavItem=function(g,h){var f=this;return d(a.createElement("li")).addClass(f.slider.options.cssPrefix+"nav-item").append(d(a.createElement("a")).attr("href","").text((f.slider.options.navType!=="numbers"&&h.name)?h.name:(h.index+1)).on("click",function(i){i.preventDefault();f.itemOnClick(g)}))};e.prototype.createThumb=function(h,f){var g=this;return d(a.createElement("a")).attr("href","").attr("data-rsts-type","image").append(d(a.createElement("img")).attr("src",f.getThumbUrl()).attr("alt",f.getData().name)).on("click",function(i){i.preventDefault();g.itemOnClick(h)})};e.prototype.itemOnClick=function(f){var g=this.slider.getVisibleCount();var h=this.slider.getVisibleRowsCount();var i=f-Math.floor((g-1)/2);if(!this.slider.options.loop){i=Math.min(this.slider.slides.length-g,Math.max(0,i))}else{i=this.getNearestIndex(this.slider.getSlideIndex(i),this.slider.slideIndex,this.slider.getSlides().length)}i-=((((i+Math.floor(h/2)-this.slider.slideIndex)%h)+h)%h)-Math.floor(h/2);this.slider.goTo(i)};e.prototype.resize=function(){if(this.thumbsSlider){this.thumbsSlider.resize()}};e.prototype.getSize=function(){if(!this.elements.main||this.elements.main.css("position")==="absolute"){return{x:0,y:0}}return{x:this.elements.main.outerWidth(true),y:this.elements.main.outerHeight(true)}};return e})();d.fn.rstSlider=function(f){var e=arguments;return this.each(function(){var h=d(this);if(typeof f==="string"){var g=h.data("rstSlider");if(g&&g[f]){return g[f].apply(g,Array.prototype.slice.call(e,1))}}else{if(!h.data("rstSlider")){h.data("rstSlider",new b.Slider(h,f))}}})}})(jQuery,window,document); +/*! rocksolid-slider v1.5.3 */ +(function(d,c,a){var b={};b.Slide=(function(){function e(g,h){var f=this;this.slider=h;this.element=d(a.createElement("div")).addClass(h.options.cssPrefix+"slide");this.data={name:undefined,sliderClasses:[]};this.backgrounds=d([]);if(g.nodeName.toLowerCase()==="script"&&g.type==="text/html"){this.contentHtml=g.innerHTML.replace(/\\(.)/gi,"$1");this.data.thumbUrl=d(g).attr("data-rsts-thumb")||undefined}else{this.init(g)}this.setState("inactive")}e.prototype.init=function(i){var h=this;if(this.isInitialized()){return}if(!i&&this.contentHtml){i=d(this.contentHtml)[0];delete this.contentHtml}this.content=d(i);var j=this.content.attr("data-rsts-class");this.data.name=this.content.attr("data-rsts-name")||this.content.attr("title");this.data.sliderClasses=(j&&j.split(" "))||[];if(this.content.attr("data-rsts-autoplay")){this.data.autoplay=parseFloat(this.content.attr("data-rsts-autoplay"))}if(i.nodeName.toLowerCase()==="img"||i.nodeName.toLowerCase()==="picture"){this.type="image"}if(i.nodeName.toLowerCase()==="video"){this.type="video"}this.type=this.content.attr("data-rsts-type")||this.type||"default";this.centerContent=this.content.attr("data-rsts-center")!==undefined?this.content.attr("data-rsts-center"):this.slider.options.centerContent;if(this.centerContent!=="x"&&this.centerContent!=="y"){this.centerContent=!!this.centerContent}if(this.type==="image"||this.type==="video"){this.centerContent=false}this.element.addClass(this.slider.options.cssPrefix+"slide-"+this.type).append(i);if(!a.createElement("video").canPlayType||this.slider.device==="iPhone"||this.slider.device==="iPod"){this.element.find("video[data-rsts-background]").each(function(){var k=d(this);if(k.attr("poster")){d(a.createElement("img")).attr("src",k.attr("poster")).attr("data-rsts-background","").attr("data-rsts-position",k.attr("data-rsts-position")).attr("data-rsts-scale-mode",k.attr("data-rsts-scale-mode")).insertBefore(k)}k.detach()})}if(this.type==="video"&&!this.content.attr("data-rsts-video")&&!a.createElement("video").canPlayType){this.element.find("video").each(function(){var k=d(this);if(!k.find("img").length){d(a.createElement("img")).attr("src",k.attr("poster")).attr("data-rsts-position",k.attr("data-rsts-position")).attr("data-rsts-scale-mode",k.attr("data-rsts-scale-mode")).appendTo(k)}});this.type="image"}this.backgrounds=[];this.element.find("[data-rsts-background]").each(function(){var k=d(this);if(k.is("img")&&k.parent().is("picture")){k=k.parent()}if(k.is("video")){k.attr("autoplay",true).attr("loop",true)}k.css({position:"absolute",top:0,left:0});h.backgrounds.push(k[0])});this.backgrounds=d(this.backgrounds).prependTo(this.element);if(this.backgrounds.length){this.element.children().last().css({position:"relative"});if(this.backgrounds.filter("video").length){this.element.children().last().css({"-webkit-transform":"translateZ(0)"})}}this.element.find("video[autoplay]").each(function(){if(this.pause){this.pause()}});if(this.content.attr("data-rsts-thumb")){this.data.thumbUrl=this.content.attr("data-rsts-thumb")}if(this.type==="image"){this.data.name=this.data.name||this.element.find("img").last().attr("alt");if(this.element.find("img").last().attr("data-rsts-thumb")){this.data.thumbUrl=this.element.find("img").last().attr("data-rsts-thumb")}if(!this.data.thumbUrl){this.data.thumbUrl=this.element.find("img").last().attr("src")}}if(!this.data.thumbUrl&&this.type==="video"){if(!this.content.attr("data-rsts-video")&&this.element.find("video").last().attr("poster")){this.data.thumbUrl=this.element.find("video").last().attr("poster")}else{if(this.element.find("img").last().length){this.data.thumbUrl=this.element.find("img").last().attr("data-rsts-thumb")||this.element.find("img").last().attr("src")}}}if(this.data.name&&this.slider.options.captions){d(a.createElement("div")).addClass(this.slider.options.cssPrefix+"caption").text(this.data.name).appendTo(this.element)}var g=function(){h.slider.resize(h.data.index);if(h.slider.css3Supported){h.slider.elements.crop.css("transform","");h.slider.elements.crop.css("transform");h.slider.elements.crop.css("transform","translateZ(0)")}};this.element.find("img").on("load",g);this.element.find("video").on("loadedmetadata",g);var f=this.element.find("h1,h2,h3,h4,h5,h6");if(!this.data.name&&f.length){this.data.name=f.text()}if(this.type==="video"){this.data.video=this.content.attr("data-rsts-video");this.videoStartButton=d(a.createElement("a")).attr("href",this.data.video||"").text("play").addClass(this.slider.options.cssPrefix+"video-play").on("click",function(k){k.preventDefault();h.startVideo()}).appendTo(this.element);if(!this.data.video&&this.element.find("video").last().length){this.element.find("video").last()[0].controls=false;this.element.find("video").last().on("ended",function(){h.stopVideo(true)})}}};e.prototype.videoRegExp={youtube:/^https?:\/\/(?:(?:www\.)?youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\?|#|\/)(?:(?:.*[?&#]|)t=([0-9hms]+))?/i,youtubePlayer:/^https?:\/\/(?:www\.)?youtube\.com\/embed\/[0-9a-z_\-]{11}/i,vimeo:/^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)(?:.*#t=([0-9hms]+))?/i,vimeoPlayer:/^https?:\/\/player\.vimeo\.com\/video\/[0-9]+/i};e.prototype.isInjected=function(){return !!(this.element.get(0).parentNode&&this.element.get(0).parentNode.tagName)};e.prototype.isInitialized=function(){return !!this.content};e.prototype.isMediaLoaded=function(){var f=true;this.element.find("img").each(function(){if(this.complete===false){f=false;return false}});return f};e.prototype.size=function(f,h,g){this.updateResponsiveImages(true);if(f&&!h){this.slider.modify(this.element,{width:f,height:""});this.scaleContent(f,h);if(g||this.backgrounds.length){h=this.element.outerHeight()}}else{if(h&&!f){this.slider.modify(this.element,{height:h,width:""});this.scaleContent(f,h);if(g||this.backgrounds.length){f=this.element.outerWidth()}}else{if(f&&h){this.slider.modify(this.element,{width:f,height:h});this.scaleContent(f,h)}else{this.scaleContent(f,h);f=this.element.outerWidth();h=this.element.outerHeight()}}}this.scaleBackground(f,h);return{x:f,y:h}};e.prototype.updateResponsiveImages=function(g){var f=c.picturefill||c.respimage;if(!f){return}f({elements:this.element.find("img").get(),reevaluate:!!g})};e.prototype.scaleContent=function(f,h){if(this.centerContent){if(this.content.css("display")==="inline"){this.content.css("display","inline-block")}var g={"margin-top":"","margin-left":""};if(this.centerContent!=="y"&&f){g["margin-left"]=Math.round((f-this.content.outerWidth())/2)}if(this.centerContent!=="x"&&h){g["margin-top"]=Math.round((h-this.content.outerHeight())/2)}this.content.css(g)}if(this.type==="video"&&!this.data.video){this.element.find("video").last().css({width:f,height:h,display:"block"})}else{if(this.type==="image"||this.type==="video"){this.scaleImage(this.element.find("img").last(),f,h)}}};e.prototype.scaleBackground=function(f,h){var g=this;this.backgrounds.each(function(){var i=d(this);if(i.is("picture")){i=i.find("img").first()}g.scaleImage(i,f,h)})};e.prototype.scaleImage=function(f,m,l){var n=f.attr("data-rsts-scale-mode")||this.slider.options.scaleMode;var g=f.attr("data-rsts-position")||this.slider.options.imagePosition;var i=this.getOriginalSize(f);if(!i.x||!i.y){return}var j=i.x/i.y;if(m&&!l){l=m/j}else{if(l&&!m){m=l*j}else{if(!m&&!l){m=i.x;l=i.y}}}var k=m/l;var h={display:"block",width:i.x,height:i.y,"min-width":0,"min-height":0,"max-width":"none","max-height":"none"};if(n==="fit"||n==="crop"){if((j>=k&&n==="fit")||(j<=k&&n==="crop")){h.width=m;h.height=m/j}else{h.width=l*j;h.height=l}}else{if(n==="scale"){h.width=m;h.height=l}}h["margin-top"]=(l-h.height)/2;h["margin-left"]=(m-h.width)/2;if(g==="top"||g==="top-left"||g==="top-right"){h["margin-top"]=0}else{if(g==="bottom"||g==="bottom-left"||g==="bottom-right"){h["margin-top"]=l-h.height}}if(g==="left"||g==="top-left"||g==="bottom-left"){h["margin-left"]=0}else{if(g==="right"||g==="top-right"||g==="bottom-right"){h["margin-left"]=m-h.width}}f.css(h)};e.prototype.getOriginalSize=function(h){h=d(h);var g={};if(h[0].nodeName.toLowerCase()==="img"){if("naturalWidth" in new Image()){g.x=h[0].naturalWidth;g.y=h[0].naturalHeight}else{var f=new Image();f.src=h[0].src;g.x=f.width;g.y=f.height}}else{if(h[0].nodeName.toLowerCase()==="video"){g.x=h[0].videoWidth;g.y=h[0].videoHeight}}if(!g.x||!g.y){if(h.attr("width")||h.attr("height")){g.x=parseFloat(h.attr("width")||h.attr("height"));g.y=parseFloat(h.attr("height")||h.attr("width"))}else{g.x=g.y=0}}return g};e.prototype.setState=function(g){if(g==="active"&&g!==this.state&&this.state!=="preactive"){this.setState("preactive");this.element.css("opacity")}if(this.type==="video"&&this.state&&g==="inactive"&&g!==this.state){this.stopVideo()}if(this.type==="video"&&this.state&&g==="active"&&g!==this.state&&this.slider.options.videoAutoplay){this.startVideo()}if((g==="preactive"||g==="active")&&g!==this.state){this.element.find("video[autoplay]").each(function(){if(this.play){this.play()}})}else{if(g!=="active"&&g!=="preactive"&&(this.state==="active"||this.state==="preactive")){this.element.find("video").each(function(){if(this.pause){this.pause()}})}}this.state=g;var f=this.slider.options.cssPrefix;this.element.removeClass(f+"active").removeClass(f+"inactive").removeClass(f+"preactive").removeClass(f+"postactive").addClass(f+g)};e.prototype.stopVideo=function(h,g){if(!this.isVideoPlaying){return}this.isVideoPlaying=false;if(this.eventNamespace){d(c).off("message."+this.eventNamespace);delete this.eventNamespace}if(!this.data.video){var f=this.element.find("video").last();f[0].controls=false;f[0].pause();f[0].currentTime=0;if(f[0].poster){f[0].src="";f.removeAttr("src")}}if(this.videoElement){this.videoElement.attr("src","");this.videoElement.remove();delete this.videoElement}if(this.videoStopButton){this.videoStopButton.remove();delete this.videoStopButton}if(this.videoStartButton){this.videoStartButton.css("display","")}this.slider.elements.main.removeClass(this.slider.options.cssPrefix+"video-playing");if(h&&this.slider.options.autoplayRestart){this.slider.autoplay(200)}else{if(g){this.slider.stopAutoplay()}}};e.prototype.startVideo=function(){var f=this;var k,g,i,j,l;if(this.isVideoPlaying){return}this.isVideoPlaying=true;this.slider.stopAutoplay(true);if(!this.data.video){var h=this.element.find("video").last();h[0].controls=true;h[0].play();this.videoStartButton.css("display","none")}else{if((i=this.data.video.match(this.videoRegExp.youtube))){this.element.addClass(this.slider.options.cssPrefix+"video-youtube");k=i[1];j=i[2];if(j){j=j.split(/[hm]/).reverse();j[0]=parseInt(j[0]||0,10);j[1]=parseInt(j[1]||0,10);j[2]=parseInt(j[2]||0,10);j=j[0]+(j[1]*60)+(j[2]*60*60)}l="https://www.youtube.com/embed/"+k;if(this.data.video.match(this.videoRegExp.youtubePlayer)){l=this.data.video}if(!l.match(/[?&]autoplay=/i)){l+=(l.match(/\?/)?"&":"?")+"autoplay=1"}if(!l.match(/[?&]enablejsapi=/i)){l+="&enablejsapi=1"}if(!l.match(/[?&]wmode=/i)){l+="&wmode=opaque"}if(j&&!l.match(/[?&]start=/i)){l+="&start="+j}this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src",l).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);g=function(){if(f.videoElement&&c.YT){new YT.Player(f.videoElement.get(0),{events:{onStateChange:function(m){if(m.data===YT.PlayerState.ENDED){f.stopVideo(true)}}}})}};if(c.YT&&YT.Player){g()}else{d(a.createElement("script")).attr("src","//www.youtube.com/iframe_api").appendTo(a.head);c.onYouTubeIframeAPIReady=function(){delete c.onYouTubeIframeAPIReady;g()}}}else{if((i=this.data.video.match(this.videoRegExp.vimeo))){this.element.addClass(this.slider.options.cssPrefix+"video-vimeo");k=i[1];j=i[2];l="https://player.vimeo.com/video/"+k;if(this.data.video.match(this.videoRegExp.vimeoPlayer)){l=this.data.video}if(!l.match(/[?&]autoplay=/i)){l+=(l.match(/\?/)?"&":"?")+"autoplay=1"}if(!l.match(/[?&]api=/i)){l+="&api=1"}if(j&&!l.match(/#t=/i)){l+="#t="+j}this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src",l).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);this.eventNamespace="rsts"+new Date().getTime();d(c).on("message."+this.eventNamespace,function(m){var n=JSON.parse(m.originalEvent.data);if(n&&n.event){if(n.event==="ready"){f.videoElement.get(0).contentWindow.postMessage('{"method":"addEventListener","value":"finish"}',f.videoElement.attr("src").split("?")[0])}else{if(n.event==="finish"){f.stopVideo(true)}}}})}else{this.element.addClass(this.slider.options.cssPrefix+"video-unknown");this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src",this.data.video).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element)}}}if(this.slider.device==="iPad"){this.element.addClass(this.slider.options.cssPrefix+"video-ipad")}this.videoStopButton=d(a.createElement("a")).attr("href",this.data.video||"").text("stop").addClass(this.slider.options.cssPrefix+"video-stop").on("click",function(m){m.preventDefault();f.stopVideo(false,true)}).appendTo(this.element);this.slider.elements.main.addClass(this.slider.options.cssPrefix+"video-playing")};e.prototype.setIndex=function(f){this.data.index=f};e.prototype.getData=function(){return this.data};e.prototype.getThumbUrl=function(){return this.data.thumbUrl||"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="};return e})();b.Slider=(function(){function e(i,h){var g=this;this.slides=[];this.elements={};this.elements.main=i;this.options=d.extend(true,{},this.defaultOptions,h);if(this.options.height==="auto"&&this.options.direction==="y"){throw new Error('height "auto" with direction "y" ist not possible')}if(this.options.type!=="slide"){this.options.visibleArea=1;this.options.visibleAreaMax=0;this.options.slideMaxCount=0;this.options.slideMinSize=0;this.options.slideMaxSize=0;this.options.rowMaxCount=0;this.options.rowMinSize=0;this.options.rowSlideRatio=0}this.checkCss3Support();this.readSlides();if(this.options.random){this.slides.sort(function(){return Math.random()-0.5})}d.each(this.slides,function(k){this.setIndex(k)});this.slideIndex=this.getIndexFromUrl();if(this.slideIndex===false){this.slideIndex=0}this.activeSlideOffset=0;d(c).on("hashchange.rsts",function(){var k=g.getIndexFromUrl();if(k!==false&&k!==g.slideIndex){g.goTo(k)}});this.elements.main.addClass(this.options.cssPrefix+"main").addClass(this.options.cssPrefix+"direction-"+this.options.direction).addClass(this.options.cssPrefix+"type-"+this.options.type).addClass(this.options.cssPrefix+"skin-"+this.options.skin);if(this.options.direction==="x"&&this.options.height==="normalize"){this.normalizeSize=true;this.options.height="auto"}else{if(this.options.direction==="x"&&(this.options.height==="auto"||(this.options.height==="css"&&this.elements.main.height()<1))){this.autoSize=true}else{if(this.options.direction==="y"&&this.options.width==="normalize"){this.normalizeSize=true;this.options.width="auto"}else{if(this.options.direction==="y"&&(this.options.width==="auto"||(this.options.width==="css"&&this.elements.main.width()<1))){this.autoSize=true}}}}var j=this.options.width.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.width;this.elements.main.css({width:"auto"})}j=this.options.height.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.height;this.elements.main.css({height:"auto"})}if(this.options.width&&this.options.width!=="css"){this.elements.main.css({width:this.options.width});if(this.options.width==="auto"){this.options.width="css"}}if(this.options.height&&this.options.height!=="css"){this.elements.main.css({height:this.options.height})}if(this.elements.header){this.elements.header.addClass(this.options.cssPrefix+"header").appendTo(this.elements.main)}this.elements.view=d(a.createElement("div")).addClass(this.options.cssPrefix+"view").appendTo(this.elements.main);this.elements.crop=d(a.createElement("div")).addClass(this.options.cssPrefix+"crop").on("scroll",function(){d(this).scrollLeft(0).scrollTop(0)}).appendTo(this.elements.view);this.elements.slides=d(a.createElement("div")).addClass(this.options.cssPrefix+"slides").appendTo(this.elements.crop);if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress=d(a.createElement("div")).addClass(this.options.cssPrefix+"progress").appendTo(this.elements.view);this.elements.progressBar=d(a.createElement("div")).appendTo(this.elements.progress)}if(this.options.visibleArea<1||this.options.visibleAreaMax){this.elements.overlayPrev=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-prev").appendTo(this.elements.view);this.elements.overlayNext=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-next").appendTo(this.elements.view)}this.nav=new b.SliderNav(this);if(this.elements.footer){this.elements.footer.addClass(this.options.cssPrefix+"footer").appendTo(this.elements.main)}this.preloadSlides(this.slideIndex);this.cleanupSlides();d(c).on("resize.rsts",function(){g.resize()});this.resize();this.nav.combineItems();this.resize();this.autoplay();d(c).on("domready.rsts load.rsts",function(){if(g.windowSizeHasChanged()){g.resize()}});if(this.options.type==="slide"){this.setDragEvents()}else{this.modify(this.slides[this.slideIndex].element,{opacity:1})}if(this.css3Supported){this.elements.slides.on("transitionend webkitTransitionEnd oTransitionEnd msTransitionEnd",function(k){if((g.options.type==="slide"&&k.target===g.elements.slides.get(0))||(g.options.type!=="slide"&&k.target.parentNode===g.elements.slides.get(0))){g.cleanupSlides()}});this.elements.crop.css({transform:"translateZ(0)"})}if(this.options.pauseAutoplayOnHover){this.elements.view.on("mouseenter",function(){if(!g.isTouch){g.pauseAutoplay()}});this.elements.view.on("mouseleave",function(){g.playAutoplay()})}this.isVisible=true;d(a).on("visibilitychange webkitvisibilitychange",function(k){g.checkVisibility()});var f;d(c).on("scroll",function(k){clearTimeout(f);f=setTimeout(function(){g.checkVisibility()},100)});this.checkVisibility();if(this.options.keyboard){d(a.body).on("keydown.rsts",function(m){var l=g.options.direction==="x"?37:38;var k=g.options.direction==="x"?39:40;if((m.which===l||m.which===k)&&(m.target===a.body||d(m.target).closest(g.elements.main).length)){if(m.which===l){g.prev()}else{g.next()}}})}}e.prototype.defaultOptions={type:"slide",direction:"x",visibleArea:1,visibleAreaMax:0,random:false,loop:false,cssPrefix:"rsts-",skin:"default",width:"css",height:"css",preloadSlides:2,slideMaxCount:0,slideMinSize:0,slideMaxSize:0,rowMaxCount:0,rowMinSize:0,rowSlideRatio:0,combineNavItems:true,prevNextSteps:0,centerContent:false,gapSize:20,duration:400,autoplay:false,videoAutoplay:false,autoplayRestart:false,autoplayProgress:false,pauseAutoplayOnHover:false,navType:"bullets",controls:true,scaleMode:"fit",imagePosition:"center",deepLinkPrefix:false,keyboard:true,captions:true,thumbs:{cssPrefix:"rsts-thumbs-",navType:"none",slideMaxSize:50,preloadSlides:10,gapSize:5,width:"100%",height:"1x1",scaleMode:"crop",keyboard:false,captions:false}};e.prototype.goTo=function(l,o,j){var r=this;if(!j){this.stopAutoplay()}var m=this.getVisibleCount();var k=this.getVisibleRowsCount();var s=false;var v=0;var g=this.slideIndex;var w=l-this.slideIndex<0?-1:l===this.slideIndex?0:1;if((l<0||l>this.slides.length-1)&&this.options.loop){v=l-this.slideIndex;l=this.getSlideIndex(l)}else{if((l<0||l>this.slides.length-m)&&!this.options.loop){if(this.options.type!=="slide"){return}s=l<0?-1:1;l=l<0?0:this.slides.length-m}}if(!s&&this.slideIndex===l&&!o){return}var x=[];for(var u=this.slideIndex;u<=this.slideIndex+m-1;u++){x.push(this.getSlideIndex(u))}var t=[];for(u=l;u<=l+m-1;u++){t.push(this.getSlideIndex(u))}d.each(x,function(y,z){if(d.inArray(z,t)===-1){r.slides[z].setState("postactive")}});d.each(t,function(y,z){if(d.inArray(z,x)===-1){r.slides[z].setState("preactive")}});var h=this.slideSize+this.getGapSize();if(v){this.activeSlideOffset=this.getSlideOffset(this.slideIndex+v)}else{if(l>this.slideIndex&&l-this.slideIndex-m>this.options.preloadSlides*k*2){this.activeSlideOffset+=(this.options.preloadSlides*k*2+m)*h/k}else{if(lthis.options.preloadSlides*k*2){this.activeSlideOffset-=(this.options.preloadSlides*k*2+m)*h/k}else{this.activeSlideOffset=this.getSlideOffset(l)}}}this.slideIndex=l;var n=true;if(!o){n=false}else{d.each(t,function(y,z){if(!r.slides[z].isInjected()||Math.round(r.slides[z].element.position()[{x:"left",y:"top"}[r.options.direction]])!==Math.round(r.getSlideOffset(r.slideIndex+y))){n=false;return false}})}if(n){this.preloadOnCleanup=true}else{this.preloadSlides(l,g)}var q=this.getViewSize(l);var p;var f=-this.getSlideOffset(l)+Math.round(q[this.options.direction]*(1-this.visibleAreaRate)/2);if(o&&!s){p=Math.abs((this.getOffset(this.elements.slides)-f)/h)}else{if(o&&s){p=0.7}}if(this.options.type==="slide"){this.modify(this.elements.slides,{offset:f},true,p,o,!o&&s)}else{if(this.options.type==="fade"){this.modify(this.slides[this.slideIndex].element,{opacity:1},true)}else{if(this.options.type==="side-slide"){this.modify(this.slides[this.slideIndex].element,{offset:w*this.slideSize});this.slides[this.slideIndex].element.position();this.modify(this.slides[this.slideIndex].element,{offset:0},true)}else{this.modify(this.slides[this.slideIndex].element,{},true)}}}this.nav.setActive(t);if(this.autoSize){this.modify(this.elements.crop,{width:q.x,height:q.y},true,p,o)}this.elements.main.trigger({type:"rsts-slidestart",rstSlider:this})};e.prototype.getIndexFromUrl=function(){if(!this.options.deepLinkPrefix){return false}var f="#"+this.options.deepLinkPrefix;if(c.location.hash.substr(0,f.length)===f){var g=Math.abs(parseInt(c.location.hash.substr(f.length),10));if(g){if(g>this.slides.length){g=this.slides.length}return g-1}}return 0};e.prototype.stopAutoplay=function(g){var f=this;clearTimeout(this.autoplayTimeout);this.autoplayStopped=true;if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress.removeClass(this.options.cssPrefix+"progress-active")}if(this.options.autoplayRestart&&!g){this.autoplayTimeout=setTimeout(function(){f.autoplay()},this.options.autoplayRestart-this.options.autoplay+(this.options.duration*2))}};e.prototype.pauseAutoplay=function(){if(!this.options.autoplay||this.autoplayPaused){return}if(!this.autoplayStopped){clearTimeout(this.autoplayTimeout)}this.autoplayPaused=true;if(this.options.autoplay&&this.options.autoplayProgress&&!this.autoplayStopped){this.pauseAutoplayProgressBar()}};e.prototype.playAutoplay=function(){if(!this.options.autoplay||!this.autoplayPaused){return}this.autoplayPaused=false;if(!this.autoplayStopped){this.autoplay((1-(this.options.autoplayProgress?this.elements.progressBar.outerWidth()/this.elements.progress.width():0))*(this.slides[this.slideIndex].getData().autoplay||this.options.autoplay))}};e.prototype.autoplay=function(g){var f=this;if(!this.options.autoplay||this.getVisibleCount()>=this.slides.length){return}clearTimeout(this.autoplayTimeout);this.autoplayStopped=false;if(this.autoplayPaused){this.pauseAutoplayProgressBar(0);return}g=(g||g===0)?g:((this.slides[this.slideIndex].getData().autoplay||this.options.autoplay)-this.options.duration);this.startAutoplayProgressBar(g);var h=function(){var k=f.getVisibleCount();var j=f.slideIndex+(Math.min(f.options.prevNextSteps*f.getVisibleRowsCount(),k)||k);if(j>f.slides.length-k&&!f.options.loop){if(f.slideIndexthis.slides.length-g&&this.slideIndex0){f=0}this.goTo(f)};e.prototype.readSlides=function(){var f=this;this.elements.main.children().each(function(){var g=d(this);if(g.is('h1, h2, h3, h4, h5, h6, [data-rsts-type="header"]')){if(!f.elements.header){f.elements.header=d(a.createElement("div"))}g.appendTo(f.elements.header)}else{if(g.is('[data-rsts-type="footer"]')){if(!f.elements.footer){f.elements.footer=d(a.createElement("div"))}g.appendTo(f.elements.footer)}else{f.slides.push(new b.Slide(this,f))}}});this.elements.main.empty();if(this.slides.length===0){throw new Error("No slides found")}};e.prototype.preloadSlides=function(k,l){var p=this;var q=this.getViewSizeFixed();q[this.options.direction]=this.slideSize;if(this.getVisibleRowsCount()>1){q[this.options.direction==="x"?"y":"x"]=this.rowSize}var o=this.getVisibleCount();var f=0;if(this.options.loop){f=Math.min(Math.floor((this.slides.length-o)/2),this.options.preloadSlides*this.getVisibleRowsCount())}else{f=this.options.preloadSlides*this.getVisibleRowsCount()}var n=this.getActiveSlides(k);var j=0;var h,m;for(var g=k-f;g<=k+f+o-1;g++){m=this.getSlideIndex(g);h=this.slides[m];if(!this.options.loop&&(g<0||g>=this.slides.length)){continue}if(!h.isInitialized()){h.init();j++}if(p.options.type!=="slide"&&g!==k){continue}if(p.options.type==="slide"){if(l!==undefined&&d.inArray(m,n)===-1&&(g<0||g>=this.slides.length)&&h.isInjected()){this.preloadOnCleanup=true;continue}p.modify(h.element,{offset:p.getSlideOffset(g),rowOffset:p.getRowOffset(g)})}if(!h.isInjected()){if(p.options.type==="fade"){p.modify(h.element,{opacity:0})}p.elements.slides.append(h.element);h.size(q.x,q.y)}else{if(p.options.type!=="slide"&&g===p.slideIndex&&h.element.next().length){if(p.options.type==="fade"){if(h.element.next().length===1){p.modify(h.element,{opacity:1-h.element.next().css("opacity")});p.modify(h.element.next(),{opacity:1})}else{p.modify(h.element,{opacity:0})}}p.elements.slides.append(h.element)}}}if(this.normalizeSize&&j){this.resize()}};e.prototype.getActiveSlides=function(j){j=j!==undefined?j:this.slideIndex;var h=[];var g=this.getVisibleCount();for(var f=j;f<=j+g-1;f++){h.push(this.getSlideIndex(f))}return h};e.prototype.cleanupSlides=function(){clearTimeout(this.cleanupSlidesTimeout);var o=this;var n=this.getVisibleCount();var g=this.options.type==="slide"?this.options.preloadSlides*this.getVisibleRowsCount():0;var k=[];var m=[];var h=[];var f=[];for(var j=this.slideIndex-g;j<=this.slideIndex+g+n-1;j++){k.push(this.getSlideIndex(j))}for(j=this.slideIndex;j<=this.slideIndex+n-1;j++){m.push(this.getSlideIndex(j))}d.each(this.slides,function(q,p){d.merge(h,p.data.sliderClasses);if(p.isInjected()&&d.inArray(q,k)===-1){if(o.options.type==="fade"&&o.slides[o.slideIndex].element.css("opacity")<1){return}if(o.options.type==="side-slide"){var r=o.options.direction==="x"?"left":"top";if(o.slides[o.slideIndex].element.position()[r]!==0){return}}p.element.detach()}if(d.inArray(q,m)===-1&&p.state!=="inactive"){p.setState("inactive")}});this.nav.setActive(m);d.each(m,function(p,q){o.slides[q].setState("active");d.merge(f,o.slides[q].data.sliderClasses)});this.elements.main.removeClass(d.grep(h,function(i){return d.inArray(i,f)===-1}).join(" "));this.elements.main.addClass(f.join(" "));if(this.options.deepLinkPrefix&&this.getIndexFromUrl()!==this.slideIndex){if(this.slideIndex){c.location.hash="#"+this.options.deepLinkPrefix+(this.slideIndex+1)}else{if(c.history&&c.history.pushState){c.history.pushState("",a.title,c.location.pathname+c.location.search)}else{var l={x:d(c).scrollLeft(),y:d(c).scrollTop()};c.location.hash="";d(c).scrollLeft(l.x);d(c).scrollTop(l.y)}}}if(this.preloadOnCleanup){this.preloadOnCleanup=false;this.preloadSlides(this.slideIndex)}if(this.windowSizeHasChanged()){this.resize()}this.elements.main.trigger({type:"rsts-slidestop",rstSlider:this})};e.prototype.getSlideOffset=function(f){var g=this.getViewSizeFixed(true);var j=this.getVisibleSlidesCount();var h=this.getVisibleRowsCount();var k=this.getGapSize();var i=(this.slideSize+k)-(((g[this.options.direction]*this.visibleAreaRate)+k)/j);return Math.floor((f-this.slideIndex)/h)*(this.slideSize+k)-Math.round(i*Math.floor((f-this.slideIndex)/h))+this.activeSlideOffset};e.prototype.getRowOffset=function(l){var n=this.getViewSizeFixed(true);var k=this.getVisibleRowsCount();var o=((((l-this.slideIndex)%k)+k)%k);var h=0;var m=this.options.direction==="x"?"y":"x";var f=this.getGapSize();if(this.autoSize){var p={};p[this.options.direction]=this.slideSize;for(var j=l-o;jthis.options.slideMaxSize)){g=Math.ceil((f+h)/(this.options.slideMaxSize+h))}return Math.min(this.slides.length,Math.max(1,g))};e.prototype.getVisibleRowsCount=function(){if(!this.options.rowMaxCount&&!this.options.rowMinSize&&!this.options.rowSlideRatio){return 1}var f=this.getViewSizeFixed(true)[this.options.direction==="x"?"y":"x"];var i=this.getGapSize();var h=this.getVisibleSlidesCount();var g=0;if(this.options.rowSlideRatio){g=Math.floor(h*this.options.rowSlideRatio)}if(this.options.rowMaxCount&&(!g||g>this.options.rowMaxCount)){g=this.options.rowMaxCount}if(f&&!this.normalizeSize&&this.options.rowMinSize&&(!g||(f-(i*(g-1)))/gthis.options.visibleAreaMax){this.visibleAreaRate=this.options.visibleAreaMax/(this.options.direction==="x"?f:k)}if(this.options.slideMaxSize&&(this.options.direction==="x"?f:k)*this.visibleAreaRate>this.slides.length*(this.options.slideMaxSize+j)-j){this.visibleAreaRate=(this.slides.length*(this.options.slideMaxSize+j)-j)/(this.options.direction==="x"?f:k)}var h=this.getVisibleSlidesCount();var i=this.getVisibleRowsCount();if(!this.options.width&&this.proportion){f=this.viewSizeFixedCache.x=Math.round((((((((k+j)/i)-j)*this.proportion)+j)*h)-j)/this.visibleAreaRate)}if(!this.options.height&&this.proportion){k=this.viewSizeFixedCache.y=Math.round(((Math.round(((((f*this.visibleAreaRate)+j)/h)-j)/this.proportion)+j)*i)-j)}if(this.normalizeSize&&this.normalizedSize){if(this.options.direction==="x"){k=this.viewSizeFixedCache.y=((this.normalizedSize+j)*i)-j}else{f=this.viewSizeFixedCache.x=((this.normalizedSize+j)*i)-j}}this.slideSize=(j>0?Math.round:Math.ceil)((((this.options.direction==="x"?f:k)*this.visibleAreaRate)-(j*(h-1)))/h);if(this.options.direction==="x"?k:f){this.rowSize=(j>0?Math.round:Math.ceil)(((this.options.direction==="x"?k:f)-(j*(i-1)))/i)}else{this.rowSize=undefined}return d.extend({},this.viewSizeFixedCache)};e.prototype.getViewSize=function(j){j=j||0;var p=this.getViewSizeFixed();var q=p[this.options.direction];p[this.options.direction]=this.slideSize;if(!p.x||!p.y){var m=this.getVisibleSlidesCount();var l=this.getVisibleRowsCount();var f=this.getGapSize();var n=!p.x?"x":"y";var i=0;var g,o,h,k;for(g=0;g=this.slides.length){this.nav.hide();this.stopAutoplay(true)}else{this.nav.show();if(f>=this.slides.length){this.stopAutoplay()}}if(f!==this.getVisibleCount()){this.nav.combineItems();this.cleanupSlides()}this.checkVisibility();this.windowSizeHasChanged()};e.prototype.checkVisibility=function(){var g=!(a.hidden||a.webkitHidden);var h=false;var f=this.elements.main;var j=f.offset();var i=d(c);if(g&&j.lefti.scrollLeft()&&j.topi.scrollTop()){h=true}if(this.isVisible!==h){this.isVisible=h;if(h){this.playAutoplay()}else{this.pauseAutoplay()}}};e.prototype.getSlides=function(){return this.slides};e.prototype.getSlide=function(f){return this.slides[this.getSlideIndex(f)]};e.prototype.getSlideIndex=function(f){return((f%this.slides.length)+this.slides.length)%this.slides.length};e.prototype.setTouch=function(f){if(f!==this.isTouch){if(f){this.elements.main.addClass(this.options.cssPrefix+"touch").removeClass(this.options.cssPrefix+"no-touch")}else{this.elements.main.addClass(this.options.cssPrefix+"no-touch").removeClass(this.options.cssPrefix+"touch")}}if(f){this.lastTouchTime=new Date().getTime()}this.isTouch=f};e.prototype.setDragEvents=function(){var f=this;this.lastTouchTime=0;this.setTouch(false);var g={start:"mousedown",stop:"mouseup",move:"mousemove"};if(c.navigator.pointerEnabled&&c.navigator.maxTouchPoints){g={start:"pointerdown",stop:"pointerup",move:"pointermove"};this.elements.crop.css("touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("pointerdown",function(h){if(h.originalEvent.pointerType==="touch"){f.setTouch(true)}})}else{if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){g={start:"MSPointerDown",stop:"MSPointerUp",move:"MSPointerMove"};this.elements.crop.css("-ms-touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("MSPointerDown",function(h){if(h.originalEvent.pointerType===h.originalEvent.MSPOINTER_TYPE_TOUCH){f.setTouch(true)}})}else{if("ontouchstart" in c||"ontouchend" in a){g={start:g.start+" touchstart",stop:g.stop+" touchend touchcancel",move:g.move+" touchmove"};this.elements.main.on("touchstart",function(h){f.setTouch(true)})}}}this.elements.crop.on(g.start,function(h){return f.onDragStart(h)});d(a).on(g.stop+".rsts",function(h){return f.onDragStop(h)});d(a).on(g.move+".rsts",function(h){return f.onDragMove(h)});this.elements.crop.on("dragstart",function(h){if(f.isDragging){h.preventDefault()}});if(this.elements.crop[0].addEventListener){this.elements.crop[0].addEventListener("click",function(h){return f.onClickCapturing(d.event.fix(h))},true)}};e.prototype.onDragStart=function(f){if(this.isDragging||(f.type==="mousedown"&&f.which!==1)){return}this.dragLastDiff=0;this.touchAxis="";if(d(f.target).closest("."+this.options.cssPrefix+"no-drag",this.elements.slides).length){return}if(c.navigator.pointerEnabled&&c.navigator.maxTouchPoints){this.setTouch(f.originalEvent.pointerType==="touch")}else{if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){this.setTouch(f.originalEvent.pointerType===f.originalEvent.MSPOINTER_TYPE_TOUCH)}else{this.setTouch(f.type!=="mousedown"||new Date().getTime()-this.lastTouchTime<1000)}}var g=this.getPositionFromEvent(f);this.isDragging=true;this.isDraggingStarted=false;this.dragStartPos={x:g.x-this.elements.slides.offset().left+this.elements.crop.offset().left,y:g.y-this.elements.slides.offset().top+this.elements.crop.offset().top};this.dragLastPos=g[this.options.direction];this.rawStartPos=g;this.modify(this.elements.slides,{offset:g[this.options.direction]-this.dragStartPos[this.options.direction]});this.onDragMove(f)};e.prototype.onDragStop=function(f){if(!this.isDragging){return}this.isDragging=false;this.isDraggingStarted=false;this.elements.main.removeClass(this.options.cssPrefix+"dragging");if(this.dragLastDiff===0||this.dragLastDiff===undefined){return}var g=this.slideIndex+(Math.floor((-Math.round(this.getOffset(this.elements.slides))-this.activeSlideOffset+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))/(this.slideSize+this.getGapSize()))*this.getVisibleRowsCount());if(this.dragLastDiff<=0){this.goTo(g,true)}else{this.goTo(g+this.getVisibleRowsCount(),true)}};e.prototype.onDragMove=function(j){if(!this.isDragging||(this.isTouch&&j.type==="mousemove")){return}if(j.originalEvent.touches&&j.originalEvent.touches[1]){return this.onDragStop()}var k=this.getPositionFromEvent(j);var g;if(!this.touchAxis){g=Math.abs(k.x-this.rawStartPos.x)-Math.abs(k.y-this.rawStartPos.y);if(g>(this.isTouch?4:2)){this.touchAxis="x"}else{if(g<-(this.isTouch?4:2)){this.touchAxis="y"}}}if(this.touchAxis===this.options.direction){j.preventDefault();this.stopAutoplay()}else{if(!this.touchAxis){return}else{return this.onDragStop()}}if(!this.isDraggingStarted){this.isDraggingStarted=true;this.elements.main.addClass(this.options.cssPrefix+"dragging");(function(){var l=(c.getSelection&&c.getSelection())||a.selection||{};(l.empty||l.removeAllRanges||function(){}).apply(l)})()}var f=this.dragLastPos-k[this.options.direction];var i=k[this.options.direction]-this.dragStartPos[this.options.direction];var h=this.getVisibleCount();if(!this.options.loop){if(i>-this.getSlideOffset(0)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(0)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}if(i<-this.getSlideOffset(this.slides.length-h)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(this.slides.length-h)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}}this.modify(this.elements.slides,{offset:i});if(f<0||f>0){this.dragLastDiff=f}this.dragLastPos=k[this.options.direction]};e.prototype.onClickCapturing=function(f){if(this.dragLastDiff!==0&&typeof this.dragLastDiff!=="undefined"){f.stopPropagation();f.preventDefault()}};e.prototype.getPositionFromEvent=function(f){var g={x:f.pageX,y:f.pageY};if(typeof g.x!=="number"){g={x:f.originalEvent.pageX,y:f.originalEvent.pageY}}if(f.originalEvent.touches&&f.originalEvent.touches[0]){g={x:f.originalEvent.touches[0].pageX,y:f.originalEvent.touches[0].pageY}}return g};return e})();b.SliderNav=(function(){function e(h){var g=this;this.slider=h;this.elements={};if(h.options.controls){this.elements.prev=d(a.createElement("a")).attr("href","").text("prev").addClass(h.options.cssPrefix+"prev").on("click",function(i){i.preventDefault();g.slider.prev()});this.elements.next=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).addClass(h.options.cssPrefix+"next");h.elements.view.append(this.elements.prev).append(this.elements.next)}if(h.options.navType!=="none"){this.elements.main=d(a.createElement("div")).addClass(h.options.cssPrefix+"nav "+h.options.cssPrefix+"nav-"+h.options.navType);if(h.options.navType==="thumbs"){this.elements.thumbs=d(a.createElement("div"));d.each(this.slider.getSlides(),function(k,j){g.createThumb(k,j).appendTo(g.elements.thumbs)});this.elements.main.append(this.elements.thumbs);h.elements.main.append(this.elements.main);this.thumbsSlider=new b.Slider(this.elements.thumbs,d.extend({visibleArea:h.options.visibleArea,visibleAreaMax:h.options.visibleAreaMax,loop:h.options.loop,duration:h.options.duration,controls:h.options.controls},h.options.thumbs||{}));this.setActive([0])}else{this.elements.mainPrev=d(a.createElement("a")).attr("href","").text("prev").on("click",function(i){i.preventDefault();g.slider.prev()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-prev"));this.elements.mainNext=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-next"));var f=a.createElement("ul");d.each(this.slider.getSlides(),function(k,j){g.elements[k]=g.createNavItem(k,j.getData()).appendTo(f)});this.elements.mainPrev.parent().prependTo(f);this.elements.mainNext.parent().appendTo(f);this.elements.main.append(f);h.elements.main.append(this.elements.main)}}}e.prototype.setActive=function(g){var f=this;var j=this.slider.getSlides();if(this.slider.options.navType==="thumbs"){var h=this.thumbsSlider.getVisibleCount();var i=this.thumbsSlider.getVisibleRowsCount();var k=g[Math.floor((g.length-1)/2)]-Math.floor((h-1)/2);if(!this.thumbsSlider.options.loop){k=Math.min(this.thumbsSlider.slides.length-h,Math.max(0,k))}else{k=this.thumbsSlider.getSlideIndex(k);k=this.getNearestIndex(k,this.thumbsSlider.slideIndex,this.thumbsSlider.getSlides().length)}k-=((((k+Math.floor(i/2)-this.thumbsSlider.slideIndex)%i)+i)%i)-Math.floor(i/2);d.each(this.activeIndexes||[],function(n,m){f.thumbsSlider.getSlide(m).element.removeClass(f.thumbsSlider.options.cssPrefix+"active-thumb")});d.each(g,function(n,m){f.thumbsSlider.getSlide(m).element.addClass(f.thumbsSlider.options.cssPrefix+"active-thumb")});this.thumbsSlider.resize();this.thumbsSlider.goTo(k)}if(this.activeIndexes){d.each(this.activeIndexes,function(n,m){if(!f.elements[m]){return}f.elements[m].children("a").removeClass("active")})}if(this.elements[j.length]&&d.inArray(j.length-1,g)!==-1){g=[j.length]}this.activeIndexes=g;var l=false;d.each(this.activeIndexes,function(n,m){if(!f.elements[m]){return}if(f.elements[m][0].style.display!=="none"){l=true}f.elements[m].children("a").addClass("active")});if(!l&&this.elements[j.length]){d.each(this.activeIndexes,function(n,m){if(!f.elements[m]){return}f.elements[m].children("a").removeClass("active")});this.activeIndexes=[j.length];this.elements[j.length].children("a").addClass("active")}};e.prototype.getNearestIndex=function(h,f,g){if(Math.abs(h-f)>Math.abs(h-g-f)){h-=g}else{if(Math.abs(h-f)>Math.abs(h+g-f)){h+=g}}return h};e.prototype.combineItems=function(){if(!this.elements[0]){return}var h=this.slider.getVisibleCount();var j=this.slider.getSlides();if(this.elements[j.length]){this.elements[j.length].remove();delete this.elements[j.length]}d.each(this.elements,function(){this.css("display","")});if(h<2||!this.slider.options.combineNavItems){return}var k;for(var g=0;this.elements[g];g++){if((g-Math.floor((h-1)/2))%h||(g-Math.floor((h-1)/2))>j.length-h){this.elements[g].css("display","none")}else{k=g}}if(j.length%h===0){this.elements[j.length-h+Math.floor((h-1)/2)].css("display","")}else{var f=j.length-(j.length%h||h)+Math.floor((h-1)/2);this.elements[j.length]=this.createNavItem(f,j[f>=j.length?j.length-1:f].getData()).insertAfter(this.elements[j.length-1])}};e.prototype.show=function(){d([]).add(this.elements.prev).add(this.elements.next).add(this.elements.main).css("display","")};e.prototype.hide=function(){d([]).add(this.elements.prev).add(this.elements.next).add(this.elements.main).css("display","none")};e.prototype.createNavItem=function(g,h){var f=this;return d(a.createElement("li")).addClass(f.slider.options.cssPrefix+"nav-item").append(d(a.createElement("a")).attr("href","").text((f.slider.options.navType!=="numbers"&&h.name)?h.name:(h.index+1)).on("click",function(i){i.preventDefault();f.itemOnClick(g)}))};e.prototype.createThumb=function(h,f){var g=this;return d(a.createElement("a")).attr("href","").attr("data-rsts-type","image").append(d(a.createElement("img")).attr("src",f.getThumbUrl()).attr("alt",f.getData().name)).on("click",function(i){i.preventDefault();g.itemOnClick(h)})};e.prototype.itemOnClick=function(f){var g=this.slider.getVisibleCount();var h=this.slider.getVisibleRowsCount();var i=f-Math.floor((g-1)/2);if(!this.slider.options.loop){i=Math.min(this.slider.slides.length-g,Math.max(0,i))}else{i=this.getNearestIndex(this.slider.getSlideIndex(i),this.slider.slideIndex,this.slider.getSlides().length)}i-=((((i+Math.floor(h/2)-this.slider.slideIndex)%h)+h)%h)-Math.floor(h/2);this.slider.goTo(i)};e.prototype.resize=function(){if(this.thumbsSlider){this.thumbsSlider.resize()}};e.prototype.getSize=function(){if(!this.elements.main||this.elements.main.css("position")==="absolute"){return{x:0,y:0}}return{x:this.elements.main.outerWidth(true),y:this.elements.main.outerHeight(true)}};return e})();d.fn.rstSlider=function(f){var e=arguments;return this.each(function(){var h=d(this);if(typeof f==="string"){var g=h.data("rstSlider");if(g&&g[f]){return g[f].apply(g,Array.prototype.slice.call(e,1))}}else{if(!h.data("rstSlider")){h.data("rstSlider",new b.Slider(h,f))}}})}})(jQuery,window,document); /*! * jQuery UI Effects 1.10.1 * http://jqueryui.com