!function(t){function i(i,e){function l(i,e){var l="number"==typeof i?i:t(this).index(),s=l?"transform: translate3d(-"+l*h.slideWidth+"px, 0, 0); ":"",n="width: "+h.slideCount*h.slideWidth+"px";h.index=l,h.$slider.attr("style",s+n),"number"!=typeof i&&h.autoMode&&clearInterval(h.autoMode),h.$slideTitles.find("li").attr("class",""),e?0===l?(h.$slideTitles.find("li:eq("+(h.slideCount-1)+")").attr("class","title--auto title--right"),h.$slideTitles.find("li:eq("+l+")").attr("class","title--active title--auto")):(h.$slideTitles.find("li:eq("+(l-1)+")").attr("class",e?"title--right title--auto":"title--right"),h.$slideTitles.find("li:eq("+l+")").attr("class",e?"title--active title--auto":"title--active")):h.$slideTitles.find("li:eq("+l+")").attr("class","title--active"),h.$el.offset().height}function s(){var t=0;h.autoMode=setInterval(function(){t=t===h.slideCount-1?0:t+1,l(t,!0)},h.options.timing),h.$slideTitles.children().first().attr("class","title--active title--auto")}function n(){h.$slideTitles.children().first().attr("class","title--active")}function d(){h.$slideTitles.children().bind("click",l),h.$slides.find("img").bind("dragstart",function(t){t.preventDefault()}),t(window).bind("resize orientationchange",u)}function a(){function t(t){h.autoMode&&clearInterval(h.autoMode);var l="mousedown"===t.type?t.originalEvent:t.originalEvent.touches[0];n=l.pageX,h.$slider.bind("touchmove",i).bind("mousemove",i).bind("mouseleave",e).bind("mouseup",e).bind("touchend",e).bind("touchcancel",e).removeClass("slides--anim"),h.$slideTitles.children().removeClass("title--auto")}function i(t){var i="touchmove"===t.type?t.originalEvent.touches[0]:t.originalEvent,e=i.pageX;d=Math.round(e-n),s=0>d?"<":">";var l=h.index*-h.slideWidth+d;">"===s&&0===h.index||"<"===s&&h.index===h.slideCount-1||h.$slider.attr("style","width: "+h.slideWidth*h.slideCount+"px; transform: translate3d("+l+"px, 0, 0)")}function e(t){var a="<"===s?h.index+1:h.index-1,o="touchend"===t.type||"touchcancel"===t.type?t.originalEvent.changedTouches[0]:t.originalEvent,r=o.pageX,u=h.index*h.slideWidth;return d=Math.round(r-n),h.$slider.unbind("touchmove",i).unbind("mousemove",i).unbind("mouseleave",e).unbind("mouseup",e).unbind("touchend",e).unbind("touchcancel",e).addClass("slides--anim"),">"===s&&0===h.index||"<"===s&&h.index===h.slideCount-1?void 0:d>140||-140>d?void l(a):void h.$slider.attr("style","width: "+h.slideWidth*h.slideCount+"px; transform: translate3d(-"+u+"px, 0, 0)")}var s,n,d=0;h.$slider.bind("touchstart",t),h.$slider.bind("mousedown",t)}function o(){h.$el.addClass("jFlex"),h.$slider=h.$el.children(),h.$slides=h.$slider.children(),h.slideCount=h.$slides.length,h.slideWidth=h.$el.width(),h.$slides.width(h.slideWidth+"px"),h.$el.children().width(h.slideCount*h.slideWidth+"px"),h.$slideTitles=t('
')}function r(){h.$slider.addClass("slides--anim")}function u(){var t=h.index?"transform: translate3d(-"+h.index*h.slideWidth+"px, 0, 0); ":"";h.slideWidth=h.$el.width(),h.$slider.attr("style",t+"width: "+h.slideCount*h.slideWidth+"px"),h.$slides.width(h.slideWidth+"px")}var h=this;h.autoMode=null,h.el=i,h.$el=t(i),h.index=0,h.defaultOptions={autoplay:!1,fx:"slide",timing:2e3,titles:"top"},h.options=t.extend({},h.defaultOptions,e),h.init=function(){return o(),h.slideCount<2?void console.error("Your HTML must contain at least two slides to flex."):(d(),"string"==typeof h.options.fx&&"slide"===h.options.fx&&(r(),a()),void(h.options.autoplay?s():n()))},h.init()}t.fn.jFlex=function(t){return this.each(function(){new i(this,t)})}}(jQuery);