PageSourceSearch

https://histoire-sedan.fr/shas/js/jquery.revolution.js

js histoire-sedan.fr collected 2026-10-09 05:03:29 UTC 218,038 bytes, 6,267 lines download raw bytes

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

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.