PageSourceSearch

https://www.stubaierhof.at/(cms)/module/static/default/content/libs/js/vjg/vjg.js?v=1083

js stubaierhof.at collected 2026-10-08 08:11:51 UTC 58,590 bytes, 1,636 lines download raw bytes

1/*
2 * vjg - vioma jquery gallery
3 * 
4 */
5
6if ( typeof vjg_effect_before == 'undefined' ) function vjg_effect_before(){};
7if ( typeof vjg_effect_after == 'undefined' ) function vjg_effect_after(){};
8if ( typeof vjg_started == 'undefined' ) function vjg_started(){};
9
10if ( typeof window.vjg_settings == 'undefined' ) {
11	window.vjg = {};
12	window.vjg_settings = [];
13	
14	vjg.debug = false;
15	
16	if ( window.console && jQuery.browser && jQuery.browser.msie ) {
17		console.debug = window.console.log;
18	}
19	
20	vjg.child_init = function( identifier, index ) {
21		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'child_init( ' + identifier + ', ' + index + ' );');
22		
23		vjg.lightbox_init( identifier );
24		
25		if ( vjg_settings[identifier].resize !== false ) {
26			var parts = vjg_settings[identifier].resize.split( 'x' );
27
28			if ( parts[0] > 0 ) {
29				parts[0] = parseInt( parts[0] );
30				
31				vjg_settings[identifier]._children.height( parts[0] );
32			}
33			
34			if ( parts[1] > 0 ) {
35				parts[1] = parseInt( parts[1] );
36				
37				var tmp = -1;
38				vjg_settings[identifier]._children.eq( index ).width( parts[1] + 'px' ).css( 'overflow', 'hidden' );
39			}
40			
41			vjg_settings[identifier]._children_info[index] = {
42				loaded: false,
43				width: parts[1],
44				left: tmp++,
45				right: ( tmp + parts[1] )
46			};
47			
48			tmp += parts[1];
49			vjg_settings[identifier]._children_width += parts[1];
50		}
51		else {
52			var width = vjg_settings[identifier]._children.eq( index ).outerWidth( true );
53			
54			if ( vjg_settings[identifier].view == 'single' ) {
55				width = vjg_settings[identifier]._el_parent.width();
56			}
57			
58			if ( vjg_settings[identifier].offset !== false && index < ( vjg_settings[identifier]._children.size() - 1 ) ) {
59				width += parseInt( vjg_settings[identifier].offset, 10 );
60			}
61			
62			if ( vjg_settings[identifier].lightbox !== false && vjg_settings[identifier]._children.eq( index ).attr( 'rel' ) ) {
63				vjg_settings[identifier]._children.eq( index )
64			}
65			
66			if ( index == 0 ) {
67				vjg_settings[identifier]._children.eq( index ).addClass( 'current' );
68			}
69			
70			vjg_settings[identifier]._children_info[index] = {
71				width: width,
72				loaded: false,
73				left: vjg_settings[identifier]._children_width,
74				right: ( vjg_settings[identifier]._children_width + width )
75			};
76			
77			if ( vjg_settings[identifier].effect[0] == 'slide' ) {
78				vjg_settings[identifier]._children
79					.eq( index )
80					.css( 'left', vjg_settings[identifier]._children_width );
81				
82				if ( index == vjg_settings[identifier]._children.length - 1 ) {
83					if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'all ' + vjg_settings[identifier]._children.length + ' images loaded', 2 );
84					
85					if ( typeof vjg_settings[identifier]._el_parent == 'object' ) {
86						vjg_settings[identifier]._el_parent.width( vjg_settings[identifier]._children_width );
87					}
88				}
89			}
90
91			vjg_settings[identifier]._children_width += width;
92		}
93	}
94
95	vjg.child_create = function( identifier, index ){
96		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'child_create( ' + identifier + ', ' + index + ' );' );
97		
98		if ( index == undefined ) index = 0;
99
100		var child = vjg_settings[identifier]._children_object.eq( index );
101		child.attr( 'vjg', identifier );
102			
103		if ( child.attr( 'onclick' ) ) {
104			var a = jQuery( '<a onclick="' + child.attr( 'onclick' ).replace(/\"/g, "'") + '" />').appendTo( vjg_settings[identifier]._el_parent );
105		}
106		else {
107			var a = jQuery( '<a onclick="return false;" style="cursor: default;" />').appendTo( vjg_settings[identifier]._el_parent );
108		}
109		
110		a.attr( 'vjg', identifier );
111		
112		if ( child.attr( 'href' ) ) {	
113			a.attr( 'href', child.attr( 'href' ) );
114		}
115		
116		if ( child.attr( 'thumb' ) ) {	
117			a.attr( 'thumb', child.attr( 'thumb' ) );
118		}
119		
120		if ( child.attr( 'rel' ) ) {	
121			a.attr( 'rel', child.attr( 'rel' ) );
122		}
123
124		if ( child.attr( 'style' ) ) {	
125			//a.attr( 'style', child.attr( 'style' ) );
126		}
127
128		if ( child.attr( 'title' ) ) {
129			a.attr( 'title', child.attr( 'title' ) );
130			// muss fuer abwaertskompatibilitaet drinnen bleiben
131			a.attr( 'alt', child.attr( 'title' ) );
132		}
133
134		if ( child.attr( 'alt' ) ) {
135			a.attr( 'alt', child.attr( 'alt' ) );
136		}
137		
138		if ( child.attr( 'src' ) ) {
139			var img = jQuery( document.createElement( 'img' ) );
140			
141			if ( vjg_settings[identifier].view == 'multi' || index < 4 ) {
142				img.attr( 'src', child.attr( 'src' ) );
143			}
144			else {
145				img.attr( 'rev', child.attr( 'src' ) );
146			}
147			
148			if ( child.attr( 'title' ) ) {	
149				img.attr( 'alt', child.attr( 'title' ) );
150			}
151			
152			if ( child.attr( 'overlay' ) ) {
153				var wrapper = jQuery( document.createElement( 'div' ) );
154				wrapper.attr( 'class', 'vjg_wrapper' );
155				wrapper.append( img );
156				
157				var overlay = jQuery( document.createElement( 'span' ) );
158				overlay.html( child.attr( 'overlay' ) );
159				overlay.attr( 'style', a.attr( 'style' ) );
160				wrapper.append( overlay );
161
162				a.hide().append( wrapper );
163			}
164			else {
165				a.hide().append( img );
166			}
167		}
168		
169		vjg_settings[identifier]._children = vjg_settings[identifier]._el_parent.children();
170		
171		return img;
172	}
173	
174	vjg.children_init = function( identifier ){
175		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'children_init( ' + identifier + ' );');
176
177		vjg_settings[identifier]._children_width = 0;
178
179		if ( vjg_settings[identifier]._children === false ) {
180			switch( typeof vjg_settings[identifier].children ) {
181				case 'object':
182					vjg_settings[identifier]._children_object = jQuery( vjg_settings[identifier].children );
183					vjg.parent_prepare( identifier );
184					vjg.child_prepare( identifier );
185				break;
186				
187				case 'string':
188					vjg_settings[identifier]._children = vjg_settings[identifier]._el_parent.children( vjg_settings[identifier].children ).attr( 'vjg', identifier );
189					vjg.parent_prepare( identifier );
190				break;
191				
192				case 'boolean':
193					vjg_settings[identifier]._children = vjg_settings[identifier]._el_parent.children().attr( 'vjg', identifier );
194					vjg.parent_prepare( identifier );
195					vjg.children_prepare( identifier, true );
196				break;
197			}
198		}
199
200		vjg_started( identifier, vjg_settings[identifier]._children.eq( 0 ) );
201	}
202	
203	vjg.child_load = function( identifier, index ) {
204		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'child_load( ' + identifier + ', ' + index + ( !index ? ' (self calculated: ' + ( vjg_settings[identifier]._child_current + 1 ) + ')' : '' ) + ' );' );
205		
206		if ( !index ) index = vjg_settings[identifier]._child_current + 1;
207		
208		var child_next = vjg_settings[identifier]._children.eq( index );
209		
210		if ( child_next.length > 0 ) {
211			var child_next_img = child_next.find( 'img:first' );
212			
213			if ( child_next_img.attr( 'rev' ) ) {
214				child_next_img.attr( 'src', child_next_img.attr( 'rev' ) );
215				child_next_img.removeAttr( 'rev' );
216			}
217		}
218	}
219	
220	vjg.child_prepare = function ( identifier ) {
221		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'child_prepare( ' + identifier + ' );' );
222
223		if ( vjg_settings[identifier]._children.length == vjg_settings[identifier]._children_object.length ) {
224			return;
225		}
226		
227		for( var i = 0; i < vjg_settings[identifier].children.length; i++ ) {
228			jQuery( vjg.child_create( identifier, i ) )
229				.attr( 'vjg', identifier )
230				.load(function(){
231					vjg.child_init( identifier, i );
232					vjg.children_prepare( identifier, ( i != 1 ) );
233				});
234		}
235	}
236	
237	vjg.children_next = function( identifier, index ) {
238		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'children_next( ' + index + ' );');
239		
240		if( typeof index == 'undefined' ) {
241			index = vjg_settings[identifier]._child_current;
242		}
243		
244		index++;
245		
246		if ( index == vjg_settings[identifier]._children.length ) {
247			return 0;
248		}
249		
250		return index;
251	}
252	
253	vjg.children_prev = function( identifier, index ) {
254		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'children_prev( ' + identifier + ', ' + index + ' );');
255		
256		if( typeof index == 'undefined' ) {
257			index = vjg_settings[identifier]._child_current;
258		}
259		
260		index--;
261		
262		if ( index < 0 ) {
263			return ( vjg_settings[identifier]._children.length - 1 );
264		}
265		
266		return index;
267	}
268	
269	vjg.children_prepare = function( identifier, reinit ) {
270		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'children_prepare( ' + identifier + ', ' + reinit + ' );');
271		
272		switch( vjg_settings[identifier].effect[0] ) {
273			case 'space':
274				/* 
275				 * sample: http://eyecon.ro/spacegallery/#about
276				 */
277				var top = 35, left = 10;
278				
279				vjg_settings[identifier]._children.each(function( i ){
280					vjg_settings[identifier]._children
281						.eq( i )
282						.css( 'display', ( i == vjg_settings[identifier]._child_current ? 'block' : 'none' ) )
283						.css( 'position', 'absolute' )
284						.css( 'top', top + 'px' )
285						.css( 'left', left + 'px' )
286						.css( 'opacity', ( i == vjg_settings[identifier]._child_current ? '1' : '0' ) );
287					
288					top -= 5;
289					left += 5;
290				});
291			break;
292
293			case 'move':
294				vjg_settings[identifier]._children.each(function( i ){
295					vjg_settings[identifier]._children
296						.eq( i )
297						.css( 'display', ( i == vjg_settings[identifier]._child_current ? 'block' : 'none' ) )
298						.css( 'position', 'absolute' )
299						.css( 'top', '-10px' )
300						.css( 'left', '-10px' )
301						.css( 'opacity', ( i == vjg_settings[identifier]._child_current ? '1' : '0' ) );
302				});
303			break;
304
305			case 'fade':
306				vjg_settings[identifier]._children.each(function( i ){
307					vjg_settings[identifier]._children
308						.eq( i )
309						.css( 'display', ( i == vjg_settings[identifier]._child_current ? 'block' : 'none' ) )
310						.css( 'position', 'absolute' )
311						.css( 'top', '0px' )
312						.css( 'left', '0px' )
313						.css( 'opacity', ( i == vjg_settings[identifier]._child_current ? '1' : '0' ) );
314				});						
315			break;
316
317			case 'accordion':
318				vjg_settings[identifier]._children_width = 0;
319				tmp = 0;
320				
321				vjg_settings[identifier]._children.each(function( i ){
322					var width = vjg_settings[identifier]._children.eq( i ).outerWidth( true );
323
324					vjg_settings[identifier]._children
325						.eq( i )
326						.width( ( i == vjg_settings[identifier]._child_current ? vjg_settings[identifier]._children_info[i].width : 0 ) )
327						.bind( 'click', function(){
328							vjg.jumpto( jQuery( this ).attr( 'vjg' ), i );
329							return false;
330						})
331						.css( 'overflow', 'hidden' )
332						.css( 'display', 'block' )
333						.css( 'position', 'absolute' )
334						.css( 'top', '0px' )
335						.css( 'right', '0px' )
336						.css( 'opacity', ( i == vjg_settings[identifier]._child_current ? '1' : '0' ) );
337
338					vjg_settings[identifier]._children_info[i] = {
339						width: width,
340						left: vjg_settings[identifier]._children_width + ( i * 2 ) * parseInt( vjg_settings[identifier].offset, 10 ),
341						right: ( tmp + width ),
342						loaded: false
343					};
344					
345					tmp += width;
346					vjg_settings[identifier]._children_width += width;
347				});		
348			break;
349
350			case 'slide':
351				vjg_settings[identifier]._children_width = 0;
352				tmp = 0;
353				
354				vjg_settings[identifier]._children.each(function( i ){
355					var width = jQuery( this )
356//							.width( vjg_settings[identifier]._children_info[i].width )
357						.bind( 'click', function(){
358							vjg.jumpto( jQuery( this ).attr( 'vjg' ), i );
359							return false;
360						})
361						.outerWidth( true );
362					
363					jQuery( this )
364						.find( 'img:first' )
365						.load(function(){
366							// rewrite all children positions
367							var tmp = 0;
368							vjg_settings[identifier]._children.each(function( j ){
369								vjg_settings[identifier]._children_info[j] = {
370									width: jQuery( this ).outerWidth(),
371									left: tmp + ( j * 2 ) * parseInt( vjg_settings[identifier].offset, 10 ),
372									right: ( tmp + jQuery( this ).outerWidth() )
373								};
374
375								tmp += jQuery( this ).outerWidth();
376								
377								vjg_settings[identifier]._children
378									.eq( j )
379									.css( 'left', vjg_settings[identifier]._children_info[j].left );
380							});
381						});
382
383						
384					vjg_settings[identifier]._children_info[i] = {
385						width: width,
386						left: vjg_settings[identifier]._children_width + ( i * 2 ) * parseInt( vjg_settings[identifier].offset, 10 ),
387						right: ( tmp + width ),
388						loaded: false
389					};
390					
391					tmp += width;
392					vjg_settings[identifier]._children_width += width;
393					
394					if ( vjg_settings[identifier].view != 'single' ) {
395						vjg_settings[identifier]._children
396							.eq( i )
397							.css( 'left', ( vjg_settings[identifier]._children_info[i] != null ? vjg_settings[identifier]._children_info[i].left : 0 ) )
398							.css( 'display', 'block' )
399							.css( 'position', 'absolute' )
400							.css( 'top', '0px' );
401
402						vjg_settings[identifier]._el_parent.width( vjg_settings[identifier]._children_width );
403					}
404				});
405			break;
406
407			default:
408				vjg_settings[identifier]._children
409					.css( 'opacity', '0' )
410					.css( 'display', 'block' )
411					.eq( 0 )
412					.css( 'opacity', '1' );
413			
414				if ( vjg_settings[identifier].view == 'multi' ) {
415					vjg_settings[identifier]._children
416						.css( 'position', 'absolute')
417						.css( 'top', '0px' )
418						.css( 'left', '0px' );
419				}
420			break;
421		}
422		
423		if( vjg_settings[identifier].view == 'single' ) {
424			switch( vjg_settings[identifier].effect[0] ) {
425				case 'move':
426					vjg_settings[identifier]._children.each(function( i ){
427						vjg_settings[identifier]._children
428							.eq( i )
429							.css( 'position', 'absolute' )
430							.css( 'width', width );
431					});
432				break;
433				
434				case 'fade':
435					var tmp = 0;
436					vjg_settings[identifier]._children_width = 0;
437					
438					vjg_settings[identifier]._children.each(function( i ){
439						var width = vjg_settings[identifier]._el_parent.width();
440						
441						vjg_settings[identifier]._children
442							.eq( i )
443							.css( 'position', ( i == vjg_settings[identifier]._child_current ? 'static' : 'absolute' ) )
444							.css( 'top', '0px' )
445							.css( 'left', '0px' )
446							.css( 'text-align', 'center' )
447							.css( 'width', width );
448
449						vjg_settings[identifier]._children_info[i] = {
450							loaded: false,
451							width: width,
452							left: vjg_settings[identifier]._children_width,
453							right: ( tmp + width )
454						};
455						
456						tmp += width;
457						vjg_settings[identifier]._children_width += width;
458					});
459				break;
460
461				case 'slide':
462					vjg_settings[identifier]._children.each(function( i ){
463						var width = vjg_settings[identifier]._el_parent.width();
464						
465						vjg_settings[identifier]._children
466							.eq( i )
467							.width( vjg_settings[identifier]._children_info[i].width )
468							.css( 'display', 'block' )
469							.css( 'margin', '0px auto' )
470							.wrap( 
471								jQuery( document.createElement( 'div' ) )
472									.css({
473										position: 'absolute',
474										top: '0px',
475										left: '0px',
476										'text-align': 'center',
477										width: width
478									})
479							)
480							.unbind( 'mouseenter' )
481							.bind( 'mouseenter', function(){
482								jQuery( this ).addClass( 'hover' );
483							})
484							.unbind( 'mouseleave' )
485							.bind( 'mouseleave', function(){
486								jQuery( this ).removeClass( 'hover' );
487							});
488					});
489				break;
490			}
491		}
492
493		vjg.scroller_init( identifier, reinit );
494		
495		if ( vjg_settings[identifier]._el_parent !== false ) {
496			vjg_settings[identifier]._el_parent.css( 'visibility', 'visible' );
497		}
498		else {
499			vjg_settings[identifier]._el_parent.css( 'visibility', 'visible' );
500		}
501
502		if ( vjg_settings[identifier].links !== false ) {
503			vjg.links_init( identifier );
504		}
505		
506		vjg.scroll_elements_init( identifier );
507		
508		if ( reinit ) {
509			vjg.interval_start( identifier );
510		}
511	}
512	 
513	vjg.effect = function( identifier ) {
514		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'effect( ' + identifier + ' );', 3 );
515		
516		vjg_effect_before( identifier, vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ) );
517		
518		if ( vjg_settings[identifier]._children.length <= 1 ) {
519			return false;
520		}
521		
522		if ( vjg_settings[identifier].scrollable !== false ) {
523			vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).removeClass( 'current' );
524		}
525
526		if ( vjg_settings[identifier].scroller.container !== false ) {
527			vjg.scroller_scroll_to( identifier, vjg.children_next( identifier, vjg_settings[identifier]._child_current ) );
528		}
529		
530		switch( vjg_settings[identifier].effect[0] ) {
531			case 'move':
532				vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current )
533					.animate( { opacity: 0 }, vjg_settings[identifier].speed, "linear", function(){ 
534						jQuery( this )
535							.css( 'display', 'none' )
536							.css( 'top', '-10px' )
537							.css( 'left', '-10px' );
538					} );
539				
540				vjg_settings[identifier]._child_current = vjg.children_next( identifier, vjg_settings[identifier]._child_current );
541				
542				vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current )
543					.css( 'display', 'block' )
544					.animate( { opacity: 1 }, vjg_settings[identifier].speed, "linear" )
545					.animate( { top: '0px', left: '0px' }, vjg_settings[identifier].speed, "easeInOutQuad" );
546			break;
547
548			case 'fade':
549				// in ie8 the animated element needs position "static" or "relative", so wen cant use z-index..
550				vjg_settings[identifier]._child_old = vjg_settings[identifier]._child_current;
551				vjg_settings[identifier]._child_current = vjg.children_next( identifier, vjg_settings[identifier]._child_current );
552
553				// the last image fades out
554				if ( vjg_settings[identifier]._child_old == vjg_settings[identifier]._children.length - 1 ) {
555					vjg_settings[identifier]._children
556						.eq( vjg_settings[identifier]._child_current )
557						.css( 'position', 'absolute' )
558						.css( 'display', 'block' )
559						.css( 'opacity', 1 )
560						.end()
561						.eq( vjg_settings[identifier]._child_old )
562						.css( 'position', 'relative' )
563						.animate( { opacity: 0 }, vjg_settings[identifier].speed, "linear", function(){
564							vjg.child_load( identifier );
565							vjg_effect_after( identifier, vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ) );
566						}.bind(identifier));
567				}
568				else {
569					vjg_settings[identifier]._children
570						.css( 'position', 'absolute' )
571						.eq( vjg_settings[identifier]._child_current )
572						.css( 'position', 'relative' )
573						.css( 'display', 'block' )
574						.animate( { opacity: 1 }, vjg_settings[identifier].speed, "linear", function(){
575							vjg_settings[identifier]._children
576								.eq( vjg_settings[identifier]._child_current )
577								.css( 'position', 'absolute' )
578								.css( 'display', 'block' );
579	
580							vjg_settings[identifier]._children
581								.eq( vjg_settings[identifier]._child_old )
582								.css( 'opacity', 0 )
583								.css( 'display', 'none' );
584	
585							vjg.child_load( identifier );
586							vjg_effect_after( identifier, vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ) );
587						}.bind(identifier));
588				}
589			break;
590			
591			case 'accordion':
592				var child_before = vjg_settings[identifier]._child_current;
593				vjg_settings[identifier]._child_current = vjg.children_next( identifier, vjg_settings[identifier]._child_current );
594				
595				vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).css( 'opacity', '1' ).animate( { width: vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].width }, vjg_settings[identifier].speed, 'linear', function(){
596					vjg_settings[identifier]._children.eq( child_before ).css( 'width', '0px' ).css( 'opacity', '0' );
597				});
598			break;
599			
600			case 'slide':
601				vjg_settings[identifier]._child_current = vjg.children_next( identifier, vjg_settings[identifier]._child_current );
602				vjg_settings[identifier]._el_parent.animate( { left: '-' + vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left }, vjg_settings[identifier].speed );
603			break;
604
605			default:
606				vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current )
607					.css( 'opacity', '0' )
608					.css( 'display', 'none' );
609			
610				vjg_settings[identifier]._child_current = vjg.children_next( identifier, vjg_settings[identifier]._child_current );
611				
612				vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current )
613					.css( 'opacity', '1' )
614					.css( 'display', 'block' );
615			break;
616		}
617		
618		if ( vjg_settings[identifier].scrollable !== false ) {
619			vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).addClass( 'current' );
620		}
621		
622		if ( vjg_settings[identifier].overlay ) {
623			vjg.parent_overlay_update( identifier );
624		}
625	}
626	
627	vjg.effect_duration = function( identifier ) {
628		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'effect_duration( ' + identifier + ' );');
629		
630		switch( vjg_settings[identifier].speed ) {
631			case 'slow':
632				var duration = 600;
633			break;
634			
635			case 'fast':
636				var duration = 200;
637			break;
638			
639			default:
640				if ( isNaN( vjg_settings[identifier].speed ) ) {
641					var duration = 400;
642				}
643				else {
644					var duration = vjg_settings[identifier].speed;
645				}
646			break;
647		}
648		
649		if ( vjg_settings[identifier].effect[0] == 'move' ) {
650			return duration + duration;
651		}
652		
653		return duration;
654	}
655	
656	vjg.start = function( identifier ) {
657		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'elements_mark( ' + identifier + ' );');
658		
659		vjg.children_init( identifier );
660	}
661	
662	vjg.interval_start = function( identifier ) {
663		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'interval_start( ' + identifier + ' );');
664
665		window.clearTimeout( vjg_settings[identifier]._interval_timer );
666
667		if ( vjg_settings[identifier]._stopped ) {
668			return;
669		}
670		
671		if ( vjg_settings[identifier].autostart !== false && !vjg_settings[identifier]._paused ) {
672			vjg_settings[identifier]._interval_timer = window.setTimeout(function(){
673				vjg.effect( identifier );
674				vjg.interval_start( identifier );
675			}, ( vjg_settings[identifier].timeout + vjg.effect_duration( identifier ) ) );
676		}
677	}
678	 
679	vjg.interval_stop = function( identifier ) {
680		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'interval_stop( ' + identifier + ' );');
681		
682		window.clearTimeout( vjg_settings[identifier]._interval_timer );
683	}
684	 
685	vjg.jumpto = function( identifier, index ) {
686		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'jumpto( ' + identifier + ', ' + index + ' );');
687		
688		if ( vjg_settings[identifier].scrollable ) {
689			vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).removeClass( 'current' );
690		}
691		
692		if ( vjg_settings[identifier].scroller.container !== false ) {
693			vjg_settings[identifier]._scroller_inner
694				.children()
695				.removeClass( 'current' )
696				.eq( index )
697				.addClass( 'current' );
698		}
699
700		vjg.child_load( identifier, index );
701
702		switch( vjg_settings[identifier].effect[1] ) {
703			case 'slide':
704				switch( vjg_settings[identifier].view ) {
705					case 'single':
706						if ( !vjg_settings[identifier]._el_parent ) {
707							var child_before = vjg_settings[identifier]._child_current;
708							vjg_settings[identifier]._child_current = index;
709							
710							if ( child_before > vjg_settings[identifier]._child_current ) {
711								vjg_settings[identifier]._children
712									.eq( vjg_settings[identifier]._child_current )
713									.css( 'display', 'block' )
714									.css( 'opacity', '1' );
715								
716								vjg_settings[identifier]._children
717									.eq( child_before )
718									.animate( { opacity: 1, left: vjg_settings[identifier]._el_parent.offset().left + vjg_settings[identifier]._el_parent.width() }, vjg_settings[identifier].speed, "linear" );
719							}
720							else if ( child_before < vjg_settings[identifier]._child_current ) {
721								vjg_settings[identifier]._children
722									.eq( child_before )
723									.css( 'display', 'block' )
724									.css( 'opacity', '1' );
725								
726								vjg_settings[identifier]._children
727									.eq( vjg_settings[identifier]._child_current )
728									.css( 'left', vjg_settings[identifier]._el_parent.offset().left + vjg_settings[identifier]._el_parent.width() )
729									.css( 'display', 'block' )
730									.animate( { opacity: 1, left: 0 }, vjg_settings[identifier].speed, "linear" );
731							}
732						}
733						else {
734							vjg_settings[identifier]._el_parent.animate( { left: '-' + vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left }, { queue: false, duration: vjg_settings[identifier].speed } );
735						}
736					break;
737					
738					default:
739						vjg_settings[identifier]._child_current = index;
740
741						if ( vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left <= ( parseInt( vjg_settings[identifier]._el_parent.css( 'width' ) ) - parseInt( vjg_settings[identifier]._el_parent.css( 'width' ) ) ) ) {
742							vjg_settings[identifier]._el_parent.css( 'opacity', '1' ).animate( { left: '-' + vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left }, vjg_settings[identifier].speed );
743						}
744					break;
745				}
746				
747				vjg.child_load( identifier, ( index + 1 ) );
748			break;
749
750			case 'accordion':
751				vjg_settings[identifier]._children
752					.eq( vjg_settings[identifier]._child_current )
753					.css( 'width', '0px' )
754					.css( 'opacity', '0' );
755				
756				vjg_settings[identifier]._child_current = index;
757				
758				vjg_settings[identifier]._children
759					.eq( vjg_settings[identifier]._child_current )
760					.css( 'width', vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].width )
761					.css( 'opacity', '1' );
762				
763				vjg.child_load( identifier, ( index + 1 ) );
764			break;
765
766			case 'fade':
767				vjg_settings[identifier]._children
768					.eq( vjg_settings[identifier]._child_current )
769					.animate( { opacity: 0 }, vjg_settings[identifier].speed, "linear", function(){
770						jQuery( this ).css( 'display', 'none' );
771					});
772				
773				vjg_settings[identifier]._child_current = index;
774				
775				vjg_settings[identifier]._children
776					.eq( vjg_settings[identifier]._child_current )
777					.css( 'display', 'block' )
778					.animate( { opacity: 1 }, vjg_settings[identifier].speed, "linear", function(){
779						vjg.child_load( identifier, ( index + 1 ) );
780					});
781			break;
782
783			default:
784				if( vjg_settings[identifier].scrollable === false ) {
785					vjg_settings[identifier]._children
786						.eq( vjg_settings[identifier]._child_current )
787						.css( 'display', 'none' )
788						.css( 'opacity', '0' );
789				}
790				
791				vjg_settings[identifier]._child_current = index;
792
793				switch( vjg_settings[identifier].view ) {
794					case 'single':
795						vjg_settings[identifier]._children
796							.eq( vjg_settings[identifier]._child_current )
797							.css( 'position', 'absolute' )
798							.css( 'top', '0px' )
799							.css( 'left', '0px' )
800							.css( 'display', 'block' )
801							.css( 'opacity', '1' );
802					break;
803					
804					case 'multi':
805						vjg_settings[identifier]._children
806							.eq( vjg_settings[identifier]._child_current )
807							.css( 'display', 'block' )
808							.css( 'opacity', '1' );
809					break;
810				}
811				
812				vjg.child_load( identifier, ( index + 1 ) );
813			break;
814		}
815		
816		if ( vjg_settings[identifier].scrollable ) {
817			vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).addClass( 'current' );
818		}
819
820		if ( vjg_settings[identifier].overlay ) {
821			vjg.parent_overlay_update( identifier );
822		}
823	}
824	
825	vjg.links_init = function( identifier ) {
826		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'links_init( ' + identifier + ' );');
827		
828		if ( typeof vjg_settings[identifier].links.lightbox != 'undefined' ) {
829			vjg.lightbox_init( identifier );
830			
831			jQuery( vjg_settings[identifier].links.lightbox )
832				.unbind( 'click' )
833				.bind( 'click', function(){
834					vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).trigger( 'click' );
835					return false;
836				});
837		}
838
839		if ( typeof vjg_settings[identifier].links.play != 'undefined' ) {
840			jQuery( vjg_settings[identifier].links.play )
841				.unbind( 'click' )
842				.bind( 'click', function(){
843					vjg.parent_pause( identifier, false, function(){
844						vjg.interval_start( identifier );
845					});
846					
847					jQuery( this ).hide();
848					jQuery( vjg_settings[identifier].links.pause ).show();
849					return false;
850				});
851		}
852
853		if ( typeof vjg_settings[identifier].links.pause != 'undefined' ) {
854			jQuery( vjg_settings[identifier].links.pause )
855				.unbind( 'click' )
856				.bind( 'click', function(){
857					vjg.parent_pause( identifier, true, function(){
858						vjg.interval_stop( identifier );
859					});
860					
861					jQuery( this ).hide();
862					jQuery( vjg_settings[identifier].links.play ).show();
863					
864					return false;
865				});
866		}
867		
868		if ( typeof vjg_settings[identifier].links.prev != 'undefined' ) {
869			jQuery( vjg_settings[identifier].links.prev )
870				.unbind( 'click' )
871				.bind( 'click', function(){
872					vjg.jumpto( identifier, vjg.children_prev( identifier ) );
873					return false;
874				});
875		}
876
877		if ( typeof vjg_settings[identifier].links.next != 'undefined' ) {
878			jQuery( vjg_settings[identifier].links.next )
879				.unbind( 'click' )
880				.bind( 'click', function(){
881					vjg.jumpto( identifier, vjg.children_next( identifier ) );
882					return false;
883				});
884		}
885	}
886	
887	vjg.lightbox_init = function( identifier ) {
888		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'lightbox_init( ' + identifier + ' );');
889
890		if ( typeof hs != 'undefined' ) {
891			vjg_settings[identifier].lightbox = 'Highslide';
892			hs.updateAnchors();
893			
894			hs.Expander.prototype.onBeforeExpand = function(){
895				vjg.parent_stop( identifier, true, function(){
896					vjg.interval_stop( identifier );
897				});
898			};
899			
900			hs.Expander.prototype.onAfterClose = function(){
901				vjg.parent_stop( identifier, false, function(){
902					vjg.interval_start( identifier );
903				});
904			};
905		}
906		else if ( typeof initLytebox == 'function' ) {
907			vjg_settings[identifier].lightbox = 'Lytebox';
908			initLytebox( identifier );
909		}
910	}
911	
912	vjg.parent_overlay_init = function( identifier ) {
913		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'parent_overlay_init( ' + identifier + ' );');
914		
915		var title;
916
917		if ( vjg_settings[identifier]._children ) {
918			title = vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).attr( 'title' );
919		}
920		else {
921			title = vjg_settings[identifier]._children_object[ vjg_settings[identifier]._child_current ].title;
922		}
923
924		vjg_settings[identifier]._el_overlay = jQuery( document.createElement( 'div' ) )
925			.addClass( 'vjg_overlay' )
926			.css( 'position', 'absolute' )
927			.css( 'width', vjg_settings[identifier]._el_parent.width() )
928			.css( 'z-index', '501' )
929			.text( title );
930		
931		jQuery( document.createElement( 'div' ) )
932					.addClass( 'vjg_overlay_background' )
933					.css( 'position', 'absolute' )
934					.css( 'width', vjg_settings[identifier]._el_parent.width() )
935					.css( 'z-index', '500' )
936					.appendTo( vjg_settings[identifier].overlay_container || vjg_settings[identifier]._el_parent );
937					
938		vjg_settings[identifier]._el_overlay.appendTo( vjg_settings[identifier].overlay_container || vjg_settings[identifier]._el_parent )
939	}
940	
941	vjg.parent_overlay_update = function( identifier ) {
942		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'parent_overlay_update( ' + identifier + ' );');
943		
944		var title;
945
946		if ( vjg_settings[identifier]._children_object ) {
947			title = vjg_settings[identifier]._children_object[ vjg_settings[identifier]._child_current ].title;
948		}
949		else {
950			title = vjg_settings[identifier]._children.eq( vjg_settings[identifier]._child_current ).attr( 'title' );
951		}
952
953		vjg_settings[identifier]._el_overlay.text( title );
954	}
955	 
956	vjg.parent_prepare = function( identifier ) {
957		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'parent_prepare( ' + identifier + ' );');
958			
959		switch( vjg_settings[identifier].effect[0] ) {
960			case 'accordion':
961				vjg_settings[identifier]._el_parent
962					.addClass( 'vjg' )
963					.css( 'position', 'relative' )
964					.unbind( 'mouseenter' )
965					.bind( 'mouseenter', function(){
966						jQuery( this ).addClass( 'hover' );
967						vjg.parent_pause( identifier, true, function(){
968							vjg.interval_stop( identifier );
969						});
970					})
971					.unbind( 'mouseleave' )
972					.bind( 'mouseleave', function(){
973						jQuery( this ).removeClass( 'hover' );
974						vjg.parent_pause( identifier, false, function(){
975							vjg.interval_start( identifier );
976						});
977					});
978			break;
979			
980			case 'slide':
981				vjg_settings[identifier]._el_parent_outer = jQuery( document.createElement( 'div' ) )
982					.attr( 'class', vjg_settings[identifier]._el_parent.attr( 'class' ) )
983					.css({
984						position: 'relative',
985						height: vjg_settings[identifier]._el_parent.css( 'height' ),
986						width: vjg_settings[identifier]._el_parent.css( 'width' ),
987						overflow: 'hidden'
988					})
989					.unbind( 'mouseenter' )
990					.bind( 'mouseenter', function(){
991						jQuery( this ).addClass( 'hover' );
992						vjg.parent_pause( identifier, true, function(){
993							vjg.interval_stop( identifier );
994						});
995					})
996					.unbind( 'mouseleave' )
997					.bind( 'mouseleave', function(){
998						jQuery( this ).removeClass( 'hover' );
999						vjg.parent_pause( identifier, false, function(){
1000							vjg.interval_start( identifier );
1001						});
1002					});
1003			
1004				vjg_settings[identifier]._el_parent
1005					.attr( 'class', 'vjg' )
1006//						.addClass( 'vjg_loading' )
1007					.css({
1008						position: 'absolute',
1009						top: 0,
1010						left: 0,
1011						height: vjg_settings[identifier]._el_parent.css( 'height' ),
1012						width: vjg_settings[identifier]._children_width,
1013						whiteSpace: 'nowrap'
1014					});
1015
1016				vjg_settings[identifier]._el_parent
1017					.wrap( vjg_settings[identifier]._el_parent_outer )
1018					.parent()
1019					.append( vjg_settings[identifier]._el_pause );
1020			break;
1021			
1022			default:
1023				vjg_settings[identifier]._el_parent.css( 'position', 'relative' )
1024					.addClass( 'vjg vjg_loading' )
1025					.css( 'overflow', 'hidden' )
1026					.append( vjg_settings[identifier]._el_pause )
1027					.unbind( 'mouseenter' )
1028					.bind( 'mouseenter', function(){
1029						jQuery( this ).addClass( 'hover' );
1030						vjg.parent_pause( identifier, true, function(){
1031							vjg.interval_stop( identifier );
1032						});
1033					})
1034					.unbind( 'mouseleave' )
1035					.bind( 'mouseleave', function(){
1036						jQuery( this ).removeClass( 'hover' );
1037						vjg.parent_pause( identifier, false, function(){
1038							vjg.interval_start( identifier );
1039						});
1040					});
1041			break;
1042		}
1043		
1044		if ( vjg_settings[identifier].overlay ) {
1045			vjg.parent_overlay_init( identifier );
1046		}
1047	}
1048	
1049	vjg.scroll_elements_init = function( identifier ) {
1050		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'scroll_elements_init( ' + identifier + ' );');
1051
1052		if ( vjg_settings[identifier].scrollable !== false ) {
1053			jQuery( vjg_settings[identifier].scrollable.next )
1054				.attr( 'vjg', identifier )
1055				.bind( 'click', function(){
1056					return false;
1057				})
1058				.unbind( 'mouselaeve' )
1059				.bind( 'mouseleave', function(){
1060					jQuery( this ).removeClass( 'hover' );
1061					
1062					if ( typeof vjg_settings[identifier].scrollable.type == 'undefined' ) {
1063						vjg_settings[identifier]._el_parent.stop();
1064					}
1065					else {
1066						for( var i = 0; i < vjg_settings[identifier]._children_info.length; i++ ) {
1067							if ( vjg_settings[identifier]._children_info[i].left >= Math.abs( parseInt( vjg_settings[identifier]._el_parent.css( 'left' ) ) ) ) {
1068								vjg_settings[identifier]._child_current = i;
1069								break;
1070							}
1071						}
1072						
1073						var left = vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left;
1074						var left_max = ( parseInt( vjg_settings[identifier]._el_parent.css( 'width' ) ) - parseInt( vjg_settings[identifier]._el_parent.css( 'width' ) ) );
1075						
1076						if ( vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left > left_max ) {
1077							left = left_max;
1078						}
1079
1080						vjg_settings[identifier]._el_parent.stop().animate( { left: '-' + left }, { queue: false } );
1081					}
1082
1083					vjg.scroller_scroll_to( identifier, vjg_settings[identifier]._child_current );
1084					vjg.interval_start( identifier );
1085				})
1086				.unbind( 'mouseenter' )
1087				.bind( 'mouseenter', function(){
1088					jQuery( this ).addClass( 'hover' );
1089					vjg.interval_stop( identifier );
1090
1091					switch( vjg_settings[identifier].view ) {
1092						case 'single':
1093							var speed = parseInt( vjg_settings[identifier]._el_parent.css( 'width' ), 10 );
1094							speed -= Math.abs( parseInt( vjg_settings[identifier]._el_parent.css( 'left' ), 10 ) );
1095							speed = speed * vjg_settings[identifier]._scroll_speed_multiplier;
1096							
1097							vjg_settings[identifier]._el_parent.animate( { left: '-' + vjg_settings[identifier]._children_info[vjg_settings[identifier]._children_info.length - 1].left }, { queue: false, duration: speed } );
1098						break;
1099						
1100						default:
1101							var speed = left = ( parseInt( vjg_settings[identifier]._el_parent.css( 'width' ), 10 ) - parseInt( vjg_settings[identifier]._el_parent.parent().width(), 10 ) );
1102							speed -= Math.abs( parseInt( vjg_settings[identifier]._el_parent.css( 'left' ) ) );
1103							speed = speed * vjg_settings[identifier]._scroll_speed_multiplier;
1104					
1105							vjg_settings[identifier]._el_parent.animate( { left: '-' + Math.abs( left ) }, { queue: false, duration: speed } );
1106						break;
1107					}
1108				});
1109
1110			jQuery( vjg_settings[identifier].scrollable.prev )
1111				.bind( 'click', function(){
1112					return false;
1113				})
1114				.unbind( 'mouseleave' )
1115				.bind( 'mouseleave', function(){
1116					jQuery( this ).removeClass( 'hover' );
1117					if ( typeof vjg_settings[identifier].scrollable.type == 'undefined' ) {
1118						vjg_settings[identifier]._el_parent.stop();
1119					}
1120					else {
1121						for( var i = ( vjg_settings[identifier]._children_info.length - 1 ); i >= 0; i-- ) {
1122							if ( vjg_settings[identifier]._children_info[i].left <= Math.abs( parseInt( vjg_settings[identifier]._el_parent.css( 'left' ), 10 ) ) ) {
1123								vjg_settings[identifier]._child_current = i;
1124								break;
1125							}
1126						}
1127
1128						vjg_settings[identifier]._el_parent.stop().animate( { left: '-' + vjg_settings[identifier]._children_info[vjg_settings[identifier]._child_current].left }, { queue: false } );
1129					}
1130
1131					vjg.scroller_scroll_to( identifier, vjg_settings[identifier]._child_current );
1132					vjg.interval_start( identifier );
1133				})
1134				.unbind( 'mouseenter' )
1135				.bind( 'mouseenter', function(){
1136					jQuery( this ).addClass( 'hover' );
1137					vjg.interval_stop( identifier );
1138					
1139					var speed = Math.abs( parseInt( vjg_settings[identifier]._el_parent.css( 'left' ) ) );
1140					speed = speed * vjg_settings[identifier]._scroll_speed_multiplier;
1141					
1142					vjg_settings[identifier]._el_parent.animate({left: '0' }, speed );
1143				});
1144		}
1145		
1146		if ( vjg_settings[identifier].scroller.container !== false ) {
1147			jQuery( vjg_settings[identifier].scroller.container )
1148				.attr( 'vjg', identifier )
1149				.unbind( 'mouseenter' )
1150				.bind( 'mouseenter', function(){
1151					jQuery( this ).addClass( 'hover' );
1152					vjg.interval_stop( identifier );
1153					vjg.parent_pause( identifier, true, false );
1154				})
1155				.unbind( 'mouseleave' )
1156				.bind( 'mouseleave', function(){
1157					jQuery( this ).removeClass( 'hover' );
1158					vjg.parent_pause( identifier, false, function(){
1159						vjg.interval_start( identifier );
1160					});
1161				});
1162			
1163			if ( typeof vjg_settings[identifier].scroller.prev == 'string' ) {
1164				jQuery( vjg_settings[identifier].scroller.prev )
1165					.attr( 'vjg', identifier )
1166					.bind( 'click', function(){
1167						return false;
1168					})
1169					.unbind( 'mouseenter' )
1170					.bind( 'mouseenter', function(){
1171						var identifier = jQuery( this ).addClass( 'hover' ).attr( 'vjg' );
1172
1173						if ( vjg_settings[identifier]._scroller_inner.width() < parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ), 10 ) ) {
1174							return false;
1175						}
1176						
1177						vjg.parent_stop( identifier, true );
1178
1179						var speed = Math.abs( parseInt( vjg_settings[identifier]._scroller_inner.css( 'left' ) ) );
1180						speed = speed * vjg_settings[identifier]._scroll_speed_multiplier;
1181					
1182						vjg_settings[identifier]._scroller_inner.animate({left: '0' }, speed, 'linear' );
1183					})
1184					.unbind( 'mouseleave' )
1185					.bind( 'mouseleave', function(){
1186						var identifier = jQuery( this ).removeClass( 'hover' ).attr( 'vjg' );
1187
1188						if ( vjg_settings[identifier]._scroller_inner.width() < parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ), 10 ) ) {
1189							return false;
1190						}
1191						
1192						vjg_settings[identifier]._scroller_inner.stop();
1193						
1194						vjg.parent_stop( identifier, false, function(){
1195							vjg.interval_start( identifier );
1196						});
1197					});
1198			}
1199
1200			if ( typeof vjg_settings[identifier].scroller.next == 'string' ) {
1201				jQuery( vjg_settings[identifier].scroller.next )
1202					.attr( 'vjg', identifier )
1203					.bind( 'click', function(){
1204						return false;
1205					})
1206					.unbind( 'mouseleave' )
1207					.bind( 'mouseleave', function(){
1208						var identifier = jQuery( this ).removeClass( 'hover' ).attr( 'vjg' );
1209
1210						if ( vjg_settings[identifier]._scroller_inner.width() < parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ), 10 ) ) {
1211							return false;
1212						}
1213						
1214						vjg_settings[identifier]._scroller_inner.stop();
1215						
1216						vjg.parent_stop( identifier, false, function(){
1217							vjg.interval_start( identifier );
1218						});
1219					})
1220					.unbind( 'mouseenter' )
1221					.bind( 'mouseenter', function(){
1222						var identifier = jQuery( this ).addClass( 'hover' ).attr( 'vjg' );
1223						
1224						if ( vjg_settings[identifier]._scroller_inner.width() < parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ), 10 ) ) {
1225							return false;
1226						}
1227						
1228						vjg.parent_stop( identifier, true );
1229						vjg.interval_stop( identifier );
1230						
1231						var speed = ( parseInt( vjg_settings[identifier]._scroller_inner.width() ) - parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ) ) );
1232						var left = ( parseInt( vjg_settings[identifier]._scroller_inner.width() ) - parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ) ) );
1233						
1234						if ( isNaN( speed ) ) {
1235							speed = ( parseInt( vjg_settings[identifier]._scroller_inner.width(), 10 ) - parseInt( vjg_settings[identifier]._scroller_inner.parent().width(), 10 ) );
1236						}
1237
1238						if ( isNaN( left ) ) {
1239							left = ( parseInt( vjg_settings[identifier]._scroller_inner.width() ) - parseInt( vjg_settings[identifier]._scroller_inner.parent().width(), 10 ) );
1240						}
1241
1242						speed -= Math.abs( parseInt( vjg_settings[identifier]._scroller_inner.css( 'left' ) ) );
1243						speed = speed * vjg_settings[identifier]._scroll_speed_multiplier;
1244						left -= ( parseInt( vjg_settings[identifier]._scroller_inner.css( 'left' ) ) * -1 );
1245						
1246						if ( isFinite( left ) && isFinite( speed ) ) {
1247							vjg_settings[identifier]._scroller_inner.animate({left: '-=' + left }, speed, 'linear' );
1248						}
1249					});
1250			}
1251		}
1252	}
1253	
1254	vjg.scroll_to_next = function( identifier ) {
1255		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'scroll_to_next( ' + identifier + ' );');
1256		
1257		var left = parseInt( vjg_settings[identifier]._el_parent.css( 'left' ) ) * -1;
1258		
1259		for( var i = ( vjg_settings[identifier]._children_info.length - 1 ); i >= 0; i-- ) {
1260			if ( vjg_settings[identifier]._children_info[i].left > left ) continue;
1261			
1262			vjg_settings[identifier]._child_current = i;
1263			return i;
1264		}
1265	}
1266	
1267	vjg.parent_pause = function( identifier, pause, fn ) {
1268		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'parent_pause( ' + identifier + ', ' + pause + ', ' + fn + ');', 2 );
1269		
1270		if ( vjg_settings[identifier].pause != 'mouseenter' ) {
1271			return;
1272		}
1273		
1274		if ( typeof pause_timer != 'undefined' ) {
1275			window.clearTimeout( pause_timer );
1276		}
1277
1278		if ( vjg_settings[identifier]._stopped ) {
1279			return;
1280		}
1281		
1282		if ( pause ) {
1283			vjg_settings[identifier]._paused = true;
1284
1285			if ( typeof fn == 'function' ) {
1286				fn();
1287			}
1288		}
1289		else {
1290			vjg_settings[identifier]._paused = false;
1291			
1292			var pause_timer = window.setTimeout( function(){
1293				if ( typeof fn == 'function' ) {
1294					fn( identifier );
1295				}
1296			}, 750 );
1297		}
1298	}
1299	
1300	vjg.parent_stop = function( identifier, stop, fn ) {
1301		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'parent_stop( ' + identifier + ', ' + stop + ', ' + fn + ');', 2 );
1302		
1303		vjg_settings[identifier]._stopped = stop;
1304		vjg.parent_pause( identifier, stop, fn );
1305	}
1306	
1307	vjg.scroller_init = function( identifier, reinit ) {
1308		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'scroller_init( ' + identifier + ', ' + reinit + ' );');
1309		
1310		if ( !vjg_settings[identifier].scroller || !vjg_settings[identifier].scroller.container ) return;
1311	
1312		if ( !reinit || vjg_settings[identifier]._el_scroller == false ) {
1313			vjg_settings[identifier]._el_scroller = jQuery( document.createElement( 'div' ) )
1314				.attr( 'class' , vjg_settings[identifier].scroller.container.attr( 'class' ) )
1315				.attr( 'vjg', identifier )
1316				.addClass( 'vjg_scroller' )
1317				.height( vjg_settings[identifier].scroller.container.css( 'height' ) )
1318				.width( vjg_settings[identifier].scroller.container.css( 'width' ) )
1319				.css( 'position', 'relative' )
1320				.css( 'overflow', 'hidden' );
1321			
1322			vjg_settings[identifier].scroller.container.wrap( vjg_settings[identifier]._el_scroller )
1323		}
1324
1325		if ( !reinit || vjg_settings[identifier]._scroller_inner == false ) {
1326			vjg_settings[identifier]._scroller_inner = vjg_settings[identifier].scroller.container;
1327
1328			vjg_settings[identifier]._scroller_inner
1329				.attr( 'class' , '' )
1330				.attr( 'vjg', identifier )
1331				.css( 'position', 'absolute' )
1332				.css( 'top', '0px' )
1333				.css( 'left', '0px' )
1334				.css( 'width', 'auto' )
1335				.css( 'white-space', 'nowrap' );
1336		}
1337
1338		if ( vjg_settings[identifier]._scroller_inner.children().size() == vjg_settings[identifier]._children.size() ) {
1339			var thumb = false;
1340			
1341			vjg_settings[identifier]._scroller_inner.children().each(function( i ){
1342				thumb = vjg_settings[identifier]._thumbs[i] = jQuery( this ).attr( 'vjg', identifier );
1343				
1344				if ( !vjg_settings[identifier]._thumbs_info[i] ) {
1345					thumb
1346						.css( 'display', 'inline' )
1347						.bind( 'click', function(){
1348							vjg.jumpto( jQuery( this ).attr( 'vjg' ), i );
1349							return false;
1350						});
1351				}
1352				
1353				if ( thumb[0].complete ) {
1354					vjg_settings[identifier]._thumbs_info[i] = {
1355						width: vjg_settings[identifier]._thumbs[i].outerWidth( true ),
1356						left: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ),
1357						right: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ) + vjg_settings[identifier]._thumbs[i].outerWidth( true )
1358					};
1359
1360					if ( vjg_settings[identifier]._thumbs_info.length == vjg_settings[identifier]._children.length ) {
1361						vjg_settings[identifier]._scroller_inner.children().each(function( j ){
1362							vjg_settings[identifier]._thumbs_info[j] = {
1363								width: vjg_settings[identifier]._thumbs[j].outerWidth( true ),
1364								left: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ),
1365								right: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ) + vjg_settings[identifier]._thumbs[j].outerWidth( true )
1366							};
1367						});
1368						
1369						vjg_settings[identifier]._scroller_inner.width( vjg_settings[identifier]._thumbs_info[vjg_settings[identifier]._thumbs_info.length - 1].right );
1370					}
1371				}
1372				else {
1373					thumb.load(function(){
1374						vjg_settings[identifier]._thumbs_info[i] = {
1375								width: vjg_settings[identifier]._thumbs[i].outerWidth( true ),
1376								left: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ),
1377								right: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ) + vjg_settings[identifier]._thumbs[i].outerWidth( true )
1378							};
1379
1380						if ( vjg_settings[identifier]._thumbs_info.length == vjg_settings[identifier]._children.length ) {
1381							vjg_settings[identifier]._scroller_inner.children().each(function( j ){
1382								if ( typeof vjg_settings[identifier]._thumbs[j] != 'undefined' ) {
1383									vjg_settings[identifier]._thumbs_info[j] = {
1384										width: vjg_settings[identifier]._thumbs[j].outerWidth( true ),
1385										left: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ),
1386										right: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ) + vjg_settings[identifier]._thumbs[j].outerWidth( true )
1387									};
1388								}
1389							});
1390
1391							vjg_settings[identifier]._scroller_inner.width( vjg_settings[identifier]._thumbs_info[vjg_settings[identifier]._thumbs_info.length - 1].right );
1392						}
1393					});
1394				}
1395			});
1396			
1397			return;
1398		}
1399		
1400		if ( typeof vjg_settings[identifier].scroller.resize == 'string' ) {
1401			var parts = vjg_settings[identifier].scroller.resize.split( 'x' );
1402
1403			if ( parts[0] > 0 ) {
1404				var height = parseInt( parts[0] );
1405			}
1406			
1407			if ( parts[1] > 0 ) {
1408				var width = parseInt( parts[1] );
1409			}
1410		}
1411
1412		vjg_settings[identifier]._children.each(function( i ){
1413			if ( typeof vjg_settings[identifier]._thumbs[i] == 'object' && vjg_settings[identifier]._thumbs[i].complete === false || !vjg_settings[identifier]._children.eq( i ).attr( 'thumb' ) ) {
1414				return;
1415			}
1416			
1417			if ( vjg_settings[identifier]._children.eq( i ).attr( 'thumb' ).indexOf( '<' ) != -1 ) {
1418				var thumb = vjg_settings[identifier]._thumbs[i] = jQuery( vjg_settings[identifier]._children.eq( i ).attr( 'thumb' ) )
1419					.attr( 'vjg', identifier )
1420					.bind( 'click', function(){
1421						vjg.jumpto( jQuery( this ).attr( 'vjg' ), i );
1422						return false;
1423					})
1424
1425				vjg_settings[identifier]._thumbs_info[i] = {
1426					width: vjg_settings[identifier]._thumbs.eq( i ).outerWidth( true ),
1427					left: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ),
1428					right: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ) + vjg_settings[identifier]._thumbs.eq( i ).outerWidth( true )
1429				};
1430				
1431				if ( vjg_settings[identifier]._thumbs_info.length == vjg_settings[identifier]._children.length ) {
1432					jQuery( vjg_settings[identifier]._thumbs ).each(function( j ){
1433						vjg_settings[identifier]._thumbs_info[j] = {
1434							width: vjg_settings[identifier]._thumbs.eq( j ).outerWidth( true ),
1435							left: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ),
1436							right: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ) + jQuery( vjg_settings[identifier]._thumbs[j] ).outerWidth( true )
1437						};
1438					});
1439				}
1440			}
1441			else {
1442				var thumb = vjg_settings[identifier]._thumbs[i] = jQuery( document.createElement('img') )
1443					.attr( 'vjg', identifier )
1444					.attr( 'src', vjg_settings[identifier]._children.eq( i ).attr( 'thumb' ) )
1445					.bind( 'click', function(){
1446						vjg.jumpto( jQuery( this ).attr( 'vjg' ), i );
1447						return false;
1448					})
1449					.load( function(){
1450						vjg_settings[identifier]._thumbs_info[i] = {
1451							width: vjg_settings[identifier]._thumbs.eq( i ).outerWidth( true ),
1452							left: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ),
1453							right: ( i > 0 && typeof vjg_settings[identifier]._thumbs_info[i-1] != 'undefined' ? vjg_settings[identifier]._thumbs_info[i-1].right : 0 ) + vjg_settings[identifier]._thumbs.eq( i ).outerWidth( true )
1454						};
1455						
1456						if ( vjg_settings[identifier]._thumbs_info.length == vjg_settings[identifier]._children.length ) {
1457							jQuery( vjg_settings[identifier]._thumbs ).each(function( j ){
1458								vjg_settings[identifier]._thumbs_info[j] = {
1459									width: vjg_settings[identifier]._thumbs.eq( j ).outerWidth( true ),
1460									left: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ),
1461									right: ( j == 0 ? 0 : vjg_settings[identifier]._thumbs_info[j-1].right ) + jQuery( vjg_settings[identifier]._thumbs[j] ).outerWidth( true )
1462								};
1463							});
1464						}
1465					});
1466			}
1467			
1468			if ( i == 0 ) {
1469				thumb.addClass( 'first current' );
1470			}
1471			
1472			if ( i == ( vjg_settings[identifier]._children.size() - 1 ) ) {
1473				vjg_settings[identifier]._scroller_inner.children().removeClass( 'last' );
1474				thumb.addClass( 'last' );
1475			}
1476
1477			
1478			if ( i == vjg_settings[identifier]._scroller_inner.children().length ) {
1479				vjg_settings[identifier]._scroller_inner.append( thumb );
1480			}
1481			
1482			return;
1483		});
1484	}
1485	
1486	vjg.scroller_scroll_to = function( identifier, index ) {
1487		if ( vjg.debug ) console.debug( identifier, vjg_settings[identifier], 'scroller_scroll_to( ' + identifier + ', ' + index + ' );');
1488
1489		if ( !vjg_settings[identifier].scroller || !vjg_settings[identifier].scroller.container || !vjg_settings[identifier]._scroller_inner ) {
1490			return false;
1491		}
1492
1493		if ( vjg_settings[identifier].scroller.container !== false ) {
1494			vjg_settings[identifier]._scroller_inner
1495				.children()
1496				.removeClass( 'current' )
1497				.eq( index )
1498				.addClass( 'current' );
1499		}
1500
1501		if ( vjg_settings[identifier]._scroller_inner.width() < parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ), 10 ) ) {
1502			vjg_settings[identifier].scroller.autoscroll = false;
1503			return false;
1504		}
1505		
1506		if ( !!vjg_settings[identifier].scroller.autoscroll ) {
1507			return false;
1508		}
1509
1510		if ( index == 0 ) {
1511			vjg_settings[identifier]._scroller_inner.animate( { left: 0 }, { queue: false, duration: vjg_settings[identifier].speed } );
1512		}
1513		else if ( index == ( vjg_settings[identifier]._children.length - 1 ) ) {
1514			var pos = vjg_settings[identifier]._scroller_inner.width() - parseInt( vjg_settings[identifier]._el_scroller.width() );
1515			pos = Math.round( pos );
1516			pos = pos * -1;
1517			
1518			var left_max = parseInt( vjg_settings[identifier]._scroller_inner.width() ) - parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ) );
1519			left_max = Math.abs( left_max );
1520			
1521			if ( Math.abs( pos ) > left_max ) {
1522				pos = left_max;
1523			}
1524
1525			vjg_settings[identifier]._scroller_inner.animate( { left: '-' + pos }, { queue: false, duration: vjg_settings[identifier].speed } );
1526		}
1527		else {
1528			var half = vjg_settings[identifier]._el_scroller.width() / 2;
1529			
1530			if ( vjg_settings[identifier]._thumbs_info[index] && parseInt( vjg_settings[identifier]._thumbs_info[index].left, 10 ) > half ) {
1531				var pos = parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ) ) - vjg_settings[identifier]._thumbs_info[index].width;
1532				pos = pos / 2;
1533				pos = ( vjg_settings[identifier]._thumbs_info[index].left - pos ) * -1;
1534				
1535				if( pos > 0 ) {
1536					pos = 0;
1537				}
1538				
1539				var left_max = parseInt( vjg_settings[identifier]._scroller_inner.width() ) - parseInt( vjg_settings[identifier]._el_scroller.css( 'width' ) );
1540
1541				if ( Math.abs( pos ) > left_max ) {
1542					pos = left_max * -1;
1543				}
1544
1545				if ( isFinite( pos  ) ) {
1546					vjg_settings[identifier]._scroller_inner.animate( { left: pos }, { queue: false, duration: vjg_settings[identifier].speed } );
1547				}
1548			}
1549		}
1550	}
1551}
1552
1553(function(jQuery) {
1554	jQuery.fn.vjg = function( options ) {
1555		var version = '2.1';
1556		
1557		var identifier = window.vjg_settings.length,
1558			defaults = {
1559				container:		false,
1560				autostart:		true,
1561				lightbox:		true,// 'Highslide', 'Lytebox'
1562				overlay:		false,
1563				overlay_container:			false,
1564				resize:			false,
1565				view:			'single',// multi, single
1566				effect:			'fade',// 'effect1 [,effect2]', effects can be false, fade or slide (dev: move, space). effect2 is used by clicking on a thumbnail
1567				timeout:		4000,
1568				pause:			'mouseenter',
1569				children:		false,// false, object, selector
1570				links:			false,
1571				scrollable:		false,
1572				scroller: {
1573					autoscroll:	true,
1574					container:	false
1575				},
1576				offset:			'1px',
1577				debug:			false
1578			};
1579		
1580		if ( options ) {
1581			vjg_settings[identifier] = jQuery.extend( true, defaults, options );
1582		}
1583		
1584		vjg_settings[identifier]._el_parent = jQuery( this ).attr( 'vjg', identifier );
1585		vjg_settings[identifier]._el_parent_outer = false;
1586		vjg_settings[identifier]._el_pause = false;
1587		vjg_settings[identifier]._paused = false;
1588		vjg_settings[identifier]._child_current = 0;
1589		vjg_settings[identifier]._children = false;
1590		vjg_settings[identifier]._children_object = false;
1591		vjg_settings[identifier]._children_timer = false;
1592		vjg_settings[identifier]._children_info = new Array();
1593		vjg_settings[identifier]._children_width = 0;
1594		vjg_settings[identifier]._interval_timer = false;
1595		vjg_settings[identifier]._el_scroller = false;
1596		vjg_settings[identifier]._el_overlay = false;
1597		vjg_settings[identifier]._scroller_inner = false;
1598		vjg_settings[identifier]._scroll_speed_multiplier = 6.5;// the bigger, the slower :)
1599		vjg_settings[identifier]._stopped = false;
1600		vjg_settings[identifier]._thumbs = jQuery(new Array());
1601		vjg_settings[identifier]._thumbs_info = new Array();
1602
1603		if ( window.console && window.console.info ) {
1604			console.info( 'vioma jQuery gallery ' );
1605			console.info( 'Version ' + version );
1606		}
1607		
1608		this.each(function() {
1609			vjg_settings[identifier].effect = vjg_settings[identifier].effect.toString();
1610			vjg_settings[identifier].effect = ( vjg_settings[identifier].effect.indexOf( ',' ) != -1 ? vjg_settings[identifier].effect.split( ',' ) : new Array( vjg_settings[identifier].effect, null ) );
1611			vjg_settings[identifier].container = jQuery( vjg_settings[identifier].container || vjg_settings[identifier]._el_parent );
1612
1613			if ( vjg_settings[identifier].scroller.container !== false ) {
1614				vjg_settings[identifier].scroller.container = jQuery( vjg_settings[identifier].scroller.container );
1615			}
1616			
1617			if ( vjg_settings[identifier].scrollable !== false ) {
1618				vjg_settings[identifier].effect[0] = 'slide';
1619			}
1620			 
1621	//		if ( vjg_settings[identifier].debug ) vjg_settings[identifier].effect[0] = 'accordion';
1622			
1623			if ( vjg_settings[identifier].effect[0] == 'move' ) {
1624				vjg_settings[identifier].timeout = 0;
1625			}
1626	
1627			if ( vjg_settings[identifier].children !== false && vjg_settings[identifier].children.length == 1 ) {
1628				vjg_settings[identifier].autostart = false;
1629			}
1630	
1631			vjg.start( identifier );
1632		});
1633		
1634		return this;
1635	};
1636})(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.