PageSourceSearch

https://net-consult.ru/local/templates/jb/js/camera.js

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