PageSourceSearch

https://www.selcus.com/modules/leosliderlayer/js/jquery.themepunch.revolution.js

js selcus.com collected 2026-10-08 20:56:53 UTC 211,761 bytes, 6,229 lines download raw bytes

1/**************************************************************************
2 * jquery.themepunch.revolution.js - jQuery Plugin for Revolution Slider
3 * @version: 4.6.0 (18.08.2013)
4 * @requires jQuery v1.7 or later (tested on 1.9)
5 * @author ThemePunch
6 * Dual licensed under the MIT or GPL Version 2 licenses.
7**************************************************************************/
8
9
10(function(jQuery,undefined){
11
12
13
14
15	////////////////////////////////////////
16	// THE REVOLUTION PLUGIN STARTS HERE //
17	///////////////////////////////////////
18
19	jQuery.fn.extend({
20
21		// OUR PLUGIN HERE :)
22		revolution: function(options) {
23
24
25
26				////////////////////////////////
27				// SET DEFAULT VALUES OF ITEM //
28				////////////////////////////////
29				defaults = {
30					delay:9000,
31					startheight:500,
32					startwidth:960,
33					fullScreenAlignForce:"off",
34					autoHeight:"off",
35					hideTimerBar:"off",
36					hideThumbs:200,
37					hideNavDelayOnMobile:1500,
38
39					thumbWidth:100,							// Thumb With and Height and Amount (only if navigation Tyope set to thumb !)
40					thumbHeight:50,
41					thumbAmount:3,
42
43					navigationType:"bullet",				// bullet, thumb, none
44					navigationArrows:"solo",				// nextto, solo, none
45					navigationInGrid:"off",					// on/off
46
47					hideThumbsOnMobile:"off",
48					hideBulletsOnMobile:"off",
49					hideArrowsOnMobile:"off",
50					hideThumbsUnderResoluition:0,
51
52					navigationStyle:"round",				// round,square,navbar,round-old,square-old,navbar-old, or any from the list in the docu (choose between 50+ different item),
53
54					navigationHAlign:"center",				// Vertical Align top,center,bottom
55					navigationVAlign:"bottom",				// Horizontal Align left,center,right
56					navigationHOffset:0,
57					navigationVOffset:20,
58
59					soloArrowLeftHalign:"left",
60					soloArrowLeftValign:"center",
61					soloArrowLeftHOffset:20,
62					soloArrowLeftVOffset:0,
63
64					soloArrowRightHalign:"right",
65					soloArrowRightValign:"center",
66					soloArrowRightHOffset:20,
67					soloArrowRightVOffset:0,
68
69					keyboardNavigation:"on",
70
71					touchenabled:"on",						// Enable Swipe Function : on/off
72					onHoverStop:"on",						// Stop Banner Timet at Hover on Slide on/off
73
74
75					stopAtSlide:-1,							// Stop Timer if Slide "x" has been Reached. If stopAfterLoops set to 0, then it stops already in the first Loop at slide X which defined. -1 means do not stop at any slide. stopAfterLoops has no sinn in this case.
76					stopAfterLoops:-1,						// Stop Timer if All slides has been played "x" times. IT will stop at THe slide which is defined via stopAtSlide:x, if set to -1 slide never stop automatic
77
78					hideCaptionAtLimit:0,					// It Defines if a caption should be shown under a Screen Resolution ( Basod on The Width of Browser)
79					hideAllCaptionAtLimit:0,				// Hide all The Captions if Width of Browser is less then this value
80					hideSliderAtLimit:0,					// Hide the whole slider, and stop also functions if Width of Browser is less than this value
81
82					shadow:0,								//0 = no Shadow, 1,2,3 = 3 Different Art of Shadows  (No Shadow in Fullwidth Version !)
83					fullWidth:"off",						// Turns On or Off the Fullwidth Image Centering in FullWidth Modus
84					fullScreen:"off",
85					minFullScreenHeight:0,					// The Minimum FullScreen Height
86					fullScreenOffsetContainer:"",			// Size for FullScreen Slider minimising Calculated on the Container sizes
87					fullScreenOffset:"0",					// Size for FullScreen Slider minimising
88					dottedOverlay:"none",					//twoxtwo, threexthree, twoxtwowhite, threexthreewhite
89
90					forceFullWidth:"off",						// Force The FullWidth
91
92					spinner:"spinner0",
93
94					swipe_treshold : 75,					// The number of pixels that the user must move their finger by before it is considered a swipe.
95					swipe_min_touches : 1,					// Min Finger (touch) used for swipe
96					drag_block_vertical:false,				// Prevent Vertical Scroll during Swipe
97					isJoomla:false,
98					parallax:"off",
99					parallaxLevels: [10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85],
100					parallaxBgFreeze: "off",
101					parallaxOpacity:"on",
102					parallaxDisableOnMobile:"off",
103					panZoomDisableOnMobile:"off",
104					simplifyAll:"on",
105					minHeight:0,
106					nextSlideOnWindowFocus:"off"
107
108
109				};
110
111					options = jQuery.extend({}, defaults, options);
112
113					return this.each(function() {
114
115						// REPORT SOME IMPORTAN INFORMATION ABOUT THE SLIDER
116						if (window.tplogs==true)
117						 try{
118								//console.groupCollapsed("Slider Revolution 4.6.0 Initialisation on "+jQuery(this).attr('id'));
119								//console.groupCollapsed("Used Options:");
120								//console.info(options);
121								//console.groupEnd();
122								//console.groupCollapsed("Tween Engine:")
123							} catch(e) {}
124
125						// CHECK IF TweenLite IS LOADED AT ALL
126						if (punchgs.TweenLite==undefined) {
127						   if (window.tplogs==true)
128						    try{ console.error("GreenSock Engine Does not Exist!");
129						    } catch(e) {}
130							return false;
131						}
132
133						punchgs.force3D = true;
134
135						if (window.tplogs==true)
136							try{ //console.info("GreenSock Engine Version in Slider Revolution:"+punchgs.TweenLite.version);
137							} catch(e) {
138
139							}
140
141						if (options.simplifyAll=="on") {
142
143						} else {
144							punchgs.TweenLite.lagSmoothing(1000,16);
145							punchgs.force3D = "true";
146						}
147						
148						if (window.tplogs==true)
149							try{
150								console.groupEnd();
151								console.groupEnd();
152							} catch(e) {}
153
154
155						initSlider(jQuery(this),options)
156
157
158					})
159				},
160
161
162		// METHODE PAUSE
163		revscroll: function(oy) {
164					return this.each(function() {
165						var container=jQuery(this);
166						jQuery('body,html').animate(
167							{scrollTop:(container.offset().top+(container.find('>ul >li').height())-oy)+"px"},{duration:400});
168					})
169				},
170
171		// METHODE PAUSE
172		revredraw: function(oy) {
173					return this.each(function() {
174						var container=jQuery(this);
175						var bt = container.parent().find('.tp-bannertimer');
176						var opt = bt.data('opt');
177						containerResized(container,opt);
178
179					})
180				},
181
182		// METHODE PAUSE
183		revpause: function(options) {
184
185					return this.each(function() {
186						var container=jQuery(this);
187						container.data('conthover',1);
188						container.data('conthover-changed',1);
189						container.trigger('revolution.slide.onpause');
190						var bt = container.parent().find('.tp-bannertimer');
191						var opt = bt.data('opt');
192						opt.bannertimeronpause = true;
193						container.trigger('stoptimer');
194
195					})
196
197
198				},
199
200		// METHODE RESUME
201		revresume: function(options) {
202					return this.each(function() {
203						var container=jQuery(this);
204						container.data('conthover',0);
205						container.data('conthover-changed',1);
206						container.trigger('revolution.slide.onresume');
207						var bt = container.parent().find('.tp-bannertimer');
208						var opt = bt.data('opt');
209						opt.bannertimeronpause = false;
210						container.trigger('starttimer');
211
212					})
213
214				},
215
216		// METHODE NEXT
217		revnext: function(options) {
218					return this.each(function() {
219
220						// CATCH THE CONTAINER
221						var container=jQuery(this);
222						container.parent().find('.tp-rightarrow').click();
223
224
225					})
226
227				},
228
229		// METHODE RESUME
230		revprev: function(options) {
231					return this.each(function() {
232						// CATCH THE CONTAINER
233						var container=jQuery(this);
234						container.parent().find('.tp-leftarrow').click();
235					})
236
237				},
238
239		// METHODE LENGTH
240		revmaxslide: function(options) {
241						// CATCH THE CONTAINER
242						return jQuery(this).find('>ul:first-child >li').length;
243				},
244
245
246		// METHODE CURRENT
247		revcurrentslide: function(options) {
248						// CATCH THE CONTAINER
249						var container=jQuery(this);
250						var bt = container.parent().find('.tp-bannertimer');
251						var opt = bt.data('opt');
252						return opt.act;
253				},
254
255		// METHODE CURRENT
256		revlastslide: function(options) {
257						// CATCH THE CONTAINER
258						var container=jQuery(this);
259						var bt = container.parent().find('.tp-bannertimer');
260						var opt = bt.data('opt');
261						return opt.lastslide;
262				},
263
264
265		// METHODE JUMP TO SLIDE
266		revshowslide: function(slide) {
267					return this.each(function() {
268						// CATCH THE CONTAINER
269						var container=jQuery(this);
270						container.data('showus',slide);
271						container.parent().find('.tp-rightarrow').click();
272					})
273
274				}
275
276
277})
278		/*******************************************
279			-	IS IOS VERSION OLDER THAN 5 ??	-
280		*******************************************/
281
282		function iOSVersion() {
283			var oldios = false;
284			if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
285		        if (navigator.userAgent.match(/OS 4_\d like Mac OS X/i)) {
286		        	oldios = true;
287				}
288		    } else {
289				   oldios = false;
290		    }
291			return oldios;
292		}
293
294		function initSlider(container,opt) {
295
296						// PREPARE FALL BACK SETTINGS
297						if (opt.navigationStyle=="preview1" ||  opt.navigationStyle=="preview3" || opt.navigationStyle=="preview4") {
298									opt.soloArrowLeftHalign="left";
299									opt.soloArrowLeftValign="center";
300									opt.soloArrowLeftHOffset=0;
301									opt.soloArrowLeftVOffset=0;
302									opt.soloArrowRightHalign="right";
303									opt.soloArrowRightValign="center";
304									opt.soloArrowRightHOffset=0;
305									opt.soloArrowRightVOffset=0;
306									opt.navigationArrows="solo";
307						}
308
309
310						// SIMPLIFY ANIMATIONS ON OLD IOS AND IE8 IF NEEDED
311						if (opt.simplifyAll=="on" && (isIE(8) || iOSVersion())) {
312							container.find('.tp-caption').each(function() {
313								var tc = jQuery(this);
314								tc.removeClass("customin").removeClass("customout").addClass("fadein").addClass("fadeout");
315								tc.data('splitin',"");
316								tc.data('speed',400);
317							})
318							container.find('>ul>li').each(function() {
319								var li= jQuery(this);
320								li.data('transition',"fade");
321								li.data('masterspeed',500);
322								li.data('slotamount',1);
323								var img = li.find('>img').first();
324								img.data('kenburns',"off");
325							});
326						}
327
328
329
330
331
332						opt.desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i);
333
334						if (opt.fullWidth!="on" && opt.fullScreen!="on") opt.autoHeight = "off";
335						if (opt.fullScreen=="on") opt.autoHeight = "on";
336						if (opt.fullWidth!="on" && opt.fullScreen!="on") forceFulWidth="off";
337
338						if (opt.fullWidth=="on" && opt.autoHeight=="off")
339							container.css({maxHeight:opt.startheight+"px"});
340
341						if (is_mobile() && opt.hideThumbsOnMobile=="on" && opt.navigationType=="thumb")
342						   opt.navigationType = "none"
343
344						if (is_mobile() && opt.hideBulletsOnMobile=="on" && opt.navigationType=="bullet")
345						   opt.navigationType = "none"
346
347						if (is_mobile() && opt.hideBulletsOnMobile=="on" && opt.navigationType=="both")
348						   opt.navigationType = "none"
349
350						if (is_mobile() && opt.hideArrowsOnMobile=="on")
351						   opt.navigationArrows = "none"
352
353						if (opt.forceFullWidth=="on" && container.closest('.forcefullwidth_wrapper_tp_banner').length==0) {
354
355							var loff = container.parent().offset().left;
356							var mb = container.parent().css('marginBottom');
357							var mt = container.parent().css('marginTop');
358							if (mb==undefined) mb=0;
359							if (mt==undefined) mt=0;
360
361							container.parent().wrap('<div style="position:relative;width:100%;height:auto;margin-top:'+mt+';margin-bottom:'+mb+'" class="forcefullwidth_wrapper_tp_banner"></div>');
362							container.closest('.forcefullwidth_wrapper_tp_banner').append('<div class="tp-fullwidth-forcer" style="width:100%;height:'+container.height()+'px"></div>');
363							container.css({'backgroundColor':container.parent().css('backgroundColor'),'backgroundImage':container.parent().css('backgroundImage')});
364							//container.parent().css({'position':'absolute','width':jQuery(window).width()});
365							container.parent().css({'left':(0-loff)+"px",position:'absolute','width':jQuery(window).width()});
366							opt.width=jQuery(window).width();
367						}
368
369						// HIDE THUMBS UNDER RESOLUTION
370						try{
371							if (opt.hideThumbsUnderResolution>jQuery(window).width() && opt.hideThumbsUnderResolution!=0) {
372								container.parent().find('.tp-bullets.tp-thumbs').css({display:"none"});
373							} else {
374								container.parent().find('.tp-bullets.tp-thumbs').css({display:"block"});
375							}
376						} catch(e) {}
377
378						if (!container.hasClass("revslider-initialised")) {
379
380									container.addClass("revslider-initialised");
381									if (container.attr('id')==undefined) container.attr('id',"revslider-"+Math.round(Math.random()*1000+5));
382
383									// CHECK IF FIREFOX 13 IS ON WAY.. IT HAS A STRANGE BUG, CSS ANIMATE SHOULD NOT BE USED
384
385
386
387									opt.firefox13 = false;
388									opt.ie = !jQuery.support.opacity;
389									opt.ie9 = (document.documentMode == 9);
390
391									opt.origcd=opt.delay;
392
393									// CHECK THE jQUERY VERSION
394									var version = jQuery.fn.jquery.split('.'),
395										versionTop = parseFloat(version[0]),
396										versionMinor = parseFloat(version[1]),
397										versionIncrement = parseFloat(version[2] || '0');
398
399									if (versionTop==1 && versionMinor < 7) {
400										container.html('<div style="text-align:center; padding:40px 0px; font-size:20px; color:#992222;"> The Current Version of jQuery:'+version+' <br>Please update your jQuery Version to min. 1.7 in Case you wish to use the Revolution Slider Plugin</div>');
401									}
402
403									if (versionTop>1) opt.ie=false;
404
405
406									// Delegate .transition() calls to .animate()
407									// if the browser can't do CSS transitions.
408									if (!jQuery.support.transition)
409										jQuery.fn.transition = jQuery.fn.animate;
410
411									// CATCH THE CONTAINER
412
413
414									 // LOAD THE YOUTUBE API IF NECESSARY
415
416									container.find('.caption').each(function() { jQuery(this).addClass('tp-caption')});
417
418									if (is_mobile()) {
419										container.find('.tp-caption').each(function() {
420											var nextcaption = jQuery(this);
421											if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true")
422													nextcaption.data('autoplayonlyfirsttime',"false");
423											if (nextcaption.data('autoplay')==true || nextcaption.data('autoplay')=="true")
424												 nextcaption.data('autoplay',false);
425
426										})
427									}
428
429
430									var addedyt=0;
431									var addedvim=0;
432									var addedvid=0;
433									var httpprefix = "http";
434
435									if (location.protocol === 'https:') {
436											httpprefix = "https";
437									}
438									container.find('.tp-caption').each(function(i) {
439										// IF SRC EXIST, RESET SRC'S since WE DONT NEED THEM !!
440
441										try {
442
443												if ((jQuery(this).data('ytid')!=undefined  || jQuery(this).find('iframe').attr('src').toLowerCase().indexOf('youtube')>0) && addedyt==0) {
444													addedyt=1;
445													var s = document.createElement("script");
446													var httpprefix2 = "https";
447													s.src = httpprefix2+"://www.youtube.com/iframe_api"; /* Load Player API*/
448
449													var before = document.getElementsByTagName("script")[0];
450													var loadit = true;
451													jQuery('head').find('*').each(function(){
452														if (jQuery(this).attr('src') == httpprefix2+"://www.youtube.com/iframe_api")
453														   loadit = false;
454													});
455													if (loadit) {
456														before.parentNode.insertBefore(s, before);
457
458
459													}
460												}
461											} catch(e) {}
462
463										try{
464											   if ((jQuery(this).data('vimeoid')!=undefined || jQuery(this).find('iframe').attr('src').toLowerCase().indexOf('vimeo')>0) && addedvim==0) {
465													addedvim=1;
466													var f = document.createElement("script");
467													f.src = httpprefix+"://a.vimeocdn.com/js/froogaloop2.min.js"; /* Load Player API*/
468													var before = document.getElementsByTagName("script")[0];
469
470													var loadit = true;
471													jQuery('head').find('*').each(function(){
472														if (jQuery(this).attr('src') == httpprefix+"://a.vimeocdn.com/js/froogaloop2.min.js")
473														   loadit = false;
474													});
475													if (loadit)
476														before.parentNode.insertBefore(f, before);
477												}
478											} catch(e) {}
479
480										try{
481											if ((jQuery(this).data('videomp4')!=undefined || jQuery(this).data('videowebm')!=undefined))  {
482
483											}
484										} catch(e) {}
485									});
486
487
488
489
490									// REMOVE ANY VIDEO JS SETTINGS OF THE VIDEO  IF NEEDED
491									container.find('.tp-caption video').each(function(i) {
492										jQuery(this).removeClass("video-js").removeClass("vjs-default-skin");
493										jQuery(this).attr("preload","");
494										jQuery(this).css({display:"none"});
495									});
496
497									// SHUFFLE MODE
498									if (opt.shuffle=="on") {
499										var fsa = new Object,
500											fli = container.find('>ul:first-child >li:first-child')
501
502										fsa.fstransition = fli.data('fstransition');
503										fsa.fsmasterspeed = fli.data('fsmasterspeed');
504										fsa.fsslotamount = fli.data('fsslotamount');
505
506
507										for (var u=0;u<container.find('>ul:first-child >li').length;u++) {
508											var it = Math.round(Math.random()*container.find('>ul:first-child >li').length);
509											container.find('>ul:first-child >li:eq('+it+')').prependTo(container.find('>ul:first-child'));
510										}
511
512										var newfli = container.find('>ul:first-child >li:first-child');
513										 newfli.data('fstransition',fsa.fstransition);
514										 newfli.data('fsmasterspeed',fsa.fsmasterspeed);
515										 newfli.data('fsslotamount',fsa.fsslotamount);
516									}
517
518
519									// CREATE SOME DEFAULT OPTIONS FOR LATER
520									opt.slots=4;
521									opt.act=-1;
522									opt.next=0;
523
524									// IF START SLIDE IS SET
525									if (opt.startWithSlide !=undefined) opt.next=opt.startWithSlide;
526
527									// IF DEEPLINK HAS BEEN SET
528									var deeplink = getUrlVars("#")[0];
529									if (deeplink.length<9) {
530										if (deeplink.split('slide').length>1) {
531											var dslide=parseInt(deeplink.split('slide')[1],0);
532											if (dslide<1) dslide=1;
533											if (dslide>container.find('>ul:first >li').length) dslide=container.find('>ul:first >li').length;
534											opt.next=dslide-1;
535										}
536									}
537
538
539									opt.firststart=1;
540
541									// BASIC OFFSET POSITIONS OF THE BULLETS
542									if (opt.navigationHOffset==undefined) opt.navOffsetHorizontal=0;
543									if (opt.navigationVOffset==undefined) opt.navOffsetVertical=0;
544
545
546
547									container.append('<div class="tp-loader '+opt.spinner+'">'+
548												  		'<div class="dot1"></div>'+
549												  	    '<div class="dot2"></div>'+
550												  	    '<div class="bounce1"></div>'+
551														'<div class="bounce2"></div>'+
552														'<div class="bounce3"></div>'+
553													 '</div>');
554
555									// RESET THE TIMER
556									if (container.find('.tp-bannertimer').length==0) container.append('<div class="tp-bannertimer" style="visibility:hidden"></div>');
557									var bt=container.find('.tp-bannertimer');
558									if (bt.length>0) {
559										bt.css({'width':'0%'});
560									};
561
562
563									// WE NEED TO ADD A BASIC CLASS FOR SETTINGS.CSS
564									container.addClass("tp-simpleresponsive");
565									opt.container=container;
566
567									//if (container.height()==0) container.height(opt.startheight);
568
569									// AMOUNT OF THE SLIDES
570									opt.slideamount = container.find('>ul:first >li').length;
571
572
573									// A BASIC GRID MUST BE DEFINED. IF NO DEFAULT GRID EXIST THAN WE NEED A DEFAULT VALUE, ACTUAL SIZE OF CONAINER
574									if (container.height()==0) container.height(opt.startheight);
575									if (opt.startwidth==undefined || opt.startwidth==0) opt.startwidth=container.width();
576									if (opt.startheight==undefined || opt.startheight==0) opt.startheight=container.height();
577
578									// OPT WIDTH && HEIGHT SHOULD BE SET
579									opt.width=container.width();
580									opt.height=container.height();
581
582
583									// DEFAULT DEPENDECIES
584									opt.bw= opt.startwidth / container.width();
585									opt.bh = opt.startheight / container.height();
586
587									// IF THE ITEM ALREADY IN A RESIZED FORM
588									if (opt.width!=opt.startwidth) {
589
590										opt.height = Math.round(opt.startheight * (opt.width/opt.startwidth));
591
592										container.height(opt.height);
593
594									}
595
596									// LETS SEE IF THERE IS ANY SHADOW
597									if (opt.shadow!=0) {
598										container.parent().append('<div class="tp-bannershadow tp-shadow'+opt.shadow+'"></div>');
599										var loff=0;
600										if (opt.forceFullWidth=="on")
601													loff = 0-opt.container.parent().offset().left;
602										container.parent().find('.tp-bannershadow').css({'width':opt.width,'left':loff});
603									}
604
605
606									container.find('ul').css({'display':'none'});
607
608									var fliparent = container;
609
610
611									// PREPARE THE SLIDES
612									container.find('ul').css({'display':'block'});
613									prepareSlides(container,opt);
614									if (opt.parallax!="off") checkForParallax(container,opt);
615
616									// CREATE BULLETS
617									if (opt.slideamount >1) createBullets(container,opt);
618
619									if (opt.slideamount >1 && opt.navigationType=="thumb") createThumbs(container,opt);
620									if (opt.slideamount >1) createArrows(container,opt);
621									if (opt.keyboardNavigation=="on") createKeyboard(container,opt);
622
623
624									swipeAction(container,opt);
625									
626
627									if (opt.hideThumbs>0) hideThumbs(container,opt);
628
629									swapSlide(container,opt);
630									// START COUNTDOWN
631									if (opt.slideamount >1) countDown(container,opt);
632									setTimeout(function() {
633										container.trigger('revolution.slide.onloaded');
634									},500);
635
636
637
638									/******************************
639										-	FULLSCREEN CHANGE	-
640									********************************/
641									// FULLSCREEN MODE TESTING
642									jQuery("body").data('rs-fullScreenMode',false);
643									jQuery(window).on ('mozfullscreenchange webkitfullscreenchange fullscreenchange',function(){
644									     jQuery("body").data('rs-fullScreenMode',!jQuery("body").data('rs-fullScreenMode'));
645									     if (jQuery("body").data('rs-fullScreenMode')) {
646										     setTimeout(function() {
647										     	jQuery(window).trigger("resize");
648
649										     },200);
650									     }
651									})
652
653
654									// IF RESIZED, NEED TO STOP ACTUAL TRANSITION AND RESIZE ACTUAL IMAGES
655									jQuery(window).resize(function() {
656										if (jQuery('body').find(container)!=0)
657											if (opt.forceFullWidth=="on" ) {
658
659												var loff = opt.container.closest('.forcefullwidth_wrapper_tp_banner').offset().left;
660												//opt.container.parent().css({'width':jQuery(window).width()});
661												opt.container.parent().css({'left':(0-loff)+"px",'width':jQuery(window).width()});
662											}
663
664											if (container.outerWidth(true)!=opt.width || container.is(":hidden")) {
665													containerResized(container,opt);
666											}
667
668
669
670
671									});
672
673									// HIDE THUMBS UNDER SIZE...
674									try{
675										if (opt.hideThumbsUnderResoluition!=0 && opt.navigationType=="thumb") {
676											if (opt.hideThumbsUnderResoluition>jQuery(window).width())
677												jQuery('.tp-bullets').css({display:"none"});
678											 else
679											 	jQuery('.tp-bullets').css({display:"block"});
680										}
681									} catch(e) {}
682
683
684
685									// CHECK IF THE CAPTION IS A "SCROLL ME TO POSITION" CAPTION IS
686									//if (opt.fullScreen=="on") {
687										container.find('.tp-scrollbelowslider').on('click',function() {
688												var off=0;
689												try{
690												 	off = jQuery('body').find(opt.fullScreenOffsetContainer).height();
691												 } catch(e) {}
692												try{
693												 	off = off - parseInt(jQuery(this).data('scrolloffset'),0);
694												 } catch(e) {}
695
696
697												jQuery('body,html').animate(
698													{scrollTop:(container.offset().top+(container.find('>ul >li').height())-off)+"px"},{duration:400});
699											});
700									//}
701
702
703									// FIRST TIME STOP/START HIDE / SHOW SLIDER
704									//REMOVE AND SHOW SLIDER ON DEMAND
705									var contpar= container.parent();
706									if (jQuery(window).width()<opt.hideSliderAtLimit) {
707										container.trigger('stoptimer');
708										if (contpar.css('display')!="none")
709											contpar.data('olddisplay',contpar.css('display'));
710										contpar.css({display:"none"});
711									}
712
713									tabBlurringCheck(container,opt);
714
715						}
716
717	}
718
719
720
721/******************************
722	-	MODULES	-
723********************************/
724
725
726		/////////////////////////////////////////
727		// main visibility API function
728		// check if current tab is active or not
729		var vis = (function(){
730		    var stateKey,
731		        eventKey,
732		        keys = {
733		                hidden: "visibilitychange",
734		                webkitHidden: "webkitvisibilitychange",
735		                mozHidden: "mozvisibilitychange",
736		                msHidden: "msvisibilitychange"
737		    };
738		    for (stateKey in keys) {
739		        if (stateKey in document) {
740		            eventKey = keys[stateKey];
741		            break;
742		        }
743		    }
744		    return function(c) {
745		        if (c) document.addEventListener(eventKey, c);
746		        return !document[stateKey];
747		    }
748		})();
749
750		var tabBlurringCheck = function(container,opt) {
751
752			var notIE = (document.documentMode === undefined),
753			    isChromium = window.chrome;
754
755			if (notIE && !isChromium) {
756
757			    // checks for Firefox and other  NON IE Chrome versions
758			    jQuery(window).on("focusin", function () {
759
760			        setTimeout(function(){
761			            // TAB IS ACTIVE, WE CAN START ANY PART OF THE SLIDER
762			            if (opt.nextSlideOnWindowFocus=="on") container.revnext();
763			            container.revredraw();
764			        },300);
765
766			    }).on("focusout", function () {
767					// TAB IS NOT ACTIVE, WE CAN STOP ANY PART OF THE SLIDER
768			    });
769
770			} else {
771
772			    // checks for IE and Chromium versions
773			    if (window.addEventListener) {
774
775			        // bind focus event
776			        window.addEventListener("focus", function (event) {
777			            setTimeout(function(){
778			                 // TAB IS ACTIVE, WE CAN START ANY PART OF THE SLIDER
779				            if (opt.nextSlideOnWindowFocus=="on") container.revnext();
780							container.revredraw();
781			            },300);
782
783			        }, false);
784
785			        // bind blur event
786			        window.addEventListener("blur", function (event) {
787						// TAB IS NOT ACTIVE, WE CAN STOP ANY PART OF THE SLIDER
788			        }, false);
789
790			    } else {
791
792			        // bind focus event
793			        window.attachEvent("focus", function (event) {
794
795			            setTimeout(function(){
796							// TAB IS ACTIVE, WE CAN START ANY PART OF THE SLIDER
797				            if (opt.nextSlideOnWindowFocus=="on") container.revnext();
798							container.revredraw();
799				         },300);
800
801			        });
802
803			        // bind focus event
804			        window.attachEvent("blur", function (event) {
805						// TAB IS NOT ACTIVE, WE CAN STOP ANY PART OF THE SLIDER
806			        });
807			    }
808			}
809		}
810
811		///////////////////////////
812		// GET THE URL PARAMETER //
813		///////////////////////////
814		var getUrlVars = function (hashdivider)
815			{
816				var vars = [], hash;
817				var hashes = window.location.href.slice(window.location.href.indexOf(hashdivider) + 1).split('_');
818				for(var i = 0; i < hashes.length; i++)
819				{
820					hashes[i] = hashes[i].replace('%3D',"=");
821					hash = hashes[i].split('=');
822					vars.push(hash[0]);
823					vars[hash[0]] = hash[1];
824				}
825				return vars;
826			}
827
828		//////////////////////////
829		//	CONTAINER RESIZED	//
830		/////////////////////////
831		var containerResized = function (container,opt) {
832
833			// HIDE THUMBS UNDER SIZE...
834			try{
835				if (opt.hideThumbsUnderResoluition!=0 && opt.navigationType=="thumb") {
836					if (opt.hideThumbsUnderResoluition>jQuery(window).width())
837						jQuery('.tp-bullets').css({display:"none"});
838					 else
839					 	jQuery('.tp-bullets').css({display:"block"});
840				}
841			} catch(e) {}
842
843
844
845			container.find('.defaultimg').each(function(i) {
846					setSize(jQuery(this),opt);
847			});
848
849
850			//REMOVE AND SHOW SLIDER ON DEMAND
851			var contpar= container.parent();
852			if (jQuery(window).width()<opt.hideSliderAtLimit) {
853				container.trigger('stoptimer');
854				if (contpar.css('display')!="none")
855					contpar.data('olddisplay',contpar.css('display'));
856				contpar.css({display:"none"});
857
858			} else {
859
860				if (container.is(":hidden")) {
861					if (contpar.data('olddisplay')!=undefined && contpar.data('olddisplay')!="undefined" && contpar.data('olddisplay') != "none")
862						contpar.css({display:contpar.data('olddisplay')});
863					else
864						contpar.css({display:"block"});
865					container.trigger('restarttimer');
866					setTimeout(function() {
867						containerResized(container,opt);
868					},150)
869				}
870			}
871
872
873			var loff=0;
874			if (opt.forceFullWidth=="on")
875						loff = 0-opt.container.parent().offset().left;
876			try{
877				container.parent().find('.tp-bannershadow').css({'width':opt.width,'left':loff});
878			} catch(e) {}
879
880			var actsh = container.find('>ul >li:eq('+opt.act+') .slotholder');
881			var nextsh = container.find('>ul >li:eq('+opt.next+') .slotholder');
882			removeSlots(container,opt,container);
883			punchgs.TweenLite.set(nextsh.find('.defaultimg'),{opacity:0}
883);
884			actsh.find('.defaultimg').css({'opacity':1});
885
886			nextsh.find('.defaultimg').each(function() {
887				var dimg = jQuery(this);
888				if (opt.panZoomDisableOnMobile == "on" && is_mobile()) {
889					// NO KEN BURNS ON MOBILE DEVICES
890				} else {
891					if (dimg.data('kenburn')!=undefined) {
892					   dimg.data('kenburn').restart();
893					   startKenBurn(container,opt,true)
894					}
895				}
896			});
897
898			var nextli = container.find('>ul >li:eq('+opt.next+')');
899
900
901
902			var arr = container.parent().find('.tparrows');
903			if (arr.hasClass("preview2"))
904				arr.css({width:(parseInt(arr.css('minWidth'),0))});
905
906
907			animateTheCaptions(nextli, opt,true);
908			//restartBannerTimer(opt,container);
909			setBulPos(container,opt);
910
911		}
912
913
914
915
916		/*********************************
917			-	CHECK IF BROWSER IS IE	-
918		********************************/
919		var isIE = function( version, comparison ){
920		    var $div = jQuery('<div style="display:none;"/>').appendTo(jQuery('body'));
921		    $div.html('<!--[if '+(comparison||'')+' IE '+(version||'')+']><a>&nbsp;</a><![endif]-->');
922		    var ieTest = $div.find('a').length;
923		    $div.remove();
924		    return ieTest;
925		}
926
927
928
929		var callingNewSlide = function(opt,container) {
930						// CHECK THE LOOPS !!
931						if (opt.next==container.find('>ul >li').length-1) {
932								opt.looptogo=opt.looptogo-1;
933								if (opt.looptogo<=0)
934										opt.stopLoop="on";
935							}
936						swapSlide(container,opt);
937
938		}
939
940
941
942
943
944
945		////////////////////////////////
946		//	-	CREATE THE BULLETS -  //
947		////////////////////////////////
948		var createBullets = function(container,opt) {
949			var starthidebullets = "hidebullets";
950			if (opt.hideThumbs==0) starthidebullets = "";
951
952			if (opt.navigationType=="bullet"  || opt.navigationType=="both") {
953						container.parent().append('<div class="tp-bullets '+starthidebullets+' simplebullets '+opt.navigationStyle+'"></div>');
954			}
955
956
957			var bullets = container.parent().find('.tp-bullets');
958
959			container.find('>ul:first >li').each(function(i) {
960							var src=container.find(">ul:first >li:eq("+i+") img:first").attr('src');
961							bullets.append('<div class="bullet"></div>');
962							var bullet= bullets.find('.bullet:first');
963
964
965				});
966
967			// ADD THE BULLET CLICK FUNCTION HERE
968			bullets.find('.bullet').each(function(i) {
969				var bul = jQuery(this);
970				if (i==opt.slideamount-1) bul.addClass('last');
971				if (i==0) bul.addClass('first');
972
973				bul.click(function() {
974					var sameslide = false;
975					if (opt.navigationArrows=="withbullet" || opt.navigationArrows=="nexttobullets") {
976						if (bul.index()-1 == opt.act) sameslide=true;
977					} else {
978						if (bul.index() == opt.act) sameslide=true;
979					}
980
981					if (opt.transition==0 && !sameslide) {
982
983					if (opt.navigationArrows=="withbullet" || opt.navigationArrows=="nexttobullets") {
984							opt.next = bul.index()-1;
985					} else {
986							opt.next = bul.index();
987					}
988
989						callingNewSlide(opt,container);
990					}
991				});
992
993			});
994
995			bullets.append('<div class="tpclear"></div>');
996
997
998
999			setBulPos(container,opt);
1000
1001
1002
1003
1004
1005		}
1006
1007		//////////////////////
1008		//	CREATE ARROWS	//
1009		/////////////////////
1010		var createArrows = function(container,opt) {
1011
1012						var bullets = container.find('.tp-bullets');
1013
1014						var hidden="",
1015							starthidearrows = "hidearrows";
1016
1017						if (opt.hideThumbs==0) starthidearrows = "";
1018
1019						var arst= opt.navigationStyle;
1020						if (opt.navigationArrows=="none") hidden="visibility:hidden;display:none";
1021						opt.soloArrowStyle = "default"+" "+opt.navigationStyle;
1022
1023						if (opt.navigationArrows!="none" && opt.navigationArrows!="nexttobullets") arst = opt.soloArrowStyle;
1024
1025						function aArrow(dir) {
1026							container.parent().append('<div style="'+hidden+'" class="tp-'+dir+'arrow '+starthidearrows+' tparrows '+arst+'"><div class="tp-arr-allwrapper"><div class="tp-arr-iwrapper"><div class="tp-arr-imgholder"></div><div class="tp-arr-imgholder2"></div><div class="tp-arr-titleholder"></div><div class="tp-arr-subtitleholder"></div></div></div></div>');
1027						}
1028						aArrow("left");
1029						aArrow("right");
1030
1031						// 	THE LEFT / RIGHT BUTTON CLICK !	 //
1032						container.parent().find('.tp-rightarrow').click(function() {
1033
1034							if (opt.transition==0) {
1035									if (container.data('showus') !=undefined && container.data('showus') != -1)
1036										opt.next = container.data('showus')-1;
1037									else
1038										opt.next = opt.next+1;
1039									container.data('showus',-1);
1040									if (opt.next >= opt.slideamount) opt.next=0;
1041									if (opt.next<0) opt.next=0;
1042
1043									if (opt.act !=opt.next)
1044										callingNewSlide(opt,container);
1045							}
1046						});
1047
1048						container.parent().find('.tp-leftarrow').click(function() {
1049							if (opt.transition==0) {
1050									opt.next = opt.next-1;
1051									opt.leftarrowpressed=1;
1052									if (opt.next < 0) opt.next=opt.slideamount-1;
1053									callingNewSlide(opt,container);
1054							}
1055						});
1056
1057						setBulPos(container,opt);
1058
1059		}
1060
1061		//////////////////////
1062		//	CREATE ARROWS	//
1063		/////////////////////
1064		var createKeyboard = function(container,opt) {
1065
1066
1067						// 	THE LEFT / RIGHT BUTTON CLICK !	 //
1068						jQuery(document).keydown(function(e){
1069							if (opt.transition==0 && e.keyCode == 39) {
1070									if (container.data('showus') !=undefined && container.data('showus') != -1)
1071										opt.next = container.data('showus')-1;
1072									else
1073										opt.next = opt.next+1;
1074									container.data('showus',-1);
1075									if (opt.next >= opt.slideamount) opt.next=0;
1076									if (opt.next<0) opt.next=0;
1077
1078									if (opt.act !=opt.next)
1079										callingNewSlide(opt,container);
1080							}
1081
1082							if (opt.transition==0 && e.keyCode == 37) {
1083									opt.next = opt.next-1;
1084									opt.leftarrowpressed=1;
1085									if (opt.next < 0) opt.next=opt.slideamount-1;
1086									callingNewSlide(opt,container);
1087							}
1088						});
1089
1090						setBulPos(container,opt);
1091
1092		}
1093
1094		////////////////////////////
1095		// SET THE SWIPE FUNCTION //
1096		////////////////////////////
1097		var swipeAction = function(container,opt) {
1098			// TOUCH ENABLED SCROLL
1099				var aps = "vertical";
1100				
1101				if (opt.touchenabled=="on") {
1102							if (opt.drag_block_vertical == true) 
1103							    aps = "none";
1104							    
1105							container.swipe({
1106								allowPageScroll:aps,
1107								fingers:opt.swipe_min_touches,								
1108								treshold:opt.swipe_treshold,								
1109								swipe:function(event,direction,distance,duration,fingerCount,fingerData) {
1110									switch (direction) {
1111										case "left":
1112											 if (opt.transition==0) {
1113																opt.next = opt.next+1;
1114																if (opt.next == opt.slideamount) opt.next=0;
1115																callingNewSlide(opt,container);
1116														}
1117										break;
1118										case "right":
1119											if (opt.transition==0) {
1120																opt.next = opt.next-1;
1121																opt.leftarrowpressed=1;
1122																if (opt.next < 0) opt.next=opt.slideamount-1;
1123																callingNewSlide(opt,container);
1124														}
1125										break;
1126										case "up":
1127											if (aps=="none")
1128												jQuery("html, body").animate({scrollTop:(container.offset().top + container.height())+"px"});
1129										break;
1130										case "down":
1131											if (aps=="none")
1132												jQuery("html, body").animate({scrollTop:(container.offset().top - jQuery(window).height())+"px"});
1133										break;
1134									}
1135								}	
1136							})
1137						
1138				}
1139
1140		}
1141
1142
1143
1144
1145		////////////////////////////////////////////////////////////////
1146		// SHOW AND HIDE THE THUMBS IF MOUE GOES OUT OF THE BANNER  ///
1147		//////////////////////////////////////////////////////////////
1148		var hideThumbs = function(container,opt) {
1149
1150			var bullets = container.parent().find('.tp-bullets');
1151			var ca = container.parent().find('.tparrows');
1152
1153			if (bullets==null) {
1154				container.append('<div class=".tp-bullets"></div>');
1155				var bullets = container.parent().find('.tp-bullets');
1156			}
1157
1158			if (ca==null) {
1159				container.append('<div class=".tparrows"></div>');
1160				var ca = container.parent().find('.tparrows');
1161			}
1162
1163
1164			//var bp = (thumbs.parent().outerHeight(true) - opt.height)/2;
1165
1166			//	ADD THUMBNAIL IMAGES FOR THE BULLETS //
1167			container.data('hideThumbs',opt.hideThumbs);
1168
1169			bullets.addClass("hidebullets");
1170			ca.addClass("hidearrows");
1171
1172			if (is_mobile()) {
1173				try{
1174					container.hammer().on('touch', function() {
1175						container.addClass("hovered");
1176						if (opt.onHoverStop=="on")
1177							container.trigger('stoptimer');
1178						clearTimeout(container.data('hideThumbs'));
1179						bullets.removeClass("hidebullets");
1180						ca.removeClass("hidearrows");
1181
1182
1183					});
1184
1185					container.hammer().on('release', function() {
1186						container.removeClass("hovered");
1187						container.trigger('starttimer');
1188						if (!container.hasClass("hovered") && !bullets.hasClass("hovered"))
1189							container.data('hideThumbs', setTimeout(function() {
1190									bullets.addClass("hidebullets");
1191									ca.addClass("hidearrows");
1192									container.trigger('starttimer');
1193							},opt.hideNavDelayOnMobile));
1194					});
1195				} catch(e) {}
1196
1197			} else {
1198				bullets.hover(function() {
1199				opt.overnav = true;
1200				if (opt.onHoverStop=="on")
1201					container.trigger('stoptimer');
1202				bullets.addClass("hovered");
1203				clearTimeout(container.data('hideThumbs'));
1204				bullets.removeClass("hidebullets");
1205				ca.removeClass("hidearrows");
1206					},
1207				function() {
1208					opt.overnav = false;
1209					container.trigger('starttimer');
1210					bullets.removeClass("hovered");
1211					if (!container.hasClass("hovered") && !bullets.hasClass("hovered"))
1212						container.data('hideThumbs', setTimeout(function() {
1213						bullets.addClass("hidebullets");
1214						ca.addClass("hidearrows");
1215						},opt.hideThumbs));
1216				});
1217
1218
1219				ca.hover(function() {
1220					opt.overnav = true;
1221					if (opt.onHoverStop=="on")
1222						container.trigger('stoptimer');
1223					bullets.addClass("hovered");
1224					clearTimeout(container.data('hideThumbs'));
1225					bullets.removeClass("hidebullets");
1226					ca.removeClass("hidearrows");
1227
1228				},
1229				function() {
1230					opt.overnav = false;
1231					container.trigger('starttimer');
1232					bullets.removeClass("hovered");
1233					});
1234
1235
1236
1237				container.on('mouseenter', function() {
1238					container.addClass("hovered");
1239					if (opt.onHoverStop=="on")
1240						container.trigger('stoptimer');
1241					clearTimeout(container.data('hideThumbs'));
1242					bullets.removeClass("hidebullets");
1243					ca.removeClass("hidearrows");
1244
1245
1246				});
1247
1248				container.on('mouseleave', function() {
1249					container.removeClass("hovered");
1250					container.trigger('starttimer');
1251					if (!container.hasClass("hovered") && !bullets.hasClass("hovered"))
1252						container.data('hideThumbs', setTimeout(function() {
1253								bullets.addClass("hidebullets");
1254								ca.addClass("hidearrows");
1255						},opt.hideThumbs));
1256				});
1257			}
1258
1259
1260		}
1261
1262
1263
1264
1265
1266
1267
1268		//////////////////////////////
1269		//	SET POSITION OF BULLETS	//
1270		//////////////////////////////
1271		var setBulPos = function(container,opt) {
1272			var topcont=container.parent();
1273			var bullets=topcont.find('.tp-bullets');
1274
1275			if (opt.navigationType=="thumb") {
1276				bullets.find('.thumb').each(function(i) {
1277					var thumb = jQuery(this);
1278
1279					thumb.css({'width':opt.thumbWidth * opt.bw+"px", 'height':opt.thumbHeight*opt.bh+"px"});
1280
1281				})
1282				var bup = bullets.find('.tp-mask');
1283
1284				bup.width(opt.thumbWidth*opt.thumbAmount * opt.bw);
1285				bup.height(opt.thumbHeight * opt.bh);
1286				bup.parent().width(opt.thumbWidth*opt.thumbAmount * opt.bw);
1287				bup.parent().height(opt.thumbHeight * opt.bh);
1288			}
1289
1290
1291			var tl = topcont.find('.tp-leftarrow');
1292			var tr = topcont.find('.tp-rightarrow');
1293
1294			if (opt.navigationType=="thumb" && opt.navigationArrows=="nexttobullets") opt.navigationArrows="solo";
1295			// IM CASE WE HAVE NAVIGATION BULLETS TOGETHER WITH ARROWS
1296			if (opt.navigationArrows=="nexttobullets") {
1297				tl.prependTo(bullets).css({'float':'left'});
1298				tr.insertBefore(bullets.find('.tpclear')).css({'float':'left'});
1299			}
1300			var loff=0;
1301			if (opt.forceFullWidth=="on")
1302						loff = 0-opt.container.parent().offset().left;
1303
1304			var gridposX = 0,
1305				gridposY = 0;
1306
1307			if (opt.navigationInGrid=="on") {
1308				gridposX = container.width()>opt.startwidth ? (container.width() - opt.startwidth)/2 : 0,
1309				gridposY = container.height()>opt.startheight ? (container.height() - opt.startheight)/2 : 0;
1310			}
1311
1312			if (opt.navigationArrows!="none" && opt.navigationArrows!="nexttobullets") {
1313
1314				tl.css({'position':'absolute'});
1315				tr.css({'position':'absolute'});
1316
1317
1318				if (opt.soloArrowLeftValign=="center")	tl.css({'top':'50%','marginTop':(opt.soloArrowLeftVOffset-Math.round(tl.innerHeight()/2))+"px"});
1319				if (opt.soloArrowLeftValign=="bottom")	tl.css({'top':'auto','bottom':(0+opt.soloArrowLeftVOffset)+"px"});
1320				if (opt.soloArrowLeftValign=="top")	 	tl.css({'bottom':'auto','top':(0+opt.soloArrowLeftVOffset)+"px"});
1321				if (opt.soloArrowLeftHalign=="center")	tl.css({'left':'50%','marginLeft':(loff+opt.soloArrowLeftHOffset-Math.round(tl.innerWidth()/2))+"px"});
1322				if (opt.soloArrowLeftHalign=="left")	tl.css({'left':(gridposX+opt.soloArrowLeftHOffset+loff)+"px"});
1323				if (opt.soloArrowLeftHalign=="right")	tl.css({'right':(gridposX+opt.soloArrowLeftHOffset-loff)+"px"});
1324
1325				if (opt.soloArrowRightValign=="center")	tr.css({'top':'50%','marginTop':(opt.soloArrowRightVOffset-Math.round(tr.innerHeight()/2))+"px"});
1326				if (opt.soloArrowRightValign=="bottom")	tr.css({'top':'auto','bottom':(0+opt.soloArrowRightVOffset)+"px"});
1327				if (opt.soloArrowRightValign=="top")	tr.css({'bottom':'auto','top':(0+opt.soloArrowRightVOffset)+"px"});
1328				if (opt.soloArrowRightHalign=="center")	tr.css({'left':'50%','marginLeft':(loff+opt.soloArrowRightHOffset-Math.round(tr.innerWidth()/2))+"px"});
1329				if (opt.soloArrowRightHalign=="left")	tr.css({'left':(gridposX+opt.soloArrowRightHOffset+loff)+"px"});
1330				if (opt.soloArrowRightHalign=="right")	tr.css({'right':(gridposX+opt.soloArrowRightHOffset-loff)+"px"});
1331
1332
1333				if (tl.position()!=null)
1334					tl.css({'top':Math.round(parseInt(tl.position().top,0))+"px"});
1335
1336				if (tr.position()!=null)
1337					tr.css({'top':Math.round(parseInt(tr.position().top,0))+"px"});
1338			}
1339
1340			if (opt.navigationArrows=="none") {
1341				tl.css({'visibility':'hidden'});
1342				tr.css({'visibility':'hidden'});
1343			}
1344
1345			// SET THE POSITIONS OF THE BULLETS // THUMBNAILS
1346
1347
1348			if (opt.navigationVAlign=="center")	 bullets.css({'top':'50%','marginTop':(opt.navigationVOffset-Math.round(bullets.innerHeight()/2))+"px"});
1349			if (opt.navigationVAlign=="bottom")	 bullets.css({'bottom':(0+opt.
1349navigationVOffset)+"px"});
1350			if (opt.navigationVAlign=="top")	 bullets.css({'top':(0+opt.navigationVOffset)+"px"});
1351
1352
1353
1354			if (opt.navigationHAlign=="center")	bullets.css({'left':'50%','marginLeft':(loff+opt.navigationHOffset-Math.round(bullets.innerWidth()/2))+"px"});
1355			if (opt.navigationHAlign=="left")	bullets.css({'left':(0+opt.navigationHOffset+loff)+"px"});
1356			if (opt.navigationHAlign=="right")	bullets.css({'right':(0+opt.navigationHOffset-loff)+"px"});
1357		}
1358
1359
1360		/*******************************************************
1361			-	HANDLING OF PREVIEWS AND CUSTOM PREVIEWS	-
1362		*******************************************************/
1363
1364		var handleSpecialPreviews = function(opt) {
1365
1366			var container= opt.container;
1367			// FILL WITH INFOS THE NAVIGATION ARROWS
1368			opt.beforli = opt.next-1;
1369			opt.comingli = opt.next+1;
1370
1371			if (opt.beforli<0) opt.beforli = opt.slideamount-1;
1372			if (opt.comingli>=opt.slideamount) opt.comingli = 0;
1373
1374			var comingli = container.find('>ul:first-child >li:eq('+opt.comingli+')'),
1375				beforli = container.find('>ul:first-child >li:eq('+opt.beforli+')'),
1376				previmgsrc = beforli.find('.defaultimg').attr('src'),
1377				nextimgsrc = comingli.find('.defaultimg').attr('src');
1378
1379			// SAVE REFERENCES
1380			if (opt.arr == undefined) {
1381				opt.arr = container.parent().find('.tparrows'),
1382				opt.rar = container.parent().find('.tp-rightarrow'),
1383				opt.lar = container.parent().find('.tp-leftarrow'),
1384				opt.raimg = opt.rar.find('.tp-arr-imgholder'),
1385				opt.laimg = opt.lar.find('.tp-arr-imgholder'),
1386				opt.raimg_b = opt.rar.find('.tp-arr-imgholder2'),
1387				opt.laimg_b = opt.lar.find('.tp-arr-imgholder2'),
1388				opt.ratit = opt.rar.find('.tp-arr-titleholder'),
1389				opt.latit = opt.lar.find('.tp-arr-titleholder');
1390			}
1391
1392			// READ REFERENCES
1393				var arr = opt.arr,
1394					rar = opt.rar,
1395					lar = opt.lar,
1396					raimg = opt.raimg,
1397					laimg = opt.laimg,
1398					raimg_b = opt.raimg_b,
1399					laimg_b = opt.laimg_b,
1400					ratit = opt.ratit,
1401					latit = opt.latit;
1402
1403
1404			if (comingli.data('title') != undefined) ratit.html(comingli.data('title'));
1405			if (beforli.data('title') != undefined) latit.html(beforli.data('title'));
1406
1407
1408			if (rar.hasClass("itishovered")) {
1409					rar.width(ratit.outerWidth(true)+parseInt(rar.css('minWidth'),0));
1410				}
1411
1412			if (lar.hasClass("itishovered")) {
1413					lar.width(latit.outerWidth(true)+parseInt(lar.css('minWidth'),0));
1414				}
1415
1416			if (arr.hasClass("preview2") && !arr.hasClass("hashoveralready")) {
1417
1418				arr.addClass("hashoveralready");
1419
1420				if (!is_mobile())
1421					arr.hover(function() {
1422
1423						var arr = jQuery(this),
1424							th = arr.find('.tp-arr-titleholder');
1425						if (jQuery(window).width()>767)
1426							arr.width(th.outerWidth(true)+parseInt(arr.css('minWidth'),0));
1427						arr.addClass("itishovered");
1428					},function() {
1429						var arr = jQuery(this),
1430							th = arr.find('.tp-arr-titleholder');
1431						arr.css({width:parseInt(arr.css('minWidth'),0)});
1432						arr.removeClass("itishovered");
1433					});
1434				else {
1435					var arr = jQuery(this),
1436						th = arr.find('.tp-arr-titleholder');
1437						th.addClass("alwayshidden");
1438					punchgs.TweenLite.set(th,{autoAlpha:0});
1439				}
1440
1441			}
1442
1443			if (beforli.data('thumb')!=undefined) previmgsrc = beforli.data('thumb');
1444			if (comingli.data('thumb')!=undefined) nextimgsrc = comingli.data('thumb')
1445
1446
1447			// CHANGE THE IMAGE SOURCE (AND ANIMATE IF PREVIEW4 MODE IS ON
1448			if (!arr.hasClass("preview4")) {
1449				punchgs.TweenLite.to(raimg,0.5,{autoAlpha:0,onComplete:function() {
1450					raimg.css({'backgroundImage':'url('+nextimgsrc+')'});
1451					laimg.css({'backgroundImage':'url('+previmgsrc+')'});
1452				}});
1453				punchgs.TweenLite.to(laimg,0.5,{autoAlpha:0,onComplete:function() {
1454					punchgs.TweenLite.to(raimg,0.5,{autoAlpha:1,delay:0.2});
1455					punchgs.TweenLite.to(laimg,0.5,{autoAlpha:1,delay:0.2});
1456				}});
1457			} else {
1458
1459				raimg_b.css({'backgroundImage':'url('+nextimgsrc+')'});
1460				laimg_b.css({'backgroundImage':'url('+previmgsrc+')'});
1461
1462				punchgs.TweenLite.fromTo(raimg_b,0.8,{force3D:punchgs.force3d,x:0},{x:-raimg.width(),ease:punchgs.Power3.easeOut,delay:1,onComplete:function() {
1463					raimg.css({'backgroundImage':'url('+nextimgsrc+')'});
1464					punchgs.TweenLite.set(raimg_b,{x:0});
1465				}});
1466				punchgs.TweenLite.fromTo(laimg_b,0.8,{force3D:punchgs.force3d,x:0},{x:raimg.width(),ease:punchgs.Power3.easeOut,delay:1,onComplete:function() {
1467					laimg.css({'backgroundImage':'url('+previmgsrc+')'});
1468					punchgs.TweenLite.set(laimg_b,{x:0});
1469				}});
1470
1471
1472
1473				punchgs.TweenLite.fromTo(raimg,0.8,{x:0},{force3D:punchgs.force3d,x:-raimg.width(),ease:punchgs.Power3.easeOut,delay:1,onComplete:function() {
1474					punchgs.TweenLite.set(raimg,{x:0});
1475				}});
1476				punchgs.TweenLite.fromTo(laimg,0.8,{x:0},{force3D:punchgs.force3d,x:raimg.width(),ease:punchgs.Power3.easeOut,delay:1,onComplete:function() {
1477					punchgs.TweenLite.set(laimg,{x:0});
1478				}});
1479			}
1480
1481			// HOVER EFFECTS ARE SPECIAL ON PREVIEW4
1482			if (rar.hasClass("preview4") && !rar.hasClass("hashoveralready")) {
1483
1484				rar.addClass("hashoveralready");
1485				rar.hover(function() {
1486					var iw = jQuery(this).find('.tp-arr-iwrapper');
1487					var all = jQuery(this).find('.tp-arr-allwrapper');
1488					punchgs.TweenLite.fromTo(iw,0.4,{x:iw.width()},{x:0,delay:0.3,ease:punchgs.Power3.easeOut,overwrite:"all"});
1489					punchgs.TweenLite.to(all,0.2,{autoAlpha:1,overwrite:"all"});
1490
1491				},function() {
1492					var iw = jQuery(this).find('.tp-arr-iwrapper');
1493					var all = jQuery(this).find('.tp-arr-allwrapper');
1494					punchgs.TweenLite.to(iw,0.4,{x:iw.width(),ease:punchgs.Power3.easeOut,delay:0.2,overwrite:"all"});
1495					punchgs.TweenLite.to(all,0.2,{delay:0.6,autoAlpha:0,overwrite:"all"});
1496				});
1497
1498
1499				lar.hover(function() {
1500					var iw = jQuery(this).find('.tp-arr-iwrapper');
1501					var all = jQuery(this).find('.tp-arr-allwrapper');
1502					punchgs.TweenLite.fromTo(iw,0.4,{x:(0-iw.width())},{x:0,delay:0.3,ease:punchgs.Power3.easeOut,overwrite:"all"});
1503					punchgs.TweenLite.to(all,0.2,{autoAlpha:1,overwrite:"all"});
1504
1505				},function() {
1506					var iw = jQuery(this).find('.tp-arr-iwrapper');
1507					var all = jQuery(this).find('.tp-arr-allwrapper');
1508					punchgs.TweenLite.to(iw,0.4,{x:(0-iw.width()),ease:punchgs.Power3.easeOut,delay:0.2,overwrite:"all"});
1509					punchgs.TweenLite.to(all,0.2,{delay:0.6,autoAlpha:0,overwrite:"all"});
1510				});
1511
1512			}
1513			// END OF NAVIGATION ARROW CONTENT FILLING
1514
1515		}
1516		//////////////////////////////////////////////////////////
1517		//	-	SET THE IMAGE SIZE TO FIT INTO THE CONTIANER -  //
1518		////////////////////////////////////////////////////////
1519		var setSize = function(img,opt) {
1520
1521
1522				opt.container.closest('.forcefullwidth_wrapper_tp_banner').find('.tp-fullwidth-forcer').css({'height':opt.container.height()});
1523				opt.container.closest('.rev_slider_wrapper').css({'height':opt.container.height()});
1524
1525
1526				opt.width=parseInt(opt.container.width(),0);
1527				opt.height=parseInt(opt.container.height(),0);
1528
1529
1530
1531				opt.bw= (opt.width / opt.startwidth);
1532				opt.bh = (opt.height / opt.startheight);
1533
1534				if (opt.bh>opt.bw) opt.bh=opt.bw;
1535				if (opt.bh<opt.bw) opt.bw = opt.bh;
1536				if (opt.bw<opt.bh) opt.bh = opt.bw;
1537				if (opt.bh>1) { opt.bw=1; opt.bh=1; }
1538				if (opt.bw>1) {opt.bw=1; opt.bh=1; }
1539
1540
1541				//opt.height= opt.startheight * opt.bh;
1542				opt.height = Math.round(opt.startheight * (opt.width/opt.startwidth));
1543
1544
1545
1546
1547
1548				if (opt.height>opt.startheight && opt.autoHeight!="on") opt.height=opt.startheight;
1549
1550
1551				if (opt.fullScreen=="on") {
1552						opt.height = opt.bw * opt.startheight;
1553						var cow = opt.container.parent().width();
1554						var coh = jQuery(window).height();
1555
1556						if (opt.fullScreenOffsetContainer!=undefined) {
1557							try{
1558								var offcontainers = opt.fullScreenOffsetContainer.split(",");
1559								jQuery.each(offcontainers,function(index,searchedcont) {
1560									coh = coh - jQuery(searchedcont).outerHeight(true);
1561									if (coh<opt.minFullScreenHeight) coh=opt.minFullScreenHeight;
1562								});
1563							} catch(e) {}
1564
1565							 try{
1566
1567								 if (opt.fullScreenOffset.split("%").length>1 && opt.fullScreenOffset!=undefined && opt.fullScreenOffset.length>0) {
1568
1569										coh = coh - (jQuery(window).height()* parseInt(opt.fullScreenOffset,0)/100);
1570								 } else {
1571								 	if (opt.fullScreenOffset!=undefined && opt.fullScreenOffset.length>0)
1572								 		coh = coh - parseInt(opt.fullScreenOffset,0);
1573								 }
1574
1575
1576								 if (coh<opt.minFullScreenHeight) coh=opt.minFullScreenHeight;
1577
1578							} catch(e) {}
1579						}
1580
1581						opt.container.parent().height(coh);
1582
1583						opt.container.closest('.rev_slider_wrapper').height(coh);
1584						opt.container.css({'height':'100%'});
1585
1586						opt.height=coh;
1587						if (opt.minHeight!=undefined && opt.height<opt.minHeight)
1588							opt.height = opt.minHeight;
1589				} else {
1590						if (opt.minHeight!=undefined && opt.height<opt.minHeight)
1591							opt.height = opt.minHeight;
1592
1593						opt.container.height(opt.height);
1594				}
1595
1596
1597				opt.slotw=Math.ceil(opt.width/opt.slots);
1598
1599				if (opt.fullScreen=="on")
1600					opt.sloth=Math.ceil(jQuery(window).height()/opt.slots);
1601				else
1602					opt.sloth=Math.ceil(opt.height/opt.slots);
1603
1604				if (opt.autoHeight=="on")
1605				 	opt.sloth=Math.ceil(img.height()/opt.slots);
1606
1607
1608
1609
1610		}
1611
1612
1613
1614
1615		/////////////////////////////////////////
1616		//	-	PREPARE THE SLIDES / SLOTS -  //
1617		///////////////////////////////////////
1618		var prepareSlides = function(container,opt) {
1619
1620			container.find('.tp-caption').each(function() { jQuery(this).addClass(jQuery(this).data('transition')); jQuery(this).addClass('start') });
1621
1622			// PREPARE THE UL CONTAINER TO HAVEING MAX HEIGHT AND HEIGHT FOR ANY SITUATION
1623			container.find('>ul:first').css({overflow:'hidden',width:'100%',height:'100%',maxHeight:container.parent().css('maxHeight')});
1624			if (opt.autoHeight=="on") {
1625			   container.find('>ul:first').css({overflow:'hidden',width:'100%',height:'100%',maxHeight:"none"});
1626			   container.css({'maxHeight':'none'});
1627			   container.parent().css({'maxHeight':'none'});
1628			 }
1629
1630			container.find('>ul:first >li').each(function(j) {
1631				var li=jQuery(this);
1632
1633				// MAKE LI OVERFLOW HIDDEN FOR FURTHER ISSUES
1634				li.css({'width':'100%','height':'100%','overflow':'hidden'});
1635
1636				// IF LINK ON SLIDE EXISTS, NEED TO CREATE A PROPER LAYER FOR IT.
1637				if (li.data('link')!=undefined) {
1638					var link = li.data('link');
1639					var target="_self";
1640					var zindex=60;
1641					if (li.data('slideindex')=="back") zindex=0;
1642
1643					var linktoslide=li.data('linktoslide');
1644					if (li.data('target')!=undefined) target=li.data('target');
1645
1646					if (link=="slide") {
1647						li.append('<div class="tp-caption sft slidelink" style="width:100%;height:100%;z-index:'+zindex+';" data-x="center" data-y="center" data-linktoslide="'+linktoslide+'" data-start="0"><a style="width:100%;height:100%;display:block"><span style="width:100%;height:100%;display:block"></span></a></div>');
1648					} else {
1649						linktoslide="no";
1650						li.append('<div class="tp-caption sft slidelink" style="width:100%;height:100%;z-index:'+zindex+';" data-x="center" data-y="center" data-linktoslide="'+linktoslide+'" data-start="0"><a style="width:100%;height:100%;display:block" target="'+target+'" href="'+link+'"><span style="width:100%;height:100%;display:block"></span></a></div>');
1651					}
1652
1653				}
1654			});
1655
1656			// RESOLVE OVERFLOW HIDDEN OF MAIN CONTAINER
1657			container.parent().css({'overflow':'visible'});
1658
1659
1660			container.find('>ul:first >li >img').each(function(j) {
1661
1662				var img=jQuery(this);
1663
1664				img.addClass('defaultimg');
1665				if (img.data('lazyload')!=undefined && img.data('lazydone') != 1) {
1666
1667				} else {
1668					setSize(img,opt);
1669				}
1670
1671
1672
1673				img.wrap('<div class="slotholder" style="width:100%;height:100%;"'+
1674						  'data-duration="'+img.data('duration')+'"'+
1675						  'data-zoomstart="'+img.data("zoomstart")+'"'+
1676						  'data-zoomend="'+img.data("zoomend")+'"'+
1677						  'data-rotationstart="'+img.data("rotationstart")+'"'+
1678						  'data-rotationend="'+img.data("rotationend")+'"'+
1679						  'data-ease="'+img.data("ease")+'"'+
1680						  'data-duration="'+img.data("duration")+'"'+
1681						  'data-bgpositionend="'+img.data("bgpositionend")+'"'+
1682						  'data-bgposition="'+img.data("bgposition")+'"'+
1683						  'data-duration="'+img.data("duration")+'"'+
1684						  'data-kenburns="'+img.data("kenburns")+'"'+
1685						  'data-easeme="'+img.data("ease")+'"'+
1686						  'data-bgfit="'+img.data("bgfit")+'"'+
1687						  'data-bgfitend="'+img.data("bgfitend")+'"'+
1688						  'data-owidth="'+img.data("owidth")+'"'+
1689						  'data-oheight="'+img.data("oheight")+'"'+
1690						  '></div>');
1691
1692				if (opt.dottedOverlay!="none" && opt.dottedOverlay!=undefined)
1693						img.closest('.slotholder').append('<div class="tp-dottedoverlay '+opt.dottedOverlay+'"></div>');
1694
1695				var src=img.attr('src'),
1696					ll = img.data('lazyload'),
1697					bgfit = img.data('bgfit'),
1698					bgrepeat = img.data('bgrepeat'),
1699					bgposition = img.data('bgposition');
1700
1701
1702				if (bgfit==undefined) bgfit="cover";
1703				if (bgrepeat==undefined) bgrepeat="no-repeat";
1704				if (bgposition==undefined) bgposition="center center"
1705
1706
1707				var pari = img.closest('.slotholder');
1708				img.replaceWith('<div class="tp-bgimg defaultimg" data-lazyload="'+img.data('lazyload')+'" data-bgfit="'+bgfit+'"data-bgposition="'+bgposition+'" data-bgrepeat="'+bgrepeat+'" data-lazydone="'+img.data('lazydone')+'" src="'+src+'" data-src="'+src+'" style="background-color:'+img.css("backgroundColor")+';background-repeat:'+bgrepeat+';background-image:url('+src+');background-size:'+bgfit+';background-position:'+bgposition+';width:100%;height:100%;"></div>');
1709
1710				if (isIE(8)) {
1711					pari.find('.tp-bgimg').css({backgroundImage:"none",'background-image':'none'});
1712					pari.find('.tp-bgimg').append('<img class="ieeightfallbackimage defaultimg" src="'+src+'" style="width:100%">');
1713				}
1714
1715				img.css({'opacity':0});
1716				img.data('li-id',j);
1717
1718			});
1719		}
1720
1721
1722
1723
1724
1725		///////////////////////
1726		// PREPARE THE SLIDE //
1727		//////////////////////
1728		var prepareOneSlideSlot = function(slotholder,opt,visible,vorh) {
1729
1730
1731				var sh=slotholder,
1732					img = sh.find('.defaultimg'),
1733					scalestart = sh.data('zoomstart'),
1734					rotatestart = sh.data('rotationstart');
1735
1736				if (img.data('currotate')!=undefined)
1737					rotatestart = img.data('currotate');
1738				if (img.data('curscale')!=undefined)
1739					scalestart = img.data('curscale');
1740
1741				setSize(img,opt)
1742
1743				var src = img.data('src'),
1744					bgcolor=img.css('background-color'),
1745					w = opt.width,
1746					h = opt.height,
1747					fulloff = img.data("fxof");
1748
1749				if (opt.autoHeight=="on") h = opt.container.height();
1750				if (fulloff==undefined) fulloff=0;
1751
1752				fullyoff=0;
1753
1754				var off=0,
1755					bgfit = img.data('bgfit'),
1756					bgrepeat = img.data('bgrepeat'),
1757					bgposition = img.data('bgposition');
1758
1759				if (bgfit==undefined) bgfit="cover";
1760				if (bgrepeat==undefined) bgrepeat="no-repeat";
1761				if (bgposition==undefined) bgposition="center center";
1762
1763
1764				if (isIE(8)) {
1765					sh.data('kenburns',"off");
1766					var imgsrc=src;
1767			    	src="";
1768
1769				}
1770
1771				// TURN OF KEN BURNS IF WE ARE ON MOBILE AND IT IS WISHED SO
1772				if (opt.panZoomDisableOnMobile == "on" && is_mobile()) {
1773					sh.data('kenburns',"off");
1774				}
1775
1776
1777				if (sh.data('kenburns')=="on") {
1778				   bgfit=scalestart;
1779				   if (bgfit.toString().length<4)
1780					   bgfit = calculateKenBurnScales(bgfit,sh,opt);
1781				 }
1782
1783
1784				if (vorh == "horizontal") {
1785
1786					if (!visible) var off=0-opt.slotw;
1787
1788					for (var i=0;i<opt.slots;i++) {
1789
1790							sh.append('<div class="slot" style="position:absolute;'+
1791															'top:'+(0+fullyoff)+'px;'+
1792															'left:'+(fulloff+(i*opt.slotw))+'px;'+
1793															'overflow:hidden;width:'+(opt.slotw+0.6)+'px;'+
1794															'height:'+h+'px">'+
1795							'<div class="slotslide" style="position:absolute;'+
1796															'top:0px;left:'+off+'px;'+
1797															'width:'+(opt.slotw+0.6)+'px;'+
1798															'height:'+h+'px;overflow:hidden;">'+
1799							'<div style="background-color:'+bgcolor+';'+
1800															'position:absolute;top:0px;'+
1801															'left:'+(0-(i*opt.slotw))+'px;'+
1802															'width:'+w+'px;height:'+h+'px;'+
1803															'background-image:url('+src+');'+
1804															'background-repeat:'+bgrepeat+';'+
1805															'background-size:'+bgfit+';background-position:'+bgposition+';">'+
1806							'</div></div></div>');
1807							if (scalestart!=undefined && rotatestart!=undefined)
1808								punchgs.TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart});
1809							if (isIE(8)) {
1810							   sh.find('.slot ').last().find('.slotslide').append('<img class="ieeightfallbackimage" src="'+imgsrc+'" style="width:100%;height:auto">');
1811							   ieimgposition(sh,opt);
1812
1813						}
1814					}
1815				} else {
1816
1817					if (!visible) var off=0-opt.sloth;
1818
1819					for (var i=0;i<opt.slots+2;i++) {
1820						sh.append('<div class="slot" style="position:absolute;'+
1821												 'top:'+(fullyoff+(i*opt.sloth))+'px;'+
1822												 'left:'+(fulloff)+'px;'+
1823												 'overflow:hidden;'+
1824												 'width:'+w+'px;'+
1825												 'height:'+(opt.sloth)+'px">'+
1826
1827									 '<div class="slotslide" style="position:absolute;'+
1828														 'top:'+(off)+'px;'+
1829														 'left:0px;width:'+w+'px;'+
1830														 'height:'+opt.sloth+'px;'+
1831														 'overflow:hidden;">'+
1832									'<div style="background-color:'+bgcolor+';'+
1833															'position:absolute;'+
1834															'top:'+(0-(i*opt.sloth))+'px;'+
1835															'left:0px;'+
1836															'width:'+w+'px;height:'+h+'px;'+
1837															'background-image:url('+src+');'+
1838															'background-repeat:'+bgrepeat+';'+
1839															'background-size:'+bgfit+';background-position:'+bgposition+';">'+
1840
1841									'</div></div></div>');
1842							if (scalestart!=undefined && rotatestart!=undefined)
1843								punchgs.TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart});
1844							if (isIE(8)) {
1845						    	sh.find('.slot ').last().find('.slotslide').append('<img class="ieeightfallbackimage" src="'+imgsrc+'" style="width:100%;height:auto;">');
1846						    	ieimgposition(sh,opt);
1847							}
1848					}
1849				}
1850
1851
1852
1853
1854		}
1855
1856
1857
1858		///////////////////////
1859		// PREPARE THE SLIDE //
1860		//////////////////////
1861		var prepareOneSlideBox = function(slotholder,opt,visible) {
1862
1863				var sh=slotholder;
1864				var img = sh.find('.defaultimg');
1865
1866				var scalestart = sh.data('zoomstart');
1867				var rotatestart = sh.data('rotationstart');
1868
1869				if (img.data('currotate')!=undefined)
1870					rotatestart = img.data('currotate');
1871				if (img.data('curscale')!=undefined)
1872					scalestart = img.data('curscale')*100;
1873
1874
1875
1876				setSize(img,opt)
1877				var src = img.data('src');
1878				var bgcolor=img.css('backgroundColor');
1879
1880				var w = opt.width;
1881				var h = opt.height;
1882				if (opt.autoHeight=="on")
1883				  h = opt.container.height();
1884
1885				var fulloff = img.data("fxof");
1886				if (fulloff==undefined) fulloff=0;
1887
1888				fullyoff=0;
1889
1890
1891
1892				var off=0;
1893
1894
1895				if (isIE(8)) {
1896					var imgsrc=src;
1897			    	src="";
1898				}
1899
1900				// SET THE MINIMAL SIZE OF A BOX
1901				var basicsize = 0;
1902				if (opt.sloth>opt.slotw)
1903					basicsize=opt.sloth
1904				else
1905					basicsize=opt.slotw;
1906
1907
1908				if (!visible) {
1909					var off=0-basicsize;
1910				}
1911
1912				opt.slotw = basicsize;
1913				opt.sloth = basicsize;
1914				var x=0;
1915				var y=0;
1916
1917				var bgfit = img.data('bgfit');
1918				var bgrepeat = img.data('bgrepeat');
1919				var bgposition = img.data('bgposition');
1920
1921				if (bgfit==undefined) bgfit="cover";
1922				if (bgrepeat==undefined) bgrepeat="no-repeat";
1923				if (bgposition==undefined) bgposition="center center";
1924
1925				if (sh.data('kenburns')=="on") {
1926				   bgfit=scalestart;
1927				   if (bgfit.toString().length<4)
1928					   bgfit = calculateKenBurnScales(bgfit,sh,opt);
1929				 }
1930
1931				for (var j=0;j<opt.slots;j++) {
1932
1933					y=0;
1934					for (var i=0;i<opt.slots;i++) 	{
1935
1936
1937						sh.append('<div class="slot" '+
1938								  'style="position:absolute;'+
1939											'top:'+(fullyoff+y)+'px;'+
1940											'left:'+(fulloff+x)+'px;'+
1941											'width:'+basicsize+'px;'+
1942											'height:'+basicsize+'px;'+
1943											'overflow:hidden;">'+
1944
1945								  '<div class="slotslide" data-x="'+x+'" data-y="'+y+'" '+
1946								  			'style="position:absolute;'+
1947											'top:'+(0)+'px;'+
1948											'left:'+(0)+'px;'+
1949											'width:'+basicsize+'px;'+
1950											'height:'+basicsize+'px;'+
1951											'overflow:hidden;">'+
1952
1953								  '<div style="position:absolute;'+
1954											'top:'+(0-y)+'px;'+
1955											'left:'+(0-x)+'px;'+
1956											'width:'+w+'px;'+
1957											'height:'+h+'px;'+
1958											'background-color:'+bgcolor+';'+
1959											'background-image:url('+src+');'+
1960											'background-repeat:'+bgrepeat+';'+
1961											'background-size:'+bgfit+';background-position:'+bgposition+';">'+
1962								  '</div></div></div>');
1963						y=y+basicsize;
1964
1965						if (isIE(8)) {
1966
1967							sh.find('.slot ').last().find('.slotslide').append('<img src="'+imgsrc+'">');
1968							ieimgposition(sh,opt);
1969						}
1970
1971						if (scalestart!=undefined && rotatestart!=undefined)
1972								punchgs.TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart});
1973					}
1974					x=x+basicsize;
1975				}
1976		}
1977
1978		/***********************************************
1979			-	MOVE IE8 IMAGE IN RIGHT POSITION	-
1980		***********************************************/
1981
1982		var ieimgposition = function(nextsh,opt) {
1983
1984			if (isIE(8)) {
1985
1986					var ie8img = nextsh.find('.ieeightfallbackimage');
1987
1988					var ie8w = ie8img.width(),
1989						ie8h = ie8img.height();
1990
1991
1992
1993					if (opt.startwidth/opt.startheight <nextsh.data('owidth')/nextsh.data('oheight'))
1994						ie8img.css({width:"auto",height:"100%"})
1995					else
1996						ie8img.css({width:"100%",height:"auto"})
1997
1998
1999					setTimeout(function() {
2000
2001
2002						var ie8w = ie8img.width(),
2003						    ie8h = ie8img.height();
2004
2005
2006
2007						if (nextsh.data('bgposition')=="center center")
2008							ie8img.css({position:"absolute",top:opt.height/2 - ie8h/2+"px", left:opt.width/2-ie8w/2+"px"});
2009
2010						if (nextsh.data('bgposition')=="center top" || nextsh.data('bgposition')=="top center")
2011							ie8img.css({position:"absolute",top:"0px", left:opt.width/2-ie8w/2+"px"});
2012
2013						if (nextsh.data('bgposition')=="center bottom" || nextsh.data('bgposition')=="bottom center")
2014							ie8img.css({position:"absolute",bottom:"0px", left:opt.width/2-ie8w/2+"px"});
2015
2016
2017						if (nextsh.data('bgposition')=="right top" || nextsh.data('bgposition')=="top right")
2018							ie8img.css({position:"absolute",top:"0px", right:"0px"});
2019
2020						if (nextsh.data('bgposition')=="right bottom" || nextsh.data('bgposition')=="bottom right")
2021							ie8img.css({position:"absolute",bottom:"0px", right:"0px"});
2022
2023						if (nextsh.data('bgposition')=="right center" || nextsh.data('bgposition')=="center right")
2024							ie8img.css({position:"absolute",top:opt.height/2 - ie8h/2+"px", right:"0px"});
2025
2026						if (nextsh.data('bgposition')=="left bottom" || nextsh.data('bgposition')=="bottom left")
2027							ie8img.css({position:"absolute",bottom:"0px", left:"0px"});
2028
2029						if (nextsh.data('bgposition')=="left center" || nextsh.data('bgposition')=="center left")
2030							ie8img.css({position:"absolute",top:opt.height/2 - ie8h/2+"px", left:"0px"});
2031					},20);
2032				}
2033		}
2034
2035
2036
2037
2038		///////////////////////
2039		//	REMOVE SLOTS	//
2040		/////////////////////
2041		var removeSlots = function(container,opt,where) {
2042
2043
2044				where.find('.slot').each(function() {
2045					jQuery(this).remove();
2046				});
2047				opt.transition = 0;
2048
2049		}
2050
2051
2052		/*******************************************
2053			-	PREPARE LOADING OF IMAGES	-
2054		********************************************/
2055		var loadAllPrepared = function(container,alreadyinload) {
2056
2057			container.find('img, .defaultimg').each(function(i) {
2058				var img = jQuery(this);
2059
2060				if (img.data('lazyload')!=img.attr('src') && alreadyinload<3 && img.data('lazyload')!=undefined && img.data('lazyload')!='undefined') {
2061
2062					if (img.data('lazyload') !=undefined && img.data('lazyload') !='undefined') {
2063						img.attr('src',img.data('lazyload'));
2064
2065						var limg = new Image();
2066
2067						limg.onload = function(i) {
2068							img.data('lazydone',1);
2069							if (img.hasClass("defaultimg")) setDefImg(img,limg);
2070						}
2071						limg.error = function() {
2072							img.data('lazydone',1);
2073						}
2074
2075						limg.src=img.attr('src');
2076						if (limg.complete) {
2077								if (img.hasClass("defaultimg")) setDefImg(img,limg);
2078								img.data('lazydone',1);
2079						}
2080
2081					}
2082				} else {
2083
2084					if ((img.data('lazyload') === undefined || img.data('lazyload') === 'undefined') && img.data('lazydone')!=1) {
2085						var limg = new Image();
2086						limg.onload = function() {
2087							if (img.hasClass("defaultimg")) setDefImg(img,limg);
2088							img.data('lazydone',1);
2089						}
2090						limg.error = function() {
2091							img.data('lazydone',1);
2092						}
2093
2094
2095						if (img.attr('src')!=undefined && img.attr('src')!='undefined') 	{
2096							limg.src = img.attr('src');
2097						} else
2098							limg.src = img.data('src');
2099
2100						if (limg.complete) {
2101								if (img.hasClass("defaultimg")) {
2102									setDefImg(img,limg);
2103								}
2104								img.data('lazydone',1);
2105						}
2106					}
2107				}
2108			})
2109		}
2110
2111		var setDefImg = function(img,limg) {
2112			var nextli = img.closest('li');
2113			var ww = limg.width;
2114			var hh = limg.height;
2115			nextli.data('owidth',ww);
2116			nextli.data('oheight',hh);
2117			nextli.find('.slotholder').data('owidth',ww);
2118			nextli.find('.slotholder').data('oheight',hh);
2119			nextli.data('loadeddone',1);
2120		}
2121
2122		var waitForLoads = function(element,call,opt) {
2123
2124			loadAllPrepared(element,0);
2125			var inter = setInterval(function() {
2126				opt.bannertimeronpause = true;
2127				opt.container.trigger('stoptimer');
2128				opt.cd=0;
2129				 var found = 0;
2130				 element.find('img, .defaultimg').each(function(i) {
2131				 	if (jQuery(this).data('lazydone')!=1) {
2132				 		found++;
2133
2134				 	}
2135				 });
2136
2137				 if (found>0)
2138					 loadAllPrepared(element,found);
2139				 else {
2140					 clearInterval(inter);
2141					 if (call!=undefined)
2142					 	call();
2143				 }
2144
2145			},100)
2146		}
2147
2148
2149		//////////////////////////////
2150		//	-	SWAP THE SLIDES -  //
2151		////////////////////////////
2152		var swapSlide = function(container,opt) {
2153			try{
2154				var actli = container.find('>ul:first-child >li:eq('+opt.act+')');
2155			} catch(e) {
2156				var actli=container.find('>ul:first-child >li:eq(1)');
2157			}
2158			opt.lastslide=opt.act;
2159			var nextli = container.find('>ul:first-child >li:eq('+opt.next+')');
2160
2161			var defimg= nextli.find('.defaultimg');
2162
2163
2164			opt.bannertimeronpause = true;
2165			container.trigger('stoptimer');
2166			opt.cd=0;
2167
2168			if (defimg.data('lazyload') !=undefined && defimg.data('lazyload') !="undefined" && defimg.data('lazydone') !=1 ) {
2169
2170				if (!isIE(8))
2171					defimg.css({backgroundImage:'url("'+nextli.find('.defaultimg').data('lazyload')+'")'});
2172				else {
2173					defimg.attr('src',nextli.find('.defaultimg').data('lazyload'));
2174				}
2175
2176				defimg.data('src',nextli.find('.defaultimg').data('lazyload'));
2177				defimg.data('lazydone',1);
2178				defimg.data('orgw',0);
2179				nextli.data('loadeddone',1);
2180
2181				container.find('.tp-loader').css({display:"block"});
2182				waitForLoads(container.find('.tp-static-layers'),function() {
2183					waitForLoads(nextli,function() {
2184							var nextsh = nextli.find('.slotholder');
2185							if (nextsh.data('kenburns')=="on") {
2186								var waitfordimension = setInterval(function() {
2187									var ow = nextsh.data('owidth');
2188									if (ow>=0) {
2189										clearInterval(waitfordimension);
2190										swapSlideCall(opt,defimg,container)
2191									}
2192								},10)
2193							} else
2194							 swapSlideCall(opt,defimg,container)
2195					},opt);
2196				},opt);
2197
2198			} else {
2199
2200				if (nextli.data('loadeddone')===undefined) {
2201					nextli.data('loadeddone',1);
2202					waitForLoads(nextli,function() {
2203						  swapSlideCall(opt,defimg,container)
2204						},opt);
2205				} else
2206
2207				 swapSlideCall(opt,defimg,container)
2208			}
2209		}
2210
2211		var swapSlideCall = function(opt,defimg,container) {
2212			opt.bannertimeronpause = false;
2213		    opt.cd=0;
2214		    container.trigger('nulltimer');
2215		    container.find('.tp-loader').css({display:"none"});
2216		    setSize(defimg,opt);
2217			setBulPos(container,opt);
2218			setSize(defimg,opt);
2219		   	swapSlideProgress(container,opt);
2220
2221		}
2222
2223		/******************************
2224			-	SWAP SLIDE PROGRESS	-
2225		********************************/
2226		/*!SWAP SLIDE*/
2227		var swapSlideProgress = function(container,opt) {
2228
2229
2230			container.trigger('revolution.slide.onbeforeswap');
2231
2232			opt.transition = 1;
2233			opt.videoplaying = false;
2234			//konsole.log("VideoPlay set to False due swapSlideProgress");
2235
2236			try{
2237				var actli = container.find('>ul:first-child >li:eq('+opt.act+')');
2238			} catch(e) {
2239				var actli=container.find('>ul:first-child >li:eq(1)');
2240			}
2241
2242			opt.lastslide=opt.act;
2243
2244			var nextli = container.find('>ul:first-child >li:eq('+opt.next+')');
2245
2246			setTimeout(function() {
2247				handleSpecialPreviews(opt);
2248			},200);
2249
2250			var actsh = actli.find('.slotholder');
2251			var nextsh = nextli.find('.slotholder');
2252
2253			if (nextsh.data('kenburns')=="on" || actsh.data('kenburns')=="on") {
2254				stopKenBurn(container,opt);
2255				container.find('.kenburnimg').remove();
2256			}
2257
2258
2259			// IF DELAY HAS BEEN SET VIA THE SLIDE, WE TAKE THE NEW VALUE, OTHER WAY THE OLD ONE...
2260			if (nextli.data('delay')!=undefined) {
2261						opt.cd=0;
2262						opt.delay=nextli.data('delay');
2263			} else {
2264				opt.delay=opt.origcd;
2265			}
2266
2267
2268			if (opt.firststart==1)
2269				punchgs.TweenLite.set(actli,{autoAlpha:0});
2270
2271			punchgs.TweenLite.set(actli,{zIndex:18});
2272			punchgs.TweenLite.set(nextli,{autoAlpha:0,zIndex:20});
2273
2274			///////////////////////////
2275			//	REMOVE THE CAPTIONS //
2276			///////////////////////////
2277			var removetime = 0;
2278			if (actli.index() != nextli.index() && opt.firststart!=1) {
2279				removetime = removeTheCaptions(actli,opt);
2280
2281			}
2282
2283			if (actli.data('saveperformance')!="on") removetime = 0;
2284
2285			setTimeout(function() {
2286				//opt.cd=0;
2287			    //container.trigger('nulltimer');
2288			    container.trigger('restarttimer');
2289				slideAnimation(container,opt,nextli,actli,actsh,nextsh);
2290			},removetime)
2291
2292		}
2293
2294
2295		/******************************************
2296			-	START THE LAYER ANIMATION 	-
2297		*******************************************/
2298
2299		var slideAnimation = function(container,opt,nextli,actli,actsh,nextsh) {
2300
2301			// IF THERE IS AN OTHER FIRST SLIDE START HAS BEED SELECTED
2302			if (nextli.data('differentissplayed') =='prepared') {
2303				nextli.data('differentissplayed','done');
2304				nextli.data('transition',nextli.data('savedtransition'));
2305				nextli.data('slotamount',nextli.data('savedslotamount'));
2306				nextli.data('masterspeed',nextli.data('savedmasterspeed'));
2307			}
2308
2309
2310			if (nextli.data('fstransition') != undefined && nextli.data('differentissplayed') !="done") {
2311				nextli.data('savedtransition',nextli.data('transition'));
2312				nextli.data('savedslotamount',nextli.data('slotamount'));
2313				nextli.data('savedmasterspeed',nextli.data('masterspeed'));
2314
2315				nextli.data('transition',nextli.data('fstransition'));
2316				nextli.data('slotamount',nextli.data('fsslotamount'));
2317				nextli.data('masterspeed',nextli.data('fsmasterspeed'));
2318
2319				nextli.data('differentissplayed','prepared');
2320			}
2321
2322			container.find('.active-revslide').removeClass('.active-revslide');
2323			nextli.addClass("active-revslide");
2324
2325			///////////////////////////////////////
2326			// TRANSITION CHOOSE - RANDOM EFFECTS//
2327			///////////////////////////////////////
2328
2329
2330			if (nextli.data('transition')==undefined) nextli.data('transition',"random");
2331
2332			var nexttrans = 0,
2333				transtext = nextli.data('transition').split(","),
2334				curtransid = nextli.data('nexttransid') == undefined ? -1 : nextli.data('nexttransid');
2335
2336			if (nextli.data('randomtransition')=="on")
2337				curtransid = Math.round(Math.random()*transtext.length);
2338			else
2339				curtransid=curtransid+1;
2340
2341			if (curtransid==transtext.length) curtransid=0;
2342			nextli.data('nexttransid',curtransid);
2343
2344
2345
2346			var comingtransition = transtext[curtransid];
2347
2348			if (opt.ie) {
2349				if (comingtransition=="boxfade") comingtransition = "boxslide";
2350				if (comingtransition=="slotfade-vertical") comingtransition = "slotzoom-vertical";
2351				if (comingtransition=="slotfade-horizontal") comingtransition = "slotzoom-horizontal";
2352			}
2353
2354			if (isIE(8)) {
2355				comingtransition = 11;
2356			}
2357
2358
2359			var specials = 0;
2360
2361			if (opt.parallax=="scroll" && opt.parallaxFirstGo==undefined) {
2362				opt.parallaxFirstGo = true;
2363				scrollParallax(container,opt);
2364				setTimeout(function() {
2365					scrollParallax(container,opt);
2366				},210);
2367				setTimeout(function() {
2368					scrollParallax(container,opt);
2369				},420);
2370
2371			}
2372
2373
2374
2375
2376			/*if (opt.ffnn == undefined) opt.ffnn=0;
2377			comingtransition=opt.ffnn;
2378
2379			if ( direction==1)
2380				opt.ffnn=opt.ffnn-1;
2381			else
2382				opt.ffnn=opt.ffnn+1;
2383
2384			if (opt.ffnn>46) opt.ffnn=0;
2385			if (opt.ffnn<0) opt.ffnn = 46;
2386
2387			jQuery('.logo').html('Next Anim:'+comingtransition);*/
2388
2389
2390			if (comingtransition=="boxslide" || comingtransition == "boxfade" || comingtransition == "papercut" ||
2391				comingtransition==0 || comingtransition == 1 || comingtransition == 16)
2392				comingtransition = 9;
2393
2394
2395			/* Transition Name ,
2396			   Transition Code,
2397			   Transition Sub Code,
2398			   Max Slots,
2399			   MasterSpeed Delays,
2400			   Preparing Slots (box,slideh, slidev),
2401			   Call on nextsh (null = no, true/false for visibility first preparing),
2402			   Call on actsh (null = no, true/false for visibility first preparing),
2403			*/
2404
2405
2406
2407
2408			if (comingtransition=="slidehorizontal") {
2409						comingtransition = "slideleft"
2410					if (opt.leftarrowpressed==1)
2411						comingtransition = "slideright"
2412				}
2413
2414			if (comingtransition=="slidevertical") {
2415						comingtransition = "slideup"
2416					if (opt.leftarrowpressed==1)
2417						comingtransition = "slidedown"
2418				}
2419
2420			if (comingtransition=="parallaxhorizontal") {
2421						comingtransition = "parallaxtoleft"
2422					if (opt.leftarrowpressed==1)
2423						comingtransition = "parallaxtoright"
2424				}
2425
2426
2427			if (comingtransition=="parallaxvertical") {
2428						comingtransition = "parallaxtotop"
2429					if (opt.leftarrowpressed==1)
2430						comingtransition = "parallaxtobottom"
2431				}
2432
2433
2434
2435
2436			var transitionsArray = [ ['boxslide' , 0, 1, 10, 0,'box',false,null,0],
2437									 ['boxfade', 1, 0, 10, 0,'box',false,null,1],
2438									 ['slotslide-horizontal', 2, 0, 0, 200,'horizontal',true,false,2],
2439									 ['slotslide-vertical', 3, 0,0,200,'vertical',true,false,3],
2440									 ['curtain-1', 4, 3,0,0,'horizontal',true,true,4],
2441									 ['curtain-2', 5, 3,0,0,'horizontal',true,true,5],
2442									 ['curtain-3', 6, 3,25,0,'horizontal',true,true,6],
2443									 ['slotzoom-horizontal', 7, 0,0,400,'horizontal',true,true,7],
2444									 ['slotzoom-vertical', 8, 0,0,0,'vertical',true,true,8],
2445									 ['slotfade-horizontal', 9, 0,0,500,'horizontal',true,null,9],
2446									 ['slotfade-vertical', 10, 0,0 ,500,'vertical',true,null,10],
2447									 ['fade', 11, 0, 1 ,300,'horizontal',true,null,11],
2448									 ['slideleft', 12, 0,1,0,'horizontal',true,true,12],
2449									 ['slideup', 13, 0,1,0,'horizontal',true,true,13],
2450									 ['slidedown', 14, 0,1,0,'horizontal',true,true,14],
2451									 ['slideright', 15, 0,1,0,'horizontal',true,true,15],
2452									 ['papercut', 16, 0,0,600,'',null,null,16],
2453									 ['3dcurtain-horizontal', 17, 0,20,100,'vertical',false,true,17],
2454									 ['3dcurtain-vertical', 18, 0,10,100,'horizontal',false,true,18],
2455									 ['cubic', 19, 0,20,600,'horizontal',false,true,19],
2456									 ['cube',19,0,20,600,'horizontal',false,true,20],
2457									 ['flyin', 20, 0,4,600,'vertical',false,true,21],
2458									 ['turnoff', 21, 0,1,1600,'horizontal',false,true,22],
2459									 ['incube', 22, 0,20,200,'horizontal',false,true,23],
2460									 ['cubic-horizontal', 23, 0,20,500,'vertical',false,true,24],
2461									 ['cube-horizontal', 23, 0,20,500,'vertical',false,true,25],
2462									 ['incube-horizontal', 24, 0,20,500,'vertical',false,true,26],
2463									 ['turnoff-vertical', 25, 0,1,200,'horizontal',false,true,27],
2464									 ['fadefromright', 12, 1,1,0,'horizontal',true,true,28],
2465									 ['fadefromleft', 15, 1,1,0,'horizontal',true,true,29],
2466									 ['fadefromtop', 14, 1,1,0,'horizontal',true,true,30],
2467									 ['fadefrombottom', 13, 1,1,0,'horizontal',true,true,31],
2468									 ['fadetoleftfadefromright', 12, 2,1,0,'horizontal',true,true,32],
2469									 ['fadetorightfadetoleft', 15, 2,1,0,'horizontal',true,true,33],
2470									 ['fadetobottomfadefromtop', 14, 2,1,0,'horizontal',true,true,34],
2471									 ['fadetotopfadefrombottom', 13, 2,1,0,'horizontal',true,true,35],
2472									 ['parallaxtoright', 12, 3,1,0,'horizontal',true,true,36],
2473									 ['parallaxtoleft', 15, 3,1,0,'horizontal',true,true,37],
2474									 ['parallaxtotop', 14, 3,1,0,'horizontal',true,true,38],
2475									 ['parallaxtobottom', 13, 3,1,0,'horizontal',true,true,39],
2476									 ['scaledownfromright', 12, 4,1,0,'horizontal',true,true,40],
2477									 ['scaledownfromleft', 15, 4,1,0,'horizontal',true,true,41],
2478									 ['scaledownfromtop', 14, 4,1,0,'horizontal',true,true,42],
2479									 ['scaledownfrombottom', 13, 4,1,0,'horizontal',true,true,43],
2480									 ['zoomout', 13, 5,1,0,'horizontal',true,true,44],
2481									 ['zoomin', 13, 6,1,0,'horizontal',true,true,45],
2482									 ['notransition',26,0,1,0,'horizontal',true,null,46]
2483								   ];
2484
2485
2486			var flatTransitions = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45];
2487			var premiumTransitions = [16,17,18,19,20,21,22,23,24,25,26,27]
2488
2489			var nexttrans =0;
2490			var specials = 1;
2491			var STAindex = 0;
2492			var indexcounter =0;
2493			var STA = new Array;
2494
2495			//START THE KEN BURN PAN ZOOM ANIMATION
2496			if (nextsh.data('kenburns')=="on") {
2497					if (comingtransition == "boxslide" || comingtransition==0 ||
2498						comingtransition == "boxfade" || comingtransition==1 ||
2499						comingtransition == "papercut" || comingtransition==16
2500						)
2501						comingtransition = 11;
2502
2503						startKenBurn(container,opt,true,true);
2504			}
2505
2506
2507
2508			// RANDOM TRANSITIONS
2509			if (comingtransition == "random") {
2510				comingtransition = Math.round(Math.random()*transitionsArray.length-1);
2511				if (comingtransition>transitionsArray.length-1) comingtransition=transitionsArray.length-1;
2512			}
2513
2514			// RANDOM FLAT TRANSITIONS
2515			if (comingtransition == "random-static") {
2516				comingtransition = Math.round(Math.random()*flatTransitions.length-1);
2517				if (comingtransition>flatTransitions.length-1) comingtransition=flatTransitions.length-1;
2518				comingtransition = flatTransitions[comingtransition];
2519			}
2520
2521			// RANDOM PREMIUM TRANSITIONS
2522			if (comingtransition == "random-premium") {
2523				comingtransition = Math.round(Math.random()*premiumTransitions.length-1);
2524				if (comingtransition>premiumTransitions.length-1) comingtransition=premiumTransitions.length-1;
2525				comingtransition = premiumTransitions[comingtransition];
2526			}
2527
2528
2529
2530			//joomla only change: avoid problematic transitions that don't compatible with mootools
2531			var problematicTransitions = [12,13,14,15,16,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45];
2532			if(opt.isJoomla == true && window.MooTools != undefined && problematicTransitions.indexOf(comingtransition) != -1){
2533
2534				var newTransIndex = Math.round(Math.random() * (premiumTransitions.length-2) ) + 1;
2535
2536				//some limits fix
2537				if (newTransIndex > premiumTransitions.length-1)
2538					newTransIndex = premiumTransitions.length-1;
2539
2540				if(newTransIndex == 0)
2541					newTransIndex = 1;
2542
2543				comingtransition = premiumTransitions[newTransIndex];
2544			}
2545
2546
2547
2548			function findTransition() {
2549				// FIND THE RIGHT TRANSITION PARAMETERS HERE
2550				jQuery.each(transitionsArray,function(inde,trans) {
2551					if (trans[0] == comingtransition || trans[8] == comingtransition) {
2552						nexttrans = trans[1];
2553						specials = trans[2];
2554						STAindex = indexcounter;
2555					}
2556					indexcounter = indexcounter+1;
2557				})
2558			}
2559
2560			findTransition();
2561
2562			// CHECK IF WE HAVE IE8 AND THAN FALL BACK ON FLAT TRANSITIONS
2563			if (isIE(8) && nexttrans>15 && nexttrans<28) {
2564				comingtransition = Math.round(Math.random()*flatTransitions.length-1);
2565				if (comingtransition>flatTransitions.length-1) comingtransition=flatTransitions.length-1;
2566				comingtransition = flatTransitions[comingtransition];
2567				indexcounter =0;
2568				findTransition();
2569			}
2570
2571
2572
2573
2574			// WHICH DIRECTION DID WE HAD ?
2575			var direction=-1;
2576			if (opt.leftarrowpressed==1 || opt.act>opt.next) direction=1;
2577
2578
2579
2580			opt.leftarrowpressed=0;
2581
2582			if (nexttrans>26) nexttrans = 26;
2583			if (nexttrans<0) nexttrans = 0;
2584
2585
2586			// DEFINE THE MASTERSPEED FOR THE SLIDE //
2587			var masterspeed=300;
2588			if (nextli.data('masterspeed')!=undefined && nextli.data('masterspeed')>99 && nextli.data('masterspeed')<4001)
2589				masterspeed = nextli.data('masterspeed');
2590
2591			// PREPARED DEFAULT SETTINGS PER TRANSITION
2592			STA = transitionsArray[STAindex];
2593
2594
2595
2596
2597
2598			/////////////////////////////////////////////
2599			// SET THE BULLETS SELECTED OR UNSELECTED  //
2600			/////////////////////////////////////////////
2601
2602
2603			container.parent().find(".bullet").each(function() {
2604				var bul = jQuery(this);
2605				bul.removeClass("selected");
2606
2607				if (opt.navigationArrows=="withbullet" || opt.navigationArrows=="nexttobullets") {
2608					if (bul.index()-1 == opt.next) bul.addClass('selected');
2609
2610				} else {
2611
2612					if (bul.index() == opt.next)  bul.addClass('selected');
2613
2614				}
2615			});
2616
2617
2618
2619			///////////////////////////////
2620			//	MAIN TIMELINE DEFINITION //
2621			///////////////////////////////
2622
2623			var mtl = new punchgs.TimelineLite({onComplete:function() {
2624							letItFree(container,opt,nextsh,actsh,nextli,actli,mtl);
2625						}});
2626			//SET DEFAULT IMG UNVISIBLE AT START
2627			mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{opacity:0}));
2628			mtl.pause();
2629
2630
2631
2632
2633			/////////////////////////////////////////////
2634			//	SET THE ACTUAL AMOUNT OF SLIDES !!     //
2635			//  SET A RANDOM AMOUNT OF SLOTS          //
2636			///////////////////////////////////////////
2637			if (nextli.data('slotamount')==undefined || nextli.data('slotamount')<1) {
2638				opt.slots=Math.round(Math.random()*12+4);
2639				if (comingtransition=="boxslide")
2640					opt.slots=Math.round(Math.random()*6+3);
2641				else
2642				if (comingtransition=="flyin")
2643					opt.slots=Math.round(Math.random()*4+1);
2644			 } else {
2645				opt.slots=nextli.data('slotamount');
2646
2647			}
2648
2649			/////////////////////////////////////////////
2650			//	SET THE ACTUAL AMOUNT OF SLIDES !!     //
2651			//  SET A RANDOM AMOUNT OF SLOTS          //
2652			///////////////////////////////////////////
2653			if (nextli.data('rotate')==undefined)
2654				opt.rotate = 0
2655			 else
2656				if (nextli.data('rotate')==999)
2657					opt.rotate=Math.round(Math.random()*360);
2658				 else
2659				    opt.rotate=nextli.data('rotate');
2660			if (!jQuery.support.transition  || opt.ie || opt.ie9) opt.rotate=0;
2661
2662
2663
2664
2665			//////////////////////////////
2666			//	FIRST START 			//
2667			//////////////////////////////
2668			if (opt.firststart==1) opt.firststart=0;
2669
2670
2671			// ADJUST MASTERSPEED
2672			masterspeed = masterspeed + STA[4];
2673
2674			if ((nexttrans==4 || nexttrans==5 || nexttrans==6) && opt.slots<3 ) opt.slots=3;
2675
2676			// ADJUST SLOTS
2677			if (STA[3] != 0) opt.slots = Math.min(opt.slots,STA[3]);
2678			if (nexttrans==9) opt.slots = opt.width/20;
2679			if (nexttrans==10) opt.slots = opt.height/20;
2680
2681			// prepareOneSlideBox
2682			if (STA[5] == "box") {
2683				if (STA[7] !=null) prepareOneSlideBox(actsh,opt,STA[7]);
2684				if (STA[6] !=null) prepareOneSlideBox(nextsh,opt,STA[6]);
2685			} else
2686
2687			if (STA[5] == "vertical" || STA[5] == "horizontal") {
2688				if (STA[7] !=null) prepareOneSlideSlot(actsh,opt,STA[7],STA[5]);
2689				if (STA[6] !=null) prepareOneSlideSlot(nextsh,opt,STA[6],STA[5]);
2690			}
2691
2692
2693
2694			/////////////////////////////////////
2695			// THE SLOTSLIDE - TRANSITION I.  //
2696			////////////////////////////////////
2697			if (nexttrans==0) {								// BOXSLIDE
2698
2699
2700						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2701						var maxz = Math.ceil(opt.height/opt.sloth);
2702						var curz = 0;
2703						nextsh.find('.slotslide').each(function(j) {
2704							var ss=jQuery(this);
2705							curz=curz+1;
2706							if (curz==maxz) curz=0;
2707
2708							mtl.add(punchgs.TweenLite.from(ss,(masterspeed)/600,
2709												{opacity:0,top:(0-opt.sloth),left:(0-opt.slotw),rotation:opt.rotate,force3D:"auto",ease:punchgs.Power2.easeOut}),((j*15) + ((curz)*30))/1500);
2710						});
2711			}
2712			/////////////////////////////////////
2713			// THE SLOTSLIDE - TRANSITION I.  //
2714			////////////////////////////////////
2715			if (nexttrans==1) {
2716
2717						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2718						var maxtime,
2719							maxj = 0;
2720
2721						nextsh.find('.slotslide').each(function(j) {
2722							var ss=jQuery(this);
2723							rand=Math.random()*masterspeed+300;
2724							rand2=Math.random()*500+200;
2725							if (rand+rand2>maxtime) {
2726								maxtime = rand2+rand2;
2727								maxj = j;
2728							}
2729							mtl.add(punchgs.TweenLite.from(ss,rand/1000,
2730										{autoAlpha:0, force3D:"auto",rotation:opt.rotate,ease:punchgs.Power2.easeInOut}),rand2/1000);
2731						});
2732			}
2733
2734
2735			/////////////////////////////////////
2736			// THE SLOTSLIDE - TRANSITION I.  //
2737			////////////////////////////////////
2738			if (nexttrans==2) {
2739
2740						var subtl = new punchgs.TimelineLite();
2741						// ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
2742						actsh.find('.slotslide').each(function() {
2743							var ss=jQuery(this);
2744							subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,{left:opt.slotw, force3D:"auto",rotation:(0-opt.rotate)}),0);
2745							mtl.add(subtl,0);
2746						});
2747
2748						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2749						nextsh.find('.slotslide').each(function() {
2750							var ss=jQuery(this);
2751							subtl.add(punchgs.TweenLite.from(ss,masterspeed/1000,{left:0-opt.slotw, force3D:"auto",rotation:opt.rotate}),0);
2752							mtl.add(subtl,0);
2753						});
2754			}
2755
2756
2757
2758			/////////////////////////////////////
2759			// THE SLOTSLIDE - TRANSITION I.  //
2760			////////////////////////////////////
2761			if (nexttrans==3) {
2762						var subtl = new punchgs.TimelineLite();
2763
2764						// ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
2765						actsh.find('.slotslide').each(function() {
2766							var ss=jQuery(this);
2767							subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,{top:opt.sloth,rotation:opt.rotate,force3D:"auto",transformPerspective:600}),0);
2768							mtl.add(subtl,0);
2769
2770						});
2771
2772						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2773						nextsh.find('.slotslide').each(function() {
2774							var ss=jQuery(this);
2775							subtl.add(punchgs.TweenLite.from(ss,masterspeed/1000,{top:0-opt.sloth,rotation:opt.rotate,ease:punchgs.Power2.easeOut,force3D:"auto",transformPerspective:600}),0);
2776							mtl.add(subtl,0);
2777						});
2778			}
2779
2780
2781
2782			/////////////////////////////////////
2783			// THE SLOTSLIDE - TRANSITION I.  //
2784			////////////////////////////////////
2785			if (nexttrans==4 || nexttrans==5) {
2786
2787						setTimeout(function() {
2788							actsh.find('.defaultimg').css({opacity:0});
2789						},100);
2790
2791
2792						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2793						var cspeed = (masterspeed)/1000,
2794							ticker = cspeed,
2795							subtl = new punchgs.TimelineLite();
2796
2797						actsh.find('.slotslide').each(function(i) {
2798							var ss=jQuery(this);
2799							var del = (i*cspeed)/opt.slots;
2800							if (nexttrans==5) del = ((opt.slots-i-1)*cspeed)/(opt.slots)/1.5;
2801							subtl.add(punchgs.TweenLite.to(ss,cspeed*3,{transformPerspective:600,force3D:"auto",top:0+opt.height,opacity:0.5,rotation:opt.rotate,ease:punchgs.Power2.easeInOut,delay:del}),0);
2802							mtl.add(subtl,0);
2803						});
2804
2805						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2806						nextsh.find('.slotslide').each(function(i) {
2807							var ss=jQuery(this);
2808							var del = (i*cspeed)/opt.slots;
2809							if (nexttrans==5) del = ((opt.slots-i-1)*cspeed)/(opt.slots)/1.5;
2810							subtl.add(punchgs.TweenLite.from(ss,cspeed*3,
2811											{top:(0-opt.height),opacity:0.5,rotation:opt.rotate,force3D:"auto",ease:punchgs.Power2.easeInOut,delay:del}),0);
2812							mtl.add(subtl,0);
2813
2814						});
2815
2816
2817			}
2818
2819
2820
2821
2822			/////////////////////////////////////
2823			// THE SLOTSLIDE - TRANSITION I.  //
2824			////////////////////////////////////
2825			if (nexttrans==6) {
2826
2827
2828						if (opt.slots<2) opt.slots=2;
2829						if (opt.slots % 2) opt.slots = opt.slots+1;
2830
2831						var subtl = new punchgs.TimelineLite();
2832
2833						//SET DEFAULT IMG UNVISIBLE
2834						setTimeout(function() {
2835							actsh.find('.defaultimg').css({opacity:0});
2836						},100);
2837
2838						actsh.find('.slotslide').each(function(i) {
2839							var ss=jQuery(this);
2840							if (i+1<opt.slots/2)
2841								var tempo = (i+2)*90;
2842							else
2843								var tempo = (2+opt.slots-i)*90;
2844
2845							subtl.add(punchgs.TweenLite.to(ss,(masterspeed+tempo)/1000,{top:0+opt.height,opacity:1,force3D:"auto",rotation:opt.rotate,ease:punchgs.Power2.easeInOut}),0);
2846							mtl.add(subtl,0);
2847						});
2848
2849						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2850						nextsh.find('.slotslide').each(function(i) {
2851							var ss=jQuery(this);
2852
2853							if (i+1<opt.slots/2)
2854								var tempo = (i+2)*90;
2855							else
2856								var tempo = (2+opt.slots-i)*90;
2857
2858							subtl.add(punchgs.TweenLite.from(ss,(masterspeed+tempo)/1000,
2859													{top:(0-opt.height),opacity:1,force3D:"auto",rotation:opt.rotate,ease:punchgs.Power2.easeInOut}),0);
2860							mtl.add(subtl,0);
2861						});
2862			}
2863
2864
2865			////////////////////////////////////
2866			// THE SLOTSZOOM - TRANSITION II. //
2867			////////////////////////////////////
2868			if (nexttrans==7) {
2869
2870						masterspeed = masterspeed *2;
2871						var subtl = new punchgs.TimelineLite();
2872
2873						//SET DEFAULT IMG UNVISIBLE
2874						setTimeout(function() {
2875							actsh.find('.defaultimg').css({opacity:0});
2876						},100);
2877
2878						// ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
2879						actsh.find('.slotslide').each(function() {
2880							var ss=jQuery(this).find('div');
2881							subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,{
2882									left:(0-opt.slotw/2)+'px',
2883									top:(0-opt.height/2)+'px',
2884									width:(opt.slotw*2)+"px",
2885									height:(opt.height*2)+"px",
2886									opacity:0,
2887									rotation:opt.rotate,
2888									force3D:"auto",
2889									ease:punchgs.Power2.easeOut}),0);
2890							mtl.add(subtl,0);
2891
2892						});
2893
2894						//////////////////////////////////////////////////////////////
2895						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT //
2896						///////////////////////////////////////////////////////////////
2897						nextsh.find('.slotslide').each(function(i) {
2898							var ss=jQuery(this).find('div');
2899
2900							subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
2901										{left:0,top:0,opacity:0,transformPerspective:600},
2902										{left:(0-i*opt.slotw)+'px',
2903										 ease:punchgs.Power2.easeOut,
2904										 force3D:"auto",
2905									     top:(0)+'px',
2906									     width:opt.width,
2907									     height:opt.height,
2908										 opacity:1,rotation:0,
2909										 delay:0.1}),0);
2910							mtl.add(subtl,0);
2911						});
2912			}
2913
2914
2915
2916
2917			////////////////////////////////////
2918			// THE SLOTSZOOM - TRANSITION II. //
2919			////////////////////////////////////
2920			if (nexttrans==8) {
2921
2922						masterspeed = masterspeed * 3;
2923						var subtl = new punchgs.TimelineLite();
2924
2925
2926
2927						// ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT
2928						actsh.find('.slotslide').each(function() {
2929							var ss=jQuery(this).find('div');
2930							subtl.add(punchgs.TweenLite.to(ss,masterspeed/1000,
2931										  {left:(0-opt.width/2)+'px',
2932										   top:(0-opt.sloth/2)+'px',
2933										   width:(opt.width*2)+"px",
2934										   height:(opt.sloth*2)+"px",
2935										   force3D:"auto",
2936										   opacity:0,rotation:opt.rotate}),0);
2937							mtl.add(subtl,0);
2938
2939						});
2940
2941
2942						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT //
2943						///////////////////////////////////////////////////////////////
2944						nextsh.find('.slotslide').each(function(i) {
2945							var ss=jQuery(this).find('div');
2946
2947							subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
2948										  {left:0, top:0,opacity:0,force3D:"auto"},
2949										  {'left':(0)+'px',
2950										   'top':(0-i*opt.sloth)+'px',
2951										   'width':(nextsh.find('.defaultimg').data('neww'))+"px",
2952										   'height':(nextsh.find('.defaultimg').data('newh'))+"px",
2953										   opacity:1,rotation:0,
2954										   }),0);
2955							mtl.add(subtl,0);
2956						});
2957			}
2958
2959
2960			////////////////////////////////////////
2961			// THE SLOTSFADE - TRANSITION III.   //
2962			//////////////////////////////////////
2963			if (nexttrans==9 || nexttrans==10) {
2964
2965
2966
2967
2968						var ssamount=0;
2969						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2970						nextsh.find('.slotslide').each(function(i) {
2971							var ss=jQuery(this);
2972							ssamount++;
2973							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,{autoAlpha:0,force3D:"auto",transformPerspective:600},
2974																				 {autoAlpha:1,ease:punchgs.Power2.easeInOut,delay:(i*5)/1000}),0);
2975
2976						});
2977
2978
2979
2980
2981			}
2982
2983
2984			///////////////////////////
2985			// SIMPLE FADE ANIMATION //
2986			///////////////////////////
2987
2988			if (nexttrans==11 || nexttrans==26) {
2989
2990
2991						var ssamount=0;
2992						if (nexttrans==26) masterspeed=0;
2993
2994						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
2995						nextsh.find('.slotslide').each(function(i) {
2996							var ss=jQuery(this);
2997							mtl.add(punchgs.TweenLite.from(ss,masterspeed/1000,{autoAlpha:0,force3D:"auto",ease:punchgs.Power2.easeInOut}),0);
2998						});
2999
3000
3001			}
3002
3003
3004
3005
3006
3007
3008			if (nexttrans==12 || nexttrans==13 || nexttrans==14 || nexttrans==15) {
3009
3010						//masterspeed = masterspeed * 3;
3011						masterspeed = 1000;
3012
3013						setTimeout(function() {
3014							punchgs.TweenLite.set(actsh.find('.defaultimg'),{autoAlpha:0});
3015
3016						},100);
3017
3018						var oow = opt.width;
3019						var ooh = opt.height;
3020
3021
3022						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
3023						var ssn=nextsh.find('.slotslide')
3024
3025
3026
3027						if (opt.fullWidth=="on" || opt.fullScreen=="on") {
3028							oow=ssn.width();
3029							ooh=ssn.height();
3030						}
3031						var twx = 0;
3032						var twy = 0;
3033
3034
3035
3036						if (nexttrans==12)
3037							twx = oow;
3038						else
3039						if (nexttrans==15)
3040							twx = 0-oow;
3041						else
3042						if (nexttrans==13)
3043							twy = ooh;
3044						else
3045						if (nexttrans==14)
3046							twy = 0-ooh;
3047
3048						// SPECIALS FOR EXTENDED ANIMATIONS
3049						var op = 1;
3050						var scal = 1;
3051						var fromscale = 1;
3052						var easeitout = punchgs.Power2.easeInOut;
3053						var easeitin = punchgs.Power2.easeInOut;
3054						var speedy = masterspeed/1000;
3055						var speedy2 = speedy;
3056
3057						// DEPENDING ON EXTENDED SPECIALS, DIFFERENT SCALE AND OPACITY FUNCTIONS NEED TO BE ADDED
3058						if (specials == 1) op = 0;
3059						if (specials == 2) op = 0;
3060						if (specials == 3) {
3061								easeitout = punchgs.Power2.easeInOut;
3062								easeitin = punchgs.Power1.easeInOut;
3063								speedy = masterspeed / 1200;
3064						}
3065
3066						if (specials==4 || specials==5)
3067							scal=0.6;
3068						if (specials==6 )
3069							scal=1.4;
3070
3071
3072						if (specials==5 || specials==6) {
3073						    fromscale=1.4;
3074						    op=0;
3075						    oow=0;
3076						    ooh=0;twx=0;twy=0;
3077						 }
3078						if (specials==6) fromscale=0.6;
3079						var dd = 0;
3080
3081
3082
3083						mtl.add(punchgs.TweenLite.from(ssn,speedy,
3084										{left:twx, top:twy, scale:fromscale, opacity:op,rotation:opt.rotate,ease:easeitin,force3D:"auto"}),0);
3085
3086
3087						var ssa=actsh.find('.slotslide');
3088
3089						if (specials==4 || specials==5) {
3090							oow = 0; ooh=0;
3091						}
3092
3093						if (specials!=1) {
3094								if (nexttrans==12)
3095									mtl.add(punchgs.TweenLite.to(ssa,speedy2,{'left':(0-oow)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}),0);
3096								else
3097								if (nexttrans==15)
3098									mtl.add(punchgs.TweenLite.to(ssa,speedy2,{'left':(oow)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}),0);
3099								else
3100								if (nexttrans==13)
3101									mtl.add(punchgs.TweenLite.to(ssa,speedy2,{'top':(0-ooh)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}),0);
3102								else
3103								if (nexttrans==14)
3104									mtl.add(punchgs.TweenLite.to(ssa,speedy2,{'top':(ooh)+'px',force3D:"auto",scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}),0);
3105						}
3106
3107
3108			}
3109
3110
3111			//////////////////////////////////////
3112			// THE SLOTSLIDE - TRANSITION XVI.  //
3113			//////////////////////////////////////
3114			if (nexttrans==16) {						// PAPERCUT
3115
3116
3117					var subtl = new punchgs.TimelineLite();
3118					mtl.add(punchgs.TweenLite.set(actli,{'position':'absolute','z-index':20}),0);
3119					mtl.add(punchgs.TweenLite.set(nextli,{'position':'absolute','z-index':15}),0);
3120
3121
3122					// PREPARE THE CUTS
3123					actli.wrapInner('<div class="tp-half-one" style="position:relative; width:100%;height:100%"></div>');
3124
3125					actli.find('.tp-half-one').clone(true).appendTo(actli).addClass("tp-half-two");
3126					actli.find('.tp-half-two').removeClass('tp-half-one');
3127
3128					var oow = opt.width;
3129					var ooh = opt.height;
3130					if (opt.autoHeight=="on")
3131						ooh = container.height();
3132
3133
3134					actli.find('.tp-half-one .defaultimg').wrap('<div class="tp-papercut" style="width:'+oow+'px;height:'+ooh+'px;"></div>')
3135					actli.find('.tp-half-two .defaultimg').wrap('<div class="tp-papercut" style="width:'+oow+'px;height:'+ooh+'px;"></div>')
3136					actli.find('.tp-half-two .defaultimg').css({position:'absolute',top:'-50%'});
3137					actli.find('.tp-half-two .tp-caption').wrapAll('<div style="position:absolute;top:-50%;left:0px;"></div>');
3138
3139					mtl.add(punchgs.TweenLite.set(actli.find('.tp-half-two'),
3140					                 {width:oow,height:ooh,overflow:'hidden',zIndex:15,position:'absolute',top:ooh/2,left:'0px',transformPerspective:600,transformOrigin:"center bottom"}),0);
3141
3142					mtl.add(punchgs.TweenLite.set(actli.find('.tp-half-one'),
3143					                 {width:oow,height:ooh/2,overflow:'visible',zIndex:10,position:'absolute',top:'0px',left:'0px',transformPerspective:600,transformOrigin:"center top"}),0);
3144
3145
3146
3147					// ANIMATE THE CUTS
3148					var img=actli.find('.defaultimg');
3149
3150
3151					var ro1=Math.round(Math.random()*20-10),
3152						ro2=Math.round(Math.random()*20-10),
3153						ro3=Math.round(Math.random()*20-10),
3154						xof = Math.random()*0.4-0.2,
3155						yof = Math.random()*0.4-0.2,
3156						sc1=Math.random()*1+1,
3157						sc2=Math.random()*1+1,
3158						sc3=Math.random()*0.3+0.3;
3159
3160					mtl.add(punchgs.TweenLite.set(actli.find('.tp-half-one'),{overflow:'hidden'}),0);
3161					mtl.add(punchgs.TweenLite.fromTo(actli.find('.tp-half-one'),masterspeed/800,
3162					                 {width:oow,height:ooh/2,position:'absolute',top:'0px',left:'0px',force3D:"auto",transformOrigin:"center top"},
3163					                 {scale:sc1,rotation:ro1,y:(0-ooh-ooh/4),autoAlpha:0,ease:punchgs.Power2.easeInOut}),0);
3164					mtl.add(punchgs.TweenLite.fromTo(actli.find('.tp-half-two'),masterspeed/800,
3165					                 {width:oow,height:ooh,overflow:'hidden',position:'absolute',top:ooh/2,left:'0px',force3D:"auto",transformOrigin:"center bottom"},
3166					                 {scale:sc2,rotation:ro2,y:ooh+ooh/4,ease:punchgs.Power2.easeInOut,autoAlpha:0,onComplete:function() {
3167						                // CLEAN UP
3168										punchgs.TweenLite.set(actli,{'position':'absolute','z-index':15});
3169										punchgs.TweenLite.set(nextli,{'position':'absolute','z-index':20});
3170										if (actli.find('.tp-half-one').length>0)  {
3171											actli.find('.tp-half-one .defaultimg').unwrap();
3172											actli.find('.tp-half-one .slotholder').unwrap();
3173										}
3174										actli.find('.tp-half-two').remove();
3175					                 }}),0);
3176
3177					subtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{autoAlpha:1}),0);
3178
3179					if (actli.html()!=null)
3180						mtl.add(punchgs.TweenLite.fromTo(nextli,(masterspeed-200)/1000,
3181														{scale:sc3,x:(opt.width/4)*xof, y:(ooh/4)*yof,rotation:ro3,force3D:"auto",transformOrigin:"center center",ease:punchgs.Power2.easeOut},
3182														{autoAlpha:1,scale:1,x:0,y:0,rotation:0}),0);
3183
3184					mtl.add(subtl,0);
3185
3186
3187			}
3188
3189			////////////////////////////////////////
3190			// THE SLOTSLIDE - TRANSITION XVII.  //
3191			///////////////////////////////////////
3192			if (nexttrans==17) {								// 3D CURTAIN HORIZONTAL
3193
3194
3195						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
3196
3197						nextsh.find('.slotslide').each(function(j) {
3198							var ss=jQuery(this);
3199
3200							mtl.add(punchgs.TweenLite.fromTo(ss,(masterspeed)/800,
3201											{opacity:0,rotationY:0,scale:0.9,rotationX:-110,force3D:"auto",transformPerspective:600,transformOrigin:"center center"},
3202											{opacity:1,top:0,left:0,scale:1,rotation:0,rotationX:0,force3D:"auto",rotationY:0,ease:punchgs.Power3.easeOut,delay:j*0.06}),0);
3203
3204						});
3205			}
3206
3207
3208
3209			////////////////////////////////////////
3210			// THE SLOTSLIDE - TRANSITION XVIII.  //
3211			///////////////////////////////////////
3212			if (nexttrans==18) {								// 3D CURTAIN VERTICAL
3213
3214						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
3215						nextsh.find('.slotslide').each(function(j) {
3216							var ss=jQuery(this);
3217
3218							mtl.add(punchgs.TweenLite.fromTo(ss,(masterspeed)/500,
3219											{autoAlpha:0,rotationY:310,scale:0.9,rotationX:10,force3D:"auto",transformPerspective:600,transformOrigin:"center center"},
3220											{autoAlpha:1,top:0,left:0,scale:1,rotation:0,rotationX:0,force3D:"auto",rotationY:0,ease:punchgs.Power3.easeOut,delay:j*0.06}),0);
3221						});
3222
3223
3224
3225			}
3226
3227
3228			////////////////////////////////////////
3229			// THE SLOTSLIDE - TRANSITION XIX.  //
3230			///////////////////////////////////////
3231
3232
3233			if (nexttrans==19 || nexttrans==22) {								// IN CUBE
3234
3235
3236						var subtl = new punchgs.TimelineLite();
3237						//SET DEFAULT IMG UNVISIBLE
3238
3239						mtl.add(punchgs.TweenLite.set(actli,{zIndex:20}),0);
3240						mtl.add(punchgs.TweenLite.set(nextli,{zIndex:20}),0);
3241						setTimeout(function() {
3242							actsh.find('.defaultimg').css({opacity:0});
3243						},100);
3244						var chix=nextli.css('z-index'),
3245							chix2=actli.css('z-index'),
3246							rot = 90,
3247							op = 1;
3248
3249						if (direction==1) rot = -90;
3250
3251						if (nexttrans==19) {
3252							var torig = "center center -"+opt.height/2;
3253							op=0;
3254
3255						} else {
3256							var torig = "center center "+opt.height/2;
3257
3258						}
3259
3260						// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
3261						punchgs.TweenLite.set(container,{transformStyle:"flat",backfaceVisibility:"hidden",transformPerspective:600});
3262
3263						nextsh.find('.slotslide').each(function(j) {
3264							var ss=jQuery(this);
3265
3266							subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3267											{transformStyle:"flat",backfaceVisibility:"hidden",left:0,rotationY:opt.rotate,z:10,top:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig,rotationX:rot},
3268											{left:0,rotationY:0,top:0,z:0, scale:1,force3D:"auto",rotationX:0, delay:(j*50)/1000,ease:punchgs.Power2.easeInOut}),0);
3269							subtl.add(punchgs.TweenLite.to(ss,0.1,{autoAlpha:1,delay:(j*50)/1000}),0);
3270							mtl.add(subtl);
3271						});
3272
3273						actsh.find('.slotslide').each(function(j) {
3274							var ss=jQuery(this);
3275							var rot = -90;
3276							if (direction==1) rot = 90;
3277
3278							subtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3279											{transformStyle:"flat",backfaceVisibility:"hidden",autoAlpha:1,rotationY:0,top:0,z:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig, rotationX:0},
3280											{autoAlpha:1,rotationY:opt.rotate,top:0,z:10, scale:1,rotationX:rot, delay:(j*50)/1000,force3D:"auto",ease:punchgs.Power2.easeInOut}),0);
3281
3282							mtl.add(subtl);
3283						});
3284			}
3285
3286
3287
3288
3289			////////////////////////////////////////
3290			// THE SLOTSLIDE - TRANSITION XX.  //
3291			///////////////////////////////////////
3292			if (nexttrans==20 ) {								// FLYIN
3293
3294
3295						setTimeout(function() {
3296							actsh.find('.defaultimg').css({opacity:0});
3297						},100);
3298						var chix=nextli.css('z-index');
3299						var chix2=actli.css('z-index');
3300
3301						if (direction==1) {
3302						   var ofx = -opt.width
3303						   var rot  =70;
3304						   var torig = "left center -"+opt.height/2;
3305						} else {
3306							var ofx = opt.width;
3307							var rot = -70;
3308							var torig = "right center -"+opt.height/2;
3309						}
3310
3311
3312						nextsh.find('.slotslide').each(function(j) {
3313							var ss=jQuery(this);
3314
3315							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1500,
3316											{left:ofx,rotationX:40,z:-600, opacity:op,top:0,force3D:"auto",transformPerspective:600,transformOrigin:torig,rotationY:rot},
3317											{left:0, delay:(j*50)/1000,ease:punchgs.Power2.easeInOut}),0);
3318
3319							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3320											{rotationX:40,z:-600, opacity:op,top:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig,rotationY:rot},
3321											{rotationX:0,opacity:1,top:0,z:0, scale:1,rotationY:0, delay:(j*50)/1000,ease:punchgs.Power2.easeInOut}),0);
3322
3323							mtl.add(punchgs.TweenLite.to(ss,0.1,{opacity:1,force3D:"auto",delay:(j*50)/1000+masterspeed/2000}),0);
3324
3325						});
3326						actsh.find('.slotslide').each(function(j) {
3327							var ss=jQuery(this);
3328
3329							if (direction!=1) {
3330							   var ofx = -opt.width
3331							   var rot  =70;
3332							   var torig = "left center -"+opt.height/2;
3333							} else {
3334								var ofx = opt.width;
3335								var rot = -70;
3336								var torig = "right center -"+opt.height/2;
3337							}
3338							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3339											{opacity:1,rotationX:0,top:0,z:0,scale:1,left:0, force3D:"auto",transformPerspective:600,transformOrigin:torig, rotationY:0},
3340											{opacity:1,rotationX:40,top:0, z:-600, left:ofx, force3D:"auto",scale:0.8,rotationY:rot, delay:(j*50)/1000,ease:punchgs.Power2.easeInOut}),0);
3341							mtl.add(punchgs.TweenLite.to(ss,0.1,{force3D:"auto",opacity:0,delay:(j*50)/1000+(masterspeed/1000 - (masterspeed/10000))}),0);
3342						});
3343			}
3344
3345			////////////////////////////////////////
3346			// THE SLOTSLIDE - TRANSITION XX.  //
3347			///////////////////////////////////////
3348			if (nexttrans==21 || nexttrans==25) {								// TURNOFF
3349
3350
3351						//SET DEFAULT IMG UNVISIBLE
3352
3353						setTimeout(function() {
3354							actsh.find('.defaultimg').css({opacity:0});
3355						},100);
3356						var chix=nextli.css('z-index');
3357						var chix2=actli.css('z-index');
3358
3359						if (direction==1) {
3360						   var ofx = -opt.width
3361						   var rot  =90;
3362
3363						   if (nexttrans==25) {
3364						   	 var torig = "center top 0"
3365						   	 rot2 = -rot;
3366						   	 rot = opt.rotate;
3367						   } else {
3368						     var torig = "left center 0";
3369						     rot2 = opt.rotate;
3370						   }
3371
3372						} else {
3373							var ofx = opt.width;
3374							var rot = -90;
3375							if (nexttrans==25) {
3376						   	 var torig = "center bottom 0"
3377						   	 rot2 = -rot;
3378						   	 rot = opt.rotate;
3379						   } else {
3380						     var torig = "right center 0";
3381						     rot2 = opt.rotate;
3382						   }
3383						}
3384
3385
3386						nextsh.find('.slotslide').each(function(j) {
3387							var ss=jQuery(this);
3388
3389
3390							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3391											{left:0,transformStyle:"flat",rotationX:rot2,z:0, autoAlpha:0,top:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig,rotationY:rot},
3392											{left:0,rotationX:0,top:0,z:0, autoAlpha:1,scale:1,rotationY:0,force3D:"auto", ease:punchgs.Power3.easeInOut}),0);
3393						});
3394
3395
3396
3397						if (direction!=1) {
3398						   var ofx = -opt.width
3399						   var rot  = 90;
3400
3401						   if (nexttrans==25) {
3402						   	 var torig = "center top 0"
3403						   	 rot2 = -rot;
3404						   	 rot = opt.rotate;
3405						   } else {
3406						     var torig = "left center 0";
3407						     rot2 = opt.rotate;
3408						   }
3409
3410						} else {
3411							var ofx = opt.width;
3412							var rot = -90;
3413							if (nexttrans==25) {
3414						   	 var torig = "center bottom 0"
3415						   	 rot2 = -rot;
3416						   	 rot = opt.rotate;
3417						   } else {
3418						     var torig = "right center 0";
3419						     rot2 = opt.rotate;
3420						   }
3421						}
3422
3423						actsh.find('.slotslide').each(function(j) {
3424							var ss=jQuery(this);
3425							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3426											{left:0,transformStyle:"flat",rotationX:0,z:0, autoAlpha:1,top:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig,rotationY:0},
3427											{left:0,rotationX:rot2,top:0,z:0,autoAlpha:1,force3D:"auto", scale:1,rotationY:rot,ease:punchgs.Power1.easeInOut}),0);
3428						});
3429			}
3430
3431
3432
3433			////////////////////////////////////////
3434			// THE SLOTSLIDE - TRANSITION XX.  //
3435			///////////////////////////////////////
3436			if (nexttrans==23 || nexttrans == 24) {								// cube-horizontal - inboxhorizontal
3437
3438
3439						//SET DEFAULT IMG UNVISIBLE
3440						setTimeout(function() {
3441							actsh.find('.defaultimg').css({opacity:0});
3442						},100);
3443						var chix=nextli.css('z-index');
3444						var chix2=actli.css('z-index');
3445
3446						var rot = -90;
3447						if (direction==1)
3448							  rot = 90;
3449
3450						var op = 1;
3451
3452
3453						if (nexttrans==23) {
3454							var torig = "center center -"+opt.width/2;
3455							op=0;
3456
3457						} else {
3458							var torig = "center center "+opt.width/2;
3459
3460						}
3461
3462
3463						var opx=0;
3464						punchgs.TweenLite.set(container,{transformStyle:"preserve-3d",backfaceVisibility:"hidden",perspective:2500});
3465										nextsh.find('.slotslide').each(function(j) {
3466							var ss=jQuery(this);
3467
3468							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3469											{left:opx,rotationX:opt.rotate,force3D:"auto",opacity:op,top:0,scale:1,transformPerspective:600,transformOrigin:torig,rotationY:rot},
3470											{left:0,rotationX:0,autoAlpha:1,top:0,z:0, scale:1,rotationY:0, delay:(j*50)/500,ease:punchgs.Power2.easeInOut}),0);
3471
3472
3473						});
3474
3475						rot = 90;
3476						if (direction==1)
3477							  rot = -90;
3478
3479
3480
3481
3482						actsh.find('.slotslide').each(function(j) {
3483							var ss=jQuery(this);
3484							mtl.add(punchgs.TweenLite.fromTo(ss,masterspeed/1000,
3485											{left:0,autoAlpha:1,rotationX:0,top:0,z:0,scale:1,force3D:"auto",transformPerspective:600,transformOrigin:torig, rotationY:0},
3486											{left:opx,autoAlpha:1,rotationX:opt.rotate,top:0, scale:1,rotationY:rot, delay:(j*50)/500,ease:punchgs.Power2.easeInOut}),0);
3487
3488
3489
3490						});
3491								}
3492
3493
3494			// SHOW FIRST LI && ANIMATE THE CAPTIONS
3495			mtl.pause();
3496			animateTheCaptions(nextli, opt,null,mtl);
3497			punchgs.TweenLite.to(nextli,0.001,{autoAlpha:1});
3498
3499
3500			var data={};
3501			data.slideIndex=opt.next+1;
3502			data.slide = nextli;
3503			container.trigger('revolution.slide.onchange',data);
3504			setTimeout(function() { container.trigger('revolution.slide.onafterswap'); },masterspeed);
3505			container.trigger('revolution.slide.onvideostop');
3506
3507		}
3508
3509
3510
3511
3512
3513
3514		/**************************************
3515			-	GIVE FREE THE TRANSITIOSN	-
3516		**************************************/
3517		var letItFree = function(container,opt,nextsh,actsh,nextli,actli,mtl) {
3518					punchgs.TweenLite.to(nextsh.find('.defaultimg'),0.001,{autoAlpha:1,onComplete:function() {
3519						removeSlots(container,opt,nextli);
3520					}});
3521					if (nextli.index()!=actli.index()) {
3522						punchgs.TweenLite.to(actli,0.2,{autoAlpha:0,onComplete:function() {
3523							removeSlots(container,opt,actli);
3524						}});
3525					}
3526					opt.act=opt.next;
3527					if (opt.navigationType=="thumb") moveSelectedThumb(container);
3528					if (nextsh.data('kenburns')=="on") {
3529						startKenBurn(container,opt);
3530					}
3531					container.find('.current-sr-slide-visible').removeClass("current-sr-slide-visible");
3532					nextli.addClass("current-sr-slide-visible");
3533					if (opt.parallax=="scroll" || opt.parallax=="scroll+mouse" || opt.parallax=="mouse+scroll") {
3534								scrollParallax(container,opt);
3535					}
3536
3537					mtl.clear();
3538
3539			}
3540
3541
3542		//////////////////////////////////////////
3543		// CHANG THE YOUTUBE PLAYER STATE HERE //
3544		////////////////////////////////////////
3545		var  onPlayerStateChange = function(event) {
3546
3547
3548			 var embedCode = event.target.getVideoEmbedCode();
3549			 var ytcont = jQuery('#'+embedCode.split('id="')[1].split('"')[0])
3550			 var container = ytcont.closest('.tp-simpleresponsive');
3551			 var player = ytcont.parent().data('player');
3552
3553			if (event.data == YT.PlayerState.PLAYING) {
3554
3555				var bt = container.find('.tp-bannertimer');
3556				var opt = bt.data('opt');
3557
3558
3559				if (ytcont.closest('.tp-caption').data('volume')=="mute")
3560					  player.mute();
3561
3562
3563				opt.videoplaying=true;
3564				container.trigger('stoptimer');
3565				container.trigger('revolution.slide.onvideoplay');
3566
3567
3568			} else {
3569
3570				var bt = container.find('.tp-bannertimer');
3571				var opt = bt.data('opt');
3572
3573				if ((event.data!=-1 && event.data!=3)) {
3574
3575					opt.videoplaying=false;
3576					container.trigger('starttimer');
3577					container.trigger('revolution.slide.onvideostop');
3578
3579				}
3580
3581				if (event.data==0 && opt.nextslideatend==true)
3582					opt.container.revnext();
3583				else {
3584
3585					opt.videoplaying=false;
3586					container.trigger('starttimer');
3587					container.trigger('revolution.slide.onvideostop');
3588				}
3589
3590			}
3591
3592
3593
3594		  }
3595
3596
3597
3598		 ////////////////////////
3599		// VIMEO ADD EVENT /////
3600		////////////////////////
3601		var addEvent = function(element, eventName, callback) {
3602
3603					if (element.addEventListener)  element.addEventListener(eventName, callback, false);
3604						else
3605					element.attachEvent(eventName, callback, false);
3606		}
3607
3608
3609
3610		/////////////////////////////////////
3611		// EVENT HANDLING FOR VIMEO VIDEOS //
3612		/////////////////////////////////////
3613
3614		var vimeoready_auto = function(player_id,autoplay) {
3615
3616			var froogaloop = $f(player_id),
3617				vimcont = jQuery('#'+player_id),
3618				container = vimcont.closest('.tp-simpleresponsive'),
3619				nextcaption = vimcont.closest('.tp-caption');
3620
3621			setTimeout(function() {
3622				froogaloop.addEvent('ready', function(data) {
3623						if(autoplay) froogaloop.api('play');
3624
3625
3626							froogaloop.addEvent('play', function(data) {
3627								var bt = container.find('.tp-bannertimer');
3628								var opt = bt.data('opt');
3629
3630								opt.videoplaying=true;
3631								container.trigger('stoptimer');
3632								if (nextcaption.data('volume')=="mute")
3633								  froogaloop.api('setVolume',"0");
3634							});
3635
3636							froogaloop.addEvent('finish', function(data) {
3637									var bt = container.find('.tp-bannertimer');
3638									var opt = bt.data('opt');
3639									opt.videoplaying=false;
3640									container.trigger('starttimer');
3641
3642									container.trigger('revolution.slide.onvideoplay'); //opt.videostartednow=1;
3643									if (opt.nextslideatend==true)
3644										opt.container.revnext();
3645
3646							});
3647
3648							froogaloop.addEvent('pause', function(data) {
3649									var bt = container.find('.tp-bannertimer');
3650									var opt = bt.data('opt');
3651									opt.videoplaying=false;
3652									container.trigger('starttimer');
3653									container.trigger('revolution.slide.onvideostop'); //opt.videostoppednow=1;
3654							});
3655
3656						// PLAY VIDEO IF THUMBNAIL HAS BEEN CLICKED
3657						 nextcaption.find('.tp-thumb-image').click(function() {
3658							 punchgs.TweenLite.to(jQuery(this),0.3,{autoAlpha:0,force3D:"auto",ease:punchgs.Power3.easeInOut})
3659							 froogaloop.api("play");
3660						 })
3661					});
3662				},150);
3663			}
3664
3665
3666
3667			/////////////////////////////////////
3668			// RESIZE HTML5VIDEO FOR FULLSCREEN//
3669			/////////////////////////////////////
3670			var updateHTML5Size = function(pc,container) {
3671					var windowW = container.width();
3672					var windowH = container.height();
3673					var mediaAspect = pc.data('mediaAspect');
3674					if (mediaAspect == undefined) mediaAspect = 1;
3675
3676
3677					var windowAspect = windowW/windowH;
3678
3679					pc.css({position:"absolute"});
3680					var video = pc.find('video');
3681
3682
3683					if (windowAspect < mediaAspect) {
3684						// taller
3685						punchgs.TweenLite.to(pc,0.0001,{width:windowH*mediaAspect,force3D:"auto",top:0,
3686												left:0-(windowH*mediaAspect-windowW)/2,
3687												height:windowH});
3688
3689					} else {
3690						// wider
3691						punchgs.TweenLite.to(pc,0.0001,{width:windowW,force3D:"auto",top:0-(windowW/mediaAspect-windowH)/2,
3692												left:0,
3693												height:windowW/mediaAspect});
3694					}
3695				}
3696
3697
3698
3699				/////////////////////////////////////
3700				//	-	CREATE ANIMATION OBJECT	-  //
3701				/////////////////////////////////////
3702				var newAnimObject = function() {
3703										var a = new Object();
3704										a.x=0;
3705										a.y=0;
3706										a.rotationX = 0;
3707										a.rotationY = 0;
3708										a.rotationZ = 0;
3709										a.scale = 1;
3710										a.scaleX = 1;
3711										a.scaleY = 1;
3712										a.skewX = 0;
3713										a.skewY = 0;
3714										a.opacity=0;
3715										a.transformOrigin = "center, center";
3716										a.transformPerspective = 400;
3717										a.rotation = 0;
3718										return a;
3719									}
3720
3721				///////////////////////////////////////////////////
3722				// ANALYSE AND READ OUT DATAS FROM HTML CAPTIONS //
3723				///////////////////////////////////////////////////
3724				var getAnimDatas = function(frm,data) {
3725
3726									var customarray = data.split(';');
3727									jQuery.each(customarray,function(index,param) {
3728
3729										param = param.split(":")
3730
3731										var w = param[0],
3732											v = param[1];
3733										if (w=="rotationX") frm.rotationX = parseInt(v,0);
3734										if (w=="rotationY") frm.rotationY = parseInt(v,0);
3735										if (w=="rotationZ") frm.rotationZ = parseInt(v,0);
3736										if (w=="rotationZ") frm.rotation = parseInt(v,0);
3737										if (w=="scaleX")  frm.scaleX = parseFloat(v);
3738										if (w=="scaleY")  frm.scaleY = parseFloat(v);
3739										if (w=="opacity") frm.opacity = parseFloat(v);
3740										if (w=="skewX")   frm.skewX = parseInt(v,0);
3741										if (w=="skewY")   frm.skewY = parseInt(v,0);
3742										if (w=="x") frm.x = parseInt(v,0);
3743										if (w=="y") frm.y = parseInt(v,0);
3744										if (w=="z") frm.z = parseInt(v,0);
3745										if (w=="transformOrigin") frm.transformOrigin = v.toString();
3746										if (w=="transformPerspective") frm.transformPerspective=parseInt(v,0);
3747									})
3748
3749									return frm;
3750								}
3751				///////////////////////////////////////////////////////////////////
3752				// ANALYSE AND READ OUT DATAS FROM HTML CAPTIONS ANIMATION STEPS //
3753				///////////////////////////////////////////////////////////////////
3754				var getAnimSteps = function(data) {
3755
3756						var paramarray = data.split("animation:");
3757						var params = new Object();
3758
3759						params.animation = getAnimDatas(newAnimObject(),paramarray[1]);
3760						var customarray = paramarray[0].split(';');
3761
3762						jQuery.each(customarray,function(index,param) {
3763							param = param.split(":")
3764							var w = param[0],
3765								v = param[1];
3766							if (w=="typ") params.typ = v;
3767							if (w=="speed") params.speed = parseInt(v,0)/1000;
3768							if (w=="start") params.start = parseInt(v,0)/1000;
3769							if (w=="elementdelay")  params.elementdelay = parseFloat(v);
3770							if (w=="ease")  params.ease = v;
3771						})
3772
3773					return params;
3774				}
3775
3776
3777
3778
3779				////////////////////////
3780				// SHOW THE CAPTION  //
3781				///////////////////////
3782				var animateTheCaptions = function(nextli, opt,recalled,mtl) {
3783
3784						if (nextli.data('ctl')==undefined) {
3785							nextli.data('ctl',new punchgs.TimelineLite());
3786						}
3787
3788						var ctl = nextli.data('ctl'),
3789							offsetx=0,
3790							offsety=0,
3791							allcaptions = nextli.find('.tp-caption'),
3792							allstaticcaptions = opt.container.find('.tp-static-layers').find('.tp-caption');
3793
3794						ctl.pause();
3795
3796						jQuery.each(allstaticcaptions, function(index,staticcapt) {
3797							allcaptions.push(staticcapt);
3798						});
3799
3800						allcaptions.each(function(i) {
3801								var internrecalled = recalled,
3802							    	staticdirection = -1,	// 1 -> In,  2-> Out  0-> Ignore  -1-> Not Static
3803									nextcaption=jQuery(this);
3804
3805								if (nextcaption.hasClass("tp-static-layer")) {
3806										var nss = nextcaption.data('startslide'),
3807											nes = nextcaption.data('endslide');
3808
3809									if ( nss == -1 || nss == "-1")
3810										nextcaption.data('startslide',0);
3811
3812									if ( nes== -1 || nes == "-1")
3813										nextcaption.data('endslide',opt.slideamount);
3814
3815									if (nss==0 && nes==opt.slideamount-1)
3816										nextcaption.data('endslide',opt.slideamount+1);
3817
3818
3819									// RESET SETTIGNS AFTER SETTING THEM AGAIN
3820									nss = nextcaption.data('startslide'),
3821									nes = nextcaption.data('endslide');
3822
3823
3824									// IF STATIC ITEM CURRENTLY NOT VISIBLE
3825									if (!nextcaption.hasClass("tp-is-shown")) {
3826										// IF ITEM SHOULD BECOME VISIBLE
3827
3828
3829										if ((nss<=opt.next && nes>=opt.next) ||
3830											(nss == opt.next) || (nes == opt.next)){
3831
3832												nextcaption.addClass("tp-is-shown");
3833												staticdirection = 1;
3834										} else {
3835
3836											staticdirection = 0;
3837										}
3838									// IF STATIC ITEM ALREADY VISIBLE
3839									} else {
3840										if ((nes==opt.next) ||
3841											(nss > opt.next) ||
3842											(nes < opt.next)) {
3843
3844											staticdirection = 2;
3845											//nextcaption.removeClass("tp-is-shown");
3846										} else {
3847											staticdirection = 0;
3848										}
3849
3850									}
3851
3852									//if (staticdirection==2) staticdirection = 0;
3853
3854								}
3855
3856								offsetx = opt.width/2 - (opt.startwidth*opt.bw)/2;
3857
3858								var xbw = opt.bw;
3859								var xbh = opt.bh;
3860
3861								if (opt.fullScreen=="on")
3862									  offsety = opt.height/2 - (opt.startheight*opt.bh)/2;
3863
3864								if (opt.autoHeight=="on" || (opt.minHeight!=undefined && opt.minHeight>0))
3865									  offsety = opt.container.height()/2 - (opt.startheight*opt.bh)/2;;
3866									  
3867
3868								if (offsety<0) offsety=0;
3869
3870
3871
3872								var handlecaption=0;
3873
3874								// HIDE CAPTION IF RESOLUTION IS TOO LOW
3875								if (opt.width<opt.hideCaptionAtLimit && nextcaption.data('captionhidden')=="on") {
3876									nextcaption.addClass("tp-hidden-caption")
3877									handlecaption=1;
3878								} else {
3879									if (opt.width<opt.hideAllCaptionAtLimit || opt.width<opt.hideAllCaptionAtLilmit)	{
3880										nextcaption.addClass("tp-hidden-caption")
3881										handlecaption=1;
3882									} else {
3883										nextcaption.removeClass("tp-hidden-caption")
3884									}
3885								}
3886
3887
3888
3889								if (handlecaption==0) {
3890
3891									// ADD A CLICK LISTENER TO THE CAPTION
3892									if (nextcaption.data('linktoslide')!=undefined && !nextcaption.hasClass("hasclicklistener")) {
3893										nextcaption.addClass("hasclicklistener")
3894										nextcaption.css({'cursor':'pointer'});
3895										if (nextcaption.data('linktoslide')!="no") {
3896											nextcaption.click(function() {
3897												var nextcaption=jQuery(this);
3898												var dir = nextcaption.data('linktoslide');
3899												if (dir!="next" && dir!="prev") {
3900													opt.container.data('showus',dir);
3901													opt.container.parent().find('.tp-rightarrow').click();
3902												} else
3903													if (dir=="next")
3904														opt.container.parent().find('.tp-rightarrow').click();
3905												else
3906													if (dir=="prev")
3907														opt.container.parent().find('.tp-leftarrow').click();
3908											});
3909										}
3910									}// END OF CLICK LISTENER
3911
3912
3913									if (offsetx<0) offsetx=0;
3914
3915
3916									if (nextcaption.hasClass("tp-videolayer") || nextcaption.find('iframe').length>0 || nextcaption.find('video').length>0 ) {
3917
3918										// YOUTUBE AND VIMEO LISTENRES INITIALISATION
3919										var frameID = "iframe"+Math.round(Math.random()*100000+1),
3920											vidw = nextcaption.data("videowidth"),
3921											vidh = nextcaption.data("videoheight"),
3922											vida = nextcaption.data("videoattributes"),
3923											vidytid = nextcaption.data('ytid'),
3924											vimeoid = nextcaption.data('vimeoid'),
3925											videopreload = nextcaption.data('videpreload'),
3926											videomp = nextcaption.data('videomp4'),
3927											videowebm = nextcaption.data('videowebm'),
3928											videocontrols = nextcaption.data('videocontrols'),
3929											httpprefix = "http",
3930											videoloop = nextcaption.data('videoloop')=="loop" ? "loop" : nextcaption.data('videoloop')=="loopandnoslidestop" ? "loop" : "";
3931
3932										if (nextcaption.data('thumbimage')!=undefined && nextcaption.data('videoposter')==undefined)
3933											nextcaption.data('videoposter',nextcaption.data('thumbimage'))
3934
3935										// ADD YOUTUBE IFRAME IF NEEDED
3936										if (vidytid!=undefined && String(vidytid).length>1 && nextcaption.find('iframe').length==0) {
3937											httpprefix = "https";
3938
3939											if (videocontrols=="none") {
3940										 		vida = vida.replace("controls=1","controls=0");
3941										 		if (vida.toLowerCase().indexOf('controls')==-1)
3942										 		  vida = vida+"&controls=0";
3943										 	}
3944											nextcaption.append('<iframe style="visible:hidden" src="'+httpprefix+'://www.youtube.com/embed/'+vidytid+'?'+vida+'" width="'+vidw+'" height="'+vidh+'" style="width:'+vidw+'px;height:'+vidh+'px"></iframe>');
3945										}
3946
3947										// ADD VIMEO IFRAME IF NEEDED
3948										if (vimeoid!=undefined && String(vimeoid).length>1 && nextcaption.find('iframe').length==0) {
3949											nextcaption.append('<iframe style="visible:hidden" src="'+httpprefix+'://player.vimeo.com/video/'+vimeoid+'?'+vida+'" width="'+vidw+'" height="'+vidh+'" style="width:'+vidw+'px;height:'+vidh+'px"></iframe>');
3950										}
3951
3952										// ADD HTML5 VIDEO IF NEEDED
3953										if ((videomp!=undefined || videowebm!=undefined) && nextcaption.find('video').length==0) {
3954											if (videocontrols!="controls") videocontrols="";
3955											nextcaption.append('<video style="visible:hidden" class="" '+videoloop+' '+videocontrols+' preload="'+videopreload+'" width="'+vidw+'" height="'+vidh+'"'+
3956															   'poster="'+nextcaption.data('videoposter')+'">'+
3957															   '<source src="'+videomp+'" type="video/mp4"" />'+
3958															   '<source src="'+videowebm+'" type="video/webm"" />'+
3959															   //'<source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />'+
3960															   '</video>');
3961										}
3962
3963										// RESET DEFAULTS
3964										var autoplaywason = false;
3965										if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true" || nextcaption.data('autoplay')==true) {
3966											nextcaption.data('autoplay',true);
3967											autoplaywason = true;
3968										}
3969
3970
3971										nextcaption.find('iframe').each(function() {
3972												var ifr=jQuery(this);
3973
3974												punchgs.TweenLite.to(ifr,0.1,{autoAlpha:1, zIndex:0, transformStyle:"preserve-3d",z:0,rotationX:0,force3D:"auto"});
3975												if (is_mobile()) {
3976													var oldsrc = ifr.attr('src');
3977													ifr.attr('src',"");
3978													ifr.attr('src',oldsrc);
3979												}
3980
3981
3982												// START YOUTUBE HANDLING
3983												opt.nextslideatend = nextcaption.data('nextslideatend');
3984
3985												// IF VIDEOPOSTER EXISTING
3986												if (nextcaption.data('videoposter')!=undefined && nextcaption.data('videoposter').length>2 && nextcaption.data('autoplay')!=true && !internrecalled) {
3987													if (nextcaption.find('.tp-thumb-image').length==0)
3988														nextcaption.append('<div class="tp-thumb-image" style="cursor:pointer; position:absolute;top:0px;left:0px;width:100%;height:100%;background-image:url('+nextcaption.data('videoposter')+'); background-size:cover"></div>');
3989													else
3990													  punchgs.TweenLite.set(nextcaption.find('.tp-thumb-image'),{autoAlpha:1});
3991												}
3992
3993												// IF IFRAME IS A YOUTUBE FRAME
3994												if (ifr.attr('src').toLowerCase().indexOf('youtube')>=0) {
3995
3996														// IF LISTENER DOES NOT EXIST YET
3997														 if (!ifr.hasClass("HasListener")) {
3998															try {
3999																ifr.attr('id',frameID);
4000																var player;
4001																var ytint = setInterval(function() {
4002																	if (YT !=undefined)
4003																		if (typeof YT.Player != undefined && typeof YT.Player !="undefined") {
4004																			player = new YT.Player(frameID, {
4005																				events: {
4006																					"onStateChange": onPlayerStateChange,
4007																					'onReady': function(event) {
4008																						var embedCode = event.target.getVideoEmbedCode(),
4009																							ytcont = jQuery('#'+embedCode.split('id="')[1].split('"')[0]),
4010																							nextcaption = ytcont.closest('.tp-caption'),
4011																							videorate = nextcaption.data('videorate'),
4012																							videostart = nextcaption.data('videostart');
4013
4014
4015																						if (videorate!=undefined)
4016																							event.target.setPlaybackRate(parseFloat(videorate));
4017
4018																						if (nextcaption.data('autoplay')==true || autoplaywason)
4019																							event.target.playVideo();
4020
4021																						// PLAY VIDEO IF THUMBNAIL HAS BEEN CLICKED
4022																						 nextcaption.find('.tp-thumb-image').click(function() {
4023																							 punchgs.TweenLite.to(jQuery(this),0.3,{autoAlpha:0,force3D:"auto",ease:punchgs.Power3.easeInOut})
4024																							 if (!is_mobile()) {
4025																								 player.playVideo();
4026																							}
4027																						 })
4028
4029																					}
4030																				}
4031																			});
4032																		}
4033																		ifr.addClass("HasListener");
4034																		nextcaption.data('player',player);
4035																		clearInterval(ytint);
4036																}, 100)
4037															} catch(e) {}
4038													 } else {
4039													 	var player=nextcaption.data('player');
4040														if (nextcaption.data('forcerewind')=="on" && !is_mobile())
4041																player.seekTo(0);
4042
4043														if (!is_mobile() && nextcaption.data('autoplay')==true || autoplaywason) {
4044																nextcaption.data('timerplay',setTimeout(function() {
4045																	player.playVideo();
4046																},nextcaption.data('start')));
4047														}
4048													 } // END YOUTUBE HANDLING
4049
4050
4051												} else
4052
4053												// START VIMEO HANDLING
4054												if (ifr.attr('src').toLowerCase().indexOf('vimeo')>=0) {
4055														   if (!ifr.hasClass("HasListener")) {
4056																ifr.addClass("HasListener");
4057																ifr.attr('id',frameID);
4058																var isrc = ifr.attr('src');
4059																var queryParameters = {}, queryString = isrc,
4060																re = /([^&=]+)=([^&]*)/g, m;
4061																// Creates a map with the query string parameters
4062																while (m = re.exec(queryString)) {
4063																	queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
4064																}
4065
4066																if (queryParameters['player_id']!=undefined)
4067																	isrc = isrc.replace(queryParameters['player_id'],frameID);
4068																else
4069																	isrc=isrc+"&player_id="+frameID;
4070
4071																try{ isrc = isrc.replace('api=0','api=1'); } catch(e) {}
4072
4073																isrc=isrc+"&api=1";
4074
4075																ifr.attr('src',isrc);
4076																var player = nextcaption.find('iframe')[0];
4077																var vimint = setInterval(function() {
4078																	if ($f !=undefined){
4079																		if (typeof $f(frameID).api != undefined && typeof $f(frameID).api !="undefined") {
4080																			$f(player).addEvent('ready', function(){
4081																				vimeoready_auto(frameID,autoplaywason)
4082																			});
4083																			clearInterval(vimint);
4084																		}
4085																	}
4086																},100);
4087
4088															 } else {
4089																	if (!is_mobile() && (nextcaption.data('autoplay')==true || nextcaption.data('forcerewind')=="on")) {
4090
4091																		var ifr = nextcaption.find('iframe');
4092																		var id = ifr.attr('id');
4093																		var froogaloop = $f(id);
4094																		if (nextcaption.data('forcerewind')=="on")
4095																				froogaloop.api("seekTo",0);
4096																		nextcaption.data('timerplay',setTimeout(function() {
4097																			if (nextcaption.data('autoplay')==true)
4098																				froogaloop.api("play");
4099																		},nextcaption.data('start')));
4100																	}
4101															 }// END HAS LISTENER HANDLING
4102
4103
4104
4105
4106												}  // END OF VIMEO HANDLING
4107										}); // END OF LOOP THROUGH IFRAMES
4108
4109
4110
4111										// START OF HTML5 VIDEOS
4112										if (is_mobile() && nextcaption.data('disablevideoonmobile')==1) nextcaption.find('video').remove();
4113										if (is_mobile() && jQuery(window).width()<569)  nextcaption.find('video').remove()
4114
4115										if (nextcaption.find('video').length>0) {
4116											nextcaption.find('video').each(function(i) {
4117
4118												var video = this,
4119													jvideo = jQuery(this);
4120
4121
4122												if (!jvideo.parent().hasClass("html5vid"))
4123													jvideo.wrap('<div class="html5vid" style="position:relative;top:0px;left:0px;width:auto;height:auto"></div>');
4124
4125												var html5vid = jvideo.parent();
4126
4127												// WAITING FOR META DATAS
4128												if (video.addEventListener)
4129													video.addEventListener("loadedmetadata",function() {
4130														html5vid.data('metaloaded',1);
4131													});
4132												else
4133													video.attachEvent("loadedmetadata",function() {
4134														html5vid.data('metaloaded',1);
4135													});
4136
4137
4138												clearInterval(html5vid.data('interval'));
4139												html5vid.data('interval',setInterval(function() {
4140													if (html5vid.data('metaloaded')==1 || video.duration!=NaN) {
4141														clearInterval(html5vid.data('interval'));
4142														// FIRST TIME LOADED THE HTML5 VIDEO
4143														if (!html5vid.hasClass("HasListener")) {
4144																html5vid.addClass("HasListener");
4145
4146																if (nextcaption.data('dottedoverlay')!="none" && nextcaption.data('dottedoverlay')!=undefined)
4147																if (nextcaption.find('.tp-dottedoverlay').length!=1)
4148																	html5vid.append('<div class="tp-dottedoverlay '+nextcaption.data('dottedoverlay')+'"></div>');
4149
4150																if (jvideo.attr('control') == undefined ) {
4151																	if (html5vid.find('.tp-video-play-button').length==0)
4152																		html5vid.append('<div class="tp-video-play-button"><i class="revicon-right-dir"></i><div class="tp-revstop"></div></div>');
4153																	html5vid.find('video, .tp-poster, .tp-video-play-button').click(function() {
4154																		if (html5vid.hasClass("videoisplaying"))
4155																			video.pause();
4156																		else
4157																			video.play();
4158																	})
4159																}
4160
4161																if (nextcaption.data('forcecover')==1 || nextcaption.hasClass('fullscreenvideo'))  {
4162																	if (nextcaption.data('forcecover')==1) {
4163																		updateHTML5Size(html5vid,opt.container);
4164																		html5vid.addClass("fullcoveredvideo");
4165																		nextcaption.addClass("fullcoveredvideo");
4166																	}
4167																	html5vid.css({width:"100%", height:"100%"});
4168																}
4169
4170																// VIDEO EVENT LISTENER FOR "PLAY"
4171																if (video.addEventListener)
4172																	video.addEventListener("play",function() {
4173	
4174																		if (nextcaption.data('volume')=="mute")
4175																			  video.muted=true;
4176	
4177																		html5vid.addClass("videoisplaying");
4178	
4179			 															if (nextcaption.data('videoloop')=="loopandnoslidestop") {
4180																			opt.videoplaying=false;
4181																			opt.container.trigger('starttimer');
4182																			opt.container.trigger('revolution.slide.onvideostop');
4183																		} else {
4184	
4185																			opt.videoplaying=true;
4186																			opt.container.trigger('stoptimer');
4187																			opt.container.trigger('revolution.slide.onvideoplay');
4188	
4189																		}
4190																	});
4191																else
4192																	video.attachEvent("play",function() {
4193	
4194																		if (nextcaption.data('volume')=="mute")
4195																			  video.muted=true;
4196	
4197																		html5vid.addClass("videoisplaying");
4198	
4199			 															if (nextcaption.data('videoloop')=="loopandnoslidestop") {
4200																			opt.videoplaying=false;
4201																			opt.container.trigger('starttimer');
4202																			opt.container.trigger('revolution.slide.onvideostop');
4203																		} else {
4204	
4205																			opt.videoplaying=true;
4206																			opt.container.trigger('stoptimer');
4207																			opt.container.trigger('revolution.slide.onvideoplay');
4208	
4209																		}
4210																	});
4211
4212																// VIDEO EVENT LISTENER FOR "PAUSE"
4213																if (video.addEventListener)
4214																	video.addEventListener("pause",function() {
4215																			html5vid.removeClass("videoisplaying");
4216																			opt.videoplaying=false;
4217																			opt.container.trigger('starttimer');
4218																			opt.container.trigger('revolution.slide.onvideostop');
4219																	});
4220																else
4221																	video.attachEvent("pause",function() {
4222																			html5vid.removeClass("videoisplaying");
4223																			opt.videoplaying=false;
4224																			opt.container.trigger('starttimer');
4225																			opt.container.trigger('revolution.slide.onvideostop');
4226																	});
4227
4228																// VIDEO EVENT LISTENER FOR "END"
4229																if (video.addEventListener)																
4230																	video.addEventListener("ended",function() {
4231																			html5vid.removeClass("videoisplaying");
4232																			opt.videoplaying=false;
4233																			opt.container.trigger('starttimer');
4234																			opt.container.trigger('revolution.slide.onvideostop');
4235																			if (opt.nextslideatend==true)
4236																				opt.container.revnext();
4237																	});
4238																else
4239																	video.attachEvent("ended",function() {
4240																			html5vid.removeClass("videoisplaying");
4241																			opt.videoplaying=false;
4242																			opt.container.trigger('starttimer');
4243																			opt.container.trigger('revolution.slide.onvideostop');
4244																			if (opt.nextslideatend==true)
4245																				opt.container.revnext();
4246																	});
4247															} // END OF LISTENER DECLARATION
4248
4249															var autoplaywason = false;
4250															if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true")
4251																autoplaywason = true;
4252
4253															var mediaaspect=16/9;
4254															if (nextcaption.data('aspectratio')=="4:3") mediaaspect=4/3;
4255															html5vid.data('mediaAspect',mediaaspect);
4256
4257															if (html5vid.closest('.tp-caption').data('forcecover')==1) {
4258																updateHTML5Size(html5vid,opt.container);
4259																html5vid.addClass("fullcoveredvideo");
4260															}
4261
4262															jvideo.css({display:"block"});
4263															opt.nextslideatend = nextcaption.data('nextslideatend');
4264
4265															// IF VIDEO SHOULD BE AUTOPLAYED
4266															if (nextcaption.data('autoplay')==true || autoplaywason==true) {
4267
4268
4269																if (nextcaption.data('videoloop')=="loopandnoslidestop") {
4270																	opt.videoplaying=false;
4271																	opt.container.trigger('starttimer');
4272																	opt.container.trigger('revolution.slide.onvideostop');
4273																} else {
4274																	opt.videoplaying=true;
4275																	opt.container.trigger('stoptimer');
4276																	opt.container.trigger('revolution.slide.onvideoplay');
4277																}
4278
4279
4280																if (nextcaption.data('forcerewind')=="on" && !html5vid.hasClass("videoisplaying"))
4281																	if (video.currentTime>0) video.currentTime=0;
4282
4283																if (nextcaption.data('volume')=="mute")
4284																	video.muted = true;
4285
4286																html5vid.data('timerplay',setTimeout(function() {
4287
4288																	if (nextcaption.data('forcerewind')=="on" && !html5vid.hasClass("videoisplaying"))
4289																		if (video.currentTime>0) video.currentTime=0;
4290
4291																	if (nextcaption.data('volume')=="mute")
4292																			video.muted = true;
4293
4294
4295																		video.play();
4296																},10+nextcaption.data('start')));
4297															}
4298
4299															if (html5vid.data('ww') == undefined) html5vid.data('ww',jvideo.attr('width'));
4300															if (html5vid.data('hh') == undefined) html5vid.data('hh',jvideo.attr('height'));
4301
4302															if (!nextcaption.hasClass("fullscreenvideo") && nextcaption.data('forcecover')==1) {
4303																try{
4304																	html5vid.width(html5vid.data('ww')*opt.bw);
4305																	html5vid.height(html5vid.data('hh')*opt.bh);
4306																} catch(e) {}
4307															}
4308
4309															clearInterval(html5vid.data('interval'));
4310													}
4311												}),100); // END OF SET INTERVAL
4312
4313											});
4314										} // END OF HTML5 VIDEO FUNCTIONS
4315
4316										// IF AUTOPLAY IS ON, WE NEED SOME STOP FUNCTION ON
4317										if (nextcaption.data('autoplay')==true) {
4318											setTimeout(function() {
4319
4320												if (nextcaption.data('videoloop')!="loopandnoslidestop") {
4321													opt.videoplaying=true;
4322													opt.container.trigger('stoptimer');
4323												}
4324											},200)
4325											if (nextcaption.data('videoloop')!="loopandnoslidestop") {
4326												opt.videoplaying=true;
4327												opt.container.trigger('stoptimer');
4328											}
4329
4330											if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true" ) {
4331												nextcaption.data('autoplay',false);
4332												nextcaption.data('autoplayonlyfirsttime',false);
4333											}
4334										}
4335									}
4336
4337
4338
4339
4340									// NEW ENGINE
4341									//if (nextcaption.hasClass("randomrotate") && (opt.ie || opt.ie9)) nextcaption.removeClass("randomrotate").addClass("sfb");
4342									//	nextcaption.removeClass('noFilterClass');
4343
4344
4345
4346								    var imw =0;
4347								    var imh = 0;
4348
4349									if (nextcaption.find('img').length>0) {
4350														var im = nextcaption.find('img');
4351														if (im.width()==0) im.css({width:"auto"});
4352														if (im.height()==0) im.css({height:"auto"});
4353
4354														if (im.data('ww') == undefined && im.width()>0) im.data('ww',im.width());
4355														if (im.data('hh') == undefined && im.height()>0) im.data('hh',im.height());
4356
4357														var ww = im.data('ww');
4358														var hh = im.data('hh');
4359
4360														if (ww==undefined) ww=0;
4361														if (hh==undefined) hh=0;
4362
4363														im.width(ww*opt.bw);
4364														im.height(hh*opt.bh);
4365														imw = im.width();
4366														imh = im.height();
4367									} else {
4368
4369									if (nextcaption.find('iframe').length>0 || nextcaption.find('video').length>0) {
4370
4371															var html5vid = false;
4372															var im = nextcaption.find('iframe');
4373															if (im.length==0) {
4374																	im = nextcaption.find('video');
4375																	html5vid = true;
4376															}
4377															im.css({display:"block"});
4378
4379															if (nextcaption.data('ww') == undefined) nextcaption.data('ww',im.width());
4380															if (nextcaption.data('hh') == undefined) nextcaption.data('hh',im.height());
4381
4382															var ww = nextcaption.data('ww');
4383															var hh = nextcaption.data('hh');
4384
4385															var nc =nextcaption;
4386																if (nc.data('fsize') == undefined) nc.data('fsize',parseInt(nc.css('font-size'),0) || 0);
4387																if (nc.data('pt') == undefined) nc.data('pt',parseInt(nc.css('paddingTop'),0) || 0);
4388																if (nc.data('pb') == undefined) nc.data('pb',parseInt(nc.css('paddingBottom'),0) || 0);
4389																if (nc.data('pl') == undefined) nc.data('pl',parseInt(nc.css('paddingLeft'),0) || 0);
4390																if (nc.data('pr') == undefined) nc.data('pr',parseInt(nc.css('paddingRight'),0) || 0);
4391
4392																if (nc.data('mt') == undefined) nc.data('mt',parseInt(nc.css('marginTop'),0) || 0);
4393																if (nc.data('mb') == undefined) nc.data('mb',parseInt(nc.css('marginBottom'),0) || 0);
4394																if (nc.data('ml') == undefined) nc.data('ml',parseInt(nc.css('marginLeft'),0) || 0);
4395																if (nc.data('mr') == undefined) nc.data('mr',parseInt(nc.css('marginRight'),0) || 0);
4396
4397																if (nc.data('bt') == undefined) nc.data('bt',parseInt(nc.css('borderTop'),0) || 0);
4398																if (nc.data('bb') == undefined) nc.data('bb',parseInt(nc.css('borderBottom'),0) || 0);
4399																if (nc.data('bl') == undefined) nc.data('bl',parseInt(nc.css('borderLeft'),0) || 0);
4400																if (nc.data('br') == undefined) nc.data('br',parseInt(nc.css('borderRight'),0) || 0);
4401
4402																if (nc.data('lh') == undefined) nc.data('lh',parseInt(nc.css('lineHeight'),0) || 0);
4403
4404
4405
4406
4407																var fvwidth=opt.width;
4408																var fvheight=opt.height;
4409																if (fvwidth>opt.startwidth) fvwidth=opt.startwidth;
4410																if (fvheight>opt.startheight) fvheight=opt.startheight;
4411
4412
4413
4414																if (!nextcaption.hasClass('fullscreenvideo'))
4415																			nextcaption.css({
4416
4417																				 'font-size': (nc.data('fsize') * opt.bw)+"px",
4418
4419																				 'padding-top': (nc.data('pt') * opt.bh) + "px",
4420																				 'padding-bottom': (nc.data('pb') * opt.bh) + "px",
4421																				 'padding-left': (nc.data('pl') * opt.bw) + "px",
4422																				 'padding-right': (nc.data('pr') * opt.bw) + "px",
4423
4424																				 'margin-top': (nc.data('mt') * opt.bh) + "px",
4425																				 'margin-bottom': (nc.data('mb') * opt.bh) + "px",
4426																				 'margin-left': (nc.data('ml') * opt.bw) + "px",
4427																				 'margin-right': (nc.data('mr') * opt.bw) + "px",
4428
4429																				 'border-top': (nc.data('bt') * opt.bh) + "px",
4430																				 'border-bottom': (nc.data('bb') * opt.bh) + "px",
4431																				 'border-left': (nc.data('bl') * opt.bw) + "px",
4432																				 'border-right': (nc.data('br') * opt.bw) + "px",
4433
4434																				 'line-height': (nc.data('lh') * opt.bh) + "px",
4435																				 'height':(hh*opt.bh)+'px'
4436																				});
4437																	else  {
4438
4439																		   offsetx=0; offsety=0;
4440																		   nextcaption.data('x',0)
4441																		   nextcaption.data('y',0)
4442
4443																		   var ovhh = opt.height
4444																		   if (opt.autoHeight=="on")
4445																		   		ovhh = opt.container.height()
4446																			nextcaption.css({
4447
4448																				'width':opt.width,
4449																				'height':ovhh
4450																			});
4451																		}
4452
4453															if (html5vid == false) {
4454																im.width(ww*opt.bw);
4455																im.height(hh*opt.bh);
4456															}
4457
4458															else
4459
4460															if (nextcaption.data('forcecover')!=1 && !nextcaption.hasClass('fullscreenvideo')) {
4461																im.width(ww*opt.bw);
4462																im.height(hh*opt.bh);
4463															}
4464
4465
4466															imw = im.width();
4467															imh = im.height();
4468														}
4469
4470											else {
4471
4472
4473												nextcaption.find('.tp-resizeme, .tp-resizeme *').each(function() {
4474														calcCaptionResponsive(jQuery(this),opt);
4475												});
4476
4477												if (nextcaption.hasClass("tp-resizeme")) {
4478													nextcaption.find('*').each(function() {
4479														calcCaptionResponsive(jQuery(this),opt);
4480													});
4481												}
4482
4483												calcCaptionResponsive(nextcaption,opt);
4484
4485												imh=nextcaption.outerHeight(true);
4486												imw=nextcaption.outerWidth(true);
4487
4488												// NEXTCAPTION FRONTCORNER CHANGES
4489												var ncch = nextcaption.outerHeight();
4490												var bgcol = nextcaption.css('backgroundColor');
4491												nextcaption.find('.frontcorner').css({
4492																'borderWidth':ncch+"px",
4493																'left':(0-ncch)+'px',
4494																'borderRight':'0px solid transparent',
4495																'borderTopColor':bgcol
4496												});
4497
4498												nextcaption.find('.frontcornertop').css({
4499																'borderWidth':ncch+"px",
4500																'left':(0-ncch)+'px',
4501																'borderRight':'0px solid transparent',
4502																'borderBottomColor':bgcol
4503												});
4504
4505												// NEXTCAPTION BACKCORNER CHANGES
4506												nextcaption.find('.backcorner').css({
4507																'borderWidth':ncch+"px",
4508																'right':(0-ncch)+'px',
4509																'borderLeft':'0px solid transparent',
4510																'borderBottomColor':bgcol
4511												});
4512
4513												// NEXTCAPTION BACKCORNER CHANGES
4514												nextcaption.find('.backcornertop').css({
4515																'borderWidth':ncch+"px",
4516																'right':(0-ncch)+'px',
4517																'borderLeft':'0px solid transparent',
4518																'borderTopColor':bgcol
4519												});
4520
4521											 }
4522
4523
4524									}
4525
4526									if (opt.fullScreenAlignForce == "on") {
4527										//xbw = 1;
4528										//xbh = 1;
4529										offsetx=0;
4530										offsety=0;
4531									}
4532
4533
4534
4535									if (nextcaption.data('voffset')==undefined) nextcaption.data('voffset',0);
4536									if (nextcaption.data('hoffset')==undefined) nextcaption.data('hoffset',0);
4537
4538									var vofs= nextcaption.data('voffset')*xbw;
4539									var hofs= nextcaption.data('hoffset')*xbw;
4540
4541									var crw = opt.startwidth*xbw;
4542									var crh = opt.startheight*xbw;
4543
4544									if (opt.fullScreenAlignForce == "on") {
4545										crw = opt.container.width();
4546										crh = opt.container.height();
4547									}
4548
4549
4550
4551									// CENTER THE CAPTION HORIZONTALLY
4552									if (nextcaption.data('x')=="center" || nextcaption.data('xcenter')=='center') {
4553										nextcaption.data('xcenter','center');
4554										//nextcaption.data('x',(crw/2 - nextcaption.outerWidth(true)/2)/xbw+  hofs);
4555										nextcaption.data('x',(crw/2 - nextcaption.outerWidth(true)/2) +  hofs);
4556
4557
4558									}
4559
4560									// ALIGN LEFT THE CAPTION HORIZONTALLY
4561									if (nextcaption.data('x')=="left" || nextcaption.data('xleft')=='left') {
4562										nextcaption.data('xleft','left');
4563
4564										nextcaption.data('x',(0)/xbw+hofs);
4565
4566									}
4567
4568									// ALIGN RIGHT THE CAPTION HORIZONTALLY
4569									if (nextcaption.data('x')=="right" || nextcaption.data('xright')=='right') {
4570										nextcaption.data('xright','right');
4571										nextcaption.data('x',((crw - nextcaption.outerWidth(true))+hofs)/xbw);
4572										//konsole.log("crw:"+crw+"  width:"+nextcaption.outerWidth(true)+"  xbw:"+xbw);
4573										//konsole.log("x-pos:"+nextcaption.data('x'))
4574									}
4575
4576
4577									// CENTER THE CAPTION VERTICALLY
4578									if (nextcaption.data('y')=="center" || nextcaption.data('ycenter')=='center') {
4579										nextcaption.data('ycenter','center');
4580										nextcaption.data('y',(crh/2 - nextcaption.outerHeight(true)/2) + vofs);
4581									}
4582
4583									// ALIGN TOP THE CAPTION VERTICALLY
4584									if (nextcaption.data('y')=="top" || nextcaption.data('ytop')=='top') {
4585										nextcaption.data('ytop','top');
4586										nextcaption.data('y',(0)/opt.bh+vofs);
4587
4588									}
4589
4590									// ALIGN BOTTOM THE CAPTION VERTICALLY
4591									if (nextcaption.data('y')=="bottom" || nextcaption.data('ybottom')=='bottom') {
4592										nextcaption.data('ybottom','bottom');
4593										nextcaption.data('y',((crh - nextcaption.outerHeight(true))+vofs)/xbw);
4594
4595									}
4596
4597
4598
4599									// THE TRANSITIONS OF CAPTIONS
4600									// MDELAY AND MSPEED
4601									if (nextcaption.data('start') == undefined) nextcaption.data('start',1000);
4602
4603
4604
4605									var easedata=nextcaption.data('easing');
4606									if (easedata==undefined) easedata="punchgs.Power1.easeOut";
4607
4608
4609									var mdelay = nextcaption.data('start')/1000;
4610									var mspeed = nextcaption.data('speed')/1000;
4611
4612
4613									if (nextcaption.data('x')=="center" || nextcaption.data('xcenter')=='center')
4614										var calcx = (nextcaption.data('x')+offsetx);
4615									else {
4616
4617										var calcx = (xbw*nextcaption.data('x')+offsetx);
4618									}
4619
4620
4621									if (nextcaption.data('y')=="center" || nextcaption.data('ycenter')=='center')
4622										var calcy = (nextcaption.data('y')+offsety);
4623									else {
4624										//if (opt.fullScreenAlignForce == "on" && (nextcaption.data('y')=="bottom" || nextcaption.data('ybottom')=='bottom'))
4625										//	opt.bh = 1;
4626
4627										var calcy = (opt.bh*nextcaption.data('y')+offsety);
4628									}
4629
4630
4631							punchgs.TweenLite.set(nextcaption,{top:calcy,left:calcx,overwrite:"auto"});
4632
4633							if (staticdirection == 0)
4634								internrecalled = true;
4635
4636							if (nextcaption.data('timeline')!=undefined && !internrecalled) {
4637								if (staticdirection!=2)
4638									nextcaption.data('timeline').gotoAndPlay(0);
4639								internrecalled = true;
4640							}
4641
4642							if (!internrecalled) {
4643
4644
4645
4646									// CLEAR THE TIMELINE, SINCE IT CAN BE DAMAGED, OR PAUSED AT A FEW PART
4647									if (nextcaption.data('timeline')!=undefined) {
4648										//nextcaption.data('timeline').clear();
4649									 }
4650									// MAKE SURE THE ANIMATION ENDS WITH A CLEANING ON MOZ TRANSFORMS
4651									function animcompleted() {
4652									/*	setTimeout(function() {
4653											nextcaption.css({transform:"none",'-moz-transform':'none','-webkit-transform':'none'});
4654										},100)*/
4655									}
4656
4657
4658								   function tlstart() {
4659								/*	   nextcaption.data('timer',setTimeout(function() {
4660										if (nextcaption.hasClass("fullscreenvideo"))
4661											nextcaption.css({'display':'block'});
4662
4663									   },nextcaption.data('start')));*/
4664									   }
4665
4666									var tl = new punchgs.TimelineLite({smoothChildTiming:true,onStart:tlstart});
4667									tl.pause();
4668
4669
4670									if (opt.fullScreenAlignForce == "on") {
4671										//calcy = nextcaption.data('y')+offsety;
4672									}
4673
4674									var animobject = nextcaption;
4675									if (nextcaption.data('mySplitText') !=undefined) nextcaption.data('mySplitText').revert();
4676
4677
4678									if (nextcaption.data('splitin') == "chars" || nextcaption.data('splitin') == "words" || nextcaption.data('splitin') == "lines" || nextcaption.data('splitout') == "chars" || nextcaption.data('splitout') == "words" || nextcaption.data('splitout') == "lines") {
4679										if (nextcaption.find('a').length>0)
4680											nextcaption.data('mySplitText',new punchgs.SplitText(nextcaption.find('a'),{type:"lines,words,chars",charsClass:"tp-splitted",wordsClass:"tp-splitted",linesClass:"tp-splitted"}));
4681										else
4682										if (nextcaption.find('.tp-layer-inner-rotation').length>0)
4683											nextcaption.data('mySplitText',new punchgs.SplitText(nextcaption.find('.tp-layer-inner-rotation'),{type:"lines,words,chars",charsClass:"tp-splitted",wordsClass:"tp-splitted",linesClass:"tp-splitted"}));
4684										else
4685											nextcaption.data('mySplitText',new punchgs.SplitText(nextcaption,{type:"lines,words,chars",charsClass:"tp-splitted",wordsClass:"tp-splitted",linesClass:"tp-splitted"}));
4686
4687										nextcaption.addClass("splitted");
4688									}
4689
4690									if (nextcaption.data('splitin') == "chars")
4691										animobject = nextcaption.data('mySplitText').chars;
4692
4693
4694									if (nextcaption.data('splitin') == "words")
4695										animobject = nextcaption.data('mySplitText').words;
4696
4697
4698									if (nextcaption.data('splitin') == "lines")
4699										animobject = nextcaption.data('mySplitText').lines;
4700
4701
4702
4703									var frm = newAnimObject();
4704									var endfrm = newAnimObject();
4705
4706
4707									if (nextcaption.data('repeat')!=undefined) repeatV = nextcaption.data('repeat');
4708									if (nextcaption.data('yoyo')!=undefined) yoyoV = nextcaption.data('yoyo');
4709									if (nextcaption.data('repeatdelay')!=undefined) repeatdelayV = nextcaption.data('repeatdelay');
4710
4711									// WHICH ANIMATION TYPE SHOULD BE USED
4712									if (nextcaption.hasClass("customin")) frm = getAnimDatas(frm,nextcaption.data('customin'));
4713									else
4714									if (nextcaption.hasClass("randomrotate")) {
4715
4716												frm.scale = Math.random()*3+1;
4717												frm.rotation = Math.round(Math.random()*200-100);
4718												frm.x = Math.round(Math.random()*200-100);
4719												frm.y = Math.round(Math.random()*200-100);
4720									}
4721									else
4722									if (nextcaption.hasClass('lfr') || nextcaption.hasClass('skewfromright')) frm.x = 15+opt.width;
4723									else
4724									if (nextcaption.hasClass('lfl') || nextcaption.hasClass('skewfromleft')) frm.x = -15-imw;
4725									else
4726									if (nextcaption.hasClass('sfl') || nextcaption.hasClass('skewfromleftshort')) frm.x = -50;
4727									else
4728									if (nextcaption.hasClass('sfr') || nextcaption.hasClass('skewfromrightshort')) frm.x = 50;
4729									else
4730									if (nextcaption.hasClass('lft')) frm.y = -25 - imh;
4731									else
4732									if (nextcaption.hasClass('lfb')) frm.y = 25 + opt.height;
4733									else
4734									if (nextcaption.hasClass('sft')) frm.y = -50;
4735									else
4736									if (nextcaption.hasClass('sfb')) frm.y = 50;
4737
4738
4739									if (nextcaption.hasClass('skewfromright') || nextcaption.hasClass('skewfromrightshort')) frm.skewX = -85
4740									else
4741									if (nextcaption.hasClass('skewfromleft') || nextcaption.hasClass('skewfromleftshort')) frm.skewX =  85
4742
4743
4744									if (nextcaption.hasClass("fade") || nextcaption.hasClass('sft') || nextcaption.hasClass('sfl') || nextcaption.hasClass('sfb') || nextcaption.hasClass('skewfromleftshort')  || nextcaption.hasClass('sfr') || nextcaption.hasClass('skewfromrightshort'))
4745										frm.opacity = 0;
4746
4747									// FOR SAFARI WE NEED TO REMOVE 3D ROTATIONS
4748									if (get_browser().toLowerCase()=="safari") {
4749										//frm.rotationX=0;frm.rotationY=0;
4750									}
4751
4752									var elemdelay = (nextcaption.data('elementdelay') == undefined) ? 0 : nextcaption.data('elementdelay');
4753									endfrm.ease = frm.ease = (nextcaption.data('easing') == undefined) ? punchgs.Power1.easeInOut : nextcaption.data('easing');
4754
4755
4756									// DISTANCES SHOULD BE RESIZED ALSO
4757
4758									frm.data = new Object();
4759									frm.data.oldx = frm.x;
4760									frm.data.oldy = frm.y;
4761
4762									endfrm.data = new Object();
4763									endfrm.data.oldx = endfrm.x;
4764									endfrm.data.oldy = endfrm.y;
4765
4766									frm.x = frm.x * xbw;
4767									frm.y = frm.y * xbw;
4768
4769									var newtl = new punchgs.TimelineLite();
4770
4771
4772									if (staticdirection != 2) {
4773
4774										// CHANGE to punchgs.TweenLite.  if Yoyo and Repeat is used. Dont forget to laod the Right Tools for it !!
4775										if (nextcaption.hasClass("customin")) {
4776											  if (animobject != nextcaption)
4777												  tl.add(punchgs.TweenLite.set(nextcaption, { force3D:"auto",opacity:1,scaleX:1,scaleY:1,rotationX:0,rotationY:0,rotationZ:0,skewX:0,skewY:0,z:0,x:0,y:0,visibility:'visible',opacity:1,delay:0,overwrite:"all"}));
4778											  frm.visibility = "hidden";
4779											  endfrm.visibility = "visible";
4780											  endfrm.overwrite = "all";
4781											  endfrm.opacity = 1;
4782											  endfrm.onComplete = animcompleted();
4783											  endfrm.delay = mdelay;
4784											  endfrm.force3D="auto"
4785
4786											  tl.add(newtl.staggerFromTo(animobject,mspeed,frm,endfrm,elemdelay),"frame0");
4787
4788										} else {
4789
4790												frm.visibility = "visible";
4791												frm.transformPerspective = 600;
4792												if (animobject != nextcaption)
4793												  tl.add(punchgs.TweenLite.set(nextcaption, { force3D:"auto",opacity:1,scaleX:1,scaleY:1,rotationX:0,rotationY:0,rotationZ:0,skewX:0,skewY:0,z:0,x:0,y:0,visibility:'visible',opacity:1,delay:0,overwrite:"all"}));
4794
4795												endfrm.visibility = "visible";
4796												endfrm.delay = mdelay;
4797												endfrm.onComplete = animcompleted();
4798												endfrm.opacity = 1;
4799												endfrm.force3D="auto";
4800												if (nextcaption.hasClass("randomrotate") && animobject != nextcaption) {
4801
4802													for (var i=0;i<animobject.length;i++) {
4803														var obj =new Object();
4804														var endobj = new Object();
4805														jQuery.extend(obj,frm);
4806														jQuery.extend(endobj,endfrm);
4807														frm.scale = Math.random()*3+1;
4808														frm.rotation = Math.round(Math.random()*200-100);
4809														frm.x = Math.round(Math.random()*200-100);
4810														frm.y = Math.round(Math.random()*200-100);
4811
4812														if (i!=0) endobj.delay = mdelay + (i*elemdelay);
4813
4814
4815														tl.append(punchgs.TweenLite.fromTo(animobject[i],mspeed,obj,endobj),"frame0");
4816													}
4817
4818
4819
4820												}	else
4821												tl.add(newtl.staggerFromTo(animobject,mspeed,frm,endfrm,elemdelay),"frame0");
4822												//tl.add(punchgs.TweenLite.fromTo(nextcaption,mspeed,frm,endfrm),"frame0");
4823										}
4824									}
4825
4826									// SAVE IT TO NCAPTION BEFORE NEW STEPS WILL BE ADDED
4827									nextcaption.data('timeline',tl);
4828
4829									// FURTHER ANIMATIONS IN CASE THERE ARE MORE THAN ONE STEP IN THE ANIMATION CHAIN
4830									var frames = new Array();
4831									if (nextcaption.data('frames')!=undefined) {
4832										var rowtext = nextcaption.data('frames');
4833										rowtext = rowtext.replace(/\s+/g, '');
4834										rowtext = rowtext.replace("{","");
4835										var spframes = rowtext.split('}');
4836										jQuery.each(spframes,function(index,spframe){
4837											if (spframe.length>0) {
4838												var params = getAnimSteps(spframe);
4839
4840												addMoveCaption(nextcaption,opt,params,"frame"+(index+10),xbw)
4841
4842											}
4843										})
4844									} // END OF ANIMATION STEPS
4845
4846									tl = nextcaption.data('timeline');
4847									// IF THERE IS ANY EXIT ANIM DEFINED
4848									// For Static Layers -> 1 -> In,  2-> Out  0-> Ignore  -1-> Not Static
4849									if ((nextcaption.data('end')!=undefined) && (staticdirection==-1 || staticdirection==2)) {
4850										endMoveCaption(nextcaption,opt,nextcaption.data('end')/1000,frm,"frame99",xbw);
4851									} else {
4852										if (staticdirection==-1 || staticdirection==2)
4853											endMoveCaption(nextcaption,opt,999999,frm,"frame99",xbw);
4854										else
4855											endMoveCaption(nextcaption,opt,200,frm,"frame99",xbw);
4856									}
4857
4858									// SAVE THE TIMELINE IN DOM ELEMENT
4859									tl = nextcaption.data('timeline');
4860									nextcaption.data('timeline',tl);
4861									callCaptionLoops(nextcaption,xbw);
4862									tl.resume();
4863							 }
4864						  }
4865
4866						  if (internrecalled) {
4867						  			killCaptionLoops(nextcaption);
4868						  			callCaptionLoops(nextcaption,xbw);
4869
4870							  		if (nextcaption.data('timeline') != undefined) {
4871								  		var tweens = nextcaption.data('timeline').getTweensOf();
4872								  		jQuery.each(tweens,function(index,tween) {
4873									  		if (tween.vars.data != undefined) {
4874									  			var newx =  tween.vars.data.oldx * xbw;
4875									  			var newy =  tween.vars.data.oldy * xbw;
4876									  			if (tween.progress() !=1 && tween.progress()!=0) {
4877									  				try{
4878											  			//tween.updateTo({x:newx, y:newy},true);
4879											  			tween.vars.x = newx;
4880											  			tween.vary.y = newy;
4881											  		  } catch(e) {
4882
4883											  		  }
4884										  		} else {
4885										  			if (tween.progress()==1) {
4886											  				punchgs.TweenLite.set(tween.target,{x:newx,y:newy});
4887											  		}
4888											  	}
4889									  		}
4890								  		})
4891								  	}
4892						  }
4893
4894					})
4895
4896						var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
4897						bt.data('opt',opt);
4898
4899
4900
4901					if (mtl != undefined) setTimeout(function() {
4902						mtl.resume();
4903					},30);
4904
4905				}
4906
4907
4908				var get_browser = function(){
4909				    var N=navigator.appName, ua=navigator.userAgent, tem;
4910				    var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
4911				    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
4912				    M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
4913				    return M[0];
4914				    }
4915				var get_browser_version  = function(){
4916				    var N=navigator.appName, ua=navigator.userAgent, tem;
4917				    var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
4918				    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
4919				    M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
4920				    return M[1];
4921				    }
4922
4923				/////////////////////////////////////////////////////////////////
4924				//	-	CALCULATE THE RESPONSIVE SIZES OF THE CAPTIONS	-	  //
4925				/////////////////////////////////////////////////////////////////
4926				var calcCaptionResponsive = function(nc,opt) {
4927								if (nc.data('fsize') == undefined) nc.data('fsize',parseInt(nc.css('font-size'),0) || 0);
4928								if (nc.data('pt') == undefined) nc.data('pt',parseInt(nc.css('paddingTop'),0) || 0);
4929								if (nc.data('pb') == undefined) nc.data('pb',parseInt(nc.css('paddingBottom'),0) || 0);
4930								if (nc.data('pl') == undefined) nc.data('pl',parseInt(nc.css('paddingLeft'),0) || 0);
4931								if (nc.data('pr') == undefined) nc.data('pr',parseInt(nc.css('paddingRight'),0) || 0);
4932
4933								if (nc.data('mt') == undefined) nc.data('mt',parseInt(nc.css('marginTop'),0) || 0);
4934								if (nc.data('mb') == undefined) nc.data('mb',parseInt(nc.css('marginBottom'),0) || 0);
4935								if (nc.data('ml') == undefined) nc.data('ml',parseInt(nc.css('marginLeft'),0) || 0);
4936								if (nc.data('mr') == undefined) nc.data('mr',parseInt(nc.css('marginRight'),0) || 0);
4937
4938								if (nc.data('bt') == undefined) nc.data('bt',parseInt(nc.css('borderTopWidth'),0) || 0);
4939								if (nc.data('bb') == undefined) nc.data('bb',parseInt(nc.css('borderBottomWidth'),0) || 0);
4940								if (nc.data('bl') == undefined) nc.data('bl',parseInt(nc.css('borderLeftWidth'),0) || 0);
4941								if (nc.data('br') == undefined) nc.data('br',parseInt(nc.css('borderRightWidth'),0) || 0);
4942
4943								if (nc.data('ls') == undefined) nc.data('ls',parseInt(nc.css('letterSpacing'),0) || 0);
4944
4945								if (nc.data('lh') == undefined) nc.data('lh',parseInt(nc.css('lineHeight'),0) || "auto");
4946								if (nc.data('minwidth') == undefined) nc.data('minwidth',parseInt(nc.css('minWidth'),0) || 0);
4947								if (nc.data('minheight') == undefined) nc.data('minheight',parseInt(nc.css('minHeight'),0) || 0);
4948								if (nc.data('maxwidth') == undefined) nc.data('maxwidth',parseInt(nc.css('maxWidth'),0) || "none");
4949								if (nc.data('maxheight') == undefined) nc.data('maxheight',parseInt(nc.css('maxHeight'),0) || "none");
4950								if (nc.data('wii') == undefined) nc.data('wii',parseInt(nc.css('width'),0) || 0);
4951								if (nc.data('hii') == undefined) nc.data('hii',parseInt(nc.css('height'),0) || 0);
4952
4953								if (nc.data('wan') == undefined) nc.data('wan',nc.css("-webkit-transition"));
4954								if (nc.data('moan') == undefined) nc.data('moan',nc.css("-moz-animation-transition"));
4955								if (nc.data('man') == undefined) nc.data('man',nc.css("-ms-animation-transition"));
4956								if (nc.data('ani') == undefined) nc.data('ani',nc.css("transition"));
4957
4958
4959
4960
4961
4962								if (!nc.hasClass("tp-splitted")) {
4963
4964
4965										nc.css("-webkit-transition", "none");
4966									    nc.css("-moz-transition", "none");
4967									    nc.css("-ms-transition", "none");
4968									    nc.css("transition", "none");
4969
4970										punchgs.TweenLite.set(nc,{
4971														 fontSize: Math.round((nc.data('fsize') * opt.bw))+"px",
4972
4973														 letterSpacing:Math.floor((nc.data('ls') * opt.bw))+"px",
4974
4975														 paddingTop: Math.round((nc.data('pt') * opt.bh)) + "px",
4976														 paddingBottom: Math.round((nc.data('pb') * opt.bh)) + "px",
4977														 paddingLeft: Math.round((nc.data('pl') * opt.bw)) + "px",
4978														 paddingRight: Math.round((nc.data('pr') * opt.bw)) + "px",
4979
4980														 marginTop: (nc.data('mt') * opt.bh) + "px",
4981														 marginBottom: (nc.data('mb') * opt.bh) + "px",
4982														 marginLeft: (nc.data('ml') * opt.bw) + "px",
4983														 marginRight: (nc.data('mr') * opt.bw) + "px",
4984
4985														 borderTopWidth: Math.round((nc.data('bt') * opt.bh)) + "px",
4986														 borderBottomWidth: Math.round((nc.data('bb') * opt.bh)) + "px",
4987														 borderLeftWidth: Math.round((nc.data('bl') * opt.bw)) + "px",
4988														 borderRightWidth: Math.round((nc.data('br') * opt.bw)) + "px",
4989
4990														 lineHeight: Math.round((nc.data('lh') * opt.bh)) + "px",
4991														 minWidth:(nc.data('minwidth') * opt.bw) + "px",
4992														 minHeight:(nc.data('minheight') * opt.bh) + "px",
4993
4994														/* width:(nc.data('wii') * opt.bw) + "px",
4995														 height:(nc.data('hii') * opt.bh) + "px",														 */
4996
4997														 overwrite:"auto"
4998										});
4999										setTimeout(function() {
5000											nc.css("-webkit-transition", nc.data('wan'));
5001										    nc.css("-moz-transition", nc.data('moan'));
5002										    nc.css("-ms-transition", nc.data('man'));
5003										    nc.css("transition", nc.data('ani'));
5004
5005										},30);
5006
5007										//konsole.log(nc.data('maxwidth')+"  "+nc.data('maxheight'));
5008										if (nc.data('maxheight')!='none')
5009											nc.css({'maxHeight':(nc.data('maxheight') * opt.bh) + "px"});
5010
5011
5012										if (nc.data('maxwidth')!='none')
5013											nc.css({'maxWidth':(nc.data('maxwidth') * opt.bw) + "px"});
5014								}
5015						}
5016
5017
5018				/******************************
5019					-	CAPTION LOOPS	-
5020				********************************/
5021
5022
5023				var callCaptionLoops = function(nextcaption,factor) {
5024
5025					// SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
5026									nextcaption.find('.rs-pendulum').each(function() {
5027										var el = jQuery(this);
5028										if (el.data('timeline')==undefined) {
5029											el.data('timeline',new punchgs.TimelineLite);
5030											var startdeg = el.data('startdeg')==undefined ? -20 : el.data('startdeg'),
5031												enddeg = el.data('enddeg')==undefined ? 20 : el.data('enddeg');
5032												speed = el.data('speed')==undefined ? 2 : el.data('speed'),
5033												origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'),
5034												easing = el.data('ease')==undefined ? punchgs.Power2.easeInOut : el.data('ease');
5035
5036											startdeg = startdeg * factor;
5037											enddeg = enddeg * factor;
5038
5039											el.data('timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:startdeg,transformOrigin:origin},{rotation:enddeg,ease:easing}));
5040											el.data('timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:enddeg,transformOrigin:origin},{rotation:startdeg,ease:easing,onComplete:function() {
5041												el.data('timeline').restart();
5042											}}));
5043										}
5044
5045									})
5046
5047									// SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
5048									nextcaption.find('.rs-slideloop').each(function() {
5049										var el = jQuery(this);
5050										if (el.data('timeline')==undefined) {
5051											el.data('timeline',new punchgs.TimelineLite);
5052											var xs = el.data('xs')==undefined ? 0 : el.data('xs'),
5053												ys = el.data('ys')==undefined ? 0 : el.data('ys');
5054												xe = el.data('xe')==undefined ? 0 : el.data('xe'),
5055												ye = el.data('ye')==undefined ? 0 : el.data('ye'),
5056												speed = el.data('speed')==undefined ? 2 : el.data('speed'),
5057												easing = el.data('ease')==undefined ? punchgs.Power2.easeInOut : el.data('ease');
5058
5059												xs = xs * factor;
5060												ys = ys * factor;
5061												xe = xe * factor;
5062												ye = ye * factor;
5063
5064											el.data('timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",x:xs,y:ys},{x:xe,y:ye,ease:easing}));
5065											el.data('timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",x:xe,y:ye},{x:xs,y:ys,onComplete:function() {
5066												el.data('timeline').restart();
5067											}}));
5068										}
5069
5070									})
5071
5072									// SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
5073									nextcaption.find('.rs-pulse').each(function() {
5074										var el = jQuery(this);
5075										if (el.data('timeline')==undefined) {
5076											el.data('timeline',new punchgs.TimelineLite);
5077											var zoomstart = el.data('zoomstart')==undefined ? 0 : el.data('zoomstart'),
5078												zoomend = el.data('zoomend')==undefined ? 0 : el.data('zoomend');
5079												speed = el.data('speed')==undefined ? 2 : el.data('speed'),
5080												easing = el.data('ease')==undefined ? punchgs.Power2.easeInOut : el.data('ease');
5081
5082											el.data('timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",scale:zoomstart},{scale:zoomend,ease:easing}));
5083											el.data('timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",scale:zoomend},{scale:zoomstart,onComplete:function() {
5084												el.data('timeline').restart();
5085											}}));
5086										}
5087
5088									})
5089
5090									nextcaption.find('.rs-wave').each(function() {
5091										var el = jQuery(this);
5092										if (el.data('timeline')==undefined) {
5093											el.data('timeline',new punchgs.TimelineLite);
5094
5095											var angle= el.data('angle')==undefined ? 10 : el.data('angle'),
5096												radius = el.data('radius')==undefined ? 10 : el.data('radius'),
5097												speed = el.data('speed')==undefined ? -20 : el.data('speed'),
5098												origin = el.data('origin')==undefined ? -20 : el.data('origin');
5099
5100												angle = angle*factor;
5101												radius = radius * factor;
5102
5103											var angobj = {a:0, ang : angle, element:el, unit:radius};
5104
5105
5106												el.data('timeline').append(new punchgs.TweenLite.fromTo(angobj,speed,
5107																			{	a:360	},
5108																			{	a:0,
5109																				force3D:"auto",
5110																				ease:punchgs.Linear.easeNone,
5111																				onUpdate:function() {
5112
5113																					var rad = angobj.a * (Math.PI / 180);
5114																		            punchgs.TweenLite.to(angobj.element,0.1,{force3D:"auto",x:Math.cos(rad) * angobj.unit, y:angobj.unit * (1 - Math.sin(rad))});
5115
5116																				},
5117																				onComplete:function() {
5118																					el.data('timeline').restart();
5119																				}
5120																			}
5121																			));
5122										}
5123
5124									})
5125				}
5126
5127				var killCaptionLoops = function(nextcaption) {
5128							// SOME LOOPING ANIMATION ON INTERNAL ELEMENTS
5129							nextcaption.find('.rs-pendulum, .rs-slideloop, .rs-pulse, .rs-wave').each(function() {
5130								var el = jQuery(this);
5131								if (el.data('timeline')!=undefined) {
5132										el.data('timeline').pause();
5133										el.data('timeline',null);
5134									}
5135								});
5136				}
5137
5138				//////////////////////////
5139				//	REMOVE THE CAPTIONS //
5140				/////////////////////////
5141				var removeTheCaptions = function(actli,opt) {
5142
5143						var removetime = 0;
5144
5145						var allcaptions = actli.find('.tp-caption'),
5146							allstaticcaptions = opt.container.find('.tp-static-layers').find('.tp-caption');
5147
5148
5149						jQuery.each(allstaticcaptions, function(index,staticcapt) {
5150							allcaptions.push(staticcapt);
5151						});
5152
5153						allcaptions.each(function(i) {
5154
5155
5156
5157							    var staticdirection = -1;	// 1 -> In,  2-> Out  0-> Ignore  -1-> Not Static
5158
5159								var nextcaption=jQuery(this);
5160								if (nextcaption.hasClass("tp-static-layer")) {
5161
5162									if (nextcaption.data('startslide') == -1 || nextcaption.data('startslide') == "-1")
5163										nextcaption.data('startslide',0);
5164
5165									if (nextcaption.data('endslide') == -1 || nextcaption.data('endslide') == "-1")
5166										nextcaption.data('endslide',opt.slideamount);
5167
5168
5169
5170									// IF STATIC ITEM CURRENTLY NOT VISIBLE
5171									if (nextcaption.hasClass("tp-is-shown")) {
5172
5173										if ((nextcaption.data('startslide') > opt.next) ||
5174											(nextcaption.data('endslide') < opt.next)) {
5175
5176											staticdirection = 2;
5177											nextcaption.removeClass("tp-is-shown");
5178										} else {
5179											staticdirection = 0;
5180										}
5181									} else {
5182										staticdirection = 2;
5183									}
5184
5185
5186
5187								}
5188
5189
5190
5191							if (staticdirection != 0 ) {
5192
5193									killCaptionLoops(nextcaption);
5194
5195									if (nextcaption.find('iframe').length>0) {
5196																	// VIMEO VIDEO PAUSE
5197																	//if (nextcaption.data('vimeoid')!=undefined && String(nextcaption.data('vimeoid')).length>0)
5198																	  	punchgs.TweenLite.to(nextcaption.find('iframe'),0.2,{autoAlpha:0});
5199																	  	if (is_mobile()) nextcaption.find('iframe').remove();
5200																	try {
5201																		var ifr = nextcaption.find('iframe');
5202																		var id = ifr.attr('id');
5203																		var froogaloop = $f(id);
5204																		froogaloop.api("pause");
5205																		clearTimeout(nextcaption.data('timerplay'));
5206																	} catch(e) {}
5207
5208																	try {
5209																		var player=nextcaption.data('player');
5210																		player.stopVideo();
5211																		clearTimeout(nextcaption.data('timerplay'));
5212																	} catch(e) {}
5213																}
5214
5215									// IF HTML5 VIDEO IS EMBEDED
5216									if (nextcaption.find('video').length>0) {
5217													try{
5218														nextcaption.find('video').each(function(i) {
5219															var html5vid = jQuery(this).parent();
5220															var videoID =html5vid.attr('id');
5221															clearTimeout(html5vid.data('timerplay'));
5222															var video = this;
5223															video.pause();
5224														})
5225													}catch(e) {}
5226												} // END OF VIDEO JS FUNCTIONS
5227									try {
5228
5229											//var tl = punchgs.TimelineLite.exportRoot();
5230											var tl = nextcaption.data('timeline');
5231											var endstarts = tl.getLabelTime("frame99");
5232											var curtime = tl.time();
5233											if (endstarts>curtime) {
5234
5235												// WE NEED TO STOP ALL OTHER NIMATIONS
5236												var tweens = tl.getTweensOf(nextcaption);
5237												jQuery.each(tweens,function(index,tw) {
5238
5239													if (index!=0)
5240														tw.pause();
5241												});
5242												if (nextcaption.css('opacity')!=0) {
5243													var spp = nextcaption.data('endspeed') == undefined ? nextcaption.data('speed') : nextcaption.data('endspeed');
5244													if (spp>removetime) removetime =spp;
5245													tl.play("frame99");
5246												} else
5247													tl.progress(1,false);
5248											}
5249
5250										} catch(e) {}
5251
5252							}
5253
5254						});
5255
5256						return removetime;
5257				}
5258
5259				//////////////////////////////
5260				//	MOVE THE CAPTIONS  //
5261				////////////////////////////
5262				var addMoveCaption = function(nextcaption,opt,params,frame,downscale) {
5263							var tl = nextcaption.data('timeline');
5264
5265							var newtl = new punchgs.TimelineLite();
5266
5267							var animobject = nextcaption;
5268
5269							if (params.typ == "chars") animobject = nextcaption.data('mySplitText').chars;
5270							else
5271							if (params.typ == "words") animobject = nextcaption.data('mySplitText').words;
5272							else
5273							if (params.typ == "lines") animobject = nextcaption.data('mySplitText').lines;
5274							params.animation.ease = params.ease;
5275
5276							if (params.animation.rotationZ !=undefined) params.animation.rotation = params.animation.rotationZ;
5277							params.animation.data = new Object();
5278							params.animation.data.oldx = params.animation.x;
5279							params.animation.data.oldy = params.animation.y;
5280
5281							params.animation.x = params.animation.x * downscale;
5282							params.animation.y = params.animation.y * downscale;
5283
5284
5285							tl.add(newtl.staggerTo(animobject,params.speed,params.animation,params.elementdelay),params.start);
5286							tl.addLabel(frame,params.start);
5287
5288							nextcaption.data('timeline',tl);
5289
5290				}
5291				//////////////////////////////
5292				//	MOVE OUT THE CAPTIONS  //
5293				////////////////////////////
5294				var endMoveCaption = function(nextcaption,opt,mdelay,backwards,frame,downscale) {
5295
5296									var tl = nextcaption.data('timeline');
5297									var newtl = new punchgs.TimelineLite();
5298
5299									var frm = newAnimObject();
5300									var mspeed= (nextcaption.data('endspeed') == undefined) ? nextcaption.data('speed') : nextcaption.data('endspeed');
5301									frm.ease = (nextcaption.data('endeasing') == undefined) ? punchgs.Power1.easeInOut : nextcaption.data('endeasing');
5302
5303									mspeed = mspeed/1000;
5304
5305
5306
5307									if (nextcaption.hasClass('ltr') ||
5308										nextcaption.hasClass('ltl') ||
5309										nextcaption.hasClass('str') ||
5310										nextcaption.hasClass('stl') ||
5311										nextcaption.hasClass('ltt') ||
5312										nextcaption.hasClass('ltb') ||
5313										nextcaption.hasClass('stt') ||
5314										nextcaption.hasClass('stb') ||
5315										nextcaption.hasClass('skewtoright') ||
5316										nextcaption.hasClass('skewtorightshort') ||
5317										nextcaption.hasClass('skewtoleft') ||
5318										nextcaption.hasClass('skewtoleftshort') ||
5319										nextcaption.hasClass('fadeout') ||
5320										nextcaption.hasClass("randomrotateout"))
5321									{
5322
5323										if (nextcaption.hasClass('skewtoright') || nextcaption.hasClass('skewtorightshort')) frm.skewX = 35
5324										else
5325										if (nextcaption.hasClass('skewtoleft') || nextcaption.hasClass('skewtoleftshort')) frm.skewX =  -35
5326
5327
5328										if (nextcaption.hasClass('ltr') || nextcaption.hasClass('skewtoright'))
5329											frm.x=opt.width+60;
5330										else if (nextcaption.hasClass('ltl') || nextcaption.hasClass('skewtoleft'))
5331											frm.x=0-(opt.width+60);
5332										else if (nextcaption.hasClass('ltt'))
5333											frm.y=0-(opt.height+60);
5334										else if (nextcaption.hasClass('ltb'))
5335											frm.y=opt.height+60;
5336										else if (nextcaption.hasClass('str') || nextcaption.hasClass('skewtorightshort')) {
5337											frm.x=50;frm.opacity=0;
5338										} else if (nextcaption.hasClass('stl') || nextcaption.hasClass('skewtoleftshort')) {
5339											frm.x=-50;frm.opacity=0;
5340										} else if (nextcaption.hasClass('stt')) {
5341											frm.y=-50;frm.opacity=0;
5342										} else if (nextcaption.hasClass('stb')) {
5343											frm.y=50;frm.opacity=0;
5344										} else if (nextcaption.hasClass("randomrotateout")) {
5345											frm.x = Math.random()*opt.width;
5346											frm.y = Math.random()*opt.height;
5347											frm.scale = Math.random()*2+0.3;
5348											frm.rotation = Math.random()*360-180;
5349											frm.opacity = 0;
5350										} else if (nextcaption.hasClass('fadeout')) {
5351											frm.opacity = 0;
5352										}
5353
5354										if (nextcaption.hasClass('skewtorightshort')) frm.x = 270;
5355										else
5356										if (nextcaption.hasClass('skewtoleftshort')) frm.x =  -270
5357										frm.data = new Object();
5358										frm.data.oldx = frm.x;
5359										frm.data.oldy = frm.y;
5360										frm.x = frm.x * downscale;
5361										frm.y = frm.y * downscale;
5362
5363										frm.overwrite="auto";
5364										var animobject = nextcaption;
5365										var animobject = nextcaption;
5366										if (nextcaption.data('splitout') == "chars") animobject = nextcaption.data('mySplitText').chars;
5367										else
5368										if (nextcaption.data('splitout') == "words") animobject = nextcaption.data('mySplitText').words;
5369										else
5370										if (nextcaption.data('splitout') == "lines") animobject = nextcaption.data('mySplitText').lines;
5371										var elemdelay = (nextcaption.data('endelementdelay') == undefined) ? 0 : nextcaption.data('endelementdelay');
5372										//tl.add(punchgs.TweenLite.to(nextcaption,mspeed,frm),mdelay);
5373										tl.add(newtl.staggerTo(animobject,mspeed,frm,elemdelay),mdelay);
5374
5375									}
5376
5377									else
5378
5379									if (nextcaption.hasClass("customout")) {
5380
5381										frm = getAnimDatas(frm,nextcaption.data('customout'));
5382										var animobject = nextcaption;
5383										if (nextcaption.data('splitout') == "chars") animobject = nextcaption.data('mySplitText').chars;
5384										else
5385										if (nextcaption.data('splitout') == "words") animobject = nextcaption.data('mySplitText').words;
5386										else
5387										if (nextcaption.data('splitout') == "lines") animobject = nextcaption.data('mySplitText').lines;
5388
5389										var elemdelay = (nextcaption.data('endelementdelay') == undefined) ? 0 : nextcaption.data('endelementdelay');
5390										frm.onStart = function() {
5391
5392																 punchgs.TweenLite.set(nextcaption,{
5393																	  transformPerspective:frm.transformPerspective,
5394																	  transformOrigin:frm.transformOrigin,
5395																	  overwrite:"auto"
5396																  });
5397										}
5398
5399										frm.data = new Object();
5400										frm.data.oldx = frm.x;
5401										frm.data.oldy = frm.y;
5402
5403										frm.x = frm.x * downscale;
5404										frm.y = frm.y * downscale;
5405
5406										tl.add(newtl.staggerTo(animobject,mspeed,frm,elemdelay),mdelay);
5407									}
5408
5409									else {
5410										backwards.delay = 0;
5411										tl.add(punchgs.TweenLite.to(nextcaption,mspeed,backwards),mdelay);
5412									}
5413
5414
5415								tl.addLabel(frame,mdelay);
5416
5417								nextcaption.data('timeline',tl);
5418			}
5419
5420		///////////////////////////
5421		//	REMOVE THE LISTENERS //
5422		///////////////////////////
5423		var removeAllListeners = function(container,opt) {
5424			container.children().each(function() {
5425			  try{ jQuery(this).die('click'); } catch(e) {}
5426			  try{ jQuery(this).die('mouseenter');} catch(e) {}
5427			  try{ jQuery(this).die('mouseleave');} catch(e) {}
5428			  try{ jQuery(this).unbind('hover');} catch(e) {}
5429			})
5430			try{ container.die('click','mouseenter','mouseleave');} catch(e) {}
5431			clearInterval(opt.cdint);
5432			container=null;
5433
5434
5435
5436		}
5437
5438		///////////////////////////
5439		//	-	countDown	-	//
5440		/////////////////////////
5441		var countDown = function(container,opt) {
5442			opt.cd=0;
5443			opt.loop=0;
5444			if (opt.stopAfterLoops!=undefined && opt.stopAfterLoops>-1)
5445					opt.looptogo=opt.stopAfterLoops;
5446			else
5447				opt.looptogo=9999999;
5448
5449			if (opt.stopAtSlide!=undefined && opt.stopAtSlide>-1)
5450					opt.lastslidetoshow=opt.stopAtSlide;
5451			else
5452					opt.lastslidetoshow=999;
5453
5454			opt.stopLoop="off";
5455
5456			if (opt.looptogo==0) opt.stopLoop="on";
5457
5458
5459			if (opt.slideamount >1 && !(opt.stopAfterLoops==0 && opt.stopAtSlide==1) ) {
5460					var bt=container.find('.tp-bannertimer');
5461
5462
5463					// LISTENERS  //container.trigger('stoptimer');
5464					container.on('stoptimer',function() {
5465						var bt = jQuery(this).find('.tp-bannertimer');
5466						bt.data('tween').pause();
5467						if (opt.hideTimerBar=="on") bt.css({visibility:"hidden"});
5468					});
5469					container.on('starttimer',function() {
5470
5471						if (opt.conthover!=1 && opt.videoplaying!=true && opt.width>opt.hideSliderAtLimit && opt.bannertimeronpause != true && opt.overnav !=true)
5472							if ((opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) || opt.noloopanymore == 1)
5473							{
5474
5475							   opt.noloopanymore = 1;
5476							}
5477							else {
5478
5479								bt.css({visibility:"visible"});
5480								bt.data('tween').resume();
5481							}
5482
5483							if (opt.hideTimerBar=="on") bt.css({visibility:"hidden"});
5484					});
5485					container.on('restarttimer',function() {
5486						var bt = jQuery(this).find('.tp-bannertimer');
5487						if ((opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) || opt.noloopanymore == 1)
5488							{
5489							   	opt.noloopanymore = 1;
5490							}
5491							else {
5492
5493								bt.css({visibility:"visible"});
5494								bt.data('tween').kill();
5495								bt.data('tween',punchgs.TweenLite.fromTo(bt,opt.delay/1000,{width:"0%"},{force3D:"auto",width:"100%",ease:punchgs.Linear.easeNone,onComplete:countDownNext,delay:1}));
5496
5497							}
5498							if (opt.hideTimerBar=="on") bt.css({visibility:"hidden"});
5499					});
5500
5501					container.on('nulltimer',function() {
5502
5503							bt.data('tween').pause(0);
5504							if (opt.hideTimerBar=="on") bt.css({visibility:"hidden"});
5505
5506					});
5507
5508
5509
5510					 var countDownNext = function() {
5511						if (jQuery('body').find(container).length==0) {
5512							removeAllListeners(container,opt);
5513							clearInterval(opt.cdint);
5514						}
5515						
5516						container.trigger("revolution.slide.slideatend");
5517
5518						//STATE OF API CHANGED -> MOVE TO AIP BETTER
5519						if (container.data('conthover-changed') == 1) {
5520							opt.conthover=	container.data('conthover');
5521							container.data('conthover-changed',0);
5522						}
5523
5524						// SWAP TO NEXT BANNER
5525						opt.act=opt.next;
5526						opt.next=opt.next+1;
5527
5528						if (opt.next>container.find('>ul >li').length-1) {
5529								opt.next=0;
5530								opt.looptogo=opt.looptogo-1;
5531
5532								if (opt.looptogo<=0) {
5533										opt.stopLoop="on";
5534
5535								}
5536							}
5537
5538						// STOP TIMER IF NO LOOP NO MORE NEEDED.
5539
5540						if (opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) {
5541								container.find('.tp-bannertimer').css({'visibility':'hidden'});
5542								container.trigger('revolution.slide.onstop');
5543								opt.noloopanymore = 1;
5544						} else {
5545							bt.data('tween').restart();
5546						}
5547
5548						// SWAP THE SLIDES
5549						swapSlide(container,opt);
5550
5551					}
5552
5553					bt.data('tween',punchgs.TweenLite.fromTo(bt,opt.delay/1000,{width:"0%"},{force3D:"auto",width:"100%",ease:punchgs.Linear.easeNone,onComplete:countDownNext,delay:1}));
5554					bt.data('opt',opt);
5555
5556
5557					container.hover(
5558						function() {
5559
5560							if (opt.onHoverStop=="on" && (!is_mobile())) {
5561								container.trigger('stoptimer');
5562
5563								container.trigger('revolution.slide.onpause');
5564								var nextsh = container.find('>ul >li:eq('+opt.next+') .slotholder');
5565								nextsh.find('.defaultimg').each(function() {
5566									var dimg = jQuery(this);
5567									if (dimg.data('kenburn')!=undefined) {
5568									   dimg.data('kenburn').pause();
5569									 }
5570								});
5571							}
5572						},
5573						function() {
5574							if (container.data('conthover')!=1) {
5575								container.trigger('revolution.slide.onresume');
5576								container.trigger('starttimer');
5577
5578								var nextsh = container.find('>ul >li:eq('+opt.next+') .slotholder');
5579								nextsh.find('.defaultimg').each(function() {
5580									var dimg = jQuery(this);
5581									if (dimg.data('kenburn')!=undefined) {
5582									   dimg.data('kenburn').play();
5583									 }
5584								});
5585							}
5586						});
5587			}
5588		}
5589
5590
5591	//////////////////
5592	// IS MOBILE ?? //
5593	//////////////////
5594	var is_mobile = function() {
5595	    var agents = ['android', 'webos', 'iphone', 'ipad', 'blackberry','Android', 'webos', ,'iPod', 'iPhone', 'iPad', 'Blackberry', 'BlackBerry'];
5596		var ismobile=false;
5597	    for(i in agents) {
5598
5599		    if (navigator.userAgent.split(agents[i]).length>1) {
5600	            ismobile = true;
5601
5602	          }
5603	    }
5604	    return ismobile;
5605	}
5606
5607
5608
5609/**************************************************************************
5610 * Revolution Slider - PAN ZOOM MODULE
5611 * @version: 1.0 (03.06.2013)
5612 * @author ThemePunch
5613**************************************************************************/
5614
5615	/***********************************************
5616		-	KEN BURN BACKGROUND FIT CALCULATOR	-
5617	***********************************************/
5618	var calculateKenBurnScales = function(proc,sloth,opt) {
5619				var ow = sloth.data('owidth');
5620				var oh = sloth.data('oheight');
5621
5622				if (ow / oh > opt.width / opt.height) {
5623					var factor = (opt.container.width() /ow);
5624					var nheight = oh * factor;
5625					var hfactor = (nheight / opt.container.height())*proc;
5626					proc = proc * (100/hfactor);
5627					hfactor = 100;
5628					proc = proc;
5629					return (proc+"% "+hfactor+"%"+" 1");
5630				} else {
5631					var factor = (opt.container.width() /ow);
5632					var nheight = oh * factor;
5633					var hfactor = (nheight / opt.container.height())*proc;
5634					return (proc+"% "+hfactor+"%");
5635				}
5636			}
5637
5638
5639
5640	/******************************
5641		-	startKenBurn	-
5642	********************************/
5643	var startKenBurn = function(container,opt,recalc,prepareonly) {
5644
5645		try{
5646			var actli = container.find('>ul:first-child >li:eq('+opt.act+')');
5647		} catch(e) {
5648			var actli=container.find('>ul:first-child >li:eq(1)');
5649		}
5650
5651		opt.lastslide=opt.act;
5652
5653
5654		var nextli = container.find('>ul:first-child >li:eq('+opt.next+')'),
5655			nextsh = nextli.find('.slotholder'),
5656			bgps = nextsh.data('bgposition'),
5657			bgpe = nextsh.data('bgpositionend'),
5658			zos = nextsh.data('zoomstart')/100,
5659			zoe = nextsh.data('zoomend')/100,
5660			ros = nextsh.data('rotationstart'),
5661			roe = nextsh.data('rotationend'),
5662			bgfs = nextsh.data('bgfit'),
5663			bgfe = nextsh.data('bgfitend'),
5664			easeme = nextsh.data('easeme'),
5665			dur = nextsh.data('duration')/1000,
5666			bgfb = 100;
5667
5668
5669			if (bgfs==undefined) bgfs=100;
5670			if (bgfe==undefined) bgfe=100;
5671			var obgfs = bgfs,
5672				obgfe = bgfe;
5673
5674			bgfs = calculateKenBurnScales(bgfs,nextsh,opt);
5675			bgfe = calculateKenBurnScales(bgfe,nextsh,opt);
5676			bgfb = calculateKenBurnScales(100,nextsh,opt);
5677
5678
5679			if (zos==undefined) zos=1;
5680			if (zoe==undefined) zoe=1;
5681			if (ros==undefined) ros=0;
5682			if (roe==undefined) roe=0;
5683
5684			if (zos<1) zos=1;
5685			if (zoe<1) zoe=1;
5686
5687
5688			var imgobj = new Object();
5689			imgobj.w = parseInt(bgfb.split(" ")[0],0),
5690			imgobj.h = parseInt(bgfb.split(" ")[1],0);
5691
5692			var turned = false;
5693			if (bgfb.split(" ")[2] == "1") {
5694				turned = true;
5695			}
5696
5697			nextsh.find('.defaultimg').each(function() {
5698				var defimg = jQuery(this);
5699				if (nextsh.find('.kenburnimg').length==0)
5700					nextsh.append('<div class="kenburnimg" style="position:absolute;z-index:1;width:100%;height:100%;top:0px;left:0px;"><img src="'+defimg.attr('src')+'" style="-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;position:absolute;width:'+imgobj.w+'%;height:'+imgobj.h+'%;"></div>');
5701				else {
5702					nextsh.find('.kenburnimg img').css({width:imgobj.w+'%',height:imgobj.h+'%'});
5703				}
5704
5705
5706
5707				var kbimg = nextsh.find('.kenburnimg img');
5708
5709
5710				var imgs = calculateKenBurnImgPos(opt,bgps,bgfs,kbimg,turned),
5711					imge = calculateKenBurnImgPos(opt,bgpe,bgfe,kbimg,turned);
5712
5713				if (turned) {
5714					imgs.w = obgfs/100;
5715					imge.w = obgfe/100;
5716				}
5717
5718
5719
5720				if (prepareonly) {
5721
5722					punchgs.TweenLite.set(kbimg,{autoAlpha:0,
5723											transformPerspective:1200,
5724											transformOrigin:"0% 0%",
5725											top:0,left:0,
5726											scale:imgs.w,
5727											x:imgs.x,
5728											y:imgs.y});
5729					var sx = imgs.w,
5730						ww = (sx * kbimg.width()) - opt.width,
5731						hh = (sx * kbimg.height()) - opt.height,
5732						hor = Math.abs((imgs.x / ww)*100),
5733						ver = Math.abs((imgs.y / hh)*100);
5734						if (hh==0) ver =0;
5735						if (ww == 0) hor = 0;
5736					defimg.data('bgposition',hor+"% "+ver+"%");
5737					if (!isIE(8)) defimg.data('currotate',getRotationDegrees(kbimg));
5738					if (!isIE(8)) defimg.data('curscale',(imgobj.w*sx)+"%  "+(imgobj.h*sx+"%"));
5739
5740					nextsh.find('.kenburnimg').remove();
5741				}
5742				else
5743					defimg.data('kenburn',punchgs.TweenLite.fromTo(kbimg,dur,{autoAlpha:1, force3D:punchgs.force3d, transformOrigin:"0% 0%", top:0,left:0, scale:imgs.w, x:imgs.x, y:imgs.y},{autoAlpha:1,rotationZ:roe,ease:easeme, x:imge.x, y:imge.y,scale:imge.w,onUpdate:function() {
5744							var sx = kbimg[0]._gsTransform.scaleX;
5745							var ww = (sx * kbimg.width()) - opt.width,
5746								hh = (sx * kbimg.height()) - opt.height,
5747								hor = Math.abs((kbimg[0]._gsTransform.x / ww)*100),
5748								ver = Math.abs((kbimg[0]._gsTransform.y / hh)*100);
5749								if (hh==0) ver =0;
5750								if (ww == 0) hor = 0;
5751
5752							defimg.data('bgposition',hor+"% "+ver+"%");
5753
5754							if (!isIE(8)) defimg.data('currotate',getRotationDegrees(kbimg));
5755							if (!isIE(8)) defimg.data('curscale',(imgobj.w*sx)+"%  "+(imgobj.h*sx+"%"));
5756							//punchgs.TweenLite.set(defimg,{rotation:defimg.data('currotate'), backgroundPosition:defimg.data('bgposition'), backgroundSize:defimg.data('curscale')});
5757					}}));
5758		})
5759	}
5760
5761	/*************************************************
5762		-	CALCULATE KENBURNS IMAGE POSITIONS	-
5763	**************************************************/
5764
5765	var calculateKenBurnImgPos = function(opt,bgp,bgf,img,turned) {
5766			var imgobj = new Object;
5767
5768			if (!turned)
5769				imgobj.w = parseInt(bgf.split(" ")[0],0) / 100;
5770			else
5771				imgobj.w = parseInt(bgf.split(" ")[1],0) / 100;
5772
5773			switch(bgp) {
5774							case "left top":
5775							case "top left":
5776								imgobj.x = 0;
5777								imgobj.y = 0;
5778							break;
5779							case "center top":
5780							case "top center":
5781								imgobj.x = (((0-img.width()) * imgobj.w) + parseInt(opt.width,0))/2;
5782								imgobj.y = 0;
5783							break;
5784							case "top right":
5785							case "right top":
5786								imgobj.x = ((0-img.width()) * imgobj.w) + parseInt(opt.width,0);
5787								imgobj.y = 0;
5788
5789							break;
5790							case "center left":
5791							case "left center":
5792								imgobj.x = 0;
5793								imgobj.y = (((0-img.height()) * imgobj.w) + parseInt(opt.height,0)) / 2;
5794							break;
5795							case "center center":
5796								imgobj.x = (((0-img.width()) * imgobj.w) + parseInt(opt.width,0))/2;
5797								imgobj.y = (((0-img.height()) * imgobj.w) + parseInt(opt.height,0)) / 2;
5798
5799							break;
5800							case "center right":
5801							case "right center":
5802								imgobj.x = ((0-img.width()) * imgobj.w) + parseInt(opt.width,0);
5803								imgobj.y = (((0-img.height()) * imgobj.w) + parseInt(opt.height,0)) / 2;
5804
5805							break;
5806							case "bottom left":
5807							case "left bottom":
5808								imgobj.x =0;
5809								imgobj.y = ((0-img.height()) * imgobj.w) + parseInt(opt.height,0);
5810
5811							break;
5812							case "bottom center":
5813							case "center bottom":
5814								imgobj.x = (((0-img.width()) * imgobj.w) + parseInt(opt.width,0))/2;
5815								imgobj.y = ((0-img.height()) * imgobj.w) + parseInt(opt.height,0);
5816							break;
5817							case "bottom right":
5818							case "right bottom":
5819								imgobj.x = ((0-img.width()) * imgobj.w) + parseInt(opt.width,0);
5820								imgobj.y = ((0-img.height()) * imgobj.w) + parseInt(opt.height,0);
5821							break;
5822						}
5823
5824
5825
5826			return imgobj;
5827		}
5828
5829		/******************************
5830			-	GET ROTATION DEGREES	-
5831		********************************/
5832		var getRotationDegrees = function(obj) {
5833				    var matrix = obj.css("-webkit-transform") ||
5834				    obj.css("-moz-transform")    ||
5835				    obj.css("-ms-transform")     ||
5836				    obj.css("-o-transform")      ||
5837				    obj.css("transform");
5838				    if(matrix !== 'none') {
5839				        var values = matrix.split('(')[1].split(')')[0].split(',');
5840				        var a = values[0];
5841				        var b = values[1];
5842				        var angle = Math.round(Math.atan2(b, a) * (180/Math.PI));
5843				    } else { var angle = 0; }
5844				    return (angle < 0) ? angle +=360 : angle;
5845				}
5846
5847
5848		/******************************
5849			-	STOP KEN BURN	-
5850		********************************/
5851		var stopKenBurn = function(container,opt) {
5852
5853			try{
5854				var actli = container.find('>ul:first-child >li:eq('+opt.act+')');
5855			} catch(e) {
5856				var actli=container.find('>ul:first-child >li:eq(1)');
5857			}
5858
5859			opt.lastslide=opt.act;
5860
5861			var nextli = container.find('>ul:first-child >li:eq('+opt.next+')');
5862
5863
5864			var actsh = actli.find('.slotholder');
5865			var nextsh = nextli.find('.slotholder');
5866
5867			container.find('.defaultimg').each(function() {
5868				var defimg = jQuery(this);
5869				punchgs.TweenLite.killTweensOf(defimg,false);
5870				punchgs.TweenLite.set(defimg,{scale:1,rotationZ:0});
5871				punchgs.TweenLite.killTweensOf(defimg.data('kenburn img'),false);
5872				if (defimg.data('kenburn') != undefined) {
5873					defimg.data('kenburn').pause();
5874				}
5875				if (defimg.data('currotate') != undefined && defimg.data('bgposition') !=undefined && defimg.data('curscale') != undefined)
5876					punchgs.TweenLite.set(defimg,{rotation:defimg.data('currotate'), backgroundPosition:defimg.data('bgposition'), backgroundSize:defimg.data('curscale')});
5877				if (defimg!= undefined && defimg.data('kenburn img') != undefined && defimg.data('kenburn img').length>0) punchgs.TweenLite.set(defimg.data('kenburn img'),{autoAlpha:0});
5878
5879			});
5880		}
5881
5882//// END OF KENBURNS EXTNESION
5883
5884
5885
5886
5887/**************************************************************************
5888 * Revolution Slider - PARALLAX MODULE
5889 * @version: 1.1 (23.06.2013)
5890 * @author ThemePunch
5891**************************************************************************/
5892
5893		/******************************
5894			-	PARALLAX EFFECT	-
5895		********************************/
5896		var checkForParallax = function(container,opt) {
5897			if (is_mobile() && opt.parallaxDisableOnMobile=="on") return false;
5898
5899			container.find('>ul:first-child >li').each(function() {
5900				var li = jQuery(this);
5901				for (var i = 1; i<=10;i++)
5902					li.find('.rs-parallaxlevel-'+i).each(function() {
5903						var pw = jQuery(this);
5904						pw.wrap('<div style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:'+pw.css('zIndex')+'" class="tp-parallax-container" data-parallaxlevel="'+opt.parallaxLevels[i-1]+'"></div>');
5905					});
5906			})
5907
5908
5909
5910			if (opt.parallax=="mouse" || opt.parallax=="scroll+mouse" || opt.parallax=="mouse+scroll") {
5911
5912						container.mouseenter(function(event) {
5913							var currslide = container.find('.current-sr-slide-visible');
5914									var t = container.offset().top,
5915										l = container.offset().left,
5916										ex = (event.pageX-l),
5917										ey =  (event.pageY-t);
5918									currslide.data("enterx",ex);
5919									currslide.data("entery",ey);
5920
5921						})
5922
5923						container.on('mousemove.hoverdir, mouseleave.hoverdir',function(event) {
5924							var currslide = container.find('.current-sr-slide-visible');
5925							switch (event.type) {
5926
5927								case "mousemove":
5928
5929										var	t = container.offset().top,
5930											l = container.offset().left,
5931											mh = currslide.data("enterx"),
5932											mv = currslide.data("entery"),
5933											diffh = (mh - (event.pageX  - l)),
5934											diffv = (mv - (event.pageY - t));
5935
5936										currslide.find(".tp-parallax-container").each(function() {
5937											var pc = jQuery(this),
5938												pl = parseInt(pc.data('parallaxlevel'),0)/100,
5939												offsh =	diffh * pl,
5940												offsv =	diffv * pl;
5941											if (opt.parallax=="scroll+mouse" || opt.parallax=="mouse+scroll")
5942												punchgs.TweenLite.to(pc,0.4,{force3D:"auto",x:offsh,ease:punchgs.Power3.easeOut,overwrite:"all"});
5943											else
5944												punchgs.TweenLite.to(pc,0.4,{force3D:"auto",x:offsh,y:offsv,ease:punchgs.Power3.easeOut,overwrite:"all"});
5945										})
5946
5947								break;
5948								case "mouseleave":
5949										currslide.find(".tp-parallax-container").each(function() {
5950											var pc = jQuery(this);
5951											if (opt.parallax=="scroll+mouse" || opt.parallax=="mouse+scroll")
5952												punchgs.TweenLite.to(pc,1.5,{force3D:"auto",x:0,ease:punchgs.Power3.easeOut});
5953											else
5954												punchgs.TweenLite.to(pc,1.5,{force3D:"auto",x:0,y:0,ease:punchgs.Power3.easeOut});
5955										})
5956								break;
5957							}
5958						});
5959
5960						if (is_mobile())
5961							window.ondeviceorientation = function(event) {
5962							  var 	y = Math.round(event.beta  || 0),
5963							  		x = Math.round(event.gamma || 0);
5964
5965							  var currslide = container.find('.current-sr-slide-visible');
5966
5967
5968							  if (jQuery(window).width() > jQuery(window).height()){
5969							  		var xx = x;
5970							  		x = y;
5971							  		y = xx;
5972
5973							  }
5974
5975								var curh = 360/container.width() * x,
5976							  		curv = 180/container.height() * y;
5977
5978
5979
5980
5981							  currslide.find(".tp-parallax-container").each(function() {
5982												var pc = jQuery(this),
5983													pl = parseInt(pc.data('parallaxlevel'),0)/100,
5984													offsh =	curh * pl,
5985													offsv =	curv * pl;
5986												punchgs.TweenLite.to(pc,0.2,{force3D:"auto",x:offsh,y:offsv,ease:punchgs.Power3.easeOut});
5987											})
5988
5989							  // y: -90 -> +90,  x:-180 -> +180
5990
5991							  //jQuery('.logo-container').html("h:"+curh+"  v:"+curv);
5992							  }
5993			}
5994			if (opt.parallax=="scroll" || opt.parallax=="scroll+mouse" || opt.parallax=="mouse+scroll") {
5995
5996						jQuery(window).on('scroll',function(event) {
5997							scrollParallax(container,opt);
5998						});
5999			}
6000		}
6001
6002		/***************************************
6003			-	SET POST OF SCROLL PARALLAX	-
6004		***************************************/
6005		var scrollParallax = function(container,opt) {
6006			if (is_mobile() && opt.parallaxDisableOnMobile=="on") return false;
6007			var t = container.offset().top,
6008					st = jQuery(window).scrollTop(),
6009					dist = t+container.height()/2,
6010					mv = t+container.height()/2 - st,
6011					wh = jQuery(window).height()/2,
6012					diffv= wh - mv;
6013
6014			if (dist<wh) diffv = diffv - (wh-dist);
6015			var currslide = container.find('.current-sr-slide-visible');
6016			container.find(".tp-parallax-container").each(function(i) {
6017				var pc = jQuery(this),
6018					pl = parseInt(pc.data('parallaxlevel'),0)/100,
6019					offsv =	diffv * pl;
6020				pc.data('parallaxoffset',offsv);
6021				punchgs.TweenLite.to(pc,0.2,{force3D:"auto",y:offsv,ease:punchgs.Power3.easeOut});
6022			})
6023
6024			if (opt.parallaxBgFreeze!="on") {
6025				var pl = opt.parallaxLevels[0]/100,
6026					offsv =	diffv * pl;
6027				punchgs.TweenLite.to(container,0.2,{force3D:"auto",y:offsv,ease:punchgs.Power3.easeOut});
6028			}
6029		}
6030
6031		/**************************************************************************
6032		 * Revolution Slider - THUMBNAIL MODULE
6033		 * @version: 1.0 (03.06.2013)
6034		 * @author ThemePunch
6035		**************************************************************************/
6036
6037
6038		////////////////////////////////
6039		//	-	CREATE THE BULLETS -  //
6040		////////////////////////////////
6041		var createThumbs = function(container,opt) {
6042
6043			var cap=container.parent();
6044
6045
6046
6047			if (opt.navigationType=="thumb" || opt.navsecond=="both") {
6048						cap.append('<div class="tp-bullets tp-thumbs '+opt.navigationStyle+'"><div class="tp-mask"><div class="tp-thumbcontainer"></div></div></div>');
6049			}
6050			var bullets = cap.find('.tp-bullets.tp-thumbs .tp-mask .tp-thumbcontainer');
6051			var bup = bullets.parent();
6052
6053			bup.width(opt.thumbWidth*opt.thumbAmount);
6054			bup.height(opt.thumbHeight);
6055			bup.parent().width(opt.thumbWidth*opt.thumbAmount);
6056			bup.parent().height(opt.thumbHeight);
6057
6058			container.find('>ul:first >li').each(function(i) {
6059							var li= container.find(">ul:first >li:eq("+i+")");
6060							var bgcolor = li.find(".defaultimg").css("backgroundColor");
6061							if (li.data('thumb') !=undefined)
6062								var src= li.data('thumb')
6063							else
6064								var src=li.find("img:first").attr('src');
6065
6066
6067							bullets.append('<div class="bullet thumb" style="background-color:'+bgcolor+';position:relative;width:'+opt.thumbWidth+'px;height:'+opt.thumbHeight+'px;background-image:url('+src+') !important;background-size:cover;background-position:center center;"></div>');
6068							var bullet= bullets.find('.bullet:first');
6069				});
6070			//bullets.append('<div style="clear:both"></div>');
6071			var minwidth=10;
6072
6073
6074			// ADD THE BULLET CLICK FUNCTION HERE
6075			bullets.find('.bullet').each(function(i) {
6076				var bul = jQuery(this);
6077
6078				if (i==opt.slideamount-1) bul.addClass('last');
6079				if (i==0) bul.addClass('first');
6080				bul.width(opt.thumbWidth);
6081				bul.height(opt.thumbHeight);
6082
6083				if (minwidth<bul.outerWidth(true)) minwidth=bul.outerWidth(true);
6084				bul.click(function() {
6085					if (opt.transition==0 && bul.index() != opt.act) {
6086						opt.next = bul.index();
6087						callingNewSlide(opt,container);
6088					}
6089				});
6090			});
6091
6092
6093			var max=minwidth*container.find('>ul:first >li').length;
6094
6095			var thumbconwidth=bullets.parent().width();
6096			opt.thumbWidth = minwidth;
6097
6098
6099
6100			////////////////////////
6101			// SLIDE TO POSITION  //
6102			////////////////////////
6103			if (thumbconwidth<max) {
6104				jQuery(document).mousemove(function(e) {
6105					jQuery('body').data('mousex',e.pageX);
6106				});
6107
6108
6109
6110				// ON MOUSE MOVE ON THE THUMBNAILS EVERYTHING SHOULD MOVE :)
6111
6112				bullets.parent().mouseenter(function() {
6113						var $this=jQuery(this);
6114						$this.addClass("over");
6115						var offset = $this.offset();
6116						var x = jQuery('body').data('mousex')-offset.left;
6117						var thumbconwidth=$this.width();
6118						var minwidth=$this.find('.bullet:first').outerWidth(true);
6119						var max=minwidth*container.find('>ul:first >li').length;
6120						var diff=(max- thumbconwidth)+15;
6121						var steps = diff / thumbconwidth;
6122						x=x-30;
6123						//if (x<30) x=0;
6124						//if (x>thumbconwidth-30) x=thumbconwidth;
6125
6126						//ANIMATE TO POSITION
6127						var pos=(0-((x)*steps));
6128						if (pos>0) pos =0;
6129						if (pos<0-max+thumbconwidth) pos=0-max+thumbconwidth;
6130						moveThumbSliderToPosition($this,pos,200);
6131				});
6132
6133				bullets.parent().mousemove(function() {
6134
6135								var $this=jQuery(this);
6136
6137								//if (!$this.hasClass("over")) {
6138										var offset = $this.offset();
6139										var x = jQuery('body').data('mousex')-offset.left;
6140										var thumbconwidth=$this.width();
6141										var minwidth=$this.find('.bullet:first').outerWidth(true);
6142										var max=minwidth*container.find('>ul:first >li').length-1;
6143										var diff=(max- thumbconwidth)+15;
6144										var steps = diff / thumbconwidth;
6145										x=x-3;
6146										if (x<6) x=0;
6147										if (x+3>thumbconwidth-6) x=thumbconwidth;
6148
6149										//ANIMATE TO POSITION
6150										var pos=(0-((x)*steps));
6151										if (pos>0) pos =0;
6152										if (pos<0-max+thumbconwidth) pos=0-max+thumbconwidth;
6153										moveThumbSliderToPosition($this,pos,0);
6154								//} else {
6155									//$this.removeClass("over");
6156								//}
6157
6158				});
6159
6160				bullets.parent().mouseleave(function() {
6161								var $this=jQuery(this);
6162								$this.removeClass("over");
6163								moveSelectedThumb(container);
6164				});
6165			}
6166
6167
6168		}
6169
6170
6171		///////////////////////////////
6172		//	SelectedThumbInPosition //
6173		//////////////////////////////
6174		var moveSelectedThumb = function(container) {
6175
6176									var bullets=container.parent().find('.tp-bullets.tp-thumbs .tp-mask .tp-thumbcontainer');
6177									var $this=bullets.parent();
6178									var offset = $this.offset();
6179									var minwidth=$this.find('.bullet:first').outerWidth(true);
6180
6181									var x = $this.find('.bullet.selected').index() * minwidth;
6182									var thumbconwidth=$this.width();
6183									var minwidth=$this.find('.bullet:first').outerWidth(true);
6184									var max=minwidth*container.find('>ul:first >li').length;
6185									var diff=(max- thumbconwidth);
6186									var steps = diff / thumbconwidth;
6187
6188									//ANIMATE TO POSITION
6189									var pos=0-x;
6190
6191									if (pos>0) pos =0;
6192									if (pos<0-max+thumbconwidth) pos=0-max+thumbconwidth;
6193									if (!$this.hasClass("over")) {
6194										moveThumbSliderToPosition($this,pos,200);
6195									}
6196		}
6197
6198
6199		////////////////////////////////////
6200		//	MOVE THUMB SLIDER TO POSITION //
6201		///////////////////////////////////
6202		var moveThumbSliderToPosition = function($this,pos,speed) {
6203			punchgs.TweenLite.to($this.find('.tp-thumbcontainer'),0.2,{force3D:"auto",left:pos,ease:punchgs.Power3.easeOut,overwrite:"auto"});
6204		}
6205
6206
6207
6208})(jQuery);
6209
6210
6211
6212/// END OF THUMBNAIL EXTNESIONS
6213
6214
6215
6216
6217
6218
6219// SOME ERROR MESSAGES IN CASE THE PLUGIN CAN NOT BE LOADED
6220function revslider_showDoubleJqueryError(sliderID) {
6221	var errorMessage = "Revolution Slider Error: You have some jquery.js library include that comes after the revolution files js include.";
6222	errorMessage += "<br> This includes make eliminates the revolution slider libraries, and make it not work.";
6223	errorMessage += "<br><br> To fix it you can:<br>&nbsp;&nbsp;&nbsp; 1. In the Slider Settings -> Troubleshooting set option:  <strong><b>Put JS Includes To Body</b></strong> option to true.";
6224	errorMessage += "<br>&nbsp;&nbsp;&nbsp; 2. Find the double jquery.js include and remove it.";
6225	errorMessage = "<span style='font-size:16px;color:#BC0C06;'>" + errorMessage + "</span>"
6226		jQuery(sliderID).show().html(errorMessage);
6227}
6228
6229

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.