PageSourceSearch

https://multivita.lt/catalog/view/theme/journal2/lib/rs-plugin/js/jquery.themepunch.revolution.js?j2v=2.16.8

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

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.