// source --> https://jgm-foerderverein.de/wp-content/plugins/responsive-lightbox/js/front.js?ver=1.7.2 
( function ( $ ) {

	$( document ).on( 'ready' + rlArgs.customEvents, function () {

		// initialise event
		$.event.trigger( {
			type: 'doResponsiveLightbox',
			script: rlArgs.script,
			selector: rlArgs.selector,
			args: rlArgs
		} );
	} );

	// this is similar to the WP function add_action();
	$( document ).on( 'doResponsiveLightbox', function ( event ) {

		var script = event.script,
			selector = event.selector,
			args = event.args;

		if ( typeof script === 'undefined' || typeof selector === 'undefined' ) {
			return false;
		}

		var observe_script_dom = ( function () {
			var MutationObserver = window.MutationObserver || window.WebKitMutationObserver,
				eventListenerSupported = window.addEventListener;

			return function ( obj, only_added, callback ) {
				if ( MutationObserver ) {
					// define a new observer
					var obs = new MutationObserver( function ( mutations, observer ) {
						if ( only_added ) {
							if ( mutations[0].addedNodes.length )
								callback();
						} else {
							if ( mutations[0].addedNodes.length || mutations[0].removedNodes.length )
								callback();
						}
					} );

					// have the observer observe for changes in children
					obs.observe( obj, { childList: true, subtree: true } );
				} else if ( eventListenerSupported ) {
					obj.addEventListener( 'DOMNodeInserted', callback, false );

					if ( !only_added ) {
						obj.addEventListener( 'DOMNodeRemoved', callback, false );
					}
				}
			}
		} )();

		rl_view_image = function ( script, url ) {
			$.event.trigger( {
				type: 'doLightboxViewImage',
				script: script,
				url: url
			} );
		}

		rl_hide_image = function ( script, url ) {
			$.event.trigger( {
				type: 'doLightboxHideImage',
				script: script,
				url: url
			} );
		}

		// WooCommerce 3.0+ compatibility
		setTimeout( function () {
			var flex = $( '.flex-viewport' );

			if ( rlArgs.woocommerce_gallery === '1' && flex.length ) {
				$( '.zoomImg' ).css( 'cursor', 'pointer' );

				$( document ).on( 'click', '.flex-active-slide .zoomImg', function ( e ) {
					e.preventDefault();
					e.stopPropagation();

					flex.find( '.flex-active-slide a[data-rel]' ).trigger( 'click' );
				} );
			}
		}, 10 );

		switch ( script ) {

			case 'swipebox':

				var slide = $( '#swipebox-overlay' ).find( '.slide.current' ),
					image_source = '',
					allow_hide = false,
					close_executed = false;

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).swipebox( {
					useCSS: ( rlArgs.animation === '1' ? true : false ),
					useSVG: ( rlArgs.useSVG === '1' ? true : false ),
					hideCloseButtonOnMobile: ( rlArgs.hideCloseButtonOnMobile === '1' ? true : false ),
					removeBarsOnMobile: ( rlArgs.removeBarsOnMobile === '1' ? true : false ),
					hideBarsDelay: ( rlArgs.hideBars === '1' ? parseInt( rlArgs.hideBarsDelay ) : 0 ),
					videoMaxWidth: parseInt( rlArgs.videoMaxWidth ),
					loopAtEnd: ( rlArgs.loopAtEnd === '1' ? true : false ),
					afterOpen: function () {
						close_executed = false;

						// update current slide container
						slide = $( '#swipebox-overlay' ).find( '.slide.current' );

						// get image source
						var image = slide.find( 'img' ).attr( 'src' );

						// valid image source?
						if ( typeof image !== 'undefined' ) {
							image_source = image;

							// trigger image view
							rl_view_image( script, image_source );
						} else {
							image_source = '';
						}

						// add current slide observer
						observe_script_dom( document.getElementById( 'swipebox-slider' ), false, function () {
							if ( image_source === '' ) {
								// get image source
								var image = slide.find( 'img' ).attr( 'src' );

								// valid image source?
								if ( typeof image !== 'undefined' ) {
									image_source = image;

									// trigger image view
									rl_view_image( script, image_source );
								} else {
									image_source = '';
								}
							}
						} );
					},
					nextSlide: function () {
						// update current slide container
						slide = $( '#swipebox-overlay' ).find( '.slide.current' );

						// get image source
						var image = slide.find( 'img' ).attr( 'src' );

						// valid image source?
						if ( typeof image !== 'undefined' ) {
							image_source = image;

							// trigger image view
							rl_view_image( script, image_source );
						} else {
							image_source = '';
						}
					},
					prevSlide: function () {
						// update current slide container
						slide = $( '#swipebox-overlay' ).find( '.slide.current' );

						// get image source
						var image = slide.find( 'img' ).attr( 'src' );

						// valid image source?
						if ( typeof image !== 'undefined' ) {
							image_source = image;

							// trigger image view
							rl_view_image( script, image_source );
						} else {
							image_source = '';
						}
					},
					afterClose: function () {
						// afterClose event executed
						close_executed = true;

						// allow to hide image?
						if ( allow_hide ) {
							// trigger image hide
							rl_hide_image( script, image_source );

							allow_hide = false;
						}
					}
				} );

				// additional event to prevent rl_hide_image to execure while opening modal
				$( window ).on( 'resize', function () {
					if ( !close_executed ) {
						allow_hide = true;
					}
				} );

				break;

			case 'prettyphoto':

				var view_disabled = false,
					last_image = '';

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).prettyPhoto( {
					hook: 'data-rel',
					animation_speed: rlArgs.animationSpeed,
					slideshow: ( rlArgs.slideshow === '1' ? parseInt( rlArgs.slideshowDelay ) : false ),
					autoplay_slideshow: ( rlArgs.slideshowAutoplay === '1' ? true : false ),
					opacity: rlArgs.opacity,
					show_title: ( rlArgs.showTitle === '1' ? true : false ),
					allow_resize: ( rlArgs.allowResize === '1' ? true : false ),
					allow_expand: ( rlArgs.allowExpand === '1' ? true : false ),
					default_width: parseInt( rlArgs.width ),
					default_height: parseInt( rlArgs.height ),
					counter_separator_label: rlArgs.separator,
					theme: rlArgs.theme,
					horizontal_padding: parseInt( rlArgs.horizontalPadding ),
					hideflash: ( rlArgs.hideFlash === '1' ? true : false ),
					wmode: rlArgs.wmode,
					autoplay: ( rlArgs.videoAutoplay === '1' ? true : false ),
					modal: ( rlArgs.modal === '1' ? true : false ),
					deeplinking: ( rlArgs.deeplinking === '1' ? true : false ),
					overlay_gallery: ( rlArgs.overlayGallery === '1' ? true : false ),
					keyboard_shortcuts: ( rlArgs.keyboardShortcuts === '1' ? true : false ),
					social_tools: ( rlArgs.social === '1' ? '<div class="pp_social"><div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href=' + location.href + '&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div></div>' : '' ),
					ie6_fallback: true,
					changepicturecallback: function () {
						// is view disabled?
						if ( view_disabled ) {
							// enable view
							view_disabled = false;

							return;
						}

						last_image = $( '#pp_full_res' ).find( 'img' ).attr( 'src' );

						// trigger image view
						rl_view_image( script, last_image );

						// is expanding allowed?
						if ( rlArgs.allowExpand === '1' ) {
							// disable changepicturecallback event after expanding
							$( 'a.pp_expand' ).on( 'click', function () {
								view_disabled = true;
							} );
						}
					},
					callback: function () {
						// trigger image hide
						rl_hide_image( script, last_image );
					}
				} );

				break;

			case 'fancybox':

				var last_image = '';

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).fancybox( {
					modal: ( rlArgs.modal === '1' ? true : false ),
					overlayShow: ( rlArgs.showOverlay === '1' ? true : false ),
					showCloseButton: ( rlArgs.showCloseButton === '1' ? true : false ),
					enableEscapeButton: ( rlArgs.enableEscapeButton === '1' ? true : false ),
					hideOnOverlayClick: ( rlArgs.hideOnOverlayClick === '1' ? true : false ),
					hideOnContentClick: ( rlArgs.hideOnContentClick === '1' ? true : false ),
					cyclic: ( rlArgs.cyclic === '1' ? true : false ),
					showNavArrows: ( rlArgs.showNavArrows === '1' ? true : false ),
					autoScale: ( rlArgs.autoScale === '1' ? true : false ),
					scrolling: rlArgs.scrolling,
					centerOnScroll: ( rlArgs.centerOnScroll === '1' ? true : false ),
					opacity: ( rlArgs.opacity === '1' ? true : false ),
					overlayOpacity: parseFloat( rlArgs.overlayOpacity / 100 ),
					overlayColor: rlArgs.overlayColor,
					titleShow: ( rlArgs.titleShow === '1' ? true : false ),
					titlePosition: rlArgs.titlePosition,
					transitionIn: rlArgs.transitions,
					transitionOut: rlArgs.transitions,
					easingIn: rlArgs.easings,
					easingOut: rlArgs.easings,
					speedIn: parseInt( rlArgs.speeds ),
					speedOut: parseInt( rlArgs.speeds ),
					changeSpeed: parseInt( rlArgs.changeSpeed ),
					changeFade: parseInt( rlArgs.changeFade ),
					padding: parseInt( rlArgs.padding ),
					margin: parseInt( rlArgs.margin ),
					width: parseInt( rlArgs.videoWidth ),
					height: parseInt( rlArgs.videoHeight ),
					onComplete: function () {
						last_image = $( '#fancybox-content' ).find( 'img' ).attr( 'src' );

						// trigger image view
						rl_view_image( script, last_image );
					},
					onClosed: function () {
						// trigger image hide
						rl_hide_image( script, last_image );
					}
				} );

				break;

			case 'nivo':

				$.each( $( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ), function () {
					var attr = $( this ).attr( 'data-rel' );

					// check data-rel attribute first
					if ( typeof attr === 'undefined' || attr == false ) {
						// if not found then try to check rel attribute for backward compatibility
						attr = $( this ).attr( 'rel' );
					}

					// for some browsers, `attr` is undefined; for others, `attr` is false. Check for both.
					if ( typeof attr !== 'undefined' && attr !== false ) {
						var match = attr.match( new RegExp( rlArgs.selector + '\\-(gallery\\-(?:[\\da-z]{1,4}))', 'ig' ) );

						if ( match !== null ) {
							$( this ).attr( 'data-lightbox-gallery', match[0] );
						}
					}

				} );

				var observer_initialized = false,
					change_allowed = true,
					last_image = '';

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).nivoLightbox( {
					effect: rlArgs.effect,
					clickOverlayToClose: ( rlArgs.clickOverlayToClose === '1' ? true : false ),
					keyboardNav: ( rlArgs.keyboardNav === '1' ? true : false ),
					errorMessage: rlArgs.errorMessage,
					afterShowLightbox: function ( lightbox ) {
						var content = $( lightbox )[0].find( '.nivo-lightbox-content' );

						// is observer initialized?
						if ( !observer_initialized ) {
							// turn it off
							observer_initialized = true;

							// add content observer
							observe_script_dom( document.getElementsByClassName( 'nivo-lightbox-content' )[0], true, function () {
								if ( change_allowed ) {
									last_image = content.find( '.nivo-lightbox-image img' ).attr( 'src' );

									// trigger image view
									rl_view_image( script, last_image );

									// disallow observer changes
									change_allowed = false;
								}
							} );
						}
					},
					afterHideLightbox: function () {
						// allow observer changes
						change_allowed = true;

						// trigger image hide
						rl_hide_image( script, last_image );
					},
					onPrev: function ( element ) {
						// disallow observer changes
						change_allowed = false;

						last_image = element[0].attr( 'href' );

						// trigger image view
						rl_view_image( script, last_image );
					},
					onNext: function ( element ) {
						// disallow observer changes
						change_allowed = false;

						last_image = element[0].attr( 'href' );

						// trigger image view
						rl_view_image( script, last_image );
					}
				} );

				break;

			case 'imagelightbox':

				var selectors = [ ],
					last_image = '';

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).each( function ( i, item ) {
					var attr = $( item ).attr( 'data-rel' );

					// check data-rel attribute first
					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
						selectors.push( attr );
					// if not found then try to check rel attribute for backward compatibility
					else {
						attr = $( item ).attr( 'rel' );

						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
							selectors.push( attr );
					}
				} );

				if ( selectors.length > 0 ) {

					// make unique
					selectors = $.unique( selectors );

					$( selectors ).each( function ( i, item ) {
						$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).imageLightbox( {
							animationSpeed: parseInt( rlArgs.animationSpeed ),
							preloadNext: ( rlArgs.preloadNext === '1' ? true : false ),
							enableKeyboard: ( rlArgs.enableKeyboard === '1' ? true : false ),
							quitOnEnd: ( rlArgs.quitOnEnd === '1' ? true : false ),
							quitOnImgClick: ( rlArgs.quitOnImageClick === '1' ? true : false ),
							quitOnDocClick: ( rlArgs.quitOnDocumentClick === '1' ? true : false ),
							onLoadEnd: function () {
								last_image = $( '#imagelightbox' ).attr( 'src' );

								// trigger image view
								rl_view_image( script, last_image );
							},
							onEnd: function () {
								// trigger image hide
								rl_hide_image( script, last_image );
							}
						} );
					} );
				}

				break;

			case 'tosrus':

				var selectors = [ ],
					last_image = '';

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).each( function ( i, item ) {
					var attr = $( item ).attr( 'data-rel' );

					// check data-rel attribute first
					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
						selectors.push( attr );
					// if not found then try to check rel attribute for backward compatibility
					else {
						attr = $( item ).attr( 'rel' );

						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
							selectors.push( attr );
					}
				} );

				if ( selectors.length > 0 ) {

					// make unique
					selectors = $.unique( selectors );

					$( selectors ).each( function ( i, item ) {
						var tos = $( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).tosrus( {
							infinite: ( rlArgs.infinite === '1' ? true : false ),
							autoplay: {
								play: ( rlArgs.autoplay === '1' ? true : false ),
								pauseOnHover: ( rlArgs.pauseOnHover === '1' ? true : false ),
								timeout: rlArgs.timeout
							},
							effect: rlArgs.effect,
							keys: {
								prev: ( rlArgs.keys === '1' ? true : false ),
								next: ( rlArgs.keys === '1' ? true : false ),
								close: ( rlArgs.keys === '1' ? true : false )
							},
							pagination: {
								add: ( rlArgs.pagination === '1' ? true : false ),
								type: rlArgs.paginationType
							},
							// forced
							show: false,
							buttons: true,
							caption: {
								add: true,
								attributes: [ "title" ]
							},
							wrapper: {
								onClick: rlArgs.closeOnClick === '1' ? 'close' : 'toggleUI'
							}
						} );

						tos.bind( 'sliding.tos', function ( event, number ) {
							last_image = $( $( event.target ).find( '.tos-slider .tos-slide' )[number] ).find( 'img' ).attr( 'src' );

							// trigger image view
							rl_view_image( script, last_image );
						} );

						tos.bind( 'closing.tos', function () {
							// trigger image hide
							rl_hide_image( script, last_image );
						} );

					} );
				}

				break;

			case 'featherlight':

				var selectors = [ ],
					last_image = '';

				$( 'a[rel*="' + rlArgs.selector + '"], a[data-rel*="' + rlArgs.selector + '"]' ).each( function ( i, item ) {
					var attr = $( item ).attr( 'data-rel' );

					// check data-rel attribute first
					if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
						selectors.push( attr );
					// if not found then try to check rel attribute for backward compatibility
					else {
						attr = $( item ).attr( 'rel' );

						if ( typeof attr !== 'undefined' && attr !== false && attr !== 'norl' )
							selectors.push( attr );
					}
				} );

				if ( selectors.length > 0 ) {
					// make unique
					selectors = $.unique( selectors );

					// set defaults
					$.extend( $.featherlight.defaults, {
						openSpeed: parseInt( rlArgs.openSpeed ),
						closeSpeed: parseInt( rlArgs.closeSpeed ),
						closeOnClick: rlArgs.closeOnClick,
						closeOnEsc: ( rlArgs.closeOnEsc === '1' ? true : false ),
						afterOpen: function ( event ) {
							last_image = event.currentTarget.href;

							// trigger image view
							rl_view_image( script, last_image );
						},
						afterClose: function () {
							// trigger image hide
							rl_hide_image( script, last_image );
						}
					} );

					$( selectors ).each( function ( i, item ) {

						// gallery?
						if ( /-gallery-/.test( item ) ) {
							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).featherlightGallery( {
								galleryFadeIn: parseInt( rlArgs.galleryFadeIn ),
								galleryFadeOut: parseInt( rlArgs.galleryFadeOut ),
								previousIcon: '&#10094;',
								nextIcon: '&#10095;'
							} );
							// video?
						} else if ( /-video-/.test( item ) ) {
							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).featherlight();
							// single image?
						} else {
							$( 'a[data-rel="' + item + '"], a[rel="' + item + '"]' ).featherlight();
						}
					} );

				}

				break;
		}

	} );

} )( jQuery );
// source --> https://jgm-foerderverein.de/wp-content/plugins/slider-wd/js/jquery.mobile.js?ver=2.2.22 
/*! jQuery Mobile v1.3.2 | Copyright 2010, 2013 jQuery Foundation, Inc. | jquery.org/license */
(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function x(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function T(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=x(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function N(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function C(t,n){var r;while(t){r=e.data(t,i);if(r&&(!n||r[n]))return t;t=t.parentNode}return null}function k(){g=!1}function L(){g=!0}function A(){E=0,v.length=0,m=!1,L()}function O(){k()}function M(){_(),c=setTimeout(function(){c=0,A()},e.vmouse.resetTimerDuration)}function _(){c&&(clearTimeout(c),c=0)}function D(t,n,r){var i;if(r&&r[t]||!r&&C(n.target,t))i=T(n,t),e(n.target).trigger(i);return i}function P(t){var n=e.data(t.target,s);if(!m&&(!E||E!==n)){var r=D("v"+t.type,t);r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation())}}function H(t){var n=x(t).touches,r,i;if(n&&n.length===1){r=t.target,i=N(r);if(i.hasVirtualBinding){E=w++,e.data(r,s,E),_(),O(),d=!1;var o=x(t).touches[0];h=o.pageX,p=o.pageY,D("vmouseover",t,i),D("vmousedown",t,i)}}}function B(e){if(g)return;d||D("vmousecancel",e,N(e.target)),d=!0,M()}function j(t){if(g)return;var n=x(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=N(t.target);d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i,d&&!r&&D("vmousecancel",t,s),D("vmousemove",t,s),M()}function F(e){if(g)return;L();var t=N(e.target),n;D("vmouseup",e,t);if(!d){var r=D("vclick",e,t);r&&r.isDefaultPrevented()&&(n=x(e).changedTouches[0],v.push({touchID:E,x:n.clientX,y:n.clientY}),m=!0)}D("vmouseout",e,t),d=!1,M()}function I(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function q(){}function R(t){var n=t.substr(1);return{setup:function(r,s){I(this)||e.data(this,i,{});var o=e.data(this,i);o[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,P),e(this).bind(n,q),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",H).bind("touchend",F).bind("touchmove",j).bind("scroll",B))},teardown:function(r,s){--l[t],l[t]||b.unbind(n,P),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",H).unbind("touchmove",j).unbind("touchend",F).unbind("scroll",B));var o=e(this),u=e.data(this,i);u&&(u[t]=!1),o.unbind(n,q),I(this)||o.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var U=0;U<o.length;U++)e.event.special[o[U]]=R(o[U]);y&&n.addEventListener("click",function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}u=u.parentNode}}},!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,r){var i=r.type;r.type=n,e.event.dispatch.call(t,r),r.type=i}var i=e(n);e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)});var s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;r||s(t,!0),clearTimeout(i),i=setTimeout(function(){s(t,!1)},50)})}},e.event.special.tap={tapholdThreshold:750,setup:function(){var t=this,n=e(t);n.bind("vmousedown",function(r){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),s===e.target&&l(t,"tap",e)}if(r.which&&r.which!==1)return!1;var s=r.target,o=r.originalEvent,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout(function(){l(t,"taphold",e.Event("taphold",{target:s}))},e.event.special.tap.tapholdThreshold)})}},e.event.special.swipe={scrollSupressionThreshold:10,durationThreshold:1000,horizontalDistanceThreshold:10,verticalDistanceThreshold:475,start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t;return{time:(new Date).getTime(),coords:[n.pageX,n.pageY],origin:e(t.target)}},stop:function(e){var t=e.originalEvent.touches?e.originalEvent.touches[0]:e;return{time:(new Date).getTime(),coords:[t.pageX,t.pageY]}},handleSwipe:function(t,n){n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold&&t.origin.trigger("swipe").trigger(t.coords[0]>n.coords[0]?"swipeleft":"swiperight")},setup:function(){var t=this,n=e(t);n.bind(u,function(t){function o(t){if(!i)return;s=e.event.special.swipe.stop(t),Math.abs(i.coords[0]-s.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()}var i=e.event.special.swipe.start(t),s;n.bind(f,o).one(a,function(){n.unbind(f,o),i&&s&&e.event.special.swipe.handleSwipe(i,s),i=s=r})})}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)}}})}(e,this)});
// source --> https://jgm-foerderverein.de/wp-content/plugins/slider-wd/js/jquery.featureCarouselslider.js?ver=2.2.22 
(function($){
  $.fn.featureCarouselslider = function (options) {
    // Adds support for multiple carousels on one page.
    if (this.length > 1) {
      this.each(function() {
        $(this).featureCarouselslider(options);
      });
      return this;
    }

    // override the default options with user defined options
    options = $.extend({}, $.fn.featureCarouselslider.defaults, options || {});

    /* These are univeral values that are used throughout the plugin. Do not modify them
     * unless you know what you're doing. Most of them feed off the options
     * so most customization can be achieved by modifying the options values 
    */
    var pluginData = {      
     
      containerWidth:       0,
      containerHeight:      0,
      largeFeatureWidth:    0,
      largeFeatureHeight:   0,
      smallFeatureHeight:   0,
      smallFeatureWidth:    0,       
      totalFeatureCount:    $(this).children().first().children().first().children("span").length,
      featuresContainer:    $(this),
      featuresArray:        [],
      containerIDTag:       "." + $(this).attr("id"),
      timeoutVar:           null,
      rotationsRemaining:   0,
      itemsToAnimate:       0,
      borderWidth:		      0,     
      autoTime:             0   
    };

    /**
     * Function to preload the images in the carousel if desired.
     * This is not recommended if there are a lot of images in the carousel because
     * it may take a while. Functionality does not depend on preloading the images 
     */ 
    var preload = function(callback) {
      callback(); 
    }
 
    // Gets the feature container based on the number
    var getContainer = function(featureNum) {
      return pluginData.featuresArray[featureNum-1];
    }

    // get previous feature number
    var getPreviousNum = function(num) {
      if ((num - 1) == 0) {
        return pluginData.totalFeatureCount;
      } else {
        return num - 1;
      }
    }

    // get next feature number
    var getNextNum = function(num) {
      if ((num + 1) > pluginData.totalFeatureCount) {
        return 1;
      } else {
        return num + 1;
      }
    }

    /**
     * Because there are several options the user can set for the width and height
     * of the feature images, this function is used to determine which options were set
     * and to set the appropriate dimensions used for a small and large feature	
     */
    var setupFeatureDimensions = function() {
      // Set the height and width of the entire carousel container
      options.containerWidth = pluginData.featuresContainer.width();
      options.containerHeight = pluginData.featuresContainer.height();
    
      // Grab the first image for reference
      var $firstFeatureImage = $(pluginData.containerIDTag).find(".wds_slider_car_image" + options.wds_number + ":first");
 
      // Large Feature Width
      if (options.largeFeatureWidth > 1) {
        pluginData.largeFeatureWidth = options.largeFeatureWidth;
      }
	    else if (options.largeFeatureWidth > 0 && options.largeFeatureWidth < 1) {
        pluginData.largeFeatureWidth = $firstFeatureImage.width() * options.largeFeatureWidth;
      }
      else {
        pluginData.largeFeatureWidth = $firstFeatureImage.outerWidth();
      }
      // Large Feature Height
      if (options.largeFeatureHeight > 1) {
        pluginData.largeFeatureHeight = options.largeFeatureHeight;
      }
      else if (options.largeFeatureHeight > 0 && options.largeFeatureHeight < 1) {
        pluginData.largeFeatureHeight = $firstFeatureImage.height() * options.largeFeatureHeight;
      }
      else {
        pluginData.largeFeatureHeight = $firstFeatureImage.outerHeight();
      }
    }

    /**
     * Function to take care of setting up various aspects of the carousel,
     * most importantly the default positions for the features	
     */
    var setupCarousel = function() {
      // Set the total feature count to the amount the user wanted to cutoff
      if (options.displayCutoff > 0 && options.displayCutoff < pluginData.totalFeatureCount) {
        pluginData.totalFeatureCount = options.displayCutoff;
      }

      // Fill in the features array .
      pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).each(function (index) {
        if (index < pluginData.totalFeatureCount) {
          pluginData.featuresArray[index] = $(this);
        }
      });
 
      // Determine the total border width around the feature if there is one.
      if (pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).first().css("borderLeftWidth") != "medium") {
        pluginData.borderWidth = parseInt(pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).first().css("borderLeftWidth"))*2;
      }
      // Place all the features in a center hidden position to start off.
      if (options.imagecount != 1) {
        pluginData.featuresContainer
        .find(".wds_slider_car_image" + options.wds_number).each(function () {
          // Center all the features in the middle and hide them.
          jQuery(this).css({
            'left': (options.containerWidth / 2) - (options.largeFeatureWidth * options.smallFeaturePar / 2) - (pluginData.borderWidth / 2) - options.parf,
            'width': options.largeFeatureWidth * options.smallFeaturePar * options.parametr / 100,
            'height': options.largeFeatureHeight * options.smallFeaturePar * options.parametr / 100,
            'top': options.smallFeatureOffset + options.topPadding + options.parf,
            'opacity': 0,
            'filter': 'Alpha(opacity=0)'
          });
        });
      } 
      else {
        pluginData.featuresContainer
        .find(".wds_slider_car_image" + options.wds_number).each(function () {
          // Center all the features in the middle and hide them.
          jQuery(this).css({
            'left': 0,
            'width': options.largeFeatureWidth * options.smallFeaturePar,
            'height': options.largeFeatureHeight * options.smallFeaturePar,
            'top': 0,
            'opacity': 0,
            'filter': 'Alpha(opacity=0)'
          });
        });
      }        
      // Set position to relative of captions if displaying below image.
      if (options.captionBelow) {
        pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).css('position','absolute');
      }

      // Figure out number of items that will rotate each time.
      if (pluginData.totalFeatureCount < options.imagecount) {
        pluginData.itemsToAnimate = pluginData.totalFeatureCount;  
      }  else {
        pluginData.itemsToAnimate = options.imagecount + 2 ;
      }       
    }

    /**
     * Here all the position data is set for the features.
     * This is an important part of the carousel to keep track of where
     * each feature within the carousel is	 
     */
    var setupFeaturePositions = function() {
      // give all features a set number that won't change so they remember their
      // original order 
      $.each(pluginData.featuresArray, function (i) {
        $(this).data('setPosition', i + 1);
      });

      // Go back one - This is done because we call the move function right away, which
      // shifts everything to the right. So we set the current center back one, so that
      // it displays in the center when that happens
      var oneBeforeStarting = getPreviousNum(window["wds_currentCenterNum" +options.wds_number]);

      window["wds_currentCenterNum" +options.wds_number] = oneBeforeStarting;

      // Center feature will be position 1
      var $centerFeature = getContainer(oneBeforeStarting);
      $centerFeature.data('position', 1);

      // Everything before that center feature...
      var $prevFeatures = $centerFeature.prevAll();
      $prevFeatures.each(function (i) {
        $(this).data('position', (pluginData.totalFeatureCount - i));
      });
        
      // And everything after that center feature...
      var $nextFeatures = $centerFeature.nextAll();
      $nextFeatures.each(function (i) {
        if ($(this).data('setPosition') != undefined) {
          $(this).data('position',(i + 2));
        }
      });
    }

    /**
     * This function will set the autoplay for the carousel to
     * automatically rotate it given the time in the options
     * pass in TRUE to just clear the timer
     */
    var setTimer = function(stop) {
      return;
      // clear the timeout var if it exists
      clearTimeout(pluginData.timeoutVar);

      // set interval for moving if autoplay is set
      if (!stop && options.autoPlay != 0) {
        var autoTime = (Math.abs(options.autoPlay) < options.carouselSpeed) ? options.carouselSpeed : Math.abs(options.autoPlay);
        pluginData.timeoutVar = setTimeout(function () {
          (options.autoPlay > 0) ? initiateMove(true,1) : initiateMove(false,1);
        }, autoTime);
      }
    }
 
    // This is a helper function for the animateFeature function that
    // will update the positions of all the features based on the direction
    var rotatePositions = function(direction) {
      $.each(pluginData.featuresArray, function () {
        var newPos;
        if (direction == false) {
          newPos = getNextNum($(this).data().position);
        } else {
          newPos = getPreviousNum($(this).data().position);
        }

        $(this).data('position',newPos);
      });
    }

    /* Animate the given feature to the given location. Valid locations are "left", "right", "center", "hidden".*/
    var animateFeature = function($feature, direction, onload) {
      if (typeof onload == "undefined") {
        var onload = 0;
      }
      $feature.find(".wds_slideshow_image_" + options.wds_number).children().each(function() {
        jQuery(this).hide();
      });
      $feature.find(".wds_video_hide" + options.wds_number).each(function() {
        jQuery(this).show();
      });
      var new_width, new_height, new_top, new_left, new_zindex, new_padding, new_fade, new_fade1, new_left1;
      // Determine the old and new positions of the feature.
      var oldPosition = $feature.data('position');
      var newPosition;
      if (direction == true) {
        newPosition = getPreviousNum(oldPosition);
      }
      else {
        newPosition = getNextNum(oldPosition);
      }
      // Callback for moving out of center pos.
      if (oldPosition == 1) {
        options.leavingCenter($feature);
      }
      // Caculate new new css values depending on where the feature will be located center.
      if (newPosition == 1) {
        new_width = pluginData.largeFeatureWidth;        
        new_height = pluginData.largeFeatureHeight;
        new_top =(options.containerHeight / 2 - new_height / 2 );
        new_zindex = $feature.css("z-index");
        new_left = (options.containerWidth / 2) - (pluginData.largeFeatureWidth / 2) - (pluginData.borderWidth / 2);
        new_fade = 1.0;
        new_fade1 = 100;
        new_f = "translateZ(0px) rotateY(0deg)";
        new_gray = "grayscale(0%)";
        $feature.find(".wds_slideshow_image_" + options.wds_number).children().each(function() {
          jQuery(this).show();
        });
        $feature.find(".wds_video_hide" + options.wds_number).each(function() {
          jQuery(this).hide();
        });
      }
      else {
        // Left.
        if (newPosition <= pluginData.totalFeatureCount && newPosition > pluginData.totalFeatureCount - options.imagecount / 2 + 1) {
          new_width = (pluginData.largeFeatureWidth * Math.pow(options.smallFeaturePar, pluginData.totalFeatureCount - newPosition + 1));      
          new_height = (pluginData.largeFeatureHeight * Math.pow(options.smallFeaturePar, pluginData.totalFeatureCount - newPosition + 1));
          new_top = (options.containerHeight/ 2  - new_height / 2 ) ;         
          new_fade = 1 - options.carousel_transparency / 100;        
          new_fade1 = 100; 
          new_f = "translateX("+ (-1) * options.parametr  * options.carousel_degree  +"px) translateZ("+ (-1) *options.parametr * options.carousel_degree + "px) rotateY("+ options.carousel_degree +"deg)";
          new_gray = "grayscale("+ options.carousel_grayscale +"%)";
          if(options.fit_containerWidth == false && options.smallFeaturePar < 1){
            new_left = (options.containerWidth / 2 - pluginData.largeFeatureWidth / 2)-(pluginData.largeFeatureWidth * (1 - options.smallFeaturePar) * options.smallFeaturePar * (pluginData.totalFeatureCount - newPosition + 1));             
          } else if(options.fit_containerWidth == false && options.smallFeaturePar == 1){
            new_left = (options.containerWidth / 2 - pluginData.largeFeatureWidth / 2)-(pluginData.largeFeatureWidth * ( options.smallFeaturePar) * options.smallFeaturePar * (pluginData.totalFeatureCount - newPosition + 1));             
          } else {
              new_left1 = (options.containerWidth / 2 - pluginData.largeFeatureWidth / 2) / (options.imagecount / 2 - 0.5);
              new_left =  ((options.containerWidth / 2) - (pluginData.largeFeatureWidth / 2) - (pluginData.borderWidth / 2)) - (new_left1 * (pluginData.totalFeatureCount - newPosition+1  ));             
          }                        
        }
        // Right.
        else if (newPosition >= 2 && newPosition <= options.imagecount / 2 + 1) {
          new_width = (pluginData.largeFeatureWidth * Math.pow(options.smallFeaturePar,newPosition - 1));
          new_height =( pluginData.largeFeatureHeight * Math.pow(options.smallFeaturePar, newPosition - 1));
          new_top = ( options.containerHeight / 2 - new_height / 2);
          new_fade = 1 - options.carousel_transparency / 100;
          new_fade1 = 100;
          new_f = "translateX("+ options.parametr * options.carousel_degree +"px) translateZ("+ (-1) * options.parametr *options.carousel_degree +"px) rotateY("+ (-1) * options.carousel_degree +"deg)" ;
          new_gray = "grayscale("+ options.carousel_grayscale + "%)";
          if (options.fit_containerWidth == false && options.smallFeaturePar < 1) {
            new_left = (options.containerWidth / 2 + pluginData.largeFeatureWidth / 2) + (pluginData.largeFeatureWidth * options.smallFeaturePar * (1 - options.smallFeaturePar) * (newPosition - 1)) - new_width;
          } else if (options.fit_containerWidth == false && options.smallFeaturePar == 1) {
            new_left = (options.containerWidth / 2 + pluginData.largeFeatureWidth / 2) + (pluginData.largeFeatureWidth * options.smallFeaturePar * (options.smallFeaturePar) * (newPosition - 1)) - new_width;
          } else {
            new_left1 = ( (options.containerWidth / 2 -pluginData.largeFeatureWidth / 2)) / (options.imagecount / 2 - 0.5);
            new_left = (options.containerWidth / 2 + pluginData.largeFeatureWidth / 2) - new_width + (new_left1 * (newPosition - 1));
          }
        }
        // Hidden.
        else {
          new_left = (options.containerWidth / 2) - (pluginData.largeFeatureWidth * options.smallFeaturePar / 2) - (pluginData.borderWidth / 2);
          new_fade = 0;
          new_fade1 = 0;
        }
      }
      // This code block takes care of hiding the feature information if the feature is leaving the center.
      if (oldPosition == 1) {
        // Slide up the story information.
        $feature.find(".wds_slider_car_image" + options.wds_number).hide();
      }

      // Animate the feature div to its new location.
      jQuery(".wds_slide_bg_" + options.wds_number).css('perspective', 1000);
      jQuery(".wds_slide_" + options.wds_number).css({"transformStyle":"preserve-3d"});
      $feature.css({
        "-webkit-transform":new_f,
        "-moz-transform:":new_f,
        "-ms-transform":new_f,
        "-o-transform":new_f,
        "transform":new_f,
        "-webkit-filter":new_gray,
        "-moz-filter":new_gray,
        "-ms-filter":new_gray,
        "-o-filter":new_gray,
        "filter":new_gray,
        "progid":"DXImageTransform.Microsoft.BasicImage(grayscale=1)",}),
      $feature
        .animate(
          {
            width: new_width,
            height: new_height,
            top: new_top,
            left: new_left,                      
            opacity: new_fade,
            filter: new_fade1
          },
          onload ? 0 : options.carouselSpeed,
          options.animationEasing,
          function () {
            // Take feature info out of hiding if new position is center
            if (newPosition == 1) {
              // need to set the height to auto to accomodate caption if displayed below image
              if (options.captionBelow)
               $feature.css('height','auto');
              // fade in the feature information
              $feature.find(".wds_slider_car_image" + options.wds_number)
                .fadeTo("fast",0.85);
              // callback for moved to center
              options.movedToCenter($feature);
            }
            // decrement the animation queue
            pluginData.rotationsRemaining = pluginData.rotationsRemaining - 1;
            // have to change the z-index after the animation is done
            $feature.css("z-index", new_zindex);
            // change trackers if using them
            if (options.trackerIndividual || options.trackerSummation) {
              // just update the tracker once; once the new center feature has arrived in center
              if (newPosition == 1) {
                // figure out what item was just in the center, and what item is now in the center
                var newCenterItemNum = pluginData.featuresContainer.find(".wds_slider_car_image" + options.wds_number).index($feature) + 1;
                var oldCenterItemNum;
                if (direction == false) {
                  oldCenterItemNum = getNextNum(newCenterItemNum);
                }
                else {
                  oldCenterItemNum = getPreviousNum(newCenterItemNum);
                }
              }
            }

            // did all the the animations finish yet?
            var divide = pluginData.rotationsRemaining / pluginData.itemsToAnimate;
            if (divide % 1 == 0) {
              // Set moving to false.
              window["wds_currentlyMoving" +options.wds_number]   = false;
              // Change positions for all items.
              rotatePositions(direction);

              // Move carousel again if queue is not empty.
              if (pluginData.rotationsRemaining > 0)
                move(direction);
            }
            // Reset timer and auto rotate again.
            setTimer(false); 
          }
        )
        .end();
    }

    /* Move the carousel to the left or to the right. The features that
     * will move into the four positions are calculated and then animated
     * rotate to the RIGHT when direction is TRUE and
     * rotate to the LEFT when direction is FALSE.
     */
    var move = function(direction, onload) {
      // Set the carousel to currently moving
      window["wds_currentlyMoving" + options.wds_number]  = true;
      // Obtain the new feature positions based on the direction that the carousel is moving
      var $newCenter, $newLefts, $newRights, $newHidden, $curNum;

      if (direction == true) {
        // Shift features to the left
        $newCenter = getContainer(getNextNum(window["wds_currentCenterNum" +options.wds_number]));
        $newLefts = [];
        $curNum = window["wds_currentCenterNum" +options.wds_number];        
        for (var i = 1; i <= options.imagecount / 2 + 1; ++i) {
          $newLefts.push(getContainer($curNum));
          $curNum = getPreviousNum($curNum);
        }
        $newRights = [];
        $curNum = getNextNum(window["wds_currentCenterNum" + options.wds_number]);
        for (var i = 1; i <= options.imagecount / 2 + 1; ++i) {
          $curNum = getNextNum($curNum);
          $newRights.push(getContainer($curNum));
        }
        window["wds_currentCenterNum" + options.wds_number] = getNextNum(window["wds_currentCenterNum" + options.wds_number]);
      }
      else {
        $newCenter = getContainer(getPreviousNum(window["wds_currentCenterNum" +options.wds_number]));
        $newLefts = [];
        $curNum = getPreviousNum(window["wds_currentCenterNum" +options.wds_number]);        
        for (var i = 1; i <= options.imagecount / 2 +1; ++i) {
          $curNum = getPreviousNum($curNum);   
          $newLefts.push(getContainer($curNum));
        }
        $newRights = [];
        $curNum = window["wds_currentCenterNum" + options.wds_number];
        for (var i = 1; i <= options.imagecount / 2 + 1; ++i) {
          $newRights.push(getContainer($curNum));
          $curNum = getNextNum($curNum);
        }
        window["wds_currentCenterNum" +options.wds_number] = getPreviousNum(window["wds_currentCenterNum" + options.wds_number]);
      }
      // Animate the features into their new positions.
      for (i = 0; i < $newLefts.length; i++) {
        $newLefts[i].css("z-index", $newLefts.length - i + 3);
        animateFeature($newLefts[i], direction, onload);
      }
      $newCenter.css("z-index", Math.max($newLefts.length, $newRights.length) + 4);
      animateFeature($newCenter, direction, onload);
      for (i = 0; i < $newRights.length; i++) {
        $newRights[i].css("z-index", $newRights.length - i + 3);
        animateFeature($newRights[i], direction, onload);
      }
    }

    // This is used to relegate carousel movement throughout the plugin.
    // It will only initiate a move if the carousel isn't currently moving.
    // It will set the animation queue to the number of rotations given.
    var initiateMove = function(direction, rotations, onload) {
      if (typeof onload == "undefined") {
        var onload = 0;
      }
      if (window["wds_currentlyMoving" +options.wds_number]  == false) {
        var queue = rotations * pluginData.itemsToAnimate ;
        pluginData.rotationsRemaining = queue ;      
        window["wds_set_filmstrip_class_" + options.wds_number]();
        window["wds_set_dots_class_" + options.wds_number]();
        move(direction, onload);
      }
    }

    // Add event listener to all clicks within the features container
    // This is done to disable any links that aren't within the center feature
    $("a", pluginData.containerIDTag).on("click", function (event) {
      // travel up to the container
      var $parents = $(this).parentsUntil(pluginData.containerIDTag);
      // now check each of the feature divs within it
      $parents.each(function () {
        var position = $(this).data('position');
        // if there are more than just feature divs within the container, they will
        // not have a position and it may come back as undefined. Throw these out
        if (position != undefined) {
          // if any of the links on a feature OTHER THAN the center feature were clicked,
          // initiate a carousel move but then throw the link action away
          if (position != 1) {
            if (position == pluginData.totalFeatureCount) {
              initiateMove(false,1);
            } else if (position == 2) {
              initiateMove(true, 1);
            }
            event.preventDefault();
            return false;
          // if the position WAS the center (i.e. 1), fire callback
          } else {
            options.clickedCenter($(this));
          }
        }
      });
    });

    // Public functions.
    this.initialize = function () {
      jQuery("#wds_container2_" + options.wds_number).css({visibility: 'visible'});
      jQuery(".wds_loading").hide();
      // Call the preloader and pass in our callback, which is just a slew of function calls
      // that should only be executed after the images have been loaded
      preload(function () {
        setupFeatureDimensions();
        setupCarousel();
        if (window["wds_currentlyMoving" +options.wds_number]  == false ) {
          setupFeaturePositions();
          initiateMove(true, 1, 1);
        }
      }); 
      return this;
    };

    this.next = function() {
      initiateMove(true, 1);
    }
    this.prev = function () {
      initiateMove(false, 1);
    }
    this.shift = function (that) {
      var position = $(that).data('position');
      if (position == 1) {
        return;
      }
      if (position > pluginData.totalFeatureCount / 2 + 1) {
        initiateMove(false, pluginData.totalFeatureCount - position + 1);
        options.carouselSpeed = 400;
        options.animationEasing;
      }
      else {
        initiateMove(true, position - 1);
        options.carouselSpeed = 400;
        options.animationEasing;
      }
    }
    this.pause = function () {
      options.autoPlay = false;
      setTimer(true);
    }
    this.start = function () {
      options.autoPlay = options.interval;
      setTimer(false);
    }
    // Initialize the plugin.
    return this.initialize();
  };

  $.fn.featureCarouselslider.defaults = {
    // If zero, take original width and height of image
    // If between 0 and 1, multiply by original width and height (acts as a percentage)
    // If greater than one, use as a forced width/height for all of the images
    largeFeatureWidth :   0,
    largeFeatureHeight:		0,
    containerWidth:       0,
    containerHeight:      0,
    fit_containerWidth:   0,
    wds_number:           0,
    // how much to pad the top of the carousel
    topPadding:           20,
    // spacing between the sides of the container
    sidePadding:          50,
    // the additional offset to pad the side features from the top of the carousel
    smallFeatureOffset:		50,
    //smallFeature parameters
    smallFeaturePar:      0,
    // indicates which feature to start the carousel at
    startingFeature:      1,
    // speed in milliseconds it takes to rotate the carousel
    carouselSpeed:        400,
    // time in milliseconds to set interval to autorotate the carousel
    // set to zero to disable it, negative to go left
    autoPlay:             4000,
    carousel_degree: 50,
    carousel_grayscale: 0,
    carousel_transparency: 50,
    interval:             true,
    //imagecounts
    imagecount:           7,
    // with autoplay enabled, set this option to true to have the carousel pause rotating
    // when a user hovers over any feature
    pauseOnHover:         true,
    // with autoplay enabled, set this option to completely stop the autorotate functionality
    stopOnHover:          false,
    // numbered blips can appear and be used to track the currently centered feature, as well as 
    // allow the user to click a number to move to that feature. Set to false to not process these at all
    // and true to process and display them//and true to process and display them
    trackerIndividual:    true,
    // a summation of the features can also be used to display an "x Of y" style of tracking
    // this can be combined with the above option as well
    trackerSummation:     true,
    // Will only display this many features in the carousel
    // set to zero to disable
    displayCutoff:        0,
    data:                 "",
    // an easing can be specified for the animation of the carousel
    animationEasing:      'swing',
    // display captions below the image instead of on top
    captionBelow:         false,
    parf:                 0,
    // callback function for when a feature has animated to the center
    movedToCenter:        $.noop,
    // callback function for when feature left center
    leavingCenter:        $.noop,
    // callback function for when center feature was clicked
    clickedCenter:        $.noop
  };
})(jQuery);
// source --> https://jgm-foerderverein.de/wp-content/plugins/slider-wd/js/wds_hotspot.js?ver=2.2.22 
function wds_display_hotspot() {
	jQuery(".wds_layer").each(function() {
		jQuery(this).hover(function() {
      jQuery(this).next().next().hide();
			jQuery(this).next().next().stop().fadeIn();
		  }, function() {
			  jQuery(this).next().next().stop().fadeOut();
		});
	});
}

function wds_hotspot_position(prefix, ratio) {
  if (typeof prefix == 'undefined' || prefix == "") {
    var hotspot_layer = ".hotspot_container";
  }
  else {
    hotspot_layer = "#" + prefix + "_div";
  }
  if (typeof ratio == 'undefined') {
    var ratio = 1;
  }
  var arrow_size = Math.round(7 * ratio);
  var distance = Math.round(20 * ratio);

  jQuery(hotspot_layer).each(function() {
    var layer_id = jQuery(this).attr("id").replace("_div", "");
    var text_pos = jQuery(this).attr("data-text_position");
    var slide_width = jQuery(this).parent().outerWidth();
    var slide_height = jQuery(this).parent().outerHeight();
    var layer_left = parseFloat(jQuery(this).css("left"));
    var layer_top = parseFloat(jQuery(this).css("top"));
    var layer_text_bgcolor = jQuery(this).find("span:nth-child(3)").css("background-color");

    var chw1, chw2, chw3, chh1, chh2, chh3, marginTop, left, right;
    var right_border, left_border, top_border, bottom_border, bottom_angle, top_angle;
    chw1 = parseFloat(jQuery(this).find("span:nth-child(1)").outerWidth());
    chw2 = parseFloat(jQuery(this).find("span:nth-child(2)").outerWidth());
    chw3 = parseFloat(jQuery(this).find("span:nth-child(3)").outerWidth());

    chh1 = parseFloat(jQuery(this).find("span:nth-child(1)").outerHeight());
    chh2 = parseFloat(jQuery(this).find("span:nth-child(2)").outerHeight());
    chh3 = parseFloat(jQuery(this).find("span:nth-child(3)").outerHeight());

    right_border = layer_left + ((text_pos == "top" || text_pos == "bottom") ? (chw3 / 2 + chw1 / 2) : (chw2 + chw3 + distance));
    left_border = layer_left - ((text_pos == "top" || text_pos == "bottom") ? (chw3 / 2 - chw1 / 2) : (chw3 + distance));

    top_border = (text_pos == "left" || text_pos == "right") ? layer_top : (layer_top - chh3 - distance);
    bottom_border = (text_pos == "left" || text_pos == "right") ? (layer_top + chh2) : (layer_top + chh2 + chh3 + distance);

    bottom_angle = layer_top + chh2 / 2 + chh3 / 2;
    top_angle = layer_top - chh3 / 2 + chh2 / 2;

    if (right_border > slide_width) {
      text_pos = "left";
    }
    else if (left_border < 0) {
      text_pos = "right";
    }
    else if (top_border < 0) {
      text_pos = "bottom";
    }
    else if (bottom_border > slide_height) {
      text_pos = "top";
    }

    if (top_angle < 0) {
      if (text_pos == "right") {
        text_pos = "top-left";
      }
      else if (text_pos == "left") {
        text_pos = "top-right";
      }
    }
    else if (bottom_angle > slide_height) {
      if (text_pos == "right") {
        text_pos = "bottom-left";
      }
      else if (text_pos == "left") {
        text_pos = "bottom-right";
      }
    }

    jQuery(this).find("span.hotspot_text_before").removeAttr("style");
    if (text_pos == "bottom-left") {
      marginTop = "-" + (chh3 - chw2) + "px";
      left = (chw2 + distance) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: "-" + arrow_size + "px",
        top: (chh3 - (2 * arrow_size + 3)) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "bottom-right") {
      marginTop = "-" + (chh3 - chw2) + "px";
      left = 'auto';
      right = (chw2 + distance) + 'px';
      jQuery(this).find("span.hotspot_text_before").css({
        right: "-" + arrow_size + "px",
        top: (chh3 - (2 * arrow_size + 3)) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderLeft: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "top-left") {
      marginTop = 0;
      left = (chw2 + distance) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: "-" + arrow_size + "px",
        top: "3px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "top-right") {
      marginTop = 0;
      left = 'auto';
      console.log(chw2);
      right = (chw2 + distance) + 'px';
      jQuery(this).find("span.hotspot_text_before").css({
        right: "-" + arrow_size + "px",
        top: "3px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderLeft: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "top") {
      marginTop = (-1 * (chh3 + distance)) + 'px';
      left = '-' + ((chw3 - chw2) / 2) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: (chw3 / 2 - arrow_size) + "px",
        bottom: "-" + arrow_size + "px",
        borderLeft: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid transparent",
        borderTop: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "bottom") {
      marginTop = (chw2 + distance) + 'px';
      left = '-' + ((chw3 - chw2) / 2) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: (chw3 / 2 - arrow_size) + "px",
        top: "-" + arrow_size + "px",
        borderLeft: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "left") {
      marginTop = (-1 * ((chh3 - chw2) / 2)) + "px";
      left = 'auto';
      right = (chw2 + distance) + 'px';
      jQuery(this).find("span.hotspot_text_before").css({
        right: "-" + arrow_size + "px",
        top: (chh3 / 2 - arrow_size) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderLeft: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    else if (text_pos == "right") {
      marginTop = ((chw2 - chh3) / 2) + "px";
      left = (chw2 + distance) + 'px';
      right = 'auto';
      jQuery(this).find("span.hotspot_text_before").css({
        left: "-" + arrow_size + "px",
        top: (chh3 / 2 - arrow_size) + "px",
        borderTop: arrow_size + "px solid transparent",
        borderBottom: arrow_size + "px solid transparent",
        borderRight: arrow_size + "px solid " + layer_text_bgcolor
      });
    }
    jQuery(this).find(".wds_hotspot_text").css({ 
      marginTop : marginTop,
      left : left,
      right : right,
    });

    /*var random = Math.random() * 10;
    random = random.toFixed(2) + "s";
    jQuery(this).find("span:nth-child(2)").css({animationDelay: random, "-webkit-animation-delay": random});*/
  });
};
// source --> https://jgm-foerderverein.de/wp-content/plugins/slider-wd/js/wds_frontend.js?ver=2.2.22 
// Parallax.
function wds_parallax(wds, slide_id) {
  var current_key = jQuery("#wds_current_image_key_" + wds).val();
  var slide_id = window["wds_data_" + wds][current_key]["id"];
  var layers_cont = ".wds_slideshow_image_" + wds + ">[id^='wds_" + wds + "_slide" + slide_id + "_layer']";

  var slide_width = jQuery(".wds_slideshow_image_" + wds + "[image_id='" + slide_id + "']").outerWidth();
  var slide_height = jQuery(".wds_slideshow_image_" + wds + "[image_id='" + slide_id + "']").outerHeight();

  var zIndex_arr = [];
  var hor = [];
  var ver = [];
  
  jQuery(layers_cont).each(function() {
    jQuery(this).css({
      'transform': 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1)',
      '-ms-transform': 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1)',
      '-webkit-transform': 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1)',
      'transform-origin': '50% 50% 0px',
      '-ms-transform-origin': '50% 50% 0px',
      '-webkit-transform-origin': '50% 50% 0px'
    });
    var cur_zIndex = parseInt(jQuery(this).css("z-index"));
    hor[cur_zIndex] = 0;
    ver[cur_zIndex] = 0;
    zIndex_arr.push(cur_zIndex);
  });

  // Arithmetic average for layer movement direction.
  var average = (zIndex_arr[0] + zIndex_arr[zIndex_arr.length - 1]) / 2;

  zIndex_arr.sort();

  var last_position = {};
  jQuery("#wds_container1_" + wds).off("mousemove touchmove");
  jQuery("#wds_container1_" + wds).off("mouseleave touchcancel");

  jQuery("#wds_container1_" + wds).on("mousemove touchmove", function (event) {
    // Check to make sure there is data to compare against.
    if (typeof(last_position.x) != 'undefined') {
      // Get the change from last position to this position.
      var deltaX = last_position.x - event.clientX,
          deltaY = last_position.y - event.clientY;

      jQuery(layers_cont).each(function() {
        var cur_zIndex = jQuery(this).css('z-index');
        var layer_left = parseFloat(jQuery(this).css("left"));
        var layer_top = parseFloat(jQuery(this).css("top"));
        var layer_width = jQuery(this).outerWidth();
        var layer_height = jQuery(this).outerHeight();
        for (var j in zIndex_arr) {
          if (zIndex_arr[j] == cur_zIndex) {
            j = parseFloat(j);
            var step = (j + 1) / 10;
            // Check which direction had the highest amplitude and then figure out direction by checking if the value is greater or less than zero.
            if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0) {
              // Left.
              hor[cur_zIndex] = hor[cur_zIndex] + step;
            } else if (Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0) {
              // Right.
              hor[cur_zIndex] = hor[cur_zIndex] - step;
            } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0) {
              // Up.
              ver[cur_zIndex] = ver[cur_zIndex] + step;
            } else if (Math.abs(deltaY) > Math.abs(deltaX) && deltaY < 0) {
              // Down.
              ver[cur_zIndex] = ver[cur_zIndex] - step;
            }
            // Layer movement direction.
            var dir = (average >= cur_zIndex ? -1 : 1);

            if (layer_left + dir * hor[cur_zIndex] < 0) {
              hor[cur_zIndex] += dir * step;
            }
            if (layer_left + layer_width + dir * hor[cur_zIndex] > slide_width) {
              hor[cur_zIndex] -= dir * step;
            }
            if (layer_top + dir * ver[cur_zIndex] < 0) {
              ver[cur_zIndex] += dir * step;
            }
            if (layer_top + layer_height + dir * ver[cur_zIndex] > slide_height) {
              ver[cur_zIndex] -= dir * step;
            }
            jQuery(this).stop();
            jQuery(this).css({
              marginTop: (ver[cur_zIndex] *  dir).toFixed(2) + 'px',
              marginLeft: (hor[cur_zIndex] * dir).toFixed(2) + 'px'
            });
          }
        }
      });
    }
    // Set the new last position to the current for next time.
    last_position = {
      x : event.clientX,
      y : event.clientY
    };
    
  });
  // Reset layer positions on mouse out.
  jQuery("#wds_container1_" + wds).on("mouseleave touchcancel", function (event) {
    jQuery(layers_cont).each(function() {
      jQuery(this).animate({
          marginTop: 0,
          marginLeft: 0
        },
        500);
      var cur_zIndex = jQuery(this).css('z-index');
      hor[cur_zIndex] = 0;
      ver[cur_zIndex] = 0;
    });
  });
}

function wds_embed_slide_autoplay(slide_id, wds){
  jQuery(slide_id).find("iframe:not([class^='wds_video_layer_frame'])").each(function () {
    if (typeof jQuery(this)[0].contentWindow != "undefined") {
      if (jQuery(this).attr('type') == 'youtube') {
        player = window["youtube_iframes_ids_" + wds].indexOf(this.id);
        window["youtube_iframes_" + wds][player].playVideo();
      }
      else if (jQuery(this).attr('type') == 'vimeo') {
        jQuery(this)[0].contentWindow.postMessage('{"method": "play"}', "*");
      }
      else {
        jQuery(this)[0].contentWindow.postMessage('play', '*');
      }
    }
  });
}

// Uploaded video.
function wds_video_dimenstion(wds, current_key) {
  var slide_id = window["wds_data_" + wds][current_key]["id"];
  var is_video = window["wds_data_" + wds][current_key]["is_video"];
  var autoplay = window["wds_data_" + wds][current_key]["target_attr_slide"];
  var bg_fit = window["wds_data_" + wds][current_key]["bg_fit"];
  var att_width = window["wds_data_" + wds][current_key]["width"];
  var att_height = window["wds_data_" + wds][current_key]["height"];
  if (is_video == 'video') {
    if (bg_fit == 'cover') {
      var video_slide_width = jQuery("#wds_slide_container_" + wds + "").width();
      var video_slide_height = jQuery("#wds_slide_container_" + wds + "").height();
      var video_width = att_width;
      var video_height = att_height;
      var ratio = video_width / video_height;
      if ((video_slide_width / video_slide_height) <= (video_width / video_height)) {
        jQuery("#wds_slide_" + wds + '_' + slide_id).attr("height", video_slide_height);
        video_width = jQuery("#wds_slide_" + wds + '_' + slide_id).height() * ratio ;
        video_width = (video_width - video_slide_width) / 2;
        jQuery("#wds_slide_" + wds + '_' + slide_id).css({'position': 'relative', 'left': -video_width});
      }
      else {
        jQuery("#wds_slide_" + wds + '_' + slide_id).attr("width", video_slide_width);
        video_height = jQuery("#wds_slide_" + wds + '_' + slide_id).width() / ratio ;
        video_height = (video_height - video_slide_height) / 2;
        jQuery("#wds_slide_" + wds + '_' + slide_id).css({'position': 'relative', 'top': -video_height});
      }
    }
    else {
      jQuery("#wds_slide_" + wds + '_' + slide_id).attr("height", "100%");
    }
    if (autoplay == 1) {
      jQuery("#wds_slide_" + wds + '_' + slide_id).get(0).load();		  
      jQuery("#wds_slide_" + wds + '_' + slide_id).get(0).play();
    }
  }
}

function wds_upvideo_layer_dimenstion(wds, key, j) {
  var slide_id = window["wds_data_" + wds][key]["id"];
  var data = window["wds_data_" + wds][key];
  var autoplay = window["wds_data_" + wds][key]["layer_" + j + "_video_autoplay"];
  var width = window["wds_data_" + wds][key]["layer_" + j + "_attr_width"];
  var height = window["wds_data_" + wds][key]["layer_" + j + "_attr_height"];

  if (data["layer_" + j + "_type"] == "upvideo")  {
    var video_layer_width = jQuery('#wds_' + wds + '_slide' + slide_id + '_layer' + data["layer_" + j + "_id"]).width();
    var video_layer_height = jQuery('#wds_' + wds + '_slide' + slide_id + '_layer' +data["layer_" + j + "_id"]).height();
    var video_width = width;
    var video_height = height;

    if ((video_layer_width / video_layer_height) <= (video_width / video_height)) {
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).attr("height", video_layer_height);
      video_width = jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).width();
      video_width = (video_width - video_layer_width) / 2;
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).css({'position': 'relative', 'left': -video_width});
    }
    else {
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).attr("width", video_layer_width);
      video_height = jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).height();
      video_height = (video_height - video_layer_height) / 2;
      jQuery("#wds_slide_" + wds + "_" + slide_id + "_layer_" + data['layer_' + j + '_id']).css({'position': 'relative', 'top': -video_height});
    }
    if (autoplay == 'on') {
      jQuery("#wds_slide_" + wds + "_" + slide_id + '_layer_' + data["layer_" + j + "_id"]).get(0).load();		  
      jQuery("#wds_slide_" + wds + "_" + slide_id + '_layer_' + data["layer_" + j + "_id"]).get(0).play();
    }
  } 
}

function wds_video_play_pause(id, wds) {
  if (jQuery(id).get(0).paused) {
    jQuery(id).get(0).play();
    jQuery('.wds_bigplay_' + wds).hide();
  }
  else {
    jQuery(id).get(0).pause();
    jQuery('.wds_bigplay_' + wds).show();
  }
}

function wds_video_play_pause_layer(wds,slide_id,layer_id) {
  if (jQuery('#wds_slide_' + wds + '_' + slide_id + '_layer_' + layer_id).get(0).paused) {
    jQuery('#wds_slide_' + wds + '_' + slide_id + '_layer_' + layer_id).get(0).play();
    jQuery('#wds_bigplay_layer_' + wds + '_' + slide_id + '_layer_' + layer_id).hide();
  }
  else {
    jQuery('#wds_slide_' + wds + '_' + slide_id + '_layer_' + layer_id).get(0).pause();
    jQuery('#wds_bigplay_layer_' + wds + '_' + slide_id + '_layer_' + layer_id).show();
  }
}

function wds_show_thumb(key, wds) {
  var data = window["wds_data_" + wds][key];
  var bg_fit = window["wds_data_" + wds][key]["bg_fit"];
  var full_width = window["wds_data_" + wds][key]["full_width"];
  var bull_position = window["wds_data_" + wds][key]["bull_position"];
  var image_url = data["image_thumb_url"];
  var dot_conteiner_width = jQuery('.wds_slideshow_dots_container_' + wds).width() / 2;
  var dot_conteiner_height = jQuery('.wds_slideshow_dots_container_' + wds).height();
  var wds_bulframe_width = jQuery('.wds_bulframe_' + wds).width() / 2;
  var dot_position = jQuery('#wds_dots_' + key + '_' + wds ).position();
  var dot_width = jQuery('#wds_dots_' + key + '_' + wds ).width() / 2;
  dot_position = dot_position.left;
  var childPos = jQuery('#wds_dots_' + key + '_' + wds ).offset();
  var parentPos = jQuery('.wds_slideshow_dots_thumbnails_' + wds).parent().offset();
  var childOffset = childPos.left - parentPos.left;
  var right_offset = 0;
  var rt = (dot_conteiner_width * 2) - childOffset;
  if (wds_bulframe_width >= rt && rt > 0 ){
    right_offset =  wds_bulframe_width - rt ;
    dot_width = 0;
  }
  if (full_width == '1') {
    if (wds_bulframe_width >= childOffset) {
      wds_bulframe_width = childOffset - parentPos.left ;  
      dot_width = 0;
    }
  }
  else {
    if (wds_bulframe_width >= childOffset) {
      wds_bulframe_width = childOffset ;  
      dot_width = 0;
    }
  }
  dot_position = childOffset - wds_bulframe_width + dot_width - right_offset ;
  jQuery('.wds_bulframe_' + wds ).css({
    'position' : 'absolute',
    'z-index' : '9999',
    'left': dot_position,
    'background-image' :'url("' + image_url + '")',
    'background-size' : bg_fit,
    'background-repeat' : 'no-repeat',
    'background-position' : 'center center'});
  jQuery('.wds_bulframe_' + wds ).css(bull_position, dot_conteiner_height);
  jQuery('.wds_bulframe_' + wds ).fadeIn();
}

function wds_hide_thumb(wds) {
  jQuery('.wds_bulframe_' + wds ).css({'background-image':''});
  jQuery('.wds_bulframe_' + wds ).fadeOut();
}

function wds_get_overall_parent(obj) {
  if (obj.parent().width()) {
    obj.width(obj.parent().width());
    return obj.parent().width();
  }
  else {
    return wds_get_overall_parent(obj.parent());
  }
}

function wds_set_text_dots_cont(wds) {
  var wds_bull_width = 0;
  jQuery(".wds_slideshow_dots_" + wds).each(function(){
    wds_bull_width += jQuery(this).outerWidth() + 2 * parseInt(jQuery(this).css("margin-left"));
  });
  jQuery(".wds_slideshow_dots_thumbnails_" + wds).css({width: wds_bull_width});
};