(function(e){function k(a){e.fn.cycle.debug&&j(a)}function j(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "))}function w(a,b,d){function g(a,b,d){if(!a&&!0===b){a=e(d).data("cycle.opts");if(!a)return j("options not found, can not resume"),!1;if(d.cycleTimeout)clearTimeout(d.cycleTimeout),d.cycleTimeout=0;n(a.elements,a,1,!a.backwards)}}if(void 0==a.cycleStop)a.cycleStop=0;if(void 0===b||null===b)b={};if(b.constructor==String)switch(b){case "destroy":case "stop":d=
e(a).data("cycle.opts");if(!d)return!1;a.cycleStop++;a.cycleTimeout&&clearTimeout(a.cycleTimeout);a.cycleTimeout=0;e(a).removeData("cycle.opts");"destroy"==b&&x(d);return!1;case "toggle":return a.cyclePause=1===a.cyclePause?0:1,g(a.cyclePause,d,a),!1;case "pause":return a.cyclePause=1,!1;case "resume":return a.cyclePause=0,g(!1,d,a),!1;case "prev":case "next":d=e(a).data("cycle.opts");if(!d)return j('options not found, "prev/next" ignored'),!1;e.fn.cycle[b](d);return!1;default:b={fx:b}}else if(b.constructor==
Number){var f=b,b=e(a).data("cycle.opts");if(!b)return j("options not found, can not advance slide"),!1;if(0>f||f>=b.elements.length)return j("invalid slide index: "+f),!1;b.nextSlide=f;if(a.cycleTimeout)clearTimeout(a.cycleTimeout),a.cycleTimeout=0;if("string"==typeof d)b.oneTimeFx=d;n(b.elements,b,1,f>=b.currSlide);return!1}return b}function u(a,b){if(!e.support.opacity&&b.cleartype&&a.style.filter)try{a.style.removeAttribute("filter")}catch(d){}}function x(a){a.next&&e(a.next).unbind(a.prevNextEvent);
a.prev&&e(a.prev).unbind(a.prevNextEvent);if(a.pager||a.pagerAnchorBuilder)e.each(a.pagerAnchors||[],function(){this.unbind().remove()});a.pagerAnchors=null;a.destroy&&a.destroy(a)}function y(a,b,d,g,f){var c=e.extend({},e.fn.cycle.defaults,g||{},e.metadata?a.metadata():e.meta?a.data():{});if(c.autostop)c.countdown=c.autostopCount||d.length;var h=a[0];a.data("cycle.opts",c);c.$cont=a;c.stopCount=h.cycleStop;c.elements=d;c.before=c.before?[c.before]:[];c.after=c.after?[c.after]:[];!e.support.opacity&&
c.cleartype&&c.after.push(function(){u(this,c)});c.continuous&&c.after.push(function(){n(d,c,0,!c.backwards)});z(c);!e.support.opacity&&c.cleartype&&!c.cleartypeNoBg&&v(b);"static"==a.css("position")&&a.css("position","relative");c.width&&a.width(c.width);c.height&&"auto"!=c.height&&a.height(c.height);if(c.startingSlide)c.startingSlide=parseInt(c.startingSlide);else if(c.backwards)c.startingSlide=d.length-1;if(c.random){c.randomMap=[];for(h=0;h<d.length;h++)c.randomMap.push(h);c.randomMap.sort(function(){return Math.random()-
0.5});c.randomIndex=1;c.startingSlide=c.randomMap[1]}else if(c.startingSlide>=d.length)c.startingSlide=0;c.currSlide=c.startingSlide||0;var i=c.startingSlide;b.css({position:"absolute",top:0,left:0}).hide().each(function(a){a=c.backwards?i?a<=i?d.length+(a-i):i-a:d.length-a:i?a>=i?d.length-(a-i):i-a:d.length-a;e(this).css("z-index",a)});e(d[i]).css("opacity",1).show();u(d[i],c);c.fit&&c.width&&b.width(c.width);c.fit&&c.height&&"auto"!=c.height&&b.height(c.height);if(c.containerResize&&!a.innerHeight()){for(var l=
h=0,t=0;t<d.length;t++){var m=e(d[t]),k=m[0],q=m.outerWidth(),r=m.outerHeight();q||(q=k.offsetWidth||k.width||m.attr("width"));r||(r=k.offsetHeight||k.height||m.attr("height"));h=q>h?q:h;l=r>l?r:l}0<h&&0<l&&a.css({width:h+"px",height:l+"px"})}c.pause&&a.hover(function(){this.cyclePause++},function(){this.cyclePause--});if(!1===A(c))return!1;var o=!1;g.requeueAttempts=g.requeueAttempts||0;b.each(function(){var a=e(this);this.cycleH=c.fit&&c.height?c.height:a.height()||this.offsetHeight||this.height||
a.attr("height")||0;this.cycleW=c.fit&&c.width?c.width:a.width()||this.offsetWidth||this.width||a.attr("width")||0;if(a.is("img")){var a=e.browser.mozilla&&34==this.cycleW&&19==this.cycleH&&!this.complete,b=e.browser.opera&&(42==this.cycleW&&19==this.cycleH||37==this.cycleW&&17==this.cycleH)&&!this.complete,d=0==this.cycleH&&0==this.cycleW&&!this.complete;if(e.browser.msie&&28==this.cycleW&&30==this.cycleH&&!this.complete||a||b||d){if(f.s&&c.requeueOnImageNotLoaded&&100>++g.requeueAttempts)return j(g.requeueAttempts,
" - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH),setTimeout(function(){e(f.s,f.c).cycle(g)},c.requeueTimeout),o=!0,!1;j("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}}return!0});if(o)return!1;c.cssBefore=c.cssBefore||{};c.cssAfter=c.cssAfter||{};c.cssFirst=c.cssFirst||{};c.animIn=c.animIn||{};c.animOut=c.animOut||{};b.not(":eq("+i+")").css(c.cssBefore);e(b[i]).css(c.cssFirst);if(c.timeout){c.timeout=parseInt(c.timeout);if(c.speed.constructor==
String)c.speed=e.fx.speeds[c.speed]||parseInt(c.speed);c.sync||(c.speed/=2);for(h="none"==c.fx?0:"shuffle"==c.fx?500:250;c.timeout-c.speed<h;)c.timeout+=c.speed}if(c.easing)c.easeIn=c.easeOut=c.easing;if(!c.speedIn)c.speedIn=c.speed;if(!c.speedOut)c.speedOut=c.speed;c.slideCount=d.length;c.currSlide=c.lastSlide=i;if(c.random){if(++c.randomIndex==d.length)c.randomIndex=0;c.nextSlide=c.randomMap[c.randomIndex]}else c.nextSlide=c.backwards?0==c.startingSlide?d.length-1:c.startingSlide-1:c.startingSlide>=
d.length-1?0:c.startingSlide+1;if(!c.multiFx)if(h=e.fn.cycle.transitions[c.fx],e.isFunction(h))h(a,b,c);else if("custom"!=c.fx&&!c.multiFx)return j("unknown transition: "+c.fx,"; slideshow terminating"),!1;a=b[i];c.before.length&&c.before[0].apply(a,[a,a,c,!0]);c.after.length&&c.after[0].apply(a,[a,a,c,!0]);c.next&&e(c.next).bind(c.prevNextEvent,function(){return s(c,1)});c.prev&&e(c.prev).bind(c.prevNextEvent,function(){return s(c,0)});(c.pager||c.pagerAnchorBuilder)&&B(d,c);C(c,d);return c}function z(a){a.original=
{before:[],after:[]};a.original.cssBefore=e.extend({},a.cssBefore);a.original.cssAfter=e.extend({},a.cssAfter);a.original.animIn=e.extend({},a.animIn);a.original.animOut=e.extend({},a.animOut);e.each(a.before,function(){a.original.before.push(this)});e.each(a.after,function(){a.original.after.push(this)})}function A(a){var b,d,g=e.fn.cycle.transitions;if(0<a.fx.indexOf(",")){a.multiFx=!0;a.fxs=a.fx.replace(/\s*/g,"").split(",");for(b=0;b<a.fxs.length;b++){var f=a.fxs[b];d=g[f];if(!d||!g.hasOwnProperty(f)||
!e.isFunction(d))j("discarding unknown transition: ",f),a.fxs.splice(b,1),b--}if(!a.fxs.length)return j("No valid transitions named; slideshow terminating."),!1}else if("all"==a.fx)for(p in a.multiFx=!0,a.fxs=[],g)d=g[p],g.hasOwnProperty(p)&&e.isFunction(d)&&a.fxs.push(p);if(a.multiFx&&a.randomizeEffects){d=Math.floor(20*Math.random())+30;for(b=0;b<d;b++)g=Math.floor(Math.random()*a.fxs.length),a.fxs.push(a.fxs.splice(g,1)[0]);k("randomized fx sequence: ",a.fxs)}return!0}function C(a,b){a.addSlide=
function(d,g){var f=e(d),c=f[0];a.autostopCount||a.countdown++;b[g?"unshift":"push"](c);if(a.els)a.els[g?"unshift":"push"](c);a.slideCount=b.length;f.css("position","absolute");f[g?"prependTo":"appendTo"](a.$cont);g&&(a.currSlide++,a.nextSlide++);!e.support.opacity&&a.cleartype&&!a.cleartypeNoBg&&v(f);a.fit&&a.width&&f.width(a.width);a.fit&&a.height&&"auto"!=a.height&&f.height(a.height);c.cycleH=a.fit&&a.height?a.height:f.height();c.cycleW=a.fit&&a.width?a.width:f.width();f.css(a.cssBefore);(a.pager||
a.pagerAnchorBuilder)&&e.fn.cycle.createPagerAnchor(b.length-1,c,e(a.pager),b,a);if(e.isFunction(a.onAddSlide))a.onAddSlide(f);else f.hide()}}function n(a,b,d,g){if(d&&b.busy&&b.manualTrump)k("manualTrump in go(), stopping active transition"),e(a).stop(!0,!0),b.busy=0;if(b.busy)k("transition active, ignoring new tx request");else{var f=b.$cont[0],c=a[b.currSlide],h=a[b.nextSlide];if(!(f.cycleStop!=b.stopCount||0===f.cycleTimeout&&!d))if(!d&&!f.cyclePause&&!b.bounce&&(b.autostop&&0>=--b.countdown||
b.nowrap&&!b.random&&b.nextSlide<b.currSlide))b.end&&b.end(b);else{var i=!1;if((d||!f.cyclePause)&&b.nextSlide!=b.currSlide){var i=!0,l=b.fx;c.cycleH=c.cycleH||e(c).height();c.cycleW=c.cycleW||e(c).width();h.cycleH=h.cycleH||e(h).height();h.cycleW=h.cycleW||e(h).width();if(b.multiFx){if(void 0==b.lastFx||++b.lastFx>=b.fxs.length)b.lastFx=0;l=b.fxs[b.lastFx];b.currFx=l}if(b.oneTimeFx)l=b.oneTimeFx,b.oneTimeFx=null;e.fn.cycle.resetState(b,l);b.before.length&&e.each(b.before,function(a,d){f.cycleStop==
b.stopCount&&d.apply(h,[c,h,b,g])});var j=function(){b.busy=0;e.each(b.after,function(a,d){f.cycleStop==b.stopCount&&d.apply(h,[c,h,b,g])})};k("tx firing("+l+"); currSlide: "+b.currSlide+"; nextSlide: "+b.nextSlide);b.busy=1;if(b.fxFn)b.fxFn(c,h,b,j,g,d&&b.fastOnEvent);else if(e.isFunction(e.fn.cycle[b.fx]))e.fn.cycle[b.fx](c,h,b,j,g,d&&b.fastOnEvent);else e.fn.cycle.custom(c,h,b,j,g,d&&b.fastOnEvent)}if(i||b.nextSlide==b.currSlide)if(b.lastSlide=b.currSlide,b.random){b.currSlide=b.nextSlide;if(++b.randomIndex==
a.length)b.randomIndex=0;b.nextSlide=b.randomMap[b.randomIndex];if(b.nextSlide==b.currSlide)b.nextSlide=b.currSlide==b.slideCount-1?0:b.currSlide+1}else b.backwards?(d=0>b.nextSlide-1)&&b.bounce?(b.backwards=!b.backwards,b.nextSlide=1,b.currSlide=0):(b.nextSlide=d?a.length-1:b.nextSlide-1,b.currSlide=d?0:b.nextSlide+1):(d=b.nextSlide+1==a.length)&&b.bounce?(b.backwards=!b.backwards,b.nextSlide=a.length-2,b.currSlide=a.length-1):(b.nextSlide=d?0:b.nextSlide+1,b.currSlide=d?a.length-1:b.nextSlide-1);
i&&b.pager&&b.updateActivePagerLink(b.pager,b.currSlide,b.activePagerClass);i=0;b.timeout&&!b.continuous?i=o(a[b.currSlide],a[b.nextSlide],b,g):b.continuous&&f.cyclePause&&(i=10);if(0<i)f.cycleTimeout=setTimeout(function(){n(a,b,0,!b.backwards)},i)}}}function o(a,b,d,e){if(d.timeoutFn){for(a=d.timeoutFn.call(a,a,b,d,e);"none"!=d.fx&&250>a-d.speed;)a+=d.speed;k("calculated timeout: "+a+"; speed: "+d.speed);if(!1!==a)return a}return d.timeout}function s(a,b){var d=b?1:-1,g=a.elements,f=a.$cont[0],c=
f.cycleTimeout;if(c)clearTimeout(c),f.cycleTimeout=0;if(a.random&&0>d){a.randomIndex--;if(-2==--a.randomIndex)a.randomIndex=g.length-2;else if(-1==a.randomIndex)a.randomIndex=g.length-1;a.nextSlide=a.randomMap[a.randomIndex]}else if(a.random)a.nextSlide=a.randomMap[a.randomIndex];else if(a.nextSlide=a.currSlide+d,0>a.nextSlide){if(a.nowrap)return!1;a.nextSlide=g.length-1}else if(a.nextSlide>=g.length){if(a.nowrap)return!1;a.nextSlide=0}f=a.onPrevNextEvent||a.prevNextClick;e.isFunction(f)&&f(0<d,a.nextSlide,
g[a.nextSlide]);n(g,a,1,b);return!1}function B(a,b){var d=e(b.pager);e.each(a,function(g,f){e.fn.cycle.createPagerAnchor(g,f,d,a,b)});b.updateActivePagerLink(b.pager,b.startingSlide,b.activePagerClass)}function v(a){function b(a){a=parseInt(a).toString(16);return 2>a.length?"0"+a:a}function d(a){for(;a&&"html"!=a.nodeName.toLowerCase();a=a.parentNode){var d=e.css(a,"background-color");if(d&&0<=d.indexOf("rgb"))return a=d.match(/\d+/g),"#"+b(a[0])+b(a[1])+b(a[2]);if(d&&"transparent"!=d)return d}return"#ffffff"}
k("applying clearType background-color hack");a.each(function(){e(this).css("background-color",d(this))})}if(void 0==e.support)e.support={opacity:!e.browser.msie};e.expr[":"].paused=function(a){return a.cyclePause};e.fn.cycle=function(a,b){var d={s:this.selector,c:this.context};if(0===this.length&&"stop"!=a){if(!e.isReady&&d.s)return j("DOM not ready, queuing slideshow"),e(function(){e(d.s,d.c).cycle(a,b)}),this;j("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var g=
w(this,a,b);if(!1!==g){g.updateActivePagerLink=g.updateActivePagerLink||e.fn.cycle.updateActivePagerLink;this.cycleTimeout&&clearTimeout(this.cycleTimeout);this.cycleTimeout=this.cyclePause=0;var f=e(this),c=g.slideExpr?e(g.slideExpr,this):f.children(),h=c.get();if(2>h.length)j("terminating; too few slides: "+h.length);else{var i=y(f,c,h,g,d);if(!1!==i&&(f=i.continuous?10:o(h[i.currSlide],h[i.nextSlide],i,!i.backwards)))f+=i.delay||0,10>f&&(f=10),k("first timeout: "+f),this.cycleTimeout=setTimeout(function(){n(h,
i,0,!g.backwards)},f)}}})};e.fn.cycle.resetState=function(a,b){b=b||a.fx;a.before=[];a.after=[];a.cssBefore=e.extend({},a.original.cssBefore);a.cssAfter=e.extend({},a.original.cssAfter);a.animIn=e.extend({},a.original.animIn);a.animOut=e.extend({},a.original.animOut);a.fxFn=null;e.each(a.original.before,function(){a.before.push(this)});e.each(a.original.after,function(){a.after.push(this)});var d=e.fn.cycle.transitions[b];e.isFunction(d)&&d(a.$cont,e(a.elements),a)};e.fn.cycle.updateActivePagerLink=
function(a,b,d){e(a).each(function(){e(this).children().removeClass(d).eq(b).addClass(d)})};e.fn.cycle.next=function(a){s(a,1)};e.fn.cycle.prev=function(a){s(a,0)};e.fn.cycle.createPagerAnchor=function(a,b,d,g,f){e.isFunction(f.pagerAnchorBuilder)?(b=f.pagerAnchorBuilder(a,b),k("pagerAnchorBuilder("+a+", el) returned: "+b)):b='<a href="#">'+(a+1)+"</a>";if(b){var c=e(b);if(0===c.parents("body").length){var h=[];1<d.length?(d.each(function(){var a=c.clone(!0);e(this).append(a);h.push(a[0])}),c=e(h)):
c.appendTo(d)}f.pagerAnchors=f.pagerAnchors||[];f.pagerAnchors.push(c);c.bind(f.pagerEvent,function(b){b.preventDefault();f.nextSlide=a;var b=f.$cont[0],c=b.cycleTimeout;if(c)clearTimeout(c),b.cycleTimeout=0;b=f.onPagerEvent||f.pagerClick;e.isFunction(b)&&b(f.nextSlide,g[f.nextSlide]);n(g,f,1,f.currSlide<a)});!/^click/.test(f.pagerEvent)&&!f.allowPagerClickBubble&&c.bind("click.cycle",function(){return!1});f.pauseOnPagerHover&&c.hover(function(){f.$cont[0].cyclePause++},function(){f.$cont[0].cyclePause--})}};
e.fn.cycle.hopsFromLast=function(a,b){var d=a.lastSlide,e=a.currSlide;return b?e>d?e-d:a.slideCount-d:e<d?d-e:d+a.slideCount-e};e.fn.cycle.commonReset=function(a,b,d,g,f,c){e(d.elements).not(a).hide();if("undefined"==typeof d.cssBefore.opacity)d.cssBefore.opacity=1;d.cssBefore.display="block";if(d.slideResize&&!1!==g&&0<b.cycleW)d.cssBefore.width=b.cycleW;if(d.slideResize&&!1!==f&&0<b.cycleH)d.cssBefore.height=b.cycleH;d.cssAfter=d.cssAfter||{};d.cssAfter.display="none";e(a).css("zIndex",d.slideCount+
(!0===c?1:0));e(b).css("zIndex",d.slideCount+(!0===c?0:1))};e.fn.cycle.custom=function(a,b,d,g,f,c){var h=e(a),i=e(b),j=d.speedIn,a=d.speedOut,k=d.easeIn,b=d.easeOut;i.css(d.cssBefore);c&&(j="number"==typeof c?a=c:a=1,k=b=null);var m=function(){i.animate(d.animIn,j,k,function(){g()})};h.animate(d.animOut,a,b,function(){h.css(d.cssAfter);d.sync||m()});d.sync&&m()};e.fn.cycle.transitions={fade:function(a,b,d){b.not(":eq("+d.currSlide+")").css("opacity",0);d.before.push(function(a,b,c){e.fn.cycle.commonReset(a,
b,c);c.cssBefore.opacity=0});d.animIn={opacity:1};d.animOut={opacity:0};d.cssBefore={top:0,left:0}}};e.fn.cycle.ver=function(){return"2.99"};e.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:!1,animIn:null,animOut:null,autostop:0,autostopCount:0,backwards:!1,before:null,cleartype:!e.support.opacity,cleartypeNoBg:!1,containerResize:1,continuous:0,cssAfter:null,cssBefore:null,delay:0,easeIn:null,easeOut:null,easing:null,end:null,fastOnEvent:0,fit:0,fx:"fade",fxFn:null,
height:"auto",manualTrump:!0,next:null,nowrap:0,onPagerEvent:null,onPrevNextEvent:null,pager:null,pagerAnchorBuilder:null,pagerEvent:"click.cycle",pause:0,pauseOnPagerHover:0,prev:null,prevNextEvent:"click.cycle",random:0,randomizeEffects:1,requeueOnImageNotLoaded:!0,requeueTimeout:250,rev:0,shuffle:null,slideExpr:null,slideResize:1,speed:1E3,speedIn:null,speedOut:null,startingSlide:0,sync:1,timeout:4E3,timeoutFn:null,updateActivePagerLink:null}})(jQuery);
