PageSourceSearch

https://healthimpactnews.com/wp-content/plugins/smooth-slider/js/smooth.js?ver=2.8.8

js healthimpactnews.com collected 2026-10-02 03:02:08 UTC 53,820 bytes, 1,544 lines download raw bytes

1/*!
2 * Modifications for Smooth Slider
3 * jQuery Cycle Plugin (with Transition Definitions)
4 * Examples and documentation at: http://jquery.malsup.com/smooth/
5 * Copyright (c) 2007-2013 M. Alsup
6 * Version: 3.0.3 (11-JUL-2013)
7 * Dual licensed under the MIT and GPL licenses.
8 * http://jquery.malsup.com/license.html
9 * Requires: jQuery v1.7.1 or later
10 */
11;(function($, undefined) {
12"use strict";
13
14var ver = '3.0.3';
15
16function debug(s) {
17	if ($.fn.smooth.debug)
18		log(s);
19}		
20function log() {
21	/*global console */
22	if (window.console && console.log)
23		console.log('[smooth] ' + Array.prototype.join.call(arguments,' '));
24}
25$.expr[':'].paused = function(el) {
26	return el.smoothPause;
27};
28
29
30// the options arg can be...
31//   a number  - indicates an immediate transition should occur to the given slide index
32//   a string  - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
33//   an object - properties to control the slideshow
34//
35// the arg2 arg can be...
36//   the name of an fx (only used in conjunction with a numeric value for 'options')
37//   the value true (only used in first arg == 'resume') and indicates
38//	 that the resume should occur immediately (not wait for next timeout)
39
40$.fn.smooth = function(options, arg2) {
41	var o = { s: this.selector, c: this.context };
42
43	// in 1.3+ we can fix mistakes with the ready state
44	if (this.length === 0 && options != 'stop') {
45		if (!$.isReady && o.s) {
46			log('DOM not ready, queuing slideshow');
47			$(function() {
48				$(o.s,o.c).smooth(options,arg2);
49			});
50			return this;
51		}
52		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
53		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
54		return this;
55	}
56
57	// iterate the matched nodeset
58	return this.each(function() {
59		var opts = handleArguments(this, options, arg2);
60		if (opts === false)
61			return;
62
63		opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.smooth.updateActivePagerLink;
64		
65		// stop existing slideshow for this container (if there is one)
66		if (this.smoothTimeout)
67			clearTimeout(this.smoothTimeout);
68		this.smoothTimeout = this.smoothPause = 0;
69		this.smoothStop = 0; // issue #108
70
71		var $cont = $(this);
72		var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
73		var els = $slides.get();
74
75		if (els.length < 2) {
76			log('terminating; too few slides: ' + els.length);
77			return;
78		}
79
80		var opts2 = buildOptions($cont, $slides, els, opts, o);
81		if (opts2 === false)
82			return;
83
84		var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
85
86		// if it's an auto slideshow, kick it off
87		if (startTime) {
88			startTime += (opts2.delay || 0);
89			if (startTime < 10)
90				startTime = 10;
91			debug('first timeout: ' + startTime);
92			this.smoothTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime);
93		}
94	});
95};
96
97function triggerPause(cont, byHover, onPager) {
98	var opts = $(cont).data('smooth.opts');
99	if (!opts)
100		return;
101	var paused = !!cont.smoothPause;
102	if (paused && opts.paused)
103		opts.paused(cont, opts, byHover, onPager);
104	else if (!paused && opts.resumed)
105		opts.resumed(cont, opts, byHover, onPager);
106}
107
108// process the args that were passed to the plugin fn
109function handleArguments(cont, options, arg2) {
110	if (cont.smoothStop === undefined)
111		cont.smoothStop = 0;
112	if (options === undefined || options === null)
113		options = {};
114	if (options.constructor == String) {
115		switch(options) {
116		case 'destroy':
117		case 'stop':
118			var opts = $(cont).data('smooth.opts');
119			if (!opts)
120				return false;
121			cont.smoothStop++; // callbacks look for change
122			if (cont.smoothTimeout)
123				clearTimeout(cont.smoothTimeout);
124			cont.smoothTimeout = 0;
125			if (opts.elements)
126				$(opts.elements).stop();
127			$(cont).removeData('smooth.opts');
128			if (options == 'destroy')
129				destroy(cont, opts);
130			return false;
131		case 'toggle':
132			cont.smoothPause = (cont.smoothPause === 1) ? 0 : 1;
133			checkInstantResume(cont.smoothPause, arg2, cont);
134			triggerPause(cont);
135			return false;
136		case 'pause':
137			cont.smoothPause = 1;
138			triggerPause(cont);
139			return false;
140		case 'resume':
141			cont.smoothPause = 0;
142			checkInstantResume(false, arg2, cont);
143			triggerPause(cont);
144			return false;
145		case 'prev':
146		case 'next':
147			opts = $(cont).data('smooth.opts');
148			if (!opts) {
149				log('options not found, "prev/next" ignored');
150				return false;
151			}
152			if (typeof arg2 == 'string') 
153				opts.oneTimeFx = arg2;
154			$.fn.smooth[options](opts);
155			return false;
156		default:
157			options = { fx: options };
158		}
159		return options;
160	}
161	else if (options.constructor == Number) {
162		// go to the requested slide
163		var num = options;
164		options = $(cont).data('smooth.opts');
165		if (!options) {
166			log('options not found, can not advance slide');
167			return false;
168		}
169		if (num < 0 || num >= options.elements.length) {
170			log('invalid slide index: ' + num);
171			return false;
172		}
173		options.nextSlide = num;
174		if (cont.smoothTimeout) {
175			clearTimeout(cont.smoothTimeout);
176			cont.smoothTimeout = 0;
177		}
178		if (typeof arg2 == 'string')
179			options.oneTimeFx = arg2;
180		go(options.elements, options, 1, num >= options.currSlide);
181		return false;
182	}
183	return options;
184	
185	function checkInstantResume(isPaused, arg2, cont) {
186		if (!isPaused && arg2 === true) { // resume now!
187			var options = $(cont).data('smooth.opts');
188			if (!options) {
189				log('options not found, can not resume');
190				return false;
191			}
192			if (cont.smoothTimeout) {
193				clearTimeout(cont.smoothTimeout);
194				cont.smoothTimeout = 0;
195			}
196			go(options.elements, options, 1, !options.backwards);
197		}
198	}
199}
200
201function removeFilter(el, opts) {
202	if (!$.support.opacity && opts.cleartype && el.style.filter) {
203		try { el.style.removeAttribute('filter'); }
204		catch(smother) {} // handle old opera versions
205	}
206}
207
208// unbind event handlers
209function destroy(cont, opts) {
210	if (opts.next)
211		$(opts.next).unbind(opts.prevNextEvent);
212	if (opts.prev)
213		$(opts.prev).unbind(opts.prevNextEvent);
214	
215	if (opts.pager || opts.pagerAnchorBuilder)
216		$.each(opts.pagerAnchors || [], function() {
217			this.unbind().remove();
218		});
219	opts.pagerAnchors = null;
220	$(cont).unbind('mouseenter.smooth mouseleave.smooth');
221	if (opts.destroy) // callback
222		opts.destroy(opts);
223}
224
225// one-time initialization
226function buildOptions($cont, $slides, els, options, o) {
227	var startingSlideSpecified;
228	// support metadata plugin (v1.0 and v2.0)
229	var opts = $.extend({}, $.fn.smooth.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
230	var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
231	if (meta)
232		opts = $.extend(opts, meta);
233	if (opts.autostop)
234		opts.countdown = opts.autostopCount || els.length;
235
236	var cont = $cont[0];
237	$cont.data('smooth.opts', opts);
238	opts.$cont = $cont;
239	opts.stopCount = cont.smoothStop;
240	opts.elements = els;
241	opts.before = opts.before ? [opts.before] : [];
242	opts.after = opts.after ? [opts.after] : [];
243
244	// push some after callbacks
245	if (!$.support.opacity && opts.cleartype)
246		opts.after.push(function() { removeFilter(this, opts); });
247	if (opts.continuous)
248		opts.after.push(function() { go(els,opts,0,!opts.backwards); });
249
250	saveOriginalOpts(opts);
251
252	// clearType corrections
253	if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
254		clearTypeFix($slides);
255
256	// container requires non-static position so that slides can be position within
257	if ($cont.css('position') == 'static')
258		$cont.css('position', 'relative');
259	if (opts.width)
260		$cont.width(opts.width);
261	if (opts.height && opts.height != 'auto')
262		$cont.height(opts.height);
263
264	if (opts.startingSlide !== undefined) {
265		opts.startingSlide = parseInt(opts.startingSlide,10);
266		if (opts.startingSlide >= els.length || opts.startSlide < 0)
267			opts.startingSlide = 0; // catch bogus input
268		else 
269			startingSlideSpecified = true;
270	}
271	else if (opts.backwards)
272		opts.startingSlide = els.length - 1;
273	else
274		opts.startingSlide = 0;
275
276	// if random, mix up the slide array
277	if (opts.random) {
278		opts.randomMap = [];
279		for (var i = 0; i < els.length; i++)
280			opts.randomMap.push(i);
281		opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
282		if (startingSlideSpecified) {
283			// try to find the specified starting slide and if found set start slide index in the map accordingly
284			for ( var cnt = 0; cnt < els.length; cnt++ ) {
285				if ( opts.startingSlide == opts.randomMap[cnt] ) {
286					opts.randomIndex = cnt;
287				}
288			}
289		}
290		else {
291			opts.randomIndex = 1;
292			opts.startingSlide = opts.randomMap[1];
293		}
294	}
295	else if (opts.startingSlide >= els.length)
296		opts.startingSlide = 0; // catch bogus input
297	opts.currSlide = opts.startingSlide || 0;
298	var first = opts.startingSlide;
299
300	// set position and zIndex on all the slides
301	$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
302		var z;
303		if (opts.backwards)
304			z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
305		else
306			z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
307		$(this).css('z-index', z);
308	});
309
310	// make sure first slide is visible
311	$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
312	removeFilter(els[first], opts);
313
314	// stretch slides
315	if (opts.fit) {
316		if (!opts.aspect) {
317	        if (opts.width)
318	            $slides.width(opts.width);
319	        if (opts.height && opts.height != 'auto')
320	            $slides.height(opts.height);
321		} else {
322			$slides.each(function(){
323				var $slide = $(this);
324				var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
325				if( opts.width && $slide.width() != opts.width ) {
326					$slide.width( opts.width );
327					$slide.height( opts.width / ratio );
328				}
329
330				if( opts.height && $slide.height() < opts.height ) {
331					$slide.height( opts.height );
332					$slide.width( opts.height * ratio );
333				}
334			});
335		}
336	}
337
338	if (opts.center && ((!opts.fit) || opts.aspect)) {
339		$slides.each(function(){
340			var $slide = $(this);
341			$slide.css({
342				"margin-left": opts.width ?
343					((opts.width - $slide.width()) / 2) + "px" :
344					0,
345				"margin-top": opts.height ?
346					((opts.height - $slide.height()) / 2) + "px" :
347					0
348			});
349		});
350	}
351
352	if (opts.center && !opts.fit && !opts.slideResize) {
353		$slides.each(function(){
354			var $slide = $(this);
355			$slide.css({
356				"margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
357				"margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
358			});
359		});
360	}
361		
362	// stretch container
363	var reshape = (opts.containerResize || opts.containerResizeHeight) && $cont.innerHe
363ight() < 1;
364	if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
365		var maxw = 0, maxh = 0;
366		for(var j=0; j < els.length; j++) {
367			var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
368			if (!w) w = e.offsetWidth || e.width || $e.attr('width');
369			if (!h) h = e.offsetHeight || e.height || $e.attr('height');
370			maxw = w > maxw ? w : maxw;
371			maxh = h > maxh ? h : maxh;
372		}
373		if (opts.containerResize && maxw > 0 && maxh > 0)
374			$cont.css({width:maxw+'px',height:maxh+'px'});
375		if (opts.containerResizeHeight && maxh > 0)
376			$cont.css({height:maxh+'px'});
377	}
378
379	var pauseFlag = false;  // https://github.com/malsup/smooth/issues/44
380	if (opts.pause)
381		$cont.bind('mouseenter.smooth', function(){
382			pauseFlag = true;
383			this.smoothPause++;
384			triggerPause(cont, true);
385		}).bind('mouseleave.smooth', function(){
386				if (pauseFlag)
387					this.smoothPause--;
388				triggerPause(cont, true);
389		});
390
391	if (supportMultiTransitions(opts) === false)
392		return false;
393
394	// apparently a lot of people use image slideshows without height/width attributes on the images.
395	// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
396	var requeue = false;
397	options.requeueAttempts = options.requeueAttempts || 0;
398	$slides.each(function() {
399		// try to get height/width of each slide
400		var $el = $(this);
401		this.smoothH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
402		this.smoothW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
403
404		if ( $el.is('img') ) {
405			var loading = (this.smoothH === 0 && this.smoothW === 0 && !this.complete);
406			// don't requeue for images that are still loading but have a valid size
407			if (loading) {
408				if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
409					log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.smoothW, this.smoothH);
410					setTimeout(function() {$(o.s,o.c).smooth(options);}, opts.requeueTimeout);
411					requeue = true;
412					return false; // break each loop
413				}
414				else {
415					log('could not determine size of image: '+this.src, this.smoothW, this.smoothH);
416				}
417			}
418		}
419		return true;
420	});
421
422	if (requeue)
423		return false;
424
425	opts.cssBefore = opts.cssBefore || {};
426	opts.cssAfter = opts.cssAfter || {};
427	opts.cssFirst = opts.cssFirst || {};
428	opts.animIn = opts.animIn || {};
429	opts.animOut = opts.animOut || {};
430
431	$slides.not(':eq('+first+')').css(opts.cssBefore);
432	$($slides[first]).css(opts.cssFirst);
433
434	if (opts.timeout) {
435		opts.timeout = parseInt(opts.timeout,10);
436		// ensure that timeout and speed settings are sane
437		if (opts.speed.constructor == String)
438			opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
439		if (!opts.sync)
440			opts.speed = opts.speed / 2;
441		
442		var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
443		while((opts.timeout - opts.speed) < buffer) // sanitize timeout
444			opts.timeout += opts.speed;
445	}
446	if (opts.easing)
447		opts.easeIn = opts.easeOut = opts.easing;
448	if (!opts.speedIn)
449		opts.speedIn = opts.speed;
450	if (!opts.speedOut)
451		opts.speedOut = opts.speed;
452
453	opts.slideCount = els.length;
454	opts.currSlide = opts.lastSlide = first;
455	if (opts.random) {
456		if (++opts.randomIndex == els.length)
457			opts.randomIndex = 0;
458		opts.nextSlide = opts.randomMap[opts.randomIndex];
459	}
460	else if (opts.backwards)
461		opts.nextSlide = opts.startingSlide === 0 ? (els.length-1) : opts.startingSlide-1;
462	else
463		opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
464
465	// run transition init fn
466	if (!opts.multiFx) {
467		var init = $.fn.smooth.transitions[opts.fx];
468		if ($.isFunction(init))
469			init($cont, $slides, opts);
470		else if (opts.fx != 'custom' && !opts.multiFx) {
471			log('unknown transition: ' + opts.fx,'; slideshow terminating');
472			return false;
473		}
474	}
475
476	// fire artificial events
477	var e0 = $slides[first];
478	if (!opts.skipInitializationCallbacks) {
479		if (opts.before.length)
480			opts.before[0].apply(e0, [e0, e0, opts, true]);
481		if (opts.after.length)
482			opts.after[0].apply(e0, [e0, e0, opts, true]);
483	}
484	if (opts.next)
485		$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});
486	if (opts.prev)
487		$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});
488	if (opts.pager || opts.pagerAnchorBuilder)
489		buildPager(els,opts);
490
491	exposeAddSlide(opts, els);
492
493	return opts;
494}
495
496// save off original opts so we can restore after clearing state
497function saveOriginalOpts(opts) {
498	opts.original = { before: [], after: [] };
499	opts.original.cssBefore = $.extend({}, opts.cssBefore);
500	opts.original.cssAfter  = $.extend({}, opts.cssAfter);
501	opts.original.animIn	= $.extend({}, opts.animIn);
502	opts.original.animOut   = $.extend({}, opts.animOut);
503	$.each(opts.before, function() { opts.original.before.push(this); });
504	$.each(opts.after,  function() { opts.original.after.push(this); });
505}
506
507function supportMultiTransitions(opts) {
508	var i, tx, txs = $.fn.smooth.transitions;
509	// look for multiple effects
510	if (opts.fx.indexOf(',') > 0) {
511		opts.multiFx = true;
512		opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
513		// discard any bogus effect names
514		for (i=0; i < opts.fxs.length; i++) {
515			var fx = opts.fxs[i];
516			tx = txs[fx];
517			if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
518				log('discarding unknown transition: ',fx);
519				opts.fxs.splice(i,1);
520				i--;
521			}
522		}
523		// if we have an empty list then we threw everything away!
524		if (!opts.fxs.length) {
525			log('No valid transitions named; slideshow terminating.');
526			return false;
527		}
528	}
529	else if (opts.fx == 'all') {  // auto-gen the list of transitions
530		opts.multiFx = true;
531		opts.fxs = [];
532		for (var p in txs) {
533			if (txs.hasOwnProperty(p)) {
534				tx = txs[p];
535				if (txs.hasOwnProperty(p) && $.isFunction(tx))
536					opts.fxs.push(p);
537			}
538		}
539	}
540	if (opts.multiFx && opts.randomizeEffects) {
541		// munge the fxs array to make effect selection random
542		var r1 = Math.floor(Math.random() * 20) + 30;
543		for (i = 0; i < r1; i++) {
544			var r2 = Math.floor(Math.random() * opts.fxs.length);
545			opts.fxs.push(opts.fxs.splice(r2,1)[0]);
546		}
547		debug('randomized fx sequence: ',opts.fxs);
548	}
549	return true;
550}
551
552// provide a mechanism for adding slides after the slideshow has started
553function exposeAddSlide(opts, els) {
554	opts.addSlide = function(newSlide, prepend) {
555		var $s = $(newSlide), s = $s[0];
556		if (!opts.autostopCount)
557			opts.countdown++;
558		els[prepend?'unshift':'push'](s);
559		if (opts.els)
560			opts.els[prepend?'unshift':'push'](s); // shuffle needs this
561		opts.slideCount = els.length;
562
563		// add the slide to the random map and resort
564		if (opts.random) {
565			opts.randomMap.push(opts.slideCount-1);
566			opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
567		}
568
569		$s.css('position','absolute');
570		$s[prepend?'prependTo':'appendTo'](opts.$cont);
571
572		if (prepend) {
573			opts.currSlide++;
574			opts.nextSlide++;
575		}
576
577		if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
578			clearTypeFix($s);
579
580		if (opts.fit && opts.width)
581			$s.width(opts.width);
582		if (opts.fit && opts.height && opts.height != 'auto')
583			$s.height(opts.height);
584		s.smoothH = (opts.fit && opts.height) ? opts.height : $s.height();
585		s.smoothW = (opts.fit && opts.width) ? opts.width : $s.width();
586
587		$s.css(opts.cssBefore);
588
589		if (opts.pager || opts.pagerAnchorBuilder)
590			$.fn.smooth.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
591
592		if ($.isFunction(opts.onAddSlide))
593			opts.onAddSlide($s);
594		else
595			$s.hide(); // default behavior
596	};
597}
598
599// reset internal state; we do this on every pass in order to support multiple effects
600$.fn.smooth.resetState = function(opts, fx) {
601	fx = fx || opts.fx;
602	opts.before = []; opts.after = [];
603	opts.cssBefore = $.extend({}, opts.original.cssBefore);
604	opts.cssAfter  = $.extend({}, opts.original.cssAfter);
605	opts.animIn	= $.extend({}, opts.original.animIn);
606	opts.animOut   = $.extend({}, opts.original.animOut);
607	opts.fxFn = null;
608	$.each(opts.original.before, function() { opts.before.push(this); });
609	$.each(opts.original.after,  function() { opts.after.push(this); });
610
611	// re-init
612	var init = $.fn.smooth.transitions[fx];
613	if ($.isFunction(init))
614		init(opts.$cont, $(opts.elements), opts);
615};
616
617// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
618function go(els, opts, manual, fwd) {
619	var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
620
621	// opts.busy is true if we're in the middle of an animation
622	if (manual && opts.busy && opts.manualTrump) {
623		// let manual transitions requests trump active ones
624		debug('manualTrump in go(), stopping active transition');
625		$(els).stop(true,true);
626		opts.busy = 0;
627		clearTimeout(p.smoothTimeout);
628	}
629
630	// don't begin another timeout-based transition if there is one active
631	if (opts.busy) {
632		debug('transition active, ignoring new tx request');
633		return;
634	}
635
636
637	// stop cycling if we have an outstanding stop request
638	if (p.smoothStop != opts.stopCount || p.smoothTimeout === 0 && !manual)
639		return;
640
641	// check to see if we should stop cycling based on autostop options
642	if (!manual && !p.smoothPause && !opts.bounce &&
643		((opts.autostop && (--opts.countdown <= 0)) ||
644		(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
645		if (opts.end)
646			opts.end(opts);
647		return;
648	}
649
650	// if slideshow is paused, only transition on a manual trigger
651	var changed = false;
652	if ((manual || !p.smoothPause) && (opts.nextSlide != opts.currSlide)) {
653		changed = true;
654		var fx = opts.fx;
655		// keep trying to get the slide size if we don't have it yet
656		curr.smoothH = curr.smoothH || $(curr).height();
657		curr.smoothW = curr.smoothW || $(curr).width();
658		next.smoothH = next.smoothH || $(next).height();
659		next.smoothW = next.smoothW || $(next).width();
660
661		// support multiple transition types
662		if (opts.multiFx) {
663			if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length))
664				opts.lastFx = 0;
665			else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0))
666				opts.lastFx = opts.fxs.length - 1;
667			fx = opts.fxs[opts.lastFx];
668		}
669
670		// one-time fx overrides apply to:  $('div').smooth(3,'zoom');
671		if (opts.oneTimeFx) {
672			fx = opts.oneTimeFx;
673			opts.oneTimeFx = null;
674		}
675
676		$.fn.smooth.resetState(opts, fx);
677
678		// run the before callbacks
679		if (opts.before.length)
680			$.each(opts.before, function(i,o) {
681				if (p.smoothStop != opts.stopCount) return;
682				o.apply(next, [curr, next, opts, fwd]);
683			});
684
685		// stage the after callacks
686		var after = function() {
687			opts.busy = 0;
688			$.each(opts.after, function(i,o) {
689				if (p.smoothStop != opts.stopCount) return;
690				o.apply(next, [curr, next, opts, fwd]);
691			});
692			if (!p.smoothStop) {
693				// queue next transition
694				queueNext();
695			}
696		};
697
698		debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
699		
700		// get ready to perform the transition
701		opts.busy = 1;
702		if (opts.fxFn) // fx function provided?
703			opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
704		else if ($.isFunction($.fn.smooth[opts.fx])) // fx plugin ?
705			$.fn.smooth[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
706		else
707			$.fn.smooth.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
708	}
709	else {
710		queueNext();
711	}
712
713	if (changed || opts.nextSlide == opts.currSlide) {
714		// calculate the next slide
715		var roll;
716		opts.lastSlide = opts.currSlide;
717		if (opts.random) {
718			opts.currSlide = opts.nextSlide;
719			if (++opts.randomIndex == els.length) {
720				opts.randomIndex = 0;
721				opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
722			}
723			opts.nextSlide = opts.randomMap[opts.randomIndex];
724			if (opts.nextSlide == opts.currSlide)
725				opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
726		}
727		else if (opts.backwards) {
728			roll = (opts.nextSlide - 1) < 0;
729			if (roll && opts.bounce) {
730				opts.backwards = !opts.backwards;
731				opts.nextSlide = 1;
732				opts.currSlide = 0;
733			}
734			else {
735				opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
736				opts.currSlide = roll ? 0 : opts.nextSlide+1;
737			}
738		}
739		else { // sequence
740			roll = (opts.nextSlide + 1) == els.length;
741			if (roll && opts.bounce) {
742				opts.backwards = !opts.backwards;
743				opts.nextSlide = els.length-2;
744				opts.currSlide = els.length-1;
745			}
746			else {
747				opts.nextSlide = roll ? 0 : opts.nextSlide+1;
748				opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
749			}
750		}
751	}
752	if (changed && opts.pager)
753		opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
754	
755	function queueNext() {
756		// stage the next transition
757		var ms = 0, timeout = opts.timeout;
758		if (opts.timeout && !opts.continuous) {
759			ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
760         if (opts.fx == 'shuffle')
761            ms -= opts.speedOut;
762      }
763		else if (opts.continuous && p.smoothPause) // continuous shows work off an after callback, not this timer logic
764			ms = 10;
765		if (ms > 0)
766			p.smoothTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms);
767	}
768}
769
770// invoked after transition
771$.fn.smooth.updateActivePagerLink = function(pager, currSlide, clsName) {
772   $(pager).each(function() {
773       $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
774   });
775};
776
777// calculate timeout value for current transition
778function getTimeout(curr, next, opts, fwd) {
779	if (opts.timeoutFn) {
780		// call user provided calc fn
781		var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
782		while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
783			t += opts.speed;
784		debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
785		if (t !== false)
786			return t;
787	}
788	return opts.timeout;
789}
790
791// expose next/prev function, caller must pass in state
792$.fn.smooth.next = function(opts) { advance(opts,1); };
793$.fn.smooth.prev = function(opts) { advance(opts,0);};
794
795// advance slide forward or back
796function advance(opts, moveForward) {
797	var val = moveForward ? 1 : -1;
798	var els = opts.elements;
799	var p = opts.$cont[0], timeout = p.smoothTimeout;
800	if (timeout) {
801		clearTimeout(timeout);
802		p.smoothTimeout = 0;
803	}
804	if (opts.random && val < 0) {
805		// move back to the previously display slide
806		opts.randomIndex--;
807		if (--opts.randomIndex == -2)
808			opts.randomIndex = els.length-2;
809		else if (opts.randomIndex == -1)
810			opts.randomIndex = els.length-1;
811		opts.nextSlide = opts.randomMap[opts.randomIndex];
812	}
813	else if (opts.random) {
814		opts.nextSlide = opts.randomMap[opts.randomIndex];
815	}
816	else {
817		opts.nextSlide = opts.currSlide + val;
818		if (opts.nextSlide < 0) {
819			if (opts.nowrap) return false;
820			opts.nextSlide = els.length - 1;
821		}
822		else if (opts.nextSlide >= els.length) {
823			if (opts.nowrap) return false;
824			opts.nextSlide = 0;
825		}
826	}
827
828	var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
829	if ($.isFunction(cb))
830		cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
831	go(els, opts, 1, moveForward);
832	return false;
833}
834
835function buildPager(els, opts) {
836	var $p = $(opts.pager);
837	$.each(els, function(i,o) {
838		$.fn.smooth.createPagerAnchor(i,o,$p,els,opts);
839	});
840	opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
841}
842
843$.fn.smooth.createPagerAnchor = function(i, el, $p, els, opts) {
844	var a;
845	if ($.isFunction(opts.pagerAnchorBuilder)) {
846		a = opts.pagerAnchorBuilder(i,el);
847		debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
848	}
849	else
850		a = '<a href="#">'+(i+1)+'</a>';
851		
852	if (!a)
853		return;
854	var $a = $(a);
855	// don't reparent if anchor is in the dom
856	if ($a.parents('body').length === 0) {
857		var arr = [];
858		if ($p.length > 1) {
859			$p.each(function() {
860				var $clone = $a.clone(true);
861				$(this).append($clone);
862				arr.push($clone[0]);
863			});
864			$a = $(arr);
865		}
866		else {
867			$a.appendTo($p);
868		}
869	}
870
871	opts.pagerAnchors =  opts.pagerAnchors || [];
872	opts.pagerAnchors.push($a);
873	
874	var pagerFn = function(e) {
875		e.preventDefault();
876		opts.nextSlide = i;
877		var p = opts.$cont[0], timeout = p.smoothTimeout;
878		if (timeout) {
879			clearTimeout(timeout);
880			p.smoothTimeout = 0;
881		}
882		var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
883		if ($.isFunction(cb))
884			cb(opts.nextSlide, els[opts.nextSlide]);
885		go(els,opts,1,opts.currSlide < i); // trigger the trans
886//		return false; // <== allow bubble
887	};
888	
889	if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
890		$a.hover(pagerFn, function(){/* no-op */} );
891	}
892	else {
893		$a.bind(opts.pagerEvent, pagerFn);
894	}
895	
896	if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
897		$a.bind('click.smooth', function(){return false;}); // suppress click
898	
899	var cont = opts.$cont[0];
900	var pauseFlag = false; // https://github.com/malsup/smooth/issues/44
901	if (opts.pauseOnPagerHover) {
902		$a.hover(
903			function() { 
904				pauseFlag = true;
905				cont.smoothPause++; 
906				triggerPause(cont,true,true);
907			}, function() { 
908				if (pauseFlag)
909					cont.smoothPause--; 
910				triggerPause(cont,true,true);
911			} 
912		);
913	}
914};
915
916// helper fn to calculate the number of slides between the current and the next
917$.fn.smooth.hopsFromLast = function(opts, fwd) {
918	var hops, l = opts.lastSlide, c = opts.currSlide;
919	if (fwd)
920		hops = c > l ? c - l : opts.slideCount - l;
921	else
922		hops = c < l ? l - c : l + opts.slideCount - c;
923	return hops;
924};
925
926// fix clearType problems in ie6 by setting an explicit bg color
927// (otherwise text slides look horrible during a fade transition)
928function clearTypeFix($slides) {
929	debug('applying clearType background-color hack');
930	function hex(s) {
931		s = parseInt(s,10).toString(16);
932		return s.length < 2 ? '0'+s : s;
933	}
934	function getBg(e) {
935		for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
936			var v = $.css(e,'background-color');
937			if (v && v.indexOf('rgb') >= 0 ) {
938				var rgb = v.match(/\d+/g);
939				return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
940			}
941			if (v && v != 'transparent')
942				return v;
943		}
944		return '#ffffff';
945	}
946	$slides.each(function() { $(this).css('background-color', getBg(this)); });
947}
948
949// reset common props before the next transition
950$.fn.smooth.commonReset = function(curr,next,opts,w,h,rev) {
951	$(opts.elements).not(curr).hide();
952	if (typeof opts.cssBefore.opacity == 'undefined')
953		opts.cssBefore.opacity = 1;
954	opts.cssBefore.display = 'block';
955	if (opts.slideResize && w !== false && next.smoothW > 0)
956		opts.cssBefore.width = next.smoothW;
957	if (opts.slideResize && h !== false && next.smoothH > 0)
958		opts.cssBefore.height = next.smoothH;
959	opts.cssAfter = opts.cssAfter || {};
960	opts.cssAfter.display = 'none';
961	$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
962	$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
963};
964
965// the actual fn for effecting a transition
966$.fn.smooth.custom = function(curr, next, opts, cb, fwd, speedOverride) {
967	var $l = $(curr), $n = $(next);
968	var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut, animInDelay = opts.animInDelay, animOutDelay = opts.animOutDelay;
969	$n.css(opts.cssBefore);
970	if (speedOverride) {
971		if (typeof speedOverride == 'number')
972			speedIn = speedOut = speedOverride;
973		else
974			speedIn = speedOut = 1;
975		easeIn = easeOut = null;
976	}
977	var fn = function() {
978		$n.delay(animInDelay).animate(opts.animIn, speedIn, easeIn, function() {
979			cb();
980		});
981	};
982	$l.delay(animOutDelay).animate(opts.animOut, speedOut, easeOut, function() {
983		$l.css(opts.cssAfter);
984		if (!opts.sync) 
985			fn();
986	});
987	if (opts.sync) fn();
988};
989
990// transition definitions - only fade is defined here, transition pack defines the rest
991$.fn.smooth.transitions = {
992	fade: function($cont, $slides, opts) {
993		$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
994		opts.before.push(function(curr,next,opts) {
995			$.fn.smooth.commonReset(curr,next,opts);
996			opts.cssBefore.opacity = 0;
997		});
998		opts.animIn	   = { opacity: 1 };
999		opts.animOut   = { opacity: 0 };
1000		opts.cssBefore = { top: 0, left: 0 };
1001	}
1002};
1003
1004$.fn.smooth.ver = function() { return ver; };
1005
1006// override these globally if you like (they are all optional)
1007$.fn.smooth.defaults = {
1008    activePagerClass: 'activeSlide', // class name used for the active pager link
1009    after:            null,     // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
1010    allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
1011    animIn:           null,     // properties that define how the slide animates in
1012    animInDelay:      0,        // allows delay before next slide transitions in	
1013    animOut:          null,     // properties that define how the slide animates out
1014    animOutDelay:     0,        // allows delay before current slide transitions out
1015    aspect:           false,    // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
1016    autostop:         0,        // true to end slideshow after X transitions (where X == slide count)
1017    autostopCount:    0,        // number of transitions (optionally used with autostop to define X)
1018    backwards:        false,    // true to start slideshow at last slide and move backwards through the stack
1019    before:           null,     // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
1020    center:           null,     // set to true to have smooth add top/left margin to each slide (use with width and height options)
1021    cleartype:        !$.support.opacity,  // true if clearType corrections should be applied (for IE)
1022    cleartypeNoBg:    false,    // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
1023    containerResize:  1,        // resize container to fit largest slide
1024    containerResizeHeight:  0,  // resize containers height to fit the largest slide but leave the width dynamic
1025    continuous:       0,        // true to start next transition immediately after current one completes
1026    cssAfter:         null,     // properties that defined the state of the slide after transitioning out
1027    cssBefore:        null,     // properties that define the initial state of the slide before transitioning in
1028    delay:            0,        // additional delay (in ms) for first transition (hint: can be negative)
1029    easeIn:           null,     // easing for "in" transition
1030    easeOut:          null,     // easing for "out" transition
1031    easing:           null,     // easing method for both in and out transitions
1032    end:              null,     // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
1033    fastOnEvent:      0,        // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
1034    fit:              0,        // force slides to fit container
1035    fx:               'fade',   // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
1036    fxFn:             null,     // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
1037    height:           'auto',   // container height (if the 'fit' option is true, the slides will be set to this height as well)
1038    manualTrump:      true,     // causes manual transition to stop an active transition instead of being ignored
1039    metaAttr:         'smooth',  // data- attribute that holds the option data for the slideshow
1040    next:             null,     // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
1041    nowrap:           0,        // true to prevent slideshow from wrapping
1042    onPagerEvent:     null,     // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
1043    onPrevNextEvent:  null,     // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
1044    pager:            null,     // element, jQuery object, or jQuery selector string for the element to use as pager container
1045    pagerAnchorBuilder: null,   // callback fn for building anchor links:  function(index, DOMelement)
1046    pagerEvent:       'click.smooth', // name of event which drives the pager navigation
1047    pause:            0,        // true to enable "pause on hover"
1048    pauseOnPagerHover: 0,       // true to pause when hovering over pager link
1049    prev:             null,     // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
1050    prevNextEvent:    'click.smooth',// event which drives the manual transition to the previous or next slide
1051    random:           0,        // true for random, false for sequence (not applicable to shuffle fx)
1052    randomizeEffects: 1,        // valid when multiple effects are used; true to make the effect sequence random
1053    requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
1054    requeueTimeout:   250,      // ms delay for requeue
1055    rev:              0,        // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
1056    shuffle:          null,     // coords for shuffle animation, ex: { top:15, left: 200 }
1057    skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
1058    slideExpr:        null,     // expression for selecting slides (if something other than all children is required)
1059    slideResize:      1,        // force slide width/height to fixed size before every transition
1060    speed:            1000,     // speed of the transition (any valid fx speed value)
1061    speedIn:          null,     // speed of the 'in' transition
1062    speedOut:         null,     // speed of the 'out' transition
1063    startingSlide:    undefined,// zero-based index of the first slide to be displayed
1064    sync:             1,        // true if in/out transitions should occur simultaneously
1065    timeout:          4000,     // milliseconds between slide transitions (0 to disable auto advance)
1066    timeoutFn:        null,     // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
1067    updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style)
1068    width:            null      // container width (if the 'fit' option is true, the slides will be set to this width as well)
1069};
1070
1071})(jQuery);
1072
1073
1074/*!
1075 * jQuery Cycle Plugin Transition Definitions
1076 * This script is a plugin for the jQuery Cycle Plugin
1077 * Examples and documentation at: http://malsup.com/jquery/smooth/
1078 * Copyright (c) 2007-2010 M. Alsup
1079 * Version:	 2.73
1080 * Dual licensed under the MIT and GPL licenses:
1081 * http://www.opensource.org/licenses/mit-license.php
1082 * http://www.gnu.org/licenses/gpl.html
1083 */
1084(function($) {
1085"use strict";
1086
1087//
1088// These functions define slide initialization and properties for the named
1089// transitions. To save file size feel free to remove any of these that you
1090// don't need.
1091//
1092$.fn.smooth.transitions.none = function($cont, $slides, opts) {
1093	opts.fxFn = function(curr,next,opts,after){
1094		$(next).show();
1095		$(curr).hide();
1096		after();
1097	};
1098};
1099
1100// not a cross-fade, fadeout only fades out the top slide
1101$.fn.smooth.transitions.fadeout = function($cont, $slides, opts) {
1102	$slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
1103	opts.before.push(function(curr,next,opts,w,h,rev) {
1104		$(curr).css('zIndex',opts.slideCount + (rev !== true ? 1 : 0));
1105		$(next).css('zIndex',opts.slideCount + (rev !== true ? 0 : 1));
1106	});
1107	opts.animIn.opacity = 1;
1108	opts.animOut.opacity = 0;
1109	opts.cssBefore.opacity = 1;
1110	opts.cssBefore.display = 'block';
1111	opts.cssAfter.zIndex = 0;
1112};
1113
1114// scrollUp/Down/Left/Right
1115$.fn.smooth.transitions.scrollUp = function($cont, $slides, opts) {
1116	$cont.css('overflow','hidden');
1117	opts.before.push($.fn.smooth.commonReset);
1118	var h = $cont.height();
1119	opts.cssBefore.top = h;
1120	opts.cssBefore.left = 0;
1121	opts.cssFirst.top = 0;
1122	opts.animIn.top = 0;
1123	opts.animOut.top = -h;
1124};
1125$.fn.smooth.transitions.scrollDown = function($cont, $slides, opts) {
1126	$cont.css('overflow','hidden');
1127	opts.before.push($.fn.smooth.commonReset);
1128	var h = $cont.height();
1129	opts.cssFirst.top = 0;
1130	opts.cssBefore.top = -h;
1131	opts.cssBefore.left = 0;
1132	opts.animIn.top = 0;
1133	opts.animOut.top = h;
1134};
1135$.fn.smooth.transitions.scrollLeft = function($cont, $slides, opts) {
1136	$cont.css('overflow','hidden');
1137	opts.before.push($.fn.smooth.commonReset);
1138	var w = $cont.width();
1139	opts.cssFirst.left = 0;
1140	opts.cssBefore.left = w;
1141	opts.cssBefore.top = 0;
1142	opts.animIn.left = 0;
1143	opts.animOut.left = 0-w;
1144};
1145$.fn.smooth.transitions.scrollRight = function($cont, $slides, opts) {
1146	$cont.css('overflow','hidden');
1147	opts.before.push($.fn.smooth.commonReset);
1148	var w = $cont.width();
1149	opts.cssFirst.left = 0;
1150	opts.cssBefore.left = -w;
1151	opts.cssBefore.top = 0;
1152	opts.animIn.left = 0;
1153	opts.animOut.left = w;
1154};
1155$.fn.smooth.transitions.scrollHorz = function($cont, $slides, opts) {
1156	$cont.css('overflow','hidden').width();
1157	opts.before.push(function(curr, next, opts, fwd) {
1158		if (opts.rev)
1159			fwd = !fwd;
1160		$.fn.smooth.commonReset(curr,next,opts);
1161		opts.cssBefore.left = fwd ? (next.smoothW-1) : (1-next.smoothW);
1162		opts.animOut.left = fwd ? -curr.smoothW : curr.smoothW;
1163	});
1164	opts.cssFirst.left = 0;
1165	opts.cssBefore.top = 0;
1166	opts.animIn.left = 0;
1167	opts.animOut.top = 0;
1168};
1169$.fn.smooth.transitions.scrollVert = function($cont, $slides, opts) {
1170	$cont.css('overflow','hidden');
1171	opts.before.push(function(curr, next, opts, fwd) {
1172		if (opts.rev)
1173			fwd = !fwd;
1174		$.fn.smooth.commonReset(curr,next,opts);
1175		opts.cssBefore.top = fwd ? (1-next.smoothH) : (next.smoothH-1);
1176		opts.animOut.top = fwd ? curr.smoothH : -curr.smoothH;
1177	});
1178	opts.cssFirst.top = 0;
1179	opts.cssBefore.left = 0;
1180	opts.animIn.top = 0;
1181	opts.animOut.left = 0;
1182};
1183
1184// slideX/slideY
1185$.fn.smooth.transitions.slideX = function($cont, $slides, opts) {
1186	opts.before.push(function(curr, next, opts) {
1187		$(opts.elements).not(curr).hide();
1188		$.fn.smooth.commonReset(curr,next,opts,false,true);
1189		opts.animIn.width = next.smoothW;
1190	});
1191	opts.cssBefore.left = 0;
1192	opts.cssBefore.top = 0;
1193	opts.cssBefore.width = 0;
1194	opts.animIn.width = 'show';
1195	opts.animOut.width = 0;
1196};
1197$.fn.smooth.transitions.slideY = function($cont, $slides, opts) {
1198	opts.before.push(function(curr, next, opts) {
1199		$(opts.elements).not(curr).hide();
1200		$.fn.smooth.commonReset(curr,next,opts,true,false);
1201		opts.animIn.height = next.smoothH;
1202	});
1203	opts.cssBefore.left = 0;
1204	opts.cssBefore.top = 0;
1205	opts.cssBefore.height = 0;
1206	opts.animIn.height = 'show';
1207	opts.animOut.height = 0;
1208};
1209
1210// shuffle
1211$.fn.smooth.transitions.shuffle = function($cont, $slides, opts) {
1212	var i, w = $cont.css('overflow', 'visible').width();
1213	$slides.css({left: 0, top: 0});
1214	opts.before.push(function(curr,next,opts) {
1215		$.fn.smooth.commonReset(curr,next,opts,true,true,true);
1216	});
1217	// only adjust speed once!
1218	if (!opts.speedAdjusted) {
1219		opts.speed = opts.speed / 2; // shuffle has 2 transitions
1220		opts.speedAdjusted = true;
1221	}
1222	opts.random = 0;
1223	opts.shuffle = opts.shuffle || {left:-w, top:15};
1224	opts.els = [];
1225	for (i=0; i < $slides.length; i++)
1226		opts.els.push($slides[i]);
1227
1228	for (i=0; i < opts.currSlide; i++)
1229		opts.els.push(opts.els.shift());
1230
1231	// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
1232	opts.fxFn = function(curr, next, opts, cb, fwd) {
1233		if (opts.rev)
1234			fwd = !fwd;
1235		var $el = fwd ? $(curr) : $(next);
1236		$(next).css(opts.cssBefore);
1237		var count = opts.slideCount;
1238		$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
1239			var hops = $.fn.smooth.hopsFromLast(opts, fwd);
1240			for (var k=0; k < hops; k++) {
1241				if (fwd)
1242					opts.els.push(opts.els.shift());
1243				else
1244					opts.els.unshift(opts.els.pop());
1245			}
1246			if (fwd) {
1247				for (var i=0, len=opts.els.length; i < len; i++)
1248					$(opts.els[i]).css('z-index', len-i+count);
1249			}
1250			else {
1251				var z = $(curr).css('z-index');
1252				$el.css('z-index', parseInt(z,10)+1+count);
1253			}
1254			$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
1255				$(fwd ? this : curr).hide();
1256				if (cb) cb();
1257			});
1258		});
1259	};
1260	$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
1261};
1262
1263// turnUp/Down/Left/Right
1264$.fn.smooth.transitions.turnUp = function($cont, $slides, opts) {
1265	opts.before.push(function(curr, next, opts) {
1266		$.fn.smooth.commonReset(curr,next,opts,true,false);
1267		opts.cssBefore.top = next.smoothH;
1268		opts.animIn.height = next.smoothH;
1269		opts.animOut.width = next.smoothW;
1270	});
1271	opts.cssFirst.top = 0;
1272	opts.cssBefore.left = 0;
1273	opts.cssBefore.height = 0;
1274	opts.animIn.top = 0;
1275	opts.animOut.height = 0;
1276};
1277$.fn.smooth.transitions.turnDown = function($cont, $slides, opts) {
1278	opts.before.push(function(curr, next, opts) {
1279		$.fn.smooth.commonReset(curr,next,opts,true,false);
1280		opts.animIn.height = next.smoothH;
1281		opts.animOut.top   = curr.smoothH;
1282	});
1283	opts.cssFirst.top = 0;
1284	opts.cssBefore.left = 0;
1285	opts.cssBefore.top = 0;
1286	opts.cssBefore.height = 0;
1287	opts.animOut.height = 0;
1288};
1289$.fn.smooth.transitions.turnLeft = function($cont, $slides, opts) {
1290	opts.before.push(function(curr, next, opts) {
1291		$.fn.smooth.commonReset(curr,next,opts,false,true);
1292		opts.cssBefore.left = next.smoothW;
1293		opts.animIn.width = next.smoothW;
1294	});
1295	opts.cssBefore.top = 0;
1296	opts.cssBefore.width = 0;
1297	opts.animIn.left = 0;
1298	opts.animOut.width = 0;
1299};
1300$.fn.smooth.transitions.turnRight = function($cont, $slides, opts) {
1301	opts.before.push(function(curr, next, opts) {
1302		$.fn.smooth.commonReset(curr,next,opts,false,true);
1303		opts.animIn.width = next.smoothW;
1304		opts.animOut.left = curr.smoothW;
1305	});
1306	$.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
1307	opts.animIn.left = 0;
1308	opts.animOut.width = 0;
1309};
1310
1311// zoom
1312$.fn.smooth.transitions.zoom = function($cont, $slides, opts) {
1313	opts.before.push(function(curr, next, opts) {
1314		$.fn.smooth.commonReset(curr,next,opts,false,false,true);
1315		opts.cssBefore.top = next.smoothH/2;
1316		opts.cssBefore.left = next.smoothW/2;
1317		$.extend(opts.animIn, { top: 0, left: 0, width: next.smoothW, height: next.smoothH });
1318		$.extend(opts.animOut, { width: 0, height: 0, top: curr.smoothH/2, left: curr.smoothW/2 });
1319	});
1320	opts.cssFirst.top = 0;
1321	opts.cssFirst.left = 0;
1322	opts.cssBefore.width = 0;
1323	opts.cssBefore.height = 0;
1324};
1325
1326// fadeZoom
1327$.fn.smooth.transitions.fadeZoom = function($cont, $slides, opts) {
1328	opts.before.push(function(curr, next, opts) {
1329		$.fn.smooth.commonReset(curr,next,opts,false,false);
1330		opts.cssBefore.left = next.smoothW/2;
1331		opts.cssBefore.top = next.smoothH/2;
1332		$.extend(opts.animIn, { top: 0, left: 0, width: next.smoothW, height: next.smoothH });
1333	});
1334	opts.cssBefore.width = 0;
1335	opts.cssBefore.height = 0;
1336	opts.animOut.opacity = 0;
1337};
1338
1339// blindX
1340$.fn.smooth.transitions.blindX = function($cont, $slides, opts) {
1341	var w = $cont.css('overflow','hidden').width();
1342	opts.before.push(function(curr, next, opts) {
1343		$.fn.smooth.commonReset(curr,next,opts);
1344		opts.animIn.width = next.smoothW;
1345		opts.animOut.left   = curr.smoothW;
1346	});
1347	opts.cssBefore.left = w;
1348	opts.cssBefore.top = 0;
1349	opts.animIn.left = 0;
1350	opts.animOut.left = w;
1351};
1352// blindY
1353$.fn.smooth.transitions.blindY = function($cont, $slides, opts) {
1354	var h = $cont.css('overflow','hidden').height();
1355	opts.before.push(function(curr, next, opts) {
1356		$.fn.smooth.commonReset(curr,next,opts);
1357		opts.animIn.height = next.smoothH;
1358		opts.animOut.top   = curr.smoothH;
1359	});
1360	opts.cssBefore.top = h;
1361	opts.cssBefore.left = 0;
1362	opts.animIn.top = 0;
1363	opts.animOut.top = h;
1364};
1365// blindZ
1366$.fn.smooth.transitions.blindZ = function($cont, $slides, opts) {
1367	var h = $cont.css('overflow','hidden').height();
1368	var w = $cont.width();
1369	opts.before.push(function(curr, next, opts) {
1370		$.fn.smooth.commonReset(curr,next,opts);
1371		opts.animIn.height = next.smoothH;
1372		opts.animOut.top   = curr.smoothH;
1373	});
1374	opts.cssBefore.top = h;
1375	opts.cssBefore.left = w;
1376	opts.animIn.top = 0;
1377	opts.animIn.left = 0;
1378	opts.animOut.top = h;
1379	opts.animOut.left = w;
1380};
1381
1382// growX - grow horizontally from centered 0 width
1383$.fn.smooth.transitions.growX = function($cont, $slides, opts) {
1384	opts.before.push(function(curr, next, opts) {
1385		$.fn.smooth.commonReset(curr,next,opts,false,true);
1386		opts.cssBefore.left = this.smoothW/2;
1387		opts.animIn.left = 0;
1388		opts.animIn.width = this.smoothW;
1389		opts.animOut.left = 0;
1390	});
1391	opts.cssBefore.top = 0;
1392	opts.cssBefore.width = 0;
1393};
1394// growY - grow vertically from centered 0 height
1395$.fn.smooth.transitions.growY = function($cont, $slides, opts) {
1396	opts.before.push(function(curr, next, opts) {
1397		$.fn.smooth.commonReset(curr,next,opts,true,false);
1398		opts.cssBefore.top = this.smoothH/2;
1399		opts.animIn.top = 0;
1400		opts.animIn.height = this.smoothH;
1401		opts.animOut.top = 0;
1402	});
1403	opts.cssBefore.height = 0;
1404	opts.cssBefore.left = 0;
1405};
1406
1407// curtainX - squeeze in both edges horizontally
1408$.fn.smooth.transitions.curtainX = function($cont, $slides, opts) {
1409	opts.before.push(function(curr, next, opts) {
1410		$.fn.smooth.commonReset(curr,next,opts,false,true,true);
1411		opts.cssBefore.left = next.smoothW/2;
1412		opts.animIn.left = 0;
1413		opts.animIn.width = this.smoothW;
1414		opts.animOut.left = curr.smoothW/2;
1415		opts.animOut.width = 0;
1416	});
1417	opts.cssBefore.top = 0;
1418	opts.cssBefore.width = 0;
1419};
1420// curtainY - squeeze in both edges vertically
1421$.fn.smooth.transitions.curtainY = function($cont, $slides, opts) {
1422	opts.before.push(function(curr, next, opts) {
1423		$.fn.smooth.commonReset(curr,next,opts,true,false,true);
1424		opts.cssBefore.top = next.smoothH/2;
1425		opts.animIn.top = 0;
1426		opts.animIn.height = next.smoothH;
1427		opts.animOut.top = curr.smoothH/2;
1428		opts.animOut.height = 0;
1429	});
1430	opts.cssBefore.height = 0;
1431	opts.cssBefore.left = 0;
1432};
1433
1434// cover - curr slide covered by next slide
1435$.fn.smooth.transitions.cover = function($cont, $slides, opts) {
1436	var d = opts.direction || 'left';
1437	var w = $cont.css('overflow','hidden').width();
1438	var h = $cont.height();
1439	opts.before.push(function(curr, next, opts) {
1440		$.fn.smooth.commonReset(curr,next,opts);
1441		opts.cssAfter.display = '';
1442		if (d == 'right')
1443			opts.cssBefore.left = -w;
1444		else if (d == 'up')
1445			opts.cssBefore.top = h;
1446		else if (d == 'down')
1447			opts.cssBefore.top = -h;
1448		else
1449			opts.cssBefore.left = w;
1450	});
1451	opts.animIn.left = 0;
1452	opts.animIn.top = 0;
1453	opts.cssBefore.top = 0;
1454	opts.cssBefore.left = 0;
1455};
1456
1457// uncover - curr slide moves off next slide
1458$.fn.smooth.transitions.uncover = function($cont, $slides, opts) {
1459	var d = opts.direction || 'left';
1460	var w = $cont.css('overflow','hidden').width();
1461	var h = $cont.height();
1462	opts.before.push(function(curr, next, opts) {
1463		$.fn.smooth.commonReset(curr,next,opts,true,true,true);
1464		if (d == 'right')
1465			opts.animOut.left = w;
1466		else if (d == 'up')
1467			opts.animOut.top = -h;
1468		else if (d == 'down')
1469			opts.animOut.top = h;
1470		else
1471			opts.animOut.left = -w;
1472	});
1473	opts.animIn.left = 0;
1474	opts.animIn.top = 0;
1475	opts.cssBefore.top = 0;
1476	opts.cssBefore.left = 0;
1477};
1478
1479// toss - move top slide and fade away
1480$.fn.smooth.transitions.toss = function($cont, $slides, opts) {
1481	var w = $cont.css('overflow','visible').width();
1482	var h = $cont.height();
1483	opts.before.push(function(curr, next, opts) {
1484		$.fn.smooth.commonReset(curr,next,opts,true,true,true);
1485		// provide default toss settings if animOut not provided
1486		if (!opts.animOut.left && !opts.animOut.top)
1487			$.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
1488		else
1489			opts.animOut.opacity = 0;
1490	});
1491	opts.cssBefore.left = 0;
1492	opts.cssBefore.top = 0;
1493	opts.animIn.left = 0;
1494};
1495
1496// wipe - clip animation
1497$.fn.smooth.transitions.wipe = function($cont, $slides, opts) {
1498	var w = $cont.css('overflow','hidden').width();
1499	var h = $cont.height();
1500	opts.cssBefore = opts.cssBefore || {};
1501	var clip;
1502	if (opts.clip) {
1503		if (/l2r/.test(opts.clip))
1504			clip = 'rect(0px 0px '+h+'px 0px)';
1505		else if (/r2l/.test(opts.clip))
1506			clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
1507		else if (/t2b/.test(opts.clip))
1508			clip = 'rect(0px '+w+'px 0px 0px)';
1509		else if (/b2t/.test(opts.clip))
1510			clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
1511		else if (/zoom/.test(opts.clip)) {
1512			var top = parseInt(h/2,10);
1513			var left = parseInt(w/2,10);
1514			clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
1515		}
1516	}
1517
1518	opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
1519
1520	var d = opts.cssBefore.clip.match(/(\d+)/g);
1521	var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
1522
1523	opts.before.push(function(curr, next, opts) {
1524		if (curr == next) return;
1525		var $curr = $(curr), $next = $(next);
1526		$.fn.smooth.commonReset(curr,next,opts,true,true,false);
1527		opts.cssAfter.display = 'block';
1528
1529		var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
1530		(function f() {
1531			var tt = t ? t - parseInt(step * (t/count),10) : 0;
1532			var ll = l ? l - parseInt(step * (l/count),10) : 0;
1533			var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
1534			var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
1535			$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
1536			(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
1537		})();
1538	});
1539	$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
1540	opts.animIn	   = { left: 0 };
1541	opts.animOut   = { left: 0 };
1542};
1543
1544})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.