/**
* jquery.slitslider.js v1.1.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2012, Codrops
* http://www.codrops.com
*/
/*
* debouncedresize: special jQuery event that happens once after a window resize
*
* latest version and complete README available on Github:
* https://github.com/louisremi/jquery-smartresize/blob/master/jquery.debouncedresize.js
*
* Copyright 2011 @louis_remi
* Licensed under the MIT license.
*/
(function(e,t,n){var r=e.event,i,s;i=r.special.debouncedresize={setup:function(){e(this).on("resize",i.handler)},teardown:function(){e(this).off("resize",i.handler)},handler:function(e,t){var n=this,o=arguments,u=function(){e.type="debouncedresize",r.dispatch.apply(n,o)};s&&clearTimeout(s),t?u():s=setTimeout(u,i.threshold)},threshold:20};var o=e(t),u=e(document),a=t.Modernizr;e.Slitslider=function(t,n){this.$elWrapper=e(n),this._init(t)},e.Slitslider.defaults={speed:800,optOpacity:!1,translateFactor:230,maxAngle:25,maxScale:2,autoplay:!1,keyboard:!0,interval:4e3,onBeforeChange:function(e,t){return!1},onAfterChange:function(e,t){return!1}},e.Slitslider.prototype={_init:function(t){this.options=e.extend(!0,{},e.Slitslider.defaults,t),this.transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},this.transEndEventName=this.transEndEventNames[a.prefixed("transition")],this.support=a.csstransitions&&a.csstransforms3d,this.$el=this.$elWrapper.children(".sl-slider"),this.$slides=this.$el.children(".sl-slide").hide(),this.slidesCount=this.$slides.length,this.current=0,this.isAnimating=!1,this._getSize(),this._layout(),this._loadEvents(),this.options.autoplay&&this._startSlideshow()},_getSize:function(){this.size={width:this.$elWrapper.outerWidth(!0),height:this.$elWrapper.outerHeight(!0)}},_layout:function(){this.$slideWrapper=e('
'),this.$slides.wrapAll(this.$slideWrapper).each(function(t){var n=e(this),r=n.data("orientation");n.addClass("sl-slide-"+r).children().wrapAll('').wrapAll('')}),this._setSize(),this.$slides.eq(this.current).show()},_navigate:function(t,r){if(this.isAnimating||this.slidesCount<2)return!1;this.isAnimating=!0;var i=this,s=this.$slides.eq(this.current);r!==n?this.current=r:t==="next"?this.current=this.current0?--this.current:this.slidesCount-1),this.options.onBeforeChange(s,this.current);var o=this.$slides.eq(this.current),u=t==="next"?s:o,a=u.data(),f={};f.orientation=a.orientation||"horizontal",f.slice1angle=a.slice1Rotation||0,f.slice1scale=a.slice1Scale||1,f.slice2angle=a.slice2Rotation||0,f.slice2scale=a.slice2Scale||1,this._validateValues(f);var l=f.orientation==="horizontal"?{marginTop:-this.size.height/2}:{marginLeft:-this.size.width/2},c={transform:"translate(0%,0%) rotate(0deg) scale(1)",opacity:1},h=f.orientation==="horizontal"?{transform:"translateY(-"+this.options.translateFactor+"%) rotate("+f.slice1angle+"deg) scale("+f.slice1scale+")"}:{transform:"translateX(-"+this.options.translateFactor+"%) rotate("+f.slice1angle+"deg) scale("+f.slice1scale+")"},p=f.orientation==="horizontal"?{transform:"translateY("+this.options.translateFactor+"%) rotate("+f.slice2angle+"deg) scale("+f.slice2scale+")"}:{transform:"translateX("+this.options.translateFactor+"%) rotate("+f.slice2angle+"deg) scale("+f.slice2scale+")"};this.options.optOpacity&&(h.opacity=0,p.opacity=0),s.removeClass("sl-trans-elems");var d={transition:"all "+this.options.speed+"ms ease-in-out"};u.css("z-index",this.slidesCount).find("div.sl-content-wrapper").wrap(e('').css(d)).parent().cond(t==="prev",function(){var e=this;this.css(h),setTimeout(function(){e.css(c)},50)},function(){var e=this;setTimeout(function(){e.css(h)},50)}).clone().appendTo(u).cond(t==="prev",function(){var e=this;this.css(p),setTimeout(function(){s.addClass("sl-trans-back-elems"),i.support?e.css(c).on(i.transEndEventName,function(){i._onEndNavigate(e,s,t)}):i._onEndNavigate(e,s,t)},50)},function(){var e=this;setTimeout(function(){o.addClass("sl-trans-elems"),i.support?e.css(p).on(i.transEndEventName,function(){i._onEndNavigate(e,s,t)}):i._onEndNavigate(e,s,t)},50)}).find("div.sl-content-wrapper").css(l),o.show()},_validateValues:function(e){if(e.slice1angle>this.options.maxAngle||e.slice1angle<-this.options.maxAngle)e.slice1angle=this.options.maxAngle;if(e.slice2angle>this.options.maxAngle||e.slice2angle<-this.options.maxAngle)e.slice2angle=this.options.maxAngle;if(e.slice1scale>this.options.maxScale||e.slice1scale<=0)e.slice1scale=this.options.maxScale;if(e.slice2scale>this.options.maxScale||e.slice2scale<=0)e.slice2scale=this.options.maxScale;e.orientation!=="vertical"&&e.orientation!=="horizontal"&&(e.orientation="horizontal")},_onEndNavigate:function(e,t,n){var r=e.parent(),i="sl-trans-elems sl-trans-back-elems";e.remove(),r.css("z-index",1).find("div.sl-content-wrapper").unwrap(),t.hide().removeClass(i),r.removeClass(i),this.isAnimating=!1,this.options.onAfterChange(r,this.current)},_setSize:function(){var e={width:this.size.width,height:this.size.height};this.$el.css(e).find("div.sl-content-wrapper").css(e)},_loadEvents:function(){var e=this;o.on("debouncedresize.slitslider",function(t){e._getSize(),e._setSize()}),this.options.keyboard&&u.on("keydown.slitslider",function(t){var n=t.keyCode||t.which,r={left:37,up:38,right:39,down:40};switch(n){case r.left:e._stopSlideshow(),e._navigate("prev");break;case r.right:e._stopSlideshow(),e._navigate("next")}})},_startSlideshow:function(){var e=this;this.slideshow=setTimeout(function(){e._navigate("next"),e.options.autoplay&&e._startSlideshow()},this.options.interval)},_stopSlideshow:function(){this.options.autoplay&&(clearTimeout(this.slideshow),this.isPlaying=!1,this.options.autoplay=!1)},_destroy:function(t){this.$el.off(".slitslider").removeData("slitslider"),o.off(".slitslider"),u.off(".slitslider"),this.$slides.each(function(t){var n=e(this),r=n.find("div.sl-content").children();r.appendTo(n),n.children("div.sl-content-wrapper").remove()}),this.$slides.unwrap(this.$slideWrapper).hide(),this.$slides.eq(0).show(),t&&t.call()},add:function(t,n){this.$slides=this.$slides.add(t);var r=this;t.each(function(t){var n=e(this),i=n.data("orientation");n.hide().addClass("sl-slide-"+i).children().wrapAll('').wrapAll('').end().appendTo(r.$el.find("div.sl-slides-wrapper"))}),this._setSize(),this.slidesCount=this.$slides.length,n&&n.call($items)},next:function(){this._stopSlideshow(),this._navigate("next")},previous:function(){this._stopSlideshow(),this._navigate("prev")},jump:function(e){e-=1;if(e===this.current||e>=this.slidesCount||e<0)return!1;this._stopSlideshow(),this._navigate(e>this.current?"next":"prev",e)},play:function(){this.isPlaying||(this.isPlaying=!0,this._navigate("next"),this.options.autoplay=!0,this._startSlideshow())},pause:function(){this.isPlaying&&this._stopSlideshow()},isActive:function(){return this.isAnimating},destroy:function(e){this._destroy(e)}};var f=function(e){t.console&&t.console.error(e)};e.fn.slitslider=function(t){var n=e.data(this,"slitslider");if(typeof t=="string"){var r=Array.prototype.slice.call(arguments,1);this.each(function(){if(!n){f("cannot call methods on slitslider prior to initialization; attempted to call method '"+t+"'");return}if(!e.isFunction(n[t])||t.charAt(0)==="_"){f("no such method '"+t+"' for slitslider self");return}n[t].apply(n,r)})}else this.each(function(){n?n._init():n=e.data(this,"slitslider",new e.Slitslider(t,this))});return n}})(jQuery,window);