PageSourceSearch

https://cifrasoft.com/secondscreen/m/vendor/rs-plugin/js/jquery.themepunch.revolution.js

js cifrasoft.com collected 2026-10-06 01:03:00 UTC 200,739 bytes, 5,974 lines download raw bytes

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

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.