/*!
 * @copyright 2011-Present Advanced Care Solutions, Inc.
 * @author Christopher Rahauiser <crahauiser@acs-web.com>
 */
(function(a){a.fn.customizableSlideShow=function(b){var c=a.extend({},a.fn.customizableSlideShow.defaults,b);return this.each(function(){var e=a.meta?a.extend({},c,a(this).data()):c;var f=a(this).children();if(f.length<2){return}c.childrenSetup(f);var j=0,i,d=null,n=false,k;function l(){if(n){return}n=true;i=j+1;if(i==f.length){i=0}e.beforeNextAnimation(f.eq(i),f.eq(j));f.eq(i).animate(e.animateInNextProperties,e.animateInNextDuration,e.animateInNextEasing,e.animateInNextCallback).end().eq(j).animate(e.animateOutNextProperties,e.animateOutNextDuration,e.animateOutNextEasing,function(){e.animateOutNextCallback.call(this);n=false});j=i}function h(){if(n){return}n=true;i=j-1;if(i<0){i=f.length-1}e.beforePreviousAnimation(f.eq(i),f.eq(j));f.eq(i).animate(e.animateInPreviousProperties,e.animateInPreviousDuration,e.animateInPreviousEasing,e.animateInPreviousCallback).end().eq(j).animate(e.animateOutPreviousProperties,e.animateOutPreviousDuration,e.animateOutPreviousEasing,function(){e.animateOutPreviousCallback.call(this);n=false});j=i}function g(){if(k.length>0){k.addClass(e.pauseClass).removeClass(e.playClass)}d=setInterval(l,e.triggerDuration)}function m(){clearInterval(d);d=null}a(e.nextSelector).show().click(function(o){o.preventDefault();m();l();g()});a(e.previousSelector).show().click(function(o){o.preventDefault();m();h();g()});k=a(e.playPauseSelector).show().click(function(){if(k.hasClass(e.pauseClass)){m();k.addClass(e.playClass).removeClass(e.pauseClass)}else{g()}});g()})};a.fn.customizableSlideShow.defaults={triggerDuration:6000,beforeNextAnimation:function(b,c){},beforePreviousAnimation:function(b,c){},animateInNextEasing:"swing",animateInNextDuration:1200,animateInNextProperties:{opacity:"toggle"},animateInNextCallback:function(){a(this).css("z-index",2)},animateOutNextEasing:"swing",animateOutNextDuration:1200,animateOutNextProperties:{opacity:"toggle"},animateOutNextCallback:function(){a(this).css("z-index",1)},animateInPreviousEasing:"swing",animateInPreviousDuration:1200,animateInPreviousProperties:{opacity:"toggle"},animateInPreviousCallback:function(){a(this).css("z-index",2)},animateOutPreviousEasing:"swing",animateOutPreviousDuration:1200,animateOutPreviousProperties:{opacity:"toggle"},animateOutPeviousCallback:function(){a(this).css("z-index",1)},nextSelector:".customizable-slideshow-next",previousSelector:".customizable-slideshow-previous",playPauseSelector:".customizable-slideshow-play-pause",playClass:"customizable-slideshow-play",pauseClass:"customizable-slideshow-pause",childrenSetup:function(b){}}})(jQuery);
