PageSourceSearch

https://mydesignpad.com/js/jquery.cycle.all.js

js mydesignpad.com collected 2026-10-03 20:46:07 UTC 41,712 bytes, 1,211 lines download raw bytes

1/*!
2 * jQuery Cycle Plugin (with Transition Definitions)
3 * Examples and documentation at: http://jquery.malsup.com/cycle/
4 * Copyright (c) 2007-2009 M. Alsup
5 * Version: 2.65 (07-APR-2009)
6 * Dual licensed under the MIT and GPL licenses:
7 * http://www.opensource.org/licenses/mit-license.php
8 * http://www.gnu.org/licenses/gpl.html
9 * Requires: jQuery v1.2.6 or later
10 *
11 * Originally based on the work of:
12 *	1) Matt Oakes
13 *	2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
14 *	3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
15 */
16;(function($) {
17
18var ver = '2.65';
19
20// if $.support is not defined (pre jQuery 1.3) add what I need
21if ($.support == undefined) {
22	$.support = {
23		opacity: !($.browser.msie)
24	};
25}
26
27function log() {
28	if (window.console && window.console.log)
29		window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
30	//$('body').append('<div>'+Array.prototype.join.call(arguments,' ')+'</div>');
31};
32
33// the options arg can be...
34//   a number  - indicates an immediate transition should occur to the given slide index
35//   a string  - 'stop', 'pause', 'resume', or the name of a transition effect (ie, 'fade', 'zoom', etc)
36//   an object - properties to control the slideshow
37//
38// the arg2 arg can be...
39//   the name of an fx (only used in conjunction with a numeric value for 'options')
40//   the value true (only used in conjunction with a options == 'resume') and indicates
41//     that the resume should occur immediately (not wait for next timeout)
42
43$.fn.cycle = function(options, arg2) {
44	var o = { s: this.selector, c: this.context };
45
46    // in 1.3+ we can fix mistakes with the ready state
47	if (this.length == 0 && options != 'stop') {
48        if (!$.isReady && o.s) {
49            log('DOM not ready, queuing slideshow')
50            $(function() {
51                $(o.s,o.c).cycle(options,arg2);
52            });
53            return this;
54        }
55		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
56		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
57		return this;
58	}
59
60    // iterate the matched nodeset
61	return this.each(function() {
62        options = handleArguments(this, options, arg2);
63        if (options === false)
64            return;
65
66		// stop existing slideshow for this container (if there is one)
67		if (this.cycleTimeout)
68            clearTimeout(this.cycleTimeout);
69		this.cycleTimeout = this.cyclePause = 0;
70
71		var $cont = $(this);
72		var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
73		var els = $slides.get();
74		if (els.length < 2) {
75			log('terminating; too few slides: ' + els.length);
76			return;
77		}
78
79        var opts = buildOptions($cont, $slides, els, options, o);
80        if (opts === false)
81            return;
82
83        // if it's an auto slideshow, kick it off
84		if (opts.timeout || opts.continuous)
85			this.cycleTimeout = setTimeout(function(){go(els,opts,0,!opts.rev)},
86				opts.continuous ? 10 : opts.timeout + (opts.delay||0));
87	});
88};
89
90// process the args that were passed to the plugin fn
91function handleArguments(cont, options, arg2) {
92	if (cont.cycleStop == undefined)
93		cont.cycleStop = 0;
94	if (options === undefined || options === null)
95		options = {};
96	if (options.constructor == String) {
97		switch(options) {
98		case 'stop':
99			cont.cycleStop++; // callbacks look for change
100			if (cont.cycleTimeout)
101                clearTimeout(cont.cycleTimeout);
102			cont.cycleTimeout = 0;
103			$(cont).removeData('cycle.opts');
104			return false;
105		case 'pause':
106			cont.cyclePause = 1;
107			return false;
108		case 'resume':
109			cont.cyclePause = 0;
110			if (arg2 === true) { // resume now!
111				options = $(cont).data('cycle.opts');
112				if (!options) {
113					log('options not found, can not resume');
114					return false;
115				}
116				if (cont.cycleTimeout) {
117					clearTimeout(cont.cycleTimeout);
118					cont.cycleTimeout = 0;
119				}
120				go(options.elements, options, 1, 1);
121			}
122			return false;
123		default:
124			options = { fx: options };
125		};
126	}
127	else if (options.constructor == Number) {
128		// go to the requested slide
129		var num = options;
130		options = $(cont).data('cycle.opts');
131		if (!options) {
132			log('options not found, can not advance slide');
133			return false;
134		}
135		if (num < 0 || num >= options.elements.length) {
136			log('invalid slide index: ' + num);
137			return false;
138		}
139		options.nextSlide = num;
140		if (cont.cycleTimeout) {
141			clearTimeout(cont.cycleTimeout);
142			cont.cycleTimeout = 0;
143		}
144        if (typeof arg2 == 'string')
145            options.oneTimeFx = arg2;
146		go(options.elements, options, 1, num >= options.currSlide);
147		return false;
148	}
149    return options;
150};
151
152function removeFilter(el, opts) {
153	if (!$.support.opacity && opts.cleartype && el.style.filter) {
154		try { el.style.removeAttribute('filter'); }
155		catch(smother) {} // handle old opera versions
156	}
157};
158
159// one-time initialization
160function buildOptions($cont, $slides, els, options, o) {
161	// support metadata plugin (v1.0 and v2.0)
162	var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
163	if (opts.autostop)
164		opts.countdown = opts.autostopCount || els.length;
165
166    var cont = $cont[0];
167	$cont.data('cycle.opts', opts);
168	opts.$cont = $cont;
169	opts.stopCount = cont.cycleStop;
170	opts.elements = els;
171	opts.before = opts.before ? [opts.before] : [];
172	opts.after = opts.after ? [opts.after] : [];
173	opts.after.unshift(function(){ opts.busy=0; });
174
175    // push some after callbacks
176	if (!$.support.opacity && opts.cleartype)
177		opts.after.push(function() { removeFilter(this, opts); });
178	if (opts.continuous)
179		opts.after.push(function() { go(els,opts,0,!opts.rev); });
180
181    saveOriginalOpts(opts);
182
183	// clearType corrections
184	if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
185		clearTypeFix($slides);
186
187    // container requires non-static position so that slides can be position within
188	if ($cont.css('position') == 'static')
189		$cont.css('position', 'relative');
190	if (opts.width)
191		$cont.width(opts.width);
192	if (opts.height && opts.height != 'auto')
193		$cont.height(opts.height);
194
195	if (opts.startingSlide)
196        opts.startingSlide = parseInt(opts.startingSlide);
197
198    // if random, mix up the slide array
199	if (opts.random) {
200		opts.randomMap = [];
201		for (var i = 0; i < els.length; i++)
202			opts.randomMap.push(i);
203		opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
204		opts.randomIndex = 0;
205		opts.startingSlide = opts.randomMap[0];
206	}
207	else if (opts.startingSlide >= els.length)
208		opts.startingSlide = 0; // catch bogus input
209	opts.currSlide = opts.startingSlide = opts.startingSlide || 0;
210	var first = opts.startingSlide;
211
212    // set position and zIndex on all the slides
213	$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
214		var z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
215		$(this).css('z-index', z)
216	});
217
218    // make sure first slide is visible
219	$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
220	removeFilter(els[first], opts);
221
222    // stretch slides
223	if (opts.fit && opts.width)
224		$slides.width(opts.width);
225	if (opts.fit && opts.height && opts.height != 'auto')
226		$slides.height(opts.height);
227
228    // stretch container
229	var reshape = opts.containerResize && !$cont.innerHeight();
230	if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
231		var maxw = 0, maxh = 0;
232		for(var i=0; i < els.length; i++) {
233			var $e = $(els[i]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
234            if (!w) w = e.offsetWidth;
235            if (!h) h = e.offsetHeight;
236			maxw = w > maxw ? w : maxw;
237			maxh = h > maxh ? h : maxh;
238		}
239        if (maxw > 0 && maxh > 0)
240		    $cont.css({width:maxw+'px',height:maxh+'px'});
241	}
242
243	if (opts.pause)
244		$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});
245
246    if (supportMultiTransitions(opts) === false)
247		return false;
248
249	// run transition init fn
250	if (!opts.multiFx) {
251		var init = $.fn.cycle.transitions[opts.fx];
252		if ($.isFunction(init))
253			init($cont, $slides, opts);
254		else if (opts.fx != 'custom' && !opts.multiFx) {
255			log('unknown transition: ' + opts.fx,'; slideshow terminating');
256			return false;
257		}
258	}
259
260	// apparently a lot of people use image slideshows without height/width attributes on the images.
261	// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
262	var requeue = false;
263	options.requeueAttempts = options.requeueAttempts || 0;
264	$slides.each(function() {
265        // try to get height/width of each slide
266		var $el = $(this);
267	    this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
268		this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
269
270		if ( $el.is('img') ) {
271			// sigh..  sniffing, hacking, shrugging...
272			var loadingIE    = ($.browser.msie  && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
273			var loadingOp    = ($.browser.opera && this.cycleW == 42 && this.cycleH == 19 && !this.complete);
274			var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
275
276			// don't requeue for images that are still loading but have a valid size
277			if (loadingIE || loadingOp || loadingOther) {
278				if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
279					log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
280					setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
281					requeue = true;
282					return false; // break each loop
283				}
284				else {
285					log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
286				}
287			}
288		}
289		return true;
290	});
291
292	if (requeue)
293		return false;
294
295	opts.cssBefore = opts.cssBefore || {};
296	opts.animIn = opts.animIn || {};
297	opts.animOut = opts.animOut || {};
298
299	$slides.not(':eq('+first+')').css(opts.cssBefore);
300	if (opts.cssFirst)
301		$($slides[first]).css(opts.cssFirst);
302
303	if (opts.timeout) {
304		opts.timeout = parseInt(opts.timeout);
305		// ensure that timeout and speed settings are sane
306		if (opts.speed.constructor == String)
307			opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed);
308		if (!opts.sync)
309			opts.speed = opts.speed / 2;
310		while((opts.timeout - opts.speed) < 250) // sanitize timeout
311			opts.timeout += opts.speed;
312	}
313	if (opts.easing)
314		opts.easeIn = opts.easeOut = opts.easing;
315	if (!opts.speedIn)
316		opts.speedIn = opts.speed;
317	if (!opts.speedOut)
318		opts.speedOut = opts.speed;
319
320	opts.slideCount = els.length;
321	opts.currSlide = opts.lastSlide = first;
322	if (opts.random) {
323		opts.nextSlide = opts.currSlide;
324		if (++opts.randomIndex == els.length)
325			opts.randomIndex = 0;
326		opts.nextSlide = opts.randomMap[opts.randomIndex];
327	}
328	else
329		opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
330
331	// fire artificial events
332	var e0 = $slides[first];
333	if (opts.before.length)
334		opts.before[0].apply(e0, [e0, e0, opts, true]);
335	if (opts.after.length > 1)
336		opts.after[1].apply(e0, [e0, e0, opts, true]);
337
338	if (opts.next)
339		$(opts.next).click(function(){return advance(opts,opts.rev?-1:1)});
340	if (opts.prev)
341		$(opts.prev).click(function(){return advance(opts,opts.rev?1:-1)});
342	if (opts.pager)
343		buildPager(els,opts);
344
345    exposeAddSlide(opts, els);
346
347    return opts;
348};
349
350// save off original opts so we can restore after clearing state
351function saveOriginalOpts(opts) {
352    opts.original = { before: [], after: [] };
353    opts.original.cssBefore = $.extend({}, opts.cssBefore);
354    opts.original.cssAfter  = $.extend({}, opts.cssAfter);
355    opts.original.animIn    = $.extend({}, opts.animIn);
356    opts.original.animOut   = $.extend({}, opts.animOut);
357	$.each(opts.before, function() { opts.original.before.push(this); });
358	$.each(opts.after,  function() { opts.original.after.push(this); });
359};
360
361function supportMultiTransitions(opts) {
362    var txs = $.fn.cycle.transitions;
363	// look for multiple effects
364	if (opts.fx.indexOf(',') > 0) {
365		opts.multiFx = true;
366		opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
367		// discard any bogus effect names
368		for (var i=0; i < opts.fxs.length; i++) {
369			var fx = opts.fxs[i];
370			var tx = txs[fx];
371			if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
372				log('discarding unknown transition: ',fx);
373				opts.fxs.splice(i,1);
374				i--;
375			}
376		}
377		// if we have an empty list then we threw everything away!
378		if (!opts.fxs.length) {
379			log('No valid transitions named; slideshow terminating.');
380			return false;
381		}
382	}
383	else if (opts.fx == 'all') {  // auto-gen the list of transitions
384		opts.multiFx = true;
385		opts.fxs = [];
386		for (p in txs) {
387			var tx = txs[p];
388			if (txs.hasOwnProperty(p) && $.isFunction(tx))
389				opts.fxs.push(p);
390		}
391	}
392	if (opts.multiFx && opts.randomizeEffects) {
393		// munge the fxs array to make effect selection random
394		var r1 = Math.floor(Math.random() * 20) + 30;
395		for (var i = 0; i < r1; i++) {
396			var r2 = Math.floor(Math.random() * opts.fxs.length);
397			opts.fxs.push(opts.fxs.splice(r2,1)[0]);
398		}
399		log('randomized fx sequence: ',opts.fxs);
400	}
401	return true;
402};
403
404// provide a mechanism for adding slides after the slideshow has started
405function exposeAddSlide(opts, els) {
406	opts.addSlide = function(newSlide, prepend) {
407		var $s = $(newSlide), s = $s[0];
408		if (!opts.autostopCount)
409			opts.countdown++;
410		els[prepend?'unshift':'push'](s);
411		if (opts.els)
412			opts.els[prepend?'unshift':'push'](s); // shuffle needs this
413		opts.slideCount = els.length;
414
415		$s.css('position','absolute');
416		$s[prepend?'prependTo':'appendTo'](opts.$cont);
417
418		if (prepend) {
419			opts.currSlide++;
420			opts.nextSlide++;
421		}
422
423		if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
424			clearTypeFix($s);
425
426		if (opts.fit && opts.width)
427			$s.width(opts.width);
428		if (opts.fit && opts.height && opts.height != 'auto')
429			$slides.height(opts.height);
430		s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
431		s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
432
433		$s.css(opts.cssBefore);
434
435		if (opts.pager)
436			$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
437
438		if ($.isFunction(opts.onAddSlide))
439			opts.onAddSlide($s);
440		else
441			$s.hide(); // default behavior
442	};
443}
444
445// reset internal state; we do this on every pass in order to support multiple effects
446$.fn.cycle.resetState = function(opts, fx) {
447    fx = fx || opts.fx;
448	opts.before = []; opts.after = [];
449	opts.cssBefore = $.extend({}, opts.original.cssBefore);
450	opts.cssAfter  = $.extend({}, opts.original.cssAfter);
451	opts.animIn    = $.extend({}, opts.original.animIn);
452	opts.animOut   = $.extend({}, opts.original.animOut);
453	opts.fxFn = null;
454	$.each(opts.original.before, function() { opts.before.push(this); });
455	$.each(opts.original.after,  function() { opts.after.push(this); });
456
457	// re-init
458	var init = $.fn.cycle.transitions[fx];
459	if ($.isFunction(init))
460		init(opts.$cont, $(opts.elements), opts);
461};
462
463// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
464function go(els, opts, manual, fwd) {
465    // opts.busy is true if we're in the middle of an animation
466	if (manual && opts.busy && opts.manualTrump) {
467        // let manual transitions requests trump active ones
468		$(els).stop(true,true);
469		opts.busy = false;
470	}
471    // don't begin another timeout-based transition if there is one active
472	if (opts.busy)
473        return;
474
475	var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
476
477    // stop cycling if we have an outstanding stop request
478	if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
479		return;
480
481    // check to see if we should stop cycling based on autostop options
482	if (!manual && !p.cyclePause &&
483		((opts.autostop && (--opts.countdown <= 0)) ||
484		(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
485		if (opts.end)
486			opts.end(opts);
487		return;
488	}
489
490    // if slideshow is paused, only transition on a manual trigger
491	if (manual || !p.cyclePause) {
492        var fx = opts.fx;
493		// keep trying to get the slide size if we don't have it yet
494		curr.cycleH = curr.cycleH || $(curr).height();
495		curr.cycleW = curr.cycleW || $(curr).width();
496		next.cycleH = next.cycleH || $(next).height();
497		next.cycleW = next.cycleW || $(next).width();
498
499		// support multiple transition types
500		if (opts.multiFx) {
501			if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length)
502				opts.lastFx = 0;
503			fx = opts.fxs[opts.lastFx];
504			opts.currFx = fx;
505		}
506
507        // one-time fx overrides apply to:  $('div').cycle(3,'zoom');
508        if (opts.oneTimeFx) {
509            fx = opts.oneTimeFx;
510            opts.oneTimeFx = null;
511        }
512
513        $.fn.cycle.resetState(opts, fx);
514
515        // run the before callbacks
516		if (opts.before.length)
517			$.each(opts.before, function(i,o) {
518				if (p.cycleStop != opts.stopCount) return;
519				o.apply(next, [curr, next, opts, fwd]);
520			});
521
522        // stage the after callacks
523		var after = function() {
524			$.each(opts.after, function(i,o) {
525				if (p.cycleStop != opts.stopCount) return;
526				o.apply(next, [curr, next, opts, fwd]);
527			});
528		};
529
530		if (opts.nextSlide != opts.currSlide) {
531            // get ready to perform the transition
532			opts.busy = 1;
533			if (opts.fxFn) // fx function provided?
534				opts.fxFn(curr, next, opts, after, fwd);
535			else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
536				$.fn.cycle[opts.fx](curr, next, opts, after);
537			else
538				$.fn.cycle.custom(curr, next, opts, after, manual && opts.fastOnEvent);
539		}
540
541        // calculate the next slide
542		opts.lastSlide = opts.currSlide;
543		if (opts.random) {
544			opts.currSlide = opts.nextSlide;
545			if (++opts.randomIndex == els.length)
546				opts.randomIndex = 0;
547			opts.nextSlide = opts.randomMap[opts.randomIndex];
548		}
549		else { // sequence
550			var roll = (opts.nextSlide + 1) == els.length;
551			opts.nextSlide = roll ? 0 : opts.nextSlide+1;
552			opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
553		}
554
555		if (opts.pager)
556			$.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide);
557	}
558
559    // stage the next transtion
560    var ms = 0;
561	if (opts.timeout && !opts.continuous)
562        ms = getTimeout(curr, next, opts, fwd);
563    else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
564        ms = 10;
565    if (ms > 0)
566        p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.rev) }, ms);
567};
568
569// invoked after transition
570$.fn.cycle.updateActivePagerLink = function(pager, currSlide) {
571	$(pager).find('a').removeClass('activeSlide').filter('a:eq('+currSlide+')').addClass('activeSlide');
572};
573
574// calculate timeout value for current transition
575function getTimeout(curr, next, opts, fwd) {
576	if (opts.timeoutFn) {
577        // call user provided calc fn
578		var t = opts.timeoutFn(curr,next,opts,fwd);
579		if (t !== false)
580			return t;
581	}
582	return opts.timeout;
583};
584
585// expose next/prev function, caller must pass in state
586$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); };
587$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);};
588
589// advance slide forward or back
590function advance(opts, val) {
591    var els = opts.elements;
592	var p = opts.$cont[0], timeout = p.cycleTimeout;
593	if (timeout) {
594		clearTimeout(timeout);
595		p.cycleTimeout = 0;
596	}
597	if (opts.random && val < 0) {
598		// move back to the previously display slide
599		opts.randomIndex--;
600		if (--opts.randomIndex == -2)
601			opts.randomIndex = els.length-2;
602		else if (opts.randomIndex == -1)
603			opts.randomIndex = els.length-1;
604		opts.nextSlide = opts.randomMap[opts.randomIndex];
605	}
606	else if (opts.random) {
607		if (++opts.randomIndex == els.length)
608			opts.randomIndex = 0;
609		opts.nextSlide = opts.randomMap[opts.randomIndex];
610	}
611	else {
612		opts.nextSlide = opts.currSlide + val;
613		if (opts.nextSlide < 0) {
614			if (opts.nowrap) return false;
615			opts.nextSlide = els.length - 1;
616		}
617		else if (opts.nextSlide >= els.length) {
618			if (opts.nowrap) return false;
619			opts.nextSlide = 0;
620		}
621	}
622
623	if ($.isFunction(opts.prevNextClick))
624		opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]);
625	go(els, opts, 1, val>=0);
626	return false;
627};
628
629function buildPager(els, opts) {
630	var $p = $(opts.pager);
631	$.each(els, function(i,o) {
632		$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
633	});
634   $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide);
635};
636
637$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
638	var a = ($.isFunction(opts.pagerAnchorBuilder))
639		? opts.pagerAnchorBuilder(i,el)
640		: '<a href="#">'+(i+1)+'</a>';
641	if (!a)
642		return;
643	var $a = $(a);
644	// don't reparent if anchor is in the dom
645	if ($a.parents('body').length == 0) {
646		var arr = [];
647		if ($p.length > 1) {
648			$p.each(function() {
649				var $clone = $a.clone(true);
650				$(this).append($clone);
651				arr.push($clone);
652			});
653			$a = $(arr);
654		}
655		else {
656			$a.appendTo($p);
657		}
658	}
659
660	$a.bind(opts.pagerEvent, function() {
661		opts.nextSlide = i;
662		var p = opts.$cont[0], timeout = p.cycleTimeout;
663		if (timeout) {
664			clearTimeout(timeout);
665			p.cycleTimeout = 0;
666		}
667		if ($.isFunction(opts.pagerClick))
668			opts.pagerClick(opts.nextSlide, els[opts.nextSlide]);
669		go(els,opts,1,opts.currSlide < i); // trigger the trans
670		return false;
671	});
672	if (opts.pauseOnPagerHover)
673		$a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } );
674};
675
676// helper fn to calculate the number of slides between the current and the next
677$.fn.cycle.hopsFromLast = function(opts, fwd) {
678	var hops, l = opts.lastSlide, c = opts.currSlide;
679	if (fwd)
680		hops = c > l ? c - l : opts.slideCount - l;
681	else
682		hops = c < l ? l - c : l + opts.slideCount - c;
683	return hops;
684};
685
686// fix clearType problems in ie6 by setting an explicit bg color
687// (otherwise text slides look horrible during a fade transition)
688function clearTypeFix($slides) {
689	function hex(s) {
690		s = parseInt(s).toString(16);
691		return s.length < 2 ? '0'+s : s;
692	};
693	function getBg(e) {
694		for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
695			var v = $.css(e,'background-color');
696			if (v.indexOf('rgb') >= 0 ) {
697				var rgb = v.match(/\d+/g);
698				return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
699			}
700			if (v && v != 'transparent')
701				return v;
702		}
703		return '#ffffff';
704	};
705	$slides.each(function() { $(this).css('background-color', getBg(this)); });
706};
707
708// reset common props before the next transition
709$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
710	$(opts.elements).not(curr).hide();
711	opts.cssBefore.opacity = 1;
712	opts.cssBefore.display = 'block';
713	if (w !== false && next.cycleW > 0)
714		opts.cssBefore.width = next.cycleW;
715	if (h !== false && next.cycleH > 0)
716		opts.cssBefore.height = next.cycleH;
717	opts.cssAfter = opts.cssAfter || {};
718	opts.cssAfter.display = 'none';
719	$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
720	$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
721};
722
723// the actual fn for effecting a transition
724$.fn.cycle.custom = function(curr, next, opts, cb, speedOverride) {
725	var $l = $(curr), $n = $(next);
726	var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
727	$n.css(opts.cssBefore);
728	if (speedOverride) {
729		if (typeof speedOverride == 'number')
730			speedIn = speedOut = speedOverride;
731		else
732			speedIn = speedOut = 1;
733		easeIn = easeOut = null;
734	}
735	var fn = function() {$n.animate(opts.animIn, speedIn, easeIn, cb)};
736	$l.animate(opts.animOut, speedOut, easeOut, function() {
737		if (opts.cssAfter) $l.css(opts.cssAfter);
738		if (!opts.sync) fn();
739	});
740	if (opts.sync) fn();
741};
742
743// transition definitions - only fade is defined here, transition pack defines the rest
744$.fn.cycle.transitions = {
745	fade: function($cont, $slides, opts) {
746		$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
747		opts.before.push(function(curr,next,opts) {
748			$.fn.cycle.commonReset(curr,next,opts);
749			opts.cssBefore.opacity = 0;
750		});
751		opts.animIn	   = { opacity: 1 };
752		opts.animOut   = { opacity: 0 };
753		opts.cssBefore = { top: 0, left: 0 };
754	}
755};
756
757$.fn.cycle.ver = function() { return ver; };
758
759// override these globally if you like (they are all optional)
760$.fn.cycle.defaults = {
761	fx:			  'fade', // name of transition effect (or comma separated names, ex: fade,scrollUp,shuffle)
762	timeout:	   4000,  // milliseconds between slide transitions (0 to disable auto advance)
763	timeoutFn:     null,  // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
764	continuous:	   0,	  // true to start next transition immediately after current one completes
765	speed:		   1000,  // speed of the transition (any valid fx speed value)
766	speedIn:	   null,  // speed of the 'in' transition
767	speedOut:	   null,  // speed of the 'out' transition
768	next:		   null,  // selector for element to use as click trigger for next slide
769	prev:		   null,  // selector for element to use as click trigger for previous slide
770	prevNextClick: null,  // callback fn for prev/next clicks:	function(isNext, zeroBasedSlideIndex, slideElement)
771	pager:		   null,  // selector for element to use as pager container
772	pagerClick:	   null,  // callback fn for pager clicks:	function(zeroBasedSlideIndex, slideElement)
773	pagerEvent:	  'click', // name of event which drives the pager navigation
774	pagerAnchorBuilder: null, // callback fn for building anchor links:  function(index, DOMelement)
775	before:		   null,  // transition callback (scope set to element to be shown):     function(currSlideElement, nextSlideElement, options, forwardFlag)
776	after:		   null,  // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
777	end:		   null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
778	easing:		   null,  // easing method for both in and out transitions
779	easeIn:		   null,  // easing for "in" transition
780	easeOut:	   null,  // easing for "out" transition
781	shuffle:	   null,  // coords for shuffle animation, ex: { top:15, left: 200 }
782	animIn:		   null,  // properties that define how the slide animates in
783	animOut:	   null,  // properties that define how the slide animates out
784	cssBefore:	   null,  // properties that define the initial state of the slide before transitioning in
785	cssAfter:	   null,  // properties that defined the state of the slide after transitioning out
786	fxFn:		   null,  // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
787	height:		  'auto', // container height
788	startingSlide: 0,	  // zero-based index of the first slide to be displayed
789	sync:		   1,	  // true if in/out transitions should occur simultaneously
790	random:		   0,	  // true for random, false for sequence (not applicable to shuffle fx)
791	fit:		   0,	  // force slides to fit container
792	containerResize: 1,	  // resize container to fit largest slide
793	pause:		   0,	  // true to enable "pause on hover"
794	pauseOnPagerHover: 0, // true to pause when hovering over pager link
795	autostop:	   0,	  // true to end slideshow after X transitions (where X == slide count)
796	autostopCount: 0,	  // number of transitions (optionally used with autostop to define X)
797	delay:		   0,	  // additional delay (in ms) for first transition (hint: can be negative)
798	slideExpr:	   null,  // expression for selecting slides (if something other than all children is required)
799	cleartype:	   !$.support.opacity,  // true if clearType corrections should be applied (for IE)
800	nowrap:		   0,	  // true to prevent slideshow from wrapping
801	fastOnEvent:   0,	  // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
802	randomizeEffects: 1,  // valid when multiple effects are used; true to make the effect sequence random
803	rev:           0,     // causes animations to transition in reverse
804	manualTrump:   true,  // causes manual transition to stop an active transition instead of being ignored
805	requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
806	requeueTimeout: 250   // ms delay for requeue
807};
808
809})(jQuery);
810
811
812/*!
813 * jQuery Cycle Plugin Transition Definitions
814 * This script is a plugin for the jQuery Cycle Plugin
815 * Examples and documentation at: http://malsup.com/jquery/cycle/
816 * Copyright (c) 2007-2008 M. Alsup
817 * Version:	 2.52
818 * Dual licensed under the MIT and GPL licenses:
819 * http://www.opensource.org/licenses/mit-license.php
820 * http://www.gnu.org/licenses/gpl.html
821 */
822(function($) {
823
824//
825// These functions define one-time slide initialization for the named
826// transitions. To save file size feel free to remove any of these that you
827// don't need.
828//
829
830// scrollUp/Down/Left/Right
831$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
832	$cont.css('overflow','hidden');
833	opts.before.push($.fn.cycle.commonReset);
834	var h = $cont.height();
835	opts.cssBefore ={ top: h, left: 0 };
836	opts.cssFirst = { top: 0 };
837	opts.animIn	  = { top: 0 };
838	opts.animOut  = { top: -h };
839};
840$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
841	$cont.css('overflow','hidden');
842	opts.before.push($.fn.cycle.commonReset);
843	var h = $cont.height();
844	opts.cssFirst = { top: 0 };
845	opts.cssBefore= { top: -h, left: 0 };
846	opts.animIn	  = { top: 0 };
847	opts.animOut  = { top: h };
848};
849$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
850	$cont.css('overflow','hidden');
851	opts.before.push($.fn.cycle.commonReset);
852	var w = $cont.width();
853	opts.cssFirst = { left: 0 };
854	opts.cssBefore= { left: w, top: 0 };
855	opts.animIn	  = { left: 0 };
856	opts.animOut  = { left: 0-w };
857};
858$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
859	$cont.css('overflow','hidden');
860	opts.before.push($.fn.cycle.commonReset);
861	var w = $cont.width();
862	opts.cssFirst = { left: 0 };
863	opts.cssBefore= { left: -w, top: 0 };
864	opts.animIn	  = { left: 0 };
865	opts.animOut  = { left: w };
866};
867$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
868	$cont.css('overflow','hidden').width();
869	opts.before.push(function(curr, next, opts, fwd) {
870		$.fn.cycle.commonReset(curr,next,opts);
871		opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
872		opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
873	});
874	opts.cssFirst = { left: 0 };
875	opts.cssBefore= { top: 0 };
876	opts.animIn   = { left: 0 };
877	opts.animOut  = { top: 0 };
878};
879$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
880	$cont.css('overflow','hidden');
881	opts.before.push(function(curr, next, opts, fwd) {
882		$.fn.cycle.commonReset(curr,next,opts);
883		opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
884		opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
885	});
886	opts.cssFirst = { top: 0 };
887	opts.cssBefore= { left: 0 };
888	opts.animIn   = { top: 0 };
889	opts.animOut  = { left: 0 };
890};
891
892// slideX/slideY
893$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
894	opts.before.push(function(curr, next, opts) {
895		$(opts.elements).not(curr).hide();
896		$.fn.cycle.commonReset(curr,next,opts,false,true);
897		opts.animIn.width = next.cycleW;
898	});
899	opts.cssBefore = { left: 0, top: 0, width: 0 };
900	opts.animIn	 = { width: 'show' };
901	opts.animOut = { width: 0 };
902};
903$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
904	opts.before.push(function(curr, next, opts) {
905		$(opts.elements).not(curr).hide();
906		$.fn.cycle.commonReset(curr,next,opts,true,false);
907		opts.animIn.height = next.cycleH;
908	});
909	opts.cssBefore = { left: 0, top: 0, height: 0 };
910	opts.animIn	 = { height: 'show' };
911	opts.animOut = { height: 0 };
912};
913
914// shuffle
915$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
916	var w = $cont.css('overflow', 'visible').width();
917	$slides.css({left: 0, top: 0});
918	opts.before.push(function(curr,next,opts) {
919		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
920	});
921	opts.speed = opts.speed / 2; // shuffle has 2 transitions
922	opts.random = 0;
923	opts.shuffle = opts.shuffle || {left:-w, top:15};
924	opts.els = [];
925	for (var i=0; i < $slides.length; i++)
926		opts.els.push($slides[i]);
927
928	for (var i=0; i < opts.currSlide; i++)
929		opts.els.push(opts.els.shift());
930
931	// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
932	opts.fxFn = function(curr, next, opts, cb, fwd) {
933		var $el = fwd ? $(curr) : $(next);
934		$(next).css(opts.cssBefore);
935		var count = opts.slideCount;
936		$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
937			var hops = $.fn.cycle.hopsFromLast(opts, fwd);
938			for (var k=0; k < hops; k++)
939				fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
940			if (fwd)
941				for (var i=0, len=opts.els.length; i < len; i++)
942					$(opts.els[i]).css('z-index', len-i+count);
943			else {
944				var z = $(curr).css('z-index');
945				$el.css('z-index', parseInt(z)+1+count);
946			}
947			$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
948				$(fwd ? this : curr).hide();
949				if (cb) cb();
950			});
951		});
952	};
953	opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
954};
955
956// turnUp/Down/Left/Right
957$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
958	opts.before.push(function(curr, next, opts) {
959		$.fn.cycle.commonReset(curr,next,opts,true,false);
960		opts.cssBefore.top = next.cycleH;
961		opts.animIn.height = next.cycleH;
962	});
963	opts.cssFirst  = { top: 0 };
964	opts.cssBefore = { left: 0, height: 0 };
965	opts.animIn	   = { top: 0 };
966	opts.animOut   = { height: 0 };
967};
968$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
969	opts.before.push(function(curr, next, opts) {
970		$.fn.cycle.commonReset(curr,next,opts,true,false);
971		opts.animIn.height = next.cycleH;
972		opts.animOut.top   = curr.cycleH;
973	});
974	opts.cssFirst  = { top: 0 };
975	opts.cssBefore = { left: 0, top: 0, height: 0 };
976	opts.animOut   = { height: 0 };
977};
978$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
979	opts.before.push(function(curr, next, opts) {
980		$.fn.cycle.commonReset(curr,next,opts,false,true);
981		opts.cssBefore.left = next.cycleW;
982		opts.animIn.width = next.cycleW;
983	});
984	opts.cssBefore = { top: 0, width: 0  };
985	opts.animIn	   = { left: 0 };
986	opts.animOut   = { width: 0 };
987};
988$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
989	opts.before.push(function(curr, next, opts) {
990		$.fn.cycle.commonReset(curr,next,opts,false,true);
991		opts.animIn.width = next.cycleW;
992		opts.animOut.left = curr.cycleW;
993	});
994	opts.cssBefore = { top: 0, left: 0, width: 0 };
995	opts.animIn	   = { left: 0 };
996	opts.animOut   = { width: 0 };
997};
998
999// zoom
1000$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
1001	opts.before.push(function(curr, next, opts) {
1002		$.fn.cycle.commonReset(curr,next,opts,false,false,true);
1003		opts.cssBefore.top = next.cycleH/2;
1004		opts.cssBefore.left = next.cycleW/2;
1005		opts.animIn	   = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
1006		opts.animOut   = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 };
1007	});
1008	opts.cssFirst = { top:0, left: 0 };
1009	opts.cssBefore = { width: 0, height: 0 };
1010};
1011
1012// fadeZoom
1013$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
1014	opts.before.push(function(curr, next, opts) {
1015		$.fn.cycle.commonReset(curr,next,opts,false,false);
1016		opts.cssBefore.left = next.cycleW/2;
1017		opts.cssBefore.top = next.cycleH/2;
1018		opts.animIn	= { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
1019	});
1020	opts.cssBefore = { width: 0, height: 0 };
1021	opts.animOut  = { opacity: 0 };
1022};
1023
1024// blindX
1025$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
1026	var w = $cont.css('overflow','hidden').width();
1027	opts.before.push(function(curr, next, opts) {
1028		$.fn.cycle.commonReset(curr,next,opts);
1029		opts.animIn.width = next.cycleW;
1030		opts.animOut.left   = curr.cycleW;
1031	});
1032	opts.cssBefore = { left: w, top: 0 };
1033	opts.animIn = { left: 0 };
1034	opts.animOut  = { left: w };
1035};
1036// blindY
1037$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
1038	var h = $cont.css('overflow','hidden').height();
1039	opts.before.push(function(curr, next, opts) {
1040		$.fn.cycle.commonReset(curr,next,opts);
1041		opts.animIn.height = next.cycleH;
1042		opts.animOut.top   = curr.cycleH;
1043	});
1044	opts.cssBefore = { top: h, left: 0 };
1045	opts.animIn = { top: 0 };
1046	opts.animOut  = { top: h };
1047};
1048// blindZ
1049$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
1050	var h = $cont.css('overflow','hidden').height();
1051	var w = $cont.width();
1052	opts.before.push(function(curr, next, opts) {
1053		$.fn.cycle.commonReset(curr,next,opts);
1054		opts.animIn.height = next.cycleH;
1055		opts.animOut.top   = curr.cycleH;
1056	});
1057	opts.cssBefore = { top: h, left: w };
1058	opts.animIn = { top: 0, left: 0 };
1059	opts.animOut  = { top: h, left: w };
1060};
1061
1062// growX - grow horizontally from centered 0 width
1063$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
1064	opts.before.push(function(curr, next, opts) {
1065		$.fn.cycle.commonReset(curr,next,opts,false,true);
1066		opts.cssBefore.left = this.cycleW/2;
1067		opts.animIn = { left: 0, width: this.cycleW };
1068		opts.animOut = { left: 0 };
1069	});
1070	opts.cssBefore = { width: 0, top: 0 };
1071};
1072// growY - grow vertically from centered 0 height
1073$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
1074	opts.before.push(function(curr, next, opts) {
1075		$.fn.cycle.commonReset(curr,next,opts,true,false);
1076		opts.cssBefore.top = this.cycleH/2;
1077		opts.animIn = { top: 0, height: this.cycleH };
1078		opts.animOut = { top: 0 };
1079	});
1080	opts.cssBefore = { height: 0, left: 0 };
1081};
1082
1083// curtainX - squeeze in both edges horizontally
1084$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
1085	opts.before.push(function(curr, next, opts) {
1086		$.fn.cycle.commonReset(curr,next,opts,false,true,true);
1087		opts.cssBefore.left = next.cycleW/2;
1088		opts.animIn = { left: 0, width: this.cycleW };
1089		opts.animOut = { left: curr.cycleW/2, width: 0 };
1090	});
1091	opts.cssBefore = { top: 0, width: 0 };
1092};
1093// curtainY - squeeze in both edges vertically
1094$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
1095	opts.before.push(function(curr, next, opts) {
1096		$.fn.cycle.commonReset(curr,next,opts,true,false,true);
1097		opts.cssBefore.top = next.cycleH/2;
1098		opts.animIn = { top: 0, height: next.cycleH };
1099		opts.animOut = { top: curr.cycleH/2, height: 0 };
1100	});
1101	opts.cssBefore = { left: 0, height: 0 };
1102};
1103
1104// cover - curr slide covered by next slide
1105$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
1106	var d = opts.direction || 'left';
1107	var w = $cont.css('overflow','hidden').width();
1108	var h = $cont.height();
1109	opts.before.push(function(curr, next, opts) {
1110		$.fn.cycle.commonReset(curr,next,opts);
1111		if (d == 'right')
1112			opts.cssBefore.left = -w;
1113		else if (d == 'up')
1114			opts.cssBefore.top = h;
1115		else if (d == 'down')
1116			opts.cssBefore.top = -h;
1117		else
1118			opts.cssBefore.left = w;
1119	});
1120	opts.animIn = { left: 0, top: 0};
1121	opts.animOut = { opacity: 1 };
1122	opts.cssBefore = { top: 0, left: 0 };
1123};
1124
1125// uncover - curr slide moves off next slide
1126$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
1127	var d = opts.direction || 'left';
1128	var w = $cont.css('overflow','hidden').width();
1129	var h = $cont.height();
1130	opts.before.push(function(curr, next, opts) {
1131		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
1132		if (d == 'right')
1133			opts.animOut.left = w;
1134		else if (d == 'up')
1135			opts.animOut.top = -h;
1136		else if (d == 'down')
1137			opts.animOut.top = h;
1138		else
1139			opts.animOut.left = -w;
1140	});
1141	opts.animIn = { left: 0, top: 0 };
1142	opts.animOut = { opacity: 1 };
1143	opts.cssBefore = { top: 0, left: 0 };
1144};
1145
1146// toss - move top slide and fade away
1147$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
1148	var w = $cont.css('overflow','visible').width();
1149	var h = $cont.height();
1150	opts.before.push(function(curr, next, opts) {
1151		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
1152		// provide default toss settings if animOut not provided
1153		if (!opts.animOut.left && !opts.animOut.top)
1154			opts.animOut = { left: w*2, top: -h/2, opacity: 0 };
1155		else
1156			opts.animOut.opacity = 0;
1157	});
1158	opts.cssBefore = { left: 0, top: 0 };
1159	opts.animIn = { left: 0 };
1160};
1161
1162// wipe - clip animation
1163$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
1164	var w = $cont.css('overflow','hidden').width();
1165	var h = $cont.height();
1166	opts.cssBefore = opts.cssBefore || {};
1167	var clip;
1168	if (opts.clip) {
1169		if (/l2r/.test(opts.clip))
1170			clip = 'rect(0px 0px '+h+'px 0px)';
1171		else if (/r2l/.test(opts.clip))
1172			clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
1173		else if (/t2b/.test(opts.clip))
1174			clip = 'rect(0px '+w+'px 0px 0px)';
1175		else if (/b2t/.test(opts.clip))
1176			clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
1177		else if (/zoom/.test(opts.clip)) {
1178			var t = parseInt(h/2);
1179			var l = parseInt(w/2);
1180			clip = 'rect('+t+'px '+l+'px '+t+'px '+l+'px)';
1181		}
1182	}
1183
1184	opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
1185
1186	var d = opts.cssBefore.clip.match(/(\d+)/g);
1187	var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]);
1188
1189	opts.before.push(function(curr, next, opts) {
1190		if (curr == next) return;
1191		var $curr = $(curr), $next = $(next);
1192		$.fn.cycle.commonReset(curr,next,opts,true,true,false);
1193    	opts.cssAfter.display = 'block';
1194
1195		var step = 1, count = parseInt((opts.speedIn / 13)) - 1;
1196		(function f() {
1197			var tt = t ? t - parseInt(step * (t/count)) : 0;
1198			var ll = l ? l - parseInt(step * (l/count)) : 0;
1199			var bb = b < h ? b + parseInt(step * ((h-b)/count || 1)) : h;
1200			var rr = r < w ? r + parseInt(step * ((w-r)/count || 1)) : w;
1201			$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
1202			(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
1203		})();
1204	});
1205	opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
1206	opts.animIn	   = { left: 0 };
1207	opts.animOut   = { left: 0 };
1208};
1209
1210})(jQuery);
1211

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.