PageSourceSearch

https://www.mattadi.co.uk/assets/js/camera.js

js mattadi.co.uk collected 2026-10-04 12:25:03 UTC 68,310 bytes, 2,266 lines download raw bytes

1// Camera slideshow v1.3.3 - a jQuery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jQuery 1.4+
2// Copyright (c) 2012 by Manuel Masia - www.pixedelic.com
3// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4;(function($){$.fn.camera = function(opts, callback) {
5	
6	var defaults = {
7		alignment			: 'center', //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight
8		
9		autoAdvance			: true,	//true, false
10		
11		mobileAutoAdvance	: true, //true, false. Auto-advancing for mobile devices
12		
13		barDirection		: 'leftToRight',	//'leftToRight', 'rightToLeft', 'topToBottom', 'bottomToTop'
14		
15		barPosition			: 'bottom',	//'bottom', 'left', 'top', 'right'
16		
17		cols				: 6,
18		
19		easing				: 'easeInOutExpo',	//for the complete list http://jqueryui.com/demos/effect/easing.html
20		
21		mobileEasing		: '',	//leave empty if you want to display the same easing on mobile devices and on desktop etc.
22		
23		fx					: 'random',	//'random','simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'bottomLeftTopRight'
24										//you can also use more than one effect, just separate them with commas: 'simpleFade, scrollRight, scrollBottom'
25
26		mobileFx			: '',	//leave empty if you want to display the same effect on mobile devices and on desktop etc.
27
28		gridDifference		: 250,	//to make the grid blocks slower than the slices, this value must be smaller than transPeriod
29		
30		height				: '50%',	//here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto'
31		
32		imagePath			: 'images/',	//he path to the image folder (it serves for the blank.gif, when you want to display videos)
33		
34		hover				: true,	//true, false. Puase on state hover. Not available for mobile devices
35				
36		loader				: 'pie',	//pie, bar, none (even if you choose "pie", old browsers like IE8- can't display it... they will display always a loading bar)
37		
38		loaderColor			: '#eeeeee', 
39		
40		loaderBgColor		: '#222222', 
41		
42		loaderOpacity		: .8,	//0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1
43		
44		loaderPadding		: 2,	//how many empty pixels you want to display between the loader and its background
45		
46		loaderStroke		: 7,	//the thickness both of the pie loader and of the bar loader. Remember: for the pie, the loader thickness must be less than a half of the pie diameter
47				
48		minHeight			: '200px',	//you can also leave it blank
49		
50		navigation			: true,	//true or false, to display or not the navigation buttons
51		
52		navigationHover		: true,	//if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always
53		
54		mobileNavHover		: true,	//same as above, but only for mobile devices
55		
56		opacityOnGrid		: false,	//true, false. Decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, I recommend to set it false to have a smoother effect 
57		
58		overlayer			: true,	//a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer)
59		
60		pagination			: true,
61		
62		playPause			: true,	//true or false, to display or not the play/pause buttons
63		
64		pauseOnClick		: true,	//true, false. It stops the slideshow when you click the sliders.
65		
66		pieDiameter			: 38,
67		
68		piePosition			: 'rightTop',	//'rightTop', 'leftTop', 'leftBottom', 'rightBottom'
69		
70		portrait			: false, //true, false. Select true if you don't want that your images are cropped
71		
72		rows				: 4,
73		
74		slicedCols			: 12,	//if 0 the same value of cols
75		
76		slicedRows			: 8,	//if 0 the same value of rows
77		
78		slideOn				: 'random',	//next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide
79		
80		thumbnails			: false,
81		
82		time				: 7000,	//milliseconds between the end of the sliding effect and the start of the nex one
83		
84		transPeriod			: 1500,	//lenght of the sliding effect in milliseconds
85		
86////////callbacks
87
88		onEndTransition		: function() {  },	//this callback is invoked when the transition effect ends
89
90		onLoaded			: function() {  },	//this callback is invoked when the image on a slide has completely loaded
91		
92		onStartLoading		: function() {  },	//this callback is invoked when the image on a slide start loading
93		
94		onStartTransition	: function() {  }	//this callback is invoked when the transition effect starts
95
96    };
97	
98	
99	function isMobile() {
100		if( navigator.userAgent.match(/Android/i) ||
101			navigator.userAgent.match(/webOS/i) ||
102			navigator.userAgent.match(/iPad/i) ||
103			navigator.userAgent.match(/iPhone/i) ||
104			navigator.userAgent.match(/iPod/i)
105			){
106				return true;
107		}
108	}
109
110	var opts = $.extend({}, defaults, opts);
111	
112	var wrap = $(this).addClass('camera_wrap');
113	
114	wrap.wrapInner(
115        '<div class="camera_src" />'
116		).wrapInner(
117	    '<div class="camera_fakehover" />'
118		);
119		
120	var fakeHover = $('.camera_fakehover',wrap);
121	
122	fakeHover.append(
123		'<div class="camera_target"></div>'
124		);
125	if(opts.overlayer == true){
126		fakeHover.append(
127			'<div class="camera_overlayer"></div>'
128			)
129	}
130		fakeHover.append(
131        '<div class="camera_target_content"></div>'
132		);
133		
134	var loader;
135	
136//	if(opts.loader=='pie' && $.browser.msie && $.browser.version < 9){
137//		loader = 'bar';
138//	} else {
139		loader = opts.loader;
140//	}
141	
142	if(loader == 'pie'){
143		fakeHover.append(
144			'<div class="camera_pie"></div>'
145			)
146	} else if (loader == 'bar') {
147		fakeHover.append(
148			'<div class="camera_bar"></div>'
149			)
150	} else {
151		fakeHover.append(
152			'<div class="camera_bar" style="display:none"></div>'
153			)
154	}
155	
156	if(opts.playPause==true){
157		fakeHover.append(
158        '<div class="camera_commands"></div>'
159		)
160	}
161		
162	if(opts.navigation==true){
163		fakeHover.append(
164			'<div class="camera_prev"><span></span></div>'
165			).append(
166			'<div class="camera_next"><span></span></div>'
167			);
168	}
169		
170	if(opts.thumbnails==true){
171		wrap.append(
172			'<div class="camera_thumbs_cont" />'
173			);
174	}
175	
176	if(opts.thumbnails==true && opts.pagination!=true){
177		$('.camera_thumbs_cont',wrap).wrap(
178			'<div />'
179			).wrap(
180				'<div class="camera_thumbs" />'
181			).wrap(
182				'<div />'
183			).wrap(
184				'<div class="camera_command_wrap" />'
185			);
186	}
187		
188	if(opts.pagination==true){
189		wrap.append(
190			'<div class="camera_pag"></div>'
191			);
192	}
193		
194	wrap.append(
195		'<div class="camera_loader"></div>'
196		);
197		
198	$('.camera_caption',wrap).each(function(){
199		$(this).wrapInner('<div />');
200	});
201		
202                
203	var pieID = 'pie_'+wrap.index(),
204		elem = $('.camera_src',wrap),
205		target = $('.camera_target',wrap),
206		content = $('.camera_target_content',wrap),
207		pieContainer = $('.camera_pie',wrap),
208		barContainer = $('.camera_bar',wrap),
209		prevNav = $('.camera_prev',wrap),
210		nextNav = $('.camera_next',wrap),
211		commands = $('.camera_commands',wrap),
212		pagination = $('.camera_pag',wrap),
213		thumbs = $('.camera_thumbs_cont',wrap);	
214
215	
216	var w,
217		h;
218
219
220	var allImg = new Array();
221	$('> div', elem).each( function() { 
222		allImg.push($(this).attr('data-src'));
223	});
224	
225	var allLinks = new Array();
226	$('> div', elem).each( function() {
227		if($(this).attr('data-link')){
228			allLinks.push($(this).attr('data-link'));
229		} else {
230			allLinks.push('');
231		}
232	});
233	
234	var allTargets = new Array();
235	$('> div', elem).each( function() {
236		if($(this).attr('data-target')){
237			allTargets.push($(this).attr('data-target'));
238		} else {
239			allTargets.push('');
240		}
241	});
242	
243	var allPor = new Array();
244	$('> div', elem).each( function() {
245		if($(this).attr('data-portrait')){
246			allPor.push($(this).attr('data-portrait'));
247		} else {
248			allPor.push('');
249		}
250	});
251	
252	var allAlign= new Array();
253	$('> div', elem).each( function() { 
254		if($(this).attr('data-alignment')){
255			allAlign.push($(this).attr('data-alignment'));
256		} else {
257			allAlign.push('');
258		}
259	});
260	
261		
262	var allThumbs = new Array();
263	$('> div', elem).each( function() { 
264		if($(this).attr('data-thumb')){
265			allThumbs.push($(this).attr('data-thumb'));
266		} else {
267			allThumbs.push('');
268		}
269	});
270	
271	var amountSlide = allImg.length;
272
273	$(content).append('<div class="cameraContents" />');
274	var loopMove;
275	for (loopMove=0;loopMove<amountSlide;loopMove++)
276	{
277		$('.cameraContents',content).append('<div class="cameraContent" />');
278		if(allLinks[loopMove]!=''){
279			//only for Wordpress plugin
280			var dataBox = $('> div ',elem).eq(loopMove).attr('data-box');
281			if(typeof dataBox !== 'undefined' && dataBox !== false && dataBox != '') {
282				dataBox = 'data-box="'+$('> div ',elem).eq(loopMove).attr('data-box')+'"';
283			} else {
284				dataBox = '';
285			}
286			//
287			$('.camera_target_content .cameraContent:eq('+loopMove+')',wrap).append('<a class="camera_link" href="'+allLinks[loopMove]+'" '+dataBox+' target="'+allTargets[loopMove]+'"></a>');
288		}
289
290	}
291	$('.camera_caption',wrap).each(function(){
292		var ind = $(this).parent().index(),
293			cont = wrap.find('.cameraContent').eq(ind);
294		$(this).appendTo(cont);
295	});
296	
297	target.append('<div class="cameraCont" />');
298	var cameraCont = $('.cameraCont',wrap);
299	
300
301	
302	var loop;
303	for (loop=0;loop<amountSlide;loop++)
304	{
305		cameraCont.append('<div class="cameraSlide cameraSlide_'+loop+'" />');
306		var div = $('> div:eq('+loop+')',elem);
307		target.find('.cameraSlide_'+loop).clone(div);
308	}
309	
310	
311	function thumbnailVisible() {
312		var wTh = $(thumbs).width();
313		$('li', thumbs).removeClass('camera_visThumb');
314		$('li', thumbs).each(function(){
315			var pos = $(this).position(),
316				ulW = $('ul', thumbs).outerWidth(),
317				offUl = $('ul', thumbs).offset().left,
318				offDiv = $('> div',thumbs).offset().left,
319				ulLeft = offDiv-offUl;
320				if(ulLeft>0){
321					$('.camera_prevThumbs',camera_thumbs_wrap).removeClass('hideNav');
322				} else {
323					$('.camera_prevThumbs',camera_thumbs_wrap).addClass('hideNav');
324				}
325				if((ulW-ulLeft)>wTh){
326					$('.camera_nextThumbs',camera_thumbs_wrap).removeClass('hideNav');
327				} else {
328					$('.camera_nextThumbs',camera_thumbs_wrap).addClass('hideNav');
329				}
330				var left = pos.left,
331					right = pos.left+($(this).width());
332				if(right-ulLeft<=wTh && left-ulLeft>=0){
333					$(this).addClass('camera_visThumb');
334				}
335		});
336	}
337	
338	$(window).bind('load resize pageshow',function(){
339		thumbnailPos();
340		thumbnailVisible();
341	});
342
343
344	cameraCont.append('<div class="cameraSlide cameraSlide_'+loop+'" />');
345	
346	
347	var started;
348	
349	wrap.show();
350	var w = target.width();
351	var h = target.height();
352	
353	var setPause;
354		
355	$(window).bind('resize pageshow',function(){
356		if(started == true) {
357			resizeImage();
358		}
359		$('ul', thumbs).animate({'margin-top':0},0,thumbnailPos);
360		if(!elem.hasClass('paused')){
361			elem.addClass('paused');
362			if($('.camera_stop',camera_thumbs_wrap).length){
363				$('.camera_stop',camera_thumbs_wrap).hide()
364				$('.camera_play',camera_thumbs_wrap).show();
365				if(loader!='none'){
366					$('#'+pieID).hide();
367				}
368			} else {
369				if(loader!='none'){
370					$('#'+pieID).hide();
371				}
372			}
373			clearTimeout(setPause);
374			setPause = setTimeout(function(){
375				elem.removeClass('paused');
376				if($('.camera_play',camera_thumbs_wrap).length){
377					$('.camera_play',camera_thumbs_wrap).hide();
378					$('.camera_stop',camera_thumbs_wrap).show();
379					if(loader!='none'){
380						$('#'+pieID).fadeIn();
381					}
382				} else {
383					if(loader!='none'){
384						$('#'+pieID).fadeIn();
385					}
386				}
387			},1500);
388		}
389	});
390	
391	function resizeImage(){	
392		var res;
393		function resizeImageWork(){
394			w = wrap.width();
395			if(opts.height.indexOf('%')!=-1) {
396				var startH = Math.round(w / (100/parseFloat(opts.height)));
397				if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){
398					h = parseFloat(opts.minHeight);
399				} else {
400					h = startH;
401				}
402				wrap.css({height:h});
403			} else if (opts.height=='auto') {
404				h = wrap.height();
405			} else {
406				h = parseFloat(opts.height);
407				wrap.css({height:h});
408			}
409			$('.camerarelative',target).css({'width':w,'height':h});
410			$('.imgLoaded',target).each(function(){
411				var t = $(this),
412					wT = t.attr('width'),
413					hT = t.attr('height'),
414					imgLoadIn = t.index(),
415					mTop,
416					mLeft,
417					alignment = t.attr('data-alignment'),
418					portrait =  t.attr('data-portrait');
419					
420					if(typeof alignment === 'undefined' || alignment === false || alignment === ''){
421						alignment = opts.alignment;
422					}
423					
424					if(typeof portrait === 'undefined' || portrait === false || portrait === ''){
425						portrait = opts.portrait;
426					}
427										
428					if(portrait==false||portrait=='false'){
429						if((wT/hT)<(w/h)) {
430							var r = w / wT;
431							var d = (Math.abs(h - (hT*r)))*0.5;
432							switch(alignment){
433								case 'topLeft':
434									mTop = 0;
435									break;
436								case 'topCenter':
437									mTop = 0;
438									break;
439								case 'topRight':
440									mTop = 0;
441									break;
442								case 'centerLeft':
443									mTop = '-'+d+'px';
444									break;
445								case 'center':
446									mTop = '-'+d+'px';
447									break;
448								case 'centerRight':
449									mTop = '-'+d+'px';
450									break;
451								case 'bottomLeft':
452									mTop = '-'+d*2+'px';
453									break;
454								case 'bottomCenter':
455									mTop = '-'+d*2+'px';
456									break;
457								case 'bottomRight':
458									mTop = '-'+d*2+'px';
459									break;
460							}
461							t.css({
462								'height' : hT*r,
463								'margin-left' : 0,
464								'margin-top' : mTop,
465								'position' : 'absolute',
466								'visibility' : 'visible',
467								'width' : w
468							});
469						}
470						else {
471							var r = h / hT;
472							var d = (Math.abs(w - (wT*r)))*0.5;
473							switch(alignment){
474								case 'topLeft':
475									mLeft = 0;
476									break;
477								case 'topCenter':
478									mLeft = '-'+d+'px';
479									break;
480								case 'topRight':
481									mLeft = '-'+d*2+'px';
482									break;
483								case 'centerLeft':
484									mLeft = 0;
485									break;
486								case 'center':
487									mLeft = '-'+d+'px';
488									break;
489								case 'centerRight':
490									mLeft = '-'+d*2+'px';
491									break;
492								case 'bottomLeft':
493									mLeft = 0;
494									break;
495								case 'bottomCenter':
496									mLeft = '-'+d+'px';
497									break;
498								case 'bottomRight':
499									mLeft = '-'+d*2+'px';
500									break;
501							}
502							t.css({
503								'height' : h,
504								'margin-left' : mLeft,
505								'margin-top' : 0,
506								'position' : 'absolute',
507								'visibility' : 'visible',
508								'width' : wT*r
509							});
510						}
511					} else {
512						if((wT/hT)<(w/h)) {
513							var r = h / hT;
514							var d = (Math.abs(w - (wT*r)))*0.5;
515							switch(alignment){
516								case 'topLeft':
517									mLeft = 0;
518									break;
519								case 'topCenter':
520									mLeft = d+'px';
521									break;
522								case 'topRight':
523									mLeft = d*2+'px';
524									break;
525								case 'centerLeft':
526									mLeft = 0;
527									break;
528								case 'center':
529									mLeft = d+'px';
530									break;
531								case 'centerRight':
532									mLeft = d*2+'px';
533									break;
534								case 'bottomLeft':
535									mLeft = 0;
536									break;
537								case 'bottomCenter':
538									mLeft = d+'px';
539									break;
540								case 'bottomRight':
541									mLeft = d*2+'px';
542									break;
543							}
544							t.css({
545								'height' : h,
546								'margin-left' : mLeft,
547								'margin-top' : 0,
548								'position' : 'absolute',
549								'visibility' : 'visible',
550								'width' : wT*r
551							});
552						}
553						else {
554							var r = w / wT;
555							var d = (Math.abs(h - (hT*r)))*0.5;
556							switch(alignment){
557								case 'topLeft':
558									mTop = 0;
559									break;
560								case 'topCenter':
561									mTop = 0;
562									break;
563								case 'topRight':
564									mTop = 0;
565									break;
566								case 'centerLeft':
567									mTop = d+'px';
568									break;
569								case 'center':
570									mTop = d+'px';
571									break;
572								case 'centerRight':
573									mTop = d+'px';
574									break;
575								case 'bottomLeft':
576									mTop = d*2+'px';
577									break;
578								case 'bottomCenter':
579									mTop = d*2+'px';
580									break;
581								case 'bottomRight':
582									mTop = d*2+'px';
583									break;
584							}
585							t.css({
586								'height' : hT*r,
587								'margin-left' : 0,
588								'margin-top' : mTop,
589								'position' : 'absolute',
590								'visibility' : 'visible',
591								'width' : w
592							});
593						}
594					}
595			});
596		}
597		if (started == true) {
598			clearTimeout(res);
599			res = setTimeout(resizeImageWork,200);
600		} else {
601			resizeImageWork();
602		}
603		
604		started = true;
605	}
606	
607	
608	var u,
609		setT;
610
611	var clickEv,
612		autoAdv,
613		navHover,
614		commands,
615		pagination;
616
617	var videoHover,
618		videoPresent;
619		
620	if(isMobile() && opts.mobileAutoAdvance!=''){
621		autoAdv = opts.mobileAutoAdvance;
622	} else {
623		autoAdv = opts.autoAdvance;
624	}
625	
626	if(autoAdv==false){
627		elem.addClass('paused');
628	}
629
630	if(isMobile() && opts.mobileNavHover!=''){
631		navHover = opts.mobileNavHover;
632	} else {
633		navHover = opts.navigationHover;
634	}
635
636	if(elem.length!=0){
637			
638		var selector = $('.cameraSlide',target);
639		selector.wrapInner('<div class="camerarelative" />');
640		
641		var navSlide;
642			
643		var barDirection = opts.barDirection;
644	
645		var camera_thumbs_wrap = wrap;
646
647
648		$('iframe',fakeHover).each(function(){
649			var t = $(this);
650			var src = t.attr('src');
651			t.attr('data-src',src);
652			var divInd = t.parent().index('.camera_src > div');
653			$('.camera_target_content .cameraContent:eq('+divInd+')',wrap).append(t);
654		});
655		function imgFake() {
656				$('iframe',fakeHover).each(function(){
657					$('.camera_caption',fakeHover).show();
658					var t = $(this);
659					var cloneSrc = t.attr('data-src');
660					t.attr('src',cloneSrc);
661					var imgFakeUrl = opts.imagePath+'blank.gif';
662					var imgFake = new Image();
663					imgFake.src = imgFakeUrl;
664					if(opts.height.indexOf('%')!=-1) {
665						var startH = Math.round(w / (100/parseFloat(opts.height)));
666						if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){
667							h = parseFloat(opts.minHeight);
668						} else {
669							h = startH;
670						}
671					} else if (opts.height=='auto') {
672						h = wrap.height();
673					} else {
674						h = parseFloat(opts.height);
675					}
676					t.after($(imgFake).attr({'class':'imgFake','width':w,'height':h}));
677					var clone = t.clone();
678					t.remove();
679					$(imgFake).bind('click',function(){
680						if($(this).css('position')=='absolute') {
681							$(this).remove();
682							if(cloneSrc.indexOf('vimeo') != -1 || cloneSrc.indexOf('youtube') != -1) {
683								if(cloneSrc.indexOf('?') != -1){
684									autoplay = '&autoplay=1';
685								} else {
686									autoplay = '?autoplay=1';
687								}
688							} else if(cloneSrc.indexOf('dailymotion') != -1) {
689								if(cloneSrc.indexOf('?') != -1){
690									autoplay = '&autoPlay=1';
691								} else {
692									autoplay = '?autoPlay=1';
693								}
694							}
695							clone.attr('src',cloneSrc+autoplay);
696							videoPresent = true;
697						} else {
698							$(this).css({position:'absolute',top:0,left:0,zIndex:10}).after(clone);
699							clone.css({position:'absolute',top:0,left:0,zIndex:9});
700						}
701					});
702				});
703		}
704		
705		imgFake();
706		
707		
708		if(opts.hover==true){
709			if(!isMobile()){
710				fakeHover.hover(function(){
711					elem.addClass('hovered');
712				},function(){
713					elem.removeClass('hovered');
714				});
715			}
716		}
717
718		if(navHover==true){
719			$(prevNav,wrap).animate({opacity:0}
719,0);
720			$(nextNav,wrap).animate({opacity:0},0);
721			$(commands,wrap).animate({opacity:0},0);
722			if(isMobile()){
723				fakeHover.on('vmouseover',function(){
724					$(prevNav,wrap).animate({opacity:1},200);
725					$(nextNav,wrap).animate({opacity:1},200);
726					$(commands,wrap).animate({opacity:1},200);
727				});
728				fakeHover.on('vmouseout',function(){
729					$(prevNav,wrap).delay(500).animate({opacity:0},200);
730					$(nextNav,wrap).delay(500).animate({opacity:0},200);
731					$(commands,wrap).delay(500).animate({opacity:0},200);
732				});
733			} else {
734				fakeHover.hover(function(){
735					$(prevNav,wrap).animate({opacity:1},200);
736					$(nextNav,wrap).animate({opacity:1},200);
737					$(commands,wrap).animate({opacity:1},200);
738				},function(){
739					$(prevNav,wrap).animate({opacity:0},200);
740					$(nextNav,wrap).animate({opacity:0},200);
741					$(commands,wrap).animate({opacity:0},200);
742				});
743			}
744		}
745
746		if($(commands).length) {
747			$(commands).append('<div class="camera_play"></div>').append('<div class="camera_stop"></div>');
748
749			if(autoAdv==true){
750				$('.camera_play',camera_thumbs_wrap).hide();
751				$('.camera_stop',camera_thumbs_wrap).show();
752			} else {
753				$('.camera_stop',camera_thumbs_wrap).hide();
754				$('.camera_play',camera_thumbs_wrap).show();
755			}
756		}
757	
758		$('.camera_stop',camera_thumbs_wrap).on('click',function(){
759			autoAdv = false;
760			elem.addClass('paused');
761			if($('.camera_stop',camera_thumbs_wrap).length){
762				$('.camera_stop',camera_thumbs_wrap).hide()
763				$('.camera_play',camera_thumbs_wrap).show();
764				if(loader!='none'){
765					$('#'+pieID).hide();
766				}
767			} else {
768				if(loader!='none'){
769					$('#'+pieID).hide();
770				}
771			}
772		});
773
774		$('.camera_play',camera_thumbs_wrap).on('click',function(){
775			autoAdv = true;
776			elem.removeClass('paused');
777			if($('.camera_play',camera_thumbs_wrap).length){
778				$('.camera_play',camera_thumbs_wrap).hide();
779				$('.camera_stop',camera_thumbs_wrap).show();
780				if(loader!='none'){
781					$('#'+pieID).show();
782				}
783			} else {
784				if(loader!='none'){
785					$('#'+pieID).show();
786				}
787			}
788		});
789	
790		if(opts.pauseOnClick==true){
791			$('.camera_target_content',fakeHover).mouseup(function(){
792				autoAdv = false;
793				elem.addClass('paused');
794				$('.camera_stop',camera_thumbs_wrap).hide()
795				$('.camera_play',camera_thumbs_wrap).show();
796				$('#'+pieID).hide();
797			});
798		}
799		$('.cameraContent, .imgFake',fakeHover).hover(function(){
800			videoHover = true;
801		},function(){
802			videoHover = false;
803		});
804		
805		$('.cameraContent, .imgFake',fakeHover).bind('click',function(){
806			if(videoPresent == true && videoHover == true) {
807				autoAdv = false;
808				$('.camera_caption',fakeHover).hide();
809				elem.addClass('paused');
810				$('.camera_stop',camera_thumbs_wrap).hide()
811				$('.camera_play',camera_thumbs_wrap).show();
812				$('#'+pieID).hide();
813			}
814		});
815		
816		
817	}
818	
819	
820		function shuffle(arr) {
821			for(
822			  var j, x, i = arr.length; i;
823			  j = parseInt(Math.random() * i),
824			  x = arr[--i], arr[i] = arr[j], arr[j] = x
825			);
826			return arr;
827		}
828	
829		function isInteger(s) {
830			return Math.ceil(s) == Math.floor(s);
831		}	
832	
833		if (loader != 'pie') {
834			barContainer.append('<span class="camera_bar_cont" />');
835			$('.camera_bar_cont',barContainer)
836				.animate({opacity:opts.loaderOpacity},0)
837				.css({'position':'absolute', 'left':0, 'right':0, 'top':0, 'bottom':0, 'background-color':opts.loaderBgColor})
838				.append('<span id="'+pieID+'" />');
839			$('#'+pieID).animate({opacity:0}
839,0);
840			var canvas = $('#'+pieID);
841			canvas.css({'position':'absolute', 'background-color':opts.loaderColor});
842			switch(opts.barPosition){
843				case 'left':
844					barContainer.css({right:'auto',width:opts.loaderStroke});
845					break;
846				case 'right':
847					barContainer.css({left:'auto',width:opts.loaderStroke});
848					break;
849				case 'top':
850					barContainer.css({bottom:'auto',height:opts.loaderStroke});
851					break;
852				case 'bottom':
853					barContainer.css({top:'auto',height:opts.loaderStroke});
854					break;
855			}
856			switch(barDirection){
857				case 'leftToRight':
858					canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding});
859					break;
860				case 'rightToLeft':
861					canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding});
862					break;
863				case 'topToBottom':
864					canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0});
865					break;
866				case 'bottomToTop':
867					canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0});
868					break;
869			}
870		} else {
871			pieContainer.append('<canvas id="'+pieID+'"></canvas>');
872			var G_vmlCanvasManager;
873			var canvas = document.getElementById(pieID);
874			canvas.setAttribute("width", opts.pieDiameter);
875			canvas.setAttribute("height", opts.pieDiameter);
876			var piePosition;
877			switch(opts.piePosition){
878				case 'leftTop' :
879					piePosition = 'left:0; top:0;';
880					break;
881				case 'rightTop' :
882					piePosition = 'right:0; top:0;';
883					break;
884				case 'leftBottom' :
885					piePosition = 'left:0; bottom:0;';
886					break;
887				case 'rightBottom' :
888					piePosition = 'right:0; bottom:0;';
889					break;
890			}
891			canvas.setAttribute("style", "position:absolute; z-index:1002; "+piePosition);
892			var rad;
893			var radNew;
894	
895			if (canvas && canvas.getContext) {
896				var ctx = canvas.getContext("2d");
897				ctx.rotate(Math.PI*(3/2));
898				ctx.translate(-opts.pieDiameter,0);
899			}
900		
901		}
902		if(loader=='none' || autoAdv==false) {
903			$('#'+pieID).hide();
904			$('.camera_canvas_wrap',camera_thumbs_wrap).hide();
905		}
906		
907		if($(pagination).length) {
908			$(pagination).append('<ul class="camera_pag_ul" />');
909			var li;
910			for (li = 0; li < amountSlide; li++){
911				$('.camera_pag_ul',wrap).append('<li class="pag_nav_'+li+'" style="position:relative; z-index:1002"><span><span>'+li+'</span></span></li>');
912			}
913			$('.camera_pag_ul li',wrap).hover(function(){
914				$(this).addClass('camera_hover');
915				if($('.camera_thumb',this).length){
916					var wTh = $('.camera_thumb',this).outerWidth(),
917					hTh = $('.camera_thumb',this).outerHeight(),
918					wTt = $(this).outerWidth();
919					$('.camera_thumb',this).show().css({'top':'-'+hTh+'px','left':'-'+(wTh-wTt)/2+'px'}).animate({'opacity':1,'margin-top':'-3px'},200);
920					$('.thumb_arrow',this).show().animate({'opacity':1,'margin-top':'-3px'},200);
921				}
922			},function(){
923				$(this).removeClass('camera_hover');
924				$('.camera_thumb',this).animate({'margin-top':'-20px','opacity':0},200,function(){
925					$(this).css({marginTop:'5px'}).hide();
926				});
927				$('.thumb_arrow',this).animate({'margin-top':'-20px','opacity':0},200,function(){
928					$(this).css({marginTop:'5px'}).hide();
929				});
930			});
931		}
932			
933	
934	
935		if($(thumbs).length) {
936			var thumbUrl;
937			if(!$(pagination).length) {
938				$(thumbs).append('<div />');
939				$(thumbs).before('<div class="camera_prevThumbs hideNav"><div></div></div>').before('<div class="camera_nextThumbs hideNav"><div></div></div>');
940				$('> div',thumbs).append('<ul />');
941				$.each(allThumbs, function(i, val) {
942					if($('> div', elem).eq(i).attr('data-thumb')!='') {
943						var thumbUrl = $('> div', elem).eq(i).attr('data-thumb'),
944							newImg = new Image();
945						newImg.src = thumbUrl;
946						$('ul',thumbs).append('<li class="pix_thumb pix_thumb_'+i+'" />');
947						$('li.pix_thumb_'+i,thumbs).append($(newImg).attr('class','camera_thumb'));
948					}
949				});
950			} else {
951				$.each(allThumbs, function(i, val) {
952					if($('> div', elem).eq(i).attr('data-thumb')!='') {
953						var thumbUrl = $('> div', elem).eq(i).attr('data-thumb'),
954							newImg = new Image();
955						newImg.src = thumbUrl;
956						$('li.pag_nav_'+i,pagination).append($(newImg).attr('class','camera_thumb').css({'position':'absolute'}).animate({opacity:0}
956,0));
957						$('li.pag_nav_'+i+' > img',pagination).after('<div class="thumb_arrow" />');
958						$('li.pag_nav_'+i+' > .thumb_arrow',pagination).animate({opacity:0},0);
959					}
960				});
961				wrap.css({marginBottom:$(pagination).outerHeight()});
962			}
963		} else if(!$(thumbs).length && $(pagination).length) {
964			wrap.css({marginBottom:$(pagination).outerHeight()});
965		}
966
967	
968		var firstPos = true;
969
970		function thumbnailPos() {
971			if($(thumbs).length && !$(pagination).length) {
972				var wTh = $(thumbs).outerWidth(),
973					owTh = $('ul > li',thumbs).outerWidth(),
974					pos = $('li.cameracurrent', thumbs).length ? $('li.cameracurrent', thumbs).position() : '',
975					ulW = ($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth()),
976					offUl = $('ul', thumbs).offset().left,
977					offDiv = $('> div', thumbs).offset().left,
978					ulLeft;
979
980					if(offUl<0){
981						ulLeft = '-'+ (offDiv-offUl);
982					} else {
983						ulLeft = offDiv-offUl;
984					}
985					
986					
987					
988				if(firstPos == true) {
989					$('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth());
990					if($(thumbs).length && !$(pagination).lenght) {
991						wrap.css({marginBottom:$(thumbs).outerHeight()});
992					}
993					thumbnailVisible();
994					/*I repeat this two lines because of a problem with iPhones*/
995					$('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth());
996					if($(thumbs).length && !$(pagination).lenght) {
997						wrap.css({marginBottom:$(thumbs).outerHeight()});
998					}
999					/*...*/
1000				}
1001				firstPos = false;
1002				
1003					var left = $('li.cameracurrent', thumbs).length ? pos.left : '',
1004						right = $('li.cameracurrent', thumbs).length ? pos.left+($('li.cameracurrent', thumbs).outerWidth()) : '';
1005					if(left<$('li.cameracurrent', thumbs).outerWidth()) {
1006						left = 0;
1007					}
1008					if(right-ulLeft>wTh){
1009						if((left+wTh)<ulW){
1010							$('ul', thumbs).animate({'margin-left':'-'+(left)+'px'},500,thumbnailVisible);
1011						} else {
1012							$('ul', thumbs).animate({'margin-left':'-'+($('ul', thumbs).outerWidth()-wTh)+'px'},500,thumbnailVisible);
1013						}
1014					} else if(left-ulLeft<0) {
1015						$('ul', thumbs).animate({'margin-left':'-'+(left)+'px'},500,thumbnailVisible);
1016					} else {
1017						$('ul', thumbs).css({'margin-left':'auto', 'margin-right':'auto'});
1018						setTimeout(thumbnailVisible,100);
1019					}
1020					
1021			}
1022		}
1023
1024		function canvasLoader() {
1025			rad = 0;
1026			var barWidth = $('.camera_bar_cont',camera_thumbs_wrap).width(),
1027				barHeight = $('.camera_bar_cont',camera_thumbs_wrap).height();
1028
1029			if (loader != 'pie') {
1030				switch(barDirection){
1031					case 'leftToRight':
1032						$('#'+pieID).css({'right':barWidth});
1033						break;
1034					case 'rightToLeft':
1035						$('#'+pieID).css({'left':barWidth});
1036						break;
1037					case 'topToBottom':
1038						$('#'+pieID).css({'bottom':barHeight});
1039						break;
1040					case 'bottomToTop':
1041						$('#'+pieID).css({'top':barHeight});
1042						break;
1043				}
1044			} else {
1045				ctx.clearRect(0,0,opts.pieDiameter,opts.pieDiameter); 
1046			}
1047		}
1048		
1049		
1050		canvasLoader();
1051		
1052		
1053		$('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom',fakeHover).each(function(){
1054			$(this).css('visibility','hidden');
1055		});
1056		
1057		opts.onStartLoading.call(this);
1058		
1059		nextSlide();
1060		
1061	
1062	/*************************** FUNCTION nextSlide() ***************************/
1063	
1064	function nextSlide(navSlide){ 
1065		elem.addClass('camerasliding');
1066		
1067		videoPresent = false;
1068		var vis = parseFloat($('div.cameraSlide.cameracurrent',target).index());
1069
1070		if(navSlide>0){ 
1071			var slideI = navSlide-1;
1072		} else if (vis == amountSlide-1) { 
1073			var slideI = 0;
1074		} else {
1075			var slideI = vis+1;
1076		}
1077		
1078				
1079		var slide = $('.cameraSlide:eq('+slideI+')',target);
1080		var slideNext = $('.cameraSlide:eq('+(slideI+1)+')',target).addClass('cameranext');
1081		if( vis != slideI+1 ) {
1082			slideNext.hide();
1083		}
1084		$('.cameraContent',fakeHover).fadeOut(600);
1085		$('.camera_caption',fakeHover).show();
1086		
1087		$('.camerarelative',slide).append($('> div ',elem).eq(slideI).find('> div.camera_effected'));
1088
1089		$('.camera_target_content .cameraContent:eq('+slideI+')',wrap).append($('> div ',elem).eq(slideI).find('> div'));
1090		
1091		if(!$('.imgLoaded',slide).length){
1092			var imgUrl = allImg[slideI];
1093			var imgLoaded = new Image();
1094			imgLoaded.src = imgUrl +"?"+ new Date().getTime();
1095			slide.css('visibility','hidden');
1096			slide.prepend($(imgLoaded).attr('class','imgLoaded').css('visibility','hidden'));
1097			var wT, hT;
1098			if (!$(imgLoaded).get(0).complete || wT == '0' || hT == '0' || typeof wT === 'undefined' || wT === false || typeof hT === 'undefined' || hT === false) {
1099				$('.camera_loader',wrap).delay(500).fadeIn(400);
1100				imgLoaded.onload = function() {
1101					wT = imgLoaded.naturalWidth;
1102					hT = imgLoaded.naturalHeight;
1103					$(imgLoaded).attr('data-alignment',allAlign[slideI]).attr('data-portrait',allPor[slideI]);
1104					$(imgLoaded).attr('width',wT);
1105					$(imgLoaded).attr('height',hT);
1106					target.find('.cameraSlide_'+slideI).hide().css('visibility','visible');
1107					resizeImage();
1108					nextSlide(slideI+1);
1109				};
1110			}
1111		} else {
1112			if( allImg.length > (slideI+1) && !$('.imgLoaded',slideNext).length ){
1113				var imgUrl2 = allImg[(slideI+1)];
1114				var imgLoaded2 = new Image();
1115				imgLoaded2.src = imgUrl2 +"?"+ new Date().getTime();
1116				slideNext.prepend($(imgLoaded2).attr('class','imgLoaded').css('visibility','hidden'));
1117				imgLoaded2.onload = function() {
1118					wT = imgLoaded2.naturalWidth;
1119					hT = imgLoaded2.naturalHeight;
1120					$(imgLoaded2).attr('data-alignment',allAlign[slideI+1]).attr('data-portrait',allPor[slideI+1]);
1121					$(imgLoaded2).attr('width',wT);
1122					$(imgLoaded2).attr('height',hT);
1123					resizeImage();
1124				};
1125			}
1126			opts.onLoaded.call(this);
1127			if($('.camera_loader',wrap).is(':visible')){
1128				$('.camera_loader',wrap).fadeOut(400);
1129			} else {
1130				$('.camera_loader',wrap).css({'visibility':'hidden'});
1131				$('.camera_loader',wrap).fadeOut(400,function(){
1132					$('.camera_loader',wrap).css({'visibility':'visible'});
1133				});
1134			}
1135			var rows = opts.rows,
1136				cols = opts.cols,
1137				couples = 1,
1138				difference = 0,
1139				dataSlideOn,
1140				time,
1141				transPeriod,
1142				fx,
1143				easing,
1144				randomFx = new Array('simpleFade','curtainTopLeft','curtainTopRight','curtainBottomLeft','curtainBottomRight','curtainSliceLeft','curtainSliceRight','blindCurtainTopLeft','blindCurtainTopRight','blindCurtainBottomLeft','blindCurtainBottomRight','blindCurtainSliceBottom','blindCurtainSliceTop','stampede','mosaic','mosaicReverse','mosaicRandom','mosaicSpiral','mosaicSpiralReverse','topLeftBottomRight','bottomRightTopLeft','bottomLeftTopRight','topRightBottomLeft','scrollLeft','scrollRight','scrollTop','scrollBottom','scrollHorz');
1145				marginLeft = 0,
1146				marginTop = 0,
1147				opacityOnGrid = 0;
1148				
1149				if(opts.opacityOnGrid==true){
1150					opacityOnGrid = 0;
1151				} else {
1152					opacityOnGrid = 1;
1153				}
1154 
1155			
1156			
1157			var dataFx = $(' > div',elem).eq(slideI).attr('data-fx');
1158				
1159			if(isMobile()&&opts.mobileFx!=''&&opts.mobileFx!='default'){
1160				fx = opts.mobileFx;
1161			} else {
1162				if(typeof dataFx !== 'undefined' && dataFx!== false && dataFx!== 'default'){
1163					fx = dataFx;
1164				} else {
1165					fx = opts.fx;
1166				}
1167			}
1168			
1169			if(fx=='random') {
1170				fx = shuffle(randomFx);
1171				fx = fx[0];
1172			} else {
1173				fx = fx;
1174				if(fx.indexOf(',')>0){
1175					fx = fx.replace(/ /g,'');
1176					fx = fx.split(',');
1177					fx = shuffle(fx);
1178					fx = fx[0];
1179				}
1180			}
1181			
1182			dataEasing = $(' > div',elem).eq(slideI).attr('data-easing');
1183			mobileEasing = $(' > div',elem).eq(slideI).attr('data-mobileEasing');
1184
1185			if(isMobile()&&opts.mobileEasing!=''&&opts.mobileEasing!='default'){
1186				if(typeof mobileEasing !== 'undefined' && mobileEasing!== false && mobileEasing!== 'default') {
1187					easing = mobileEasing;
1188				} else {
1189					easing = opts.mobileEasing;
1190				}
1191			} else {
1192				if(typeof dataEasing !== 'undefined' && dataEasing!== false && dataEasing!== 'default') {
1193					easing = dataEasing;
1194				} else {
1195					easing = opts.easing;
1196				}
1197			}
1198	
1199			dataSlideOn = $(' > div',elem).eq(slideI).attr('data-slideOn');
1200			if(typeof dataSlideOn !== 'undefined' && dataSlideOn!== false){
1201				slideOn = dataSlideOn;
1202			} else {
1203				if(opts.slideOn=='random'){
1204					var slideOn = new Array('next','prev');
1205					slideOn = shuffle(slideOn);
1206					slideOn = slideOn[0];
1207				} else {
1208					slideOn = opts.slideOn;
1209				}
1210			}
1211				
1212			var dataTime = $(' > div',elem).eq(slideI).attr('data-time');
1213			if(typeof dataTime !== 'undefined' && dataTime!== false && dataTime!== ''){
1214				time = parseFloat(dataTime);
1215			} else {
1216				time = opts.time;
1217			}
1218				
1219			var dataTransPeriod = $(' > div',elem).eq(slideI).attr('data-transPeriod');
1220			if(typeof dataTransPeriod !== 'undefined' && dataTransPeriod!== fal
1220se && dataTransPeriod!== ''){
1221				transPeriod = parseFloat(dataTransPeriod);
1222			} else {
1223				transPeriod = opts.transPeriod;
1224			}
1225				
1226			if(!$(elem).hasClass('camerastarted')){
1227				fx = 'simpleFade';
1228				slideOn = 'next';
1229				easing = '';
1230				transPeriod = 400;
1231				$(elem).addClass('camerastarted')
1232			}
1233	
1234			switch(fx){
1235				case 'simpleFade':
1236					cols = 1;
1237					rows = 1;
1238						break;
1239				case 'curtainTopLeft':
1240					if(opts.slicedCols == 0) {
1241						cols = opts.cols;
1242					} else {
1243						cols = opts.slicedCols;
1244					}
1245					rows = 1;
1246						break;
1247				case 'curtainTopRight':
1248					if(opts.slicedCols == 0) {
1249						cols = opts.cols;
1250					} else {
1251						cols = opts.slicedCols;
1252					}
1253					rows = 1;
1254						break;
1255				case 'curtainBottomLeft':
1256					if(opts.slicedCols == 0) {
1257						cols = opts.cols;
1258					} else {
1259						cols = opts.slicedCols;
1260					}
1261					rows = 1;
1262						break;
1263				case 'curtainBottomRight':
1264					if(opts.slicedCols == 0) {
1265						cols = opts.cols;
1266					} else {
1267						cols = opts.slicedCols;
1268					}
1269					rows = 1;
1270						break;
1271				case 'curtainSliceLeft':
1272					if(opts.slicedCols == 0) {
1273						cols = opts.cols;
1274					} else {
1275						cols = opts.slicedCols;
1276					}
1277					rows = 1;
1278						break;
1279				case 'curtainSliceRight':
1280					if(opts.slicedCols == 0) {
1281						cols = opts.cols;
1282					} else {
1283						cols = opts.slicedCols;
1284					}
1285					rows = 1;
1286						break;
1287				case 'blindCurtainTopLeft':
1288					if(opts.slicedRows == 0) {
1289						rows = opts.rows;
1290					} else {
1291						rows = opts.slicedRows;
1292					}
1293					cols = 1;
1294						break;
1295				case 'blindCurtainTopRight':
1296					if(opts.slicedRows == 0) {
1297						rows = opts.rows;
1298					} else {
1299						rows = opts.slicedRows;
1300					}
1301					cols = 1;
1302						break;
1303				case 'blindCurtainBottomLeft':
1304					if(opts.slicedRows == 0) {
1305						rows = opts.rows;
1306					} else {
1307						rows = opts.slicedRows;
1308					}
1309					cols = 1;
1310						break;
1311				case 'blindCurtainBottomRight':
1312					if(opts.slicedRows == 0) {
1313						rows = opts.rows;
1314					} else {
1315						rows = opts.slicedRows;
1316					}
1317					cols = 1;
1318						break;
1319				case 'blindCurtainSliceTop':
1320					if(opts.slicedRows == 0) {
1321						rows = opts.rows;
1322					} else {
1323						rows = opts.slicedRows;
1324					}
1325					cols = 1;
1326						break;
1327				case 'blindCurtainSliceBottom':
1328					if(opts.slicedRows == 0) {
1329						rows = opts.rows;
1330					} else {
1331						rows = opts.slicedRows;
1332					}
1333					cols = 1;
1334						break;
1335				case 'stampede':
1336					difference = '-'+transPeriod;
1337						break;
1338				case 'mosaic':
1339					difference = opts.gridDifference;
1340						break;
1341				case 'mosaicReverse':
1342					difference = opts.gridDifference;
1343						break;
1344				case 'mosaicRandom':
1345						break;
1346				case 'mosaicSpiral':
1347					difference = opts.gridDifference;
1348					couples = 1.7;
1349						break;
1350				case 'mosaicSpiralReverse':
1351					difference = opts.gridDifference;
1352					couples = 1.7;
1353						break;
1354				case 'topLeftBottomRight':
1355					difference = opts.gridDifference;
1356					couples = 6;
1357						break;
1358				case 'bottomRightTopLeft':
1359					difference = opts.gridDifference;
1360					couples = 6;
1361						break;
1362				case 'bottomLeftTopRight':
1363					difference = opts.gridDifference;
1364					couples = 6;
1365						break;
1366				case 'topRightBottomLeft':
1367					difference = opts.gridDifference;
1368					couples = 6;
1369						break;
1370				case 'scrollLeft':
1371					cols = 1;
1372					rows = 1;
1373						break;
1374				case 'scrollRight':
1375					cols = 1;
1376					rows = 1;
1377						break;
1378				case 'scrollTop':
1379					cols = 1;
1380					rows = 1;
1381						break;
1382				case 'scrollBottom':
1383					cols = 1;
1384					rows = 1;
1385						break;
1386				case 'scrollHorz':
1387					cols = 1;
1388					rows = 1;
1389						break;
1390			}
1391			
1392			var cycle = 0;
1393			var blocks = rows*cols;
1394			var leftScrap = w-(Math.floor(w/cols)*cols);
1395			var topScrap = h-(Math.floor(h/rows)*rows);
1396			var addLeft;
1397			var addTop;
1398			var tAppW = 0;	
1399			var tAppH = 0;
1400			var arr = new Array();
1401			var delay = new Array();
1402			var order = new Array();
1403			while(cycle < blocks){
1404				arr.push(cycle);
1405				delay.push(cycle);
1406				cameraCont.append('<div class="cameraappended" style="display:none; overflow:hidden; position:absolute; z-index:1000" />');
1407				var tApp = $('.cameraappended:eq('+cycle+')',target);
1408				if(fx=='scrollLeft' || fx=='scrollRight' || fx=='scrollTop' || fx=='scrollBottom' || fx=='scrollHorz'){
1409					selector.eq(slideI).clone().show().appendTo(tApp);
1410				} else {
1411					if(slideOn=='next'){
1412						selector.eq(slideI).clone().show().appendTo(tApp);
1413					} else {
1414						selector.eq(vis).clone().show().appendTo(tApp);
1415					}
1416				}
1417
1418				if(cycle%cols<leftScrap){
1419					addLeft = 1;
1420				} else {
1421					addLeft = 0;
1422				}
1423				if(cycle%cols==0){
1424					tAppW = 0;
1425				}
1426				if(Math.floor(cycle/cols)<topScrap){
1427					addTop = 1;
1428				} else {
1429					addTop = 0;
1430				}
1431				tApp.css({
1432					'height': Math.floor((h/rows)+addTop+1),
1433					'left': tAppW,
1434					'top': tAppH,
1435					'width': Math.floor((w/cols)+addLeft+1)
1436				});
1437				$('> .cameraSlide', tApp).css({
1438					'height': h,
1439					'margin-left': '-'+tAppW+'px',
1440					'margin-top': '-'+tAppH+'px',
1441					'width': w
1442				});
1443				tAppW = tAppW+tApp.width()-1;
1444				if(cycle%cols==cols-1){
1445					tAppH = tAppH + tApp.height() - 1;
1446				}
1447				cycle++;
1448			}
1449			
1450
1451			
1452			switch(fx){
1453				case 'curtainTopLeft':
1454						break;
1455				case 'curtainBottomLeft':
1456						break;
1457				case 'curtainSliceLeft':
1458						break;
1459				case 'curtainTopRight':
1460					arr = arr.reverse();
1461						break;
1462				case 'curtainBottomRight':
1463					arr = arr.reverse();
1464						break;
1465				case 'curtainSliceRight':
1466					arr = arr.reverse();
1467						break;
1468				case 'blindCurtainTopLeft':
1469						break;
1470				case 'blindCurtainBottomLeft':
1471					arr = arr.reverse();
1472						break;
1473				case 'blindCurtainSliceTop':
1474						break;
1475				case 'blindCurtainTopRight':
1476						break;
1477				case 'blindCurtainBottomRight':
1478					arr = arr.reverse();
1479						break;
1480				case 'blindCurtainSliceBottom':
1481					arr = arr.reverse();
1482						break;
1483				case 'stampede':
1484					arr = shuffle(arr);
1485						break;
1486				case 'mosaic':
1487						break;
1488				case 'mosaicReverse':
1489					arr = arr.reverse();
1490						break;
1491				case 'mosaicRandom':
1492					arr = shuffle(arr);
1493						break;
1494				case 'mosaicSpiral':
1495					var rows2 = rows/2, x, y, z, n=0;
1496						for (z = 0; z < rows2; z++){
1497							y = z;
1498							for (x = z; x < cols - z - 1; x++) {
1499								order[n++] = y * cols + x;
1500							}
1501							x = cols - z - 1;
1502							for (y = z; y < rows - z - 1; y++) {
1503								order[n++] = y * cols + x;
1504							}
1505							y = rows - z - 1;
1506							for (x = cols - z - 1; x > z; x--) {
1507								order[n++] = y * cols + x;
1508							}
1509							x = z;
1510							for (y = rows - z - 1; y > z; y--) {
1511								order[n++] = y * cols + x;
1512							}
1513						}
1514						
1515						arr = order;
1516
1517						break;
1518				case 'mosaicSpiralReverse':
1519					var rows2 = rows/2, x, y, z, n=blocks-1;
1520						for (z = 0; z < rows2; z++){
1521							y = z;
1522							for (x = z; x < cols - z - 1; x++) {
1523								order[n--] = y * cols + x;
1524							}
1525							x = cols - z - 1;
1526							for (y = z; y < rows - z - 1; y++) {
1527								order[n--] = y * cols + x;
1528							}
1529							y = rows - z - 1;
1530							for (x = cols - z - 1; x > z; x--) {
1531								order[n--] = y * cols + x;
1532							}
1533							x = z;
1534							for (y = rows - z - 1; y > z; y--) {
1535								order[n--] = y * cols + x;
1536							}
1537						}
1538
1539						arr = order;
1540						
1541						break;
1542				case 'topLeftBottomRight':
1543					for (var y = 0; y < rows; y++)
1544					for (var x = 0; x < cols; x++) {
1545						order.push(x + y);
1546					}
1547						delay = order;
1548						break;
1549				case 'bottomRightTopLeft':
1550					for (var y = 0; y < rows; y++)
1551					for (var x = 0; x < cols; x++) {
1552						order.push(x + y);
1553					}
1554						delay = order.reverse();
1555						break;
1556				case 'bottomLeftTopRight':
1557					for (var y = rows; y > 0; y--)
1558					for (var x = 0; x < cols; x++) {
1559						order.push(x + y);
1560					}
1561						delay = order;
1562						break;
1563				case 'topRightBottomLeft':
1564					for (var y = 0; y < rows; y++)
1565					for (var x = cols; x > 0; x--) {
1566						order.push(x + y);
1567					}
1568						delay = order;
1569						break;
1570			}
1571			
1572			
1573						
1574			$.each(arr, function(index, value) {
1575
1576				if(value%cols<leftScrap){
1577					addLeft = 1;
1578				} else {
1579					addLeft = 0;
1580				}
1581				if(value%cols==0){
1582					tAppW = 0;
1583				}
1584				if(Math.floor(value/cols)<topScrap){
1585					addTop = 1;
1586				} else {
1587					addTop = 0;
1588				}
1589							
1590				switch(fx){
1591					case 'simpleFade':
1592						height = h;
1593						width = w;
1594						opacityOnGrid = 0;
1595							break;
1596					case 'curtainTopLeft':
1597						height = 0,
1598						width = Math.floor((w/cols)+addLeft+1),
1599						marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';
1600							break;
1601					case 'curtainTopRight':
1602						height = 0,
1603						width = Math.floor((w/cols)+addLeft+1),
1604						marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';
1605							break;
1606					case 'curtainBottomLeft':
1607						height = 0,
1608						width = Math.floor((w/cols)+addLeft+1),
1609						marginTop = Math.floor((h/rows)+addTop+1)+'px';
1610							break;
1611					case 'curtainBottomRight':
1612						height = 0,
1613						width = Math.floor((w/cols)+addLeft+1),
1614						marginTop = Math.floor((h/rows)+addTop+1)+'px';
1615							break;
1616					case 'curtainSliceLeft':
1617						height = 0,
1618						width = Math.floor((w/cols)+addLeft+1);
1619						if(value%2==0){
1620							marginTop = Math.floor((h/rows)+addTop+1)+'px';					
1621						} else {
1622							marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';					
1623						}
1624							break;
1625					case 'curtainSliceRight':
1626						height = 0,
1627						width = Math.floor((w/cols)+addLeft+1);
1628						if(value%2==0){
1629							marginTop = Math.floor((h/rows)+addTop+1)+'px';					
1630						} else {
1631							marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';					
1632						}
1633							break;
1634					case 'blindCurtainTopLeft':
1635						height = Math.floor((h/rows)+addTop+1),
1636						width = 0,
1637						marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
1638							break;
1639					case 'blindCurtainTopRight':
1640						height = Math.floor((h/rows)+addTop+1),
1641						width = 0,
1642						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
1643							break;
1644					case 'blindCurtainBottomLeft':
1645						height = Math.floor((h/rows)+addTop+1),
1646						width = 0,
1647						marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
1648							break;
1649					case 'blindCurtainBottomRight':
1650						height = Math.floor((h/rows)+addTop+1),
1651						width = 0,
1652						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
1653							break;
1654					case 'blindCurtainSliceBottom':
1655						height = Math.floor((h/rows)+addTop+1),
1656						width = 0;
1657						if(value%2==0){
1658							marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
1659						} else {
1660							marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
1661						}
1662							break;
1663					case 'blindCurtainSliceTop':
1664						height = Math.floor((h/rows)+addTop+1),
1665						width = 0;
1666						if(value%2==0){
1667							marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
1668						} else {
1669							marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
1670						}
1671							break;
1672					case 'stampede':
1673						height = 0;
1674						width = 0;					
1675						marginLeft = (w*0.2)*(((index)%cols)-(cols-(Math.floor(cols/2))))+'px';					
1676						marginTop = (h*0.2)*((Math.floor(index/cols)+1)-(rows-(Math.floor(rows/2))))+'px';	
1677							break;
1678					case 'mosaic':
1679						height = 0;
1680						width = 0;					
1681							break;
1682					case 'mosaicReverse':
1683						height = 0;
1684						width = 0;					
1685						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';					
1686						marginTop = Math.floor((h/rows)+addTop+1)+'px';					
1687							break;
1688					case 'mosaicRandom':
1689						height = 0;
1690						width = 0;					
1691						marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px';					
1692						marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px';					
1693							break;
1694					case 'mosaicSpiral':
1695						height = 0;
1696						width = 0;
1697						marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px';					
1698						marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px';					
1699							break;
1700					case 'mosaicSpiralReverse':
1701						height = 0;
1702						width = 0;
1703						marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px';					
1704						marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px';					
1705							break;
1706					case 'topLeftBottomRight':
1707						height = 0;
1708						width = 0;					
1709							break;
1710					case 'bottomRightTopLeft':
1711						height = 0;
1712						width = 0;					
1713						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';					
1714						marginTop = Math.floor((h/rows)+addTop+1)+'px';					
1715							break;
1716					case 'bottomLeftTopRight':
1717						height = 0;
1718						width = 0;					
1719						marginLeft = 0;					
1720						marginTop = Math.floor((h/rows)+addTop+1)+'px';					
1721							break;
1722					case 'topRightBottomLeft':
1723						height = 0;
1724						width = 0;					
1725						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';					
1726						marginTop = 0;					
1727							break;
1728					case 'scrollRight':
1729						height = h;
1730						width = w;
1731						marginLeft = -w;					
1732							break;
1733					case 'scrollLeft':
1734						height = h;
1735						width = w;
1736						marginLeft = w;					
1737							break;
1738					case 'scrollTop':
1739						height = h;
1740						width = w;
1741						marginTop = h;					
1742							break;
1743					case 'scrollBottom':
1744						height = h;
1745						width = w;
1746						marginTop = -h;					
1747							break;
1748					case 'scrollHorz':
1749						height = h;
1750						width = w;
1751						if(vis==0 && slideI==amountSlide-1) {
1752							marginLeft = -w;	
1753						} else if(vis<slideI  || (vis==amountSlide-1 && slideI==0)) {
1754							marginLeft = w;	
1755						} else {
1756							marginLeft = -w;	
1757						}
1758							break;
1759					}
1760					
1761			
1762				var tApp = $('.cameraappended:eq('+value+')',target);
1763								
1764				if(typeof u !== 'undefined'){
1765					clearInterval(u);
1766					clearTimeout(setT);
1767					setT = setTimeout(canvasLoader,transPeriod+difference);
1768				}
1769				
1770				
1771				if($(pagination).length){
1772					$('.camera_pag li',wrap).removeClass('cameracurrent');
1773					$('.camera_pag li',wrap).eq(slideI).addClass('cameracurrent');
1774				}
1775						
1776				if($(thumbs).length){
1777					$('li', thumbs).removeClass('cameracurrent');
1778					$('li', thumbs).eq(slideI).addClass('cameracurrent');
1779					$('li', thumbs).not('.cameracurrent').find('img').animate({opacity:.5},0);
1780					$('li.cameracurrent img', thumbs).animate({opacity:1},0);
1781					$('li', thumbs).hover(function(){
1782						$('img',this).stop(true,false).animate({opacity:1},150);
1783					},function(){
1784						if(!$(this).hasClass('cameracurrent')){
1785							$('img',this).stop(true,false).animate({opacity:.5},150);
1786						}
1787					});
1788				}
1789								
1790						
1791				var easedTime = parseFloat(transPeriod)+parseFloat(difference);
1792				
1793				function cameraeased() {
1794
1795					$(this).addClass('cameraeased');
1796					if($('.cameraeased',target).length>=0){
1797						$(thumbs).css({visibility:'visible'});
1798					}
1799					if($('.cameraeased',target).length==blocks){
1800						
1801						thumbnailPos();
1802						
1803						$('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom',fakeHover).each(function(){
1804							$(this).css('visibility','hidden');
1805						});
1806		
1807						selector.eq(slideI).show().css('z-index','999').removeClass('cameranext').addClass('cameracurrent');
1808						selector.eq(vis).css('z-index','1').removeClass('cameracurrent');
1809						$('.cameraContent',fakeHover).eq(slideI).addClass('cameracurrent');
1810						if (vis >= 0) {
1811							$('.cameraContent',fakeHover).eq(vis).removeClass('cameracurrent');
1812						}
1813						
1814						opts.onEndTransition.call(this);
1815						
1816						if($('> div', elem).eq(slideI).attr('data-video')!='hide' && $('.cameraContent.cameracurrent .imgFake',fakeHover).length ){
1817							$('.cameraContent.cameracurrent .imgFake',fakeHover).click();
1818						}
1819
1820						
1821						var lMoveIn = selector.eq(slideI).find('.fadeIn').length;
1822						var lMoveInContent = $('.cameraContent',fakeHover).eq(slideI).find('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom').length;
1823						
1824						if (lMoveIn!=0){
1825							$('.cameraSlide.cameracurrent .fadeIn',fakeHover).each(function(){
1826								if($(this).attr('data-easing')!=''){
1827									var easeMove = $(this).attr('data-easing');
1828								} else {
1829									var easeMove = easing;
1830								}
1831								var t = $(this);
1832								if(typeof t.attr('data-outerWidth') === 'undefined' || t.attr('data-outerWidth') === false || t.attr('data-outerWidth') === '') {
1833									var wMoveIn = t.outerWidth();
1834									t.attr('data-outerWidth',wMoveIn);
1835								} else {
1836									var wMoveIn = t.attr('data-outerWidth');
1837								}
1838								if(typeof t.attr('data-outerHeight') === 'undefined' || t.attr('data-outerHeight') === false || t.attr('data-outerHeight') === '') {
1839									var hMoveIn = t.outerHeight();
1840									t.attr('data-outerHeight',hMoveIn);
1841								} else {
1842									var hMoveIn = t.attr('data-outerHeight');
1843								}
1844								//t.css('width',wMoveIn);
1845								var pos = t.position();
1846								var left = pos.left;
1847								var top = pos.top;
1848								var tClass = t.attr('class');
1849								var ind = t.index();
1850								var hRel = t.parents('.camerarelative').outerHeight();
1851								var wRel = t.parents('.camerarelative').outerWidth();
1852								if(tClass.indexOf("fadeIn") != -1) {
1853									t.animate({opacity:0}
1853,0).css('visibility','visible').delay((time/lMoveIn)*(0.1*(ind-1))).animate({opacity:1},(time/lMoveIn)*0.15,easeMove);
1854								} else {
1855									t.css('visibility','visible');
1856								}
1857							});
1858						}
1859
1860						$('.cameraContent.cameracurrent',fakeHover).show();
1861						if (lMoveInContent!=0){
1862							
1863							$('.cameraContent.cameracurrent .moveFromLeft, .cameraContent.cameracurrent .moveFromRight, .cameraContent.cameracurrent .moveFromTop, .cameraContent.cameracurrent .moveFromBottom, .cameraContent.cameracurrent .fadeIn, .cameraContent.cameracurrent .fadeFromLeft, .cameraContent.cameracurrent .fadeFromRight, .cameraContent.cameracurrent .fadeFromTop, .cameraContent.cameracurrent .fadeFromBottom',fakeHover).each(function(){
1864								if($(this).attr('data-easing')!=''){
1865									var easeMove = $(this).attr('data-easing');
1866								} else {
1867									var easeMove = easing;
1868								}
1869								var t = $(this);
1870								var pos = t.position();
1871								var left = pos.left;
1872								var top = pos.top;
1873								var tClass = t.attr('class');
1874								var ind = t.index();
1875								var thisH = t.outerHeight();
1876								if(tClass.indexOf("moveFromLeft") != -1) {
1877									t.css({'left':'-'+(w)+'px','right':'auto'});
1878									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left},(time/lMoveInContent)*0.15,easeMove);
1879								} else if(tClass.indexOf("moveFromRight") != -1) {
1880									t.css({'left':w+'px','right':'auto'});
1881									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left},(time/lMoveInContent)*0.15,easeMove);
1882								} else if(tClass.indexOf("moveFromTop") != -1) {
1883									t.css({'top':'-'+h+'px','bottom':'auto'});
1884									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top},(time/lMoveInContent)*0.15,easeMove,function(){
1885										t.css({top:'auto',bottom:0});
1886									});
1887								} else if(tClass.indexOf("moveFromBottom") != -1) {
1888									t.css({'top':h+'px','bottom':'auto'});
1889									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top},(time/lMoveInContent)*0.15,easeMove);
1890								} else if(tClass.indexOf("fadeFromLeft") != -1) {
1891									t.animate({opacity:0}
1891,0).css({'left':'-'+(w)+'px','right':'auto'});
1892									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},(time/lMoveInContent)*0.15,easeMove);
1893								} else if(tClass.indexOf("fadeFromRight") != -1) {
1894									t.animate({opacity:0},0).css({'left':(w)+'px','right':'auto'});
1895									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},(time/lMoveInContent)*0.15,easeMove);
1896								} else if(tClass.indexOf("fadeFromTop") != -1) {
1897									t.animate({opacity:0},0).css({'top':'-'+(h)+'px','bottom':'auto'});
1898									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top,opacity:1},(time/lMoveInContent)*0.15,easeMove,function(){
1899										t.css({top:'auto',bottom:0});
1900									});
1901								} else if(tClass.indexOf("fadeFromBottom") != -1) {
1902									t.animate({opacity:0},0).css({'bottom':'-'+thisH+'px'});
1903									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'bottom':'0',opacity:1},(time/lMoveInContent)*0.15,easeMove);
1904								} else if(tClass.indexOf("fadeIn") != -1) {
1905									t.animate({opacity:0}
1905,0).css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({opacity:1},(time/lMoveInContent)*0.15,easeMove);
1906								} else {
1907									t.css('visibility','visible');
1908								}
1909							});
1910						}
1911
1912						
1913						$('.cameraappended',target).remove();
1914						elem.removeClass('camerasliding');	
1915							selector.eq(vis).hide();
1916							var barWidth = $('.camera_bar_cont',camera_thumbs_wrap).width(),
1917								barHeight = $('.camera_bar_cont',camera_thumbs_wrap).height(),
1918								radSum;
1919							if (loader != 'pie') {
1920								radSum = 0.05;
1921							} else {
1922								radSum = 0.005;
1923							}
1924							$('#'+pieID).animate({opacity:opts.loaderOpacity},200);
1925							u = setInterval(
1926								function(){
1927									if(elem.hasClass('stopped')){
1928										clearInterval(u);
1929									}
1930									if (loader != 'pie') {
1931										if(rad<=1.002 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')){
1932											rad = (rad+radSum);
1933										} else if (rad<=1 && (elem.hasClass('stopped') || elem.hasClass('paused') || elem.hasClass('stopped') || elem.hasClass('hovered'))){
1934											rad = rad;
1935										} else {
1936											if(!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
1937												clearInterval(u);
1938												imgFake();
1939												$('#'+pieID).animate({opacity:0}
1939,200,function(){
1940													clearTimeout(setT);
1941													setT = setTimeout(canvasLoader,easedTime);
1942													nextSlide();
1943													opts.onStartLoading.call(this);
1944												});
1945											}
1946										}
1947										switch(barDirection){
1948											case 'leftToRight':
1949												$('#'+pieID).animate({'right':barWidth-(barWidth*rad)},(time*radSum),'linear');
1950												break;
1951											case 'rightToLeft':
1952												$('#'+pieID).animate({'left':barWidth-(barWidth*rad)},(time*radSum),'linear');
1953												break;
1954											case 'topToBottom':
1955												$('#'+pieID).animate({'bottom':barHeight-(barHeight*rad)},(time*radSum),'linear');
1956												break;
1957											case 'bottomToTop':
1958												$('#'+pieID).animate({'bottom':barHeight-(barHeight*rad)},(time*radSum),'linear');
1959												break;
1960										}
1961										
1962									} else {
1963										radNew = rad;
1964										ctx.clearRect(0,0,opts.pieDiameter,opts.pieDiameter);
1965										ctx.globalCompositeOperation = 'destination-over';
1966										ctx.beginPath();
1967										ctx.arc((opts.pieDiameter)/2, (opts.pieDiameter)/2, (opts.pieDiameter)/2-opts.loaderStroke,0,Math.PI*2,false);
1968										ctx.lineWidth = opts.loaderStroke;
1969										ctx.strokeStyle = opts.loaderBgColor;
1970										ctx.stroke();
1971										ctx.closePath();
1972										ctx.globalCompositeOperation = 'source-over';
1973										ctx.beginPath();
1974										ctx.arc((opts.pieDiameter)/2, (opts.pieDiameter)/2, (opts.pieDiameter)/2-opts.loaderStroke,0,Math.PI*2*radNew,false);
1975										ctx.lineWidth = opts.loaderStroke-(opts.loaderPadding*2);
1976										ctx.strokeStyle = opts.loaderColor;
1977										ctx.stroke();
1978										ctx.closePath();
1979												
1980										if(rad<=1.002 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')){
1981											rad = (rad+radSum);
1982										} else if (rad<=1 && (elem.hasClass('stopped') || elem.hasClass('paused') || elem.hasClass('hovered'))){
1983											rad = rad;
1984										} else {
1985											if(!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
1986												clearInterval(u);
1987												imgFake();
1988												$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
1988,200,function(){
1989													clearTimeout(setT);
1990													setT = setTimeout(canvasLoader,easedTime);
1991													nextSlide();
1992													opts.onStartLoading.call(this);
1993												});
1994											}
1995										}
1996									}
1997								},time*radSum
1998							);
1999						}
2000
2001				}
2002
2003
2004				
2005				if(fx=='scrollLeft' || fx=='scrollRight' || fx=='scrollTop' || fx=='scrollBottom' || fx=='scrollHorz'){
2006					opts.onStartTransition.call(this);
2007					easedTime = 0;
2008					tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({
2009							'display' : 'block',
2010							'height': height,
2011							'margin-left': marginLeft,
2012							'margin-top': marginTop,
2013							'width': width
2014						}).animate({
2015							'height': Math.floor((h/rows)+addTop+1),
2016							'margin-top' : 0,
2017							'margin-left' : 0,
2018							'width' : Math.floor((w/cols)+addLeft+1)
2019						},(transPeriod-difference),easing,cameraeased);
2020					selector.eq(vis).delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).animate({
2021							'margin-left': marginLeft*(-1),
2022							'margin-top': marginTop*(-1)
2023						},(transPeriod-difference),easing,function(){
2024							$(this).css({'margin-top' : 0,'margin-left' : 0});
2025						});
2026				} else {
2027					opts.onStartTransition.call(this);
2028					easedTime = parseFloat(transPeriod)+parseFloat(difference);
2029					if(slideOn=='next'){
2030						tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({
2031								'display' : 'block',
2032								'height': height,
2033								'margin-left': marginLeft,
2034								'margin-top': marginTop,
2035								'width': width,
2036								'opacity' : opacityOnGrid
2037							}).animate({
2038								'height': Math.floor((h/rows)+addTop+1),
2039								'margin-top' : 0,
2040								'margin-left' : 0,
2041								'opacity' : 1,
2042								'width' : Math.floor((w/cols)+addLeft+1)
2043							},(transPeriod-difference),easing,cameraeased);
2044					} else {
2045						selector.eq(slideI).show().css('z-index','999').addClass('cameracurrent');
2046						selector.eq(vis).css('z-index','1').removeClass('cameracurrent');
2047						$('.cameraContent',fakeHover).eq(slideI).addClass('cameracurrent');
2048						$('.cameraContent',fakeHover).eq(vis).removeClass('cameracurrent');
2049						tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({
2050								'display' : 'block',
2051								'height': Math.floor((h/rows)+addTop+1),
2052								'margin-top' : 0,
2053								'margin-left' : 0,
2054								'opacity' : 1,
2055								'width' : Math.floor((w/cols)+addLeft+1)
2056							}).animate({
2057								'height': height,
2058								'margin-left': marginLeft,
2059								'margin-top': marginTop,
2060								'width': width,
2061								'opacity' : opacityOnGrid
2062							},(transPeriod-difference),easing,cameraeased);
2063					}
2064				}
2065
2066
2067
2068
2069
2070			});
2071				
2072				
2073				
2074	 
2075		}
2076	}
2077
2078
2079				if($(prevNav).length){
2080					$(prevNav).click(function(){
2081						if(!elem.hasClass('camerasliding')){
2082							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index());
2083							clearInterval(u);
2084							imgFake();
2085							$('#'+pieID+', .camera_canvas_wrap',wrap).animate({opacity:0}
2085,0);
2086							canvasLoader();
2087							if(idNum!=0){
2088								nextSlide(idNum);
2089							} else {
2090								nextSlide(amountSlide);
2091						   }
2092						   opts.onStartLoading.call(this);
2093						}
2094					});
2095				}
2096			
2097				if($(nextNav).length){
2098					$(nextNav).click(function(){
2099						if(!elem.hasClass('camerasliding')){
2100							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 
2101							clearInterval(u);
2102							imgFake();
2103							$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
2104							canvasLoader();
2105							if(idNum==amountSlide-1){
2106								nextSlide(1);
2107							} else {
2108								nextSlide(idNum+2);
2109						   }
2110						   opts.onStartLoading.call(this);
2111						}
2112					});
2113				}
2114
2115
2116				if(isMobile()){
2117					fakeHover.bind('swipeleft',function(event){
2118						if(!elem.hasClass('camerasliding')){
2119							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 
2120							clearInterval(u);
2121							imgFake();
2122							$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
2123							canvasLoader();
2124							if(idNum==amountSlide-1){
2125								nextSlide(1);
2126							} else {
2127								nextSlide(idNum+2);
2128						   }
2129						   opts.onStartLoading.call(this);
2130						}
2131					});
2132					fakeHover.bind('swiperight',function(event){
2133						if(!elem.hasClass('camerasliding')){
2134							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index());
2135							clearInterval(u);
2136							imgFake();
2137							$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
2137,0);
2138							canvasLoader();
2139							if(idNum!=0){
2140								nextSlide(idNum);
2141							} else {
2142								nextSlide(amountSlide);
2143						   }
2144						   opts.onStartLoading.call(this);
2145						}
2146					});
2147				}
2148
2149				if($(pagination).length){
2150					$('.camera_pag li',wrap).click(function(){
2151						if(!elem.hasClass('camerasliding')){
2152							var idNum = parseFloat($(this).index());
2153							var curNum = parseFloat($('.cameraSlide.cameracurrent',target).index());
2154							if(idNum!=curNum) {
2155								clearInterval(u);
2156								imgFake();
2157								$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
2158								canvasLoader();
2159								nextSlide(idNum+1);
2160								opts.onStartLoading.call(this);
2161							}
2162						}
2163					});
2164				}
2165
2166				if($(thumbs).length) {
2167
2168					$('.pix_thumb img',thumbs).click(function(){
2169						if(!elem.hasClass('camerasliding')){
2170							var idNum = parseFloat($(this).parents('li').index());
2171							var curNum = parseFloat($('.cameracurrent',target).index());
2172							if(idNum!=curNum) {
2173								clearInterval(u);
2174								imgFake();
2175								$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
2175,0);
2176								$('.pix_thumb',thumbs).removeClass('cameracurrent');
2177								$(this).parents('li').addClass('cameracurrent');
2178								canvasLoader();
2179								nextSlide(idNum+1);
2180								thumbnailPos();
2181								opts.onStartLoading.call(this);
2182							}
2183						}
2184					});
2185
2186					$('.camera_thumbs_cont .camera_prevThumbs',camera_thumbs_wrap).hover(function(){
2187						$(this).stop(true,false).animate({opacity:1},250);
2188					},function(){
2189						$(this).stop(true,false).animate({opacity:.7},250);
2190					});
2191					$('.camera_prevThumbs',camera_thumbs_wrap).click(function(){
2192						var sum = 0,
2193							wTh = $(thumbs).outerWidth(),
2194							offUl = $('ul', thumbs).offset().left,
2195							offDiv = $('> div', thumbs).offset().left,
2196							ulLeft = offDiv-offUl;
2197							$('.camera_visThumb',thumbs).each(function(){
2198								var tW = $(this).outerWidth();
2199								sum = sum+tW;
2200							});
2201							if(ulLeft-sum>0){
2202								$('ul', thumbs).animate({'margin-left':'-'+(ulLeft-sum)+'px'},500,thumbnailVisible);
2203							} else {
2204								$('ul', thumbs).animate({'margin-left':0},500,thumbnailVisible);
2205							}
2206					});
2207
2208					$('.camera_thumbs_cont .camera_nextThumbs',camera_thumbs_wrap).hover(function(){
2209						$(this).stop(true,false).animate({opacity:1},250);
2210					},function(){
2211						$(this).stop(true,false).animate({opacity:.7},250);
2212					});
2213					$('.camera_nextThumbs',camera_thumbs_wrap).click(function(){
2214						var sum = 0,
2215							wTh = $(thumbs).outerWidth(),
2216							ulW = $('ul', thumbs).outerWidth(),
2217							offUl = $('ul', thumbs).offset().left,
2218							offDiv = $('> div', thumbs).offset().left,
2219							ulLeft = offDiv-offUl;
2220							$('.camera_visThumb',thumbs).each(function(){
2221								var tW = $(this).outerWidth();
2222								sum = sum+tW;
2223							});
2224							if(ulLeft+sum+sum<ulW){
2225								$('ul', thumbs).animate({'margin-left':'-'+(ulLeft+sum)+'px'},500,thumbnailVisible);
2226							} else {
2227								$('ul', thumbs).animate({'margin-left':'-'+(ulW-wTh)+'px'},500,thumbnailVisible);
2228							}
2229					});
2230
2231				}
2232		
2233		
2234	
2235}
2236
2237})(jQuery);
2238
2239;(function($){$.fn.cameraStop = function() {
2240	var wrap = $(this),
2241		elem = $('.camera_src',wrap),
2242		pieID = 'pie_'+wrap.index();
2243	elem.addClass('stopped');
2244	if($('.camera_showcommands').length) {
2245		var camera_thumbs_wrap = $('.camera_thumbs_wrap',wrap);
2246	} else {
2247		var camera_thumbs_wrap = wrap;
2248	}
2249}
2250})(jQuery);
2251
2252;(function($){$.fn.cameraPause = function() {
2253	var wrap = $(this);
2254	var elem = $('.camera_src',wrap);
2255	elem.addClass('paused');
2256}
2257})(jQuery);
2258
2259;(function($){$.fn.cameraResume = function() {
2260	var wrap = $(this);
2261	var elem = $('.camera_src',wrap);
2262	if(typeof autoAdv === 'undefined' || autoAdv!==true){
2263		elem.removeClass('paused');
2264	}
2265}
2266})(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.