PageSourceSearch

https://www.archipornguide.com/wp-content/themes/themify-ultra/themify/js/carousel.js?ver=7.1.2

js archipornguide.com collected 2026-10-05 06:56:00 UTC 103,430 bytes, 4,282 lines download raw bytes

vendor: 12,525 bytes, lines 1-60
1/*
2* touchSwipe - jQuery Plugin
3* https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
4* http://labs.skinkers.com/touchSwipe/
5* http://plugins.jquery.com/project/touchSwipe
6*
7* Copyright (c) 2010 Matt Bryson (www.skinkers.com)
8* Dual licensed under the MIT or GPL Version 2 licenses.
9*
10* $version: 1.6.6
11*/
12
13(function(a){if(typeof define==="function"&&define.amd&&define.amd.jQuery){define(["jquery"],a)}else{a(jQuery)}}(function(f){var p="left",o="right",e="up",x="down",c="in",z="out",m="none",s="auto",l="swipe",t="pinch",A="tap",j="doubletap",b="longtap",y="hold",D="horizontal",u="vertical",i="all",r=10,g="start",k="move",h="end",q="cancel",a="ontouchstart" in window,v=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled,d=window.navigator.pointerEnabled||window.navigator.msPointerEnabled,B="TouchSwipe";var n={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe"};f.fn.swipe=function(G){var F=f(this),E=F.data(B);if(E&&typeof G==="string"){if(E[G]){return E[G].apply(this,Array.prototype.slice.call(arguments,1))}else{f.error("Method "+G+" does not exist on jQuery.swipe")}}else{if(!E&&(typeof G==="object"||!G)){return w.apply(this,arguments)}}return F};f.fn.swipe.defaults=n;f.fn.swipe.phases={PHASE_START:g,PHASE_MOVE:k,PHASE_END:h,PHASE_CANCEL:q};f.fn.swipe.directions={LEFT:p,RIGHT:o,UP:e,DOWN:x,IN:c,OUT:z};f.fn.swipe.pageScroll={NONE:m,HORIZONTAL:D,VERTICAL:u,AUTO:s};f.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:i};function w(E){if(E&&(E.allowPageScroll===undefined&&(E.swipe!==undefined||E.swipeStatus!==undefined))){E.allowPageScroll=m}if(E.click!==undefined&&E.tap===undefined){E.tap=E.click}if(!E){E={}}E=f.extend({},f.fn.swipe.defaults,E);return this.each(function(){var G=f(this);var F=G.data(B);if(!F){F=new C(this,E);G.data(B,F)}})}function C(a4,av){var az=(a||d||!av.fallbackToMouseEvents),J=az?(d?(v?"MSPointerDown":"pointerdown"):"touchstart"):"mousedown",ay=az?(d?(v?"MSPointerMove":"pointermove"):"touchmove"):"mousemove",U=az?(d?(v?"MSPointerUp":"pointerup"):"touchend"):"mouseup",S=az?null:"mouseleave",aD=(d?(v?"MSPointerCancel":"pointercancel"):"touchcancel");var ag=0,aP=null,ab=0,a1=0,aZ=0,G=1,aq=0,aJ=0,M=null;var aR=f(a4);var Z="start";var W=0;var aQ=null;var T=0,a2=0,a5=0,ad=0,N=0;var aW=null,af=null;try{aR.bind(J,aN);aR.bind(aD,a9)}catch(ak){f.error("events not supported "+J+","+aD+" on jQuery.swipe")}this.enable=function(){aR.bind(J,aN);aR.bind(aD,a9);return aR};this.disable=function(){aK();return aR};this.destroy=function(){aK();aR.data(B,null);return aR};this.option=function(bc,bb){if(av[bc]!==undefined){if(bb===undefined){return av[bc]}else{av[bc]=bb}}else{f.error("Option "+bc+" does not exist on jQuery.swipe.options")}return null};function aN(bd){if(aB()){return}if(f(bd.target).closest(av.excludedElements,aR).length>0){return}var be=bd.originalEvent?bd.originalEvent:bd;var bc,bb=a?be.touches[0]:be;Z=g;if(a){W=be.touches.length}else{bd.preventDefault()}ag=0;aP=null;aJ=null;ab=0;a1=0;aZ=0;G=1;aq=0;aQ=aj();M=aa();R();if(!a||(W===av.fingers||av.fingers===i)||aX()){ai(0,bb);T=at();if(W==2){ai(1,be.touches[1]);a1=aZ=au(aQ[0].start,aQ[1].start)}if(av.swipeStatus||av.pinchStatus){bc=O(be,Z)}}else{bc=false}if(bc===false){Z=q;O(be,Z);return bc}else{if(av.hold){af=setTimeout(f.proxy(function(){aR.trigger("hold",[be.target]);if(av.hold){bc=av.hold.call(aR,be,be.target)}},this),av.longTapThreshold)}ao(true)}return null}function a3(be){var bh=be.originalEvent?be.originalEvent:be;if(Z===h||Z===q||am()){return}var bd,bc=a?bh.touches[0]:bh;var bf=aH(bc);a2=at();if(a){W=bh.touches.length}if(av.hold){clearTimeout(af)}Z=k;if(W==2){if(a1==0){ai(1,bh.touches[1]);a1=aZ=au(aQ[0].start,aQ[1].start)}else{aH(bh.touches[1]);aZ=au(aQ[0].end,aQ[1].end);aJ=ar(aQ[0].end,aQ[1].end)}G=a7(a1,aZ);aq=Math.abs(a1-aZ)}if((W===av.fingers||av.fingers===i)||!a||aX()){aP=aL(bf.start,bf.end);al(be,aP);ag=aS(bf.start,bf.end);ab=aM();aI(aP,ag);if(av.swipeStatus||av.pinchStatus){bd=O(bh,Z)}if(!av.triggerOnTouchEnd||av.triggerOnTouchLeave){var bb=true;if(av.triggerOnTouchLeave){var bg=aY(this);bb=E(bf.end,bg)}if(!av.triggerOnTouchEnd&&bb){Z=aC(k)}else{if(av.triggerOnTouchLeave&&!bb){Z=aC(h)}}if(Z==q||Z==h){O(bh,Z)}}}else{Z=q;O(bh,Z)}if(bd===false){Z=q;O(bh,Z)}}function L(bb){var bc=bb.originalEvent;if(a){if(bc.touches.length>0){F();return true}}if(am()){W=ad}a2=at();ab=aM();if(ba()||!an()){Z=q;O(bc,Z)}else{if(av.triggerOnTouchEnd||(av.triggerOnTouchEnd==false&&Z===k)){bb.preventDefault();Z=h;O(bc,Z)}else{if(!av.triggerOnTouchEnd&&a6()){Z=h;aF(bc,Z,A)}else{if(Z===k){Z=q;O(bc,Z)}}}}ao(false);return null}function a9(){W=0;a2=0;T=0;a1=0;aZ=0;G=1;R();ao(false)}function K(bb){var bc=bb.originalEvent;if(av.triggerOnTouchLeave){Z=aC(h);O(bc,Z)}}function aK(){aR.unbind(J,aN);aR.unbind(aD,a9);aR.unbind(ay,a3);aR.unbind(U,L);if(S){aR.unbind(S,K)}ao(false)}function aC(bf){var be=bf;var bd=aA();var bc=an();var bb=ba();if(!bd||bb){be=q}else{if(bc&&bf==k&&(!av.triggerOnTouchEnd||av.triggerOnTouchLeave)){be=h}else{if(!bc&&bf==h&&av.triggerOnTouchLeave){be=q}}}return be}function O(bd,bb){var bc=undefined;if(I()||V()){bc=aF(bd,bb,l)}else{if((P()||aX())&&bc!==false){bc=aF(bd,bb,t)}}if(aG()&&bc!==false){bc=aF(bd,bb,j)}else{if(ap()&&bc!==false){bc=aF(bd,bb,b)}else{if(ah()&&bc!==false){bc=aF(bd,bb,A)}}}if(bb===q){a9(bd)}if(bb===h){if(a){if(bd.touches.length==0){a9(bd)}}else{a9(bd)}}return bc}function aF(be,bb,bd){var bc=undefined;if(bd==l){aR.trigger("swipeStatus",[bb,aP||null,ag||0,ab||0,W,aQ]);if(av.swipeStatus){bc=av.swipeStatus.call(aR,be,bb,aP||null,ag||0,ab||0,W,aQ);if(bc===false){return false}}if(bb==h&&aV()){aR.trigger("swipe",[aP,ag,ab,W,aQ]);if(av.swipe){bc=av.swipe.call(aR,be,aP,ag,ab,W,aQ);if(bc===false){return false}}switch(aP){case p:aR.trigger("swipeLeft",[aP,ag,ab,W,aQ]);if(av.swipeLeft){bc=av.swipeLeft.call(aR,be,aP,ag,ab,W,aQ)}break;case o:aR.trigger("swipeRight",[aP,ag,ab,W,aQ]);if(av.swipeRight){bc=av.swipeRight.call(aR,be,aP,ag,ab,W,aQ)}break;case e:aR.trigger("swipeUp",[aP,ag,ab,W,aQ]);if(av.swipeUp){bc=av.swipeUp.call(aR,be,aP,ag,ab,W,aQ)}break;case x:aR.trigger("swipeDown",[aP,ag,ab,W,aQ]);if(av.swipeDown){bc=av.swipeDown.call(aR,be,aP,ag,ab,W,aQ)}break}}}if(bd==t){aR.trigger("pinchStatus",[bb,aJ||null,aq||0,ab||0,W,G,aQ]);if(av.pinchStatus){bc=av.pinchStatus.call(aR,be,bb,aJ||null,aq||0,ab||0,W,G,aQ);if(bc===false){return false}}if(bb==h&&a8()){switch(aJ){case c:aR.trigger("pinchIn",[aJ||null,aq||0,ab||0,W,G,aQ]);if(av.pinchIn){bc=av.pinchIn.call(aR,be,aJ||null,aq||0,ab||0,W,G,aQ)}break;case z:aR.trigger("pinchOut",[aJ||null,aq||0,ab||0,W,G,aQ]);if(av.pinchOut){bc=av.pinchOut.call(aR,be,aJ||null,aq||0,ab||0,W,G,aQ)}break}}}if(bd==A){if(bb===q||bb===h){clearTimeout(aW);clearTimeout(af);if(Y()&&!H()){N=at();aW=setTimeout(f.proxy(function(){N=null;aR.trigger("tap",[be.target]);if(av.tap){bc=av.tap.call(aR,be,be.target)}},this),av.doubleTapThreshold)}else{N=null;aR.trigger("tap",[be.target]);if(av.tap){bc=av.tap.call(aR,be,be.target)}}}}else{if(bd==j){if(bb===q||bb===h){clearTimeout(aW);N=null;aR.trigger("doubletap",[be.target]);if(av.doubleTap){bc=av.doubleTap.call(aR,be,be.target)}}}else{if(bd==b){if(bb===q||bb===h){clearTimeout(aW);N=null;aR.trigger("longtap",[be.target]);if(av.longTap){bc=av.longTap.call(aR,be,be.target)}}}}}return bc}function an(){var bb=true;if(av.threshold!==null){bb=ag>=av.threshold}return bb}function ba(){var bb=false;if(av.cancelThreshold!==null&&aP!==null){bb=(aT(aP)-ag)>=av.cancelThreshold}return bb}function ae(){if(av.pinchThreshold!==null){return aq>=av.pinchThreshold}return true}function aA(){var bb;if(av.maxTimeThreshold){if(ab>=av.maxTimeThreshold){bb=false}else{bb=true}}else{bb=true}return bb}function al(bb,bc){if(av.allowPageScroll===m||aX()){bb.preventDefault()}else{var bd=av.allowPageScroll===s;switch(bc){case p:if((av.swipeLeft&&bd)||(!bd&&av.allowPageScroll!=D)){bb.preventDefault()}break;case o:if((av.swipeRight&&bd)||(!bd&&av.allowPageScroll!=D)){bb.preventDefault()}break;case e:if((av.swipeUp&&bd)||(!bd&&av.allowPageScroll!=u)){bb.preventDefault()}break;case x:if((av.swipeDown&&bd)||(!bd&&av.allowPageScroll!=u)){bb.preventDefault()}break}}}function a8(){var bc=aO();var bb=X();var bd=ae();return bc&&bb&&bd}function aX(){return !!(av.pinchStatus||av.pinchIn||av.pinchOut)}function P(){return !!(a8()&&aX())}function aV(){var be=aA();var bg=an();var bd=aO();var bb=X();var bc=ba();var bf=!bc&&bb&&bd&&bg&&be;return bf}function V(){return !!(av.swipe||av.swipeStatus||av.swipeLeft||av.swipeRight||av.swipeUp||av.swipeDown)}function I(){return !!(aV()&&V())}function aO(){return((W===av.fingers||av.fingers===i)||!a)}function X(){return aQ[0].end.x!==0}function a6(){return !!(av.tap)}function Y(){return !!(av.doubleTap)}function aU(){return !!(av.longTap)}function Q(){if(N==null){return false}var bb=at();return(Y()&&((bb-N)<=av.doubleTapThreshold))}function H(){return Q()}function ax(){return((W===1||!a)&&(isNaN(ag)||ag<av.threshold))}function a0(){return((ab>av.longTapThreshold)&&(ag<r))}function ah(){return !!(ax()&&a6())}function aG(){return !!(Q()&&Y())}function ap(){return !!(a0()&&aU())}function F(){a5=at();ad=event.touches.length+1}function R(){a5=0;ad=0}function am(){var bb=false;if(a5){var bc=at()-a5;if(bc<=av.fingerReleaseThreshold){bb=true}}return bb}function aB(){return !!(aR.data(B+"_intouch")===true)}function ao(bb){if(bb===true){aR.bind(ay,a3);aR.bind(U,L);if(S){aR.bind(S,K)}}else{aR.unbind(ay,a3,false);aR.unbind(U,L,false);if(S){aR.unbind(S,K,false)}}aR.data(B+"_intouch",bb===true)}function ai(bc,bb){var bd=bb.identifier!==undefined?bb.identifier:0;aQ[bc].identifier=bd;aQ[bc].start.x=aQ[bc].end.x=bb.pageX||bb.clientX;aQ[bc].start.y=aQ[bc].end.y=bb.pageY||bb.clientY;return aQ[bc]}function aH(bb){var bd=bb.identifier!==undefined?bb.identifier:0;var bc=ac(bd);bc.end.x=bb.pageX||bb.clientX;bc.end.y=bb.pageY||bb.clientY;return bc}function ac(bc){for(var bb=0;bb<aQ.length;bb++){if(aQ[bb].identifier==bc){return aQ[bb]}}}function aj(){var bb=[];for(var bc=0;bc<=5;bc++){bb.push({start:{x:0,y:0},end:{x:0,y:0},identifier:0})}return bb}function aI(bb,bc){bc=Math.max(bc,aT(bb));M[bb].distance=bc}function aT(bb){if(M[bb]){return M[bb].distance}return undefined}function aa(){var bb={};bb[p]=aw(p);bb[o]=aw(o);bb[e]=aw(e);bb[x]=aw(x);return bb}function aw(bb){return{direction:bb,distance:0}}function aM(){return a2-T}function au(be,bd){var bc=Math.abs(be.x-bd.x);var bb=Math.abs(be.y-bd.y);return Math.round(Math.sqrt(bc*bc+bb*bb))}function a7(bb,bc){var bd=(bc/bb)*1;return bd.toFixed(2)}function ar(){if(G<1){return z}else{return c}}function aS(bc,bb){return Math.round(Math.sqrt(Math.pow(bb.x-bc.x,2)+Math.pow(bb.y-bc.y,2)))}function aE(be,bc){var bb=be.x-bc.x;var bg=bc.y-be.y;var bd=Math.atan2(bg,bb);var bf=Math.round(bd*180/Math.PI);if(bf<0){bf=360-Math.abs(bf)}return bf}function aL(bc,bb){var bd=aE(bc,bb);if((bd<=45)&&(bd>=0)){return p}else{if((bd<=360)&&(bd>=315)){return p}else{if((bd>=135)&&(bd<=225)){return o}else{if((bd>45)&&(bd<135)){return x}else{return e}}}}}function at(){var bb=new Date();return bb.getTime()}function aY(bb){bb=f(bb);var bd=bb.offset();var bc={left:bd.left,right:bd.left+bb.outerWidth(),top:bd.top,bottom:bd.top+bb.outerHeight()};return bc}function E(bb,bc){return(bb.x>bc.left&&bb.x<bc.right&&bb.y>bc.top&&bb.y<bc.bottom)}}}));
14
15/*
16 *	jQuery carouFredSel 6.2.1
17 *	Demo's and documentation:
18 *	caroufredsel.dev7studios.com
19 *
20 *	Copyright (c) 2013 Fred Heusschen
21 *	www.frebsite.nl
22 *
23 *	Dual licensed under the MIT and GPL licenses.
24 *	http://en.wikipedia.org/wiki/MIT_License
25 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
26 */
27
28
29(function($) {
30
31
32	//	LOCAL
33
34	if ( $.fn.carouFredSel )
35	{
36		return;
37	}
38
39	$.fn.caroufredsel = $.fn.carouFredSel = function(options, configs)
40	{
41
42		//	no element
43		if (this.length == 0)
44		{
45			debug( true, 'No element found for "' + this.selector + '".' );
46			return this;
47		}
48
49		//	multiple elements
50		if (this.length > 1)
51		{
52			return this.each(function() {
53				$(this).carouFredSel(options, configs);
54			});
55		}
56
57
58		var $cfs = this,
59			$tt0 = this[0],
60			starting_position = false;
vendor: 4,369 bytes, lines 61-221
61
62		if ($cfs.data('_cfs_isCarousel'))
63		{
64			starting_position = $cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition');
65			$cfs.trigger('_cfs_triggerEvent', ['destroy', true]);
66		}
67
68		var FN = {};
69
70		FN._init = function(o, setOrig, start)
71		{
72			o = go_getObject($tt0, o);
73
74			o.items = go_getItemsObject($tt0, o.items);
75			o.scroll = go_getScrollObject($tt0, o.scroll);
76			o.auto = go_getAutoObject($tt0, o.auto);
77			o.prev = go_getPrevNextObject($tt0, o.prev);
78			o.next = go_getPrevNextObject($tt0, o.next);
79			o.pagination = go_getPaginationObject($tt0, o.pagination);
80			o.swipe = go_getSwipeObject($tt0, o.swipe);
81			o.mousewheel = go_getMousewheelObject($tt0, o.mousewheel);
82
83			if (setOrig)
84			{
85				opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
86			}
87
88			opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
89			opts.d = cf_getDimensions(opts);
90
91			crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';
92
93			var	a_itm = $cfs.children(),
94				avail_primary = ms_getParentSize($wrp, opts, 'width');
95
96			if (is_true(opts.cookie))
97			{
98				opts.cookie = 'caroufredsel_cookie_' + conf.serialNumber;
99			}
100
101			opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
102
103			//	complement items and sizes
104			opts.items = in_complementItems(opts.items, opts, a_itm, start);
105			opts[opts.d['width']] = in_complementPrimarySize(opts[opts.d['width']], opts, a_itm);
106			opts[opts.d['height']] = in_complementSecondarySize(opts[opts.d['height']], opts, a_itm);
107
108			//	primary size not set for a responsive carousel
109			if (opts.responsive)
110			{
111				if (!is_percentage(opts[opts.d['width']]))
112				{
113					opts[opts.d['width']] = '100%';
114				}
115			}
116
117			//	primary size is percentage
118			if (is_percentage(opts[opts.d['width']]))
119			{
120				crsl.upDateOnWindowResize = true;
121				crsl.primarySizePercentage = opts[opts.d['width']];
122				opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
123				if (!opts.items.visible)
124				{
125					opts.items.visibleConf.variable = true;
126				}
127			}
128
129			if (opts.responsive)
130			{
131				opts.usePadding = false;
132				opts.padding = [0, 0, 0, 0];
133				opts.align = false;
134				opts.items.visibleConf.variable = false;
135			}
136			else
137			{
138				//	visible-items not set
139				if (!opts.items.visible)
140				{
141					opts = in_complementVisibleItems(opts, avail_primary);
142				}
143
144				//	primary size not set -> calculate it or set to "variable"
145				if (!opts[opts.d['width']])
146				{
147					if (!opts.items.visibleConf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*')
148					{
149						opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
150						opts.align = false;
151					}
152					else
153					{
154						opts[opts.d['width']] = 'variable';
155					}
156				}
157				//	align not set -> set to center if primary size is number
158				if (is_undefined(opts.align))
159				{
160					opts.align = (is_number(opts[opts.d['width']]))
161						? 'center'
162						: false;
163				}
164				//	set variabe visible-items
165				if (opts.items.visibleConf.variable)
166				{
167					opts.items.visible = gn_getVisibleItemsNext(a_itm, opts, 0);
168				}
169			}
170
171			//	set visible items by filter
172			if (opts.items.filter != '*' && !opts.items.visibleConf.variable)
173			{
174				opts.items.visibleConf.org = opts.items.visible;
175				opts.items.visible = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
176			}
177
178			opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0);
179			opts.items.visibleConf.old = opts.items.visible;
180
181			if (opts.responsive)
182			{
183				if (!opts.items.visibleConf.min)
184				{
185					opts.items.visibleConf.min = opts.items.visible;
186				}
187				if (!opts.items.visibleConf.max)
188				{
189					opts.items.visibleConf.max = opts.items.visible;
190				}
191				opts = in_getResponsiveValues(opts, a_itm, avail_primary);
192			}
193			else
194			{
195				opts.padding = cf_getPadding(opts.padding);
196
197				if (opts.align == 'top')
198				{
199					opts.align = 'left';
200				}
201				else if (opts.align == 'bottom')
202				{
203					opts.align = 'right';
204				}
205
206				switch (opts.align)
207				{
208					//	align: center, left or right
209					case 'center':
210					case 'left':
211					case 'right':
212						if (opts[opts.d['width']] != 'variable')
213						{
214							opts = in_getAlignPadding(opts, a_itm);
215							opts.usePadding = true;
216						}
217						break;
218
219					//	padding
220					default:
221						opts.align = false;
222						opts.usePadding = (
223							opts.padding[0] == 0 &&
224							opts.padding[1] == 0 &&
225							opts.padding[2] == 0 &&
226							opts.padding[3] == 0
227						) ? false : true;
228						break;
229				}
230			}
231
232			if (!is_number(opts.scroll.duration))
233			{
234				opts.scroll.duration = 500;
235			}
236			if (is_undefined(opts.scroll.items))
237			{
238				opts.scroll.items = (opts.responsive || opts.items.visibleConf.variable || opts.items.filter != '*')
vendor: 29,289 bytes, lines 238-1470
238
239					? 'visible'
240					: opts.items.visible;
241			}
242
243			opts.auto = $.extend(true, {}, opts.scroll, opts.auto);
244			opts.prev = $.extend(true, {}, opts.scroll, opts.prev);
245			opts.next = $.extend(true, {}, opts.scroll, opts.next);
246			opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination);
247			//	swipe and mousewheel extend later on, per direction
248
249			opts.auto = go_complementAutoObject($tt0, opts.auto);
250			opts.prev = go_complementPrevNextObject($tt0, opts.prev);
251			opts.next = go_complementPrevNextObject($tt0, opts.next);
252			opts.pagination = go_complementPaginationObject($tt0, opts.pagination);
253			opts.swipe = go_complementSwipeObject($tt0, opts.swipe);
254			opts.mousewheel = go_complementMousewheelObject($tt0, opts.mousewheel);
255
256			if (opts.synchronise)
257			{
258				opts.synchronise = cf_getSynchArr(opts.synchronise);
259			}
260
261
262			//	DEPRECATED
263			if (opts.auto.onPauseStart)
264			{
265				opts.auto.onTimeoutStart = opts.auto.onPauseStart;
266				deprecated('auto.onPauseStart', 'auto.onTimeoutStart');
267			}
268			if (opts.auto.onPausePause)
269			{
270				opts.auto.onTimeoutPause = opts.auto.onPausePause;
271				deprecated('auto.onPausePause', 'auto.onTimeoutPause');
272			}
273			if (opts.auto.onPauseEnd)
274			{
275				opts.auto.onTimeoutEnd = opts.auto.onPauseEnd;
276				deprecated('auto.onPauseEnd', 'auto.onTimeoutEnd');
277			}
278			if (opts.auto.pauseDuration)
279			{
280				opts.auto.timeoutDuration = opts.auto.pauseDuration;
281				deprecated('auto.pauseDuration', 'auto.timeoutDuration');
282			}
283			//	/DEPRECATED
284
285
286		};	//	/init
287
288
289		FN._build = function() {
290			$cfs.data('_cfs_isCarousel', true);
291
292			var a_itm = $cfs.children(),
293				orgCSS = in_mapCss($cfs, ['textAlign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zIndex', 'width', 'height', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft']),
294				newPosition = 'relative';
295
296			switch (orgCSS.position)
297			{
298				case 'absolute':
299				case 'fixed':
300					newPosition = orgCSS.position;
301					break;
302			}
303
304			if (conf.wrapper == 'parent')
305			{
306				sz_storeOrigCss($wrp);
307			}
308			else
309			{
310				$wrp.css(orgCSS);
311			}
312			$wrp.css({
313				'overflow'		: 'hidden',
314				'position'		: newPosition
315			});
316
317			sz_storeOrigCss($cfs);
318			$cfs.data('_cfs_origCssZindex', orgCSS.zIndex);
319			$cfs.css({
320				'textAlign'		: 'left',
321				'float'			: 'none',
322				'position'		: 'absolute',
323				'top'			: 0,
324				'right'			: 'auto',
325				'bottom'		: 'auto',
326				'left'			: 0,
327				'marginTop'		: 0,
328				'marginRight'	: 0,
329				'marginBottom'	: 0,
330				'marginLeft'	: 0
331			});
332
333			sz_storeMargin(a_itm, opts);
334			sz_storeOrigCss(a_itm);
335			if (opts.responsive)
336			{
337				sz_setResponsiveSizes(opts, a_itm);
338			}
339
340		};	//	/build
341
342
343		FN._bind_events = function() {
344			FN._unbind_events();
345
346
347			//	stop event
348			$cfs.bind(cf_e('stop', conf), function(e, imm) {
349				e.stopPropagation();
350
351				//	button
352				if (!crsl.isStopped)
353				{
354					if (opts.auto.button)
355					{
356						opts.auto.button.addClass(cf_c('stopped', conf));
357					}
358				}
359
360				//	set stopped
361				crsl.isStopped = true;
362
363				if (opts.auto.play)
364				{
365					opts.auto.play = false;
366					$cfs.trigger(cf_e('pause', conf), imm);
367				}
368				return true;
369			});
370
371
372			//	finish event
373			$cfs.bind(cf_e('finish', conf), function(e) {
374				e.stopPropagation();
375				if (crsl.isScrolling)
376				{
377					sc_stopScroll(scrl);
378				}
379				return true;
380			});
381
382
383			//	pause event
384			$cfs.bind(cf_e('pause', conf), function(e, imm, res) {
385				e.stopPropagation();
386				tmrs = sc_clearTimers(tmrs);
387
388				//	immediately pause
389				if (imm && crsl.isScrolling)
390				{
391					scrl.isStopped = true;
392					var nst = getTime() - scrl.startTime;
393					scrl.duration -= nst;
394					if (scrl.pre)
395					{
396						scrl.pre.duration -= nst;
397					}
398					if (scrl.post)
399					{
400						scrl.post.duration -= nst;
401					}
402					sc_stopScroll(scrl, false);
403				}
404
405				//	update remaining pause-time
406				if (!crsl.isPaused && !crsl.isScrolling)
407				{
408					if (res)
409					{
410						tmrs.timePassed += getTime() - tmrs.startTime;
411					}
412				}
413
414				//	button
415				if (!crsl.isPaused)
416				{
417					if (opts.auto.button)
418					{
419						opts.auto.button.addClass(cf_c('paused', conf));
420					}
421				}
422
423				//	set paused
424				crsl.isPaused = true;
425
426				//	pause pause callback
427				if (opts.auto.onTimeoutPause)
428				{
429					var dur1 = opts.auto.timeoutDuration - tmrs.timePassed,
430						perc = 100 - Math.ceil( dur1 * 100 / opts.auto.timeoutDuration );
431
432					opts.auto.onTimeoutPause.call($tt0, perc, dur1);
433				}
434				return true;
435			});
436
437
438			//	play event
439			$cfs.bind(cf_e('play', conf), function(e, dir, del, res) {
440				e.stopPropagation();
441				tmrs = sc_clearTimers(tmrs);
442
443				//	sort params
444				var v = [dir, del, res],
445					t = ['string', 'number', 'boolean'],
446					a = cf_sortParams(v, t);
447
448				dir = a[0];
449				del = a[1];
450				res = a[2];
451
452				if (dir != 'prev' && dir != 'next')
453				{
454					dir = crsl.direction;
455				}
456				if (!is_number(del))
457				{
458					del = 0;
459				}
460				if (!is_boolean(res))
461				{
462					res = false;
463				}
464
465				//	stopped?
466				if (res)
467				{
468					crsl.isStopped = false;
469					opts.auto.play = true;
470				}
471				if (!opts.auto.play)
472				{
473					e.stopImmediatePropagation();
474					return debug(conf, 'Carousel stopped: Not scrolling.');
475				}
476
477				//	button
478				if (crsl.isPaused)
479				{
480					if (opts.auto.button)
481					{
482						opts.auto.button.removeClass(cf_c('stopped', conf));
483						opts.auto.button.removeClass(cf_c('paused', conf));
484					}
485				}
486
487				//	set playing
488				crsl.isPaused = false;
489				tmrs.startTime = getTime();
490
491				//	timeout the scrolling
492				var dur1 = opts.auto.timeoutDuration + del;
493					dur2 = dur1 - tmrs.timePassed;
494					perc = 100 - Math.ceil(dur2 * 100 / dur1);
495
496				if (opts.auto.progress)
497				{
498					tmrs.progress = setInterval(function() {
499						var pasd = getTime() - tmrs.startTime + tmrs.timePassed,
500							perc = Math.ceil(pasd * 100 / dur1);
501						opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc);
502					}, opts.auto.progress.interval);
503				}
504
505				tmrs.auto = setTimeout(function() {
506					if (opts.auto.progress)
507					{
508						opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100);
509					}
510					if (opts.auto.onTimeoutEnd)
511					{
512						opts.auto.onTimeoutEnd.call($tt0, perc, dur2);
513					}
514					if (crsl.isScrolling)
515					{
516						$cfs.trigger(cf_e('play', conf), dir);
517					}
518					else
519					{
520						$cfs.trigger(cf_e(dir, conf), opts.auto);
521					}
522				}, dur2);
523
524				//	pause start callback
525				if (opts.auto.onTimeoutStart)
526				{
527					opts.auto.onTimeoutStart.call($tt0, perc, dur2);
528				}
529
530				return true;
531			});
532
533
534			//	resume event
535			$cfs.bind(cf_e('resume', conf), function(e) {
536				e.stopPropagation();
537				if (scrl.isStopped)
538				{
539					scrl.isStopped = false;
540					crsl.isPaused = false;
541					crsl.isScrolling = true;
542					scrl.startTime = getTime();
543					sc_startScroll(scrl, conf);
544				}
545				else
546				{
547					$cfs.trigger(cf_e('play', conf));
548				}
549				return true;
550			});
551
552
553			//	prev + next events
554			$cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb, que) {
555				e.stopPropagation();
556
557				//	stopped or hidden carousel, don't scroll, don't queue
558				if (crsl.isStopped || $cfs.is(':hidden'))
559				{
560					e.stopImmediatePropagation();
561					return debug(conf, 'Carousel stopped or hidden: Not scrolling.');
562				}
563
564				//	not enough items
565				var minimum = (is_number(opts.items.minimum)) ? opts.items.minimum : opts.items.visible + 1;
566				if (minimum > itms.total)
567				{
568					e.stopImmediatePropagation();
569					return debug(conf, 'Not enough items ('+itms.total+' total, '+minimum+' needed): Not scrolling.');
570				}
571
572				//	get config
573				var v = [obj, num, clb, que],
574					t = ['object', 'number/string', 'function', 'boolean'],
575					a = cf_sortParams(v, t);
576
577				obj = a[0];
578				num = a[1];
579				clb = a[2];
580				que = a[3];
581
582				var eType = e.type.slice(conf.events.prefix.length);
583
584				if (!is_object(obj))
585				{
586					obj = {};
587				}
588				if (is_function(clb))
589				{
590					obj.onAfter = clb;
591				}
592				if (is_boolean(que))
593				{
594					obj.queue = que;
595				}
596				obj = $.extend(true, {}, opts[eType], obj);
597
598				//	test conditions callback
599				if (obj.conditions && !obj.conditions.call($tt0, eType))
600				{
601					e.stopImmediatePropagation();
602					return debug(conf, 'Callback "conditions" returned false.');
603				}
604
605				if (!is_number(num))
606				{
607					if (opts.items.filter != '*')
608					{
609						num = 'visible';
610					}
611					else
612					{
613						var arr = [num, obj.items, opts[eType].items];
614						for (var a = 0, l = arr.length; a < l; a++)
615						{
616							if (is_number(arr[a]) || arr[a] == 'page' || arr[a] == 'visible') {
617								num = arr[a];
618								break;
619							}
620						}
621					}
622					switch(num) {
623						case 'page':
624							e.stopImmediatePropagation();
625							return $cfs.triggerHandler(cf_e(eType+'Page', conf), [obj, clb]);
626							break;
627
628						case 'visible':
629							if (!opts.items.visibleConf.variable && opts.items.filter == '*')
630							{
631								num = opts.items.visible;
632							}
633							break;
634					}
635				}
636
637				//	resume animation, add current to queue
638				if (scrl.isStopped)
639				{
640					$cfs.trigger(cf_e('resume', conf));
641					$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
642					e.stopImmediatePropagation();
643					return debug(conf, 'Carousel resumed scrolling.');
644				}
645
646				//	queue if scrolling
647				if (obj.duration > 0)
648				{
649					if (crsl.isScrolling)
650					{
651						if (obj.queue)
652						{
653							if (obj.queue == 'last')
654							{
655								queu = [];
656							}
657							if (obj.queue != 'first' || queu.length == 0)
658							{
659								$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
660							}
661						}
662						e.stopImmediatePropagation();
663						return debug(conf, 'Carousel currently scrolling.');
664					}
665				}
666
667				tmrs.timePassed = 0;
668				$cfs.trigger(cf_e('slide_'+eType, conf), [obj, num]);
669
670				//	synchronise
671				if (opts.synchronise)
672				{
673					var s = opts.synchronise,
674						c = [obj, num];
675
676					for (var j = 0, l = s.length; j < l; j++) {
677						var d = eType;
678						if (!s[j][2])
679						{
680							d = (d == 'prev') ? 'next' : 'prev';
681						}
682						if (!s[j][1])
683						{
684							c[0] = s[j][0].triggerHandler('_cfs_triggerEvent', ['configuration', d]);
685						}
686						c[1] = num + s[j][3];
687						s[j][0].trigger('_cfs_triggerEvent', ['slide_'+d, c]);
688					}
689				}
690				return true;
691			});
692
693
694			//	prev event
695			$cfs.bind(cf_e('slide_prev', conf), function(e, sO, nI) {
696				e.stopPropagation();
697				var a_itm = $cfs.children();
698
699				//	non-circular at start, scroll to end
700				if (!opts.circular)
701				{
702					if (itms.first == 0)
703					{
704						if (opts.infinite)
705						{
706							$cfs.trigger(cf_e('next', conf), itms.total-1);
707						}
708						return e.stopImmediatePropagation();
709					}
710				}
711
712				sz_resetMargin(a_itm, opts);
713
714				//	find number of items to scroll
715				if (!is_number(nI))
716				{
717					if (opts.items.visibleConf.variable)
718					{
719						nI = gn_getVisibleItemsPrev(a_itm, opts, itms.total-1);
720					}
721					else if (opts.items.filter != '*')
722					{
723						var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts);
724						nI = gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI);
725					}
726					else
727					{
728						nI = opts.items.visible;
729					}
730					nI = cf_getAdjust(nI, opts, sO.items, $tt0);
731				}
732
733				//	prevent non-circular from scrolling to far
734				if (!opts.circular)
735				{
736					if (itms.total - nI < itms.first)
737					{
738						nI = itms.total - itms.first;
739					}
740				}
741
742				//	set new number of visible items
743				opts.items.visibleConf.old = opts.items.visible;
744				if (opts.items.visibleConf.variable)
745				{
746					var vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
747					if (opts.items.visible+nI <= vI && nI < itms.total)
748					{
749						nI++;
750						vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
751					}
752					opts.items.visible = vI;
753				}
754				else if (opts.items.filter != '*')
755				{
756					var vI = gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI);
757					opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
758				}
759
760				sz_resetMargin(a_itm, opts, true);
761
762				//	scroll 0, don't scroll
763				if (nI == 0)
764				{
765					e.stopImmediatePropagation();
766					return debug(conf, '0 items to scroll: Not scrolling.');
767				}
768				debug(conf, 'Scrolling '+nI+' items backward.');
769
770
771				//	save new config
772				itms.first += nI;
773				while (itms.first >= itms.total)
774				{
775					itms.first -= itms.total;
776				}
777
778				//	non-circular callback
779				if (!opts.circular)
780				{
781					if (itms.first == 0 && sO.onEnd)
782					{
783						sO.onEnd.call($tt0, 'prev');
784					}
785					if (!opts.infinite)
786					{
787						nv_enableNavi(opts, itms.first, conf);
788					}
789				}
790
791				//	rearrange items
792				$cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs);
793				if (itms.total < opts.items.visible + nI)
794				{
795					$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
796				}
797
798				//	the needed items
799				var a_itm = $cfs.children(),
800					i_old = gi_getOldItemsPrev(a_itm, opts, nI),
801					i_new = gi_getNewItemsPrev(a_itm, opts),
802					i_cur_l = a_itm.eq(nI-1),
803					i_old_l = i_old.last(),
804					i_new_l = i_new.last();
805
806				sz_resetMargin(a_itm, opts);
807
808				var pL = 0,
809					pR = 0;
810
811				if (opts.align)
812				{
813					var p = cf_getAlignPadding(i_new, opts);
814					pL = p[0];
815					pR = p[1];
816				}
817				var oL = (pL < 0) ? opts.padding[opts.d[3]] : 0;
818
819				//	hide items for fx directscroll
820				var hiddenitems = false,
821					i_skp = $();
822				if (opts.items.visible < nI)
823				{
824					i_skp = a_itm.slice(opts.items.visibleConf.old, nI);
825					if (sO.fx == 'directscroll')
826					{
827						var orgW = opts.items[opts.d['width']];
828						hiddenitems = i_skp;
829						i_cur_l = i_new_l;
830						sc_hideHiddenItems(hiddenitems);
831						opts.items[opts.d['width']] = 'variable';
832					}
833				}
834
835				//	save new sizes
836				var $cf2 = false,
837					i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
838					w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
839					i_siz_vis = 0,
840					a_cfs = {},
841					a_wsz = {},
842					a_cur = {},
843					a_old = {},
844					a_new = {},
845					a_lef = {},
846					a_lef_vis = {},
847					a_dur = sc_getDuration(sO, opts, nI, i_siz);
848
849				switch(sO.fx)
850				{
851					case 'cover':
852					case 'cover-fade':
853						i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visible), opts, 'width');
854						break;
855				}
856
857				if (hiddenitems)
858				{
859					opts.items[opts.d['width']] = orgW;
860				}
861
862				sz_resetMargin(a_itm, opts, true);
863				if (pR >= 0)
864				{
865					sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
866				}
867				if (pL >= 0)
868				{
869					sz_resetMargin(i_cur_l, opts, opts.padding[opts.d[3]]);
870				}
871
872				if (opts.align)
873				{
874					opts.padding[opts.d[1]] = pR;
875					opts.padding[opts.d[3]] = pL;
876				}
877
878				a_lef[opts.d['left']] = -(i_siz - oL);
879				a_lef_vis[opts.d['left']] = -(i_siz_vis - oL);
880				a_wsz[opts.d['left']] = w_siz[opts.d['width']];
881
882				//	scrolling functions
883				var _s_wrapper = function() {},
884					_a_wrapper = function() {},
885					_s_paddingold = function() {},
886					_a_paddingold = function() {},
887					_s_paddingnew = function() {},
888					_a_paddingnew = function() {},
889					_s_paddingcur = function() {},
890					_a_paddingcur = function() {},
891					_onafter = function() {},
892					_moveitems = function() {},
893					_position = function() {};
894
895				//	clone carousel
896				switch(sO.fx)
897				{
898					case 'crossfade':
899					case 'cover':
900					case 'cover-fade':
901					case 'uncover':
902					case 'uncover-fade':
903						$cf2 = $cfs.clone(true).appendTo($wrp);
904						break;
905				}
906				switch(sO.fx)
907				{
908					case 'crossfade':
909					case 'uncover':
910					case 'uncover-fade':
911						$cf2.children().slice(0, nI).remove();
912						$cf2.children().slice(opts.items.visibleConf.old).remove();
913						break;
914
915					case 'cover':
916					case 'cover-fade':
917						$cf2.children().slice(opts.items.visible).remove();
918						$cf2.css(a_lef_vis);
919						break;
920				}
921
922				$cfs.css(a_lef);
923
924				//	reset all scrolls
925				scrl = sc_setScroll(a_dur, sO.easing, conf);
926
927				//	animate / set carousel
928				a_cfs[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
929
930				//	animate / set wrapper
931				if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable')
932				{
933					_s_wrapper = function() {
934						$wrp.css(w_siz);
935					};
936					_a_wrapper = function() {
937						scrl.anims.push([$wrp, w_siz]);
938					};
939				}
940
941				//	animate / set items
942				if (opts.usePadding)
943				{
944					if (i_new_l.not(i_cur_l).length)
945					{
946			 			a_cur[opts.d['marginRight']] = i_cur_l.data('_cfs_origCssMargin');
947
948						if (pL < 0)
949						{
950							i_cur_l.css(a_cur);
951						}
952						else
953						{
954							_s_paddingcur = function() {
955								i_cur_l.css(a_cur);
956							};
957							_a_paddingcur = function() {
958								scrl.anims.push([i_cur_l, a_cur]);
959							};
960						}
961					}
962					switch(sO.fx)
963					{
964						case 'cover':
965						case 'cover-fade':
966							$cf2.children().eq(nI-1).css(a_cur);
967							break;
968					}
969
970					if (i_new_l.not(i_old_l).length)
971					{
972						a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin');
973						_s_paddingold = function() {
974							i_old_l.css(a_old);
975						};
976						_a_paddingold = function() {
977							scrl.anims.push([i_old_l, a_old]);
978						};
979					}
980
981					if (pR >= 0)
982					{
983						a_new[opts.d['marginRight']] = i_new_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]];
984						_s_paddingnew = function() {
985							i_new_l.css(a_new);
986						};
987						_a_paddingnew = function() {
988							scrl.anims.push([i_new_l, a_new]);
989						};
990					}
991				}
992
993				//	set position
994				_position = function() {
995					$cfs.css(a_cfs);
996				};
997
998
999				var overFill = opts.items.visible+nI-itms.total;
1000
1001				//	rearrange items
1002				_moveitems = function() {
1003					if (overFill > 0)
1004					{
1005						$cfs.children().slice(itms.total).remove();
1006						i_old = $( $cfs.children().slice(itms.total-(opts.items.visible-overFill)).get().concat( $cfs.children().slice(0, overFill).get() ) );
1007					}
1008					sc_showHiddenItems(hiddenitems);
1009
1010					if (opts.usePadding)
1011					{
1012						var l_itm = $cfs.children().eq(opts.items.visible+nI-1);
1013						l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
1014					}
1015				};
1016
1017
1018				var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'prev', a_dur, w_siz);
1019
1020				//	fire onAfter callbacks
1021				_onafter = function() {
1022					sc_afterScroll($cfs, $cf2, sO);
1023					crsl.isScrolling = false;
1024					clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
1025					queu = sc_fireQueue($cfs, queu, conf);
1026
1027					if (!crsl.isPaused)
1028					{
1029						$cfs.trigger(cf_e('play', conf));
1030					}
1031				};
1032
1033				//	fire onBefore callback
1034				crsl.isScrolling = true;
1035				tmrs = sc_clearTimers(tmrs);
1036				clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
1037
1038				switch(sO.fx)
1039				{
1040					case 'none':
1041						$cfs.css(a_cfs);
1042						_s_wrapper();
1043						_s_paddingold();
1044						_s_paddingnew();
1045						_s_paddingcur();
1046						_position();
1047						_moveitems();
1048						_onafter();
1049						break;
1050
1051					case 'fade':
1052						scrl.anims.push([$cfs, { 'opacity': 0 }, function() {
1053							_s_wrapper();
1054							_s_paddingold();
1055							_s_paddingnew();
1056							_s_paddingcur();
1057							_position();
1058							_moveitems();
1059							scrl = sc_setScroll(a_dur, sO.easing, conf);
1060							scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1061							sc_startScroll(scrl, conf);
1062						}]);
1063						break;
1064
1065					case 'crossfade':
1066						$cfs.css({ 'opacity': 0 });
1067						scrl.anims.push([$cf2, { 'opacity': 0 }]);
1068						scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1069						_a_wrapper();
1070						_s_paddingold();
1071						_s_paddingnew();
1072						_s_paddingcur();
1073						_position();
1074						_moveitems();
1075						break;
1076
1077					case 'cover':
1078						scrl.anims.push([$cf2, a_cfs, function() {
1079							_s_paddingold();
1080							_s_paddingnew();
1081							_s_paddingcur();
1082							_position();
1083							_moveitems();
1084							_onafter();
1085						}]);
1086						_a_wrapper();
1087						break;
1088
1089					case 'cover-fade':
1090						scrl.anims.push([$cfs, { 'opacity': 0 }]);
1091						scrl.anims.push([$cf2, a_cfs, function() {
1092							_s_paddingold();
1093							_s_paddingnew();
1094							_s_paddingcur();
1095							_position();
1096							_moveitems();
1097							_onafter();
1098						}]);
1099						_a_wrapper();
1100						break;
1101
1102					case 'uncover':
1103						scrl.anims.push([$cf2, a_wsz, _onafter]);
1104						_a_wrapper();
1105						_s_paddingold();
1106						_s_paddingnew();
1107						_s_paddingcur();
1108						_position();
1109						_moveitems();
1110						break;
1111
1112					case 'uncover-fade':
1113						$cfs.css({ 'opacity': 0 });
1114						scrl.anims.push([$cfs, { 'opacity': 1 }]);
1115						scrl.anims.push([$cf2, a_wsz, _onafter]);
1116						_a_wrapper();
1117						_s_paddingold();
1118						_s_paddingnew();
1119						_s_paddingcur();
1120						_position();
1121						_moveitems();
1122						break;
1123
1124					default:
1125						scrl.anims.push([$cfs, a_cfs, function() {
1126							_moveitems();
1127							_onafter();
1128						}]);
1129						_a_wrapper();
1130						_a_paddingold();
1131						_a_paddingnew();
1132						_a_paddingcur();
1133						break;
1134				}
1135
1136				sc_startScroll(scrl, conf);
1137				cf_setCookie(opts.cookie, $cfs, conf);
1138
1139				$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
1140
1141				return true;
1142			});
1143
1144
1145			//	next event
1146			$cfs.bind(cf_e('slide_next', conf), function(e, sO, nI) {
1147				e.stopPropagation();
1148				var a_itm = $cfs.children();
1149
1150				//	non-circular at end, scroll to start
1151				if (!opts.circular)
1152				{
1153					if (itms.first == opts.items.visible)
1154					{
1155						if (opts.infinite)
1156						{
1157							$cfs.trigger(cf_e('prev', conf), itms.total-1);
1158						}
1159						return e.stopImmediatePropagation();
1160					}
1161				}
1162
1163				sz_resetMargin(a_itm, opts);
1164
1165				//	find number of items to scroll
1166				if (!is_number(nI))
1167				{
1168					if (opts.items.filter != '*')
1169					{
1170						var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts);
1171						nI = gn_getScrollItemsNextFilter(a_itm, opts, 0, xI);
1172					}
1173					else
1174					{
1175						nI = opts.items.visible;
1176					}
1177					nI = cf_getAdjust(nI, opts, sO.items, $tt0);
1178				}
1179
1180				var lastItemNr = (itms.first == 0) ? itms.total : itms.first;
1181
1182				//	prevent non-circular from scrolling to far
1183				if (!opts.circular)
1184				{
1185					if (opts.items.visibleConf.variable)
1186					{
1187						var vI = gn_getVisibleItemsNext(a_itm, opts, nI),
1188							xI = gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1);
1189					}
1190					else
1191					{
1192						var vI = opts.items.visible,
1193							xI = opts.items.visible;
1194					}
1195
1196					if (nI + vI > lastItemNr)
1197					{
1198						nI = lastItemNr - xI;
1199					}
1200				}
1201
1202				//	set new number of visible items
1203				opts.items.visibleConf.old = opts.items.visible;
1204				if (opts.items.visibleConf.variable)
1205				{
1206					var vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
1207					while (opts.items.visible-nI >= vI && nI < itms.total)
1208					{
1209						nI++;
1210						vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
1211					}
1212					opts.items.visible = vI;
1213				}
1214				else if (opts.items.filter != '*')
1215				{
1216					var vI = gn_getVisibleItemsNextFilter(a_itm, opts, nI);
1217					opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
1218				}
1219
1220				sz_resetMargin(a_itm, opts, true);
1221
1222				//	scroll 0, don't scroll
1223				if (nI == 0)
1224				{
1225					e.stopImmediatePropagation();
1226					return debug(conf, '0 items to scroll: Not scrolling.');
1227				}
1228				debug(conf, 'Scrolling '+nI+' items forward.');
1229
1230
1231				//	save new config
1232				itms.first -= nI;
1233				while (itms.first < 0)
1234				{
1235					itms.first += itms.total;
1236				}
1237
1238				//	non-circular callback
1239				if (!opts.circular)
1240				{
1241					if (itms.first == opts.items.visible && sO.onEnd)
1242					{
1243						sO.onEnd.call($tt0, 'next');
1244					}
1245					if (!opts.infinite)
1246					{
1247						nv_enableNavi(opts, itms.first, conf);
1248					}
1249				}
1250
1251				//	rearrange items
1252				if (itms.total < opts.items.visible+nI)
1253				{
1254					$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
1255				}
1256
1257				//	the needed items
1258				var a_itm = $cfs.children(),
1259					i_old = gi_getOldItemsNext(a_itm, opts),
1260					i_new = gi_getNewItemsNext(a_itm, opts, nI),
1261					i_cur_l = a_itm.eq(nI-1),
1262					i_old_l = i_old.last(),
1263					i_new_l = i_new.last();
1264
1265				sz_resetMargin(a_itm, opts);
1266
1267				var pL = 0,
1268					pR = 0;
1269
1270				if (opts.align)
1271				{
1272					var p = cf_getAlignPadding(i_new, opts);
1273					pL = p[0];
1274					pR = p[1];
1275				}
1276
1277				//	hide items for fx directscroll
1278				var hiddenitems = false,
1279					i_skp = $();
1280				if (opts.items.visibleConf.old < nI)
1281				{
1282					i_skp = a_itm.slice(opts.items.visibleConf.old, nI);
1283					if (sO.fx == 'directscroll')
1284					{
1285						var orgW = opts.items[opts.d['width']];
1286						hiddenitems = i_skp;
1287						i_cur_l = i_old_l;
1288						sc_hideHiddenItems(hiddenitems);
1289						opts.items[opts.d['width']] = 'variable';
1290					}
1291				}
1292
1293				//	save new sizes
1294				var $cf2 = false,
1295					i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
1296					w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
1297					i_siz_vis = 0,
1298					a_cfs = {},
1299					a_cfs_vis = {},
1300					a_cur = {},
1301					a_old = {},
1302					a_lef = {},
1303					a_dur = sc_getDuration(sO, opts, nI, i_siz);
1304
1305				switch(sO.fx)
1306				{
1307					case 'uncover':
1308					case 'uncover-fade':
1309						i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visibleConf.old), opts, 'width');
1310						break;
1311				}
1312
1313				if (hiddenitems)
1314				{
1315					opts.items[opts.d['width']] = orgW;
1316				}
1317
1318				if (opts.align)
1319				{
1320					if (opts.padding[opts.d[1]] < 0)
1321					{
1322						opts.padding[opts.d[1]] = 0;
1323					}
1324				}
1325				sz_resetMargin(a_itm, opts, true);
1326				sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
1327
1328				if (opts.align)
1329				{
1330					opts.padding[opts.d[1]] = pR;
1331					opts.padding[opts.d[3]] = pL;
1332				}
1333
1334				a_lef[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
1335
1336				//	scrolling functions
1337				var _s_wrapper = function() {},
1338					_a_wrapper = function() {},
1339					_s_paddingold = function() {},
1340					_a_paddingold = function() {},
1341					_s_paddingcur = function() {},
1342					_a_paddingcur = function() {},
1343					_onafter = function() {},
1344					_moveitems = function() {},
1345					_position = function() {};
1346
1347				//	clone carousel
1348				switch(sO.fx)
1349				{
1350					case 'crossfade':
1351					case 'cover':
1352					case 'cover-fade':
1353					case 'uncover':
1354					case 'uncover-fade':
1355						$cf2 = $cfs.clone(true).appendTo($wrp);
1356						$cf2.children().slice(opts.items.visibleConf.old).remove();
1357						break;
1358				}
1359				switch(sO.fx)
1360				{
1361					case 'crossfade':
1362					case 'cover':
1363					case 'cover-fade':
1364						$cfs.css('zIndex', 1);
1365						$cf2.css('zIndex', 0);
1366						break;
1367				}
1368
1369				//	reset all scrolls
1370				scrl = sc_setScroll(a_dur, sO.easing, conf);
1371
1372				//	animate / set carousel
1373				a_cfs[opts.d['left']] = -i_siz;
1374				a_cfs_vis[opts.d['left']] = -i_siz_vis;
1375
1376				if (pL < 0)
1377				{
1378					a_cfs[opts.d['left']] += pL;
1379				}
1380
1381				//	animate / set wrapper
1382				if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable')
1383				{
1384					_s_wrapper = function() {
1385						$wrp.css(w_siz);
1386					};
1387					_a_wrapper = function() {
1388						scrl.anims.push([$wrp, w_siz]);
1389					};
1390				}
1391
1392				//	animate / set items
1393				if (opts.usePadding)
1394				{
1395					var i_new_l_m = i_new_l.data('_cfs_origCssMargin');
1396
1397					if (pR >= 0)
1398					{
1399						i_new_l_m += opts.padding[opts.d[1]];
1400					}
1401					i_new_l.css(opts.d['marginRight'], i_new_l_m);
1402
1403					if (i_cur_l.not(i_old_l).length)
1404					{
1405						a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin');
1406					}
1407					_s_paddingold = function() {
1408						i_old_l.css(a_old);
1409					};
1410					_a_paddingold = function() {
1411						scrl.anims.push([i_old_l, a_old]);
1412					};
1413
1414					var i_cur_l_m = i_cur_l.data('_cfs_origCssMargin');
1415					if (pL > 0)
1416					{
1417						i_cur_l_m += opts.padding[opts.d[3]];
1418					}
1419
1420					a_cur[opts.d['marginRight']] = i_cur_l_m;
1421
1422					_s_paddingcur = function() {
1423						i_cur_l.css(a_cur);
1424					};
1425					_a_paddingcur = function() {
1426						scrl.anims.push([i_cur_l, a_cur]);
1427					};
1428				}
1429
1430				//	set position
1431				_position = function() {
1432					$cfs.css(a_lef);
1433				};
1434
1435
1436				var overFill = opts.items.visible+nI-itms.total;
1437
1438				//	rearrange items
1439				_moveitems = function() {
1440					if (overFill > 0)
1441					{
1442						$cfs.children().slice(itms.total).remove();
1443					}
1444					var l_itm = $cfs.children().slice(0, nI).appendTo($cfs).last();
1445					if (overFill > 0)
1446					{
1447						i_new = gi_getCurrentItems(a_itm, opts);
1448					}
1449					sc_showHiddenItems(hiddenitems);
1450
1451					if (opts.usePadding)
1452					{
1453						if (itms.total < opts.items.visible+nI) {
1454							var i_cur_l = $cfs.children().eq(opts.items.visible-1);
1455							i_cur_l.css(opts.d['marginRight'], i_cur_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]);
1456						}
1457						l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
1458					}
1459				};
1460
1461
1462				var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'next', a_dur, w_siz);
1463
1464				//	fire onAfter callbacks
1465				_onafter = function() {
1466					$cfs.css('zIndex', $cfs.data('_cfs_origCssZindex'));
1467					sc_afterScroll($cfs, $cf2, sO);
1468					crsl.isScrolling = false;
1469					clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
1470					queu = sc_fireQueue($cfs, queu, conf);
vendor: 34,044 bytes, lines 1471-3053
1471
1472					if (!crsl.isPaused)
1473					{
1474						$cfs.trigger(cf_e('play', conf));
1475					}
1476				};
1477
1478				//	fire onBefore callbacks
1479				crsl.isScrolling = true;
1480				tmrs = sc_clearTimers(tmrs);
1481				clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
1482
1483				switch(sO.fx)
1484				{
1485					case 'none':
1486						$cfs.css(a_cfs);
1487						_s_wrapper();
1488						_s_paddingold();
1489						_s_paddingcur();
1490						_position();
1491						_moveitems();
1492						_onafter();
1493						break;
1494
1495					case 'fade':
1496						scrl.anims.push([$cfs, { 'opacity': 0 }, function() {
1497							_s_wrapper();
1498							_s_paddingold();
1499							_s_paddingcur();
1500							_position();
1501							_moveitems();
1502							scrl = sc_setScroll(a_dur, sO.easing, conf);
1503							scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1504							sc_startScroll(scrl, conf);
1505						}]);
1506						break;
1507
1508					case 'crossfade':
1509						$cfs.css({ 'opacity': 0 });
1510						scrl.anims.push([$cf2, { 'opacity': 0 }]);
1511						scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
1512						_a_wrapper();
1513						_s_paddingold();
1514						_s_paddingcur();
1515						_position();
1516						_moveitems();
1517						break;
1518
1519					case 'cover':
1520						$cfs.css(opts.d['left'], $wrp[opts.d['width']]());
1521						scrl.anims.push([$cfs, a_lef, _onafter]);
1522						_a_wrapper();
1523						_s_paddingold();
1524						_s_paddingcur();
1525						_moveitems();
1526						break;
1527
1528					case 'cover-fade':
1529						$cfs.css(opts.d['left'], $wrp[opts.d['width']]());
1530						scrl.anims.push([$cf2, { 'opacity': 0 }]);
1531						scrl.anims.push([$cfs, a_lef, _onafter]);
1532						_a_wrapper();
1533						_s_paddingold();
1534						_s_paddingcur();
1535						_moveitems();
1536						break;
1537
1538					case 'uncover':
1539						scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
1540						_a_wrapper();
1541						_s_paddingold();
1542						_s_paddingcur();
1543						_position();
1544						_moveitems();
1545						break;
1546
1547					case 'uncover-fade':
1548						$cfs.css({ 'opacity': 0 });
1549						scrl.anims.push([$cfs, { 'opacity': 1 }]);
1550						scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
1551						_a_wrapper();
1552						_s_paddingold();
1553						_s_paddingcur();
1554						_position();
1555						_moveitems();
1556						break;
1557
1558					default:
1559						scrl.anims.push([$cfs, a_cfs, function() {
1560							_position();
1561							_moveitems();
1562							_onafter();
1563						}]);
1564						_a_wrapper();
1565						_a_paddingold();
1566						_a_paddingcur();
1567						break;
1568				}
1569
1570				sc_startScroll(scrl, conf);
1571				cf_setCookie(opts.cookie, $cfs, conf);
1572
1573				$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
1574
1575				return true;
1576			});
1577
1578
1579			//	slideTo event
1580			$cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb) {
1581				e.stopPropagation();
1582
1583				var v = [num, dev, org, obj, dir, clb],
1584					t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'],
1585					a = cf_sortParams(v, t);
1586
1587				obj = a[3];
1588				dir = a[4];
1589				clb = a[5];
1590
1591				num = gn_getItemIndex(a[0], a[1], a[2], itms, $cfs);
1592
1593				if (num == 0)
1594				{
1595					return false;
1596				}
1597				if (!is_object(obj))
1598				{
1599					obj = false;
1600				}
1601
1602				if (dir != 'prev' && dir != 'next')
1603				{
1604					if (opts.circular)
1605					{
1606						dir = (num <= itms.total / 2) ? 'next' : 'prev';
1607					}
1608					else
1609					{
1610						dir = (itms.first == 0 || itms.first > num) ? 'next' : 'prev';
1611					}
1612				}
1613
1614				if (dir == 'prev')
1615				{
1616					num = itms.total-num;
1617				}
1618				$cfs.trigger(cf_e(dir, conf), [obj, num, clb]);
1619
1620				return true;
1621			});
1622
1623
1624			//	prevPage event
1625			$cfs.bind(cf_e('prevPage', conf), function(e, obj, clb) {
1626				e.stopPropagation();
1627				var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
1628				return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]);
1629			});
1630
1631
1632			//	nextPage event
1633			$cfs.bind(cf_e('nextPage', conf), function(e, obj, clb) {
1634				e.stopPropagation();
1635				var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
1636				return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]);
1637			});
1638
1639
1640			//	slideToPage event
1641			$cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb) {
1642				e.stopPropagation();
1643				if (!is_number(pag))
1644				{
1645					pag = $cfs.triggerHandler(cf_e('currentPage', conf));
1646				}
1647				var ipp = opts.pagination.items || opts.items.visible,
1648					max = Math.ceil(itms.total / ipp)-1;
1649
1650				if (pag < 0)
1651				{
1652					pag = max;
1653				}
1654				if (pag > max)
1655				{
1656					pag = 0;
1657				}
1658				return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]);
1659			});
1660
1661			//	jumpToStart event
1662			$cfs.bind(cf_e('jumpToStart', conf), function(e, s) {
1663				e.stopPropagation();
1664				if (s)
1665				{
1666					s = gn_getItemIndex(s, 0, true, itms, $cfs);
1667				}
1668				else
1669				{
1670					s = 0;
1671				}
1672
1673				s += itms.first;
1674				if (s != 0)
1675				{
1676					if (itms.total > 0)
1677					{
1678						while (s > itms.total)
1679						{
1680							s -= itms.total;
1681						}
1682					}
1683					$cfs.prepend($cfs.children().slice(s, itms.total));
1684				}
1685				return true;
1686			});
1687
1688
1689			//	synchronise event
1690			$cfs.bind(cf_e('synchronise', conf), function(e, s) {
1691				e.stopPropagation();
1692				if (s)
1693				{
1694					s = cf_getSynchArr(s);
1695				}
1696				else if (opts.synchronise)
1697				{
1698					s = opts.synchronise;
1699				}
1700				else
1701				{
1702					return debug(conf, 'No carousel to synchronise.');
1703				}
1704
1705				var n = $cfs.triggerHandler(cf_e('currentPosition', conf)),
1706					x = true;
1707
1708				for (var j = 0, l = s.length; j < l; j++)
1709				{
1710					if (!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true]))
1711					{
1712						x = false;
1713					}
1714				}
1715				return x;
1716			});
1717
1718
1719			//	queue event
1720			$cfs.bind(cf_e('queue', conf), function(e, dir, opt) {
1721				e.stopPropagation();
1722				if (is_function(dir))
1723				{
1724					dir.call($tt0, queu);
1725				}
1726				else if (is_array(dir))
1727				{
1728					queu = dir;
1729				}
1730				else if (!is_undefined(dir))
1731				{
1732					queu.push([dir, opt]);
1733				}
1734				return queu;
1735			});
1736
1737
1738			//	insertItem event
1739			$cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev) {
1740				e.stopPropagation();
1741
1742				var v = [itm, num, org, dev],
1743					t = ['string/object', 'string/number/object', 'boolean', 'number'],
1744					a = cf_sortParams(v, t);
1745
1746				itm = a[0];
1747				num = a[1];
1748				org = a[2];
1749				dev = a[3];
1750
1751				if (is_object(itm) && !is_jquery(itm))
1752				{
1753					itm = $(itm);
1754				}
1755				else if (is_string(itm))
1756				{
1757					itm = $(itm);
1758				}
1759				if (!is_jquery(itm) || itm.length == 0)
1760				{
1761					return debug(conf, 'Not a valid object.');
1762				}
1763
1764				if (is_undefined(num))
1765				{
1766					num = 'end';
1767				}
1768
1769				sz_storeMargin(itm, opts);
1770				sz_storeOrigCss(itm);
1771
1772				var orgNum = num,
1773					before = 'before';
1774
1775				if (num == 'end')
1776				{
1777					if (org)
1778					{
1779						if (itms.first == 0)
1780						{
1781							num = itms.total-1;
1782							before = 'after';
1783						}
1784						else
1785						{
1786							num = itms.first;
1787							itms.first += itm.length;
1788						}
1789						if (num < 0)
1790						{
1791							num = 0;
1792						}
1793					}
1794					else
1795					{
1796						num = itms.total-1;
1797						before = 'after';
1798					}
1799				}
1800				else
1801				{
1802					num = gn_getItemIndex(num, dev, org, itms, $cfs);
1803				}
1804
1805				var $cit = $cfs.children().eq(num);
1806				if ($cit.length)
1807				{
1808					$cit[before](itm);
1809				}
1810				else
1811				{
1812					debug(conf, 'Correct insert-position not found! Appending item to the end.');
1813					$cfs.append(itm);
1814				}
1815
1816				if (orgNum != 'end' && !org)
1817				{
1818					if (num < itms.first)
1819					{
1820						itms.first += itm.length;
1821					}
1822				}
1823				itms.total = $cfs.children().length;
1824				if (itms.first >= itms.total)
1825				{
1826					itms.first -= itms.total;
1827				}
1828
1829				$cfs.trigger(cf_e('updateSizes', conf));
1830				$cfs.trigger(cf_e('linkAnchors', conf));
1831
1832				return true;
1833			});
1834
1835
1836			//	removeItem event
1837			$cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev) {
1838				e.stopPropagation();
1839
1840				var v = [num, org, dev],
1841					t = ['string/number/object', 'boolean', 'number'],
1842					a = cf_sortParams(v, t);
1843
1844				num = a[0];
1845				org = a[1];
1846				dev = a[2];
1847
1848				var removed = false;
1849
1850				if (num instanceof $ && num.length > 1)
1851				{
1852					$removed = $();
1853					num.each(function(i, el) {
1854						var $rem = $cfs.trigger(cf_e('removeItem', conf), [$(this), org, dev]);
1855						if ( $rem )
1856						{
1857							$removed = $removed.add($rem);
1858						}
1859					});
1860					return $removed;
1861				}
1862
1863				if (is_undefined(num) || num == 'end')
1864				{
1865					$removed = $cfs.children().last();
1866				}
1867				else
1868				{
1869					num = gn_getItemIndex(num, dev, org, itms, $cfs);
1870					var $removed = $cfs.children().eq(num);
1871					if ( $removed.length )
1872					{
1873						if (num < itms.first)
1874						{
1875							itms.first -= $removed.length;
1876						}
1877					}
1878				}
1879				if ( $removed && $removed.length )
1880				{
1881					$removed.detach();
1882					itms.total = $cfs.children().length;
1883					$cfs.trigger(cf_e('updateSizes', conf));
1884				}
1885
1886				return $removed;
1887			});
1888
1889
1890			//	onBefore and onAfter event
1891			$cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn) {
1892				e.stopPropagation();
1893				var eType = e.type.slice(conf.events.prefix.length);
1894				if (is_array(fn))
1895				{
1896					clbk[eType] = fn;
1897				}
1898				if (is_function(fn))
1899				{
1900					clbk[eType].push(fn);
1901				}
1902				return clbk[eType];
1903			});
1904
1905
1906			//	currentPosition event
1907			$cfs.bind(cf_e('currentPosition', conf), function(e, fn) {
1908				e.stopPropagation();
1909				if (itms.first == 0)
1910				{
1911					var val = 0;
1912				}
1913				else
1914				{
1915					var val = itms.total - itms.first;
1916				}
1917				if (is_function(fn))
1918				{
1919					fn.call($tt0, val);
1920				}
1921				return val;
1922			});
1923
1924
1925			//	currentPage event
1926			$cfs.bind(cf_e('currentPage', conf), function(e, fn) {
1927				e.stopPropagation();
1928				var ipp = opts.pagination.items || opts.items.visible,
1929					max = Math.ceil(itms.total/ipp-1),
1930					nr;
1931				if (itms.first == 0)
1932				{
1933					nr = 0;
1934				}
1935				else if (itms.first < itms.total % ipp)
1936				{
1937					nr = 0;
1938				}
1939				else if (itms.first == ipp && !opts.circular)
1940				{
1941					nr = max;
1942				}
1943				else
1944				{
1945					 nr = Math.round((itms.total-itms.first)/ipp);
1946				}
1947				if (nr < 0)
1948				{
1949					nr = 0;
1950				}
1951				if (nr > max)
1952				{
1953					nr = max;
1954				}
1955				if (is_function(fn))
1956				{
1957					fn.call($tt0, nr);
1958				}
1959				return nr;
1960			});
1961
1962
1963			//	currentVisible event
1964			$cfs.bind(cf_e('currentVisible', conf), function(e, fn) {
1965				e.stopPropagation();
1966				var $i = gi_getCurrentItems($cfs.children(), opts);
1967				if (is_function(fn))
1968				{
1969					fn.call($tt0, $i);
1970				}
1971				return $i;
1972			});
1973
1974
1975			//	slice event
1976			$cfs.bind(cf_e('slice', conf), function(e, f, l, fn) {
1977				e.stopPropagation();
1978
1979				if (itms.total == 0)
1980				{
1981					return false;
1982				}
1983
1984				var v = [f, l, fn],
1985					t = ['number', 'number', 'function'],
1986					a = cf_sortParams(v, t);
1987
1988				f = (is_number(a[0])) ? a[0] : 0;
1989				l = (is_number(a[1])) ? a[1] : itms.total;
1990				fn = a[2];
1991
1992				f += itms.first;
1993				l += itms.first;
1994
1995				if (items.total > 0)
1996				{
1997					while (f > itms.total)
1998					{
1999						f -= itms.total;
2000					}
2001					while (l > itms.total)
2002					{
2003						l -= itms.total;
2004					}
2005					while (f < 0)
2006					{
2007						f += itms.total;
2008					}
2009					while (l < 0)
2010					{
2011						l += itms.total;
2012					}
2013				}
2014				var $iA = $cfs.children(),
2015					$i;
2016
2017				if (l > f)
2018				{
2019					$i = $iA.slice(f, l);
2020				}
2021				else
2022				{
2023					$i = $( $iA.slice(f, itms.total).get().concat( $iA.slice(0, l).get() ) );
2024				}
2025
2026				if (is_function(fn))
2027				{
2028					fn.call($tt0, $i);
2029				}
2030				return $i;
2031			});
2032
2033
2034			//	isPaused, isStopped and isScrolling events
2035			$cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn) {
2036				e.stopPropagation();
2037				var eType = e.type.slice(conf.events.prefix.length),
2038					value = crsl[eType];
2039				if (is_function(fn))
2040				{
2041					fn.call($tt0, value);
2042				}
2043				return value;
2044			});
2045
2046
2047			//	configuration event
2048			$cfs.bind(cf_e('configuration', conf), function(e, a, b, c) {
2049				e.stopPropagation();
2050				var reInit = false;
2051
2052				//	return entire configuration-object
2053				if (is_function(a))
2054				{
2055					a.call($tt0, opts);
2056				}
2057				//	set multiple options via object
2058				else if (is_object(a))
2059				{
2060					opts_orig = $.extend(true, {}, opts_orig, a);
2061					if (b !== false) reInit = true;
2062					else opts = $.extend(true, {}, opts, a);
2063
2064				}
2065				else if (!is_undefined(a))
2066				{
2067
2068					//	callback function for specific option
2069					if (is_function(b))
2070					{
2071						var val = eval('opts.'+a);
2072						if (is_undefined(val))
2073						{
2074							val = '';
2075						}
2076						b.call($tt0, val);
2077					}
2078					//	set individual option
2079					else if (!is_undefined(b))
2080					{
2081						if (typeof c !== 'boolean') c = true;
2082						eval('opts_orig.'+a+' = b');
2083						if (c !== false) reInit = true;
2084						else eval('opts.'+a+' = b');
2085					}
2086					//	return value for specific option
2087					else
2088					{
2089						return eval('opts.'+a);
2090					}
2091				}
2092				if (reInit)
2093				{
2094					sz_resetMargin($cfs.children(), opts);
2095					FN._init(opts_orig);
2096					FN._bind_buttons();
2097					var sz = sz_setSizes($cfs, opts);
2098					$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
2099				}
2100				return opts;
2101			});
2102
2103
2104			//	linkAnchors event
2105			$cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel) {
2106				e.stopPropagation();
2107
2108				if (is_undefined($con))
2109				{
2110					$con = $('body');
2111				}
2112				else if (is_string($con))
2113				{
2114					$con = $($con);
2115				}
2116				if (!is_jquery($con) || $con.length == 0)
2117				{
2118					return debug(conf, 'Not a valid object.');
2119				}
2120				if (!is_string(sel))
2121				{
2122					sel = 'a.caroufredsel';
2123				}
2124
2125				$con.find(sel).each(function() {
2126					var h = this.hash || '';
2127					if (h.length > 0 && $cfs.children().index($(h)) != -1)
2128					{
2129						$(this).unbind('click').click(function(e) {
2130							e.preventDefault();
2131							$cfs.trigger(cf_e('slideTo', conf), h);
2132						});
2133					}
2134				});
2135				return true;
2136			});
2137
2138
2139			//	updatePageStatus event
2140			$cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes) {
2141				e.stopPropagation();
2142				if (!opts.pagination.container)
2143				{
2144					return;
2145				}
2146
2147				var ipp = opts.pagination.items || opts.items.visible,
2148					pgs = Math.ceil(itms.total/ipp);
2149
2150				if (build)
2151				{
2152					if (opts.pagination.anchorBuilder)
2153					{
2154						opts.pagination.container.children().remove();
2155						opts.pagination.container.each(function() {
2156							for (var a = 0; a < pgs; a++)
2157							{
2158								var i = $cfs.children().eq( gn_getItemIndex(a*ipp, 0, true, itms, $cfs) );
2159								$(this).append(opts.pagination.anchorBuilder.call(i[0], a+1));
2160							}
2161						});
2162					}
2163					opts.pagination.container.each(function() {
2164						$(this).children().unbind(opts.pagination.event).each(function(a) {
2165							$(this).bind(opts.pagination.event, function(e) {
2166								e.preventDefault();
2167								$cfs.trigger(cf_e('slideTo', conf), [a*ipp, -opts.pagination.deviation, true, opts.pagination]);
2168							});
2169						});
2170					});
2171				}
2172
2173				var selected = $cfs.triggerHandler(cf_e('currentPage', conf)) + opts.pagination.deviation;
2174				if (selected >= pgs)
2175				{
2176					selected = 0;
2177				}
2178				if (selected < 0)
2179				{
2180					selected = pgs-1;
2181				}
2182				opts.pagination.container.each(function() {
2183					$(this).children().removeClass(cf_c('selected', conf)).eq(selected).addClass(cf_c('selected', conf));
2184				});
2185				return true;
2186			});
2187
2188
2189			//	updateSizes event
2190			$cfs.bind(cf_e('updateSizes', conf), function(e) {
2191				var vI = opts.items.visible,
2192					a_itm = $cfs.children(),
2193					avail_primary = ms_getParentSize($wrp, opts, 'width');
2194
2195				itms.total = a_itm.length;
2196
2197				if (crsl.primarySizePercentage)
2198				{
2199					opts.maxDimension = avail_primary;
2200					opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
2201				}
2202				else
2203				{
2204					opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
2205				}
2206
2207				if (opts.responsive)
2208				{
2209					opts.items.width = opts.items.sizesConf.width;
2210					opts.items.height = opts.items.sizesConf.height;
2211					opts = in_getResponsiveValues(opts, a_itm, avail_primary);
2212					vI = opts.items.visible;
2213					sz_setResponsiveSizes(opts, a_itm);
2214				}
2215				else if (opts.items.visibleConf.variable)
2216				{
2217					vI = gn_getVisibleItemsNext(a_itm, opts, 0);
2218				}
2219				else if (opts.items.filter != '*')
2220				{
2221					vI = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
2222				}
2223
2224				if (!opts.circular && itms.first != 0 && vI > itms.first) {
2225					if (opts.items.visibleConf.variable)
2226					{
2227						var nI = gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first;
2228					}
2229					else if (opts.items.filter != '*')
2230					{
2231						var nI = gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first;
2232					}
2233					else
2234					{
2235						var nI = opts.items.visible - itms.first;
2236					}
2237					debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.');
2238					$cfs.trigger(cf_e('prev', conf), nI);
2239				}
2240
2241				opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
2242				opts.items.visibleConf.old = opts.items.visible;
2243				opts = in_getAlignPadding(opts, a_itm);
2244
2245				var sz = sz_setSizes($cfs, opts);
2246				$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
2247				nv_showNavi(opts, itms.total, conf);
2248				nv_enableNavi(opts, itms.first, conf);
2249
2250				return sz;
2251			});
2252
2253
2254			//	destroy event
2255			$cfs.bind(cf_e('destroy', conf), function(e, orgOrder) {
2256				e.stopPropagation();
2257				tmrs = sc_clearTimers(tmrs);
2258
2259				$cfs.data('_cfs_isCarousel', false);
2260				$cfs.trigger(cf_e('finish', conf));
2261				if (orgOrder)
2262				{
2263					$cfs.trigger(cf_e('jumpToStart', conf));
2264				}
2265				sz_restoreOrigCss($cfs.children());
2266				sz_restoreOrigCss($cfs);
2267				FN._unbind_events();
2268				FN._unbind_buttons();
2269				if (conf.wrapper == 'parent')
2270				{
2271					sz_restoreOrigCss($wrp);
2272				}
2273				else
2274				{
2275					$wrp.replaceWith($cfs);
2276				}
2277
2278				return true;
2279			});
2280
2281
2282			//	debug event
2283			$cfs.bind(cf_e('debug', conf), function(e) {
2284				debug(conf, 'Carousel width: ' + opts.width);
2285				debug(conf, 'Carousel height: ' + opts.height);
2286				debug(conf, 'Item widths: ' + opts.items.width);
2287				debug(conf, 'Item heights: ' + opts.items.height);
2288				debug(conf, 'Number of items visible: ' + opts.items.visible);
2289				if (opts.auto.play)
2290				{
2291					debug(conf, 'Number of items scrolled automatically: ' + opts.auto.items);
2292				}
2293				if (opts.prev.button)
2294				{
2295					debug(conf, 'Number of items scrolled backward: ' + opts.prev.items);
2296				}
2297				if (opts.next.button)
2298				{
2299					debug(conf, 'Number of items scrolled forward: ' + opts.next.items);
2300				}
2301				return conf.debug;
2302			});
2303
2304
2305			//	triggerEvent, making prefixed and namespaced events accessible from outside
2306			$cfs.bind('_cfs_triggerEvent', function(e, n, o) {
2307				e.stopPropagation();
2308				return $cfs.triggerHandler(cf_e(n, conf), o);
2309			});
2310		};	//	/bind_events
2311
2312
2313		FN._unbind_events = function() {
2314			$cfs.unbind(cf_e('', conf));
2315			$cfs.unbind(cf_e('', conf, false));
2316			$cfs.unbind('_cfs_triggerEvent');
2317		};	//	/unbind_events
2318
2319
2320		FN._bind_buttons = function() {
2321			FN._unbind_buttons();
2322			nv_showNavi(opts, itms.total, conf);
2323			nv_enableNavi(opts, itms.first, conf);
2324
2325			if (opts.auto.pauseOnHover)
2326			{
2327				var pC = bt_pauseOnHoverConfig(opts.auto.pauseOnHover);
2328				$wrp.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC);	})
2329					.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));		});
2330			}
2331
2332			//	play button
2333			if (opts.auto.button)
2334			{
2335				opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e) {
2336					e.preventDefault();
2337					var ev = false,
2338						pC = null;
2339
2340					if (crsl.isPaused)
2341					{
2342						ev = 'play';
2343					}
2344					else if (opts.auto.pauseOnEvent)
2345					{
2346						ev = 'pause';
2347						pC = bt_pauseOnHoverConfig(opts.auto.pauseOnEvent);
2348					}
2349					if (ev)
2350					{
2351						$cfs.trigger(cf_e(ev, conf), pC);
2352					}
2353				});
2354			}
2355
2356			//	prev button
2357			if (opts.prev.button)
2358			{
2359				opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e) {
2360					e.preventDefault();
2361					$cfs.trigger(cf_e('prev', conf));
2362				});
2363				if (opts.prev.pauseOnHover)
2364				{
2365					var pC = bt_pauseOnHoverConfig(opts.prev.pauseOnHover);
2366					opts.prev.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC);	})
2367									.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));		});
2368				}
2369			}
2370
2371			//	next butotn
2372			if (opts.next.button)
2373			{
2374				opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e) {
2375					e.preventDefault();
2376					$cfs.trigger(cf_e('next', conf));
2377				});
2378				if (opts.next.pauseOnHover)
2379				{
2380					var pC = bt_pauseOnHoverConfig(opts.next.pauseOnHover);
2381					opts.next.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); 	})
2382									.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));		});
2383				}
2384			}
2385
2386			//	pagination
2387			if (opts.pagination.container)
2388			{
2389				if (opts.pagination.pauseOnHover)
2390				{
2391					var pC = bt_pauseOnHoverConfig(opts.pagination.pauseOnHover);
2392					opts.pagination.container.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC);	})
2393											 .bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf));	});
2394				}
2395			}
2396
2397			//	prev/next keys
2398			if (opts.prev.key || opts.next.key)
2399			{
2400				$(document).bind(cf_e('keyup', conf, false, true, true), function(e) {
2401					var k = e.keyCode;
2402					if (k == opts.next.key)
2403					{
2404						e.preventDefault();
2405						$cfs.trigger(cf_e('next', conf));
2406					}
2407					if (k == opts.prev.key)
2408					{
2409						e.preventDefault();
2410						$cfs.trigger(cf_e('prev', conf));
2411					}
2412				});
2413			}
2414
2415			//	pagination keys
2416			if (opts.pagination.keys)
2417			{
2418				$(document).bind(cf_e('keyup', conf, false, true, true), function(e) {
2419					var k = e.keyCode;
2420					if (k >= 49 && k < 58)
2421					{
2422						k = (k-49) * opts.items.visible;
2423						if (k <= itms.total)
2424						{
2425							e.preventDefault();
2426							$cfs.trigger(cf_e('slideTo', conf), [k, 0, true, opts.pagination]);
2427						}
2428					}
2429				});
2430			}
2431
2432			//	swipe
2433			if ($.fn.swipe)
2434			{
2435				var isTouch = 'ontouchstart' in window;
2436				if ((isTouch && opts.swipe.onTouch) || (!isTouch && opts.swipe.onMouse))
2437				{
2438					var scP = $.extend(true, {}, opts.prev, opts.swipe),
2439						scN = $.extend(true, {}, opts.next, opts.swipe),
2440						swP = function() { $cfs.trigger(cf_e('prev', conf), [scP]) },
2441						swN = function() { $cfs.trigger(cf_e('next', conf), [scN]) };
2442
2443					switch (opts.direction)
2444					{
2445						case 'up':
2446						case 'down':
2447							opts.swipe.options.swipeUp = swN;
2448							opts.swipe.options.swipeDown = swP;
2449							break;
2450						default:
2451							opts.swipe.options.swipeLeft = swN;
2452							opts.swipe.options.swipeRight = swP;
2453					}
2454					if (crsl.swipe)
2455					{
2456						$cfs.swipe('destroy');
2457					}
2458					$wrp.swipe(opts.swipe.options);
2459					$wrp.css('cursor', 'move');
2460					crsl.swipe = true;
2461				}
2462			}
2463
2464			//	mousewheel
2465			if ($.fn.mousewheel)
2466			{
2467
2468				if (opts.mousewheel)
2469				{
2470					var mcP = $.extend(true, {}, opts.prev, opts.mousewheel),
2471						mcN = $.extend(true, {}, opts.next, opts.mousewheel);
2472
2473					if (crsl.mousewheel)
2474					{
2475						$wrp.unbind(cf_e('mousewheel', conf, false));
2476					}
2477					$wrp.bind(cf_e('mousewheel', conf, false), function(e, delta) {
2478						e.preventDefault();
2479						if (delta > 0)
2480						{
2481							$cfs.trigger(cf_e('prev', conf), [mcP]);
2482						}
2483						else
2484						{
2485							$cfs.trigger(cf_e('next', conf), [mcN]);
2486						}
2487					});
2488					crsl.mousewheel = true;
2489				}
2490			}
2491
2492			if (opts.auto.play)
2493			{
2494				$cfs.trigger(cf_e('play', conf), opts.auto.delay);
2495			}
2496
2497			if (crsl.upDateOnWindowResize)
2498			{
2499				var resizeFn = function(e) {
2500					$cfs.trigger(cf_e('finish', conf));
2501					if (opts.auto.pauseOnResize && !crsl.isPaused)
2502					{
2503						$cfs.trigger(cf_e('play', conf));
2504					}
2505					sz_resetMargin($cfs.children(), opts);
2506					$cfs.trigger(cf_e('updateSizes', conf));
2507				};
2508
2509				var $w = $(window),
2510					onResize = null;
2511
2512				if ($.debounce && conf.onWindowResize == 'debounce')
2513				{
2514					onResize = $.debounce(200, resizeFn);
2515				}
2516				else if ($.throttle && conf.onWindowResize == 'throttle')
2517				{
2518					onResize = $.throttle(300, resizeFn);
2519				}
2520				else
2521				{
2522					var _windowWidth = 0,
2523						_windowHeight = 0;
2524
2525					onResize = function() {
2526						var nw = $w.width(),
2527							nh = $w.height();
2528
2529						if (nw != _windowWidth || nh != _windowHeight)
2530						{
2531							resizeFn();
2532							_windowWidth = nw;
2533							_windowHeight = nh;
2534						}
2535					};
2536				}
2537				$w.bind(cf_e('resize', conf, false, true, true), onResize);
2538			}
2539		};	//	/bind_buttons
2540
2541
2542		FN._unbind_buttons = function() {
2543			var ns1 = cf_e('', conf),
2544				ns2 = cf_e('', conf, false);
2545				ns3 = cf_e('', conf, false, true, true);
2546
2547			$(document).unbind(ns3);
2548			$(window).unbind(ns3);
2549			$wrp.unbind(ns2);
2550
2551			if (opts.auto.button)
2552			{
2553				opts.auto.button.unbind(ns2);
2554			}
2555			if (opts.prev.button)
2556			{
2557				opts.prev.button.unbind(ns2);
2558			}
2559			if (opts.next.button)
2560			{
2561				opts.next.button.unbind(ns2);
2562			}
2563			if (opts.pagination.container)
2564			{
2565				opts.pagination.container.unbind(ns2);
2566				if (opts.pagination.anchorBuilder)
2567				{
2568					opts.pagination.container.children().remove();
2569				}
2570			}
2571			if (crsl.swipe)
2572			{
2573				$cfs.swipe('destroy');
2574				$wrp.css('cursor', 'default');
2575				crsl.swipe = false;
2576			}
2577			if (crsl.mousewheel)
2578			{
2579				crsl.mousewheel = false;
2580			}
2581
2582			nv_showNavi(opts, 'hide', conf);
2583			nv_enableNavi(opts, 'removeClass', conf);
2584
2585		};	//	/unbind_buttons
2586
2587
2588
2589		//	START
2590
2591		if (is_boolean(configs))
2592		{
2593			configs = {
2594				'debug': configs
2595			};
2596		}
2597
2598		//	set vars
2599		var crsl = {
2600				'direction'		: 'next',
2601				'isPaused'		: true,
2602				'isScrolling'	: false,
2603				'isStopped'		: false,
2604				'mousewheel'	: false,
2605				'swipe'			: false
2606			},
2607			itms = {
2608				'total'			: $cfs.children().length,
2609				'first'			: 0
2610			},
2611			tmrs = {
2612				'auto'			: null,
2613				'progress'		: null,
2614				'startTime'		: getTime(),
2615				'timePassed'	: 0
2616			},
2617			scrl = {
2618				'isStopped'		: false,
2619				'duration'		: 0,
2620				'startTime'		: 0,
2621				'easing'		: '',
2622				'anims'			: []
2623			},
2624			clbk = {
2625				'onBefore'		: [],
2626				'onAfter'		: []
2627			},
2628			queu = [],
2629			conf = $.extend(true, {}, $.fn.carouFredSel.configs, configs),
2630			opts = {},
2631			opts_orig = $.extend(true, {}, options),
2632			$wrp = (conf.wrapper == 'parent')
2633				? $cfs.parent()
2634				: $cfs.wrap('<'+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent();
2635
2636		$carwrap = $wrp.wrap('<div class="carousel-wrap" style="position: relative;" />').parent();
2637
2638		if(undefined != options.prev || undefined != options.pagination){
2639			$slidernav = $carwrap.append('<div class="carousel-nav-wrap" />');
2640			if( undefined != options.prev )
2641				$('.carousel-nav-wrap', $slidernav).append('<a href="#" class="carousel-prev">&laquo;</a>');
2642
2643			if( undefined != options.pagination )
2644				$('.carousel-nav-wrap', $slidernav).append('<div class="carousel-pager"></div>');
2645
2646			if( undefined != options.prev )
2647				$('.carousel-nav-wrap', $slidernav).append('<a href="#" class="carousel-next">&raquo;</a>');
2648		}
2649
2650		conf.selector		= $cfs.selector;
2651		conf.serialNumber	= $.fn.carouFredSel.serialNumber++;
2652
2653		conf.transition = (conf.transition && $.fn.transition) ? 'transition' : 'animate';
2654
2655		//	create carousel
2656		FN._init(opts_orig, true, starting_position);
2657		FN._build();
2658		FN._bind_events();
2659		FN._bind_buttons();
2660
2661		//	find item to start
2662		if (is_array(opts.items.start))
2663		{
2664			var start_arr = opts.items.start;
2665		}
2666		else
2667		{
2668			var start_arr = [];
2669			if (opts.items.start != 0)
2670			{
2671				start_arr.push(opts.items.start);
2672			}
2673		}
2674		if (opts.cookie)
2675		{
2676			start_arr.unshift(parseInt(cf_getCookie(opts.cookie), 10));
2677		}
2678
2679		if (start_arr.length > 0)
2680		{
2681			for (var a = 0, l = start_arr.length; a < l; a++)
2682			{
2683				var s = start_arr[a];
2684				if (s == 0)
2685				{
2686					continue;
2687				}
2688				if (s === true)
2689				{
2690					s = window.location.hash;
2691					if (s.length < 1)
2692					{
2693						continue;
2694					}
2695				}
2696				else if (s === 'random')
2697				{
2698					s = Math.floor(Math.random()*itms.total);
2699				}
2700				if ($cfs.triggerHandler(cf_e('slideTo', conf), [s, 0, true, { fx: 'none' }]))
2701				{
2702					break;
2703				}
2704			}
2705		}
2706		var siz = sz_setSizes($cfs, opts),
2707			itm = gi_getCurrentItems($cfs.children(), opts);
2708
2709		if (opts.onCreate)
2710		{
2711			opts.onCreate.call($tt0, {
2712				'width': siz.width,
2713				'height': siz.height,
2714				'items': itm
2715			});
2716		}
2717
2718		$cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]);
2719		$cfs.trigger(cf_e('linkAnchors', conf));
2720
2721		if (conf.debug)
2722		{
2723			$cfs.trigger(cf_e('debug', conf));
2724		}
2725
2726		return $cfs;
2727	};
2728
2729
2730
2731	//	GLOBAL PUBLIC
2732
2733	$.fn.carouFredSel.serialNumber = 1;
2734	$.fn.carouFredSel.defaults = {
2735		'synchronise'	: false,
2736		'infinite'		: true,
2737		'circular'		: true,
2738		'responsive'	: false,
2739		'direction'		: 'left',
2740		'items'			: {
2741			'start'			: 0
2742		},
2743		'scroll'		: {
2744			'easing'		: 'swing',
2745			'duration'		: 500,
2746			'pauseOnHover'	: false,
2747			'event'			: 'click',
2748			'queue'			: false
2749		}
2750	};
2751	$.fn.carouFredSel.configs = {
2752		'debug'			: false,
2753		'transition'	: false,
2754		'onWindowResize': 'throttle',
2755		'events'		: {
2756			'prefix'		: '',
2757			'namespace'		: 'cfs'
2758		},
2759		'wrapper'		: {
2760			'element'		: 'div',
2761			'classname'		: 'caroufredsel_wrapper'
2762		},
2763		'classnames'	: {}
2764	};
2765	$.fn.carouFredSel.pageAnchorBuilder = function(nr) {
2766		return '<a href="#"><span>'+nr+'</span></a>';
2767	};
2768	$.fn.carouFredSel.progressbarUpdater = function(perc) {
2769		$(this).css('width', perc+'%');
2770	};
2771
2772	$.fn.carouFredSel.cookie = {
2773		get: function(n) {
2774			n += '=';
2775			var ca = document.cookie.split(';');
2776			for (var a = 0, l = ca.length; a < l; a++)
2777			{
2778				var c = ca[a];
2779				while (c.charAt(0) == ' ')
2780				{
2781					c = c.slice(1);
2782				}
2783				if (c.indexOf(n) == 0)
2784				{
2785					return c.slice(n.length);
2786				}
2787			}
2788			return 0;
2789		},
2790		set: function(n, v, d) {
2791			var e = "";
2792			if (d)
2793			{
2794				var date = new Date();
2795				date.setTime(date.getTime() + (d * 24 * 60 * 60 * 1000));
2796				e = "; expires=" + date.toGMTString();
2797			}
2798			document.cookie = n + '=' + v + e + '; path=/';
2799		},
2800		remove: function(n) {
2801			$.fn.carouFredSel.cookie.set(n, "", -1);
2802		}
2803	};
2804
2805
2806	//	GLOBAL PRIVATE
2807
2808	//	scrolling functions
2809	function sc_setScroll(d, e, c) {
2810		if (c.transition == 'transition')
2811		{
2812			if (e == 'swing')
2813			{
2814				e = 'ease';
2815			}
2816		}
2817		return {
2818			anims: [],
2819			duration: d,
2820			orgDuration: d,
2821			easing: e,
2822			startTime: getTime()
2823		};
2824	}
2825	function sc_startScroll(s, c) {
2826		for (var a = 0, l = s.anims.length; a < l; a++)
2827		{
2828			var b = s.anims[a];
2829			if (!b)
2830			{
2831				continue;
2832			}
2833			b[0][c.transition](b[1], s.duration, s.easing, b[2]);
2834		}
2835	}
2836	function sc_stopScroll(s, finish) {
2837		if (!is_boolean(finish))
2838		{
2839			finish = true;
2840		}
2841		if (is_object(s.pre))
2842		{
2843			sc_stopScroll(s.pre, finish);
2844		}
2845		for (var a = 0, l = s.anims.length; a < l; a++)
2846		{
2847			var b = s.anims[a];
2848			b[0].stop(true);
2849			if (finish)
2850			{
2851				b[0].css(b[1]);
2852				if (is_function(b[2]))
2853				{
2854					b[2]();
2855				}
2856			}
2857		}
2858		if (is_object(s.post))
2859		{
2860			sc_stopScroll(s.post, finish);
2861		}
2862	}
2863	function sc_afterScroll( $c, $c2, o ) {
2864		if ($c2)
2865		{
2866			$c2.remove();
2867		}
2868
2869		switch(o.fx) {
2870			case 'fade':
2871			case 'crossfade':
2872			case 'cover-fade':
2873			case 'uncover-fade':
2874				$c.css('opacity', 1);
2875				$c.css('filter', '');
2876				break;
2877		}
2878	}
2879	function sc_fireCallbacks($t, o, b, a, c) {
2880		if (o[b])
2881		{
2882			o[b].call($t, a);
2883		}
2884		if (c[b].length)
2885		{
2886			for (var i = 0, l = c[b].length; i < l; i++)
2887			{
2888				c[b][i].call($t, a);
2889			}
2890		}
2891		return [];
2892	}
2893	function sc_fireQueue($c, q, c) {
2894
2895		if (q.length)
2896		{
2897			$c.trigger(cf_e(q[0][0], c), q[0][1]);
2898			q.shift();
2899		}
2900		return q;
2901	}
2902	function sc_hideHiddenItems(hiddenitems) {
2903		hiddenitems.each(function() {
2904			var hi = $(this);
2905			hi.data('_cfs_isHidden', hi.is(':hidden')).hide();
2906		});
2907	}
2908	function sc_showHiddenItems(hiddenitems) {
2909		if (hiddenitems)
2910		{
2911			hiddenitems.each(function() {
2912				var hi = $(this);
2913				if (!hi.data('_cfs_isHidden'))
2914				{
2915					hi.show();
2916				}
2917			});
2918		}
2919	}
2920	function sc_clearTimers(t) {
2921		if (t.auto)
2922		{
2923			clearTimeout(t.auto);
2924		}
2925		if (t.progress)
2926		{
2927			clearInterval(t.progress);
2928		}
2929		return t;
2930	}
2931	function sc_mapCallbackArguments(i_old, i_skp, i_new, s_itm, s_dir, s_dur, w_siz) {
2932		return {
2933			'width': w_siz.width,
2934			'height': w_siz.height,
2935			'items': {
2936				'old': i_old,
2937				'skipped': i_skp,
2938				'visible': i_new
2939			},
2940			'scroll': {
2941				'items': s_itm,
2942				'direction': s_dir,
2943				'duration': s_dur
2944			}
2945		};
2946	}
2947	function sc_getDuration( sO, o, nI, siz ) {
2948		var dur = sO.duration;
2949		if (sO.fx == 'none')
2950		{
2951			return 0;
2952		}
2953		if (dur == 'auto')
2954		{
2955			dur = o.scroll.duration / o.scroll.items * nI;
2956		}
2957		else if (dur < 10)
2958		{
2959			dur = siz / dur;
2960		}
2961		if (dur < 1)
2962		{
2963			return 0;
2964		}
2965		if (sO.fx == 'fade')
2966		{
2967			dur = dur / 2;
2968		}
2969		return Math.round(dur);
2970	}
2971
2972	//	navigation functions
2973	function nv_showNavi(o, t, c) {
2974		var minimum = (is_number(o.items.minimum)) ? o.items.minimum : o.items.visible + 1;
2975		if (t == 'show' || t == 'hide')
2976		{
2977			var f = t;
2978		}
2979		else if (minimum > t)
2980		{
2981			debug(c, 'Not enough items ('+t+' total, '+minimum+' needed): Hiding navigation.');
2982			var f = 'hide';
2983		}
2984		else
2985		{
2986			var f = 'show';
2987		}
2988		var s = (f == 'show') ? 'removeClass' : 'addClass',
2989			h = cf_c('hidden', c);
2990
2991		if (o.auto.button)
2992		{
2993			o.auto.button[f]()[s](h);
2994		}
2995		if (o.prev.button)
2996		{
2997			o.prev.button[f]()[s](h);
2998		}
2999		if (o.next.button)
3000		{
3001			o.next.button[f]()[s](h);
3002		}
3003		if (o.pagination.container)
3004		{
3005			o.pagination.container[f]()[s](h);
3006		}
3007	}
3008	function nv_enableNavi(o, f, c) {
3009		if (o.circular || o.infinite) return;
3010		var fx = (f == 'removeClass' || f == 'addClass') ? f : false,
3011			di = cf_c('disabled', c);
3012
3013		if (o.auto.button && fx)
3014		{
3015			o.auto.button[fx](di);
3016		}
3017		if (o.prev.button)
3018		{
3019			var fn = fx || (f == 0) ? 'addClass' : 'removeClass';
3020			o.prev.button[fn](di);
3021		}
3022		if (o.next.button)
3023		{
3024			var fn = fx || (f == o.items.visible) ? 'addClass' : 'removeClass';
3025			o.next.button[fn](di);
3026		}
3027	}
3028
3029	//	get object functions
3030	function go_getObject($tt, obj) {
3031		if (is_function(obj))
3032		{
3033			obj = obj.call($tt);
3034		}
3035		else if (is_undefined(obj))
3036		{
3037			obj = {};
3038		}
3039		return obj;
3040	}
3041	function go_getItemsObject($tt, obj) {
3042		obj = go_getObject($tt, obj);
3043		if (is_number(obj))
3044		{
3045			obj	= {
3046				'visible': obj
3047			};
3048		}
3049		else if (obj == 'variable')
3050		{
3051			obj = {
3052				'visible': obj,
3053				'width': obj,
vendor: 8,094 bytes, lines 3053-3556
3053
3054				'height': obj
3055			};
3056		}
3057		else if (!is_object(obj))
3058		{
3059			obj = {};
3060		}
3061		return obj;
3062	}
3063	function go_getScrollObject($tt, obj) {
3064		obj = go_getObject($tt, obj);
3065		if (is_number(obj))
3066		{
3067			if (obj <= 50)
3068			{
3069				obj = {
3070					'items': obj
3071				};
3072			}
3073			else
3074			{
3075				obj = {
3076					'duration': obj
3077				};
3078			}
3079		}
3080		else if (is_string(obj))
3081		{
3082			obj = {
3083				'easing': obj
3084			};
3085		}
3086		else if (!is_object(obj))
3087		{
3088			obj = {};
3089		}
3090		return obj;
3091	}
3092	function go_getNaviObject($tt, obj) {
3093		obj = go_getObject($tt, obj);
3094		if (is_string(obj))
3095		{
3096			var temp = cf_getKeyCode(obj);
3097			if (temp == -1)
3098			{
3099				obj = $(obj);
3100			}
3101			else
3102			{
3103				obj = temp;
3104			}
3105		}
3106		return obj;
3107	}
3108
3109	function go_getAutoObject($tt, obj) {
3110		obj = go_getNaviObject($tt, obj);
3111		if (is_jquery(obj))
3112		{
3113			obj = {
3114				'button': obj
3115			};
3116		}
3117		else if (is_boolean(obj))
3118		{
3119			obj = {
3120				'play': obj
3121			};
3122		}
3123		else if (is_number(obj))
3124		{
3125			obj = {
3126				'timeoutDuration': obj
3127			};
3128		}
3129		if (obj.progress)
3130		{
3131			if (is_string(obj.progress) || is_jquery(obj.progress))
3132			{
3133				obj.progress = {
3134					'bar': obj.progress
3135				};
3136			}
3137		}
3138		return obj;
3139	}
3140	function go_complementAutoObject($tt, obj) {
3141		if (is_function(obj.button))
3142		{
3143			obj.button = obj.button.call($tt);
3144		}
3145		if (is_string(obj.button))
3146		{
3147			obj.button = $(obj.button);
3148		}
3149		if (!is_boolean(obj.play))
3150		{
3151			obj.play = true;
3152		}
3153		if (!is_number(obj.delay))
3154		{
3155			obj.delay = 0;
3156		}
3157		if (is_undefined(obj.pauseOnEvent))
3158		{
3159			obj.pauseOnEvent = true;
3160		}
3161		if (!is_boolean(obj.pauseOnResize))
3162		{
3163			obj.pauseOnResize = true;
3164		}
3165		if (!is_number(obj.timeoutDuration))
3166		{
3167			obj.timeoutDuration = (obj.duration < 10)
3168				? 2500
3169				: obj.duration * 5;
3170		}
3171		if (obj.progress)
3172		{
3173			if (is_function(obj.progress.bar))
3174			{
3175				obj.progress.bar = obj.progress.bar.call($tt);
3176			}
3177			if (is_string(obj.progress.bar))
3178			{
3179				obj.progress.bar = $(obj.progress.bar);
3180			}
3181			if (obj.progress.bar)
3182			{
3183				if (!is_function(obj.progress.updater))
3184				{
3185					obj.progress.updater = $.fn.carouFredSel.progressbarUpdater;
3186				}
3187				if (!is_number(obj.progress.interval))
3188				{
3189					obj.progress.interval = 50;
3190				}
3191			}
3192			else
3193			{
3194				obj.progress = false;
3195			}
3196		}
3197		return obj;
3198	}
3199
3200	function go_getPrevNextObject($tt, obj) {
3201		obj = go_getNaviObject($tt, obj);
3202		if (is_jquery(obj))
3203		{
3204			obj = {
3205				'button': obj
3206			};
3207		}
3208		else if (is_number(obj))
3209		{
3210			obj = {
3211				'key': obj
3212			};
3213		}
3214		return obj;
3215	}
3216	function go_complementPrevNextObject($tt, obj) {
3217		if (is_function(obj.button))
3218		{
3219			obj.button = obj.button.call($tt);
3220		}
3221		if (is_string(obj.button))
3222		{
3223			obj.button = $(obj.button);
3224		}
3225		if (is_string(obj.key))
3226		{
3227			obj.key = cf_getKeyCode(obj.key);
3228		}
3229		return obj;
3230	}
3231
3232	function go_getPaginationObject($tt, obj) {
3233		obj = go_getNaviObject($tt, obj);
3234		if (is_jquery(obj))
3235		{
3236			obj = {
3237				'container': obj
3238			};
3239		}
3240		else if (is_boolean(obj))
3241		{
3242			obj = {
3243				'keys': obj
3244			};
3245		}
3246		return obj;
3247	}
3248	function go_complementPaginationObject($tt, obj) {
3249		if (is_function(obj.container))
3250		{
3251			obj.container = obj.container.call($tt);
3252		}
3253		if (is_string(obj.container))
3254		{
3255			obj.container = $(obj.container);
3256		}
3257		if (!is_number(obj.items))
3258		{
3259			obj.items = false;
3260		}
3261		if (!is_boolean(obj.keys))
3262		{
3263			obj.keys = false;
3264		}
3265		if (!is_function(obj.anchorBuilder) && !is_false(obj.anchorBuilder))
3266		{
3267			obj.anchorBuilder = $.fn.carouFredSel.pageAnchorBuilder;
3268		}
3269		if (!is_number(obj.deviation))
3270		{
3271			obj.deviation = 0;
3272		}
3273		return obj;
3274	}
3275
3276	function go_getSwipeObject($tt, obj) {
3277		if (is_function(obj))
3278		{
3279			obj = obj.call($tt);
3280		}
3281		if (is_undefined(obj))
3282		{
3283			obj = {
3284				'onTouch': false
3285			};
3286		}
3287		if (is_true(obj))
3288		{
3289			obj = {
3290				'onTouch': obj
3291			};
3292		}
3293		else if (is_number(obj))
3294		{
3295			obj = {
3296				'items': obj
3297			};
3298		}
3299		return obj;
3300	}
3301	function go_complementSwipeObject($tt, obj) {
3302		if (!is_boolean(obj.onTouch))
3303		{
3304			obj.onTouch = true;
3305		}
3306		if (!is_boolean(obj.onMouse))
3307		{
3308			obj.onMouse = false;
3309		}
3310		if (!is_object(obj.options))
3311		{
3312			obj.options = {};
3313		}
3314		if (!is_boolean(obj.options.triggerOnTouchEnd))
3315		{
3316			obj.options.triggerOnTouchEnd = false;
3317		}
3318		return obj;
3319	}
3320	function go_getMousewheelObject($tt, obj) {
3321		if (is_function(obj))
3322		{
3323			obj = obj.call($tt);
3324		}
3325		if (is_true(obj))
3326		{
3327			obj = {};
3328		}
3329		else if (is_number(obj))
3330		{
3331			obj = {
3332				'items': obj
3333			};
3334		}
3335		else if (is_undefined(obj))
3336		{
3337			obj = false;
3338		}
3339		return obj;
3340	}
3341	function go_complementMousewheelObject($tt, obj) {
3342		return obj;
3343	}
3344
3345	//	get number functions
3346	function gn_getItemIndex(num, dev, org, items, $cfs) {
3347		if (is_string(num))
3348		{
3349			num = $(num, $cfs);
3350		}
3351
3352		if (is_object(num))
3353		{
3354			num = $(num, $cfs);
3355		}
3356		if (is_jquery(num))
3357		{
3358			num = $cfs.children().index(num);
3359			if (!is_boolean(org))
3360			{
3361				org = false;
3362			}
3363		}
3364		else
3365		{
3366			if (!is_boolean(org))
3367			{
3368				org = true;
3369			}
3370		}
3371		if (!is_number(num))
3372		{
3373			num = 0;
3374		}
3375		if (!is_number(dev))
3376		{
3377			dev = 0;
3378		}
3379
3380		if (org)
3381		{
3382			num += items.first;
3383		}
3384		num += dev;
3385		if (items.total > 0)
3386		{
3387			while (num >= items.total)
3388			{
3389				num -= items.total;
3390			}
3391			while (num < 0)
3392			{
3393				num += items.total;
3394			}
3395		}
3396		return num;
3397	}
3398
3399	//	items prev
3400	function gn_getVisibleItemsPrev(i, o, s) {
3401		var t = 0,
3402			x = 0;
3403
3404		for (var a = s; a >= 0; a--)
3405		{
3406			var j = i.eq(a);
3407			t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0;
3408			if (t > o.maxDimension)
3409			{
3410				return x;
3411			}
3412			if (a == 0)
3413			{
3414				a = i.length;
3415			}
3416			x++;
3417		}
3418	}
3419	function gn_getVisibleItemsPrevFilter(i, o, s) {
3420		return gn_getItemsPrevFilter(i, o.items.filter, o.items.visibleConf.org, s);
3421	}
3422	function gn_getScrollItemsPrevFilter(i, o, s, m) {
3423		return gn_getItemsPrevFilter(i, o.items.filter, m, s);
3424	}
3425	function gn_getItemsPrevFilter(i, f, m, s) {
3426		var t = 0,
3427			x = 0;
3428
3429		for (var a = s, l = i.length; a >= 0; a--)
3430		{
3431			x++;
3432			if (x == l)
3433			{
3434				return x;
3435			}
3436
3437			var j = i.eq(a);
3438			if (j.is(f))
3439			{
3440				t++;
3441				if (t == m)
3442				{
3443					return x;
3444				}
3445			}
3446			if (a == 0)
3447			{
3448				a = l;
3449			}
3450		}
3451	}
3452
3453	function gn_getVisibleOrg($c, o) {
3454		return o.items.visibleConf.org || $c.children().slice(0, o.items.visible).filter(o.items.filter).length;
3455	}
3456
3457	//	items next
3458	function gn_getVisibleItemsNext(i, o, s) {
3459		var t = 0,
3460			x = 0;
3461
3462		for (var a = s, l = i.length-1; a <= l; a++)
3463		{
3464			var j = i.eq(a);
3465
3466			t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0;
3467			if (t > o.maxDimension)
3468			{
3469				return x;
3470			}
3471
3472			x++;
3473			if (x == l+1)
3474			{
3475				return x;
3476			}
3477			if (a == l)
3478			{
3479				a = -1;
3480			}
3481		}
3482	}
3483	function gn_getVisibleItemsNextTestCircular(i, o, s, l) {
3484		var v = gn_getVisibleItemsNext(i, o, s);
3485		if (!o.circular)
3486		{
3487			if (s + v > l)
3488			{
3489				v = l - s;
3490			}
3491		}
3492		return v;
3493	}
3494	function gn_getVisibleItemsNextFilter(i, o, s) {
3495		return gn_getItemsNextFilter(i, o.items.filter, o.items.visibleConf.org, s, o.circular);
3496	}
3497	function gn_getScrollItemsNextFilter(i, o, s, m) {
3498		return gn_getItemsNextFilter(i, o.items.filter, m+1, s, o.circular) - 1;
3499	}
3500	function gn_getItemsNextFilter(i, f, m, s, c) {
3501		var t = 0,
3502			x = 0;
3503
3504		for (var a = s, l = i.length-1; a <= l; a++)
3505		{
3506			x++;
3507			if (x >= l)
3508			{
3509				return x;
3510			}
3511
3512			var j = i.eq(a);
3513			if (j.is(f))
3514			{
3515				t++;
3516				if (t == m)
3517				{
3518					return x;
3519				}
3520			}
3521			if (a == l)
3522			{
3523				a = -1;
3524			}
3525		}
3526	}
3527
3528	//	get items functions
3529	function gi_getCurrentItems(i, o) {
3530		return i.slice(0, o.items.visible);
3531	}
3532	function gi_getOldItemsPrev(i, o, n) {
3533		return i.slice(n, o.items.visibleConf.old+n);
3534	}
3535	function gi_getNewItemsPrev(i, o) {
3536		return i.slice(0, o.items.visible);
3537	}
3538	function gi_getOldItemsNext(i, o) {
3539		return i.slice(0, o.items.visibleConf.old);
3540	}
3541	function gi_getNewItemsNext(i, o, n) {
3542		return i.slice(n, o.items.visible+n);
3543	}
3544
3545	//	sizes functions
3546	function sz_storeMargin(i, o, d) {
3547		if (o.usePadding)
3548		{
3549			if (!is_string(d))
3550			{
3551				d = '_cfs_origCssMargin';
3552			}
3553			i.each(function() {
3554				var j = $(this),
3555					m = parseInt(j.css(o.d['marginRight']), 10);
3556				if (!is_number(m))
vendor: 10,092 bytes, lines 3556-4089
3556
3557				{
3558					m = 0;
3559				}
3560				j.data(d, m);
3561			});
3562		}
3563	}
3564	function sz_resetMargin(i, o, m) {
3565		if (o.usePadding)
3566		{
3567			var x = (is_boolean(m)) ? m : false;
3568			if (!is_number(m))
3569			{
3570				m = 0;
3571			}
3572			sz_storeMargin(i, o, '_cfs_tempCssMargin');
3573			i.each(function() {
3574				var j = $(this);
3575				j.css(o.d['marginRight'], ((x) ? j.data('_cfs_tempCssMargin') : m + j.data('_cfs_origCssMargin')));
3576			});
3577		}
3578	}
3579	function sz_storeOrigCss(i) {
3580		i.each(function() {
3581			var j = $(this);
3582			j.data('_cfs_origCss', j.attr('style') || '');
3583		});
3584	}
3585	function sz_restoreOrigCss(i) {
3586		i.each(function() {
3587			var j = $(this);
3588			j.attr('style', j.data('_cfs_origCss') || '');
3589		});
3590	}
3591	function sz_setResponsiveSizes(o, all) {
3592		var visb = o.items.visible,
3593			newS = o.items[o.d['width']],
3594			seco = o[o.d['height']],
3595			secp = is_percentage(seco);
3596
3597		all.each(function() {
3598			var $t = $(this),
3599				nw = newS - ms_getPaddingBorderMargin($t, o, 'Width');
3600
3601			$t[o.d['width']](nw);
3602			if (secp)
3603			{
3604				$t[o.d['height']](ms_getPercentage(nw, seco));
3605			}
3606		});
3607	}
3608	function sz_setSizes($c, o) {
3609		var $w = $c.parent(),
3610			$i = $c.children(),
3611			$v = gi_getCurrentItems($i, o),
3612			sz = cf_mapWrapperSizes(ms_getSizes($v, o, true), o, false);
3613
3614		$w.css(sz);
3615
3616		if (o.usePadding)
3617		{
3618			var p = o.padding,
3619				r = p[o.d[1]];
3620
3621			if (o.align && r < 0)
3622			{
3623				r = 0;
3624			}
3625			var $l = $v.last();
3626			$l.css(o.d['marginRight'], $l.data('_cfs_origCssMargin') + r);
3627			$c.css(o.d['top'], p[o.d[0]]);
3628			$c.css(o.d['left'], p[o.d[3]]);
3629		}
3630
3631		$c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2));
3632		$c.css(o.d['height'], ms_getLargestSize($i, o, 'height'));
3633		return sz;
3634	}
3635
3636	//	measuring functions
3637	function ms_getSizes(i, o, wrapper) {
3638		return [ms_getTotalSize(i, o, 'width', wrapper), ms_getLargestSize(i, o, 'height', wrapper)];
3639	}
3640	function ms_getLargestSize(i, o, dim, wrapper) {
3641		if (!is_boolean(wrapper))
3642		{
3643			wrapper = false;
3644		}
3645		if (is_number(o[o.d[dim]]) && wrapper)
3646		{
3647			return o[o.d[dim]];
3648		}
3649		if (is_number(o.items[o.d[dim]]))
3650		{
3651			return o.items[o.d[dim]];
3652		}
3653		dim = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight';
3654		return ms_getTrueLargestSize(i, o, dim);
3655	}
3656	function ms_getTrueLargestSize(i, o, dim) {
3657		var s = 0;
3658
3659		for (var a = 0, l = i.length; a < l; a++)
3660		{
3661			var j = i.eq(a);
3662
3663			var m = (j.is(':visible')) ? j[o.d[dim]](true) : 0;
3664			if (s < m)
3665			{
3666				s = m;
3667			}
3668		}
3669		return s;
3670	}
3671
3672	function ms_getTotalSize(i, o, dim, wrapper) {
3673		if (!is_boolean(wrapper))
3674		{
3675			wrapper = false;
3676		}
3677		if (is_number(o[o.d[dim]]) && wrapper)
3678		{
3679			return o[o.d[dim]];
3680		}
3681		if (is_number(o.items[o.d[dim]]))
3682		{
3683			return o.items[o.d[dim]] * i.length;
3684		}
3685
3686		var d = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight',
3687			s = 0;
3688
3689		for (var a = 0, l = i.length; a < l; a++)
3690		{
3691			var j = i.eq(a);
3692			s += (j.is(':visible')) ? j[o.d[d]](true) : 0;
3693		}
3694		return s;
3695	}
3696	function ms_getParentSize($w, o, d) {
3697		var isVisible = $w.is(':visible');
3698		if (isVisible)
3699		{
3700			$w.hide();
3701		}
3702		var s = $w.parent()[o.d[d]]();
3703		if (isVisible)
3704		{
3705			$w.show();
3706		}
3707		return s;
3708	}
3709	function ms_getMaxDimension(o, a) {
3710		return (is_number(o[o.d['width']])) ? o[o.d['width']] : a;
3711	}
3712	function ms_hasVariableSizes(i, o, dim) {
3713		var s = false,
3714			v = false;
3715
3716		for (var a = 0, l = i.length; a < l; a++)
3717		{
3718			var j = i.eq(a);
3719
3720			var c = (j.is(':visible')) ? j[o.d[dim]](true) : 0;
3721			if (s === false)
3722			{
3723				s = c;
3724			}
3725			else if (s != c)
3726			{
3727				v = true;
3728			}
3729			if (s == 0)
3730			{
3731				v = true;
3732			}
3733		}
3734		return v;
3735	}
3736	function ms_getPaddingBorderMargin(i, o, d) {
3737		return i[o.d['outer'+d]](true) - i[o.d[d.toLowerCase()]]();
3738	}
3739	function ms_getPercentage(s, o) {
3740		if (is_percentage(o))
3741		{
3742			o = parseInt( o.slice(0, -1), 10 );
3743			if (!is_number(o))
3744			{
3745				return s;
3746			}
3747			s *= o/100;
3748		}
3749		return s;
3750	}
3751
3752	//	config functions
3753	function cf_e(n, c, pf, ns, rd) {
3754		if (!is_boolean(pf))
3755		{
3756			pf = true;
3757		}
3758		if (!is_boolean(ns))
3759		{
3760			ns = true;
3761		}
3762		if (!is_boolean(rd))
3763		{
3764			rd = false;
3765		}
3766
3767		if (pf)
3768		{
3769			n = c.events.prefix + n;
3770		}
3771		if (ns)
3772		{
3773			n = n +'.'+ c.events.namespace;
3774		}
3775		if (ns && rd)
3776		{
3777			n += c.serialNumber;
3778		}
3779
3780		return n;
3781	}
3782	function cf_c(n, c) {
3783		return (is_string(c.classnames[n])) ? c.classnames[n] : n;
3784	}
3785	function cf_mapWrapperSizes(ws, o, p) {
3786		if (!is_boolean(p))
3787		{
3788			p = true;
3789		}
3790		var pad = (o.usePadding && p) ? o.padding : [0, 0, 0, 0];
3791		var wra = {};
3792
3793		wra[o.d['width']] = ws[0] + pad[1] + pad[3];
3794		wra[o.d['height']] = ws[1] + pad[0] + pad[2];
3795
3796		return wra;
3797	}
3798	function cf_sortParams(vals, typs) {
3799		var arr = [];
3800		for (var a = 0, l1 = vals.length; a < l1; a++)
3801		{
3802			for (var b = 0, l2 = typs.length; b < l2; b++)
3803			{
3804				if (typs[b].indexOf(typeof vals[a]) > -1 && is_undefined(arr[b]))
3805				{
3806					arr[b] = vals[a];
3807					break;
3808				}
3809			}
3810		}
3811		return arr;
3812	}
3813	function cf_getPadding(p) {
3814		if (is_undefined(p))
3815		{
3816			return [0, 0, 0, 0];
3817		}
3818		if (is_number(p))
3819		{
3820			return [p, p, p, p];
3821		}
3822		if (is_string(p))
3823		{
3824			p = p.split('px').join('').split('em').join('').split(' ');
3825		}
3826
3827		if (!is_array(p))
3828		{
3829			return [0, 0, 0, 0];
3830		}
3831		for (var i = 0; i < 4; i++)
3832		{
3833			p[i] = parseInt(p[i], 10);
3834		}
3835		switch (p.length)
3836		{
3837			case 0:
3838				return [0, 0, 0, 0];
3839			case 1:
3840				return [p[0], p[0], p[0], p[0]];
3841			case 2:
3842				return [p[0], p[1], p[0], p[1]];
3843			case 3:
3844				return [p[0], p[1], p[2], p[1]];
3845			default:
3846				return [p[0], p[1], p[2], p[3]];
3847		}
3848	}
3849	function cf_getAlignPadding(itm, o) {
3850		var x = (is_number(o[o.d['width']])) ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')) : 0;
3851		switch (o.align)
3852		{
3853			case 'left':
3854				return [0, x];
3855			case 'right':
3856				return [x, 0];
3857			case 'center':
3858			default:
3859				return [Math.ceil(x/2), Math.floor(x/2)];
3860		}
3861	}
3862	function cf_getDimensions(o) {
3863		var dm = [
3864				['width'	, 'innerWidth'	, 'outerWidth'	, 'height'	, 'innerHeight'	, 'outerHeight'	, 'left', 'top'	, 'marginRight'	, 0, 1, 2, 3],
3865				['height'	, 'innerHeight'	, 'outerHeight'	, 'width'	, 'innerWidth'	, 'outerWidth'	, 'top'	, 'left', 'marginBottom', 3, 2, 1, 0]
3866			];
3867
3868		var dl = dm[0].length,
3869			dx = (o.direction == 'right' || o.direction == 'left') ? 0 : 1;
3870
3871		var dimensions = {};
3872		for (var d = 0; d < dl; d++)
3873		{
3874			dimensions[dm[0][d]] = dm[dx][d];
3875		}
3876		return dimensions;
3877	}
3878	function cf_getAdjust(x, o, a, $t) {
3879		var v = x;
3880		if (is_function(a))
3881		{
3882			v = a.call($t, v);
3883
3884		}
3885		else if (is_string(a))
3886		{
3887			var p = a.split('+'),
3888				m = a.split('-');
3889
3890			if (m.length > p.length)
3891			{
3892				var neg = true,
3893					sta = m[0],
3894					adj = m[1];
3895			}
3896			else
3897			{
3898				var neg = false,
3899					sta = p[0],
3900					adj = p[1];
3901			}
3902
3903			switch(sta)
3904			{
3905				case 'even':
3906					v = (x % 2 == 1) ? x-1 : x;
3907					break;
3908				case 'odd':
3909					v = (x % 2 == 0) ? x-1 : x;
3910					break;
3911				default:
3912					v = x;
3913					break;
3914			}
3915			adj = parseInt(adj, 10);
3916			if (is_number(adj))
3917			{
3918				if (neg)
3919				{
3920					adj = -adj;
3921				}
3922				v += adj;
3923			}
3924		}
3925		if (!is_number(v) || v < 1)
3926		{
3927			v = 1;
3928		}
3929		return v;
3930	}
3931	function cf_getItemsAdjust(x, o, a, $t) {
3932		return cf_getItemAdjustMinMax(cf_getAdjust(x, o, a, $t), o.items.visibleConf);
3933	}
3934	function cf_getItemAdjustMinMax(v, i) {
3935		if (is_number(i.min) && v < i.min)
3936		{
3937			v = i.min;
3938		}
3939		if (is_number(i.max) && v > i.max)
3940		{
3941			v = i.max;
3942		}
3943		if (v < 1)
3944		{
3945			v = 1;
3946		}
3947		return v;
3948	}
3949	function cf_getSynchArr(s) {
3950		if (!is_array(s))
3951		{
3952			s = [[s]];
3953		}
3954		if (!is_array(s[0]))
3955		{
3956			s = [s];
3957		}
3958		for (var j = 0, l = s.length; j < l; j++)
3959		{
3960			if (is_string(s[j][0]))
3961			{
3962				s[j][0] = $(s[j][0]);
3963			}
3964			if (!is_boolean(s[j][1]))
3965			{
3966				s[j][1] = true;
3967			}
3968			if (!is_boolean(s[j][2]))
3969			{
3970				s[j][2] = true;
3971			}
3972			if (!is_number(s[j][3]))
3973			{
3974				s[j][3] = 0;
3975			}
3976		}
3977		return s;
3978	}
3979	function cf_getKeyCode(k) {
3980		if (k == 'right')
3981		{
3982			return 39;
3983		}
3984		if (k == 'left')
3985		{
3986			return 37;
3987		}
3988		if (k == 'up')
3989		{
3990			return 38;
3991		}
3992		if (k == 'down')
3993		{
3994			return 40;
3995		}
3996		return -1;
3997	}
3998	function cf_setCookie(n, $c, c) {
3999		if (n)
4000		{
4001			var v = $c.triggerHandler(cf_e('currentPosition', c));
4002			$.fn.carouFredSel.cookie.set(n, v);
4003		}
4004	}
4005	function cf_getCookie(n) {
4006		var c = $.fn.carouFredSel.cookie.get(n);
4007		return (c == '') ? 0 : c;
4008	}
4009
4010	//	init function
4011	function in_mapCss($elem, props) {
4012		var css = {};
4013		for (var p = 0, l = props.length; p < l; p++)
4014		{
4015			css[props[p]] = $elem.css(props[p]);
4016		}
4017		return css;
4018	}
4019	function in_complementItems(obj, opt, itm, sta) {
4020		if (!is_object(obj.visibleConf))
4021		{
4022			obj.visibleConf = {};
4023		}
4024		if (!is_object(obj.sizesConf))
4025		{
4026			obj.sizesConf = {};
4027		}
4028
4029		if (obj.start == 0 && is_number(sta))
4030		{
4031			obj.start = sta;
4032		}
4033
4034		//	visible items
4035		if (is_object(obj.visible))
4036		{
4037			obj.visibleConf.min = obj.visible.min;
4038			obj.visibleConf.max = obj.visible.max;
4039			obj.visible = false;
4040		}
4041		else if (is_string(obj.visible))
4042		{
4043			//	variable visible items
4044			if (obj.visible == 'variable')
4045			{
4046				obj.visibleConf.variable = true;
4047			}
4048			//	adjust string visible items
4049			else
4050			{
4051				obj.visibleConf.adjust = obj.visible;
4052			}
4053			obj.visible = false;
4054		}
4055		else if (is_function(obj.visible))
4056		{
4057			obj.visibleConf.adjust = obj.visible;
4058			obj.visible = false;
4059		}
4060
4061		//	set items filter
4062		if (!is_string(obj.filter))
4063		{
4064			obj.filter = (itm.filter(':hidden').length > 0) ? ':visible' : '*';
4065		}
4066
4067		//	primary item-size not set
4068		if (!obj[opt.d['width']])
4069		{
4070			//	responsive carousel -> set to largest
4071			if (opt.responsive)
4072			{
4073				debug(true, 'Set a '+opt.d['width']+' for the items!');
4074				obj[opt.d['width']] = ms_getTrueLargestSize(itm, opt, 'outerWidth');
4075			}
4076			//	 non-responsive -> measure it or set to "variable"
4077			else
4078			{
4079				obj[opt.d['width']] = (ms_hasVariableSizes(itm, opt, 'outerWidth'))
4080					? 'variable'
4081					: itm[opt.d['outerWidth']](true);
4082			}
4083		}
4084
4085		//	secondary item-size not set -> measure it or set to "variable"
4086		if (!obj[opt.d['height']])
4087		{
4088			obj[opt.d['height']] = (ms_hasVariableSizes(itm, opt, 'outerHeight'))
4089				? 'variable'
vendor: 3,722 bytes, lines 4089-4232
4089
4090				: itm[opt.d['outerHeight']](true);
4091		}
4092
4093		obj.sizesConf.width = obj.width;
4094		obj.sizesConf.height = obj.height;
4095		return obj;
4096	}
4097	function in_complementVisibleItems(opt, avl) {
4098		//	primary item-size variable -> set visible items variable
4099		if (opt.items[opt.d['width']] == 'variable')
4100		{
4101			opt.items.visibleConf.variable = true;
4102		}
4103		if (!opt.items.visibleConf.variable) {
4104			//	primary size is number -> calculate visible-items
4105			if (is_number(opt[opt.d['width']]))
4106			{
4107				opt.items.visible = Math.floor(opt[opt.d['width']] / opt.items[opt.d['width']]);
4108			}
4109			//	measure and calculate primary size and visible-items
4110			else
4111			{
4112				opt.items.visible = Math.floor(avl / opt.items[opt.d['width']]);
4113				opt[opt.d['width']] = opt.items.visible * opt.items[opt.d['width']];
4114				if (!opt.items.visibleConf.adjust)
4115				{
4116					opt.align = false;
4117				}
4118			}
4119			if (opt.items.visible == 'Infinity' || opt.items.visible < 1)
4120			{
4121				debug(true, 'Not a valid number of visible items: Set to "variable".');
4122				opt.items.visibleConf.variable = true;
4123			}
4124		}
4125		return opt;
4126	}
4127	function in_complementPrimarySize(obj, opt, all) {
4128		//	primary size set to auto -> measure largest item-size and set it
4129		if (obj == 'auto')
4130		{
4131			obj = ms_getTrueLargestSize(all, opt, 'outerWidth');
4132		}
4133		return obj;
4134	}
4135	function in_complementSecondarySize(obj, opt, all) {
4136		//	secondary size set to auto -> measure largest item-size and set it
4137		if (obj == 'auto')
4138		{
4139			obj = ms_getTrueLargestSize(all, opt, 'outerHeight');
4140		}
4141		//	secondary size not set -> set to secondary item-size
4142		if (!obj)
4143		{
4144			obj = opt.items[opt.d['height']];
4145		}
4146		return obj;
4147	}
4148	function in_getAlignPadding(o, all) {
4149		var p = cf_getAlignPadding(gi_getCurrentItems(all, o), o);
4150		o.padding[o.d[1]] = p[1];
4151		o.padding[o.d[3]] = p[0];
4152		return o;
4153	}
4154	function in_getResponsiveValues(o, all, avl) {
4155
4156		var visb = cf_getItemAdjustMinMax(Math.ceil(o[o.d['width']] / o.items[o.d['width']]), o.items.visibleConf);
4157		if (visb > all.length)
4158		{
4159			visb = all.length;
4160		}
4161
4162		var newS = Math.floor(o[o.d['width']]/visb);
4163
4164		o.items.visible = visb;
4165		o.items[o.d['width']] = newS;
4166		o[o.d['width']] = visb * newS;
4167		return o;
4168	}
4169
4170
4171	//	buttons functions
4172	function bt_pauseOnHoverConfig(p) {
4173		if (is_string(p))
4174		{
4175			var i = (p.indexOf('immediate') > -1) ? true : false,
4176				r = (p.indexOf('resume') 	> -1) ? true : false;
4177		}
4178		else
4179		{
4180			var i = r = false;
4181		}
4182		return [i, r];
4183	}
4184	function bt_mousesheelNumber(mw) {
4185		return (is_number(mw)) ? mw : null
4186	}
4187
4188	//	helper functions
4189	function is_null(a) {
4190		return (a === null);
4191	}
4192	function is_undefined(a) {
4193		return (is_null(a) || typeof a == 'undefined' || a === '' || a === 'undefined');
4194	}
4195	function is_array(a) {
4196		return (a instanceof Array);
4197	}
4198	function is_jquery(a) {
4199		return (a instanceof jQuery);
4200	}
4201	function is_object(a) {
4202		return ((a instanceof Object || typeof a == 'object') && !is_null(a) && !is_jquery(a) && !is_array(a) && !is_function(a));
4203	}
4204	function is_number(a) {
4205		return ((a instanceof Number || typeof a == 'number') && !isNaN(a));
4206	}
4207	function is_string(a) {
4208		return ((a instanceof String || typeof a == 'string') && !is_undefined(a) && !is_true(a) && !is_false(a));
4209	}
4210	function is_function(a) {
4211		return (a instanceof Function || typeof a == 'function');
4212	}
4213	function is_boolean(a) {
4214		return (a instanceof Boolean || typeof a == 'boolean' || is_true(a) || is_false(a));
4215	}
4216	function is_true(a) {
4217		return (a === true || a === 'true');
4218	}
4219	function is_false(a) {
4220		return (a === false || a === 'false');
4221	}
4222	function is_percentage(x) {
4223		return (is_string(x) && x.slice(-1) == '%');
4224	}
4225
4226
4227	function getTime() {
4228		return new Date().getTime();
4229	}
4230
4231	function deprecated( o, n ) {
4232		
vendor: 867 bytes, lines 4232-4282
4232//debug(true, o+' is DEPRECATED, support for it will be removed. Use '+n+' instead.');
4233	}
4234	function debug(d, m) {
4235		if (!is_undefined(window.console) && !is_undefined(window.console.log))
4236		{
4237			if (is_object(d))
4238			{
4239				var s = ' ('+d.selector+')';
4240				d = d.debug;
4241			}
4242			else
4243			{
4244				var s = '';
4245			}
4246			if (!d)
4247			{
4248				return false;
4249			}
4250
4251			if (is_string(m))
4252			{
4253				m = 'carouFredSel'+s+': ' + m;
4254			}
4255			else
4256			{
4257				m = ['carouFredSel'+s+':', m];
4258			}
4259			window.console.log(m);
4260		}
4261		return false;
4262	}
4263
4264
4265
4266	//	EASING FUNCTIONS
4267	$.extend($.easing, {
4268		'quadratic': function(t) {
4269			var t2 = t * t;
4270			return t * (-t2 * t + 4 * t2 - 6 * t + 4);
4271		},
4272		'cubic': function(t) {
4273			return t * (4 * t * t - 9 * t + 6);
4274		},
4275		'elastic': function(t) {
4276			var t2 = t * t;
4277			return t * (33 * t2 * t2 - 106 * t2 * t + 126 * t2 - 67 * t + 15);
4278		}
4279	});
4280
4281
4282})(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.