/* * jquery flexslider v2.1 * copyright 2012 woothemes * contributing author: tyler smith */ ; (function(d){d.flexslider=function(i,k){var a=d(i),c=d.extend({},d.flexslider.defaults,k),e=c.namespace,r="ontouchstart"in window||window.documenttouch&&document instanceof documenttouch,s=r?"touchend":"click",l="vertical"===c.direction,m=c.reverse,h=0');if(1':""+b+"",a.controlnavscaffold.append("
  • "+g+"
  • "),b++;a.controlscontainer?d(a.controlscontainer).append(a.controlnavscaffold):a.append(a.controlnavscaffold);f.controlnav.set();f.controlnav.active();a.controlnavscaffold.delegate("a, img",s,function(b){b.preventdefault();var b=d(this),g=a.controlnav.index(b);b.hasclass(e+"active")||(a.direction=g>a.currentslide?"next":"prev",a.flexanimate(g,c.pauseonaction))});r&&a.controlnavscaffold.delegate("a", "click touchstart",function(a){a.preventdefault()})},setupmanual:function(){a.controlnav=a.manualcontrols;f.controlnav.active();a.controlnav.live(s,function(b){b.preventdefault();var b=d(this),g=a.controlnav.index(b);b.hasclass(e+"active")||(g>a.currentslide?a.direction="next":a.direction="prev",a.flexanimate(g,c.pauseonaction))});r&&a.controlnav.live("click touchstart",function(a){a.preventdefault()})},set:function(){a.controlnav=d("."+e+"control-nav li "+("thumbnails"===c.controlnav?"img":"a"), a.controlscontainer?a.controlscontainer:a)},active:function(){a.controlnav.removeclass(e+"active").eq(a.animatingto).addclass(e+"active")},update:function(b,c){1"+a.count+"")):1===a.pagingcount?a.controlnavscaffold.find("li").remove():a.controlnav.eq(c).closest("li").remove();f.controlnav.set();1
  • '+c.prevtext+'
  • '+c.nexttext+"
  • ");a.controlscontainer?(d(a.controlscontainer).append(b),a.directionnav=d("."+e+"direction-nav li a",a.controlscontainer)):(a.append(b),a.directionnav=d("."+e+"direction-nav li a",a));f.directionnav.update();a.directionnav.bind(s,function(b){b.preventdefault();b=d(this).hasclass(e+"next")?a.gettarget("next"):a.gettarget("prev");a.flexanimate(b,c.pauseonaction)}); r&&a.directionnav.bind("click touchstart",function(a){a.preventdefault()})},update:function(){var b=e+"disabled";1===a.pagingcount?a.directionnav.addclass(b):c.animationloop?a.directionnav.removeclass(b):0===a.animatingto?a.directionnav.removeclass(b).filter("."+e+"prev").addclass(b):a.animatingto===a.last?a.directionnav.removeclass(b).filter("."+e+"next").addclass(b):a.directionnav.removeclass(b)}},pauseplay:{setup:function(){var b=d('
    ');a.controlscontainer? (a.controlscontainer.append(b),a.pauseplay=d("."+e+"pauseplay a",a.controlscontainer)):(a.append(b),a.pauseplay=d("."+e+"pauseplay a",a));f.pauseplay.update(c.slideshow?e+"pause":e+"play");a.pauseplay.bind(s,function(b){b.preventdefault();if(d(this).hasclass(e+"pause")){a.manualpause=true;a.manualplay=false;a.pause()}else{a.manualpause=false;a.manualplay=true;a.play()}});r&&a.pauseplay.bind("click touchstart",function(a){a.preventdefault()})},update:function(b){"play"===b?a.pauseplay.removeclass(e+ "pause").addclass(e+"play").text(c.playtext):a.pauseplay.removeclass(e+"play").addclass(e+"pause").text(c.pausetext)}},touch:function(){function b(b){j=l?d-b.touches[0].pagey:d-b.touches[0].pagex;p=l?math.abs(j)j||a.currentslide===a.last&&0number(new date)-k&&50o/2)?a.flexanimate(l,c.pauseonaction):a.flexanimate(a.currentslide,c.pauseonaction,!0)}i.removeeventlistener("touchmove",b,!1);i.removeeventlistener("touchend",g,!1);f=j=e=d=null}var d,e,f,o,j,k,p=!1;i.addeventlistener("touchstart",function(j){a.animating?j.preventdefault():1===j.touches.length&&(a.pause(),o=l?a.h:a.w,k=number(new date),f=h&& m&&a.animatingto===a.last?0:h&&m?a.limit-(a.itemw+c.itemmargin)*a.move*a.animatingto:h&&a.currentslide===a.last?a.limit:h?(a.itemw+c.itemmargin)*a.move*a.currentslide:m?(a.last-a.currentslide+a.cloneoffset)*o:(a.currentslide+a.cloneoffset)*o,d=l?j.touches[0].pagey:j.touches[0].pagex,e=l?j.touches[0].pagex:j.touches[0].pagey,i.addeventlistener("touchmove",b,!1),i.addeventlistener("touchend",g,!1))},!1)},resize:function(){!a.animating&&a.is(":visible")&&(h||a.domath(),q?f.smoothheight():h?(a.slides.width(a.computedw), a.update(a.pagingcount),a.setprops()):l?(a.viewport.height(a.h),a.setprops(a.h,"settotal")):(c.smoothheight&&f.smoothheight(),a.newslides.width(a.computedw),a.setprops(a.computedw,"settotal")))},smoothheight:function(b){if(!l||q){var c=q?a:a.viewport;b?c.animate({height:a.slides.eq(a.animatingto).height()},b):c.height(a.slides.eq(a.animatingto).height())}},sync:function(b){var g=d(c.sync).data("flexslider"),e=a.animatingto;switch(b){case "animate":g.flexanimate(e,c.pauseonaction,!1,!0);break;case "play":!g.playing&& !g.asnav&&g.play();break;case "pause":g.pause()}}};a.flexanimate=function(b,g,n,i,k){p&&1===a.pagingcount&&(a.direction=a.currentitema.w?2*c.itemmargin:c.itemmargin,b=(a.itemw+b)*a.move*a.animatingto,b=b>a.limit&&1!==a.visible?a.limit:b):b=0===a.currentslide&&b===a.count-1&&c.animationloop&&"next"!==a.direction?m?(a.count+a.cloneoffset)*o:0:a.currentslide===a.last&&0===b&&c.animationloop&&"prev"!==a.direction?m?0:(a.count+1)*o:m?(a.count-1-b+a.cloneoffset)*o:(b+a.cloneoffset)*o;a.setprops(b, "",c.animationspeed);if(a.transitions){if(!c.animationloop||!a.atend)a.animating=!1,a.currentslide=a.animatingto;a.container.unbind("webkittransitionend transitionend");a.container.bind("webkittransitionend transitionend",function(){a.wrapup(o)})}else a.container.animate(a.args,c.animationspeed,c.easing,function(){a.wrapup(o)})}c.smoothheight&&f.smoothheight(c.animationspeed)}};a.wrapup=function(b){!q&&!h&&(0===a.currentslide&&a.animatingto===a.last&&c.animationloop?a.setprops(b,"jumpend"):a.currentslide=== a.last&&(0===a.animatingto&&c.animationloop)&&a.setprops(b,"jumpstart"));a.animating=!1;a.currentslide=a.animatingto;c.after(a)};a.animateslides=function(){a.animating||a.flexanimate(a.gettarget("next"))};a.pause=function(){clearinterval(a.animatedslides);a.playing=!1;c.pauseplay&&f.pauseplay.update("play");a.syncexists&&f.sync("pause")};a.play=function(){a.animatedslides=setinterval(a.animateslides,c.slideshowspeed);a.playing=!0;c.pauseplay&&f.pauseplay.update("pause");a.syncexists&&f.sync("play")}; a.canadvance=function(b,g){var d=p?a.pagingcount-1:a.last;return g?!0:p&&a.currentitem===a.count-1&&0===b&&"prev"===a.direction?!0:p&&0===a.currentitem&&b===a.pagingcount-1&&"next"!==a.direction?!1:b===a.currentslide&&!p?!1:c.animationloop?!0:a.atend&&0===a.currentslide&&b===d&&"next"!==a.direction?!1:a.atend&&a.currentslide===d&&0===b&&"next"===a.direction?!1:!0};a.gettarget=function(b){a.direction=b;return"next"===b?a.currentslide===a.last?0:a.currentslide+1:0===a.currentslide?a.last:a.currentslide- 1};a.setprops=function(b,g,d){var e,f=b?b:(a.itemw+c.itemmargin)*a.move*a.animatingto;e=-1*function(){if(h)return"settouch"===g?b:m&&a.animatingto===a.last?0:m?a.limit-(a.itemw+c.itemmargin)*a.move*a.animatingto:a.animatingto===a.last?a.limit:f;switch(g){case "settotal":return m?(a.count-1-a.currentslide+a.cloneoffset)*b:(a.currentslide+a.cloneoffset)*b;case "settouch":return b;case "jumpend":return m?b:a.count*b;case "jumpstart":return m?a.count*b:b;default:return b}}()+"px";a.transitions&&(e=l? "translate3d(0,"+e+",0)":"translate3d("+e+",0,0)",d=void 0!==d?d/1e3+"s":"0s",a.container.css("-"+a.pfx+"-transition-duration",d));a.args[a.prop]=e;(a.transitions||void 0===d)&&a.container.css(a.args)};a.setup=function(b){if(q)a.slides.css({width:"100%","float":"left",marginright:"-100%",position:"relative"}),"init"===b&&a.slides.eq(a.currentslide).fadein(c.animationspeed,c.easing),c.smoothheight&&f.smoothheight();else{var g,n;"init"===b&&(a.viewport=d('
    ').css({overflow:"hidden", position:"relative"}).appendto(a).append(a.container),a.clonecount=0,a.cloneoffset=0,m&&(n=d.makearray(a.slides).reverse(),a.slides=d(n),a.container.empty().append(a.slides)));c.animationloop&&!h&&(a.clonecount=2,a.cloneoffset=1,"init"!==b&&a.container.find(".clone").remove(),a.container.append(a.slides.first().clone().addclass("clone")).prepend(a.slides.last().clone().addclass("clone")));a.newslides=d(c.selector,a);g=m?a.count-1-a.currentslide+a.cloneoffset:a.currentslide+a.cloneoffset;l&&!h?(a.container.height(200* (a.count+a.clonecount)+"%").css("position","absolute").width("100%"),settimeout(function(){a.newslides.css({display:"block"});a.domath();a.viewport.height(a.h);a.setprops(g*a.h,"init")},"init"===b?100:0)):(a.container.width(200*(a.count+a.clonecount)+"%"),a.setprops(g*a.computedw,"init"),settimeout(function(){a.domath();a.newslides.css({width:a.computedw,"float":"left",display:"block"});c.smoothheight&&f.smoothheight()},"init"===b?100:0))}h||a.slides.removeclass(e+"active-slide").eq(a.currentslide).addclass(e+ "active-slide")};a.domath=function(){var b=a.slides.first(),d=c.itemmargin,e=c.minitems,f=c.maxitems;a.w=a.width();a.h=b.height();a.boxpadding=b.outerwidth()-b.width();h?(a.itemt=c.itemwidth+d,a.minw=e?e*a.itemt:a.w,a.maxw=f?f*a.itemt:a.w,a.itemw=a.minw>a.w?(a.w-d*e)/e:a.maxwa.w?a.w:c.itemwidth,a.visible=math.floor(a.w/(a.itemw+d)),a.move=0a.w?(a.itemw+2*d)*a.count-a.w-d:(a.itemw+d)*a.count-a.w-d):(a.itemw=a.w,a.pagingcount=a.count,a.last=a.count-1);a.computedw=a.itemw-a.boxpadding};a.update=function(b,d){a.domath();h||(ba.controlnav.length)f.controlnav.update("add");else if("remove"===d&&!h||a.pagingcount a.last&&(a.currentslide-=1,a.animatingto-=1),f.controlnav.update("remove",a.last);c.directionnav&&f.directionnav.update()};a.addslide=function(b,e){var f=d(b);a.count+=1;a.last=a.count-1;l&&m?void 0!==e?a.slides.eq(a.count-e).after(f):a.container.prepend(f):void 0!==e?a.slides.eq(e).before(f):a.container.append(f);a.update(e,"add");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.added(a)};a.removeslide=function(b){var e=isnan(b)?a.slides.index(d(b)):b;a.count-=1;a.last=a.count-1;isnan(b)?d(b, a.slides).remove():l&&m?a.slides.eq(a.last).remove():a.slides.eq(b).remove();a.domath();a.update(e,"remove");a.slides=d(c.selector+":not(.clone)",a);a.setup();c.removed(a)};f.init()};d.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationloop:!0,smoothheight:!1,startat:0,slideshow:!0,slideshowspeed:7e3,animationspeed:600,initdelay:0,randomize:!1,pauseonaction:!0,pauseonhover:!1,usecss:!0,touch:!0,video:!1,controlnav:!0, directionnav:!0,prevtext:"previous",nexttext:"next",keyboard:!0,multiplekeyboard:!1,mousewheel:!1,pauseplay:!1,pausetext:"pause",playtext:"play",controlscontainer:"",manualcontrols:"",sync:"",asnavfor:"",itemwidth:0,itemmargin:0,minitems:0,maxitems:0,move:0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};d.fn.flexslider=function(i){void 0===i&&(i={});if("object"===typeof i)return this.each(function(){var a=d(this),c=a.find(i.selector? i.selector:".slides > li");1===c.length?(c.fadein(400),i.start&&i.start(a)):void 0===a.data("flexslider")&&new d.flexslider(this,i)});var k=d(this).data("flexslider");switch(i){case "play":k.play();break;case "pause":k.pause();break;case "next":k.flexanimate(k.gettarget("next"),!0);break;case "prev":case "previous":k.flexanimate(k.gettarget("prev"),!0);break;default:"number"===typeof i&&k.flexanimate(i,!0)}}})(jquery);