PageSourceSearch

https://www.worb.ch/wGlobal/wGlobal/layout/scripts/optimized/ui.js?260915091209

js worb.ch collected 2026-09-24 21:08:49 UTC 511,919 bytes, 11,684 lines download raw bytes

1/*
2////////////////////////////////////////////////////////////////
3//
4// UI JavaScript Funktionen
5//
6// Weblication CMS
7// erstellt durch Scholl Communications AG, 77694 Kehl, www.scholl.de
8// erstellt mit Weblication Content Management System, www.weblication.de
9//
10////////////////////////////////////////////////////////////////
11
12////////////////////////////////////////////////////////////////
13//                                                            //
14//                   BITTE NICHT ANPASSEN!                    //
15//           JS-Anpassungen können in der design.js           //
16//                    durchgeführt werden.                    //
17//                                                            //
18////////////////////////////////////////////////////////////////
19*/
20
21wUiVersion     = '1.1.155';
22wAllowMinimize = true;
23
24if(typeof wUiTmp == 'undefined'){
25  wUiTmp = {};
26  if(typeof wUiTmp['wGlobalProjectPath'] == 'undefined'){
27    var scriptTags = document.getElementsByTagName('script');
28    try{
29      for(i = 0; i < scriptTags.length; i++){
30        if(scriptTags[i].getAttribute('src') && scriptTags[i].getAttribute('src').indexOf('/optimized/') != -1){
31          wUiTmp['wGlobalProjectPath'] = scriptTags[i].getAttribute('src').replace(/^(\/[^\/]*)[^\?]*/, '$1').replace(/\?[\s\S]*$/, '');    
32        }  
33      }
34    }
35    catch(e){}
36  }  
37}
38
39wUiTmp['lastScrollTop'] = 0;
40wUiTmp['lang'] = typeof wUiTmp['lang'] == 'undefined' || wUiTmp['lang'] == '' ? jQuery('html').attr('lang') : wUiTmp['lang'] == '' ? wUiTmp['lang'] : 'de'; 
41
42devicePixelRatio          = window.devicePixelRatio || 1;
43hdLimitDpr                = 2;
44wOffsetScrolledTopDefault = 0;
45wCssClassesToAddGlobal    = typeof(wCssClassesToAddGlobal) != 'undefined' ? wCssClassesToAddGlobal : {};
46wCssDataToAddGlobal       = typeof(wCssDataToAddGlobal) != 'undefined' ? wCssDataToAddGlobal : {};
47wCssEventsToAddGlobal     = typeof(wCssEventsToAddGlobal) != 'undefined' ? wCssEventsToAddGlobal : {};
48wCssJQuery                = typeof(wCssJQuery) != 'undefined' ? wCssJQuery : {};
49wCssDOM                   = typeof(wCssDOM) != 'undefined' ? wCssDOM : {};
50wMediaqueriesToAddGlobal  = typeof(wMediaqueriesToAddGlobal) != 'undefined' ? wMediaqueriesToAddGlobal : {};
51wLightboxOpener           = null;
52
53if(document.documentElement){
54  document.documentElement.className = document.documentElement.className + (!/MSIE (6|7|8)/.test(navigator.appVersion) ? ' pagestatus-uiloaded' : '');
55}
56
57handleObserveVisible = function(entries, observer){
58  
59  var entry = null, i = 0;
60  for(i = 0; i < entries.length; i++){
61    entry = entries[i];
62    var cE = jQuery(entry.target), timestamp = (new Date()).getTime();
63    var ratio = 0.1;
64    if(cE.height()/window.innerHeight > 2) ratio = 0.01;
65    if(entry.intersectionRatio > ratio){ 
66      if(cE.hasClass('wglAnimateIfVisible')){   
67        if(!cE.hasClass('isVisible')){        
68          cE.addClass('isVisibleOnce isVisible').removeClass('isInvisible');
69          if(typeof(wOnAfterAnimateIfVisible) === 'function'){
70            wOnAfterAnimateIfVisible(cE);
71          }  
72        }
73      }
74      
75      if(cE.data('doifbecomevisible') && !cE.data('isvisible') && !cE.data('lastbecomevisible') || timestamp - cE.data('lastbecomevisible') > 1000){
76        cE.data('lastbecomevisible', (new Date()).getTime());
77        cE.data('isvisible', true);
78        var event = document.createEvent('Event');
79        var functionDoifbecomevisible = function(){
80          eval(cE.data('doifbecomevisible'));
81        };
82        functionDoifbecomevisible.call(cE.get(0));
83      }
84    }
85    else{
86      if(cE.hasClass('wglAnimateIfVisible')){         
87        if(cE.hasClass('isVisible')){     
88          cE.addClass('isInvisible').removeClass('isVisible');
89          if(typeof(wOnAfterAnimateIfInvisible) === 'function'){
90            wOnAfterAnimateIfInvisible(cE);
91          }  
92        }        
93      }    
94      
95      if(cE.data('doifbecomevisible')){        
96        cE.data('isvisible', false);
97      }      
98    }
99  }
100};
101
102handleObserveVisibleOnce = function(entries, observer){
103  //console.log('handleObserveVisibleOnce');
104
105  var entry = null, i = 0;
106  for(i = 0; i < entries.length; i++){
107    entry = entries[i];
108    if(entry.intersectionRatio > 0){
109      var cE = jQuery(entry.target);
110      if(entry.target.nodeName == 'IMG'){
111        wShowLazyLoadImage(cE);
112      }
113      else if(entry.target.nodeName == 'IFRAME'){
114        wShowLazyLoadIframe(cE);
115      }
116      
117      if(cE.data('doifbecomevisibleonce') && !cE.data('isvisible')){
118        cE.data('lastbecomevisible', (new Date()).getTime());
119        cE.data('isvisible', true);
120        var event = document.createEvent('Event');
121        var functionDoifbecomevisible = function(){
122          eval(cE.data('doifbecomevisibleonce'));
123        };
124        functionDoifbecomevisible.call(cE.get(0));
125        cE.removeAttr('data-doifbecomevisibleonce');        
126      }      
127      
128      if(cE.hasClass('wglAnimateIfVisibleOnce')){
129        cE.addClass('wglAnimateIfVisibleOnceVisible').removeClass('wglAnimateIfVisibleOnce');
130      }
131      
132      observeVisibleOnce.unobserve(entry.target);
133    }  
134  }
135};
136
137var observeVisible     = null;
138var observeVisibleOnce = null
139
140jQuery(document).ready(function(){  
141
142  wUiTmp['documentReady'] = true;
143  
144  var htmlAdditionalClasses = '';
145
146  if(parent != self){
147    if(location.href.indexOf('viewmode=blank') != -1){
148      htmlAdditionalClasses += ' isInLightbox';
149      if(typeof(wAccessibility) !== 'undefined' && wAccessibility['accessEventHandler'] != null && wAccessibility['accessEventHandler'].active){
150        var aEObject = Object.assign({}, wAccessEvents['wLightboxIframe'], {
151          element: jQuery(window.document)
152        });
153        wAccessHandler.addEvent(aEObject);
154      }
155      else{
156        if(parent.jQuery('#wLightboxIframe').data('openpointertype') === ''){
157          var elementToFocus = document.querySelector('h1, h2, h3, h4');
158          if(!elementToFocus){
159            elementToFocus = document.querySelector('div, p');
160          }
161
162          if(elementToFocus){
163            elementToFocus.setAttribute('tabindex', '0');
164            elementToFocus.focus();
165          }
166        }
167
168        document.addEventListener('keydown', function(event) {
169           if(event.key === 'Escape'){
170             event.preventDefault();
171             if(parent.wLightboxOpener){
172               parent.wLightboxOpener.focus();
173             }
174             parent.jQuery('.wLightboxCloser').trigger('click');
175           }
176        });
177      }
178    }
179  }
180
181  if(navigator.appVersion.match(/MSIE (\d+\..)/)){
182    htmlAdditionalClasses += ' ie' + String(navigator.appVersion.match(/MSIE (\d+\..)/)[1]).replace(/\..*/, '');
183  }
184  else if(navigator.userAgent.match(/Trident\/7/)){
185    htmlAdditionalClasses += ' ie11';
186  }
187  
188  if(/mobile/i.test(navigator.userAgent)) htmlAdditionalClasses += ' mobile';
189  if(/iPad/i.test(navigator.platform) || (navigator.platform == 'MacIntel' && navigator.maxTouchPoints == 5)) htmlAdditionalClasses += ' ipad';
190  if(/iPhone/i.test(navigator.platform)) htmlAdditionalClasses += ' iphone';
191  if(/iPod/i.test(navigator.platform)) htmlAdditionalClasses += ' ipod';
192  if(/(iPod|iPhone|iPad)/i.test(navigator.platform) || (navigator.platform == 'MacIntel' && navigator.maxTouchPoints == 5)){
193    htmlAdditionalClasses += ' ios';  
194    if(/Version\/(4|5|6|7|8|9|10|11|12|13)/.test(navigator.userAgent) && !/iPhone\s+OS\s+(4|5|6|7|8|9|10|11|12|13)/.test(navigator.userAgent)){      
195      htmlAdditionalClasses += ' ioslt14';     
196    }
197    if(/CriOs/i.test(navigator.userAgent)){
198      htmlAdditionalClasses += ' crios';
199    }
200    else if(/Safari/i.test(navigator.userAgent)){
201      wUiTmp['isSafari'] = true;
202      htmlAdditionalClasses += ' saios';
203    }  
204  }   
205  if(/MacIntel/.test(navigator.platform) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2){
206    if(/CriOs/i.test(navigator.userAgent)){
207      htmlAdditionalClasses += ' crios';
208    }
209    else if(/Safari/i.test(navigator.userAgent)){
210      wUiTmp['isSafari'] = true;
211      htmlAdditionalClasses += ' saios';
212    }
213  }
214
215  htmlAdditionalClasses += ' viewmode-' + (/viewmode=([^&]+)/.test(location.href) ? RegExp.$1 : 'default');
216  htmlAdditionalClasses += location.href.indexOf('targetPreview=embed') != -1 ? ' wpreview' : '';    
217  htmlAdditionalClasses += location.href.indexOf('createImageRaster=1') != -1 ? ' createImageRaster' : '';  
218  htmlAdditionalClasses += (!navigator.userAgent.match(/Trident\/7/) && (('ontouchstart' in window) || navigator.msMaxTouchPoints  || window.DocumentTouch && document instanceof DocumentTouch) ? ' touch' : ' no-touch');
219  htmlAdditionalClasses += (jQuery(window).scrollTop() <= wOffsetScrolledTopDefault && jQuery(window).scrollTop() >= 0) && document.documentElement.className.indexOf(' scrolled-top') == -1 ? ' scrolled-top' : '';
220
221  if(document.cookie.indexOf('websitezoom=l') != -1){
222    htmlAdditionalClasses += ' zoom-l';
223  }
224
225  if(document.cookie.indexOf('websitecontrast=1') != -1){
226    htmlAdditionalClasses += ' contrast-height';
227  }    
228    
229  if(document.documentElement){
230    if(document.documentElement.getAttribute('lang')){
231      htmlAdditionalClasses += ' lang-' + document.documentElement.getAttribute('lang');
232    }
233
234    var documentElementClassName = document.documentElement.className;
235    
236    if(jQuery(window).scrollTop() > wOffsetScrolledTopDefault){
237      documentElementClassName = documentElementClassName.replace(' scrolled-top', '');
238    }    
239    documentElementClassName = (documentElementClassName.replace('no-js', 'js') + htmlAdditionalClasses).replace(/^\s+/, '');        
240    if(typeof(wEditor) == 'undefined'){
241      documentElementClassName = documentElementClassName.replace(' weditor', ' no-weditor');
242    }
243    else{
244      documentElementClassName = documentElementClassName.replace(' no-weditor', ' weditor');
245    }
246    documentElementClassName = documentElementClassName + (!/MSIE (6|7|8)/.test(navigator.appVersion) ? ' pagestatus-ready' : '');
247    if(/MSIE (6|7|8)/.test(navigator.appVersion)){
248      documentElementClassName = documentElementClassName.replace(/pagestatus-\w+/g, '');
249    }
250    document.documentElement.className = documentElementClassName;
251  }  
252  
253  wPersonalizeAccessibility();  
254  
255  for(var addClassSelector in wCssClassesToAddGlobal){
256    jQuery(addClassSelector).each(function(index){
257      var classesToAdd = wCssClassesToAddGlobal[addClassSelector];
258      for(var i = 0, arrayLength = classesToAdd.length; i < arrayLength; i++){
259        var classData = classesToAdd[i].split('=');
260        if(classData.length == 2){
261          var selector = jQuery.trim(classData[0]);
262          if(selector == '.'){
263            jQuery(this).addClass(jQuery.trim(classData[1]));
264          }
265          else if(selector == 'parent'){
266            jQuery(this).parent().addClass(jQuery.trim(classData[1]));
267          }
268          else{
269            jQuery(this).find(selector).addClass(jQuery.trim(classData[1]));
270          }
271        }
272        else{
273          jQuery(this).addClass(jQuery.trim(classData[0]));
274        }
275      }
276    });
277  }
278
279  for(var addDataSelector in wCssDataToAddGlobal){
280    jQuery(addDataSelector).each(function(index){
281      var dataToAdd = wCssDataToAddGlobal[addDataSelector];
282
283      for(var i = 0, arrayLength = dataToAdd.length; i < arrayLength; i++){
284        var data = dataToAdd[i].split('=');
285        jQuery(this).attr('data-' + jQuery.trim(data[0]), jQuery.trim(data[1]));
286      }
287    });
288  }
289  
290  if(typeof wCssAttributesToAddGlobal !== 'undefined'){
291    for(var addAttributeSelector in wCssAttributesToAddGlobal){
292      jQuery(addAttributeSelector).each(function(index){
293        var attributeToAdd = wCssAttributesToAddGlobal[addAttributeSelector];
294
295        for(var i = 0, arrayLength = attributeToAdd.length; i < arrayLength; i++){
296          var data = attributeToAdd[i].split('=');
297          jQuery(this).attr(jQuery.trim(data[0]), jQuery.trim(data[1]));
298        }
299      });
300    }  
301  }
302
303  jQuery('*[data-w-addclasses]').each(function(index){
304
305    var classesToAdd = jQuery(this).data('w-addclasses').split(',');
306    jQuery(this).removeAttr('data-w-addclasses');
307    for(var i = 0, arrayLength = classesToAdd.length; i < arrayLength; i++){
308      var classData = classesToAdd[i].split('=');
309      var selector = jQuery.trim(classData[0]);
310      if(selector == '.'){
311        jQuery(this).addClass(jQuery.trim(classData[1]));
312      }
313      else{
314        jQuery(this).find(selector).addClass(jQuery.trim(classData[1]));
315      }
316    }
317  });
318
319  for(var addEventSelector in wCssEventsToAddGlobal){
320    jQuery(addEventSelector).each(function(index){
321      var eventsToAdd = wCssEventsToAddGlobal[addEventSelector];
322      for(var i = 0, arrayLength = eventsToAdd.length; i < arrayLength; i++){
323        var eventData = eventsToAdd[i].split('=');
324        if(eventData.length == 2){
325          var eventType     = jQuery.trim(eventData[0]).replace(/^on/, '');
326          var eventFunction = jQuery.trim(eventData[1]);
327          jQuery(this).on(eventType, (new Function('event', eventFunction + '(this, event.originalEvent);')));
328        }
329      }
330    });
331  }
332
333  for(var wCssJQueryEntry in wCssJQuery){
334    jQuery(wCssJQueryEntry).each(function(index){
335      if(!wCssJQuery[wCssJQueryEntry]['event'] || wCssJQuery[wCssJQueryEntry]['event'] == 'document.ready'){
336        eval(wCssJQuery[wCssJQueryEntry]['jQuery']);
337      }
338    });
339  }
340
341  for(var wCssDOMEntry in wCssDOM){
342    jQuery(wCssDOMEntry).each(function(index){
343      domActions = {'prependto' : 'prependTo', 'appendto' : 'appendTo', 'insertbefore' : 'insertBefore', 'insertafter' : 'insertAfter'};
344      if(/^(\w+)\(/.test(wCssDOM[wCssDOMEntry]['path'])){
345        eval('jQuery(this).' + domActions[wCssDOM[wCssDOMEntry]['action'].toLowerCase()] + '(jQuery(this).' + wCssDOM[wCssDOMEntry]['path'].replace(/\*\/$/, '') + ');');
346      }
347      else{
348        if(wCssDOM[wCssDOMEntry]['action'] == 'prependto'){
349          jQuery(this).prependTo(wCssDOM[wCssDOMEntry]['path']);
350        }
351        else if(wCssDOM[wCssDOMEntry]['action'] == 'appendto'){
352          jQuery(this).appendTo(wCssDOM[wCssDOMEntry]['path']);
353        }
354        else if(wCssDOM[wCssDOMEntry]['action'] == 'insertbefore'){
355          jQuery(this).insertBefore(wCssDOM[wCssDOMEntry]['path']);
356        }
357        else if(wCssDOM[wCssDOMEntry]['action'] == 'insertafter'){
358          jQuery(this).insertAfter(wCssDOM[wCssDOMEntry]['path']);
359        }
360      }
361    });
362  }
363  
364  if(typeof wHasInterpretedCssJs === 'function'){
365    wHasInterpretedCssJs();
366  }
367  
368  if(typeof wEditor != 'undefined' && typeof wEditor.wHasInterpretedCssJs === 'function'){
369    wEditor.wHasInterpretedCssJs();
370  }
371
372  var mediaQueriesTmpToAdd = '<div id="wMediaqueriesTmp">';
373
374  for(var wMediaqueryToAddGlobal in wMediaqueriesToAddGlobal){
375    mediaQueriesTmpToAdd += '<div id="wMediaqueryTmp_' + wMediaqueryToAddGlobal + '"></div>';
376  }
377
378  mediaQueriesTmpToAdd += '</div>';
379  wCookieNoticeVar = typeof(wCookieNoticeVar) != 'undefined' ? wCookieNoticeVar : '';
380  var useAccessEvent = (typeof(wAccessibility) !== 'undefined' && wAccessibility['accessEventHandler'] != null && wAccessibility['accessEventHandler'].active === true) ? true : false;
381  var useAccessEvent = true;
382  if(useAccessEvent) wAccessHandler.addEvent(wAccessEvents['cookieNotice']);
383  
384  if(typeof(wEditor) != 'undefined' || typeof doNotShowCookieNotice !== 'undefined' && doNotShowCookieNotice || document.cookie.indexOf('hideCookieNotice' + wCookieNoticeVar + '=1') != -1 || /bot|search|slurp|spider|crawler|lighthouse|mediapartners|Google-AdWords-Express/i.test(navigator.userAgent)){
385    if(typeof closeCookieNotice === 'function'){    
386      closeCookieNotice();
387    }
388    else{
389      jQuery('#cookieNotice').hide();
390    } 
391    if(useAccessEvent) wAccessEvents['cookieNotice'].deactivate(wAccessEvents['cookieNotice']);
392  }
393  else{
394    
395    var cIfDnt = typeof confirmIfDnt !== 'undefined' ? confirmIfDnt : '';
396
397    if(cIfDnt === 'hideCookieInfo' && typeof navigator.doNotTrack !== 'undefined' && navigator.doNotTrack === '1'){
398      if(typeof closeCookieNotice === 'function'){    
399        closeCookieNotice();
400      }
401      else{
402        jQuery('#cookieNotice').hide();
403      } 
404      if(useAccessEvent) wAccessEvents['cookieNotice'].deactivate(wAccessEvents['cookieNotice']);
405      document.cookie = 'allowTracking=0;path=/;sameSite=lax';
406      document.cookie = 'allowLoadExternRessources=0;path=/;sameSite=lax';
407      document.cookie = 'hideCookieNotice=1;path=/;sameSite=lax';         
408    }
409    else if(cIfDnt === 'showOnlyDntInfo' && typeof navigator.doNotTrack !== 'undefined' && navigator.doNotTrack === '1'){
410      jQuery('#cookieNotice').hide();
411      if(typeof showDntNotice === 'function'){    
412        showDntNotice();
413      }
414      else{
415        var timeDisplay = 8000;
416
417        setTimeout(function(){    
418          jQuery('#dntNotice').css({'display' : 'block'});
419        }, 1800);
420
421        setTimeout(function(){  
422          jQuery('#dntNotice').addClass('isVisible');
423          setTimeout(function(){
424            jQuery('#dntNotice').removeClass('isVisible');
425            setTimeout(function(){
426              jQuery('#dntNotice').css({'display' : 'none'});
427            }, 1000);      
428          }, timeDisplay);
429        }, 2000);
430
431        document.cookie = 'allowTracking=0;path=/;sameSite=lax';
432        document.cookie = 'allowLoadExternRessources=0;path=/;sameSite=lax';
433        document.cookie = 'hideCookieNotice=1;path=/;sameSite=lax';         
434      }
435    }
436    else if(typeof showCookieNotice === 'function'){    
437      if(useAccessEvent) wAccessEvents['cookieNotice'].activate(wAccessEvents['cookieNotice'], {'isWall' : true});
438      showCookieNotice();
439    }
440    else{    
441      //jQuery('#cookieNotice').show();
442      if(jQuery('#cookieNotice').hasClass('blockPage')){ 	
443        if(useAccessEvent) wAccessEvents['cookieNotice'].activate(wAccessEvents['cookieNotice'], {'isWall' : true});
444        else{
445          jQuery('body').on('keyup', function(e){
446            if(e.keyCode == 9 && !jQuery(e.target).is('#cookieNotice *')){
447              jQuery('#cookieNotice').attr('tabindex', 0).focus();
448              return false;
449            }
450          });
451        }
452      }
453    }    
454  }
455  
456  if(typeof(wSelectionFontSizeAddToCookieNotice) !== 'undefined' && wSelectionFontSizeAddToCookieNotice || typeof(wSelectionContrastAddToCookieNotice) !== 'undefined' && wSelectionContrastAddToCookieNotice){
457    if(!jQuery('#waiSectionCookieNotice').length){
458      jQuery('#cookieNoticeInner > div').prepend('<div id="waiSectionCookieNotice"></div>');
459    }
460    
461    if(typeof(wSelectionFontSizeAddToCookieNotice) !== 'undefined' && wSelectionFontSizeAddToCookieNotice){    
462      jQuery('#waiSectionCookieNotice').append(jQuery('.wAiSectionFontSize').clone());
463    }    
464    if(typeof(wSelectionContrastAddToCookieNotice) !== 'undefined' && wSelectionContrastAddToCookieNotice){
465      jQuery('#waiSectionCookieNotice').append(jQuery('.wAiSectionContrast').clone());
466    }
467  }
468
469  wOffsetScrolledTopSet = typeof(wOffsetScrolledTop) != 'undefined' ? wOffsetScrolledTop : (document.documentElement.getAttribute('data-offsetscrolledtop') && document.documentElement.getAttribute('data-offsetscrolledtop') != '' ? document.documentElement.getAttribute('data-offsetscrolledtop') : 0);
470  wOffsetBottomChangeScrollStatusSet = typeof(wOffsetBottomChangeScrollStatus) != 'undefined' ? wOffsetBottomChangeScrollStatus : (document.documentElement.getAttribute('data-offsetscrolledtop') && document.documentElement.getAttribute('data-offsetbottomchangescrollstatus') != '' ? document.documentElement.getAttribute('data-offsetbottomchangescrollstatus') : 0);
471  
472  if(wOffsetScrolledTopSet != wOffsetScrolledTopDefault){
473    wOffsetScrolledTopDefault = wOffsetScrolledTopSet;
474    if(jQuery(window).scrollTop() > wOffsetScrolledTopDefault){
475      documentElementClassName = documentElementClassName.replace(' scrolled-top', '');
476    }
477    else if(document.documentElement.className.indexOf(' scrolled-top') == -1){
478      document.documentElement.className += ' scrolled-top';
479    }
480  }
481  
482  if(typeof(wHandleObserveVisible) != 'undefined' && wHandleObserveVisible === true){
483    var options= {threshold: 0.1};
484    if(typeof wObserverOptions != 'undefined'){
485      options = wObserverOptions;
486    }
487    observeVisible     = ('IntersectionObserver' in window) ? new IntersectionObserver(handleObserveVisible, options) : null;
488    observeVisibleOnce = ('IntersectionObserver' in window) ? new IntersectionObserver(handleObserveVisibleOnce, options) : null;  
489  }
490
491  jQuery('body').append(mediaQueriesTmpToAdd);
492  jQuery('.wglTabcontainer').wTabcontainer();
493  jQuery('.wglAccordion').wAccordion();
494  jQuery('.wglBannerSlider').wBannerSlider();
495  jQuery('.wglSmartSlider').wSmartSlider();    
496  jQuery('.wglPictureGallery').wPictureGallery();
497  jQuery('.wglLightbox').wLightbox();
498  jQuery('.wglMaximizer').wMaximizer();
499  jQuery('.wglDatepicker').wDatepicker();
500  jQuery('.wglSearchSuggest').wSearchSuggest();
501  jQuery('textarea[data-autoheight="1"]').wAutoheight();
502  jQuery('input[type="range"]').wInputRange();
503  jQuery('[data-accessevent]').wAccessEventHandler();
504    
505  if(observeVisible){  
506    jQuery('img.wglLazyLoadInit').each(function(index){
507      observeVisible.observe(jQuery(this).get(0));
508    });    
509    jQuery('iframe.wglLazyLoadInit').each(function(index){
510      observeVisible.observe(jQuery(this).get(0));
511    });    
512  }
513
514  if(observeVisibleOnce){  
515    jQuery('img.wglLazyLoadInit').each(function(index){
516      observeVisibleOnce.observe(jQuery(this).get(0));
517    });    
518    jQuery('iframe.wglLazyLoadInit').each(function(index){
519      observeVisibleOnce.observe(jQuery(this).get(0));
520    });    
521  }     
522
523  var labels = jQuery('#blockBody').length > 0 ? jQuery('#blockBody label, #blockFooter label') : jQuery('label');
524  labels.each(function(index){
525    var nameFor = jQuery(this).attr('for');
526    if(nameFor && nameFor != ''){
527      var currentForm = jQuery(this).closest('form').get(0);
528      if(currentForm){
529        var elementFor  = currentForm.elements[nameFor];
530        if(elementFor && elementFor.length){
531          elementFor = elementFor[0];
532        }
533
534        if(!elementFor){
535          elementFor = jQuery(this).closest('form').find('#' + nameFor).get(0);
536        }
537
538        if(elementFor && typeof(elementFor.getAttribute('placeholder')) == 'string' && (elementFor.className.indexOf('wglIsInvalid') == -1 || elementFor.value == '')){
539          if(elementFor.getAttribute('data-showlabelifhasplaceholder') !== '1' && typeof(elementFor.placeholder) != 'undefined'){
540            if(jQuery(this).is(':visible') && !jQuery(this).hasClass('visuallyhidden')){
541              jQuery(this).css({'display' : 'none'});
542            }
543          }
544        }
545      }
546    }
547  });
548
549  wPrepareHTML();
550
551  if(window.matchMedia){
552    window.matchMedia('print').addListener(function(){
553      wUiTmp['isMediaPrint'] = true;
554      jQuery(window).trigger('resize');
555    });
556  }
557  else{
558    window.onbeforeprint = function(event){
559      wUiTmp['isMediaPrint'] = true;
560      jQuery(window).trigger('resize');
561    };
562  }
563
564  if(/viewmode=print/.test(location.search)){
565    wUiTmp['isViewmodePrint'] = true;
566  }
567
568  window.setTimeout(function(event){
569    wAdaptParallax(event);
570  }, 320);
571  
572  wAdaptConditionalFormData();
573  
574  jQuery('.wglAddScrollProgress').each(function(index){
575
576    var cE = jQuery(this);
577    cE.append('<progress id="scrollProgress" max="1000" value="0"><div></div></progress');
578    
579    wUiTmp['elementScrollProgress'] = jQuery('#scrollProgress');
580    
581    jQuery(window).on('resize scroll', function(){
582      var documentHeight = jQuery(document).height();      
583      var scrollPercentage = Math.round(1000 * wUiTmp['lastScrollTop'] / (documentHeight - wUiTmp['lastWindowHeight']));
584      wUiTmp['elementScrollProgress'].attr('value', scrollPercentage)
585    });
586  });  
587
588  jQuery('.wglAddScrollTop').each(function(index){
589
590    var cE = jQuery(this);
591    if(cE.get(0).nodeName.toLowerCase() == 'body'){
592      cE.append('<div id="scrollTopOuter"><div id="scrollTop" tabindex="0" role="button" title="' + (jQuery('body').data('titlescrolltop') ? jQuery('body').data('titlescrolltop') : '') + '" aria-label="' + (jQuery('body').data('titlescrolltop') ? jQuery('body').data('titlescrolltop') : '') + '"><div class="scrollTopInner"></div></div></div');
593    }
594    else{
595      cE.after('<div id="scrollTopOuter"><div id="scrollTop" tabindex="0" role="button" title="' + (jQuery('body').data('titlescrolltop') ? jQuery('body').data('titlescrolltop') : '') + '" aria-label="' + (jQuery('body').data('titlescrolltop') ? jQuery('body').data('titlescrolltop') : '') + '"><div class="scrollTopInner"></div></div></div');
596    }
597    var stO = jQuery('#scrollTop');
598    stO.on('click', function (event){
599      event.preventDefault();
600      jQuery('body, html').animate({scrollTop:0});
601    });
602    
603    stO.on('keyup', function (event){
604      if(event.keyCode == 13){
605        jQuery(this).trigger('click');
606      }
607    });
608    
609    jQuery(window).on('scroll', function(){
610      var scrollTop  = jQuery(this).scrollTop();
611      wUiTmp['scrollMax'] = typeof(wUiTmp['scrollMax']) !== 'undefined' ? Math.max(wUiTmp['scrollMax'], scrollTop) : scrollTop;      
612      var fadeInAt = stO.attr('data-fadeInAt') != undefined ? parseInt(stO.attr('data-fadeInAt')) : 200;
613      if(scrollTop > fadeInAt){
614        stO.fadeIn();
615      }
616      else{
617        stO.fadeOut();
618      }
619    });
620    
621  });
622
623  jQuery('.wglShrinkToMinWidthWithoutBreak').each(function(index){
624
625    var cE = jQuery(this);
626    var textAlignBefore = cE.css('text-align');
627    cE.css({'text-align' : 'left'});
628    var lastElementInner = cE.children('*:last');
629    var offsetRightLastElementInner = Math.ceil(lastElementInner.get(0).offsetLeft + lastElementInner.outerWidth() + parseInt(lastElementInner.css('margin-right')));
630    cE.css({'text-align' : textAlignBefore, 'width' : String(offsetRightLastElementInner) + 'px'});
631  });
632
633  jQuery('.wglAdjustWidthEqual').each(function(index){
634
635    var cE = jQuery(this);
636    var nE = 0;
637    cE.children('*').each(function(index){
638      if(jQuery(this).css('display') != 'none'){
639        nE++;
640      }
641    });
642    var widthPerEntry  = String(100 / nE) + '%';
643    cE.children('*').each(function(index){
644      if(jQuery(this).css('display') != 'none'){
645        jQuery(this).css({'width' : widthPerEntry});
646      }
647    });
648  });
649
650  jQuery('.wglRemoveOnClick').each(function(index){
651    jQuery(this).attr('onclick', '').off('click');
652  });  
653  
654  jQuery('.wglCaptcha').each(function(index){
655    if(jQuery(this).find('iframe[data-h="1"]').length == 1){
656      jQuery(this).closest('.formElementCaptcha').hide();
657      jQuery(this).closest('form').find('button[type="submit"]').on('click', function(event){
658        var iFr = jQuery(this).closest('form').find('iframe[class="wglIFrameSc"]');
659        jQuery(this).closest('form').find('input[id="captchaInput"]').val(iFr.get(0).contentWindow.gv(event.originalEvent, iFr.data('k')).substr(5, 4));
660      });
661    }
662  });    
663  
664  if(typeof(wEditor) == 'undefined'){  
665    jQuery('.wglAnimateAfterTime').each(function(index){
666      var cE = jQuery(this);
667      var ti = typeof(cE.data('animateaftertime')) != 'undefined' ? cE.data('animateaftertime') * 1000 : 0;
668      window.setTimeout(function(){
669        cE.addClass('isAfterTime' + (typeof(cE.data('classtoaddaftertime')) != 'undefined' ? ' ' + cE.data('classtoaddaftertime') : ''));
670        cE.removeClass(typeof(cE.data('classtoremoveaftertime')) != 'undefined' ? ' ' + cE.data('classtoremoveaftertime') : '');
671      }, ti);
672    });  
673  }    
674
675  if(typeof(wEditor) == 'undefined'){
676    jQuery('.wglLightbox').each(function(index){
677      var cE = jQuery(this);
678      if(cE.get(0).nodeName == 'IMG'){
679        var wrapElement = cE.parent().attr('class') == 'listEntryThumbnailOuter' ? cE.parent() : cE;
680        var srcLightbox    = cE.attr('src');
681        if(cE.attr('data-src') && cE.attr('data-src') != ''){
682          srcLightbox = cE.attr('data-src');
683        }
684        else{
685          if(/\-/.test(srcLightbox.replace(/[\s\S]+\//, ''))){
686            srcLightbox = srcLightbox.replace(/\/weblication\/wThumbnails/, '').replace(/-[^-]+(\.\w+)$/, '$1');
687          }
688          else if(cE.attr('data-src2x') && cE.attr('data-src2x') != ''){
689            srcLightbox = cE.attr('data-src2x');
690          }
691        }
692
693        var closestList = cE.closest('.elementList');
694        var relId       = '';
695        if(closestList.length == 1){
696          relId = closestList.attr('id');
697        }
698        wrapElement.wrap('<a rel="' + relId + '" onclick="event && event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true;" title="' + cE.get(0).alt + '" class="boxPictureOnly" href="' + srcLightbox + '"/>');
699      }
700    });    
701  }
702
703  jQuery('form').not('[data-inlinevalidation="onblur"]').find('input[data-validators="email"]').each(function(){
704    jQuery(this).on('blur', function(){
705      jQuery(this).val(jQuery(this).val().trim());
706    });
707  });
708                                                                            
709  wAddInlineValidator = function(input){
710    
711    currentForm = input.closest('form');    
712    currentForm.attr('data-hasinputstovalidate', '1');
713
714    if(location.search.indexOf('wFormStatus=failed') != -1 && currentForm.attr('data-showinlinevalidationaferfailed') == '1'){          
715      wglValidateElementInline(input.get(0), {'clientside' : currentForm.attr('action').indexOf('/weblication/grid5/tmpHTTP/wForm-') == -1});
716    }           
717    else if(location.search.indexOf('wFormStatus=failed') != -1 && input.find('#wFormErrorMessages').length > 0){
718      wglValidateElementInline(input.get(0), {'onInit' : true, 'clientside' : currentForm.attr('action').indexOf('/weblication/grid5/tmpHTTP/wForm-') == -1});
719    }              
720    else{
721      var vlr = wGetValidationInfoInput(input);
722      currentForm.attr('data-hasvalidated', '1');
723      if(!vlr['isValid']){
724        input.attr('data-isinvalid', '1'); 
725        currentForm.attr('data-hasinputsinvalid', '1');  
726      }  
727    }
728
729    var eventsToValidate = 'blur';
730    if(input.attr('type') == 'radio' || input.attr('type') == 'checkbox'){
731      eventsToValidate = 'blur click';
732    }    
733    else if(input.attr('type') == 'file' || input.prop("tagName") == 'SELECT' || input.hasClass('hasDatepicker')){
734      eventsToValidate = 'blur change';
735    }
736    
737    input.on(eventsToValidate, function(){
738      if(input.attr('readOnly') === 'readonly'){
739        window.setTimeout(function(){
740          wglValidateElementInline(input.get(0), {'clientside' : currentForm.attr('action').indexOf('/weblication/grid5/tmpHTTP/wForm-') == -1});
741        }, 320);
742      }
743      else{
744        wglValidateElementInline(input.get(0), {'clientside' : currentForm.attr('action').indexOf('/weblication/grid5/tmpHTTP/wForm-') == -1});
745      }
746    });
747    input.on('keyup', function(event){
748      if(event.originalEvent && (event.originalEvent.keyCode == 9 || event.originalEvent.keyCode == 16)){
749      }
750      else{
751        wglValidateElementInline(jQuery(this).get(0), {'userinfo' : false, 'clientside' : currentForm.attr('action').indexOf('/weblication/grid5/tmpHTTP/wForm-') == -1});
752      }
753    });            
754  };
755                                                 
756  wInitInlineValidation = function() {
757    jQuery('form[data-inlinevalidation="onblur"]').each(function () {
758      wUiTmp['formPos'] = wUiTmp['formPos'] ? wUiTmp['formPos'] + 1 : 1;
759      var currentForm = jQuery(this);
760
761      currentForm.attr('data-formpos', wUiTmp['formPos']);
762      currentForm.attr('data-hasinputstovalidate', '0');
763
764      currentForm.find('input, textarea, select').each(function () {
765        if (jQuery(this).attr('data-validators') && jQuery(this).attr('data-validators') !== '') {
766          wAddInlineValidator(jQuery(this));
767        } 
768        else if (typeof wAddEmptyInputValidators !== 'undefined' && wAddEmptyInputValidators) {
769          wAddInlineValidator(jQuery(this));
770        }
771      });
772    });
773  };
774  wInitInlineValidation();
775  
776  jQuery('.wglTimeLeft:not([data-init="1"]').each(function(index){
777
778    var cO = jQuery(this);  
779    var cE = cO.get(0);
780
781    if(typeof(wEditor) != 'undefined'){
782      cO.attr('data-init', '1');
783      return false;
784    }
785    
786    cO.attr('data-init', '1');  
787    
788    var htmlTemplate = cE.innerHTML;   
789    if(cE.hasAttribute('data-text-template') && (htmlTemplate == '' && cE.getAttribute('data-text-template') != '' || cE.getAttribute('data-text-template') != '')){
790      htmlTemplate = cE.getAttribute('data-text-template');
791      if(cO.children().hasClass('wglCountUp') || cE.innerHTML == ''){
792        htmlTemplate = jQuery(cE.getAttribute('data-text-template')).addClass('wglCountUp').get(0).outerHTML;
793      }
794    }
795    
796    intervalToSetTime = 10000;
797    
798    var intervalFunction = function(){
799
800      var now     = new Date(); 
801      var nowYear = now.getUTCFullYear();
802
803      var dateTimeStr = cE.getAttribute('data-time').trim();
804      if(dateTimeStr){
805        dateTimeStr = dateTimeStr.replace('Y', now.getUTCFullYear());
806        dateTimeStr = dateTimeStr.replace('m', now.getMonth() + 1);        
807      }
808      
809      var lang                = (document.documentElement.getAttribute('lang') ? document.documentElement.getAttribute('lang') : 'de').replace(/-\w+/, '');
810      var numberDigitsSeconds = cE.getAttribute('data-number-digits-seconds') ? cE.getAttribute('data-number-digits-seconds') : 1;
811
812      var textDay  = cE.getAttribute('data-text-day-' + lang) ? cE.getAttribute('data-text-day-' + lang) : (cE.getAttribute('data-text-day') ? cE.getAttribute('data-text-day') : 'Tag');
813
814      var textDay  = cE.getAttribute('data-text-day-' + lang) ? cE.getAttribute('data-text-day-' + lang) : (cE.getAttribute('data-text-day') ? cE.getAttribute('data-text-day') : 'Tag');
815      var textDays = cE.getAttribute('data-text-days-' + lang) ? cE.getAttribute('data-text-days-' + lang) : (cE.getAttribute('data-text-days') ? cE.getAttribute('data-text-days') : 'Tage');
816      
817      var textHour  = cE.getAttribute('data-text-hour-' + lang) ? cE.getAttribute('data-text-hour-' + lang) : (cE.getAttribute('data-text-hour') ? cE.getAttribute('data-text-hour') : 'Stunde');
818      var textHours = cE.getAttribute('data-text-hours-' + lang) ? cE.getAttribute('data-text-hours-' + lang) : (cE.getAttribute('data-text-hours') ? cE.getAttribute('data-text-hours') : 'Stunden');
819
820      var textMinute  = cE.getAttribute('data-text-minute-' + lang) ? cE.getAttribute('data-text-minute-' + lang) : (cE.getAttribute('data-text-minute') ? cE.getAttribute('data-text-minute') : 'Minute');
821      var textMinutes = cE.getAttribute('data-text-minutes-' + lang) ? cE.getAttribute('data-text-minutes-' + lang) : (cE.getAttribute('data-text-minutes') ? cE.getAttribute('data-text-minutes') : 'Minuten');
822
823      var textSecond  = cE.getAttribute('data-text-second-' + lang) ? cE.getAttribute('data-text-second-' + lang) : (cE.getAttribute('data-text-second') ? cE.getAttribute('data-text-second') : 'Sekunde');
824      var textSeconds = cE.getAttribute('data-text-seconds-' + lang) ? cE.getAttribute('data-text-seconds-' + lang) : (cE.getAttribute('data-text-seconds') ? cE.getAttribute('data-text-seconds') : 'Sekunden');    
825
826      if(/^(\d+)-(\d+)-(\d+)$/.test(dateTimeStr)){
827        dateTimeStr += ' 00:00:00';
828      }  
829      
830      if(/(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)/.test(dateTimeStr)){
831        var dateTime      = new Date(RegExp.$1, RegExp.$2 - 1, RegExp.$3, RegExp.$4, RegExp.$5, RegExp.$6);    
832        var diffSeconds   = parseInt(dateTime.getTime() / 1000) - parseInt(now.getTime() / 1000);
833
834        if(diffSeconds > 0){
835          var remainingDays    = Math.floor(diffSeconds / 86400);
836          var remainingHours   = Math.floor((diffSeconds % 86400) / 3600);
837          var remainingMinutes = Math.floor((diffSeconds % 3600) / 60);
838          var remainingSeconds = Math.floor((diffSeconds % 60));    
839                    
840          if(numberDigitsSeconds == 2 && remainingSeconds < 10){
841            remainingSeconds = '0' + String(remainingSeconds);
842          }
843                    
844          var html = htmlTemplate;
845
846          html = html.replace('%days', remainingDays == 1 ? '1 ' + textDay : remainingDays + ' ' + textDays);
847          html = html.replace('%hours', remainingHours == 1 ? '1 ' + textHour : remainingHours + ' ' + textHours);
848          html = html.replace('%minutes', remainingMinutes == 1 ? '1 ' + textMinute : remainingMinutes + ' ' + textMinutes);
849          html = html.replace('%seconds', remainingSeconds == 1 || remainingSeconds == '01' ?  remainingSeconds + ' ' + textSecond : remainingSeconds + ' ' + textSeconds);
850
851          cE.innerHTML = html;
852        }
853        else{
854          cO.parent().addClass('hasReachedTime');
855        }
856      }    
857    };
858    
859    intervalFunction();
860    
861    if(htmlTemplate.indexOf('%seconds') != -1){
862      window.setInterval(intervalFunction, 1000);  
863    }
864    else if(htmlTemplate.indexOf('%minutes') != -1){
865      window.setInterval(intervalFunction, 1000 * 60);        
866    }
867    else{
868      window.setInterval(intervalFunction, 1000 * 3600);  
869    }
870  });     
871
872  if(/Android/i.test(navigator.userAgent) && (typeof(wAddAccessDocumentOnPdfsIfAndroid) == 'undefined' || wAddAccessDocumentOnPdfsIfAndroid)){
873    jQuery('a').each(function(){
874      var cE = jQuery(this);
875      var hrefCurrent = cE.attr('href');
876      if(/\.pdf$/.test(hrefCurrent) && !/accessDocument\.php/.test(hrefCurrent) && !/^https?\:\/\//.test(hrefCurrent)){        
877        if(cE.attr('data-pathPrepend')){
878          hrefCurrent = cE.attr('data-pathPrepend') + hrefCurrent; 
879        }
880        cE.attr('href', wUiTmp['wGlobalProjectPath'] + '/wGlobal/scripts/accessDocument.php?forceDownload=' + (cE.hasClass('download') ? '1' : '0') + '&document=' + encodeURIComponent(hrefCurrent));
881      }
882    });
883  }
884
885  jQuery(window).trigger('resize');
886  
887  if((typeof(wDoNotFireOnLoadBeforeReady) == 'undefined' || wDoNotFireOnLoadBeforeReady) && wUiTmp['windowLoadAfterReady']){
888    wWindowOnLoad();
889  }
890  
891  showNoticeExternalLinks();
892  
893  //Barrierefreiheit
894  jQuery('.elementBox[role="link"]').each(function(){
895    if(jQuery(this).find('a, *[role="link"]').length > 0) jQuery(this).removeAttr('role'); 
896  });
897  
898  window.addEventListener('beforeunload', function(){
899    if(window.speechSynthesis && window.speechSynthesis.speaking){ 
900      window.speechSynthesis.cancel();
901    }
902  }); 
903  
904  if(typeof waiReportActive !== 'undefined' && waiReportActive){
905    window.setTimeout(function(){
906      if(!/bot/i.test(navigator.userAgent)){
907        let se = document.createElement('script');
908        se.src = '/weblication/grid5/gui/scripts/waiChecker.js' + (typeof(wCe) !== 'undefined' ? '?av=' + wCe : '');
909        se.onload = function(){
910          wWaiChecker.feedbackDataReport(location.pathname);
911        };
912        document.head.appendChild(se);  
913      }
914    }, 1000);  
915  }  
916});
917
918jQuery(window).on('load', function(){
919  
920  if(typeof(wDoNotFireOnLoadBeforeReady) == 'undefined' || wDoNotFireOnLoadBeforeReady){
921    if(wUiTmp['documentReady'] && !wUiTmp['windowLoad']){
922      wWindowOnLoad();
923    }
924    else{
925      wUiTmp['windowLoadAfterReady'] = true;
926    }
927  }
928  else{
929    wWindowOnLoad();
930  }
931});
932
933jQuery(window).on('scroll', function(){
934  
935  const scrollTop  = jQuery(window).scrollTop();    
936  wUiTmp['scrollMax'] = typeof(wUiTmp['scrollMax']) !== 'undefined' ? Math.max(wUiTmp['scrollMax'], scrollTop) : scrollTop;      
937  if(jQuery('#blockBody').length !== 0 && jQuery('#blockHeader').length !== 0){
938    const blockBodyBottom = jQuery('#blockHeader').height() + jQuery('#blockBody').height();
939    const vc = blockBodyBottom > 0 ? (Math.round(100 * (scrollTop + jQuery(window).height()) / (blockBodyBottom))/ 100) : 0;
940    wUiTmp['viewContentMax'] = typeof(wUiTmp['viewContentMax']) !== 'undefined' ? Math.max(wUiTmp['viewContentMax'], vc) : vc;
941  }
942}); 
943
944wWindowOnLoad = function(){
945    
946  wUiTmp['windowLoad'] = true;
947    
948  for(var wCssJQueryEntry in wCssJQuery){
949    jQuery(wCssJQueryEntry).each(function(index){
950      if(wCssJQuery[wCssJQueryEntry]['event'] && wCssJQuery[wCssJQueryEntry]['event'] == 'window.load'){
951        eval(wCssJQuery[wCssJQueryEntry]['jQuery']);
952      }
953    });
954  }
955
956  jQuery("img[data-srchover]").each(function(){
957    var cE         = jQuery(this);
958    var hoverTriggerElement = cE;
959    var hoverTriggerPath    = cE.data('hovertrigger');
960    if(hoverTriggerPath){
961      eval('hoverTriggerElement = hoverTriggerElement.' + hoverTriggerPath);
962    }
963    hoverTriggerElement.on('mouseover', function (event){
964      cE.data('srcbeforehover', cE.attr('src'));
965      if(cE.data('ishd') == '1'){
966        cE.attr('src', cE.data('srchover2x'));
967      }
968      else{
969        cE.attr('src', cE.data('srchover'));
970      }
971    });
972    hoverTriggerElement.on('mouseout', function (event){
973      cE.attr('src', cE.data('srcbeforehover'));
974    });
975  });
976
977  window.setTimeout(function(){
978    //var jQueryHashId = location.hash;
979    if(location.hash != '' && location.hash != '#'){
980      wAdaptOnChangeHash({'event' : 'load'});
981    }
982  }, 120);
983
984  if(document.documentElement){
985    window.setTimeout(function(){
986      document.documentElement.className = document.documentElement.className + ' pagestatus-loaded';
987    }, 800);
988  }
989  
990  jQuery('.wglImageMap').wImageMap();   
991  jQuery('.wglMagnifier').wMagnifier();
992  jQuery('.wglImageCompare').wImageCompare(); 
993  jQuery('.wglTicker').wTicker();    
994  
995  jQuery('.wglOverflowXTouch').each(function(index){
996
997    var cE = jQuery(this);
998    var widthOuter = cE.width();
999    var widthInner = cE.children('*').outerWidth();
1000
1001    if(!cE.is(":visible") || widthInner <= widthOuter){
1002      return false;
1003    }
1004    else{
1005      var lastElementInner = cE.children('*').children('*:last');
1006      var offsetRightLastElementInner = lastElementInner.get(0).offsetLeft + lastElementInner.outerWidth() + parseInt(lastElementInner.css('margin-right'));
1007      cE.children('*').children('*').each(function(index){
1008        jQuery(this).css('width', jQuery(this).width());
1009      });
1010      lastElementInner.parent().css({'width' : String(offsetRightLastElementInner) + 'px'});
1011    }
1012
1013    jQuery(this).find('img').attr('unselectable', 'on');
1014
1015    jQuery('body').on('touchstart mousedown', function(event){
1016      if(jQuery(event.target).closest(cE).length != 0){
1017        event.preventDefault();
1018      }
1019    });
1020
1021    jQuery('body').on("touchmove mousemove", function(event){
1022      if(jQuery('body').data('wtouchelement')){
1023
1024        var mouseXDiff   = (event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX) - jQuery('body').data('wtouchmousex');
1025        var mouseYDiff   = (event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY) - jQuery('body').data('wtouchmousey');
1026
1027        jQuery('body').data('wtouchmousex', event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX);
1028        jQuery('body').data('wtouchmousey', event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY);
1029        jQuery('body').data('wtouchlastdiffx', mouseXDiff);
1030        jQuery('body').data('wtouchlastdiffy', mouseYDiff);
1031
1032        var milliseconds = (new Date()).getTime();
1033        var timeDiff     = milliseconds - jQuery('body').data('timestamplast');
1034        jQuery('body').data('timestampbefore', jQuery('body').data('timestamplast'));
1035        jQuery('body').data('timestamplast', milliseconds);
1036
1037        var speedX = Math.round(100 * (mouseXDiff > 0 ? mouseXDiff : -mouseXDiff) / timeDiff) + 1;
1038
1039        jQuery('body').data('wtouchspeedX', speedX);
1040
1041        var touchDiffX = jQuery('body').data('wtouchmousex') - jQuery('body').data('wtouchstartmousex');
1042        jQuery('body').data('wtouchdiffx', touchDiffX);
1043
1044        var widthOuter = parseInt(jQuery('body').data('wtouchelement').width());
1045        var left       = parseInt(jQuery('body').data('wtouchelement').children('*').css('margin-left'));
1046        left           = isNaN(left) ? 0 : left;
1047        var right      = parseInt(jQuery('body').data('wtouchelement').width()) - parseInt(jQuery('body').data('wtouchelement').children('*').css('margin-left')) - jQuery('body').data('wtouchelement').children('*').width();
1048        right = isNaN(right) ? 0 : right;
1049
1050        if(left > 32){
1051          jQuery('body').data('wtouchelement').children('*').animate({'margin-left' : 0});
1052          jQuery('body').removeData('wtouchelement');
1053          return false;
1054        }
1055        else if(right > 32){
1056          jQuery('body').data('wtouchelement').children('*').animate({'margin-left' : String(parseInt(jQuery('body').data('wtouchelement').width()) - parseInt(jQuery('body').data('wtouchelement').children('*').width())) + 'px'});
1057          jQuery('body').removeData('wtouchelement');
1058          return false;
1059        }
1060        if(jQuery('body').data('wtouchelement').data('wtouchstartmarginleft') + touchDiffX < 0){
1061          jQuery('body').data('wtouchelement').children('*').css({'margin-left' : String(jQuery('body').data('wtouchelement').data('wtouchstartmarginleft') + touchDiffX) + 'px'});
1062        }
1063        else{
1064          jQuery('body').data('wtouchelement').children('*').css({'margin-left' : String(jQuery('body').data('wtouchelement').data('wtouchstartmarginleft') + touchDiffX) + 'px'});
1065        }
1066      }
1067    });
1068
1069    jQuery(this).on('touchstart mousedown', function(event){
1070      jQuery(this).children('*').stop();
1071      jQuery('body').data('wtouchelement', jQuery(this));
1072      jQuery(this).data('wtouchstartmarginleft', parseInt(jQuery(this).children('*').css('margin-left')));
1073      jQuery(this).data('wtouchstartmargintop', parseInt(jQuery(this).children('*').css('margin-top')));
1074      jQuery('body').data('wtouchstartmousex', event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX);
1075      jQuery('body').data('wtouchstartmousey', event.originalEvent.touches ? event.originalEvent.touches[0].pageY : event.pageY);
1076    });
1077
1078    jQuery('body').on("touchend mouseup", function(event){
1079      if(jQuery('body').data('wtouchelement')){
1080        var milliseconds = (new Date()).getTime();
1081        var timeDiff     = milliseconds - jQuery('body').data('timestamplast');
1082        var touchDiffX   = jQuery('body').data('wtouchdiffx');
1083        var lastDiffX    = jQuery('body').data('wtouchlastdiffx');
1084        var lastDiffXn   = lastDiffX >= 0 ? lastDiffX : -lastDiffX;
1085
1086        if(lastDiffXn > 1){
1087          var speedX = (Math.round((lastDiffXn > 0 ? lastDiffXn : -lastDiffXn) / timeDiff) + 1) * 5;
1088          if(speedX > 200){
1089            speedX = 200;
1090          }
1091          var movingWidth = Math.round(touchDiffX * 2 * (1 + speedX / 100));
1092          if(jQuery('body').data('wtouchdiffx') < 0){
1093            var right      = parseInt(jQuery('body').data('wtouchelement').width()) - parseInt(jQuery('body').data('wtouchelement').children('*').css('margin-left')) - jQuery('body').data('wtouchelement').children('*').width();
1094            if(movingWidth < right){
1095              movingWidth = right;
1096            }
1097            var duration    = (movingWidth > 0 ? movingWidth : -movingWidth) * 1.5 + Math.round(100 / speedX);
1098            jQuery('body').data('wtouchelement').children('*').animate({'margin-left' : '+=' + String(movingWidth)}, {'duration' : duration, 'easing' : 'wEaseOut'});
1099          }
1100          else{
1101            var left       = parseInt(jQuery('body').data('wtouchelement').children('*').css('margin-left'));
1102            if(-movingWidth < left){
1103              movingWidth = -left;
1104            }
1105            var duration    = (movingWidth > 0 ? movingWidth : -movingWidth) * 1.5 + Math.round(100 / speedX);
1106            jQuery('body').data('wtouchelement').children('*').animate({'margin-left' : '+=' + String(movingWidth)}, {'duration' : duration, 'easing' : 'wEaseOut'});
1107          }
1108        }
1109        jQuery('body').removeData('wtouchelement');
1110      }
1111    });
1112  });  
1113  
1114  jQuery('.wglOverflowXTouchScroll').each(function(index){
1115
1116    if(typeof(wEditor) != 'undefined'){
1117      return false;
1118    }    
1119    
1120    var el = jQuery(this);
1121    
1122    jQuery('body').on('touchstart mousedown', function(event){
1123      if(jQuery(event.target).closest(el).length != 0){
1124        event.preventDefault();
1125      }
1126    });
1127
1128    jQuery('body').on("touchmove mousemove", function(event){
1129      if(jQuery('body').data('wtouchelement')){
1130        var scrollLeftStart = jQuery('body').data('wtouchstartscrollleft');
1131        var mouseXDiff      = (event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX) - jQuery('body').data('wtouchstartmousex');        
1132        jQuery('body').data('wtouchelement').scrollLeft(scrollLeftStart - mouseXDiff);
1133      }
1134    });
1135
1136    jQuery(this).on('touchstart mousedown', function(event){
1137      jQuery('body').data('wtouchelement', jQuery(this));      
1138      jQuery('body').data('wtouchstartmousex', event.originalEvent.touches ? event.originalEvent.touches[0].pageX : event.pageX);      
1139      jQuery('body').data('wtouchstartscrollleft', jQuery(this).scrollLeft());
1140    });
1141
1142    jQuery('body').on("touchend mouseup", function(event){
1143      jQuery('body').removeData('wtouchelement');
1144    });
1145  });      
1146    
1147  if(typeof(wHighlightBlockRoot) == 'undefined'){
1148    wHighlightBlockRoot = 'blockContentInner';
1149  }  
1150
1151  if(wHighlightBlockRoot != 'none' && /highlight=([^&]+)/.test(decodeURIComponent(location.search.replace('+', ' ')))){
1152    
1153    highlightTexts = RegExp.$1;
1154    window.setTimeout(function(){
1155      var highlightTextsArray = highlightTexts.split(/\s+/);
1156      var elementRoot = jQuery('#' + wHighlightBlockRoot);
1157      for(var j = 0; j < highlightTextsArray.length; j++){
1158        var highlightText = highlightTextsArray[j];
1159        var regExpWord  = new RegExp('^(?:[\\w\\W]*\\W+|)(' + highlightText.replace('+', '\\+').replace(/(\w) /, '$1\\w* +') + '\\w*)([\\w\\W]*|)$', 'gim');
1160        elementRoot.find('div, p, h1, h2, h3, h4, h5, h6, li').each(function(){
1161          var nodeCurrent      = jQuery(this).get(0);
1162          if(nodeCurrent.tagName != 'DIV' && !/<\w+/.test(nodeCurrent.innerHTML)){
1163            nodeCurrent.innerHTML = nodeCurrent.innerHTML.replace(/[\n\r\s\t]+/g, ' ');
1164          }
1165          for(var j = 0; j < 6; j++){
1166            var childNodes       = nodeCurrent.childNodes;
1167            var childNodesLength = childNodes.length;
1168            for(var i = childNodesLength - 1; i >= 0; i--){
1169              if(childNodes[i].nodeType == 3 && childNodes[i].nodeValue.trim() != ''){
1170                if(regExpWord.test(childNodes[i].nodeValue)){  
1171                  var splitedNode = childNodes[i].splitText(childNodes[i].nodeValue.length - RegExp.$1.length - RegExp.$2.length);
1172                  splitedNode.nodeValue = splitedNode.nodeValue.substr(RegExp.$1.length);
1173                  var highlightNode = document.createElement('span');
1174                  highlightNode.className = 'wglHighlightWord';
1175                  highlightNode.setAttribute('data-hightlightword', highlightTexts);                  
1176                  highlightNode.appendChild(document.createTextNode(RegExp.$1));
1177                  splitedNode.parentNode.insertBefore(highlightNode, splitedNode);
1178                  var accHeaderE = jQuery(this).closest('.accordionContent').prev('.accordionHeader');
1179                  if(accHeaderE.data('ishighlighted') != true){
1180                    accHeaderE.data({noaccchange: true, noaccactivate: true, ishighlighted : true}).trigger('click');
1181                  }
1182                }
1183              }
1184            }
1185          }    
1186        });
1187        elementRoot.find('span, strong, td, a').each(function(){
1188          var nodeCurrent      = jQuery(this).get(0);
1189          if(nodeCurrent.className != 'wglHighlightWord'){
1190            if(!/<\w+/.test(nodeCurrent.innerHTML)){
1191              nodeCurrent.innerHTML = nodeCurrent.innerHTML.replace(/[\n\r\s\t]+/g, ' ');
1192            }
1193            for(var j = 0; j < 6; j++){
1194              var childNodes       = nodeCurrent.childNodes;
1195              var childNodesLength = childNodes.length;
1196              for(var i = childNodesLength - 1; i >= 0; i--){
1197                if(childNodes[i].nodeType == 3 && childNodes[i].nodeValue.trim() != ''){
1198                  if(regExpWord.test(childNodes[i].nodeValue)){  
1199                    var splitedNode = childNodes[i].splitText(childNodes[i].nodeValue.length - RegExp.$1.length - RegExp.$2.length);
1200                    splitedNode.nodeValue = splitedNode.nodeValue.substr(RegExp.$1.length);
1201                    var highlightNode = document.createElement('span');
1202                    highlightNode.className = 'wglHighlightWord';
1203                    highlightNode.setAttribute('data-hightlightword', highlightTexts);
1204                    highlightNode.appendChild(document.createTextNode(RegExp.$1));
1205                    splitedNode.parentNode.insertBefore(highlightNode, splitedNode);
1206                    var accHeaderE = jQuery(this).closest('.accordionContent').prev('.accordionHeader');
1207                    if(accHeaderE.data('ishighlighted') != true){
1208                      accHeaderE.data({noaccchange: true, noaccactivate: true, ishighlighted : true}).trigger('click');
1209                    }                  
1210                  }
1211                }
1212              }
1213            }  
1214          }    
1215        });        
1216      }
1217    }, 160);   
1218  }
1219
1220  jQuery(window).trigger('resize');  
1221    
1222  window.setTimeout(function(){
1223    if(!observeVisible){
1224      wAnimateIfVisible();    
1225    }
1226    wProcessWglAdjustHeightMax();
1227    wLazyLoading();       
1228  }, 500);
1229  
1230  if(location.hash == '#scrollposleftlist' || location.hash == '#scrollsmoothposleftlist'){
1231    var scrollToY = wGetScrollPosLeftList();
1232    if(scrollToY > 0){
1233      if(location.hash == '#scrollsmoothposleftlist'){
1234        jQuery('body, html').animate({scrollTop: scrollToY});
1235      }
1236      else{
1237        jQuery('html, body').scrollTop(scrollToY);       
1238      }
1239    }
1240  }
1241
1242  if(typeof(wUiTmp['callbackAfterLoad']) != 'undefined' && wUiTmp['callbackAfterLoad'].length && wUiTmp['callbackAfterLoad'].length > 0){
1243    for(var i = 0; i < wUiTmp['callbackAfterLoad'].length; i++){
1244      wUiTmp['callbackAfterLoad'][i]();      
1245    }
1246  }
1247  
1248  if(typeof(wUiTmp['viewContentMax']) === 'undefined' && jQuery('#blockBody').length !== 0 && jQuery('#blockHeader').length !== 0){
1249    let blockBodyBottom = jQuery('#blockHeader').height() + jQuery('#blockBody').height();
1250    wUiTmp['viewContentMax'] = blockBodyBottom > 0 ? (Math.round(100 * (jQuery(window).height()) / (jQuery('#blockHeader').height() + jQuery('#blockBody').height()))/ 100) : 0;
1251  }   
1252};
1253
1254jQuery(window).on('resize', function(){
1255    
1256  wUiTmp['lastWindowHeight']   = jQuery(window).height();
1257  wUiTmp['lastDocumentHeight'] = jQuery(document).height();
1258  wUiTmp['lastWindowWidth']    = jQuery(window).width();
1259  
1260  var hasChangedMediaQuery = false;
1261
1262  jQuery('#wMediaqueriesTmp > div').each(function(index){
1263    if(window.getComputedStyle){
1264      try{
1265        var computedStyle  = window.getComputedStyle(jQuery(this).get(0));
1266        var fontFamily     = computedStyle.fontFamily.replace(/"/g, '');
1267        var lastMediaQuery = jQuery(this).data('lastmediaquery') || '';
1268        if(fontFamily != lastMediaQuery){
1269          if(fontFamily.indexOf('mediaquery_') == 0){
1270            eval('if(typeof(' + fontFamily + '_onactivate) == \'function\'){' + fontFamily + '_onactivate();}');
1271          }
1272          else if(lastMediaQuery.indexOf('mediaquery_') == 0){
1273            eval('if(typeof(' + lastMediaQuery + '_ondeactivate) == \'function\'){' + lastMediaQuery + '_ondeactivate();}');
1274          }
1275          jQuery(this).data('lastmediaquery', fontFamily);
1276          hasChangedMediaQuery = true;
1277        }
1278      }
1279      catch(e){};
1280    }
1281  });
1282
1283  if(hasChangedMediaQuery){
1284    jQuery("img[data-srcmin]").each(function(){
1285      var currentImg    = jQuery(this);
1286      var widthOrig     = parseInt(typeof(currentImg.attr('widthorig')) != 'undefined' ? currentImg.attr('data-widthorig') : currentImg.attr('width'));
1287      var srcMin        = currentImg.data('srcmin') ? currentImg.data('srcmin') : '';
1288      var widthCurrent  = parseInt(currentImg.width());
1289      var attrWidthCur  = parseInt(typeof(currentImg.attr('width')) != 'undefined' ? currentImg.attr('width') : 0);
1290      var widthMin      = parseInt(srcMin.replace(/.*@min/, '').replace(/\..*/, ''));
1291      //var widthOuter    = parseInt(currentImg.closest('.elementStandard').width());
1292      var widthOuter    = parseInt(currentImg.parent().width());
1293
1294      var diffWidthFrame = 0;
1295      if(currentImg.parent().parent().parent().parent().hasClass('picture')){
1296        diffWidthFrame = currentImg.parent().parent().parent().parent().outerWidth() - widthCurrent;
1297      }
1298      else if(currentImg.parent().parent().hasClass('picture')){
1299        diffWidthFrame = currentImg.parent().parent().outerWidth() - widthCurrent;
1300      }
1301
1302      if(widthCurrent > widthOrig && widthOuter > widthOrig + diffWidthFrame + 1 && widthMin > widthOrig){
1303        currentImg.attr('src', srcMin);
1304        if(typeof(currentImg.attr('width')) != 'undefined' && currentImg.attr('width') != ''){
1305          currentImg.attr('data-widthorig', currentImg.attr('width')).removeAttr('width').attr('height', 'auto');
1306        }
1307      }
1308    });
1309  }
1310
1311  jQuery('.wglExpandToHeighestChild').each(function(index){
1312
1313    var cE = jQuery(this);
1314    var maxHeight      = 0;
1315    cE.children('*').each(function(index){
1316      if(jQuery(this).attr('data-adjusttoheighestchild') != 'no' && jQuery(this).outerHeight(true) > maxHeight){
1317        maxHeight = jQuery(this).outerHeight(true);
1318      }
1319    });
1320    if(maxHeight > 0){
1321      cE.css('height', String(maxHeight) + 'px');
1322    }
1323  });
1324
1325  jQuery('.wglCheckWidthParent').each(function(index){
1326
1327    var cE = jQuery(this);
1328 
1329    var widthSelf      = cE.attr('data-width-init') || cE.outerWidth();
1330    var widthParent    = cE.parent().width(); 
1331
1332    if(cE.parent().hasClass('isToSmall') && cE.parent().is(":visible")){
1333      cE.parent().removeClass('isToSmall');
1334      widthParent = cE.parent().width();
1335    }
1336
1337    if(!cE.attr('data-width-init')){
1338      cE.attr('data-width-init', widthSelf);
1339    }
1340
1341    if(widthParent >= widthSelf){
1342      cE.parent().removeClass('isToSmall');
1343    }
1344    else{
1345      cE.parent().addClass('isToSmall');
1346    }
1347  });
1348    
1349  jQuery('.wglCheckOverflow').each(function(index){
1350    
1351    if(typeof(wEditor) != 'undefined'){
1352      return false;
1353    }
1354
1355    var cE     = jQuery(this);      
1356    var scrollMax = cE.get(0).scrollWidth - cE.get(0).clientWidth;
1357        
1358    cE.attr('data-isoverflowx', cE.get(0).clientWidth < cE.get(0).scrollWidth ? '1' : 0);
1359    cE.attr('data-scrollleft', String(cE.get(0).scrollLeft));
1360    if(cE.get(0).scrollLeft == 0){
1361      cE.attr('data-scrollpos', 'left');    
1362    }
1363    else if(cE.get(0).scrollLeft + 0.5 >= scrollMax){
1364      cE.attr('data-scrollpos', 'right');    
1365    }    
1366    else{
1367      cE.attr('data-scrollpos', '');    
1368    }    
1369    
1370    jQuery(this).on('scroll', function(){
1371      
1372      var cE = jQuery(this);            
1373      var scrollMax = cE.get(0).scrollWidth - cE.get(0).clientWidth;
1374      
1375      cE.attr('data-scrollleft', String(cE.get(0).scrollLeft));
1376      if(cE.get(0).scrollLeft == 0){
1377        cE.attr('data-scrollpos', 'left');    
1378      }
1379      else if(cE.get(0).scrollLeft + 0.5 >= scrollMax){
1380        cE.attr('data-scrollpos', 'right');    
1381      }          
1382      else{
1383        cE.attr('data-scrollpos', '');    
1384      }          
1385    });
1386  });
1387
1388  let debouncedResize = wDebounce(function(){
1389
1390    jQuery('.wglCheckBreakChildren').each(function(index){
1391
1392      if(typeof(wEditor) != 'undefined'){
1393        return false;
1394      }
1395
1396      var cE = jQuery(this);
1397
1398      var widthSelf      = cE.attr('data-width-init') || cE.outerWidth();
1399      var widthParent    = cE.parent().width(); 
1400      var offsetTop      = 0;
1401      var offsetTopFirst = 0;
1402      var breakChildren  = false;
1403      var targetBreakChildrenClass    = cE.data('targetbreakchildrenclass');
1404      var targetbreakchildrencallback = cE.data('targetbreakchildrencallback');
1405      
1406      var targetToSetClass = cE.parent();
1407      if(targetBreakChildrenClass && /closest\(([^\)]+)\)/.test(targetBreakChildrenClass)){
1408        targetToSetClass = cE.closest(RegExp.$1);
1409        if(targetToSetClass.length == 0){
1410          targetToSetClass = cE.parent();
1411        }
1412      }
1413
1414      var hasBreakChildrenBefore = targetToSetClass.hasClass('breakChildren');
1415      
1416      targetToSetClass.removeClass('breakChildren');
1417
1418      if(hasBreakChildrenBefore && cE.parent().is(":visible")){
1419        targetToSetClass.removeClass('breakChildren');
1420        cE.children('*').each(function(index){
1421          offsetTop = jQuery(this).offset().top;      
1422          if(index == 0){
1423            offsetTopFirst = offsetTop;
1424          }
1425          else if(offsetTop > offsetTopFirst + 5){
1426            breakChildren = true;
1427            return false;
1428          }
1429        });    
1430      } 
1431      else{
1432        cE.children('*').each(function(index){
1433          offsetTop = jQuery(this).offset().top;
1434          if(index == 0){
1435            offsetTopFirst = offsetTop;
1436          }
1437          else if(offsetTop > offsetTopFirst + 5){
1438            breakChildren = true;
1439            return false;
1440          }
1441        });    
1442      }
1443
1444      if(!cE.attr('data-width-init')){
1445        cE.attr('data-width-init', widthSelf);
1446      }
1447
1448      if(breakChildren){
1449        cE.attr('data-width-break', cE.outerWidth());
1450        targetToSetClass.addClass('breakChildren');
1451      }
1452      //else{
1453        //targetToSetClass.removeClass('breakChildren');
1454      //}
1455      if(hasBreakChildrenBefore != breakChildren && targetbreakchildrencallback && targetbreakchildrencallback != ''){    
1456        var f = window[targetbreakchildrencallback];
1457        if(typeof f === 'function'){
1458          f(cE);   
1459        }
1460      }   
1461    });
1462    
1463    wOptimizePictureSizes();    
1464    wProcessPictureZoomer();    
1465    wLazyLoading();  
1466  }, !wUiTmp['wHasInitResize'] ? 0 : 250);  
1467  
1468  debouncedResize();
1469
1470  wProcessWglExpandToParent();
1471  wProcessWglAdjustHeightMax(); 
1472  
1473  wAdaptHeightBlockHeaderOuter();
1474  
1475  wUiTmp['wHasInitResize'] = true;
1476});
1477
1478jQuery(window).on('resize scroll', function(event){
1479  
1480  var hcw = false;
1481
1482  if(typeof(wUiTmp['lastWindowHeight']) == 'undefined' || event.type == 'resize'){
1483    wUiTmp['lastWindowHeight']   = jQuery(window).height();
1484    wUiTmp['lastDocumentHeight'] = jQuery(document).height();
1485  }
1486  
1487  if(typeof(wUiTmp['lastWindowWidthResized']) == 'undefined' || event.type == 'resize'){
1488    var cw = jQuery(window).width();
1489    if(cw != wUiTmp['lastWindowWidthResized']){
1490      hcw = true;
1491    }
1492    wUiTmp['lastWindowWidthResized'] = cw;
1493  }  
1494
1495  if(hcw){
1496    jQuery('div[data-isdarkbackgroundminwidth]').each(function(index){
1497      var v = parseInt(jQuery(this).attr('data-isdarkbackgroundminwidth').replace('px', ''));
1498      if(cw >= v){
1499        jQuery(this).addClass('isDarkBackground');
1500      }
1501      else{
1502        jQuery(this).removeClass('isDarkBackground');        
1503      }
1504    }); 
1505  }  
1506
1507  wUiTmp['lastScrollTop']  = jQuery(window).scrollTop();
1508  wUiTmp['lastScrollTime'] = new Date().getTime();  
1509  
1510  wSetScrollStatus();
1511  if(wUiTmp['lastScrollStatus'] === 'top'){
1512    wAdaptHeightBlockHeaderOuter();
1513  }
1514
1515  
1516  if(typeof(wEditor) == 'undefined'){
1517    wReader();
1518    wCountUp();    
1519  }  
1520  
1521  wUiTmp['timeoutObserveAlt'] = typeof(wUiTmp['timeoutObserveAlt']) == 'undefined' || wUiTmp['timeoutObserveAlt'] == 0 ? 8 : wUiTmp['timeoutObserveAlt'] - 1;    
1522  if(!observeVisible || wUiTmp['timeoutObserveAlt'] == 0){  
1523    wLazyLoading();
1524    if(!observeVisible){    
1525      wAnimateIfVisible();
1526    }
1527  }
1528  
1529  wKeepInsideTopOnScroll();    
1530  wAdaptNavigationSection();
1531  
1532  wUiTmp['hasToAdaptParallax'] = true;
1533  
1534  if(!wUiTmp['adaptParallax']){
1535    window.requestAnimationFrame(wAdaptParallax);
1536    wUiTmp['adaptParallax'] = true;
1537  }
1538
1539  wUiTmp['lastScrollTopBefore'] = wUiTmp['lastScrollTop'];
1540});
1541
1542wSetScrollStatus = function(){
1543  
1544  var canChange = wUiTmp['lastScrollTop'] >=0 && (wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] - wUiTmp['lastDocumentHeight']) < 0 ? true : false;
1545
1546  if(typeof(wOffsetBottomChangeScrollStatusSet) != 'undefined'){
1547    if((wUiTmp['lastWindowHeight'] + wUiTmp['lastScrollTop']) > (wUiTmp['lastDocumentHeight'] - wOffsetBottomChangeScrollStatusSet)){
1548      canChange = false;
1549    }
1550  } 
1551  
1552  if(typeof(wBlockChangeScrollstatus) != 'undefined' && wBlockChangeScrollstatus){
1553    canChange = false;
1554  }
1555
1556  if(typeof(wUiTmp['lastScrollTop']) == 'undefined'){
1557    wUiTmp['lastScrollTop'] = wOffsetScrolledTopDefault -1;
1558  }
1559  
1560  var changeScrollstatusOnAutoscrolling = false;
1561
1562  if(typeof(wChangeScrollstatusOnAutoscrolling) != 'undefined' && wChangeScrollstatusOnAutoscrolling){
1563    changeScrollstatusOnAutoscrolling = true;
1564  }
1565  
1566  if((!wUiTmp['scrollingAuto'] || changeScrollstatusOnAutoscrolling) && canChange){    
1567    if(wUiTmp['lastScrollTop'] <= wOffsetScrolledTopDefault){
1568      if(wUiTmp['lastScrollStatus'] != 'top'){
1569        document.documentElement.className = document.documentElement.className.replace(' scrolled-top', '').replace(' scrolldirection-down', '').replace(' scrolldirection-up', '') + ' scrolled-top';
1570      }
1571      wUiTmp['lastScrollStatus'] = 'top';
1572    }
1573    else if(wUiTmp['lastScrollTop'] < wUiTmp['lastScrollTopBefore']){
1574      if(wUiTmp['lastScrollStatus'] != 'scrollup'){
1575        document.documentElement.className = document.documentElement.className.replace(' scrolled-top', '').replace(' scrolldirection-down', '') + ' scrolldirection-up';
1576      }
1577      wUiTmp['lastScrollStatus'] = 'scrollup';
1578    }
1579    else if(typeof wUiTmp['lastScrollStatus'] == 'undefined' && wUiTmp['lastScrollTop'] > wOffsetScrolledTopDefault || wUiTmp['lastScrollTop'] > wUiTmp['lastScrollTopBefore']){
1580      if(wUiTmp['lastScrollStatus'] != 'scrolldown'){
1581        document.documentElement.className = document.documentElement.className.replace(' scrolled-top', '').replace(' scrolldirection-up', '') + ' scrolldirection-down';
1582      }
1583      wUiTmp['lastScrollStatus'] = 'scrolldown';
1584    }
1585  }
1586};
1587
1588wSetScrollPosLeftList = function(eventTarget){
1589  sessionStorage.setItem('scrollposleftlist:' + location.pathname, window.scrollY);
1590  sessionStorage.setItem('scrollposleftlist:' + location.pathname + location.search, window.scrollY);
1591};
1592
1593wGetScrollPosLeftList = function(){
1594  scrollToY = 0;
1595  if(sessionStorage.getItem('scrollposleftlist:' + location.pathname) != ''){
1596    scrollToY = sessionStorage.getItem('scrollposleftlist:' + location.pathname); 
1597  }
1598  else if(sessionStorage.getItem('scrollposleftlist:' + location.pathname + location.search) != ''){    
1599    scrollToY = sessionStorage.getItem('scrollposleftlist:' + location.pathname + location.search); 
1600  } 
1601  return scrollToY;
1602};
1603
1604wAdaptHeightBlockHeaderOuter = function(){
1605  try{
1606    if(jQuery(':root').css('--adaptHeightBlockHeaderOuter') !== 'no'){
1607      var blockHeaderHeight = jQuery('#blockHeader').length !== 0 ? jQuery('#blockHeader').height() : 0;
1608
1609      try{
1610        if(typeof jQuery(':root').css('--heightBlockHeader') === 'undefined'){
1611          wUiTmp['heightBlockHeaderUndefinedBeforeSet'] = true;
1612        }
1613      }
1614      catch(e){
1615        wUiTmp['heightBlockHeaderUndefinedBeforeSet'] = true;
1616      }
1617      
1618      jQuery(':root').css('--heightBlockHeader', String(blockHeaderHeight) + 'px');
1619      jQuery(':root').css('--heightApp', String(jQuery(window).height()) + 'px');  
1620
1621      if(wUiTmp['heightBlockHeaderUndefinedBeforeSet']){
1622        wUiTmp['heightBlockHeaderWasSetTo'] = jQuery(':root').css('--heightBlockHeader');
1623      }
1624    }  
1625  }
1626  catch(e){}
1627  
1628};
1629
1630wAdaptNavigationSection = function(){
1631
1632  const $adpatNavigationSectionsObj = jQuery(".elementNavigationSections");
1633  if($adpatNavigationSectionsObj.length == 0) return true;
1634  
1635  var idTopSection = '', titleSection = '', cE, nearestPositionTop = 100000, elementPositionTop = 0;
1636  var offsetTopFixed = jQuery('.wglContainerInsideTopOnScroll').length > 0 ? jQuery('.wglContainerInsideTopOnScroll').outerHeight() : 0;
1637
1638  jQuery('.elementSection').each(function(index){
1639    cE = jQuery(this);
1640    elementPositionTop = parseInt(cE.offset().top) - wUiTmp['lastScrollTop'] - offsetTopFixed;
1641    if(elementPositionTop < wUiTmp['lastWindowHeight'] - 128 && (elementPositionTop >= 0 && elementPositionTop < nearestPositionTop || elementPositionTop < 0 && elementPositionTop * -1 < nearestPositionTop)){
1642      if(cE.height() > 8){
1643        nearestPositionTop = (elementPositionTop >= 0 ? elementPositionTop : - elementPositionTop);
1644        titleSection       = cE.attr('id') ? cE.attr('id') : '';
1645      }
1646    }
1647  });
1648
1649  if(titleSection != '' && titleSection != wUiTmp['lastSectionSelected']){
1650    if(typeof(wKeepNavigationSectionsIfNoTitle) != 'undefined' && wKeepNavigationSectionsIfNoTitle){
1651      if(jQuery(".elementNavigationSections li > a[href='#" + titleSection + "']").length != 0){
1652        jQuery(".elementNavigationSections li").removeClass('selected');
1653        jQuery(".elementNavigationSections li > a[href='#" + titleSection + "']").parent().addClass('selected');
1654        wUiTmp['lastSectionSelected'] = titleSection;
1655      }  
1656    }
1657    else{
1658      jQuery(".elementNavigationSections li").removeClass('selected');
1659      jQuery(".elementNavigationSections li > a[href='#" + titleSection + "']").parent().addClass('selected');
1660      wUiTmp['lastSectionSelected'] = titleSection;
1661    }
1662  }
1663};
1664
1665wPrefetchLink = function(link){
1666  
1667  var l  = document.createElement("link");
1668  l.rel  = "prefetch";
1669  l.href = link;
1670  document.head.appendChild(l);  
1671};
1672
1673wReader = function(){
1674  
1675  jQuery('.wglReader:not([data-init="1"]').each(function(index){
1676
1677    if(window.speechSynthesis){
1678      var cE = jQuery(this);      
1679      var textToRead = cE.get(0).innerText;
1680
1681      if(textToRead != ''){
1682        var rts = 'this.parentNode.nextSibling';
1683        var rta = cE.data('readertarget') ? cE.data('readertarget') : '';
1684        if(rta == 'prepend'){
1685          rts = 'this.parentNode.parentNode';
1686        }
1687        else if(rta.substr(0, 1) == '#'){
1688          rts = 'document.getElementById(\'' + rta.substr(1) + '\')';
1689        }
1690        cE.before('<div class="wReaderPanelEmbed"><div class="wButtonStartReading" onclick="wStartReadingText(' + rts + ', this.parentNode)"></div><div class="wButtonPauseReading" onclick="wPauseReadingText(' + rts + ', this.parentNode)"></div><div class="wButtonStopReading" onclick="wStopReadingText(' + rts + ', this.parentNode)"></div></div>');          
1691      }
1692
1693      cE.attr('data-init', '1');
1694    }  
1695  }); 
1696};
1697
1698wCountUp = function(){
1699
1700  jQuery('.wglCountUp:not([data-init="1"])').each(function(index){
1701
1702    var cE = jQuery(this);
1703    var nodeName = cE.get(0).nodeName;
1704
1705    if(typeof(wEditor) != 'undefined'){
1706      cE.attr('data-init', '1');
1707      return false;
1708    }
1709
1710    var offsetTop = parseInt(cE.offset().top);
1711    if(offsetTop > wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight']){
1712      return false;
1713    }
1714
1715    cE.attr('data-init', '1');
1716    var currentDataOrig = cE.data();
1717    var currentData     = {};
1718
1719    for(key in currentDataOrig){
1720      currentData[key.toLowerCase()] = currentDataOrig[key];
1721    }
1722
1723    currentData['countupFrom']      = currentData['countupfrom'] || 0;
1724    currentData['countupTo']        = currentData['countupto'] || cE.html();
1725    currentData['countupDecimals']  = currentData['countupdecimals'] || 0;  
1726    currentData['countupDuration']  = currentData['countupduration'] || 2;
1727    currentData['countupInitdelay'] = currentData['countupinitdelay'] || 1000;
1728    currentData['countupPrefix']    = currentData['countupprefix'] || '';
1729    currentData['countupSuffix']    = currentData['countupsuffix'] || '';
1730
1731    if(/((\w*)\. )/.test(currentData['countupTo'])) currentData['countupTo'] = currentData['countupTo'].replace(/((\w*)\. )/, RegExp.$2+'~#~ ');
1732    if(/^([^\d\,\.]*)([\d\,\.\']+)([^\d\,\.]*\.?)$/.test(currentData['countupTo'])){
1733      currentData['countupPrefix'] = RegExp.$1.replace('~#~', '.');
1734      currentData['countupTo']     = RegExp.$2;
1735      currentData['countupSuffix'] = RegExp.$3.replace('~#~', '.');
1736    }
1737
1738    currentData['countupSeperator'] = '';
1739
1740    if(/^\d+([\.\'])\\d\d\d/.test(currentData['countupFrom']) || /^\d+([\.\'])\d\d\d/.test(currentData['countupTo'])){
1741      currentData['countupSeperator'] = RegExp.$1;      
1742    }
1743
1744    if(currentData['countupSeperator'] != ''){
1745      currentData['countupFrom'] = String(currentData['countupFrom']).replace(/^(\d+)[\.\'](\d\d\d)/, '$1$2').replace(/^(\d+)[\.\'](\d\d\d)/, '$1$2').replace(/^(\d+)[\.\'](\d\d\d)/, '$1$2');      
1746      currentData['countupTo']   = String(currentData['countupTo']).replace(/^(\d+)[\.\'](\d\d\d)/, '$1$2').replace(/^(\d+)[\.\'](\d\d\d)/, '$1$2').replace(/^(\d+)[\.\'](\d\d\d)/, '$1$2');            
1747    }    
1748
1749    valueToSet = String(currentData['countupFrom']); 
1750
1751    currentData['countupTo'] = currentData['countupTo'].replace(',', '.');
1752    if(currentData['countupTo']){
1753      if(/^\d+\.(\d+)$/.test(currentData['countupTo'])){
1754        currentData['countupDecimals'] = RegExp.$1.length;
1755      }
1756      else if(/^([\d\,\.]+)$/.test(currentData['countupTo'])){
1757      }
1758      else{
1759        return true;
1760      }
1761    }
1762    else{
1763      return true;
1764    }
1765
1766    if(currentData['countupDecimals'] > 0){
1767      valueToSet = parseFloat(valueToSet).toFixed(currentData['countupDecimals']).replace('.', ',');
1768    }
1769    else{ 
1770      valueToSet = String(Math.ceil(valueToSet));      
1771      if(currentData['countupSeperator'] != ''){
1772        valueToSet = valueToSet.replace(/(\d)(\d{3})$/, '$1.$2').replace(/(\d)(\d{3})\./, '$1.$2.').replace(/(\d)(\d{3})\./, '$1.$2.');             
1773      }                 
1774    }    
1775
1776    if(nodeName == 'text'){
1777      cE.get(0).textContent = currentData['countupPrefix'] + valueToSet + currentData['countupSuffix'];
1778    }  
1779    else{
1780      cE.html(currentData['countupPrefix'] + valueToSet + currentData['countupSuffix']);
1781    }  
1782    
1783    var timeoutInit = 25;
1784    var timeout     = timeoutInit;
1785    window.setTimeout(function(){            
1786      var intervalCountup = window.setInterval(function(){
1787        if(timeout < 0.5){
1788          timeout -= 0.02;
1789        }
1790        else if(timeout < 2){
1791          timeout -= 0.05;
1792        }
1793        else if(timeout < 3){
1794          timeout -= 0.14;
1795        }
1796        else if(timeout < 4){
1797          timeout -= 0.4;
1798        }
1799        else{
1800          timeout--;
1801        }
1802
1803        var valueToSet = (currentData['countupTo'] - currentData['countupFrom']) / timeoutInit * (timeoutInit - timeout) + parseFloat(currentData['countupFrom']);      
1804
1805        if(timeout <= 0.1){
1806          window.clearInterval(intervalCountup);
1807          valueToSet = currentData['countupTo'];
1808        }
1809
1810        if(currentData['countupDecimals'] > 0){
1811          valueToSet = String(parseFloat(valueToSet).toFixed(currentData['countupDecimals']).replace('.', ','));
1812          if(currentData['countupSeperator'] != ''){
1813            if(/(\d+)\,(\d+)/.test(valueToSet)){
1814              var valueToSetBefore = RegExp.$1;
1815              var valueToSetAfter  = RegExp.$2;   
1816              if(currentData['countupSeperator'] == '\''){
1817                valueToSetBefore = valueToSetBefore.replace(/(\d)(\d{3})$/, '$1\'$2').replace(/(\d)(\d{3})\'/, '$1\'$2.').replace(/(\d)(\d{3})\'/, '$1\'$2.');  
1818              }
1819              else{
1820                valueToSetBefore = valueToSetBefore.replace(/(\d)(\d{3})$/, '$1.$2').replace(/(\d)(\d{3})\./, '$1.$2.').replace(/(\d)(\d{3})\./, '$1.$2.');  
1821              }
1822              valueToSet = valueToSetBefore + ',' + valueToSetAfter;
1823            }                        
1824          }                  
1825        }
1826        else{
1827          valueToSet = String(Math.ceil(valueToSet));
1828
1829          if(currentData['countupSeperator'] != ''){
1830            if(currentData['countupSeperator'] == '\''){            
1831              valueToSet = valueToSet.replace(/(\d)(\d{3})$/, '$1\'$2').replace(/(\d)(\d{3})\'/, '$1\'$2\'').replace(/(\d)(\d{3})\./, '$1\'$2.');             
1832            }
1833            else{
1834              valueToSet = valueToSet.replace(/(\d)(\d{3})$/, '$1.$2').replace(/(\d)(\d{3})\./, '$1.$2.').replace(/(\d)(\d{3})\./, '$1.$2.');             
1835            }
1836          }            
1837        }
1838
1839        if(nodeName == 'text'){        
1840          cE.get(0).textContent = currentData['countupPrefix'] + valueToSet + currentData['countupSuffix'];
1841        }
1842        else{
1843          cE.html(currentData['countupPrefix'] + valueToSet + currentData['countupSuffix']);          
1844        }
1845        //console.log(valueToSet);
1846      }, parseInt(currentData['countupDuration'] * 500 / timeoutInit));
1847    }, currentData['countupInitdelay']);
1848  });
1849};
1850
1851wAnimateIfVisible = function(){
1852  
1853  jQuery("[data-doifbecomevisible]").each(function(index){
1854    var cE             = jQuery(this);
1855    var isVisibleState = cE.data('isvisible');
1856    var offsetTop      = parseInt(cE.offset().top);
1857    if(offsetTop < wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] || location.href.indexOf('viewmode=print') != -1){
1858      if(!isVisibleState){
1859        cE.data('isvisible', true);
1860        eval(cE.data('doifbecomevisible'));
1861        
1862        var functionDoifbecomevisible = function(){
1863          eval(cE.data('doifbecomevisible'));
1864        };
1865        functionDoifbecomevisible.call(cE.get(0));        
1866      }
1867    }
1868    else if(isVisibleState){
1869      cE.data('isvisible', false);
1870    }
1871  });
1872  
1873  jQuery("[data-doifbecomevisibleonce]").each(function(index){
1874    var cE             = jQuery(this);
1875    var isVisibleState = cE.data('isvisible');
1876    var offsetTop      = parseInt(cE.offset().top);
1877    if(offsetTop < wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] || location.href.indexOf('viewmode=print') != -1){
1878      if(!isVisibleState){
1879        cE.data('isvisible', true);
1880        //eval(cE.data('doifbecomevisibleonce'));
1881        
1882        var functionDoifbecomevisible = function(){
1883          eval(cE.data('doifbecomevisibleonce'));
1884        };
1885        functionDoifbecomevisible.call(cE.get(0));     
1886        cE.removeAttr('data-doifbecomevisibleonce');
1887      }
1888    }
1889    else if(isVisibleState){
1890      cE.data('isvisible', false);
1891    }
1892  });   
1893
1894  jQuery('.wglAnimateIfVisibleOnce').each(function(index){
1895    var cE = jQuery(this);
1896    if(parseInt(cE.offset().top) < wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] || location.href.indexOf('viewmode=print') != -1){
1897      cE.addClass('wglAnimateIfVisibleOnceVisible').removeClass('wglAnimateIfVisibleOnce');
1898      if(typeof(wOnAfterAnimateIfVisible) === 'function'){
1899        wOnAfterAnimateIfVisible(cE);
1900      }       
1901    }
1902  });
1903
1904  jQuery('.wglAnimateIfVisible').each(function(index){
1905    var cE = jQuery(this);
1906    var offsetTop      = parseInt(cE.offset().top);
1907    var offsetHeight   = parseInt(cE.outerHeight());
1908    if((offsetTop < wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] && offsetTop + offsetHeight > wUiTmp['lastScrollTop']) || location.href.indexOf('viewmode=print') != -1){
1909      if(!cE.hasClass('isVisible')){
1910        cE.addClass('isVisibleOnce isVisible').removeClass('isInvisible');
1911        if(typeof(wOnAfterAnimateIfVisible) === 'function'){
1912          wOnAfterAnimateIfVisible(cE);
1913        }
1914      }
1915    }
1916    else{
1917      if(cE.hasClass('isVisible')){      
1918        cE.addClass('isInvisible').removeClass('isVisible');
1919        if(typeof(wOnAfterAnimateIfInvisible) === 'function'){
1920          wOnAfterAnimateIfInvisible(cE);
1921        }  
1922      }      
1923    }
1924  });
1925};
1926
1927wShowContentOfElementInLightbox = function(elCurrent, el){
1928  
1929  var options = {};
1930  options['type'] = 'inline';
1931  options['content'] = jQuery(el).html();
1932  
1933  wLightbox(jQuery(elCurrent), options);
1934};
1935
1936jQuery('body').on("touchmove", function(event){
1937  wAdaptParallax(event);
1938});
1939
1940jQuery(window).on("touchend", function(event){
1941  wAdaptParallax(event);
1942});
1943
1944jQuery(window).on('mousewheel DOMMouseScroll', function (event){
1945  jQuery('body, html').stop(true, true);
1946});
1947
1948wLazyLoading = function(){
1949
1950  var winWidth     = jQuery(window).width();
1951  
1952  wUiTmp['widthOfRwids'] = {};
1953
1954  jQuery('img.wglLazyLoadInit').each(function(index){
1955
1956    if(jQuery(this).data('solvesources') == '1'){
1957      return true;
1958    }
1959    
1960    var currentImg   = jQuery(this);
1961    var offsetTop    = parseInt(currentImg.offset().top);
1962    var srcMin       = currentImg.data('srcmin') ? currentImg.data('srcmin') : '';
1963    var widthCurrent = parseInt(currentImg.width());
1964    var attrWidthCur = parseInt(typeof(currentImg.attr('width')) != 'undefined' ? currentImg.attr('width') : 0);
1965    var widthMin     = parseInt(srcMin.replace(/.*@min/, '').replace(/\..*/, ''));
1966
1967    var isVisibleComponent = true;
1968    var isVisiblePicture   = false; 
1969    
1970    if(currentImg.attr('data-maxwidthifinvisible') && currentImg.attr('data-maxwidthifinvisible') > widthCurrent){
1971      widthCurrent = currentImg.attr('data-maxwidthifinvisible');
1972    }
1973
1974    if(!currentImg.is(':visible')){
1975      isVisibleComponent = false;
1976      closestElement = currentImg.closest('.elementList');
1977      if(closestElement.length > 0 && closestElement.is(':visible')){
1978        if(closestElement.find("div[data-lazyloadifvisibleentry='1']").length > 0){
1979        }
1980        else if(closestElement.offset().top < wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight']){
1981          isVisibleComponent = true;
1982        }  
1983      }
1984    }
1985    
1986    if(currentImg.attr('data-lazyloadwidthmaxactive')){
1987      if(winWidth >= currentImg.attr('data-lazyloadwidthmaxactive')){
1988        isVisibleComponent = true;
1989        isVisiblePicture   = true;
1990      }
1991    }
1992    
1993    if(isVisibleComponent){
1994      if(currentImg.parent().prop('tagName') == 'PICTURE'){
1995        if(widthCurrent > 0){
1996          wUiTmp['widthOfRwids'][currentImg.parent().attr('data-rwid')] = widthCurrent;
1997        }  
1998        else if(wUiTmp['widthOfRwids'][currentImg.parent().attr('data-rwid')]){
1999          widthCurrent = wUiTmp['widthOfRwids'][currentImg.parent().attr('data-rwid')];
2000        }        
2001      }  
2002    }
2003
2004    if(isVisibleComponent || wUiTmp['isMediaPrint'] || wUiTmp['isViewmodePrint']){
2005      if(isVisiblePicture || (offsetTop < wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight']) || wUiTmp['isMediaPrint'] || wUiTmp['isViewmodePrint']){
2006        wShowLazyLoadImage(currentImg);
2007      }
2008    }
2009  });
2010};
2011
2012wShowLazyLoadImage = function(currentImg){
2013  
2014  var widthCurrent = parseInt(currentImg.width());  
2015  var srcMin       = currentImg.data('srcmin') ? currentImg.data('srcmin') : '';
2016  var widthCurrent = parseInt(currentImg.width());
2017  var attrWidthCur = parseInt(typeof(currentImg.attr('width')) != 'undefined' ? currentImg.attr('width') : 0);
2018  var widthMin     = parseInt(srcMin.replace(/.*@min/, '').replace(/\..*/, ''));
2019  var widthMax     = 0;
2020    
2021  if(currentImg.parent().prop('tagName') == 'PICTURE'){
2022    currentImg.data('solvesources', '1');
2023
2024    if(currentImg.parent().children('source').length > 0){
2025      currentImg.parent().children('source').each(function(){
2026        //notwendig wegen IE11
2027        if(/(\d+)/.test(jQuery(this).attr('sizes'))){
2028          if(parseInt(RegExp.$1) > widthMax){
2029            widthMax = parseInt(RegExp.$1);
2030          }
2031        }        
2032        if(jQuery(this).attr('data-src')){
2033          var currentImgElement = jQuery(this).parent().find('img').get(0);              
2034          currentImgElement.setAttribute('data-widthbefore', currentImgElement.style.width);
2035          //ggf. notwendig wegen IE11
2036          if(currentImgElement.offsetWidth > 0){
2037            currentImgElement.style.width = String(currentImgElement.offsetWidth) + 'px';  
2038          }  
2039          else{
2040            currentImgElement.style.width = '100%';                  
2041          }              
2042          //console.log('setSrcset1:');              
2043          jQuery(this).attr('srcset', jQuery(this).data('src')).removeData('src');
2044          var xi = 0;
2045          if(jQuery(this).parent().attr('data-lazywaitcompleted') != '1'){
2046            jQuery(this).parent().attr('data-lazywaitcompleted', 1);
2047            var intervalLazyWaitCompleted = window.setInterval(function(){
2048              if(currentImgElement.complete || xi > 200){
2049                currentImgElement.style.width = currentImgElement.getAttribute('data-widthbefore');
2050                currentImgElement.removeAttribute('data-widthbefore');
2051                jQuery(this).parent().removeAttr('data-lazywaitcompleted');
2052                currentImg.removeClass('wglLazyLoadInit');
2053                if(typeof(wDoNotAdjustHeightMaxAfterLazyLoad) == 'undefined' || !wDoNotAdjustHeightMaxAfterLazyLoad){
2054                  wProcessWglAdjustHeightMax();
2055                }
2056                if(typeof(wOnAfterLazyLoading) === 'function'){
2057                  wOnAfterLazyLoading(currentImg);
2058                }
2059                window.clearInterval(intervalLazyWaitCompleted);
2060              }
2061              xi++;
2062            }, 100);
2063          }
2064          else{
2065            currentImgElement.style.width = currentImgElement.getAttribute('data-widthbefore');
2066            currentImgElement.removeAttribute('data-widthbefore');
2067          }
2068        }
2069        if(jQuery(this).attr('media')){
2070          jQuery(this).attr('media', jQuery(this).attr('media').replace(/(\:\s*)999?9?\./, '$1'));
2071        }
2072      });
2073    }
2074  }
2075  
2076  var ie11 = navigator.appVersion.match(/MSIE (\d+\..)/) || navigator.userAgent.match(/Trident\/7/);
2077  
2078  if(devicePixelRatio >= hdLimitDpr && typeof(currentImg.attr('data-src2x')) != 'undefined' && currentImg.attr('data-src2x') != '' && attrWidthCur < widthCurrent * 2 && currentImg.attr('data-ishd') != '1'){
2079    currentImg.attr('src', currentImg.data('src2x')).attr('data-ishd', '1');
2080  }
2081  else if(typeof(currentImg.attr('data-srcmin')) != 'undefined' && currentImg.attr('data-srcmin') != '' && widthCurrent < widthMin && widthMin < attrWidthCur && currentImg.attr('data-ismin') != '1' && currentImg.attr('data-ishd') != '1' && currentImg.attr('data-isld') != '1'){
2082    currentImg.attr('src', currentImg.data('srcmin')).attr('data-ismin', '1');
2083  }
2084  else if(typeof(currentImg.attr('data-src')) != 'undefined' && currentImg.attr('data-src') != '' && currentImg.attr('data-ishd') != '1' && currentImg.attr('data-isld') != '1'){
2085    if(currentImg.data('src').indexOf('@px') != -1){
2086      try{
2087        if(currentImg.get(0).getBoundingClientRect()['width'] - widthCurrent == -0.5){
2088          currentImg.get(0).style.width    = 'calc(100% + 0.5px)';
2089          currentImg.get(0).style.maxWidth = 'calc(100% + 0.5px)';
2090        }
2091      }
2092      catch(e){console.log(e)}
2093      currentImg.attr('src', currentImg.data('src').replace('@px', '@' + (devicePixelRatio >= hdLimitDpr ? widthCurrent * 2 : widthCurrent) + 'px'));
2094    }
2095    else if(currentImg.data('src').indexOf('@ll') != -1){
2096      try{
2097        if(currentImg.get(0).getBoundingClientRect()['width'] - widthCurrent == -0.5){
2098          currentImg.get(0).style.width    = 'calc(100% + 0.5px)';
2099          currentImg.get(0).style.maxWidth = 'calc(100% + 0.5px)';
2100        }
2101      }
2102      catch(e){console.log(e)}
2103      if(ie11){          
2104        widthMax = widthMax > 0 ? widthMax : (widthCurrent > 1 ? widthCurrent : 1024);
2105        currentImg.attr('src', currentImg.data('src').replace('@ll', '@' + (devicePixelRatio >= hdLimitDpr ? widthMax * 2 : widthMax) + 'll'));
2106      }
2107      else{
2108        currentImg.attr('src', currentImg.data('src').replace('@ll', '@' + (devicePixelRatio >= hdLimitDpr ? widthCurrent * 2 : widthCurrent) + 'll'));
2109      }
2110    }
2111    else{
2112      currentImg.attr('src', currentImg.data('src'));            
2113    }
2114    currentImg.attr('data-isld', '1');
2115  }
2116
2117  if(jQuery(this).parent().attr('data-lazywaitcompleted') != '1'){
2118    currentImg.removeClass('wglLazyLoadInit');
2119    if(typeof(wDoNotAdjustHeightMaxAfterLazyLoad) == 'undefined' || !wDoNotAdjustHeightMaxAfterLazyLoad){    
2120      wProcessWglAdjustHeightMax();    
2121    }  
2122    if(typeof(wOnAfterLazyLoading) === 'function'){
2123      wOnAfterLazyLoading(currentImg);
2124    }
2125  }  
2126};
2127
2128wShowLazyLoadIframe = function(el){
2129  el.get(0).contentWindow.location.href = el.attr('data-src');    
2130};
2131
2132wKeepInsideTopOnScroll = function(){
2133  
2134  jQuery('.wglKeepInsideTopOnScroll').each(function(index){
2135    var cE                   = jQuery(this);
2136    var elementMovedNodeName = cE.attr('data-nodename') ? cE.attr('data-nodename') : cE.prop('nodeName');
2137    var elementMoved         = null;
2138    var offsetTop            = parseInt(cE.offset().top);
2139    var scrollTopDiff        = wGetScrollTopDiff({'considerWglContainerInsideTopOnScroll' : false});
2140    var diffTop              = offsetTop - wUiTmp['lastScrollTop'] - scrollTopDiff;
2141    var moveID               = '';
2142    var container            = cE.data('container');
2143    
2144    window.clearInterval(wUiTmp['scrollStack']);
2145    if(container == 'parent'){
2146      if(diffTop < 0){         
2147        var hasInit = false;
2148        if(cE.attr('data-hasmoved') != '1'){
2149          cE.css({'transition' : 'none'});          
2150          cE.css({'transform' : 'translateY(0)'});          
2151          cE.attr('data-offsettopinit', offsetTop);
2152          cE.attr('data-scrolltopinit', wUiTmp['lastScrollTop']);          
2153          cE.attr('data-movemax', cE.parent().height() - cE.outerHeight());              
2154          cE.attr('data-hasmoved', '1');
2155          hasInit = true;
2156        }
2157        offsetTop = cE.attr('data-offsettopinit');
2158        diffTop = offsetTop - wUiTmp['lastScrollTop'] - scrollTopDiff;
2159        diffTop = -diffTop > cE.attr('data-movemax') ? -cE.attr('data-movemax') : diffTop;
2160        if(hasInit){
2161          cE.attr('data-movetopinit', -diffTop);  
2162        }
2163        cE.css({'transform' : 'translateY(' + String(- diffTop) + 'px)'});
2164        if(hasInit){
2165          cE.css({'transition' : ''});      
2166        }        
2167      }
2168      else if(cE.attr('data-hasmoved') == '1'){
2169        if(wUiTmp['lastScrollTop'] < cE.attr('data-scrolltopinit') - cE.attr('data-movetopinit')){
2170          cE.attr('data-offsettopinit', '');
2171          cE.attr('data-hasmoved', '');
2172          //cE.css({'transition' : ''});          
2173          cE.css({'transform' : 'translateY(0)'}); 
2174        }
2175        else {
2176          offsetTop = cE.data('offsettopinit');
2177          diffTop = offsetTop - wUiTmp['lastScrollTop'] - scrollTopDiff;
2178          diffTop = -diffTop > cE.attr('data-movemax') ? -cE.attr('data-movemax') : diffTop;       
2179          //cE.css({'transition' : ''});                   
2180          cE.css({'transform' : 'translateY(' + String(- diffTop) + 'px)'});      
2181        }  
2182      }
2183    }
2184    else{
2185      if(diffTop < 0 && (elementMovedNodeName != 'THEAD' || diffTop > (-cE.parent().outerHeight()))){ 
2186        if(cE.attr('data-hasmoved') != '1'){
2187          
2188          var thStyles = {};
2189          var widthTable = 0;
2190          var widthElementTable = 0;
2191          
2192          if(cE.prop("nodeName") == 'THEAD'){
2193            var elementSource = cE.parent();
2194            if(elementSource){
2195              var firstTh = elementSource.find('thead th').get(0);
2196              if(firstTh){
2197                var computedStysle = window.getComputedStyle(firstTh);
2198                thStyles['color']            = computedStysle['color'];
2199                thStyles['background-color'] = computedStysle['background-color'];
2200                thStyles['padding-top']      = computedStysle['padding-top'];
2201                thStyles['padding-right']    = computedStysle['padding-right'];
2202                thStyles['padding-bottom']   = computedStysle['padding-bottom'];
2203                thStyles['padding-left']     = computedStysle['padding-left'];
2204                thStyles['font-weight']      = computedStysle['font-weight'];
2205                thStyles['text-align']       = computedStysle['text-align'];
2206              }
2207              elementSource.parent().scroll(function(){
2208                cE.parent().scrollLeft(jQuery(this).scrollLeft());
2209              });              
2210              widthTable = elementSource.outerWidth();
2211              widthElementTable = elementSource.parent().width();
2212              elementSource.css({'width' : String(widthTable) + 'px'});              
2213              elementSource.find('tbody > tr:first-child > td').each(function(index){
2214                jQuery(this).css({'width' : String(jQuery(this).outerWidth()) + 'px'});
2215              });
2216            }
2217          }    
2218          
2219          if(!jQuery('.wglContainerInsideTopOnScroll').length){
2220            jQuery('body').prepend('<div class="wglContainerInsideTopOnScroll"></div>');
2221          }
2222          
2223          cE.attr('data-hasmoved', '1');
2224          moveID = String(parseInt(Math.random() * 1000000));
2225
2226          if(typeof(cE.attr('data-moveidsource')) == 'undefined'){
2227            cE.attr('data-moveidsource', moveID);
2228          }
2229          else{
2230            moveID = cE.attr('data-moveidsource');
2231          }
2232          
2233          cE.before('<div id="moveidsource-' + moveID + '" class="wglKeepInsideTopOnScroll" data-noden
2233ame="' + cE.prop("nodeName") + '" data-hasmoved="1" data-moveidsource="' + moveID + '"></div>');
2234          cE.removeAttr('data-moveidsource').attr('data-moveidtarget', moveID).attr('data-moveidtarget', moveID).appendTo('.wglContainerInsideTopOnScroll').addClass('moved-init').removeClass('wglKeepInsideTopOnScroll').removeClass('restored-init').removeClass('restored-ready');
2235          window.setTimeout(function(){
2236            cE.removeClass('moved-init').addClass('moved-ready');
2237          }, 10);
2238          height = cE.height();
2239          jQuery('#' + 'moveidsource-' + moveID).css('height', String(height) + 'px');
2240
2241          if(cE.prop("nodeName") == 'THEAD'){            
2242            var elementSource    = jQuery('#' + 'moveidsource-' + moveID).parent();
2243            var offsetSource     = elementSource.parent().offset();
2244            if(offsetSource){
2245              cE.css({'display' : 'block', 'width' : String(widthTable) + 'px'});    
2246              cE.parent().css({'overflow-x' : 'auto', 'left' : String(offsetSource.left) + 'px', 'width' : String(widthElementTable) + 'px'});          
2247              elementSource.find('tbody > tr:first-child > td').each(function(index){
2248                cE.find('th:nth-child(' + (index + 1) + ')').css(thStyles);
2249                cE.find('th:nth-child(' + (index + 1) + ')').css({'width' : String(jQuery(this).outerWidth()) + 'px'});
2250              });
2251              elementSource.parent().trigger('scroll');
2252            }
2253          }
2254        }
2255        else{
2256          height = jQuery(".wglContainerInsideTopOnScroll *[data-moveidtarget='" + cE.attr('data-moveidsource') + "']").height();
2257          cE.css('height', String(height) + 'px');
2258        }
2259        jQuery('.wglContainerInsideTopOnScroll').css({'top': String(scrollTopDiff) + 'px'});
2260      }
2261      else if(jQuery('html').hasClass('object-fullpage') && cE.attr('data-hasmoved') == '1'){}
2262      else if(cE.attr('data-hasmoved') == '1'){
2263        moveID = cE.attr('data-moveidsource');
2264        elementMoved = jQuery(".wglContainerInsideTopOnScroll *[data-moveidtarget='" + moveID + "']");
2265        if(elementMoved.prop("nodeName") == 'THEAD'){
2266          elementMoved.css({'display' : '', 'width' : ''});
2267        }
2268        cE.before(elementMoved.addClass('wglKeepInsideTopOnScroll').removeClass('moved-init').removeClass('moved-ready').addClass('restored-init').removeAttr('data-hasmoved'));
2269        window.setTimeout(function(){
2270          if(cE.html() == ''){
2271            cE.remove();
2272          }
2273          elementMoved.removeClass('restored-init').addClass('restored-ready');
2274        }, 10);
2275      }
2276    }  
2277
2278    var currentTime = new Date().getTime();
2279
2280    if(currentTime - (wUiTmp['lastScrollTime']) > 1000){    
2281      window.clearInterval(wUiTmp['scrollStack']);
2282    }
2283    else{    
2284      wUiTmp['scrollStack'] = window.setTimeout(function(){
2285        wKeepInsideTopOnScroll();
2286      }, 10);    
2287    }  
2288  });
2289  if(typeof(wOnAfterKeepInsideTopOnScroll) == 'function'){
2290     wOnAfterKeepInsideTopOnScroll();
2291  }
2292};
2293
2294wSortTableRows = function(table, col, direction){
2295  
2296  var tb = table.find('tbody'), c = col - 1 || 0, d = direction || '', rs = tb.children(), rl = rs.length;
2297  
2298  if(d == '' && event && event.target){
2299    var th = event.target.nodeName == 'SPAN' ? event.target.parentNode.parentNode : (event.target.nodeName == 'DIV' ? event.target.parentNode : event.target);
2300    d = jQuery(th).attr('data-sort-status') == 'asc' ? 'desc' : 'asc';
2301    jQuery(th).parent().find('th').attr('data-sort-status', 'init');
2302    jQuery(th).attr('data-sort-status', d);    
2303  }  
2304  
2305  var factors = {'KB': 1024, 'MB': 1024 * 1024, 'GB': 1024 * 1024 * 1024, 'TB': 1024 * 1024 * 1024 * 1024};
2306  
2307  if(!table.attr('data-rowspreparedforsort') || table.attr('data-rowspreparedforsort').indexOf('|' + col + '|') == -1){
2308    for(var i = 0; i < rl; i++){
2309      var cell = jQuery(rs[i]).children('td').get(c);
2310      var vn   = cell.innerText
2311      if(/^\s*(\d+(?:[\.,\d]*))\s*(KB|MB|GB|TB)\s*$/i.test(vn)){
2312        vn = String(factors[RegExp.$2.toUpperCase()] * RegExp.$1.replace(',','.')); 
2313      }
2314      vn = vn.replace('m²', ''); 
2315      vn = vn.replace(/^[^\d]+\s+(\d+)/, '$1');
2316      vn = vn.replace(/(\d+)\,(\d+)/, '$1.$2');
2317      jQuery(rs[i]).children('td').get(c).setAttribute('data-sv', String(vn).trim());
2318    }  
2319    table.attr('data-rowspreparedforsort', (table.attr('data-rowspreparedforsort') ? table.attr('data-rowspreparedforsort') : '|') + col + '|');
2320  }
2321
2322  while(rl > 1){
2323    for(var i = 0; i < rl - 1; i++){
2324      var vc  = jQuery(rs[i]).children('td').get(c).getAttribute('data-sv');
2325      var vn  = jQuery(rs[i+1]).children('td').get(c).getAttribute('data-sv');
2326
2327      vc = /^\d+([\,\.]*\d+)?$/.test(vc) ? parseFloat(vc) : vc;
2328      vn = /^\d+([\,\.]*\d+)?$/.test(vn) ? parseFloat(vn) : vn;
2329
2330      if(d == 'asc' && vc > vn || d == 'desc' && vc < vn){
2331        jQuery(rs[i]).before(jQuery(rs[i+1]));
2332        rs = tb.children();
2333      }
2334    }
2335    rl -= 1;
2336  }
2337};
2338
2339wglValidateFormInline = function(form){
2340  jQuery(form).find('input, textarea, select').each(function(){   
2341    if(jQuery(this).attr('data-validators') && jQuery(this).attr('data-validators') != ''){          
2342      wglValidateElementInline(jQuery(this), {});
2343    }
2344  });
2345};
2346
2347wglValidateElementInline = function(currentInputElement, options){
2348
2349  var currentInput = jQuery(currentInputElement);
2350  var currentForm  = currentInput.closest('form');
2351  var async        = typeof options['async'] != 'undefined' ? options['async'] : true;
2352
2353  var formPos      = currentForm.attr('data-formpos');
2354  var formAction   = currentForm.attr('action');
2355
2356  var elementName = currentInput.attr('name');
2357  elementName = elementName.replace('[]', '');
2358
2359  var elementValue = currentInput.val();
2360  
2361  if(currentInput.attr('type') == 'checkbox'){
2362    elementValue = '';
2363    currentInput.parent().parent().find('input').each(function(){
2364      elementValue += (jQuery(this).get(0).checked ? jQuery(this).val() : '');
2365    });
2366  }
2367  else if(currentInput.attr('type') == 'radio'){
2368    elementValue = '';
2369    currentInput.parent().parent().find('input').each(function(){
2370      elementValue += (jQuery(this).get(0).checked ? jQuery(this).val() : '');
2371    });
2372  }
2373  else if(currentInput.prop("tagName") == 'SELECT' && currentInput.attr('multiple') == 'multiple'){
2374    elementValue = '';
2375    currentInput.children().each(function(){
2376      elementValue += (jQuery(this).get(0).selected ? jQuery(this).val() : '');
2377    });
2378  }
2379
2380  if(elementValue == null){
2381    elementValue = '';
2382  }
2383  
2384  if(typeof(wTrimInputsBeforeValidateOnBlur) != 'undefined' && wTrimInputsBeforeValidateOnBlur && event && event.type == 'blur'){
2385    if(currentInput.prop("nodeName") == 'TEXTAREA' || currentInput.attr("type") == 'text'){
2386      currentInput.val(currentInput.val().trim());
2387      elementValue = currentInput.val();
2388    }
2389  }
2390  
2391  wFnValidationResultSilent = function(result){
2392    return wFnValidationResult(result, true)
2393  };  
2394
2395  wFnValidationResult = function(result, silent){
2396    //console.log(result);
2397
2398    silent = silent === true;
2399
2400    elementsWithValidationClass = currentInput;
2401    elementsWithValidationAttr  = currentInput;    
2402
2403    var validationID = formPos + (elementsWithValidationClass.attr('id') ? elementsWithValidationClass.attr('id') : '');
2404
2405    if(currentInput.attr('type') == 'checkbox' || currentInput.attr('type') == 'radio'){
2406      validationID                = formPos + (elementsWithValidationClass.attr('name').replace('[]', '') ? elementsWithValidationClass.attr('name').replace('[]', '') : '');
2407      elementsWithValidationClass = elementsWithValidationClass.parent().parent().children();
2408      elementsWithValidationAttr  = elementsWithValidationClass.parent().parent().find('input[type="' + currentInput.attr('type') + '"]');
2409    }
2410        
2411    if(currentInput.attr('type') == 'hidden' && currentInput.attr('class') != null && currentInput.attr('class').indexOf('elementInputUpload') === -1){
2412      validationID                = formPos + (elementsWithValidationClass.attr('name').replace('[]', '') ? elementsWithValidationClass.attr('name').replace('[]', '') : '');
2413      elementsWithValidationClass = elementsWithValidationClass.parent().parent()
2414      elementsWithValidationAttr  = elementsWithValidationClass.parent().parent();
2415    }    
2416
2417    var elementToAddError = elementsWithValidationClass.parent();
2418
2419    if(elementToAddError.get(0).nodeName === 'FIELDSET'){
2420      elementToAddError = elementToAddError.find('legend');
2421    }    
2422    else if(elementsWithValidationClass.parent().prev('dt').length != 0){
2423      elementToAddError = elementsWithValidationClass.parent().prev('dt');
2424    }
2425    else if(elementsWithValidationClass.parent().prev('div').length != 0){
2426      elementToAddError = elementsWithValidationClass.parent().prev('div');
2427    }
2428    
2429    var elementToAddOK = elementsWithValidationClass.parent();
2430
2431    if(elementsWithValidationClass.closest('*[data-addvalidationstatusok="1"]', elementsWithValidationClass.closest('.formElement')).length != 0){
2432      elementToAddOK = elementsWithValidationClass.closest('*[data-addvalidationstatusok="1"]', elementsWithValidationClass.closest('.formElement'));
2433    }
2434    else if(elementsWithValidationClass.attr('name') && elementsWithValidationClass.closest('form').find('label[for="' + elementsWithValidationClass.attr('name').replace('[]', '') + '"]').length != 0){
2435      elementToAddOK = elementsWithValidationClass.closest('form').find('label[for="' + elementsWithValidationClass.attr('name').replace('[]', '') + '"]');
2436    }
2437    else if(elementToAddOK.get(0).nodeName === 'FIELDSET'){
2438      elementToAddOK = elementToAddOK.find('legend');
2439    }
2440    else if(elementsWithValidationClass.parent().prev('dt').length != 0 && elementsWithValidationClass.parent().prev('dt').find('label')){
2441      elementToAddOK = elementsWithValidationClass.parent().prev('dt').find('label');
2442    }
2443    else if(elementsWithValidationClass.parent().prev('div').length != 0 && elementsWithValidationClass.parent().prev('div').find('label')){
2444      elementToAddOK = elementsWithValidationClass.parent().prev('div').find('label');
2445    }
2446    
2447    if(!currentInput.attr('data-validators') && currentInput.attr('data-force-validation') != '1'){
2448      //console.log(currentInput);
2449    }
2450    else 
2451      if(result['isValid'] == false){
2452        elementsWithValidationAttr.attr('data-isinvalid', '1');       
2453
2454        if(silent){   
2455          elementsWithValidationClass.removeClass('wglIsValid');
2456
2457          jQuery('#validationStatus_' + validationID).remove();
2458
2459          jQuery('#errorMessage_' + validationID).remove();
2460          if(elementToAddError.find('.wglErrorMessageInline').length == 0){
2461            elementToAddError.removeClass('wglContainsErrorMessageInline');
2462            elementToAddError.find('.wglErrorMessageInline').remove();
2463            if(currentInput.attr('aria-describedby') ==  'errorMessage_' + validationID){
2464              currentInput.removeAttr('aria-describedby');          
2465            }          
2466          }
2467        }
2468        else{
2469          elementsWithValidationClass.addClass('wglIsInvalid');
2470          elementsWithValidationClass.removeClass('wglIsValid');
2471
2472          jQuery('#validationStatus_' + validationID).remove();
2473
2474          if(result['errorMessage'] != ''){
2475            if(jQuery('#errorMessage_' + validationID).length == 0){
2476              elementToAddError.addClass('wglContainsErrorMessageInline').append('<div class="wglErrorMessageInline" id="errorMessage_' + validationID + '" role="alert"><div>' + result['errorMessage'].replace(/\|.*/, '') + '</div></div>');
2477              currentInput.attr('aria-describedby', 'errorMessage_' + validationID);
2478              if(elementToAddError.addClass('wglContainsErrorMessageInline').find('label').length == 2){
2479                if(currentInput.attr('id') == elementToAddError.addClass('wglContainsErrorMessageInline').find('label').attr('for')){
2480                  jQuery('#errorMessage_' + validationID).css({'right' : String(Math.round(elementToAddError.addClass('wglContainsErrorMessageInline').width() - elementToAddError.addClass('wglContainsErrorMessageInline').find('label').width())) + 'px'});
2481                }
2482              }
2483              (function(validationID){
2484                window.setTimeout(function(){
2485                  jQuery('#errorMessage_' + validationID).addClass("loaded");
2486                }, 32);
2487              })(validationID);
2488            }
2489          }
2490        }
2491      }  
2492      else if(result['isValid'] == true){        
2493        elementsWithValidationAttr.removeAttr('data-isinvalid');       
2494
2495        if(silent){
2496          elementsWithValidationClass.removeClass('wglIsInvalid');
2497
2498          jQuery('#errorMessage_' + validationID).remove();
2499          if(elementToAddError.find('.wglErrorMessageInline').length == 0){
2500            elementToAddError.removeClass('wglContainsErrorMessageInline');
2501            elementToAddError.find('.wglErrorMessageInline').remove();
2502            if(currentInput.attr('aria-describedby') ==  'errorMessage_' + validationID){
2503              currentInput.removeAttr('aria-describedby');          
2504            }
2505          }
2506        }
2507        else{
2508          elementsWithValidationClass.removeClass('wglIsInvalid');
2509          elementsWithValidationClass.addClass('wglIsValid');
2510
2511          jQuery('#errorMessage_' + validationID).remove();
2512          if(elementToAddError.find('.wglErrorMessageInline').length == 0){
2513            elementToAddError.removeClass('wglContainsErrorMessageInline');
2514            elementToAddError.find('.wglErrorMessageInline').remove();
2515            if(currentInput.attr('aria-describedby') ==  'errorMessage_' + validationID){
2516              currentInput.removeAttr('aria-describedby');          
2517            }          
2518          }
2519
2520          if(jQuery('#validationStatus_' + validationID).length == 0){
2521            elementToAddOK.addClass('wglContainsValidationStatusInline').append('<div class="wglValidationStatusOK" id="validationStatus_' + validationID + '"><div></div></div>');
2522            (function(validationID){
2523              window.setTimeout(function(){
2524                jQuery('#validationStatus_' + validationID).addClass("loaded");
2525            }, 32);
2526          })(validationID);
2527        }
2528      }  
2529    }
2530
2531    wglUpdateValidationCurrentForm(currentInput);
2532  };  
2533  
2534  var silent = typeof(options['userinfo']) !== 'undefined' && !options['userinfo'] ? true : false;
2535
2536  vlr = wGetValidationInfoInput(currentInput);
2537  wFnValidationResult(vlr, silent);
2538};
2539
2540wglUpdateValidationCurrentForm = function(input){
2541  
2542  currentForm = jQuery(input).closest('form'); 
2543  currentForm.attr('data-hasvalidated', '1');  
2544  currentForm.attr('data-hasinputsinvalid', '0');
2545  currentForm.find('*[data-isinvalid="1"]').each(function(){
2546    if(jQuery(this).closest('.wglHideConditionalFormdata').length == 0){
2547      currentForm.attr('data-hasinputsinvalid', '1');
2548    }
2549  });
2550};  
2551
2552wGetValidationInfoInput = function(currentInput){
2553  
2554  var elementName = currentInput.attr('name');
2555  elementName = elementName.replace('[]', '');
2556
2557  var elementValue = currentInput.val();
2558  if(currentInput.attr('type') == 'checkbox'){
2559    elementValue = '';
2560    currentInput.parent().parent().find('input').each(function(){
2561      elementValue += (jQuery(this).get(0).checked ? jQuery(this).val() : '');
2562    });
2563  }
2564  else if(currentInput.attr('type') == 'radio'){
2565    elementValue = '';
2566    currentInput.parent().parent().find('input').each(function(){
2567      elementValue += (jQuery(this).get(0).checked ? jQuery(this).val() : '');
2568    });
2569  }
2570  else if(currentInput.prop("tagName") == 'SELECT' && currentInput.attr('multiple') == 'multiple'){
2571    elementValue = '';
2572    currentInput.children().each(function(){
2573      elementValue += (jQuery(this).get(0).selected ? jQuery(this).val() : '');
2574    });
2575  }
2576
2577  if(elementValue == null){
2578    elementValue = '';
2579  }
2580
2581  var vtv = elementValue;    
2582  var vln = jQuery(currentInput).attr('data-validators') ? jQuery(currentInput).attr('data-validators') : '';    
2583  vln = vln.replace(/\\'/g, 'wBkslhApos');
2584  if(/^(!)?preg(i)?(u)?Match(OrEmpty)?\('([^']+)'\)/.test(vln)){vln = RegExp.$1 + 'preg' + RegExp.$2 + RegExp.$3 + 'Match' + RegExp.$4 + '(\'' + RegExp.$5.replace(/\|/g, 'wPipe') + '\')';}        
2585  var vls = vln.split('|');
2586  var vlr = {'isValid' : true};
2587  var vlv = '', regExpVal = null;
2588  for(var j = 0; j < vls.length; j ++){
2589    vlv = vls[j];
2590    
2591    if(vlv == 'required' && vtv == ''){
2592      vlr = {'isValid' : false};
2593    }
2594    else if(vlv == 'captcha' && vtv == ''){
2595      vlr = {'isValid' : false};
2596    }    
2597    else if(vlv == 'email' && !/^([a-zA-Z0-9\.\-_]+@([a-zA-Z0-9öäuÖÄÜ][a-zA-Z0-9öäuÖÄÜ\.-]*|[a-zA-Z0-9öäuÖÄÜ])\.\w\w+)$/.test(vtv) || vlv == 'emailOrEmpty' && vtv != '' && !/^([a-zA-Z0-9\.\-_]+@[a-zA-Z0-9öäuÖÄÜ][a-zA-Z0-9öäuÖÄÜ\.-]*[a-zA-Z0-9öäuÖÄÜ]\.\w\w+)$/.test(vtv)){
2598      vlr = {'isValid' : false};
2599    }
2600    else if(vlv == 'file' && vtv == ''){
2601      vlr = {'isValid' : false};
2602    }      
2603    else if(/isEqualInput\((\w+)\)/.test(vlv)){
2604      var ntc = RegExp.$1;
2605      if(vtv != jQuery('#' + ntc).val()){
2606        vlr = {'isValid' : false};
2607      }
2608    }    
2609    else if(/maxlength\((\d+)\)/.test(vlv) && vtv.length > parseInt(RegExp.$1)){
2610      vlr = {'isValid' : false};
2611    }
2612    else if(/maxvalue\((\d+)\)/.test(vlv) && vtv > parseInt(RegExp.$1)){
2613      vlr = {'isValid' : false};
2614    }
2615    else if(/^(!)?preg(i)?(u)?Match(OrEmpty)?\('([^']+)'\)/.test(vlv)){      
2616      var regExpExt = RegExp.$2 + RegExp.$3;
2617     
2618      if(RegExp.$4 == 'OrEmpty' && vtv == ''){
2619      }
2620      else{
2621        var isNeg = RegExp.$1 == '!';
2622        var regExpPattern = RegExp.$5.replace(/wBkslhApos/g, '\'').replace(/wPipe/g, '|');  
2623        regExpVal = new RegExp(regExpPattern, regExpExt);
2624        if(isNeg && regExpVal.test(vtv) || !isNeg && !regExpVal.test(vtv)){
2625          vlr = {'isValid' : false};
2626        }
2627      }
2628    }   
2629    else if(/password\w?/.test(vlv)){
2630      var password   = vtv;
2631      var rules      = currentInput.data('passwordpolicy');
2632      var rulesLocal = rules;      
2633      var rulesOk    = true;   
2634      if(/^(\d+)\,?/.test(rules)){
2635        lengthMin = RegExp.$1;
2636        if(password.length < lengthMin){
2637          rulesOk = false;
2638        }
2639      }
2640      if(/^\d+\,([\w\W]+)/.test(rules)){
2641        rulesLocal = RegExp.$1;
2642      }
2643      if(/a/.test(rulesLocal)){
2644        if(!/[a-z]/.test(password)){
2645          rulesOk = false;
2646        }
2647      }
2648      if(/A/.test(rulesLocal)){
2649        if(!/[A-ZÄÖÜ]/.test(password)){
2650          rulesOk = false;
2651        }
2652      }
2653      if(/1/.test(rulesLocal)){
2654        if(!/[0-9]/.test(password)){
2655          rulesOk = false;
2656        }
2657      }
2658      if(/\\$/.test(rulesLocal)){
2659        if(!/\W/.test(password)){
2660          rulesOk = false;
2661        }
2662      }
2663      if(!rulesOk){
2664        vlr = {'isValid' : false};
2665      }
2666    }
2667    if(!vlr['isValid']){
2668      vlr['errorMessage'] = jQuery(currentInput).attr('data-errormessages');
2669      j = vls.length;
2670    }
2671  }  
2672  return vlr;
2673};
2674
2675wPrepareHTML = function(root){  
2676  //console.log('wPrepareHTML');
2677  
2678  if(!root){
2679    root = jQuery('body');
2680  }
2681  
2682  jQuery(root).find('.wglLightbox').wLightbox();  
2683
2684  wAjaxUrl(root);
2685  wFormElement(root);
2686  wLazyLoading();   
2687  
2688  if(observeVisible){
2689    jQuery('[data-doifbecomevisible]').each(function(index){
2690      observeVisible.observe(jQuery(this).get(0));
2691    });
2692    jQuery('.wglAnimateIfVisible').each(function(index){
2693      observeVisible.observe(jQuery(this).get(0));
2694    });
2695  }
2696  
2697  if(observeVisibleOnce){  
2698    jQuery('[data-doifbecomevisibleonce]').each(function(index){
2699      observeVisibleOnce.observe(jQuery(this).get(0));
2700    }); 
2701    jQuery('.wglAnimateIfVisibleOnce').each(function(index){
2702      observeVisibleOnce.observe(jQuery(this).get(0));
2703    });    
2704    jQuery('img.wglLazyLoadInit').each(function(index){
2705      observeVisibleOnce.observe(jQuery(this).get(0));
2706    });    
2707    jQuery('iframe.wglLazyLoadInit').each(function(index){
2708      observeVisibleOnce.observe(jQuery(this).get(0));
2709    });
2710  }    
2711};
2712
2713wAjaxUrl = function(root){
2714  
2715  var i, j, k;
2716  
2717  if(!root){
2718    root = jQuery('body');
2719  }  
2720
2721  jQuery(root).find("a[data-ajaxurl]").each(function(){
2722    var cE  = jQuery(this);
2723    var ajaxURL      = cE.data('ajaxurl');
2724    var ajaxAddMode  = cE.data('ajaxaddmode');
2725    var ajaxTarget   = cE.data('ajaxtarget');
2726    var ajaxCallback = cE.data('ajaxcallback');
2727    cE.on('click', function (event){
2728      jQuery('html').addClass('adaptLoading');
2729      
2730      var elementTarget = cE.parent().parent();      
2731      
2732      if(elementTarget.hasClass('elementList')){
2733        elementTarget.addClass('adaptLoading');
2734        elementTarget.find('.listDefault').addClass('adaptLoading');
2735      }
2736      
2737      if(typeof(wOnBeforeReloadElementByAjaxUrl) === 'function'){
2738        wOnBeforeReloadElementByAjaxUrl(elementTarget);
2739      }      
2740      
2741      jQuery.ajax({type: "GET", url: ajaxURL, async: true, success: function(result){
2742        
2743        jQuery('html').removeClass('adaptLoading');
2744        
2745        if(elementTarget.hasClass('elementList')){
2746          elementTarget.removeClass('adaptLoading');
2747          elementTarget.find('.listDefault').removeClass('adaptLoading');
2748        }    
2749        
2750        if(ajaxTarget && /^\.\.\/\.\.\/$/.test(ajaxTarget)){
2751          elementTarget = cE.parent().parent();
2752        }
2753        if(ajaxTarget && /^\.\.\/$/.test(ajaxTarget)){
2754          elementTarget = cE.parent().find(RegExp.$1);
2755        }
2756        if(ajaxTarget && /^\.\.\/(\w+)/.test(ajaxTarget)){
2757          elementTarget = cE.parent().find(RegExp.$1);
2758        }
2759        if(ajaxTarget && /^\.\.\/\.\.\/(\w+)/.test(ajaxTarget)){
2760          elementTarget = cE.parent().parent().find(RegExp.$1);
2761        }
2762
2763        if(typeof(window[ajaxCallback]) === 'function'){
2764          window[ajaxCallback](elementTarget, result);
2765          return;
2766        }
2767
2768        elementTarget.fadeTo(0, 0);
2769        if(ajaxAddMode == 'append'){
2770          elementTarget.html(elementTarget.html() + result);
2771        }
2772        else{
2773          elementTarget.html(result);
2774        }
2775        history.pushState({page: cE.attr('href')}, '', cE.attr('href'));
2776        wPrepareHTML(elementTarget.get(0));
2777        elementTarget.fadeTo(600, 1);
2778        if(cE.attr('data-preventscrolltotarget') != '1'){
2779          wScrollSmoothToElement(elementTarget.get(0), {'targetPos' : 'top'});
2780        }  
2781
2782        for(var addClassSelector in wCssClassesToAddGlobal){
2783          jQuery(addClassSelector).each(function(index){
2784            var classesToAdd = wCssClassesToAddGlobal[addClassSelector];
2785            for(var i = 0, arrayLength = classesToAdd.length; i < arrayLength; i++){
2786              var classData = classesToAdd[i].split('=');
2787              if(classData.length == 2){
2788                var selector = jQuery.trim(classData[0]);
2789                if(selector == '.'){
2790                  jQuery(this).addClass(jQuery.trim(classData[1]));
2791                }
2792                else if(selector == 'parent'){
2793                  jQuery(this).parent().addClass(jQuery.trim(classData[1]));
2794                }
2795                else{
2796                  jQuery(this).find(selector).addClass(jQuery.trim(classData[1]));
2797                }
2798              }
2799              else{
2800                jQuery(this).addClass(jQuery.trim(classData[0]));
2801              }
2802            }
2803          });
2804        }
2805
2806        if(typeof(wOnAfterReloadElementByAjaxUrl) === 'function'){
2807          wOnAfterReloadElementByAjaxUrl(elementTarget);
2808        }
2809        window.setTimeout(function(){
2810          jQuery(window).trigger('resize');
2811        }, 100);
2812        window.setTimeout(function(){
2813          jQuery(window).trigger('resize');
2814        }, 500);
2815        window.setTimeout(function(){
2816          jQuery(window).trigger('resize');
2817        }, 1000);
2818      }});
2819      return false;
2820    });
2821  });
2822};
2823
2824wFormElement = function(root){
2825  
2826  if(!root){
2827    root = jQuery('body');
2828  }  
2829
2830  jQuery(root).find('.formElementInput input, .formElementInput select, .formElementInput textarea').each(function(){   
2831    if((!jQuery(this).attr('name') || jQuery(this).attr('name').indexOf('wFormToken') == -1)){
2832      if(jQuery(this).prop('tagName') == 'SELECT' && !jQuery(this).attr('multiple') && jQuery(this).val() == '' || jQuery(this).prop('tagName') != 'SELECT' && jQuery(this).val() == '' && jQuery(this).text() == ''){
2833        jQuery(this).closest('.formElementInput').addClass('empty');
2834      }
2835      else{
2836        jQuery(this).closest('.formElementInput').removeClass('empty');        
2837      }
2838      
2839       if(jQuery(this).hasClass('wglInputTimeAfterDate') && (jQuery(this).val() != '' || jQuery(this).closest('.formElementInput').find('input.wglDatepicker').val() != '')){
2840        jQuery(this).closest('.formElementInput').removeClass('empty');
2841      }
2842      
2843    }
2844  });
2845
2846  jQuery(root).find('.formElementInput input, .formElementInput select, .formElementInput textarea').on('change', function(){
2847    if(jQuery(this).prop('tagName') == 'SELECT' && !jQuery(this).attr('multiple') && jQuery(this).val() == '' || jQuery(this).prop('tagName') != 'SELECT' && jQuery(this).val() == '' && jQuery(this).text() == ''){
2848      jQuery(this).closest('.formElementInput').addClass('empty');
2849    }
2850    else{
2851      jQuery(this).closest('.formElementInput').removeClass('empty');        
2852    }
2853  });       
2854
2855  jQuery(root).find('.formElementInput input, .formElementInput textarea').on('focus', function(){
2856    jQuery(this).closest('.formElementInput').addClass('focus');
2857  });
2858
2859  jQuery(root).find('.formElementInput input, .formElementInput textarea').on('blur', function(){
2860    jQuery(this).closest('.formElementInput').removeClass('focus');
2861  });     
2862};
2863
2864jQuery.extend(jQuery.easing, {
2865
2866  wEaseOut: function(x, t, b, c, d){
2867    return b - c * (t /= d) * (t - 2);
2868  },
2869
2870  wEaseOutExpo: function(x, t, b, c, d){
2871    return (t == d) ? b + c : b + c * (-Math.pow(2, -10 * t / d) + 1);
2872  },
2873
2874  wEaseIn: function(x, t, b, c, d){
2875    return b + c * (t /= d) * t;
2876  }
2877});
2878
2879jQuery.fn.wAddAnalytics = function(viewmode){
2880
2881  jQuery.each(jQuery(this), function(){
2882    jQuery(this).click(function(){ga('send', {'hitType': 'pageview', 'page': jQuery(this).attr('href'), 'title': jQuery(this).attr('title')})});
2883  });
2884};
2885
2886jQuery.fn.wSetViewmode = function(viewmode){
2887
2888  jQuery.each(jQuery(this), function(){
2889
2890    var hrefNew = this.getAttribute('href') || '';
2891    var anchor  = '';
2892    if(/#[^#]+$/.test(hrefNew)){
2893      anchor  = hrefNew.replace(/.*#/, '');
2894      hrefNew = hrefNew.replace(/#.*/, '');
2895    }
2896
2897    hrefNew = hrefNew.indexOf('?') != -1 ? hrefNew + '&viewmode=' + viewmode: hrefNew + '?viewmode=' + viewmode;
2898
2899    if(anchor != ''){
2900      hrefNew += '#' + anchor;
2901    }
2902    if(this.className.indexOf('boxOnly') == -1 && this.innerHTML.indexOf('<img ') != -1){
2903      this.style.background  = 'none';
2904      this.style.paddingLeft = 'none';
2905    }
2906    this.setAttribute('href', hrefNew);
2907  });
2908};
2909
2910wOpenPrintPreview = function(width, height, name){
2911
2912  var name = name || 'printpreview';
2913
2914  var url = location.href.indexOf('?') == -1 ? location.href.replace(/#.*/, '') + '?viewmode=print' : location.href.replace(/#.*/, '') + '&viewmode=print';
2915
2916  options = ',location=no,menubar=no,toolbar=no,resizable=yes,scrollbars=yes,status=no';
2917
2918  wOpenPopupURL(url, width, height, name, options);
2919};
2920
2921wOpenURL = function(url, target, element){
2922
2923  target = typeof(target) != 'undefined' && target ? target : (jQuery('html.isInLightbox').length == 1 ? '_top' : '');
2924  
2925  if(location.pathname.indexOf('/weblication/grid5/') != 0){  
2926    
2927    if(typeof event != 'undefined' && jQuery(event.target).closest('ul.listDefault').length > 0){
2928      wSetScrollPosLeftList(event.target);
2929    }
2930    
2931    if(/Android/i.test(navigator.userAgent)){          
2932      var cE = jQuery(element);
2933      var hrefCurrent = cE.attr('href') ? cE.attr('href') : url;         
2934      if(/\.pdf$/.test(url) && !/accessDocument\.php/.test(url) && !/^https?\:\/\//.test(url)){
2935        if(cE.attr('data-pathPrepend')){
2936          hrefCurrent = cE.attr('data-pathPrepend') + hrefCurrent; 
2937        }        
2938        url =  wUiTmp['wGlobalProjectPath'] + '/wGlobal/scripts/accessDocument.php?forceDownload=' + (cE.hasClass('download') ? '1' : '0') + '&document=' + encodeURIComponent(hrefCurrent);
2939      }
2940    }
2941
2942    if(target == '_blank'){
2943      var windowOpen = window.open(url);
2944      if(!/^\/\w+/.test(url)){
2945        windowOpen.opener = null;
2946        windowOpen.location = url;
2947      }
2948    }
2949    else if(target == '_top'){
2950      top.location.href = url;
2951    }
2952    else if(target.indexOf('embedListEntrySelf') !== -1){
2953      var options = {};
2954      var i = 8;
2955      while(element.nodeName != 'LI' && i-- > 0){
2956        element = element.parentNode;
2957      }
2958      if(element.nodeName == 'LI'){
2959        options['embedRoot']  = element.getAttribute('data-embedroot') ? element.getAttribute('data-embedroot') : (element.parentNode.getAttribute('data-embedroot') ? element.parentNode.getAttribute('data-embedroot') : '');
2960        options['embedClass'] = element.getAttribute('data-embedclass') ? element.getAttribute('data-embedclass') : (element.parentNode.getAttribute('data-embedclass') ? element.parentNode.getAttribute('data-embedclass') : '');
2961        options['embedClassAdditional'] = element.getAttribute('data-embedclassadditional') ? element.getAttribute('data-embedclassadditional') : (element.parentNode.getAttribute('data-embedclassadditional') ? element.parentNode.getAttribute('data-embedclassadditional') : '');        
2962        options['embedBefore'] = element.getAttribute('data-embedbefore') ? element.getAttribute('data-embedbefore') : (element.parentNode.getAttribute('data-embedbefore') ? element.parentNode.getAttribute('data-embedbefore') : '');
2963        options['embedMultiple'] = element.getAttribute('data-embedmultiple') ? element.getAttribute('data-embedmultiple') : (element.parentNode.getAttribute('data-embedmultiple') ? element.parentNode.getAttribute('data-embedmultiple') : '');
2964        if(element.parentNode.getAttribute('data-scrolltopoffsetifnotvisibleembed') == 'listEntryHeight'){  
2965          options['scrollTopOffset'] = element.offsetHeight;        
2966        }    
2967      }
2968      wEmbedPage(url, 'listEntrySelf', element, options);
2969    }
2970    else if(target.indexOf('embedListNextRow') !== -1){
2971      var options = {};
2972      var i = 8;
2973      while(element.nodeName != 'LI' && i-- > 0){
2974        element = element.parentNode;
2975      }
2976      if(element.nodeName == 'LI'){
2977        options['embedRoot']  = element.getAttribute('data-embedroot') ? element.getAttribute('data-embedroot') : (element.parentNode.getAttribute('data-embedroot') ? element.parentNode.getAttribute('data-embedroot') : '');
2978        options['embedClass'] = element.getAttribute('data-embedclass') ? element.getAttribute('data-embedclass') : (element.parentNode.getAttribute('data-embedclass') ? element.parentNode.getAttribute('data-embedclass') : '');
2979        options['embedClassAdditional'] = element.getAttribute('data-embedclassadditional') ? element.getAttribute('data-embedclassadditional') : (element.parentNode.getAttribute('data-embedclassadditional') ? element.parentNode.getAttribute('data-embedclassadditional') : '');        
2980        options['embedScrollElement'] = element.getAttribute('data-embedscrollelement') ? element.getAttribute('data-embedscrollelement') : (element.parentNode.getAttribute('data-embedscrollelement') ? element.parentNode.getAttribute('data-embedscrollelement') : '');
2981       if(element.parentNode.getAttribute('data-scrolltopoffsetifnotvisibleembed') == 'listEntryHeight'){  
2982          options['scrollTopOffset'] = element.offsetHeight;        
2983        }    
2984      }
2985      wEmbedPage(url, 'listNextRow', element, options);
2986    }    
2987    else if(target.indexOf('embedBody') !== -1){
2988      var options = {};
2989      options['embedRoot']  = element.getAttribute('data-embedroot') ? element.getAttribute('data-embedroot') : (element.parentNode.getAttribute('data-embedroot') ? element.parentNode.getAttribute('data-embedroot') : '');
2990      options['embedClass'] = element.getAttribute('data-embedclass') ? element.getAttribute('data-embedclass') : (element.parentNode.getAttribute('data-embedclass') ? element.parentNode.getAttribute('data-embedclass') : '');
2991      options['embedClassAdditional'] = element.getAttribute('data-embedclassadditional') ? element.getAttribute('data-embedclassadditional') : (element.parentNode.getAttribute('data-embedclassadditional') ? element.parentNode.getAttribute('data-embedclassadditional') : '');        
2992      wEmbedPage(url, 'body', element, options);
2993    }    
2994    else if(target.indexOf('box') !== -1){
2995      if(typeof(element) != 'undefined' && element.nodeType && element.nodeType == 1){
2996        wLightbox(jQuery(element), {"variant": target, "href" : url});
2997      }  
2998      else{
2999        wLightbox({"variant": target, "href" : url});        
3000      }
3001    }    
3002    else if(url !== undefined){
3003      if(url.indexOf('#') == 0){
3004        wScrollSmoothToElement(url);
3005      }
3006      else {
3007        location.href = url;
3008      }
3009    }
3010  }
3011};
3012
3013wSetParameterAndReload = function(name, value){
3014
3015  location.href = wSetParameter(location.href, name, value);
3016};
3017
3018wSetParameter = function(url, name, value){
3019  
3020  var urlHash = '';
3021  if(/(#[\w\W]*)$/.test(url)){
3022    urlHash = RegExp.$1;
3023    url = url.replace(/(#[\w\W]*)$/, '');
3024  }
3025  
3026  var paramReg = new RegExp('([\\?\\&])' + name + '=([^\\&]+)');
3027  if(paramReg.test(url)){
3028    if(value == ''){
3029      url = url.replace(paramReg, RegExp.$1);
3030      url = url.replace(/([\?\&])[\?\&]+/g, '$1');
3031      url = url.replace(/[\?\&]$/g, '');
3032    }  
3033    else{
3034      url = url.replace(paramReg, RegExp.$1 + name + '=' + value);
3035    }
3036  }
3037  else if(value == ''){
3038    
3039  }
3040  else if(url.indexOf('?') != -1){
3041    url += '&' + name + '=' + value;
3042  }
3043  else{
3044    url += '?' + name + '=' + value;
3045  }
3046  return url + urlHash;
3047};
3048
3049wEmbedPage = function(url, target, element, options){
3050  
3051  options = options || {};  
3052  
3053  options['type'] = options['type'] || 'ajax';
3054  options['embedRoot'] = options['embedRoot'] || '';
3055  options['scrollTopOffset'] = options['scrollTopOffset'] || 0;
3056
3057  var id = 'wEmbededPage-' + String(parseInt(Math.random() * 100000));
3058  
3059  var elementToAppend = element;
3060  var rootSameEmbed   = jQuery('body');
3061  
3062  if(target == 'listEntrySelf'){  
3063                
3064    if(url == wUiTmp['wEmbePageCurrentURL']){
3065      wUiTmp['wEmbePageCurrentURL'] = ''; 
3066      wEmbedPageClose();
3067      return false;
3068    }
3069  
3070    wUiTmp['wEmbePageCurrentURL'] = url;
3071  
3072    rootSameEmbed = jQuery(element).closest('li').length == 1 ? jQuery(element).closest('li') : rootSameEmbed;
3073    
3074    elementToAppend = jQuery(element).get(0); 
3075    
3076    if(options['embedMulti'] != '1'){    
3077      rootSameEmbed.parent().find('.wEmbededPage-' + target).remove();
3078    }  
3079  
3080    if(options['embedMulti'] == '1' || rootSameEmbed.find('.wEmbededPage-' + target).length == 0){  
3081      var embedClass = options['embedClass'] && options['embedClass'] != '' ? ' wEmbededPage-' + options['embedClass'] : '';      
3082      if(options['embedClassAdditional'] && options['embedClassAdditional'] != ''){
3083        embedClass += ' ' + options['embedClassAdditional'];
3084      }
3085      var embedHTML = '<div id="' + id + '" class="wEmbededPage wEmbededPage-' + target + ' wEmbededPage-' + options['type'] + embedClass + '" data-embedpagetarget="' + target + '" data-src="' + url + '"' + (options['embedMulti'] == '1' ? ' data-multi="1"' : '') + ' onclick="event.stopPropagation()"><div class="wEmbededPageInner"></div><div class="wEmbededPageCloser" onclick="wEmbedPageClose(event)"></div></div>';
3086      if(options['embedBefore'] && jQuery(element).find(options['embedBefore']).length != 0){
3087        jQuery(embedHTML).insertBefore(jQuery(element).find(options['embedBefore']));
3088      }
3089      else{
3090        jQuery(embedHTML).appendTo(elementToAppend);
3091      }
3092    }  
3093    else{
3094      rootSameEmbed.find('.wEmbededPage-' + target).attr('id', id);
3095    }   
3096    if(options['embedMulti'] != '1'){
3097      jQuery(element).siblings().removeClass('listEntryHasEmbedded');
3098    }
3099    jQuery(element).addClass('listEntryHasEmbedded');          
3100  }
3101  else if(target == 'listNextRow'){  
3102          
3103    if(url == wUiTmp['wEmbePageCurrentURL']){
3104      wUiTmp['wEmbePageCurrentURL'] = '';    
3105      wEmbedPageClose();
3106      return false;
3107    }    
3108  
3109    wUiTmp['wEmbePageCurrentURL'] = url;
3110  
3111    rootSameEmbed = jQuery(element).closest('ul').length == 1 ? jQuery(element).closest('ul') : rootSameEmbed;
3112    
3113    elementToAppend = jQuery(element).parent().children().last().get(0);    
3114    var offsetTopCurrent = element.offsetTop;
3115  
3116    jQuery(element).nextAll().each(function(){
3117      if(jQuery(this).get(0).offsetTop > offsetTopCurrent){
3118        elementToAppend = jQuery(this).prev().get(0);
3119        return false;
3120      }
3121    });
3122    
3123    if(elementToAppend != wUiTmp['wEmbePagecEToAppend']){
3124      rootSameEmbed.find('.wEmbededPage-' + target).remove();
3125    }
3126  
3127    if(rootSameEmbed.find('.wEmbededPage-' + target).length == 0){  
3128      var embedClass = options['embedClass'] && options['embedClass'] != '' ? ' wEmbededPage-' + options['embedClass'] : '';      
3129      if(options['embedClassAdditional'] && options['embedClassAdditional'] != ''){
3130        embedClass += ' ' + options['embedClassAdditional'];
3131      }
3132      jQuery('<li id="' + id + '" class="wEmbededPage wEmbededPage-' + target + ' wEmbededPage-' + options['type'] + embedClass + '" data-embedpagetarget="' + target + '" data-src="' + url + '"><div class="wEmbededPageInner" data-scrollelement="' + options['embedScrollElement'] + '"></div><div class="wEmbededPageCloser" onclick="event.stopPropagation();wEmbedPageClose(event);return false;"></div></li>').insertAfter(elementToAppend);
3133    }  
3134    else{
3135      rootSameEmbed.find('.wEmbededPage-' + target).attr('id', id);
3136    }    
3137  }  
3138  else{    
3139    if(url == wUiTmp['wEmbePageCurrentURL']){
3140      wUiTmp['wEmbePageCurrentURL'] = '';    
3141      wEmbedPageClose();
3142      return false;
3143    }   
3144          
3145    wUiTmp['wEmbePageCurrentURL'] = url;        
3146    
3147    elementToAppend = rootSameEmbed;    
3148    var offsetTopCurrent = element.offsetTop;       
3149    
3150    if(rootSameEmbed.find('.wEmbededPage-' + target).length == 0){  
3151      var embedClass = options['embedClass'] && options['embedClass'] != '' ? ' wEmbededPage-' + options['embedClass'] : '';
3152      if(options['embedClassAdditional'] && options['embedClassAdditional'] != ''){
3153        embedClass += ' ' + options['embedClassAdditional'];
3154      }      
3155      jQuery('<div id="' + id + '" class="wEmbededPage wEmbededPage-' + target + ' wEmbededPage-' + options['type'] + embedClass + '" data-embedpagetarget="' + target + '" data-src="' + url + '"><div class="wEmbededPageInner"></div><div class="wEmbededPageCloser" onclick="wEmbedPageClose(event)"></div></div>').appendTo(elementToAppend);
3156    }  
3157    else{
3158      rootSameEmbed.find('.wEmbededPage-' + target).attr('id', id);
3159    }    
3160  }
3161   
3162  rootSameEmbed.find('.wEmbededPage-' + target).addClass('loading');
3163  
3164  wUiTmp['wEmbePagecEToAppend'] = elementToAppend; 
3165    
3166  jQuery(element).siblings().removeClass('listEntrySelected');
3167  jQuery(element).addClass('listEntrySelected');      
3168  
3169  jQuery('html').removeClass('embedpage-loaded');     
3170  jQuery('html').addClass('embedpage-loading');      
3171  jQuery('html').addClass('embedpage-open');     
3172  jQuery('html').addClass('embedpage-' + target + '-open');   
3173
3174  jQuery.ajax({type: "GET", url: url, success: function(result){
3175    htmlToEmbed = result.replace(/^[\s\S]*<body[^>]*>/, '').replace(/<\/body[^>]*>[\s\S]*$/, ''); 
3176    if(typeof(wOnBeforeEmbedPage) === 'function'){
3177      wOnBeforeEmbedPage(htmlToEmbed, url);
3178    }      
3179    
3180    var htmlToEmbedElement = document.createElement('div'); 
3181    htmlToEmbedElement.innerHTML = htmlToEmbed;   
3182    
3183    if(typeof(wKeepIDsInEmbededPage) == 'undefined' || !wKeepIDsInEmbededPage){  
3184      htmlToEmbed = htmlToEmbed.replace(/ id="([^"]*)"/g, ' id="embed_$1"');
3185      htmlToEmbed = htmlToEmbed.replace(/ id="embed_(tab|accordion|container|pictureGallery|bannerSlider|listEntries)/g, ' id="$1');    
3186    }
3187    
3188    var scriptsCurrent = document.getElementsByTagName('script');    
3189    var scriptsToEmbed = [];
3190        
3191    if(/<script[^>]*src="([^"]+jquery-ui\.js)/.test(result) && !/<script[^>]*src="([^"]+jquery-ui\.js)/.test(document.documentElement.innerHTML)){
3192      scriptsToEmbed.push(RegExp.$1);
3193    }    
3194    
3195    if(/<script[^>]*src="([^"]+\.date\.js)/.test(result) && !/<script[^>]*src="([^"]+\.date\.js)/.test(document.documentElement.innerHTML)){
3196      scriptsToEmbed.push(RegExp.$1);
3197    }    
3198    
3199    if(/<script[^>]*src="([^"]+\/pictureGallery\.js)/.test(result) && !/<script[^>]*src="([^"]+\/pictureGallery\.js)/.test(document.documentElement.innerHTML)){
3200      scriptsToEmbed.push(RegExp.$1);
3201    }
3202    
3203    if(/<script[^>]*src="([^"]+\/bannerSlider\.js)/.test(result) && !/<script[^>]*src="([^"]+\/bannerSlider\.js)/.test(document.documentElement.innerHTML)){
3204      scriptsToEmbed.push(RegExp.$1);
3205    }        
3206    
3207    htmlToEmbed = htmlToEmbed.replace(/<script[^>]+src="[^>]+>([\s\n\r\t]*<\/script>)?/g, '');       
3208    htmlToEmbed = htmlToEmbed.replace('<div id="cookieNotice"', '<div style="display:none"');       
3209    htmlToEmbed = htmlToEmbed.replace('<div id="dntNotice"', '<div style="display:none"');       
3210            
3211    for(var i = 0; i < scriptsToEmbed.length; i++){
3212      var scriptElement = document.createElement('script');
3213      scriptElement.setAttribute('type', 'text/javascript');
3214      scriptElement.setAttribute('src', scriptsToEmbed[i]);
3215      scriptElement.setAttribute('data-hasloadtoembed', '1');      
3216      if(typeof(callbackOnLoad) === 'function'){
3217        scriptElement.wAddEvent('load', callbackOnLoad);
3218      }
3219      document.body.appendChild(scriptElement);
3220    }
3221        
3222    if(options['embedRoot'] && options['embedRoot'] != ''){
3223      if(typeof(wKeepIDsInEmbededPage) == 'undefined' || !wKeepIDsInEmbededPage){        
3224        options['embedRoot'] = options['embedRoot'].replace('#', '#embed_');
3225      }
3226      
3227      var tmpFragment = document.createElement('DIV');
3228      tmpFragment.innerHTML = htmlToEmbed;
3229      
3230      var resultNode = tmpFragment.querySelector(options['embedRoot']);
3231
3232      if(resultNode){
3233        htmlToEmbed = resultNode.innerHTML;
3234      }
3235    }      
3236        
3237    var tmp   = '';    
3238    var jsStr = '';
3239    var strArray = htmlToEmbed.split(/<script[^>]*>
3239/);
3240    
3241    tmp += strArray[0];
3242    
3243    for(var i = 1; i < strArray.length; i++){
3244      strArray[i] = strArray[i].replace(/^([\s\S]*)<\/script[^>]*>/m, '');
3245      jsStr += RegExp.$1.replace(/;?[\n\r\t\s]*$/, ';').replace(/;+$/, ';');
3246      tmp += strArray[i];
3247    }
3248
3249    htmlToEmbed = tmp;   
3250
3251    jQuery('#' + id).find('.wEmbededPageInner').html(htmlToEmbed);
3252    
3253    for(var addClassSelector in wCssClassesToAddGlobal){
3254      jQuery('#' + id).find(addClassSelector).each(function(index){
3255        var classesToAdd = wCssClassesToAddGlobal[addClassSelector];
3256        for(var i = 0, arrayLength = classesToAdd.length; i < arrayLength; i++){
3257          var classData = classesToAdd[i].split('=');
3258          if(classData.length == 2){
3259            var selector = jQuery.trim(classData[0]);            
3260            if(selector == '.'){
3261              jQuery(this).addClass(jQuery.trim(classData[1]));
3262            }
3263            else if(selector == 'parent'){
3264              jQuery(this).parent().addClass(jQuery.trim(classData[1]));
3265            }
3266            else{
3267              jQuery(this).find(selector).addClass(jQuery.trim(classData[1]));
3268            }
3269          }
3270          else{            
3271            jQuery(this).addClass(jQuery.trim(classData[0]));
3272          }
3273        }
3274      });
3275    }    
3276        
3277    jQuery('#' + id).find('.wEmbededPageInner .wglBannerSlider').wBannerSlider();
3278    jQuery('#' + id).find('.wEmbededPageInner .wglSmartSlider').wSmartSlider();    
3279    jQuery('#' + id).find('.wEmbededPageInner .wglPictureGallery').wPictureGallery();
3280    
3281    if(typeof(wExecuteJsInEmbededPage) != 'undefined' && wExecuteJsInEmbededPage){      
3282      try{eval(jsStr);}catch(e){}
3283    }  
3284
3285    jQuery('#' + id).on('scroll', function(){ 
3286      jQuery(window).trigger('scroll');
3287    });
3288
3289    var [query, hash] = url.split('#');
3290    jQuery('#' + id).find('.wEmbededPageInner .wglTabcontainer').wTabcontainer({'curHashId' : '#' + hash});
3291    jQuery('#' + id).find('.wEmbededPageInner .wglAccordion').wAccordion();
3292    jQuery('#' + id).find('.wEmbededPageInner .wglBannerSlider').wBannerSlider();
3293    jQuery('#' + id).find('.wEmbededPageInner .wglSmartSlider').wSmartSlider();    
3294    jQuery('#' + id).find('.wEmbededPageInner .wglPictureGallery').wPictureGallery();
3295    jQuery('#' + id).find('.wEmbededPageInner .wglMagnifier').wMagnifier();
3296    jQuery('#' + id).find('.wEmbededPageInner .wglLightbox').wLightbox();    
3297    jQuery('#' + id).find('.wEmbededPageInner .wglMaximizer').wMaximizer();
3298    jQuery('#' + id).find('.wEmbededPageInner .wglDatepicker').wDatepicker();
3299    jQuery('#' + id).find('.wEmbededPageInner .wglTicker').wTicker();  
3300    jQuery('#' + id).find('.wEmbededPageInner .wglSearchSuggest').wSearchSuggest();
3301    jQuery('#' + id).find('.wEmbededPageInner textarea[data-autoheight="1"]').wAutoheight();
3302    jQuery('#' + id).find('.wEmbededPageInner').wOptimizePictureSizes();
3303    
3304    wAdaptConditionalFormData();
3305    wInitInlineValidation();
3306    
3307    window.setTimeout(function(){
3308      wLazyLoading();
3309        window.setTimeout(function(){
3310          wLazyLoading();
3311        }, 720);    
3312    }, 160);  
3313    
3314    wPrepareHTML();    
3315
3316    jQuery('html').removeClass('embedpage-loading');     
3317    jQuery('html').addClass('embedpage-loaded');    
3318    rootSameEmbed.find('.wEmbededPage-' + target).removeClass('loading');
3319    
3320    if(typeof(wOnAfterEmbedPage) === 'function'){
3321      wOnAfterEmbedPage(rootSameEmbed.find('.wEmbededPage-' + target).get(0), url);
3322    }    
3323    
3324    if(target == 'listNextRow'){  
3325      wScrollSmoothToElement(jQuery('#' + id).find('.wEmbededPageInner').get(0), {'targetPos' : 'top', 'scrollTopOffset' : options['scrollTopOffset']});    
3326    }  
3327    
3328    if(typeof(wSimulateBreakpointsInEmbededPage) != 'undefined' && wSimulateBreakpointsInEmbededPage){    
3329      window.setTimeout(function(){
3330        if(typeof(wSimulateBreakpointsIfNeccessary) != 'undefined'){
3331          wSimulateBreakpointsIfNeccessary({root : jQuery('#' + id).find('.wEmbededPageInner').get(0), urlToSimulate : url});    
3332        }  
3333      }, 1000);  
3334    }  
3335  }});  
3336};
3337
3338wEmbedPageClose = function(event){
3339  
3340  if(typeof(event) != 'undefined'){
3341    event.stopPropagation();
3342  }
3343  
3344  var rootSameEmbed = jQuery('body');  
3345  
3346  if(typeof(event) != 'undefined' && jQuery(event.target).closest('li[data-embedpagetarget="listNextRow"]').length == 1){
3347    rootSameEmbed = jQuery(event.target).closest('ul')
3348  }
3349  
3350  document.documentElement.className = document.documentElement.className.replace(/embedpage-\w+-open/, '');  
3351  
3352  jQuery('html').removeClass('embedpage-open'); 
3353  jQuery('html').removeClass('embedpage-loaded');    
3354  jQuery('script[data-hasloadtoembed="1"]').remove();
3355  
3356  if(typeof(event) != 'undefined' && jQuery(event.target).closest('.wEmbededPage').length == 1 && jQuery(event.target).closest('.wEmbededPage').attr('data-multi') == '1'){
3357    var embedCurrent = jQuery(event.target).closest('.wEmbededPage');
3358    embedCurrent.closest('li.listEntryHasEmbedded').removeClass('listEntryHasEmbedded');        
3359    embedCurrent.closest('li.listEntrySelected').removeClass('listEntrySelected');      
3360    embedCurrent.siblings().removeClass('listEntrySelected');    
3361    embedCurrent.siblings().removeClass('listEntryHasEmbedded');    
3362    embedCurrent.remove();
3363  }
3364  else{
3365    rootSameEmbed.find('.wEmbededPage').closest('li.listEntryHasEmbedded').removeClass('listEntryHasEmbedded');        
3366    rootSameEmbed.find('.wEmbededPage').closest('li.listEntrySelected').removeClass('listEntrySelected');      
3367    rootSameEmbed.find('.wEmbededPage').siblings().removeClass('listEntrySelected');    
3368    rootSameEmbed.find('.wEmbededPage').siblings().removeClass('listEntryHasEmbedded');    
3369    rootSameEmbed.find('.wEmbededPage').remove();
3370  }
3371  
3372  wUiTmp['wEmbePageCurrentURL'] = '';
3373  
3374  if(typeof(wOnAfterCloseEmbedPage) === 'function'){
3375    wOnAfterCloseEmbedPage();
3376  }        
3377};
3378
3379wOpenPopupURL = function(url, width, height, name, options){
3380
3381  var name = name || '';
3382
3383  if(width == '' || width == ' ' || typeof(width) == 'undefined'){
3384    width = 786;
3385  }
3386  if(height == '' || height == ' ' || typeof(height) == 'undefined'){
3387    height = 677;
3388  }
3389
3390  url = url.replace(/&/g, '&');
3391  options = options || ',location=no,menubar=no,toolbar=no,resizable=yes,scrollbars=yes,status=no';
3392
3393  var width   = parseInt(width);
3394  var height  = parseInt(height);
3395
3396  var posLeft = (screen.width / 2)  - (width  / 2);
3397  var posTop  = (screen.height / 2) - (height / 2);
3398
3399  var windowOpen = window.open(url, name, 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options);
3400  if(!/^\/\w+/.test(url)){
3401    windowOpen.opener = null;
3402    windowOpen.location = url;
3403  }
3404};
3405
3406wDisableAnalytics = function(){
3407
3408  document.cookie = 'disableGoogleAnalytics=1;path=/;sameSite=Lax;expires='+(new Date(new Date().getTime() + 365 * 1000 * 60 * 60 * 24).toGMTString());
3409  if(window['gaId']){
3410    window['ga-disable-' + window['gaId']] = true;
3411  }
3412  else if(typeof(gaOptout) != 'undefined'){
3413    gaOptout();    
3414  }
3415};
3416
3417wDisableWaNextRequest = function(){
3418
3419  document.cookie = 'wDisableWaNextRequest=1;path=/;sameSite=Lax';
3420};
3421
3422wSendMailNospam = function(data){
3423  
3424  var rtc = true;
3425  if(typeof(wOnBeforeClickSendMailNospam) == 'function'){
3426    rtc = wOnBeforeClickSendMailNospam(data.replace('|', '@').replace(/wApos/, "'"), event);
3427  }
3428  if(rtc){
3429    top.location.href = 'mailto:' + data.replace('|', '@').replace(/wApos/, "'", event);
3430  }
3431};
3432
3433wAdaptConditionalFormData = function(){
3434    
3435  jQuery("*[data-conditionalformdata]").each(function(){
3436    var cE = jQuery(this);
3437    
3438    var conditionalformdata      = cE.data('conditionalformdata');
3439    var conditionalFormDataArray = conditionalformdata.split('|AND|');
3440    
3441    for(var k = 0; k < conditionalFormDataArray.length; k++){
3442      var type                = 'showIf';
3443      var dyndisplayOperator  = 'and';
3444      var callbackJS          = '';
3445      var conditionalformdata = conditionalFormDataArray[k];
3446
3447      if(/callbackJS\:([^;]+)/.test(conditionalformdata)){
3448        callbackJS = RegExp.$1;
3449      }  
3450
3451      if(/type\:(showIf|hideIf)/.test(conditionalformdata)){
3452        type = RegExp.$1;
3453      }
3454
3455      if(/operator\:(and|or)/.test(conditionalformdata)){
3456        dyndisplayOperator = RegExp.$1;
3457      }
3458
3459      if(/conditions\:(.*)/.test(conditionalformdata)){
3460        conditionalformdata = RegExp.$1;
3461      }
3462
3463      conditionalformdata = conditionalformdata.replace(/,([\w\-]+(==|\!=|\>=|\>|\<=|\<|)')/g, '_WCMA_$1');    
3464
3465      var conditionalFormDatas = conditionalformdata.split('_WCMA_');
3466      var isActive             = dyndisplayOperator == 'or' ? false : true;
3467      var isActiveCurrent      = false;
3468
3469      for(var i = 0; i < conditionalFormDatas.length; i++){ 
3470
3471        conditionalFormDatas[i] = conditionalFormDatas[i].replace("\\'", 'WBSAP');
3472
3473        /^([\w\-]+)(\=\=|\!\=|<\=|<|>|>\=|pregMatch|\!pregMatch|contains|\!contains|pregiMatch|\!pregiMatch|containsi|\!containsi|callback)\'([^\']*)\'/.test(conditionalFormDatas[i]);
3474
3475        var elementToObserveName = RegExp.$1;
3476        var operator             = RegExp.$2;
3477        var condition            = RegExp.$3.replace('WBSAP', "'").replace('wMyProject::', '');
3478        
3479        if(condition.substr(0, 1) == '$'){
3480          var elementWidthConditionName = condition.substr(1);
3481          var elementWithConditionValue = null;
3482          var elementWithCondition      = cE.closest('form').find("*[name='" + elementWidthConditionName + "']");
3483          if(elementWithCondition.length != 0){
3484            condition = elementWithCondition.val();
3485
3486            if(elementWithCondition.attr('type') == 'radio'){
3487              elementWithConditionValue = cE.closest('form').find("input[name='" + elementWidthConditionName + "']:checked, input[name='" + elementWidthConditionName + "[]:checked']");
3488              if(elementWithConditionValue.length != 0){         
3489                condition = elementWithConditionValue.val();
3490              }
3491              else{
3492                condition = '';
3493              }
3494            }
3495            else if(elementWithCondition.attr('type') == 'checkbox'){
3496              condition = new Array();
3497              elementToObserve.each(function(){
3498                if(jQuery(this).is(':checked')){
3499                  condition.push(jQuery(this).val());
3500                }
3501              });
3502            }          
3503          }
3504        }  
3505
3506        var elementToObserve      = cE.closest('form').find("*[name='" + elementToObserveName + "'], *[name='" + elementToObserveName + "[]']");
3507        var elementToObserveValue = elementToObserve;
3508        var value                 = elementToObserveValue.length > 0 ? elementToObserveValue.val() : '';
3509        
3510        if(jQuery(elementToObserveValue).hasClass('elementInputDate')){
3511          value = value.replace(/^[a-zA-Z]+, /, '');
3512          if(/^\d\d\.\d\d\.\d\d\d\d$/.test(value)){
3513            value = value.substr(6, 4) + '-' + value.substr(3, 2) + '-' + value.substr(0, 2);
3514          }
3515          if(/^\d\d\.\d\d\.\d\d\d\d$/.test(condition)){
3516            condition = condition.substr(6, 4) + '-' + condition.substr(3, 2) + '-' + condition.substr(0, 2);
3517          }          
3518        }
3519        
3520        //console.log(elementToObserveName + '(' + value + ') ' + operator + ' ' + condition);  
3521
3522        if(elementToObserve.attr('type') == 'file'){   
3523          if(elementToObserve.attr('data-isUploaded') && elementToObserve.attr('data-isUploaded') === '1'){
3524            value = 'wIsUploaded';
3525          }
3526        }  
3527        else         
3528        if(elementToObserve.attr('type') == 'radio'){
3529          elementToObserveValue = cE.closest('form').find("input[name='" + elementToObserveName + "']:checked, input[name='" + elementToObserveName + "[]:checked']");
3530          if(elementToObserveValue.length != 0){         
3531            value = elementToObserveValue.val();
3532          }
3533          else{
3534            value = '';
3535          }
3536        }
3537        else if(elementToObserve.attr('type') == 'checkbox'){
3538          value = new Array();
3539          elementToObserve.each(function(){
3540            if(jQuery(this).is(':checked')){
3541              value.push(jQuery(this).val());
3542            }
3543          });
3544        }
3545
3546        if(!elementToObserve.data('hasaddedobserver')){
3547          elementToObserve.data('hasaddedobserver', true);
3548          elementToObserve.on('change keyup', function(){wAdaptConditionalFormData();});
3549        }
3550
3551        isActiveCurrent = false;
3552
3553        if(operator == '<' || operator == '<=' || operator == '>=' || operator == '>'){
3554          if(!jQuery(elementToObserveValue).hasClass('elementInputDate')){
3555            value = isNaN(parseFloat(value)) ? 0 : parseFloat(value);
3556          }
3557        }  
3558
3559        var regExpOperator = null;
3560        if(operator == 'pregMatch' || operator == '!pregMatch'){
3561          regExpOperator = new RegExp(condition);
3562        }
3563        else if(operator == 'pregiMatch' || operator == '!pregiMatch'){
3564          regExpOperator = new RegExp(condition, 'i');
3565        }      
3566
3567        if(Array.isArray(value) && condition == ''){
3568          if(operator == '!=' && value.length != 0 || operator == '==' && value.length == 0){
3569            if(dyndisplayOperator == 'or'){
3570              isActive = true;
3571              break;
3572            }
3573          } 
3574          else{
3575            if(dyndisplayOperator == 'and'){  
3576              isActive = false;
3577              break;
3578            }          
3579          }
3580        }      
3581        else if(Array.isArray(value) && condition.indexOf('|') == -1){
3582          if(operator == '!=' && value.indexOf(condition) == -1 || operator == '==' && value.indexOf(condition) != -1){
3583            if(dyndisplayOperator == 'or'){
3584              isActive = true;
3585              break;
3586            }
3587          }
3588          else{
3589            if(dyndisplayOperator == 'and'){  
3590              isActive = false;
3591              break;
3592            }          
3593          }        
3594        }
3595        else if(Array.isArray(value)){
3596          var conditions = condition.split('|');
3597          isActiveCurrent = false;          
3598          for(var j = 0; j < conditions.length; j++){
3599            if(operator == '!=' && value.indexOf(conditions[j]) == -1 || operator == '==' && value.indexOf(conditions[j]) != -1){ 
3600              isActiveCurrent = true;
3601              break;
3602            }
3603          }
3604          if(isActiveCurrent){
3605            if(dyndisplayOperator == 'or'){
3606              isActive = true;
3607              break;
3608            }
3609          }
3610          else{
3611            if(dyndisplayOperator == 'and'){  
3612              isActive = false;
3613              break;
3614            }          
3615          }            
3616        }
3617        else if(operator == 'pregMatch' && regExpOperator.test(value) || operator == '!pregMatch' && !regExpOperator.test(value) || operator == 'pregiMatch' && regExpOperator.test(value) || operator == '!pregiMatch' && !regExpOperator.test(value)){      
3618          if(dyndisplayOperator == 'or'){
3619            isActive = true;
3620            break;
3621          }         
3622        }      
3623        else if(operator == 'contains' && value.indexOf(condition) != -1 || operator == '!contains' && value.indexOf(condition) == -1 || operator == 'containsi' && value.toLowerCase().indexOf(condition.toLowerCase()) != -1 || operator == '!containsi' && value.toLowerCase().indexOf(condition.toLowerCase()) == -1){      
3624          if(dyndisplayOperator == 'or'){
3625            isActive = true;
3626            break;
3627          }         
3628        }        
3629        else if(operator == '!=' && value != condition || operator == '==' && value == condition || operator == '<' && value < condition || operator == '<=' && value <= condition || operator == '>=' && value >= condition || operator == '>' && value > condition){      
3630          if(dyndisplayOperator == 'or'){
3631            isActive = true;
3632            break;
3633          }         
3634        }
3635        else if(operator == 'callback' && typeof(globalThis[condition]) === 'function' && globalThis[condition](value)){      
3636          if(dyndisplayOperator == 'or'){
3637            isActive = true;
3638            break;
3639          }         
3640        }      
3641        else{       
3642          if(dyndisplayOperator == 'and'){
3643            isActive = false;
3644            break;
3645          }
3646        }
3647      }
3648      if(!isActive){
3649        break;
3650      }
3651    }
3652
3653    var hasChangedDisplay = false;
3654    
3655    if(type == 'showIf' && !isActive || type == 'hideIf' && isActive){
3656      cE.addClass('wglConditionalFormdata');
3657      if(!cE.hasClass('wglHideConditionalFormdata')){ 
3658        hasChangedDisplay = true;
3659      }
3660      cE.addClass('wglHideConditionalFormdata');
3661      cE.removeClass('wglShowConditionalFormdata');     
3662      cE.find('input, textarea, select').each(function(index){
3663        if(jQuery(this).attr('tabindex') && jQuery(this).attr('tabindex') != -1){
3664          jQuery(this).attr('data-tabindex', jQuery(this).attr('tabindex'));
3665        }
3666
3667        if(typeof(wMaskAutofillIfConditionalHidden) !== 'undefined' && wMaskAutofillIfConditionalHidden && jQuery(this).attr('type') != 'hidden' || typeof(wMaskAutofillIfConditionalHiddenIfTypeHidden) !== 'undefined' && wMaskAutofillIfConditionalHiddenIfTypeHidden && jQuery(this).attr('type') == 'hidden'){        
3668          if(jQuery(this).attr('name')){
3669            jQuery(this).attr('name', jQuery(this).attr('name').replace(/~@~/g, ''));
3670            jQuery(this).attr('name', jQuery(this).attr('name').split('').join('~@~'));
3671          }
3672          if(jQuery(this).attr('id')){          
3673            jQuery(this).attr('id', jQuery(this).attr('id').replace(/~@~/g, ''));
3674            jQuery(this).attr('id', jQuery(this).attr('id').split('').join('~@~'));
3675          }  
3676          if(jQuery(this).attr('placeholder')){
3677            jQuery(this).attr('placeholder', jQuery(this).attr('placeholder').replace(/~@~/g, ''));
3678            jQuery(this).attr('placeholder', jQuery(this).attr('placeholder').split('').join('~@~'));   
3679          }
3680        }                
3681        
3682        if(typeof(wResetConditionalFormdataOnHide) != 'undefined' && wResetConditionalFormdataOnHide){    
3683          if(typeof(jQuery(this).attr('data-valueinit')) !== 'undefined'){
3684            if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio'){
3685              jQuery(this).prop('checked', jQuery(this).data('valueinit') == jQuery(this).attr('value')  ? true : false);
3686            }  
3687            else if(jQuery(this).attr('type') == 'hidden'){
3688              if(typeof(wResetConditionalFormdataOnHideIfTypeHidden) == 'undefined' || wResetConditionalFormdataOnHideIfTypeHidden){                  
3689                if((!jQuery(this).attr('name') || jQuery(this).attr('name').indexOf('wFormToken') == -1) && jQuery(this).attr('id').indexOf('wFormToken') == -1 && (!jQuery(this).attr('id') || jQuery(this).attr('id').indexOf('inputUploader-') == -1)){
3690                  jQuery(this).val(jQuery(this).attr('data-valueinit'));
3691                }
3692              }               
3693            }            
3694            else{             
3695              jQuery(this).val(jQuery(this).attr('data-valueinit'));
3696            }     
3697          }
3698          else if(typeof(jQuery(this).attr('data-valueinittmp')) !== 'undefined'){
3699            if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio'){
3700              jQuery(this).prop('checked', false);
3701            }
3702            else if(jQuery(this).attr('type') == 'hidden'){
3703              if(typeof(wResetConditionalFormdataOnHideIfTypeHidden) == 'undefined' || wResetConditionalFormdataOnHideIfTypeHidden){                  
3704                if((!jQuery(this).attr('name') || jQuery(this).attr('name').indexOf('wFormToken') == -1) && jQuery(this).attr('id').indexOf('wFormToken') == -1 && (!jQuery(this).attr('id') || jQuery(this).attr('id').indexOf('inputUploader-') == -1)){
3705                  jQuery(this).val('');
3706                }
3707              }
3708            }
3709            else{
3710              jQuery(this).val('');         
3711            }
3712          }          
3713          else{
3714            if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio'){
3715              jQuery(this).attr('data-valueinittmp', jQuery(this).prop('checked') ? 'checked' : 'unchecked');
3716              jQuery(this).prop('checked', false);
3717            }
3718            else if(jQuery(this).attr('type') == 'hidden'){
3719              if(typeof(wResetConditionalFormdataOnHideIfTypeHidden) == 'undefined' || wResetConditionalFormdataOnHideIfTypeHidden){                  
3720                if((!jQuery(this).attr('name') || jQuery(this).attr('name').indexOf('wFormToken') == -1) && jQuery(this).attr('id').indexOf('wFormToken') == -1 && (!jQuery(this).attr('id') || jQuery(this).attr('id').indexOf('inputUploader-') == -1)){
3721                  jQuery(this).attr('data-valueinittmp', jQuery(this).val());          
3722                  jQuery(this).val('');
3723                }
3724              }
3725            }
3726            else{
3727              jQuery(this).attr('data-valueinittmp', jQuery(this).val());
3728              jQuery(this).val('');         
3729            }
3730          }
3731        }        
3732        jQuery(this).attr('tabindex', -1);
3733      });     
3734    }
3735    else{
3736      if(!cE.hasClass('wglShowConditionalFormdata')){ 
3737        hasChangedDisplay = true;
3738      }      
3739      cE.addClass('wglConditionalFormdata');
3740      cE.removeClass('wglHideConditionalFormdata');
3741      cE.addClass('wglShowConditionalFormdata');
3742      cE.find('input, textarea, select').each(function(index){
3743        if(jQuery(this).attr('data-tabindex')){
3744          jQuery(this).attr('tabindex', jQuery(this).attr('data-tabindex'));
3745        }
3746        else{
3747          jQuery(this).removeAttr('tabindex');
3748        }       
3749        
3750        if(typeof(wMaskAutofillIfConditionalHidden) !== 'undefined' && wMaskAutofillIfConditionalHidden && jQuery(this).attr('type') != 'hidden' || typeof(wMaskAutofillIfConditionalHiddenIfTypeHidden) !== 'undefined' && wMaskAutofillIfConditionalHiddenIfTypeHidden && jQuery(this).attr('type') == 'hidden'){        
3751          if(jQuery(this).attr('id')){          
3752            jQuery(this).attr('id', jQuery(this).attr('id').replace(/~@~/g, ''));
3753          }
3754          if(jQuery(this).attr('name')){          
3755            jQuery(this).attr('name', jQuery(this).attr('name').replace(/~@~/g, ''));
3756          }  
3757          if(jQuery(this).attr('placeholder')){        
3758            jQuery(this).attr('placeholder', jQuery(this).attr('placeholder').replace(/~@~/g, ''));
3759          }
3760        }  
3761        
3762        if(typeof(jQuery(this).attr('data-valueinittmp')) !== 'undefined'){
3763          if(jQuery(this).attr('type') == 'checkbox' || jQuery(this).attr('type') == 'radio'){ 
3764            if(jQuery(this).attr('data-valueinittmp') === 'checked'){
3765              jQuery(this).prop('checked', true);
3766            }
3767            else if(jQuery(this).attr('data-valueinittmp') === 'unchecked'){
3768              jQuery(this).prop('checked', false);
3769            }
3770          }
3771          else{
3772            jQuery(this).val(jQuery(this).attr('data-valueinittmp'));
3773          }  
3774          jQuery(this).removeAttr('data-valueinittmp');
3775        }
3776        else if(jQuery(this).attr('type') == 'hidden' && (!jQuery(this).attr('name') || jQuery(this).attr('name').indexOf('wFormToken') == -1) && (!jQuery(this).attr('id') || jQuery(this).attr('id').indexOf('inputUploader-') == -1) && typeof(jQuery(this).attr('data-valueinit')) != 'undefined'){
3777          jQuery(this).val(jQuery(this).attr('data-valueinit'));
3778        }                        
3779      });       
3780    }  
3781
3782    if(hasChangedDisplay && callbackJS != ''){
3783      eval('if(typeof('+callbackJS+') == \'function\'){'+callbackJS+'()}');
3784    }
3785    if(cE.closest('form').length != 0){
3786      var currentForm = cE.closest('form');
3787      if(currentForm.attr('data-hasinputstovalidate') == '1'){
3788         currentForm.attr('data-hasinputsinvalid', '0');
3789         currentForm.find('*[data-isinvalid="1"]').each(function(){
3790          if(jQuery(this).closest('.wglHideConditionalFormdata').length == 0){
3791            currentForm.attr('data-hasinputsinvalid', '1');
3792          }
3793        });
3794      } 
3795    }  
3796  });  
3797};
3798
3799wAdaptParallax = function(event){
3800
3801  wUiTmp['lastEventType'] = event ? event.type : '';
3802
3803  wUiTmp['elements-wglParallaxBackground'] = wUiTmp['elements-wglParallaxBackground'] ? wUiTmp['elements-wglParallaxBackground'] : jQuery('.wglParallaxBackground');
3804  wUiTmp['elements-wglParallaxContent']    = wUiTmp['elements-wglParallaxContent'] ? wUiTmp['elements-wglParallaxContent'] : jQuery('.wglParallaxContent');
3805
3806  if(typeof(wEditor) == 'undefined'){
3807   wUiTmp['elements-wglParallaxBackground'].each(function(index){
3808      var cE  = jQuery(this);
3809            
3810      var fixedIfNotSupported = cE.data('parallaxbackgrounddirection') == 'fixedIfNotSupported';
3811      
3812      if(fixedIfNotSupported && !/(iPod|iPhone|iPad)/i.test(navigator.platform)){
3813        return true;
3814      }
3815      
3816      if(wUiTmp['lastEventType'] != 'resize' && cE.data('disableParallax') == '1'){
3817        wUiTmp['adaptParallax'] = false;
3818        return false;
3819      }
3820            
3821      var minWidth = (cE.data('parallaxbackgroundminwidth') && !isNaN(cE.data('parallaxbackgroundminwidth')) ? parseInt(cE.data('parallaxbackgroundminwidth')) : 0);      
3822      var winWidth = wUiTmp['lastWindowWidth'];
3823
3824      if(winWidth < minWidth){
3825        return false;
3826      }      
3827                  
3828      var offsetTop        = parseInt(cE.offset().top);
3829      var offsetTopInit    = 0;
3830      var offsetHeight     = parseInt(cE.outerHeight());
3831      var offsetWidth      = parseInt(cE.outerWidth());
3832      var posInsideTop     = wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] - offsetTop;
3833      var posInsideBottom  = offsetTop + offsetHeight - wUiTmp['lastScrollTop'];
3834      var posTopInside     = wUiTmp['lastScrollTop'] - offsetTop;
3835      var useEdgeOnInit    = cE.data('useedgeoninit') == '1' ? true : false;
3836      var moveMax          = offsetHeight + wUiTmp['lastWindowHeight'];
3837      var backgroundHeight = offsetHeight;
3838      var backgroundWidth  = offsetWidth;
3839      
3840      if(posInsideTop > 0 && posInsideBottom > 0){
3841
3842        var posTopPercentage            = posInsideTop / moveMax;
3843        var posTopPercentageBottom      = posTopInside / (wUiTmp['lastWindowHeight'] - offsetHeight);
3844        var backgroundPositionTop       = 0;
3845        
3846        //console.log(wUiTmp['lastScrollTop'] + ' ' + posTopInside + ' ' + posTopPercentageBottom);
3847        //console.log(posTopPercentage + ' :: ' + posTopPercentageBottom);
3848
3849        var direction         = (cE.data('parallaxbackgrounddirection') ? cE.data('parallaxbackgrounddirection').toLowerCase() : 'bottom');
3850        var factor            = (cE.data('parallaxbackgroundfactor') ? cE.data('parallaxbackgroundfactor'): 0.25);
3851        var offset            = (cE.data('parallaxbackgroundoffset') ? parseFloat(cE.data('parallaxbackgroundoffset')) : 0);
3852        var sizeStart         = (cE.data('parallaxbackgroundsizestart') ? parseFloat(cE.data('parallaxbackgroundsizestart')) : 1);
3853        var sizeEnd           = (cE.data('parallaxbackgroundsizeend') ? parseFloat(cE.data('parallaxbackgroundsizeend')) : 1);        
3854        var parallaxSizeMode  = (cE.data('parallaxbackgroundsizemode') ? cE.data('parallaxbackgroundsizemode') : '');
3855        var parallaxElement   = (cE.data('parallaxbackgroundelement') ? document.getElementById(cE.data('parallaxbackgroundelement')) : null);
3856        var transformSize     = '';
3857        var sizeFactor        = 1;
3858                
3859        if(fixedIfNotSupported && (!cE.data('backgroundHeight') || wUiTmp['hasToAdaptParallax'])){
3860          var hasBackgroundContainer = true;
3861          var elementBackgroundImageContainer = cE.find('.backgroundContainer > div, .backgroundContainer > picture');
3862
3863          if(elementBackgroundImageContainer.length >= 1){
3864
3865            backgroundHeight = jQuery(window).height();
3866            if(elementBackgroundImageContainer.parent().is(":visible")){
3867              elementBackgroundImageContainer.first().css({'position' : 'absolute', 'height' : '100vh'});
3868              cE.data('backgroundHeight', backgroundHeight);
3869            }
3870          }
3871        }        
3872        else if((direction.indexOf('top') != -1 || direction.indexOf('bottom') != -1) && (!cE.data('backgroundHeight') || wUiTmp['hasToAdaptParallax'])){
3873          var hasBackgroundContainer = true;
3874          var elementBackgroundImageContainer = cE.find('.backgroundContainer > div, .backgroundContainer > picture');
3875
3876          if(elementBackgroundImageContainer.length >= 1){
3877
3878            backgroundHeight = (1 + factor) * elementBackgroundImageContainer.parent().height();
3879            if(elementBackgroundImageContainer.parent().is(":visible")){
3880              if(parallaxSizeMode != 'original'){
3881                elementBackgroundImageContainer.first().css({'height' : String(backgroundHeight) + 'px'});
3882              }
3883              cE.data('backgroundHeight', backgroundHeight);
3884            }
3885          }
3886        }
3887        else if((direction.indexOf('left') != -1 || direction.indexOf('right') != -1) && (!cE.data('backgroundWidth') || wUiTmp['hasToAdaptParallax'])){
3888          var hasBackgroundContainer = true;
3889          var elementBackgroundImageContainer = cE.find('.backgroundContainer > div, .backgroundContainer > picture');
3890
3891          if(elementBackgroundImageContainer.length >= 1){
3892
3893            backgroundWidth = (1 + factor) * elementBackgroundImageContainer.parent().width();
3894            if(elementBackgroundImageContainer.parent().is(":visible")){
3895              if(parallaxSizeMode != 'original'){
3896                elementBackgroundImageContainer.first().css({'width' : String(backgroundWidth) + 'px'});
3897              }
3898              cE.data('backgroundWidth', backgroundWidth);
3899            }
3900          }
3901        }        
3902
3903        backgroundHeight = cE.data('backgroundHeight') ? cE.data('backgroundHeight') : backgroundHeight;
3904        backgroundWidth  = cE.data('backgroundWidth') ? cE.data('backgroundWidth') : backgroundWidth;
3905
3906        //console.log(direction);
3907        //console.log(factor + ' / ' + direction + ' / ' + (Math.round(posTopPercentage * 200) / 100));
3908        //console.log(offsetHeight + ' ' + backgroundHeight);
3909
3910        var transform3D = '';
3911        
3912        if(fixedIfNotSupported){
3913          backgroundPositionTop = '' + String(Math.round(posTopInside));
3914          transform3D = 'translate3d(0, ' + String(backgroundPositionTop) + 'px, 0)';
3915        }
3916        else if(direction.indexOf('top') != -1){
3917          posBase       = (backgroundHeight - offsetHeight) * (0.5);
3918          posBaseOffset = (backgroundHeight - offsetHeight) * (0.5 + offset);
3919          posDiff       = (backgroundHeight - offsetHeight) * posTopPercentage - posBase;
3920          posDiff       = posDiff * (offset == 0 ? 1 : (0.5 - offset) * 2);
3921          pos           = posBaseOffset + posDiff;
3922          backgroundPositionTop = '-' + String(Math.round(pos));
3923          transform3D = 'translate3d(0, ' + String(backgroundPositionTop) + 'px, 0)' ;         
3924        }
3925        else if(direction.indexOf('bottom') != -1 || direction == ''){
3926          posBase       = (backgroundHeight - offsetHeight) * (0.5 - 1);
3927          posBaseOffset = (backgroundHeight - offsetHeight) * (0.5 - 1 + offset);
3928          posDiff       = (backgroundHeight - offsetHeight) * (posTopPercentage - 1) - posBase;
3929          posDiff       = posDiff * (offset == 0 ? 1 : (0.5 - offset) * 2);
3930          pos           = posBaseOffset + posDiff;
3931          backgroundPositionTop = '' + String(Math.round(pos));
3932          transform3D = 'translate3d(0, ' + String(backgroundPositionTop) + 'px, 0)';          
3933        }
3934        else if(direction.indexOf('right') != -1){
3935          posBase       = (backgroundWidth - offsetWidth) * (0.5 - 1);
3936          posBaseOffset = (backgroundWidth - offsetWidth) * (0.5 - 1 + offset);
3937          posDiff       = (backgroundWidth - offsetWidth) * (posTopPercentage - 1) - posBase;
3938          posDiff       = posDiff * (offset == 0 ? 1 : (0.5 - offset) * 2);
3939          pos           = posBaseOffset + posDiff;
3940          backgroundPositionLeft = '' + String(Math.round(pos));
3941          transform3D = 'translate3d(' + String(backgroundPositionLeft) + 'px, 0, 0)';          
3942        }
3943        else if(direction.indexOf('left') != -1){
3944          posBase       = (backgroundWidth - offsetWidth) * (0.5);
3945          posBaseOffset = (backgroundWidth - offsetWidth) * (0.5 + offset);
3946          posDiff       = (backgroundWidth - offsetWidth) * (posTopPercentage) - posBase;
3947          posDiff       = posDiff * (offset == 0 ? 1 : (0.5 - offset) * 2);
3948          pos           = -(posBaseOffset + posDiff);
3949          backgroundPositionLeft = '' + String(Math.round(pos));
3950          transform3D = 'translate3d(' + String(backgroundPositionLeft) + 'px, 0, 0)';          
3951        }               
3952                  
3953        transformSize = '';
3954        
3955        if(sizeStart > 1){
3956          sizeFactor = posTopPercentage - 1;
3957          contentSize = ((1 - sizeStart) * sizeFactor) + sizeStart;
3958          transformSize = ' scale(' + String(contentSize) + ')';
3959        }
3960        else if(sizeEnd > 1){
3961          sizeFactor = posTopPercentage;
3962          contentSize = sizeStart + (sizeEnd - sizeStart) * posTopPercentage;          
3963          transformSize = ' scale(' + String(contentSize) + ')';
3964        }     
3965                
3966        parallaxElement = cE.find('.backgroundContainer > div, .backgroundContainer > picture');
3967        
3968        if(parallaxElement.length >= 1){
3969          if((direction.indexOf('left') != -1 || direction.indexOf('right') != -1) && parallaxElement.first().height() === 0){
3970            parallaxElement.first().css({'height' : '100%', 'transform' : transform3D});            
3971          }  
3972          else{
3973            parallaxElement.first().css({'transform' : transform3D});            
3974          }
3975        }
3976        
3977        if(transformSize != ''){
3978          parallaxElement = cE.find('.backgroundContainer');
3979
3980          if(parallaxElement.length >= 1){
3981            parallaxElement.first().css({'transform' : transformSize});
3982          }   
3983        }
3984      }
3985    });    
3986
3987    wUiTmp['elements-wglParallaxContent'].each(function(index){
3988      var cE  = jQuery(this);
3989      
3990      if(wUiTmp['lastEventType'] != 'resize' && cE.data('disableParallax') == '1'){
3991        wUiTmp['adaptParallax'] = false;
3992        return false;
3993      }
3994      
3995      var minWidth = (cE.data('parallaxcontentminwidth') && !isNaN(cE.data('parallaxcontentminwidth')) ? parseInt(cE.data('parallaxcontentminwidth')) : 0);      
3996      var winWidth = wUiTmp['lastWindowWidth'];
3997
3998      if(typeof(winWidth) == 'undefined' || winWidth < minWidth){
3999        return false;
4000      }      
4001            
4002      var offsetTop        = parseInt(cE.parent().offset().top);
4003      var offsetTopInit    = 0;
4004      var offsetHeight     = parseInt(cE.outerHeight());
4005      var offsetWidth      = parseInt(cE.outerWidth());
4006      var posInsideTop     = wUiTmp['lastScrollTop'] + wUiTmp['lastWindowHeight'] - offsetTop;
4007      var posInsideBottom  = offsetTop + offsetHeight - wUiTmp['lastScrollTop'];
4008      var posTopInside     = wUiTmp['lastScrollTop'] - offsetTop;
4009      var useEdgeOnInit    = cE.data('useedgeoninit') == '1' ? true : false;
4010      var moveMax          = offsetHeight + wUiTmp['lastWindowHeight'];
4011      var backgroundHeight = offsetHeight;
4012      var elementHeight    = offsetHeight;    
4013      
4014      if(offsetHeight == 0){
4015        return false;
4016      }
4017      
4018      if(posInsideTop > 0 && posInsideBottom > 0){
4019
4020        var posTopPercentage            = posInsideTop / moveMax;
4021        var posTopPercentageBottom      = posTopInside / (wUiTmp['lastWindowHeight'] - offsetHeight);
4022        var contentPositionTop          = 0;
4023
4024        //console.log(wUiTmp['lastScrollTop'] + ' ' + posTopInside + ' ' + posTopPercentageBottom);
4025        //console.log(posTopPercentage + ' :: ' + posTopPercentageBottom);
4026
4027        var direction         = (cE.data('parallaxcontentdirection') ? cE.data('parallaxcontentdirection').toLowerCase() : 'bottom');
4028        var directionElement  = (cE.data('parallaxcontentdirectionelement') ? cE.data('parallaxcontentdirectionelement').toLowerCase() : '');
4029        var factor            = (cE.data('parallaxcontentfactor') ? cE.data('parallaxcontentfactor') * 2 : 0.5);
4030        var start             = (cE.data('parallaxcontentstart') ? cE.data('parallaxcontentstart'): 0);
4031        var end               = (cE.data('parallaxcontentend') ? cE.data('parallaxcontentend'): 1);
4032        var sizeStart         = (cE.data('parallaxcontentsizestart') ? parseFloat(cE.data('parallaxcontentsizestart')) : 1);
4033        var sizeEnd           = (cE.data('parallaxcontentsizeend') ? parseFloat(cE.data('parallaxcontentsizeend')) : 1);
4034        var opacityStart      = (cE.data('parallaxcontentopacitystart') ? parseFloat(cE.data('parallaxcontentopacitystart')) : 1);
4035        var opacityEnd        = (cE.data('parallaxcontentopacityend') ? parseFloat(cE.data('parallaxcontentopacityend')) : 1);
4036        var timingfunction    = (cE.data('parallaxcontenttiminfunction') ? cE.data('parallaxcontenttiminfunction'): '');
4037        var transformSize     = '';
4038        var sizeFactor        = 1;
4039                
4040        //(cE.data('parallaxcontentoffset') ? parseFloat(cE.data('parallaxcontentoffset')) : 0);
4041        backgroundHeight      = offsetHeight * 2;
4042                
4043        //console.log((Math.round(posTopPercentage * 100) / 100) + '% ' + start + ' ' + end);
4044        
4045        if(posTopPercentage >= start && posTopPercentage <= end){
4046          
4047          var posTopPercentageRel  = posTopPercentage - end;
4048          var posSizePercentageRel = posTopPercentage - end;
4049          
4050          if(directionElement == 'from'){
4051            posTopPercentageRel  = (1 + posTopPercentageRel * 1 + posTopPercentageRel) + (1 - 2 * start);
4052            posSizePercentageRel = (1 + posSizePercentageRel * 1 + posSizePercentageRel) + (1 - 2 * start);
4053          }
4054          else if(directionElement == 'to'){
4055            posTopPercentageRel = (1 + posTopPercentageRel * 1 + posTopPercentageRel) - (1 - 2 * start);
4056            posSizePercentageRel = (1 + posSizePercentageRel * 1 + posSizePercentageRel) - (1 - 2 * start);       
4057          }          
4058          else{
4059            posTopPercentageRel = (1 + posTopPercentageRel * 1 + posTopPercentageRel);   
4060            posSizePercentageRel = (1 + posSizePercentageRel * 1 + posSizePercentageRel);            
4061          }
4062                                                            
4063          posTopPercentageRelOrig = posTopPercentageRel
4064
4065          expo = 0;
4066
4067          if(timingfunction != '' && timingfunction != 'linear'){
4068            if(timingfunction == 'easeInExpo'){
4069              expo = 1 + 0.5;
4070            }
4071            else if(timingfunction == 'easeOutExpo'){
4072              expo = 1 / (1 + 0.5); 
4073            } 
4074            else if(/expo\(([^\)]*)\)/.test(timingfunction)){
4075              expo = RegExp.$1;
4076              if(expo < 0){
4077                expo = 1 / (1 - expo);
4078              }
4079            }
4080          }
4081
4082          if(expo > 0){
4083            if(posTopPercentageRel < 0){
4084              posTopPercentageRel = -Math.pow(-posTopPercentageRel, expo); 
4085            }
4086            else{                
4087              posTopPercentageRel = Math.pow(posTopPercentageRel, expo);
4088            }
4089          }
4090          
4091          pos = elementHeight * posTopPercentageRel * factor;
4092          
4093          transformSize   = '';
4094          parallaxOpacity = '';
4095          sizeFactor    = posSizePercentageRel;          
4096          opacityFactor = posSizePercentageRel;     
4097                    
4098          if(sizeStart < 1 || sizeStart > 1){
4099            contentSize = ((1 - sizeStart) * sizeFactor) + sizeStart;
4100            transformSize = ' scale(' + String(Math.max(0, contentSize)) + ')';
4101          }
4102          else if(sizeEnd < 1 || sizeEnd > 1){
4103            contentSize = ((sizeEnd - 1) * sizeFactor) + sizeStart;
4104            transformSize = ' scale(' + String(Math.max(0, contentSize)) + ')';
4105          }  
4106                              
4107          if(opacityStart < 1 || opacityStart > 1){
4108            parallaxOpacity = String(((1 - opacityStart) * opacityFactor) + opacityStart);
4109            cE.css({'opacity' : parallaxOpacity});            
4110          }
4111          else if(opacityEnd < 1 || opacityEnd > 1){
4112            parallaxOpacity = String(((opacityEnd - 1) * opacityFactor) + opacityStart);            
4113            cE.css({'opacity' : parallaxOpacity});            
4114          }  
4115                    
4116          if(direction.indexOf('top') != -1){     
4117            contentPositionTop = -Math.round(pos);       
4118            cE.css({'transform' : 'translate(0, ' + String(contentPositionTop) + 'px)' + transformSize});
4119          }
4120          else if(direction.indexOf('bottom') != -1 || direction == ''){           
4121            contentPositionTop = Math.round(pos);
4122            cE.css({'transform' : 'translate(0, ' + String(contentPositionTop) + 'px)' + transformSize});
4123          }
4124          else if(direction.indexOf('right') != -1){     
4125            contentPositionTop = Math.round(pos);       
4126            cE.css({'transform' : 'translate(' + String(contentPositionTop) + 'px, 0)' + transformSize});
4127          }
4128          else if(direction.indexOf('left') != -1 || direction == ''){           
4129            contentPositionTop = -Math.round(pos);
4130            cE.css({'transform' : 'translate(' + String(contentPositionTop) + 'px , 0)' + transformSize});
4131          }
4132          else if(direction.indexOf('none') != -1 && transformSize != ''){     
4133            cE.css({'transform' : transformSize});
4134          }             
4135        }
4136        else if(directionElement == 'from' && start > 0 && posTopPercentage < start && (direction.indexOf('left') != -1 || direction.indexOf('right') != -1)){
4137          cE.css({'transform' : 'translate(' + String(0) + 'px, 0)'});             
4138        }          
4139        else if(directionElement == 'from' && start > 0 && posTopPercentage < start){
4140          cE.css({'transform' : 'translate(0, ' + String(0) + 'px)'});             
4141        }  
4142        else if(start > 0 && posTopPercentage < start){
4143          if(directionElement == 'from' && (direction.indexOf('left') != -1 || direction.indexOf('right') != -1)){
4144            cE.css({'transform' : 'translate(' + String(0) + 'px, 0)'});   
4145            return;
4146          }
4147          else if(directionElement == 'from'){
4148            cE.css({'transform' : 'translate(0, ' + String(0) + 'px)'});   
4149            return;
4150          }          
4151          else{
4152            posTopPercentageRel = -2 * (end - start);
4153            pos                 = elementHeight * posTopPercentageRel * factor;
4154          }
4155          
4156          if(direction.indexOf('top') != -1){     
4157            contentPositionTop = -Math.round(pos);   
4158            cE.css({'transform' : 'translate(0, ' + String(contentPositionTop) + 'px)'});            
4159          }
4160          else if(direction.indexOf('bottom') != -1 || direction == ''){           
4161            contentPositionTop = Math.round(pos);
4162            cE.css({'transform' : 'translate(0, ' + String(contentPositionTop) + 'px)'});            
4163          }
4164          else if(direction.indexOf('right') != -1){     
4165            contentPositionTop = Math.round(pos);
4166            cE.css({'transform' : 'translate(' + String(contentPositionTop) + 'px, 0)'});
4167          }
4168          else if(direction.indexOf('left') != -1 || direction == ''){           
4169            contentPositionTop = -Math.round(pos);
4170            cE.css({'transform' : 'translate(' + String(contentPositionTop) + 'px , 0)'});
4171          }    
4172        }
4173        else if(cE.length >= 1){  
4174          cE.css({'transform' : 'translate(0, ' + String(0) + 'px)'});   
4175        }          
4176      }    
4177    });
4178  }
4179  
4180  wUiTmp['hasInitParallax'] = true;
4181  wUiTmp['adaptParallax']   = false;
4182};
4183
4184wGetScrollTopDiff = function(options){
4185
4186  var offsetTopFixed = 0;
4187
4188  if(typeof(getOffsetTopFixed) === 'function'){
4189    offsetTopFixed = getOffsetTopFixed(options);
4190    if(isNaN(offsetTopFixed)){
4191      if(jQuery('#blockHeader').length > 0 && jQuery('#blockHeader').css('position') == 'fixed'){
4192        offsetTopFixed = jQuery('#blockHeader').height() + jQuery('#blockHeader').offset().top - wUiTmp['lastScrollTop'];
4193      }
4194      else{
4195        offsetTopFixed = 0;
4196      }
4197    }
4198  }
4199  else if(jQuery('#blockHeader').length > 0 && jQuery('#blockHeader').css('position') == 'fixed'){
4200    var transformTop = 0;
4201    if(/(\-?\w+(?:\.\w+)?)\)/.test(jQuery('#blockHeader').css('transform'))){
4202      transformTop = parseInt(RegExp.$1);
4203    }  
4204    offsetTopFixed = jQuery('#blockHeader').height() + jQuery('#blockHeader').offset().top - transformTop - wUiTmp['lastScrollTop'];    
4205  }
4206  return offsetTopFixed;
4207};
4208
4209wScrollSmoothToTarget = function(element, event){
4210
4211  var id, offsetTopFixed = 0, targetName, elementTarget, scrollTop;
4212
4213  var href = element.getAttribute('href');
4214  
4215  if(!href || href == '#' || href == '#wEmpty'){
4216    return false;
4217  }
4218  else if(element.href && element.href.replace && element.href.replace(/#[\S\s]*$/, '') != location.href.replace(/#[\S\s]*$/, '')){    
4219    return true;
4220  }
4221  else if(/(#.*)/.test(href)){
4222    targetName = RegExp.$1;
4223    targetSelector = targetName.replace(/\./, '\\.');
4224    elementTarget = jQuery(targetSelector);
4225
4226    if(elementTarget.length == 0){
4227      targetSelector = "a[name='" + targetName.replace('#', '') + "']";
4228      elementTarget = jQuery(targetSelector);
4229    }
4230    
4231    if(elementTarget.length == 0){
4232      return;
4233    }
4234    
4235    if(jQuery('.fullpage-wrapper').length != 0){
4236      var currentSection = jQuery(elementTarget).closest('.fp-section');
4237      if(currentSection.length != 0){
4238        event.stopPropagation();
4239        event.preventDefault();
4240        var anchorLink = 'fpa-' + String(currentSection.prevAll('.fp-section').length);
4241        currentSection.attr('data-anchor', anchorLink);   
4242        jQuery.fn.fullpage.moveTo(anchorLink);      
4243        jQuery(window).trigger('resize');
4244        return false;       
4245      }   
4246    }
4247
4248    var currentTimestamp = new Date().getTime();
4249    if(elementTarget.length > 0 && !element.getAttribute('data-lct') || element.getAttribute('data-lct') < currentTimestamp - 320){
4250
4251      if(typeof(wOnBeforeScrollSmoothToTarget) === 'function'){
4252        var rtc = wOnBeforeScrollSmoothToTarget(elementTarget);
4253        if(rtc === false){
4254          return false;
4255        }
4256      }          
4257
4258      element.setAttribute('data-lct', currentTimestamp);
4259      event.preventDefault();
4260      jQuery(element).parent().parent().find('li').removeClass('selected');
4261      jQuery(element).parent().addClass('selected');
4262
4263      try{
4264        jQuery('body, html').stop(true, true);
4265        scrollDuration = parseInt(element.getAttribute('data-scrollsmoothtotargetduration') ? element.getAttribute('data-scrollsmoothtotargetduration') : 400);
4266        window.setTimeout(function(){
4267          var scrollTopDiff = wGetScrollTopDiff();
4268          var hasContainerInsideTopOnScroll = jQuery('.wglContainerInsideTopOnScroll *').length; 
4269          var timeoutToAdaptAfterScrollSmoothToTarget = typeof wTimeoutToAdaptAfterScrollSmoothToTarget != 'undefined' ? wTimeoutToAdaptAfterScrollSmoothToTarget : 16;
4270          wUiTmp['scrollingAuto'] = element.getAttribute('data-scrollingauto') == 'no' ? false : true;        
4271          jQuery('body, html').animate({scrollTop: elementTarget.offset().top - scrollTopDiff}, {duration: scrollDuration}).promise().done(function(){             
4272            if(hasContainerInsideTopOnScroll != jQuery('.wglContainerInsideTopOnScroll *').length){
4273              var scrollTopDiff = wGetScrollTopDiff(); 
4274              jQuery('body, html').animate({scrollTop: elementTarget.offset().top - scrollTopDiff}, {duration: scrollDuration}).promise().done(function(){            
4275                window.setTimeout(function(){
4276                  wUiTmp['scrollingAuto'] = false;
4277                  if(!(element.getAttribute('data-preventpushstate') == '1')){
4278                    history.pushState(null, null, targetName);
4279                    jQuery(window).trigger('hashchange');
4280                  }
4281                  if(typeof(wOnAfterScrollSmoothToTarget) === 'function'){
4282                    wOnAfterScrollSmoothToTarget(elementTarget);
4283                  }
4284                  jQuery(window).trigger('resize');
4285                }, timeoutToAdaptAfterScrollSmoothToTarget);
4286              });                        
4287            }
4288            else{
4289              window.setTimeout(function(){
4290                wUiTmp['scrollingAuto'] = false;
4291                if(!(element.getAttribute('data-preventpushstate') == '1')){
4292                  history.pushState(null, null, targetName);
4293                  jQuery(window).trigger('hashchange');
4294                }          
4295                if(typeof(wOnAfterScrollSmoothToTarget) === 'function'){
4296                  wOnAfterScrollSmoothToTarget(elementTarget);
4297                }              
4298                jQuery(window).trigger('resize');
4299              }, timeoutToAdaptAfterScrollSmoothToTarget);
4300            }
4301          });
4302        }, 10);
4303        return false;
4304      }
4305      catch(e){}
4306    }
4307  }
4308};
4309
4310wScrollSmoothToElement = function(elementTarget, options){
4311  
4312  var id, offsetTopFixed, scrollTop;
4313
4314  options = options || {};
4315  
4316  elementTarget = jQuery(elementTarget);
4317  if(elementTarget.attr('data-scrollelement') == 'no'){
4318    return false;
4319  }
4320  
4321  if( typeof( wScrollSmoothToElementForceScroll ) != 'undefined' && wScrollSmoothToElementForceScroll === false ){
4322    return true;
4323  }
4324  
4325  if(jQuery('.fullpage-wrapper').length != 0){
4326    var currentSection = jQuery(elementTarget).closest('.fp-section');
4327    if(currentSection.length != 0){
4328      //event.stopPropagation();
4329      //event.preventDefault();
4330      var anchorLink = 'fpa-' + String(currentSection.prevAll('.fp-section').length);
4331      currentSection.attr('data-anchor', anchorLink);   
4332      jQuery.fn.fullpage.moveTo(anchorLink);   
4333      if(typeof(wOnAfterScrollSmoothToElement) === 'function'){
4334        wOnAfterScrollSmoothToElement(elementTarget);
4335      }      
4336      jQuery(window).trigger('resize');
4337      return false;       
4338    }   
4339  }
4340  
4341  var currentTimestamp = new Date().getTime();
4342
4343  if(elementTarget.length > 0 && !elementTarget.attr('data-lct') || elementTarget.attr('data-lct') < currentTimestamp - 320){
4344    elementTarget.attr('data-lct', currentTimestamp);
4345
4346    try{
4347      jQuery('body, html').stop(true, true);
4348      scrollDuration = parseInt(elementTarget.attr('data-scrollsmoothtotargetduration') ? elementTarget.attr('data-scrollsmoothtotargetduration') : 400);
4349
4350      var scrollTopDiff = typeof(options['scrollTopDiff']) != 'undefined' ? options['scrollTopDiff'] : wGetScrollTopDiff();
4351      
4352      if(typeof(options['scrollTopOffset']) != 'undefined'){
4353        scrollTopDiff += options['scrollTopOffset'];
4354      }
4355      else if(jQuery('html').is('[data-offsetscrollsmoothtoelement]') && jQuery('html').attr('data-offsetscrollsmoothtoelement') != ''){
4356        if(scrollTopDiff === 0) scrollTopDiff = parseInt(jQuery('html').attr('data-offsetscrollsmoothtoelement'));
4357        else scrollTopDiff -= parseInt(jQuery('html').attr('data-offsetscrollsmoothtoelement'));
4358      }
4359
4360      var visibleMin    = document.body.scrollTop + scrollTopDiff;
4361      var visibleMax    = document.body.scrollTop + wUiTmp['lastWindowHeight'];
4362      var posTopElement = elementTarget.offset().top;
4363
4364      if((typeof(wScrollSmoothToElementForceScroll) == 'undefined' || !wScrollSmoothToElementForceScroll) && (typeof(options['forceScroll']) == 'undefined' || !options['forceScroll']) && posTopElement > visibleMin && posTopElement < visibleMax){
4365        return true;
4366      }
4367
4368      wUiTmp['scrollingAuto'] = typeof(options['scrollingAuto']) != 'undefined' ? options['scrollingAuto'] : true;
4369      jQuery('body, html').animate({scrollTop: elementTarget.offset().top - scrollTopDiff}, {duration: scrollDuration, 'easing' : typeof(wScrollSmoothToElementEasing) != 'undefined' && wScrollSmoothToElementEasing != '' ? wScrollSmoothToElementEasing : 'swing', complete: function(){
4370        window.setTimeout(function(){
4371          if(options['setFocusAfterScrolling'] != null && !wUiTmp['scrollingAuto'] && typeof(wAccessibility) !== 'undefined' && wAccessibility['accessEventHandler'] != null && wAccessibility['accessEventHandler'].active){
4372            wAccessHandler.setFocusToCurElement(elementTarget);
4373          };
4374          wUiTmp['scrollingAuto'] = false;
4375          //history.pushState(null, null, targetName);
4376          jQuery(window).trigger('resize');
4377        }, 16);
4378      }});
4379      return false;
4380    }
4381    catch(e){console.log(e)}
4382  }
4383};
4384
4385wAddIsOnDarkBackground = function(element){
4386
4387  if(jQuery(element).hasClass('isLightBackground')){
4388    jQuery(element).data('wasLightBackground', '1');
4389    jQuery(element).removeClass('isLightBackground');
4390  }
4391  jQuery(element).addClass('isDarkBackground');
4392};
4393
4394wRemoveIsOnDarkBackground = function(element){
4395
4396  if(jQuery(element).data('wasLightBackground') == '1'){
4397    jQuery(element).addClass('isLightBackground')
4398  }
4399  jQuery(element).removeClass('isDarkBackground');
4400};
4401
4402wAddIsOnLightBackground = function(element){
4403
4404  if(jQuery(element).hasClass('isDarkBackground')){
4405    jQuery(element).data('wasDarkBackground', '1');
4406    jQuery(element).removeClass('isDarkBackground');
4407  }
4408  jQuery(element).addClass('isLightBackground');
4409};
4410
4411wRemoveIsOnLightBackground = function(element){
4412
4413  if(jQuery(element).data('wasDarkBackground') == '1'){
4414    jQuery(element).addClass('isDarkBackground')
4415  }
4416  jQuery(element).removeClass('isLightBackground');
4417};
4418
4419wHasWebpSupport = function(callback){
4420  
4421  if(typeof(callback) === 'function'){
4422    var hw = false;    
4423    if(/(Firefox|Chrome)\/(\d+)/.test(navigator.userAgent)){
4424      var bt = RegExp.$1;
4425      var bv = RegExp.$2;
4426      if(bt == 'Firefox' && bv >= 65){
4427        hw = true;
4428      }
4429      else if(bt == 'Chrome' && bv >= 25){
4430        hw = true;
4431      }      
4432    }
4433    if(hw){
4434      wUiTmp['hasWebpSupport'] = 'y';
4435      callback();
4436      return false;
4437    }
4438  }  
4439
4440  if(wUiTmp['hasWebpSupport']){
4441    return wUiTmp['hasWebpSupport'] == 'y';
4442  }
4443 
4444  var im = new Image();
4445  
4446  im.onload = function(){
4447    wUiTmp['hasWebpSupport'] = (im.width == 1 ? 'y' : 'n');
4448  };
4449  
4450  im.onerror = function(){
4451    wUiTmp['hasWebpSupport'] = 'n';
4452  };  
4453  
4454  im.src = 'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=';
4455  
4456  if(typeof(callback) === 'function'){
4457    window.setTimeout(function(){
4458      callback();
4459    }, 32);
4460  }
4461  return false;
4462};
4463
4464wProcessPictureZoomer = function(){
4465    
4466  jQuery('.pictureZoomer').each(function(index){ 
4467           
4468    if(typeof(wMinEnlargementToShowPictureZoomer) == 'undefined' || wMinEnlargementToShowPictureZoomer <= 1){
4469      jQuery(this).show();
4470    } 
4471    else if(jQuery(this).hasClass('pictureZoomerNotEqual')){
4472      jQuery(this).show();
4473    }
4474    else{
4475      if(jQuery(this).parent().width() > 0 && jQuery(window).width() / jQuery(this).parent().width() >= wMinEnlargementToShowPictureZoomer){
4476        jQuery(this).next('.picture').removeAttr('data-isinactivelightbox');
4477        jQuery(this).show();
4478      }
4479      else{
4480        jQuery(this).hide();
4481        jQuery(this).next('.picture').attr('data-isinactivelightbox', '1');
4482      }
4483    }  
4484  });  
4485  
4486  /*Barrierefreiheit*/
4487  jQuery('span.pictureZoomer ~ picture').on('keyup', function(e){
4488    var cE = jQuery(this);
4489    var zE = cE.prev('span.pictureZoomer');
4490    zE.attr('tabindex', 0);
4491    cE.on('blur', function(e){ 
4492      zE.focus(); 
4493      cE.attr('tabindex', -1); 
4494    })
4495    zE.on('blur', function(e){
4496      cE.attr('tabindex', 0);
4497    });
4498    zE.on('keyup', function(e){
4499      if(e.keyCode == 13){
4500        cE.trigger('click');  
4501      }
4502      e.stopImmediatePropagation();
4503    });
4504    e.stopImmediatePropagation();
4505  });
4506};
4507
4508jQuery.fn.wOptimizePictureSizes = function(){
4509  jQuery.each(jQuery(this), function(){  
4510    wOptimizePictureSizes(jQuery(this));
4511  });
4512};
4513
4514wOptimizePictureSizes = function(cO){
4515  //console.log('wOptimizePictureSizes');
4516    
4517  if(!wUiTmp['hasWebpSupport']){
4518    wHasWebpSupport(function(c0){wOptimizePictureSizes(c0)});
4519    return false;
4520  }
4521
4522  if(typeof cO === 'undefined'){
4523    cO = jQuery('body');
4524  }
4525  
4526  var cORespData = cO.find("div[data-responsivebackground]");
4527  cORespData.each(function(){
4528    var cE = jQuery(this);
4529
4530    if(cE.data('backgroundimagewebp') && wHasWebpSupport()){
4531      cE.data('backgroundimage', cE.data('backgroundimagewebp'));
4532    }
4533    if(cE.data('backgroundimagewebpmin') && wHasWebpSupport()){
4534      cE.data('backgroundimagemin', cE.data('backgroundimagewebpmin'));
4535    }  
4536        
4537    var cEWidth = cE.width();
4538    var responsiveBackgroundMinWidth = cE.data('responsivebackgroundminwidth') ? cE.data('responsivebackgroundminwidth') : 768;
4539    var minwidthVisible = cE.data('minwidthvisible') ? cE.data('minwidthvisible') : 0;
4540    
4541    if(cEWidth > minwidthVisible && cE.data('backgroundimage') && cEWidth >
4541= responsiveBackgroundMinWidth){
4542      cE.css({'background-image': 'url("' + cE.data('backgroundimage') + '")'});
4543    }
4544    else if(cEWidth > minwidthVisible && cE.data('backgroundimagemin')){
4545      cE.css({'background-image': 'url("' + cE.data('backgroundimagemin') + '")'});
4546    }
4547    else if(cEWidth > minwidthVisible && cE.data('backgroundimage')){
4548      cE.css({'background-image': 'url("' + cE.data('backgroundimage') + '")'});
4549    }    
4550  });
4551
4552  var cOImgData  = cO.find("img[data-src2x]:not(.wglLazyLoadInit), img.wglLazyLoad:not(.wglLazyLoadInit)");  
4553  cOImgData.each(function(){
4554    var currentImg   = jQuery(this);
4555    var offsetTop    = parseInt(currentImg.offset().top);
4556    var srcMin       = currentImg.data('srcmin') ? currentImg.data('srcmin') : '';
4557    var widthCurrent = parseInt(currentImg.width());
4558    var attrWidthCur = parseInt(typeof(currentImg.attr('width')) != 'undefined' ? currentImg.attr('width') : 0);
4559    var widthMin     = parseInt(srcMin.replace(/.*@min/, '').replace(/\..*/, ''));
4560
4561    if(currentImg.attr('data-maxwidthifinvisible') && currentImg.attr('data-maxwidthifinvisible') > widthCurrent){
4562      widthCurrent = currentImg.attr('data-maxwidthifinvisible');
4563    }
4564
4565    //console.log(widthCurrent + ' < ' + widthMin);
4566
4567    if(devicePixelRatio >= hdLimitDpr && typeof(currentImg.attr('data-src2x')) != 'undefined' && currentImg.attr('data-src2x') != '' && attrWidthCur < widthCurrent * 2 && currentImg.attr('data-ishd') != '1'){
4568      currentImg.attr('src', currentImg.data('src2x')).attr('data-ishd', '1');
4569    }
4570    else if(typeof(currentImg.attr('data-src2x')) != 'undefined' && currentImg.attr('data-src2x') != '' && attrWidthCur < widthCurrent && currentImg.attr('data-ishd') != '1'){
4571      currentImg.attr('src', currentImg.data('src2x')).attr('data-ishd', '1');
4572    }
4573    else if(typeof(currentImg.attr('data-srcmin')) != 'undefined' && currentImg.attr('data-srcmin') != '' && widthCurrent < widthMin && widthMin < attrWidthCur && currentImg.attr('data-ishd') != '1' && currentImg.attr('data-isld') != '1'){
4574      if(typeof(currentImg.attr('src')) != 'undefined' && currentImg.attr('src').indexOf('data:image') == 0 && currentImg.attr('data-ismin') != '1'){
4575        currentImg.attr('src', currentImg.data('srcmin')).attr('data-ismin', '1');
4576      }
4577    }
4578    else if(typeof(currentImg.attr('data-src')) != 'undefined' && currentImg.attr('data-src') != '' && currentImg.attr('data-ishd') != '1' && currentImg.attr('data-isld') != '1'){
4579      currentImg.attr('src', currentImg.data('src')).attr('data-isld', '1');
4580    }
4581  });
4582};
4583
4584wProcessWglExpandToParent = function(){
4585
4586  jQuery('.wglExpandToParent').each(function(index){
4587
4588    var cE = jQuery(this);
4589    cE.css('height', '');
4590  });
4591
4592  jQuery('.wglExpandToParent').each(function(index){
4593
4594    var cE = jQuery(this);
4595    var height         = cE.parent().height();
4596    cE.css('height', String(height) + 'px');
4597  });
4598};
4599
4600wProcessWglAdjustHeightMax = function(){
4601
4602  jQuery('.wglAdjustHeightMax').each(function(index){
4603
4604    var cE = jQuery(this);
4605    var offsetLeft     = 0;
4606    var offsetLeftLast = 0;
4607    var maxHeight      = 0;
4608    var adjust         = true;
4609    var positionCol    = 0;
4610    var childsToAdapt  = new Array();
4611    var numberChilds   = 0;
4612    var subElement     = null;
4613    var elementHeight  = 0;
4614
4615    cE.children('*').each(function(index){
4616      var className = jQuery(this).attr('class') || '';
4617      if(className.toLowerCase().indexOf('clear') == -1 && className.toLowerCase().indexOf('editor') == -1 && className.toLowerCase().indexOf('listentryquickfilterinvisible') == -1){
4618        numberChilds++;
4619      }
4620    });
4621
4622    cE.children('*').each(function(index){
4623      subElement    = jQuery(this);
4624      var className = jQuery(this).attr('class') || '';
4625
4626      if(className.toLowerCase().indexOf('clear') == -1 && className.toLowerCase().indexOf('editor') == -1 && className.toLowerCase().indexOf('listentryquickfilterinvisible') == -1){
4627        if(jQuery(this).data('wHasSetHeightToAjustHeightMax') == '1'){
4628          jQuery(this).css({'height' : ''});
4629        }
4630
4631        offsetLeft = jQuery(this).get(0).offsetLeft - (jQuery(this).parent().css('position') == 'relative' ? 0 : jQuery(this).get(0).parentNode.offsetLeft);
4632
4633        if(index > 0 && (offsetLeft == 0 || offsetLeft <= offsetLeftLast) && jQuery(this).css('position') != 'absolute'){
4634          if(positionCol == 1){
4635            childsToAdapt = new Array();
4636            maxHeight = 0;
4637          }
4638          positionCol = 0;
4639          if(offsetLeft <= offsetLeftLast){
4640            offsetLeft = 0;
4641          }
4642        }
4643
4644        positionCol++;
4645
4646        //console.log(index + ' ' + positionCol + ' ' + numberChilds);
4647
4648        elementHeight = subElement.css('box-sizing') == 'border-box' ? subElement.outerHeight() : subElement.height();
4649
4650        if(index + 1 == numberChilds && positionCol > 1){
4651          maxHeight = elementHeight > maxHeight ? elementHeight : maxHeight;
4652          childsToAdapt.push(jQuery(this));
4653        }
4654        
4655        if(childsToAdapt.length > 1 && (index > 0 && positionCol == 1 || index + 1 == numberChilds)){     
4656          for(i = 0; i < childsToAdapt.length; i++){
4657            childToAdapt = childsToAdapt[i];
4658            var className = childToAdapt.attr('class') || '';
4659            if(className.toLowerCase().indexOf('clear') == -1 && className.toLowerCase().indexOf('editor') == -1 && className.toLowerCase().indexOf('listentryquickfilter
4659invisible') == -1){
4660              childToAdapt.css({'height' : maxHeight});
4661              childToAdapt.data('wHasSetHeightToAjustHeightMax', '1');
4662            }
4663          }
4664          childsToAdapt = new Array();
4665          
4666          if(index + 1 == numberChilds){
4667            childToAdapt = subElement;
4668            var className = childToAdapt.attr('class') || '';
4669            if(className.toLowerCase().indexOf('clear') == -1 && className.toLowerCase().indexOf('editor') == -1 && className.toLowerCase().indexOf('listentryquickfilterinvisible') == -1){
4670              childToAdapt.css({'height' : (positionCol == 1 ? elementHeight  : maxHeight)});
4671              childToAdapt.data('wHasSetHeightToAjustHeightMax', '1');
4672            }
4673          }
4674          maxHeight = 0;          
4675        }
4676
4677        offsetLeftLast = offsetLeft;
4678        maxHeight = elementHeight > maxHeight ? elementHeight : maxHeight;
4679        childsToAdapt.push(jQuery(this));
4680      }
4681    });
4682  });
4683  
4684  jQuery('.wglAdjustHeightElement').each(function(index){
4685     //console.log('wglAdjustHeightElement ' + jQuery(this).data('initAdjustHeightElement'));
4686     try{ 
4687       if(jQuery(this).data('initAdjustHeightElement') == 1) return true;
4688
4689       var cE             = jQuery(this);
4690       var children       = cE.children('*');
4691       var childsToAdapt  = new Array();
4692       var maxHeight      = 0;
4693       var adaptHeight    = 0;
4694       
4695       if(children.length > 1){
4696         jQuery(window).on('resize', function(){
4697           jQuery('.wglAdjustHeightElement').data('initAdjustHeightElement', 0);
4698         }); 
4699
4700         cE.children('*').each(function(index){
4701           if(typeof jQuery(this).data('initAdjustHeightElement') != 'undefined') jQuery(this).css({'height' : ''});
4702           var height = jQuery(this).outerHeight(true);
4703           if(maxHeight < height) maxHeight = height;
4704           childsToAdapt.push(jQuery(this));
4705         });
4706         adaptHeight = maxHeight;
4707
4708         if(typeof onBeforeAdjustHeightElement === 'function'){
4709           adaptHeight = onBeforeAdjustHeightElement(childsToAdapt);
4710         }
4711         if(adaptHeight > 0){
4712           for(var i = 0; i < childsToAdapt.length; i++){
4713             childsToAdapt[i].css({'height' : String(adaptHeight) + 'px'});
4714           }
4715         }
4716       }  
4717       jQuery(this).data('initAdjustHeightElement', 1); 
4718     }
4719     catch(e){}
4720  });
4721};
4722
4723wUpdateInputDate = function(input){
4724  
4725  var elementInput = jQuery('#' + input.id.replace(/(_wDay|_wMonth|_wYear)$/, '').replace('wTmp_', ''));
4726  var dateFormat = elementInput.attr('data-dateformat');
4727
4728  if(/dd\.\mm\.yyy/.test(dateFormat)){
4729    elementInput.val(jQuery('#wTmp_' + elementInput.attr('id') + '_wDay').val() + '.' + jQuery('#wTmp_' + elementInput.attr('id') + '_wMonth').val() + '.' + jQuery('#wTmp_' + elementInput.attr('id') + '_wYear').val());
4730  }
4731  else if(/mm\/dd\/yyyy/.test(dateFormat)){
4732    elementInput.val(jQuery('#wTmp_' + elementInput.attr('id') + '_wMonth').val() + '/' + jQuery('#wTmp_' + elementInput.attr('id') + '_wDay').val() + '/' + jQuery('#wTmp_' + elementInput.attr('id') + '_wYear').val());
4733  }  
4734  else{
4735    elementInput.val(jQuery('#wTmp_' + elementInput.attr('id') + '_wYear').val() + '-' + jQuery('#wTmp_' + elementInput.attr('id') + '_wMonth').val() + '-' + jQuery('#wTmp_' + elementInput.attr('id') + '_wDay').val());
4736  }
4737};
4738
4739jQuery.fn.wDatepicker = function(){
4740  if(jQuery(this).length == 0){
4741    return false;
4742  }
4743
4744  if(typeof jQuery.datepicker == 'undefined' || typeof jQuery.datepicker != 'undefined' && typeof jQuery.datepicker.setDefaults == 'undefined' || (typeof(datepickerRegional) == 'undefined' && wUiTmp['waitLoadDatepicker'] < 3)){
4745    wUiTmp['waitLoadDatepicker'] = wUiTmp['waitLoadDatepicker'] || 0;
4746    if(wUiTmp['waitLoadDatepicker'] < 60){
4747      window.setTimeout(function(){
4748        jQuery('.wglDatepicker').wDatepicker();
4749      }, 100);
4750      wUiTmp['waitLoadDatepicker'] ++;
4751    }
4752    return false;
4753  }  
4754    
4755  if(typeof(datepickerRegional) != 'undefined' && typeof(datepickerRegional['de']) != 'undefined'){
4756    jQuery.datepicker.setDefaults(datepickerRegional['de']);    
4757  }    
4758
4759  jQuery.each(jQuery(this), function(){    
4760        
4761    jQuery(this).datepicker('destroy');
4762    
4763    var projectLang = document.documentElement.getAttribute('lang') ? document.documentElement.getAttribute('lang') : 'de';
4764    if(typeof(datepickerRegional) != 'undefined' && typeof(datepickerRegional[projectLang]) !== 'undefined'){  
4765      jQuery.datepicker.regional[projectLang] = datepickerRegional[projectLang];
4766    }    
4767    
4768    jQuery.datepicker.setDefaults(jQuery.datepicker.regional[projectLang]);
4769    
4770    var inputElement = jQuery(this);      
4771
4772    if(jQuery(this).get(0).nodeName == 'DIV'){
4773      inputElement = jQuery('#' + jQuery(this).data('input'));
4774    }    
4775    
4776    var attrDateMin             = inputElement.data('datemin');
4777    var attrDateMax             = inputElement.data('datemax');
4778    var changeYear              = inputElement.data('changeyear') == '0' ? false : true;
4779    var changeMonth             = inputElement.data('changemonth') == '1' ? true : false;    
4780    var attrLimitSelectedDays   = inputElement.data('limitselecteddays');    
4781    var attrExcludeSelectedDays = inputElement.data('excludselecteddays');     
4782
4783    var minDate = null;
4784    var maxDate = null;
4785            
4786    if(!attrDateMin){}
4787    else if(attrDateMin.indexOf('today') != -1){
4788      if(/today\s*\+\s*(\d+)years?/.test(attrDateMin)){     
4789        minDate = new Date(new Date().setFullYear(new Date().getFullYear() + parseInt(RegExp.$1)));
4790      }
4791      else if(/today\s*\-\s*(\d+)years?/.test(attrDateMin)){
4792        minDate = new Date(new Date().setFullYear(new Date().getFullYear() - parseInt(RegExp.$1)));
4793      }      
4794      else if(/today\s*\+\s*(\d+)/.test(attrDateMin)){
4795        minDate = new Date((new Date()).getTime() + parseInt(RegExp.$1) * 86400 * 1000);  
4796      }
4797      else if(/today\s*\-\s*(\d+)/.test(attrDateMin)){
4798        minDate = new Date((new Date()).getTime() - parseInt(RegExp.$1) * 86400 * 1000);
4799      }     
4800      else{
4801        minDate = new Date();
4802      }
4803    }
4804    else if(/lastDayOfMonthIfGt\-(\d+)/.test(attrDateMin)){
4805      lastDayOfMonth = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0, 0, 0, 0);
4806      today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0, 0, 0);
4807      if(((lastDayOfMonth.getTime() - today.getTime()) / 86400000) > parseInt(RegExp.$1)){
4808        minDate = lastDayOfMonth;
4809      }
4810      else{
4811        minDate = new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0, 0, 0, 0);
4812      }      
4813    }
4814    else if(/firstDayOfMonth/.test(attrDateMin)){
4815      minDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1, 0, 0, 0);
4816    }
4817    else if(/lastDayOfMonth/.test(attrDateMin)){
4818      minDate = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0, 0, 0, 0);
4819    }    
4820    else if(/firstDayOfNextMonthIfGt\-(\d+)/.test(attrDateMin)){
4821      firstDayOfNextMonth = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1, 0, 0, 0);
4822      today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0, 0, 0);
4823      if(((firstDayOfNextMonth.getTime() - today.getTime()) / 86400000) > parseInt(RegExp.$1)){
4824        minDate = firstDayOfNextMonth;
4825      }
4826      else{
4827        minDate = new Date(new Date().getFullYear(), new Date().getMonth() + 2, 1, 0, 0, 0);
4828      }      
4829    }      
4830    else if(/firstDayOfNextMonth/.test(attrDateMin)){
4831      minDate = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1, 0, 0, 0);
4832    }     
4833    else if(/^callback:(.+)/.test(attrDateMin)){
4834      eval('if(typeof('+RegExp.$1+') === \'function\')minDate='+RegExp.$1+'(
4834)');
4835    }    
4836    else if(/(>|<|>=|<=)\s*\$?(\w+)/.test(attrDateMin)){
4837      var operator = RegExp.$1;
4838      var elementName = RegExp.$2;
4839      jQuery(this).mousedown(function(){
4840        var elementRelation = jQuery('#' + elementName);
4841        if(elementRelation.length == 1){
4842          var elementRelationVal = elementRelation.val();
4843          var tmpDateObject = new Date();
4844          var hasDate = false;
4845          if(/(\d\d)\.(\d\d)\.(\d\d\d\d)/.test(elementRelationVal)){
4846            tmpDateObject.setDate(RegExp.$1);
4847            tmpDateObject.setMonth(RegExp.$2 - 1);
4848            tmpDateObject.setFullYear(RegExp.$3);
4849            hasDate = true;
4850          }
4851          else if(/(\d\d\d\d)-(\d\d)-(\d\d)/.test(elementRelationVal)){
4852            tmpDateObject.setDate(RegExp.$3);
4853            tmpDateObject.setMonth(RegExp.$2 - 1);
4854            tmpDateObject.setFullYear(RegExp.$1);
4855            hasDate = true;
4856          }
4857          else if(/(\d\d)\/(\d\d)\/(\d\d\d\d)/.test(elementRelationVal)){
4858            tmpDateObject.setDate(RegExp.$2);
4859            tmpDateObject.setMonth(RegExp.$1 - 1);
4860            tmpDateObject.setFullYear(RegExp.$3);
4861            hasDate = true;
4862          }          
4863          if(hasDate){
4864            if(operator == '>'){
4865              tmpDateObject = new Date(tmpDateObject.getTime() + 86400000);
4866            }
4867            else if(operator == '<'){
4868              tmpDateObject = new Date(tmpDateObject.getTime() - 86400000);
4869            }
4870            jQuery(this).datepicker("option", (operator == '<' ? "maxDate" : "minDate"), tmpDateObject);
4871          }
4872        }
4873      });
4874    }
4875    else{
4876      minDate = new Date(attrDateMin);
4877    }    
4878    if(!attrDateMax){
4879    }
4880    else if(attrDateMax.indexOf('today') != -1){
4881      if(/today\s*\+\s*(\d+)years?/.test(attrDateMax)){     
4882        maxDate = new Date(new Date().setFullYear(new Date().getFullYear() + parseInt(RegExp.$1)));
4883      }
4884      else if(/today\s*\-\s*(\d+)years?/.test(attrDateMax)){
4885        maxDate = new Date(new Date().setFullYear(new Date().getFullYear() - parseInt(RegExp.$1)));
4886      }
4887      else if(/today\s*\+\s*(\d+)/.test(attrDateMax)){
4888        maxDate = new Date((new Date()).getTime() + parseInt(RegExp.$1) * 86400 * 1000);  
4889      }
4890      else if(/today\s*\-\s*(\d+)/.test(attrDateMax)){
4891        maxDate = new Date((new Date()).getTime() - parseInt(RegExp.$1) * 86400 * 1000);
4892      }      
4893      else{
4894        maxDate = new Date();
4895      }
4896    }
4897    else if(/lastDayOfMonthIfGt\-(\d+)/.test(attrDateMax)){
4898      lastDayOfMonth = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0, 0, 0, 0);
4899      today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0, 0, 0);
4900      if(((lastDayOfMonth.getTime() - today.getTime()) / 86400000) > parseInt(RegExp.$1)){
4901        maxDate = lastDayOfMonth;
4902      }
4903      else{
4904        maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0, 0, 0, 0);
4905      }      
4906    }
4907    else if(/lastDayOfMonth/.test(attrDateMax)){
4908      maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0, 0, 0, 0);
4909    }
4910    else if(/lastDayOfNextMonth/.test(attrDateMax)){
4911      maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0, 0, 0, 0);
4912    }    
4913    else if(/firstDayOfMonth/.test(attrDateMax)){
4914      maxDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1, 0, 0, 0);
4915    }     
4916    else if(/firstDayOfNextMonthIfGt\-(\d+)/.test(attrDateMax)){
4917      firstDayOfNextMonth = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1, 0, 0, 0);
4918      today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), 0, 0, 0);
4919      if(((firstDayOfNextMonth.getTime() - today.getTime()) / 86400000) > parseInt(RegExp.$1)){
4920        maxDate = firstDayOfNextMonth;
4921      }
4922      else{
4923        maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 2, 1, 0, 0, 0);
4924      }      
4925    }    
4926    else if(/firstDayOfNextMonth/.test(attrDateMax)){
4927      maxDate = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1, 0, 0, 0);
4928    }         
4929    else if(/^callback:(.+)/.test(attrDateMax)){
4930      eval('if(typeof('+RegExp.$1+') === \'function\')maxDate='+RegExp.$1+'(
4930)');
4931    }        
4932    else if(/(>|<|>=|<=)\s*\$(\w+)/.test(attrDateMax)){
4933      var operator = RegExp.$1;
4934      var elementName = RegExp.$2;
4935      jQuery(this).mousedown(function(){
4936        var elementRelation = jQuery('#' + elementName);
4937        if(elementRelation.length == 1){
4938          var elementRelationVal = elementRelation.val();
4939          var tmpDateObject = new Date();
4940          var hasDate = false;
4941          if(/(\d\d)\.(\d\d)\.(\d\d\d\d)/.test(elementRelationVal)){
4942            tmpDateObject.setDate(RegExp.$1);
4943            tmpDateObject.setMonth(RegExp.$2 - 1);
4944            tmpDateObject.setFullYear(RegExp.$3);
4945            hasDate = true;
4946          }
4947          else if(/(\d\d\d\d)-(\d\d)-(\d\d)/.test(elementRelationVal)){
4948            tmpDateObject.setDate(RegExp.$3);
4949            tmpDateObject.setMonth(RegExp.$2 - 1);
4950            tmpDateObject.setFullYear(RegExp.$1);
4951            hasDate = true;
4952          }
4953          else if(/(\d\d)\/(\d\d)\/(\d\d\d\d)/.test(elementRelationVal)){
4954            tmpDateObject.setDate(RegExp.$2);
4955            tmpDateObject.setMonth(RegExp.$1 - 1);
4956            tmpDateObject.setFullYear(RegExp.$3);
4957            hasDate = true;
4958          } 
4959          if(hasDate){
4960            if(operator == '>'){
4961              tmpDateObject = new Date(tmpDateObject.getTime() + 86400000);
4962            }
4963            else if(operator == '<'){
4964              tmpDateObject = new Date(tmpDateObject.getTime() - 86400000);
4965            }
4966            jQuery(this).datepicker("option", (operator == '<' ? "maxDate" : "minDate"), tmpDateObject);
4967          }
4968        }
4969      });
4970    }
4971    else{
4972      maxDate = new Date(attrDateMax);
4973    }        
4974
4975    var callbackLimitSelectedDays = function(day){return [true, '']};
4976    
4977    if(attrLimitSelectedDays == 'workingDays'){
4978      callbackLimitSelectedDays = function(day){  
4979        return [!(day.getDay() == 6 || day.getDay() == 0), ''];
4980      };
4981    }
4982    else if(attrLimitSelectedDays == 'moToSa'){
4983      callbackLimitSelectedDays = function(day){  
4984        return [!(day.getDay() == 0), ''];
4985      };
4986    }    
4987    
4988    var excludedDays = attrExcludeSelectedDays;
4989    
4990    /*
4991    var yearCurrent  = (new Date()).getFullYear();
4992    var monthCurrent = ((new Date()).getMonth() < 9 ? '0' + String((new Date()).getMonth() + 1) : String((new Date()).getMonth() + 1));
4993    var monthNext    = ((new Date()).getMonth() < 9 ? '0' + String((new Date()).getMonth() + 2) : String((new Date()).getMonth() + 2));
4994    var excludedDays = attrExcludeSelectedDays ? attrExcludeSelectedDays.replace(/YYYY/g, yearCurrent) : '';    
4995    var excludedDays = excludedDays.replace(/MM\(\+1\)/g, monthNext);    
4996    var excludedDays = excludedDays.replace(/MM/g, monthCurrent); 
4997    */
4998    
4999    if(attrExcludeSelectedDays && attrExcludeSelectedDays != ''){
5000      callbackLimitSelectedDays = function(day){
5001        var allowDay = true;
5002        var dateStr = day.getFullYear() + '-' + (day.getMonth() < 9 ? '0' + String(day.getMonth() + 1) : String(day.getMonth() + 1)) + '-' + (day.getDate() < 10 ? '0' + String(day.getDate()) : String(day.getDate()));        
5003        var daysToExclude = excludedDays.split(',');
5004
5005        var yearCurrent  = (new Date()).getFullYear();
5006        var monthCurrent = ((new Date()).getMonth() < 9 ? '0' + String((new Date()).getMonth() + 1) : String((new Date()).getMonth() + 1));        
5007        
5008        for(var i = 0; i < daysToExclude.length; i++){
5009          
5010          dayToExclude = daysToExclude[i];
5011                    
5012          var diffYearTmp = 0;
5013          dayToExclude = dayToExclude ? dayToExclude.replace(/MM(?:\(([\+\-])(\d+)\))?/g, function(tmp, diff, month){
5014            if(Number.isInteger(Number(month))){
5015              if(diff == '-'){
5016                var mr = (new Date()).getMonth() + 1 - parseInt(month);
5017                return (mr < 10) ? '0' + String(mr) : String(mr);   
5018              }
5019              else{
5020                var mr = (new Date()).getMonth() + 1 + parseInt(month);
5021                if(mr > 12){
5022                  mr = mr - 12;
5023                  diffYearTmp = -1;
5024                }
5025                return (mr < 10) ? '0' + String(mr) : String(mr);       
5026              }
5027            }
5028            else{
5029              var mr = (new Date()).getMonth() + 1;
5030              return mr;
5031            }
5032          }) : '';
5033          dayToExclude = dayToExclude ? dayToExclude.replace(/YYYY/g, yearCurrent - diffYearTmp) : ''; 
5034          
5035          daysToExclude[i] = dayToExclude;
5036          
5037          if(/weekday\((\d+)\s*\|\s*"([^"]+)"\)/.test(daysToExclude[i].trim())){
5038            weekDayExcluded = RegExp.$1;
5039            daysAllowed     = RegExp.$2;
5040            dayToCheck = day.getDay();
5041            if(dayToCheck == 0){
5042              dayToCheck = 7;
5043            }
5044            if(weekDayExcluded == dayToCheck){
5045              daysAllowed = daysAllowed.split('|');
5046              isAllowed = false;
5047              for(var j = 0; j < daysAllowed.length; j++){ 
5048                dayAllowed = daysAllowed[j].trim();
5049                if(dayAllowed == dateStr){
5050                  isAllowed = true;
5051                  break;
5052                }
5053              }
5054              if(!isAllowed){
5055                return [false, ''];
5056              }
5057            }
5058          }          
5059          else if(/weekday\((\d+)\)/.test(daysToExclude[i].trim())){
5060            weekDayExcluded = RegExp.$1;    
5061            dayToCheck = day.getDay();
5062            if(dayToCheck == 0){
5063              dayToCheck = 7;
5064            }            
5065            if(weekDayExcluded == dayToCheck){
5066              return [false, ''];
5067            }
5068          }
5069          else if(/monthday\((\d+)\s*\-\s*(\d+)\)/.test(daysToExclude[i].trim())){
5070            weekDayExcludedFrom = RegExp.$1;    
5071            weekDayExcludedTo   = RegExp.$2;    
5072            dayToCheck = day.getDate();        
5073            if(dayToCheck >= weekDayExcludedFrom && dayToCheck <= weekDayExcludedTo){
5074              return [false, ''];
5075            }
5076          }           
5077          else if(/monthday\((\d+)\)/.test(daysToExclude[i].trim())){
5078            weekDayExcluded = RegExp.$1;    
5079            dayToCheck = day.getDate();        
5080            if(weekDayExcluded == dayToCheck){
5081              return [false, ''];
5082            }
5083          }                        
5084          else if(/(\d\d\d\d\-\d\d\-\d\d)-(\d\d\d\d\-\d\d\-\d\d)/.test(daysToExclude[i].trim())){
5085            var dayFrom = RegExp.$1;    
5086            var dayTo   = RegExp.$2;
5087            if(dateStr >= dayFrom && dateStr <= dayTo){
5088              return [false, ''];
5089            }
5090          }          
5091          else if(dateStr == daysToExclude[i].trim()){
5092            return [false, ''];
5093          }          
5094        }
5095        if(attrLimitSelectedDays == 'workingDays'){        
5096          return [!(day.getDay() == 6 || day.getDay() == 0), ''];
5097        }
5098        else if(attrLimitSelectedDays == 'moToSa'){        
5099          return [!(day.getDay() == 0), ''];
5100        }        
5101        else{
5102          return [true, ''];
5103        }
5104      };
5105    }    
5106
5107    jQuery(this).on('change', function(datepicker){
5108      var inputElement = jQuery(this);      
5109      var value        = inputElement.val();
5110      var isInline     = false;
5111      
5112      if(jQuery(this).get(0).nodeName == 'DIV'){
5113        isInline = true;
5114        inputElement = jQuery('#' + jQuery(this).data('input'));
5115        var dateFormat = inputElement.data('dateformat');
5116        var date = new Date(parseInt(datepicker.timeStamp));
5117        value = jQuery(this).val().replace(/(\d+)\/(\d+)\/(\d+)/, '$2.$1.$3');        
5118      }
5119      
5120      if(inputElement.data('dateformat') == 'D, dd.mm.yy'){
5121        if(/^\s*(\d+)\.(\d+)\.(\d\d\d\d)\s*$/.test(value)){
5122          value = value.replace(/^\s*(\d)\.(\d+)\.(\d\d\d\d)\s*$/, '0' + value).replace(/^\s*(\d+)\.(\d)\.(\d\d\d\d)\s*$/, RegExp.$1 + '.0' + RegExp.$2 + '.' + RegExp.$3);
5123          try{
5124            var dDay     = (new Date(RegExp.$3 + '-' + RegExp.$2 + '-' + RegExp.$1 + ' 12:00:00')).getDay();
5125            var dShort   = jQuery.datepicker.regional['de']['dayNamesShort'][dDay];
5126            value = dShort + ', ' + value;
5127          }catch(e){}
5128        }
5129      }
5130      else if(inputElement.data('dateformat') == 'dd.mm.yy'){
5131        if(/^(\d\.)(\d\.\d\d\d\d)\s*$/.test(value)){
5132          value = '0' + RegExp.$1 + '0' +  RegExp.$2;
5133        }           
5134        else if(/^(\d)\.(\d+)\.(\d\d\d\d)\s*$/.test(value)){
5135          value = '0' + value;
5136        }
5137        else if(/^(\d+\.)(\d\.\d\d\d\d)\s*$/.test(value)){
5138          value = RegExp.$1 + '0' + RegExp.$2;
5139        }     
5140      }
5141
5142      inputElement.val(value);
5143      
5144      if(typeof(wOnAfterChangeDate) === 'function'){
5145        wOnAfterChangeDate(inputElement);
5146      }
5147    });
5148    
5149    prepareAccessibility = function(cI, inst){
5150      /*inputElement ist input-Feld*/
5151      //cI.input.off('focus');
5152      var curDp = jQuery('#ui-datepicker-div .ui-state-active');
5153      var curDate = inputElement.datepicker("getDate");
5154      if(!(curDate instanceof Date)) curDate = new Date();
5155      jQuery(document).off('keyup.datepicker').on('keyup.datepicker', function(e){
5156        if(e.key === 'Escape'){
5157          cI.input.datepicker('hide');
5158          return false;
5159        }
5160        
5161        var curDP = jQuery("#ui-datepicker-div");
5162        var tmpDate = curDate;
5163        var day = curDate.getDate();  
5164        var dir = 'next';
5165        if(e.key === 'ArrowUp'){
5166          curDate.setDate(curDate.getDate()-7);
5167          dir = 'prev';
5168        }
5169        else if(e.key === 'ArrowDown'){
5170          curDate.setDate(curDate.getDate()+7);
5171        }
5172        else if(e.key === 'ArrowLeft'){
5173          curDate.setDate(curDate.getDate()-1);
5174          dir = 'prev';
5175        }
5176        else if(e.key === 'ArrowRight'){
5177          curDate.setDate(curDate.getDate()+1);
5178        }
5179        else if(e.key == 'Tab'){
5180          curDate.setDate(curDate.getDate()+1);
5181          var curA = curDP.find('a[data-date="' + (day+1) + '"]');
5182          var lastElement = curA.closest('td').next('.ui-datepicker-other-month');
5183          var lastRow = curA.closest('tr').is(':last-child');
5184          var lastCol = curA.closest('td').is(':last-child');
5185
5186          if(lastRow && lastCol && lastElement.length == 0){
5187            curA.closest('tr').append('<td class="ui-datepicker-other-month" >XX</td>');
5188            lastElement = curA.closest('td').next('.ui-datepicker-other-month');
5189          }
5190          if(lastElement.length > 0){
5191            lastElement.attr('tabindex' , '0');
5192            lastElement.on('focus.othermonth', function(){
5193              curDP.find('a[data-date="1"]').focus();
5194              lastElement.attr('tabindex', '-1').off('focus.othermonth');
5195            });
5196          }
5197        }
5198        
5199        var newDay = curDate.getDate();
5200        if(dir == 'prev' && newDay > day) curDP.find(".ui-datepicker-prev").trigger("click");
5201        if(dir == 'next' && newDay < day) curDP.find(".ui-datepicker-next").trigger("click");
5202        curDP.find('a[data-date="' + day + '"]').css({'outline':'none'});
5203        curDP.find('a[data-date="' + newDay + '"]').css({'outline': '1px solid black'}).focus();
5204        
5205        e.stopPropagation();
5206        e.stopImmediatePropagation();
5207      });
5208    };
5209    
5210    stopAccessibility = function(input, inst){
5211      jQuery(document).off('keyup.datepicker');
5212      var next = input.input.closest('.formElement').next();
5213      if(next.length > 0) next.attr('tabindex' , '-1').focus().removeAttr('tabindex' , '-1');
5214      input.input.off('focus').off('click').off('keydown')
5215                  .on('click', function(e){input.input.datepicker("show");})
5216                  .on('keydown', function(e){if(e.key == 'Tab' && !e.shiftKey){input.input.datepicker("show");}});
5217    };
5218    
5219    jQuery(this).datepicker({beforeShow : function(input, inst) {setTimeout(function() {prepareAccessibility(inst);}, 0)}, 
5220      beforeShowDay : callbackLimitSelectedDays, 
5221      changeYear : changeYear, 
5222      changeMonth : changeMonth, 
5223      minDate : minDate, 
5224      maxDate : maxDate, 
5225      dateFormat : inputElement.data('dateformat'), 
5226      onClose : function(input, inst) {setTimeout(function() {stopAccessibility(inst);}, 0)},
5227      onSelect : function(){
5228      
5229      var inputElement    = jQuery(this);      
5230      var value           = inputElement.val();
5231      var isInline        = false;
5232      var attrPlaceholder = inputElement.attr('placeholder');         
5233      var addPlacholderToLabelAfterSelect = inputElement.data('placeholdertolabelafterselect');         
5234                  
5235      if(jQuery(this).get(0).nodeName == 'DIV'){
5236        isInline = true;
5237        inputElement = jQuery('#' + jQuery(this).data('input')); 
5238        inputElement.val(value);
5239      }
5240
5241      inputElement.data('haschanged', 1);
5242
5243      if(addPlacholderToLabelAfterSelect == '1' && attrPlaceholder && attrPlaceholder != ''){
5244        if(inputElement.parent().prev('div').find('label').length == 0){
5245          inputElement.parent().prev('div').append(jQuery('<label for="' + inputElement.attr('id') + '">' + attrPlaceholder +'</label>'));
5246        }
5247      }
5248           
5249      var onchange = (inputElement.data('onchange') ? inputElement.data('onchange') : '').trim();
5250
5251      if(/adaptInputToThisDate\('([^']+)',\s*(\d+)\)/.test(onchange)){
5252        inputToAdaptId = RegExp.$1;
5253        valueToAdapt   = RegExp.$2;
5254        if(jQuery('#' + inputToAdaptId).length != 0){
5255          inputToAdapt = jQuery('#' + inputToAdaptId);
5256          if(inputToAdapt.data('haschanged') != '1'){
5257            if(/(\w+),\s*(\d\d)\.(\d\d)\.(\d\d\d\d)/.test(value)){
5258              var dateObj = new Date(RegExp.$4, parseInt(RegExp.$3) - 1, RegExp.$2);
5259              if(valueToAdapt > 0){
5260                dateObj.setDate(dateObj.getDate() + parseInt(valueToAdapt));
5261              }
5262              var dateStr = (dateObj.getDate() < 10 ? '0' + String(dateObj.getDate()) : String(dateObj.getDate())) + '.' + (d
5262ateObj.getMonth() < 9 ? '0' + String(dateObj.getMonth() + 1) : String(dateObj.getMonth() + 1)) + '.' + dateObj.getFullYear();
5263              var daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
5264              var weekDay = daysOfWeek[dateObj.getDay()];
5265              if(jQuery.datepicker.regional['de']){                
5266                weekDay = jQuery.datepicker.regional['de']['dayNamesMin'][dateObj.getDay()];
5267              }
5268              inputToAdapt.val(weekDay + ', ' + dateStr);
5269              jQuery(inputToAdapt).trigger('change');
5270            }            
5271            else if(/(\d\d)\.(\d\d)\.(\d\d\d\d)/.test(value)){
5272              var dateObj = new Date(RegExp.$3, parseInt(RegExp.$2) - 1, RegExp.$1);
5273              if(valueToAdapt > 0){
5274                dateObj.setDate(dateObj.getDate() + parseInt(valueToAdapt));
5275              }
5276              var dateStr = (dateObj.getDate() < 10 ? '0' + String(dateObj.getDate()) : String(dateObj.getDate())) + '.' + (dateObj.getMonth() < 9 ? '0' + String(dateObj.getMonth() + 1) : String(dateObj.getMonth() + 1)) + '.' + dateObj.getFullYear();
5277              inputToAdapt.val(dateStr);
5278              jQuery(inputToAdapt).trigger('change');
5279            }
5280            else if(/(\d\d\d\d)-(\d\d)-(\d\d)/.test(value)){
5281              var dateObj = new Date(RegExp.$1, parseInt(RegExp.$2) - 1, RegExp.$3);
5282              if(valueToAdapt > 0){
5283                dateObj.setDate(dateObj.getDate() + parseInt(valueToAdapt));
5284              }
5285              var dateStr = dateObj.getFullYear() + '-' + (dateObj.getMonth() + 1 < 10 ? '0' + String(dateObj.getMonth() + 1) : String(dateObj.getMonth() + 1))  + '-' + (dateObj.getDate() < 10 ? '0' + String(dateObj.getDate()) : String(dateObj.getDate()));
5286              inputToAdapt.val(dateStr);
5287              jQuery(inputToAdapt).trigger('change');
5288            }
5289            
5290            if(jQuery('div[data-input=\'' + inputToAdapt.attr('id') + '\']').length == 1){
5291              var dateInit = inputToAdapt.val();
5292              jQuery('div[data-input=\'' + inputToAdapt.attr('id') + '\']').datepicker('setDate', dateInit);
5293              //jQuery('div[data-input=\'' + inputToAdapt.attr('id') + '\']').datepicker('refresh');
5294            }
5295          }
5296        }
5297      }
5298
5299      var onchangescript = (inputElement.data('onchangescript') ? inputElement.data('onchangescript') : '').trim();
5300      if(onchangescript != ''){
5301        eval(onchangescript);
5302        onchange = '';
5303      }
5304
5305      jQuery(inputElement).trigger('change'); 
5306    }});
5307
5308    if(minDate){
5309      if(maxDate){
5310        jQuery(this).datepicker("option", "yearRange", String(minDate.getYear() + 1900) + ':' + String(maxDate.getYear() + 1900));
5311      }
5312      else{
5313        jQuery(this).datepicker("option", "yearRange", String(minDate.getYear() + 1900) + ':+10');
5314      }
5315    }
5316    else if(maxDate){
5317      jQuery(this).datepicker("option", "yearRange", '1970:' + String(maxDate.getYear() + 1900));
5318    }   
5319
5320  });
5321};
5322
5323hasNotYetLoadedAllCss = function(){
5324  
5325  var divTmp = document.getElementById('deferred-styles-dyn');
5326  if(!divTmp || divTmp && window.getComputedStyle(divTmp).display == 'none'){
5327    return false;
5328  }
5329  return true;
5330};
5331
5332jQuery.fn.wPictureGallery = function(options){
5333
5334  var options = options || {};
5335  options['timeout'] = options['timeout'] ? options['timeout'] : 8;  
5336
5337  var hasGalleriesToInitLater = false;
5338
5339  jQuery.each(jQuery(this), function(){
5340
5341    var pictureGalleryCurrent   = jQuery(this);
5342    if(pictureGalleryCurrent.is(":visible") && !pictureGalleryCurrent.data('wasinit') && typeof(initGallery) === 'function' && !hasNotYetLoadedAllCss()){
5343
5344      var pictureGalleryCurrentId = pictureGalleryCurrent.attr('id').replace(/pictureGallery_/, '');
5345      eval('selectEntry_' + pictureGalleryCurrentId + ' = function (position){selectListEntryGallery(pictureGalleryCurrentId, position);}');
5346      pictureGalleryCurrent.attr('data-wasinit', 1);
5347      initGallery(pictureGalleryCurrentId);
5348    }
5349    else{
5350      hasGalleriesToInitLater = true;
5351    }
5352  });
5353
5354  if(hasGalleriesToInitLater && options['timeout'] > 1){
5355    window.setTimeout(function(){
5356      jQuery('.wglPictureGallery').wPictureGallery({'timeout' : options['timeout'] - 1});
5357    }, 320);
5358  }  
5359};
5360
5361jQuery.fn.wBannerSlider = function(options){
5362
5363  var options = options || {};
5364  options['timeout'] = options['timeout'] ? options['timeout'] : 8;
5365
5366  var hasBannerSlidersToInitLater = false;
5367  
5368  jQuery.each(jQuery(this), function(){
5369
5370    var bannerSliderCurrent   = jQuery(this);
5371    var doAnimationIfVisibleOnce = true;
5372    if(bannerSliderCurrent.hasClass('wglAnimateIfVisibleOnce') && !bannerSliderCurrent.hasClass('isVisible')){
5373      doAnimationIfVisibleOnce = false;
5374      bannerSliderCurrent.attr('data-doifbecomevisibleonce', 'jQuery(this).wBannerSlider();');
5375    }
5376    
5377    if(doAnimationIfVisibleOnce && bannerSliderCurrent.is(":visible") && bannerSliderCurrent.attr('data-wasinit') != '1' && typeof(initBannerSlider) === 'function' && !hasNotYetLoadedAllCss()){
5378      var bannerSliderCurrentId = bannerSliderCurrent.attr('id').replace(/bannerSlider_/, '');
5379      var options = {};
5380
5381      options['initOn']    = options['initon']  || jQuery(this).data('initon');
5382      options['initOpen']  = options['initopen']  || jQuery(this).data('initopen');
5383      options['initDelay'] = options['initDelay'] || jQuery(this).data('initdelay');
5384      if(options['initDelay'] == ''){
5385        options['initDelay'] = 0;
5386      }
5387      else{
5388        options['initDelay'] *= 1000;
5389      }
5390
5391      eval('selectEntry_' + bannerSliderCurrentId + ' = function (position){selectListEntryBannerSlider(bannerSliderCurrentId, position);}');
5392
5393      var bannerSliderInit = function(){
5394
5395        window.setTimeout(function(){
5396          try{
5397            initBannerSlider(bannerSliderCurrentId);
5398            bannerSliderCurrent.attr('data-wasinit', 1);
5399            if(typeof(options['initOpen']) != 'undefined' && options['initOpen'] != ''){
5400              window.bannerSliderObjects[bannerSliderCurrentId] = {};
5401              selectListEntryBannerSlider(bannerSliderCurrentId, parseInt(options['initOpen']), {'animation' : 'none'});
5402            }
5403          }
5404          catch(e){}
5405        }, options['initDelay']);
5406      };
5407      
5408      if(options['initOn'] == 'load'){
5409        if(wUiTmp['windowLoad']){
5410          bannerSliderInit();
5411        }
5412        else{
5413          if(typeof(wUiTmp['callbackAfterLoad']) == 'undefined'){
5414            wUiTmp['callbackAfterLoad'] = [];
5415          }
5416          wUiTmp['callbackAfterLoad'].push(bannerSliderInit);
5417        }
5418      }
5419      else{
5420        bannerSliderInit();
5421      }
5422    }
5423    else{
5424      hasBannerSlidersToInitLater = true;
5425    }
5426  });
5427
5428  if(hasBannerSlidersToInitLater && options['timeout'] > 1){
5429    window.setTimeout(function(){
5430      jQuery('.wglBannerSlider').wBannerSlider({'timeout' : options['timeout'] - 1});
5431    }, 320);
5432  }
5433};
5434 
5435
5436class wClassTicker{
5437  
5438  constructor(object, options){
5439    this.object = object;
5440    this.options = options;
5441    /*this.options['version'] == '2.0' - 26.06.2025 Einführung der Version 2.0 wenn stabil aktivieren*/
5442    this.containerId = String(parseInt(Math.random() * 1000));      
5443    this.initWidth   = 10000;
5444    this.basicDuration = 15000; /*Ausgangsduration als basis */
5445    this.basicDurationWidth = jQuery(window).width(); 
5446    if(this.options['basicDurationWidth']) this.basicDurationWidth = this.options['basicDurationWidth'];
5447    this.initTimeout   = 100;
5448    this.tickerData  = new Array();
5449    this.cOWidth     = 0;
5450    this.changedInitWidth = false;
5451    this.cO          = null;
5452    this.multi       = 4;
5453    this.interval    = null;
5454    this.visible   = false;
5455    this.leftRepeat = 0;
5456    this.init();
5457  }
5458  
5459  init(){
5460    const self = this;
5461    jQuery.each(this.object.children(), function(){
5462      var tWidth = jQuery(this).children().first().outerWidth();
5463      if(self.options['refElementWidth'] != ''){
5464        var o = jQuery(this).find(self.options['refElementWidth']);
5465        if(o.length > 0) tWidth = o.outerWidth();
5466        else tWidth = 0;
5467      }
5468      self.cOWidth += tWidth;
5469      var clNode = jQuery(jQuery(this).children().first()).clone(true);
5470      if(jQuery(this).hasClass('clickable') && jQuery(this).attr('onclick') != ''){
5471        clNode.attr('onclick', jQuery(this).attr('onclick')).addClass('clickable');
5472      }
5473      self.tickerData.push(clNode);
5474    });
5475    
5476    if(Boolean(self.options['infinityClonedNr'])){
5477      self.multi = self.options['infinityClonedNr'];
5478    }
5479    else if(self.cOWidth*self.multi > self.initWidth){
5480      self.multi = 2;
5481      self.cOWidth *= self.multi;
5482      self.options['speed'] = parseInt(self.options['speed'])*6;
5483      self.changedInitWidth = true;
5484    }
5485    else{
5486      self.cOWidth = 0;
5487      if(self.tickerData.length == 1)       self.multi = 12;
5488      else if(self.tickerData.length == 2)  self.multi = 6;
5489      else if(self.tickerData.length == 3)  self.multi = 4;
5490    }
5491    
5492    jQuery('<div class="listTicker ' + self.object.attr('class') + '" id="' + self.containerId + '"><div style="'+(self.cOWidth > 0 ? 'width:'+self.cOWidth+'px' : '')+'" class="listTickerInner" id="' + self.containerId + '_inner"></div></div>').replaceAll(self.object);        
5493    self.cO      = jQuery('#' + self.containerId + '_inner');
5494
5495    if(this.options['version'] == '2.0'){
5496      /*Neuberechnung der Breiten nach Aktivierung*/
5497      setTimeout(() => {
5498        self.cO.css({'width':'auto'});
5499        self.cOWidth = self.cO.outerWidth(true);
5500        self.cO.css({'width':  self.cOWidth + 'px'});
5501      }, self.initTimeout); 
5502    }
5503    
5504    if(self.options['repeatMode'] == 'continue'){
5505      for(var j = 0; j < self.multi; j++){
5506        for(var i = 0; i != self.tickerData.length; i++){
5507          self.cO.append(self.options['delimiter']);
5508          self.cO.append(jQuery(self.tickerData[i]).clone(true));
5509        }
5510      }
5511      self.cO.css('margin-left', '0');                           
5512    }
5513    else{
5514      for(var i = 0; i != self.tickerData.length; i++){
5515        if(i != 0){
5516          self.cO.append(self.options['delimiter']);
5517        }
5518        self.cO.append(jQuery(self.tickerData[i]).clone(true));
5519      } 
5520    }
5521    self.cO.data('hasFinishedLoop', '1');
5522  }
5523  
5524  isVisible(){
5525    this.visible = this.cO.is(':visible');
5526    return this.visible;
5527  }  
5528  
5529  start(){
5530    const self = this;
5531    window.setTimeout(function(){         
5532        var widthContainerInner = document.getElementById('' + self.containerId + '_inner').offsetWidth;
5533        var duration            = 400 * widthContainerInner / (self.multi * self.options['speed']);
5534        if(self.options['version'] == '2.0' && self.options['repeatMode'] == 'continue' && self.options['direction'] == 'ltr'){
5535          widthContainerInner = self.cOWidth;
5536          var marginLeft = widthContainerInner/self.multi;
5537          var duration = self.basicDuration*(marginLeft/self.basicDurationWidth);
5538          self.cO.css('margin-left', '-' + marginLeft + 'px');
5539          self.interval = setInterval(function(){
5540            if(jQuery('html').hasClass('waAvoidAnimations')){
5541              self.cO.stop(true, false); 
5542              paused = true;
5543            }
5544            else if(paused){
5545              self.cO.animate({'marginLeft': '0' }, {'duration' : duration , 'easing' : 'linear', 'queue' : false, 'complete' : function(){self.cO.data('hasFinishedLoop', '1');}});
5546              paused = false;
5547            }
5548            else if(self.cO.data('hasFinishedLoop') == '1'){
5549              self.cO.css('margin-left', '-' + marginLeft + 'px');
5550              self.cO.data('hasFinishedLoop', '0').css('margin-left', '-' + String(marginLeft)).animate({'marginLeft': '0' }, {'duration' : duration , 'easing' : 'linear', 'queue' : false, 'complete' : function(){self.cO.data('hasFinishedLoop', '1');}});
5551            }
5552          }, 10);
5553        }
5554        else if(self.options['version'] == '2.0' && self.options['repeatMode'] == 'continue'){
5555          widthContainerInner = self.cOWidth;
5556          var marginLeft = widthContainerInner/self.multi;
5557          var duration = self.basicDuration*(marginLeft/self.basicDurationWidth);
5558          var paused = false;
5559          self.interval = setInterval(function(){
5560            if(jQuery('html').hasClass('waAvoidAnimations')){
5561              self.cO.stop(true, false); 
5562              paused = true;
5563            }
5564            else if(paused){
5565              self.cO.animate({'marginLeft': '-' + String(marginLeft)}, {'duration' : duration , 'easing' : 'linear', 'queue' : false, 'complete' : function(){self.cO.data('hasFinishedLoop', '1');}});
5566              paused = false;
5567            }
5568            else if(self.cO.data('hasFinishedLoop') == '1'){ 
5569              self.cO.data('hasFinishedLoop', '0').css('margin-left', '0').animate({'marginLeft': '-' + String(marginLeft)}, {'duration' : duration , 'easing' : 'linear', 'queue' : false, 'complete' : function(){self.cO.data('hasFinishedLoop', '1');}});
5570            }
5571          }, 10);
5572        }
5573        else if(self.options['repeatMode'] == 'continue' && self.options['animationEngine'] == 'css' && self.options['direction'] == 'ltr'){
5574          self.leftRepeat = jQuery('#' + self.containerId + '_inner > div').outerWidth() * self.tickerData.length * self.multi / 2;
5575          self.cO.css({'transform' : 'translateX(-' + self.leftRepeat + 'px)'});           
5576          window.setTimeout(function(){
5577            self.cO.data('hasFinishedLoop', '0').css({'transition' : 'all ' + (duration / (self.multi) * 0.001) + 's linear', 'transform' : 'translateX(0)'});                  
5578            self.interval = setInterval(function(){
5579              self.cO.css({'transition' : 'none', 'transform' : 'translateX(-' + self.leftRepeat + 'px)'});
5580              window.setTimeout(function(){
5581                self.cO.css({'transition' : 'all ' + (duration / (self.multi) * 0.001) + 's linear', 'transform' : 'translateX(0)'});                  
5582              }, 32);
5583            }, duration / self.multi);  
5584          }, 32);
5585        }       
5586        else if(self.options['repeatMode'] == 'continue' && self.options['animationEngine'] == 'css'){
5587          var lastEntry = self.cO.children().eq(self.tickerData.length-1);
5588          var entry = lastEntry;
5589          self.leftRepeat = jQuery('#' + self.containerId + '_inner > div').outerWidth() * self.tickerData.length * self.multi / 2;
5590          self.leftRepeat = self.leftRepeat+((parseInt(entry.css('margin-left'))+parseInt(entry.css('margin-right')))*(self.tickerData.length*self.multi/2)-2);
5591          if(self.changedInitWidth){
5592            var leftRepeat = lastEntry.offset()['left'] + lastEntry.outerWidth() - (parseInt(lastEntry.css('margin-left'))+parseInt(lastEntry.css('margin-right')))*self.tickerData.length;
5593            leftRepeat = (self.cOWidth/self.multi)+((parseInt(entry.css('margin-left'))+parseInt(entry.css('margin-right')))*self.tickerData.length);
5594          }
5595          self.cO.data('hasFinishedLoop', '0').css({'transition' : 'all ' + (duration / (self.multi) * 0.001) + 's linear', 'transform' : 'translateX(-' + self.leftRepeat + 'px)'});        
5596          self.interval = setInterval(function(){
5597            self.cO.css({'transition' : 'none', 'transform' : 'translateX(0)'});
5598            window.setTimeout(function(){
5599              self.cO.css({'transition' : 'all ' + (duration / (self.multi) * 0.001) + 's linear', 'transform' : 'translateX(-' + self.leftRepeat + 'px)'});                  
5600            }, 16);
5601          }, duration / self.multi); 
5602        }   
5603        else if(self.options['repeatMode'] == 'continue'){
5604          self.interval = setInterval(function(){
5605            if(self.cO.data('hasFinishedLoop') == '1'){ 
5606              self.cO.data('hasFinishedLoop', '0').css('margin-left', '0').animate({'marginLeft': '-' + String(widthContainerInner) / self.multi}, {'duration' : duration / (2 * self.multi), 'easing' : 'linear', 'queue' : false, 'complete' : function(){self.cO.data('hasFinishedLoop', '1');}});
5607              //jQuery('#' + containerId + '_inner').data('hasFinishedLoop', '0').css('margin-left', '-' + String(widthContainerInner) / multi).animate({'marginLeft': '0'}, {'duration' : duration / (2 * multi), 'easing' : 'linear', 'queue' : false, 'complete' : function(){jQuery('#' + containerId + '_inner').data('hasFinishedLoop', '1');}});
5608            }
5609          }, 10);  
5610        }        
5611        else if(self.options['repeatMode'] == 'loop'){
5612          self.interval = setInterval(function(){
5613            if(self.cO.data('hasFinishedLoop') == '1'){ 
5614              self.cO.data('hasFinishedLoop', '0').css('margin-left', String(jQuery('#' + self.containerId).width()) + 'px').animate({'marginLeft': '-' + String(widthContainerInner)}, duration, 'linear', function(){self.cO.data('hasFinishedLoop', '1');});                
5615            }
5616          }, 100);  
5617        }          
5618        else{
5619          self.cO.animate({'marginLeft': '-' + String(widthContainerInner)}, duration, 'linear');
5620        }
5621      }, self.initTimeout + parseInt(self.options['delayStart']) * 1000);    
5622  }
5623  
5624  reset(){
5625    const self = this;
5626    self.cO.css({'transition' : 'none', 'transform' : 'translateX(0)'}); 
5627    if(typeof self.interval === 'number'){
5628      clearInterval(self.interval);
5629      self.interval = null;
5630    }
5631  }
5632}
5633
5634
5635jQuery.fn.wTicker = function(){
5636  
5637  if(typeof(window.tickerObjects) == 'undefined') window.tickerObjects = {};
5638  if(jQuery('html').hasClass('waAvoidAnimations')) return;
5639  
5640  jQuery.each(jQuery(this), function(){
5641    
5642    var options = {};
5643
5644    options['delayStart']         = jQuery(this).data('delaystart') ? parseInt(j
5644Query(this).data('delaystart')) : 0;
5645    options['speed']              = jQuery(this).data('speed') ? parseFloat(jQuery(this).data('speed')) : 5;
5646    options['direction']          = jQuery(this).data('direction') && jQuery(this).data('direction') == 'ltr' ? 'ltr' : 'rtl';
5647    options['delimiter']          = jQuery(this).data('delimiter') ? jQuery(this).data('delimiter') : '';
5648    options['repeatMode']         = jQuery(this).data('repeatmode') ? jQuery(this).data('repeatmode') : 'continue';
5649    options['animationEngine']    = jQuery(this).data('animationengine') ? jQuery(this).data('animationengine') : '';
5650    options['infinityClonedNr']   = parseInt(jQuery(this).data('infinityclonednr'));
5651    options['refElementWidth']    = jQuery(this).data('refelementwidth') ? jQuery(this).data('refelementwidth') : '';
5652    options['version']            = jQuery(this).data('version') ? jQuery(this).data('version') : '';
5653    options['basicDurationWidth'] = jQuery(this).data('basicdurationwidth') ? jQuery(this).data('basicdurationwidth') : '';
5654    
5655    var tO = null;
5656    if(window.tickerObjects[jQuery(this).attr('id')] === undefined){
5657      tO = new wClassTicker(jQuery(this), options);
5658      window.tickerObjects[tO.containerId] = tO;
5659    }
5660    else{
5661      tO = window.tickerObjects[jQuery(this).attr('id')];
5662    }
5663    if(tO.isVisible()) tO.start();
5664    else tO.reset();
5665  });
5666};
5667        
5668jQuery.fn.wImageMap = function(){
5669  
5670  if(jQuery('.imageMap[data-object-fit="height"]')){
5671    jQuery(window).on('resize', function(){    
5672      jQuery('.imageMap[data-object-fit="height"]').each(function(options){
5673        var computedStyle = window.getComputedStyle(jQuery(this).get(0));    
5674        var widthImage    = parseInt(computedStyle.width);
5675        var heightImage   = parseInt(computedStyle.height);
5676
5677        var computedStyleParent = window.getComputedStyle(jQuery(this).parent().get(0));    
5678        var widthParent         = parseInt(computedStyleParent.width);      
5679        //console.log(widthImage + ' ' + widthParent);
5680        if(widthImage > widthParent + 1){
5681          jQuery(this).css({'margin-left' : String((widthParent - widthImage) / 2) + 'px'});
5682        }  
5683        else{
5684          jQuery(this).css({'margin-left' : 'auto'});
5685        }
5686      });  
5687    });
5688  }
5689  
5690  jQuery.each(jQuery(this), function(options){
5691    
5692    if(jQuery(this).data('hasInit') != '1'){
5693      var iMi = jQuery(this).find('.imageMap');
5694      var iMl = jQuery(this).find('.imageMapLabels');    
5695
5696      jQuery(this).find('.imageMap').on('click', function(event){
5697        if(jQuery(event.target).closest('.mapEntry').length == 0){
5698          iMl.find('.mapLabel').removeClass('clickedEntry').removeClass('clicked');
5699          iMi.find('.mapEntry').removeClass('clickedLabel').removeClass('clicked');
5700        } 
5701      });
5702      
5703      jQuery(this).find('.mapEntry').on('mouseenter', function(event){
5704        if(jQuery(this).attr('data-event') == 'clickOnly') return true;
5705        jQuery(this).addClass('mouseover').siblings('.mapEntry').removeClass('clicked').removeClass('clickedEntry');
5706        var iMim = jQuery(this).find('.mapEntryIcon > img')
5707        if(iMim.length == 1){
5708          iMim.data('srcorig', iMim.attr('src'));
5709          iMim.attr('src', iMim.data('imgmo'));
5710        }        
5711        iMl.find('.mapLabel').addClass('no-mouseoverEntry').removeClass('clicked').removeClass('clickedEntry');           
5712        iMl.find('.mapLabel[data-id="' + jQuery(this).data('id') + '"]').removeClass('no-mouseoverEntry').addClass('mouseoverEntry');        
5713      });
5714
5715      jQuery(this).find('.mapEntry').on('mouseleave', function(event){
5716        if(jQuery(this).attr('data-event') == 'clickOnly') return true;
5717        jQuery(this).removeClass('mouseover');
5718        var iMim = jQuery(this).find('.mapEntryIcon > img')
5719        if(iMim.length == 1 && iMim.data('srcorig')){
5720          iMim.attr('src', iMim.data('srcorig'));
5721        }        
5722        iMl.find('.mapLabel').removeClass('no-mouseoverEntry');             
5723        iMl.find('.mapLabel[data-id="' + jQuery(this).data('id') + '"]').removeClass('mouseoverEntry');            
5724      });
5725
5726      jQuery(this).find('.mapLabel').on('mouseenter', function(event){
5727        if(jQuery(this).attr('data-event') == 'clickOnly') return true;
5728        jQuery(this).addClass('mouseover').siblings('.mapLabel').removeClass('clickedLabel');      
5729        iMi.find('.mapEntry').addClass('no-mouseoverLabel').removeClass('clicked').removeClass('clickedLabel');      
5730        iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"]').removeClass('no-mouseoverLabel').addClass('mouseoverLabel');
5731        
5732        var iMim = iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"]').find('.mapEntryIcon > img')
5733        if(iMim.length == 1){
5734          iMim.data('srcorig', iMim.attr('src'));
5735          iMim.attr('src', iMim.data('imgmo'));
5736        }                
5737      });
5738
5739      jQuery(this).find('.mapLabel').on('mouseleave', function(event){
5740        if(jQuery(this).attr('data-event') == 'clickOnly') return true;
5741        jQuery(this).removeClass('mouseover');      
5742        iMi.find('.mapEntry').removeClass('no-mouseoverLabel');       
5743        iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"]').removeClass('mouseoverLabel');
5744        var iMim = iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"]').find('.mapEntryIcon > img')
5745        if(iMim.length == 1 && iMim.data('srcorig')){
5746          iMim.attr('src', iMim.data('srcorig'));
5747        }            
5748      });
5749      
5750      jQuery(this).find('.mapEntry').on('click', function(event){
5751        jQuery(this).siblings('.mapEntry').removeClass('clicked').removeClass('clickedLabel');
5752        jQuery(this).toggleClass('clicked');
5753        iMl.find('.mapLabel[data-id="' + jQuery(this).data('id') + '"]').toggleClass('clickedEntry').siblings('.mapLabel').removeClass('clickedEntry').removeClass('clicked');
5754        if(iMl.attr('data-scrolltoelement') == 'yes'){
5755          if(iMl.css('display') == 'block') wScrollSmoothToElement(iMl.find('.mapLabel[data-id="' + jQuery(this).data('id') + '"]'));
5756        }
5757      });   
5758
5759      jQuery(this).find('.mapLabel').on('click', function(event){
5760        jQuery(this).siblings('.mapLabel').removeClass('clicked').removeClass('clickedEntry');
5761        jQuery(this).toggleClass('clicked');    
5762        iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"]').toggleClass('clickedLabel').siblings('.mapEntry').removeClass('clickedLabel').removeClass('clicked');
5763        if(iMi.find('.imageMapEntries').attr('data-scrolltoelement') == 'yes'){
5764          try{
5765            wScrollSmoothToElement(iMi);
5766            iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"]').trigger('mouseenter');
5767            var offsetLeft = iMi.find('.mapEntry[data-id="' + jQuery(this).data('id') + '"] .mapEntryMarker').position().left;
5768            if(offsetLeft > iMi.width()) iMi.scrollLeft(offsetLeft + iMi.width()/2);
5769            if(offsetLeft < iMi.scrollLeft()) iMi.scrollLeft(offsetLeft - iMi.width()/2);
5770          }
5771          catch(e){}
5772        }
5773      }); 
5774    }
5775    
5776    jQuery(this).data('hasInit', '1');
5777    
5778    jQuery(this).find('.mapEntry').each(function(options){
5779      var connectorMarker  = jQuery(this).find('.mapEntryConnectorMarker');
5780      var connectorInfobox = jQuery(this).find('.mapEntryConnectorInfo');
5781      var infobox          = jQuery(this).find('.mapEntryInfo');      
5782      if(connectorMarker.length && connectorInfobox.length){
5783        
5784        var computedStyleConnectorMarker = window.getComputedStyle(connectorMarker.get(0));       
5785        var computedStyleConnectorInfobox = window.getComputedStyle(connectorInfobox.get(0));       
5786
5787        var lm = parseFloat(connectorMarker[0].style.left);
5788        var tm = parseFloat(connectorMarker[0].style.top);
5789        var li = parseFloat(connectorInfobox[0].style.left);
5790        var ti = parseFloat(connectorInfobox[0].style.top);
5791        
5792        var wi = infobox.outerWidth();
5793        var hi = infobox.outerWidth();        
5794        
5795        var mlm = computedStyleConnectorMarker['margin-left'];
5796        var mtm = computedStyleConnectorMarker['margin-top'];
5797        var mli = computedStyleConnectorInfobox['margin-left'];
5798        var mti = computedStyleConnectorInfobox['margin-top'];
5799        
5800        var line1 = jQuery(this).find('.mapEntryLine-1');
5801        var line2 = jQuery(this).find('.mapEntryLine-2');
5802        var line3 = jQuery(this).find('.mapEntryLine-3');
5803        
5804        //console.log(lm + '/' + tm + ' : ' + li + '/' + ti);
5805        //console.log(mlm + '/' + mtm + ' : ' + mli + '/' + mti);        
5806        //console.log('calc(' + String(lm) + '% + ' + mlm + ')');
5807        
5808        var lineWidth = 1;
5809        
5810        if(ti <= tm && li >= lm && parseFloat(mtm) < 0){
5811          line1.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(ti + (tm - ti) / 2) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : String((tm - ti) / 2) + '%'});                  
5812          line2.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(ti + (tm - ti) / 2) + '% + ' + mtm + ')', 'width' : 'calc(' + String(li - lm) + '% ' + '-' + ' ' + mlm + ' + ' + lineWidth + 'px)', 'height' : String(lineWidth) + 'px'});
5813          line3.css({'left' : 'calc(' + String(li) + '% + ' + mli + ')', 'top' : String(ti) + '%', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String((tm - ti) / 2) + '% + ' + mtm + ')'});        
5814        }
5815        else if(ti <= tm && li <= lm && parseFloat(mtm) < 0){
5816          line1.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(ti + (tm - ti) / 2) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : String((tm - ti) / 2) + '%'});                  
5817          line2.css({'left' : 'calc(' + String(li) + '% + ' + mli + ')', 'top' : 'calc(' + String(ti + (tm - ti) / 2) + '% + ' + mtm + ')', 'width' : 'calc(' + String(lm - li) + '% ' + '-' + ' ' + mli + ' + ' + lineWidth + 'px)', 'height' : String(lineWidth) + 'px'});
5818          line3.css({'left' : 'calc(' + String(li) + '% + ' + mli + ')', 'top' : String(ti) + '%', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String((tm - ti) / 2) + '% + ' + mtm + ')'});        
5819        }     
5820        else if(ti > tm && li > lm && parseFloat(mtm) > 0){
5821          line1.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : String((ti - tm) / 2) + '%'});                  
5822          line2.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(ti + (tm - ti) / 2) + '% + ' + mtm + ')', 'width' : 'calc(' + String(li - lm) + '% ' + '-' + ' ' + mlm + ' + ' + lineWidth + 'px)', 'height' : String(lineWidth) + 'px'});
5823          line3.css({'left' : 'calc(' + String(li) + '% + ' + mli + ')', 'top' : 'calc(' + String(tm + (ti - tm) / 2) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String((ti - tm) / 2) + '% ' + '-' + ' ' + mtm + ')'});        
5824        }
5825        else if(ti > tm && li < lm && parseFloat(mtm) > 0){
5826          line1.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : String((ti - tm) / 2) + '%'});                  
5827          line2.css({'left' : 'calc(' + String(li) + '% + ' + mli + ')', 'top' : 'calc(' + String(tm + (ti - tm) / 2) + '% + ' + mtm + ')', 'width' : 'calc(' + String(lm - li) + '% ' + '-' + ' ' + mlm + ' + ' + lineWidth + 'px)', 'height' : String(lineWidth) + 'px'});
5828          line3.css({'left' : 'calc(' + String(li) + '% + ' + mli + ')', 'top' : 'calc(' + String(tm + (ti - tm) / 2) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String((ti - tm) / 2) + '% ' + '-' + ' ' + mtm + ')'});        
5829        }                
5830        else if(li >= lm && ti >= tm){
5831          line1.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : 'calc(' + String((li - lm) / 2) + '% ' + '-' + ' ' + mlm + ')', 'height' : String(lineWidth) + 'px'});                  
5832          line2.css({'left' : 'calc(' + String(lm + (li - lm) / 2) + '%)', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String(ti - tm) + '% ' + '-' + ' ' + mtm + ' + ' + lineWidth + 'px)'});
5833          line3.css({'left' : 'calc(' + String(lm + (li - lm) / 2) + '%)', 'top' : 'calc(' + String(ti) + '% + ' + mti + ')', 'width' : String((li - lm) / 2) + '%', 'height' : String(lineWidth) + 'px'});                  
5834        }
5835        else if(li >= lm && ti <= tm){
5836          line1.css({'left' : 'calc(' + String(lm) + '% + ' + mlm + ')', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : 'calc(' + String((li - lm) / 2) + '% ' + '-' + ' ' + mlm + ')', 'height' : String(lineWidth) + 'px'});                  
5837          line2.css({'left' : 'calc(' + String(lm + (li - lm) / 2) + '%)', 'top' : 'calc(' + String(ti) + '% + ' + mti + ')', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String(tm - ti) + '% ' + '-' + ' ' + mti + ' + ' + lineWidth + 'px)'});
5838          line3.css({'left' : 'calc(' + String(lm + (li - lm) / 2) + '%)', 'top' : 'calc(' + String(ti) + '% + ' + mti + ')', 'width' : String((li - lm) / 2) + '%', 'height' : String(lineWidth) + 'px'});                  
5839        }        
5840        else if(li < lm && ti > tm){
5841          line1.css({'left' : 'calc(' + String(li + (lm - li) / 2) + '% + ' + 0 + 'px)', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : 'calc(' + String((lm - li) / 2) + '% + ' + mlm + ')', 'height' : String(lineWidth) + 'px'});                  
5842          line2.css({'left' : 'calc(' + String(lm + (li - lm) / 2) + '%)', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String(ti - tm) + '% ' + '-' + ' ' + mtm + ' + ' + lineWidth + 'px)'});
5843          line3.css({'left' : 'calc(' + String(li) + '% + ' + 0 + 'px)', 'top' : 'calc(' + String(ti) + '% + ' + mti + ')', 'width' : 'calc(' + String((lm - li) / 2) + '% + 0px)', 'height' : String(lineWidth) + 'px'});                  
5844        }
5845        else if(li < lm && ti < tm){
5846          line1.css({'left' : 'calc(' + String(li + (lm - li) / 2) + '% + ' + 0 + 'px)', 'top' : 'calc(' + String(tm) + '% + ' + mtm + ')', 'width' : 'calc(' + String((lm - li) / 2) + '% + ' + mlm + ')', 'height' : String(lineWidth) + 'px'});                  
5847          line2.css({'left' : 'calc(' + String(lm + (li - lm) / 2) + '%)', 'top' : 'calc(' + String(ti) + '% + ' + mti + ')', 'width' : String(lineWidth) + 'px', 'height' : 'calc(' + String(tm - ti) + '% ' + '-' + ' ' + mti + ' + ' + lineWidth + 'px)'});
5848          line3.css({'left' : 'calc(' + String(li) + '% + ' + 0 + 'px)', 'top' : 'calc(' + String(ti) + '% + ' + mti + ')', 'width' : 'calc(' + String((lm - li) / 2) + '% + 0px)', 'height' : String(lineWidth) + 'px'});                  
5849        }  
5850      }
5851    });    
5852  });  
5853}; 
5854       
5855jQuery.fn.wImageCompare = function(){
5856  
5857  jQuery.each(jQuery(this), function(options){
5858    
5859    if(jQuery(this).data('hasInit') != '1'){
5860      jQuery(this).data('hasInit', '1');  
5861      var fg = jQuery(this);            
5862      fg.append('<div class="wglImageCompareSlider"><div><span></span><span></span></div></div>');
5863      var sl = fg.find('.wglImageCompareSlider');      
5864            
5865      var pf = jQuery(this).find('picture:first-child');
5866      var pl = jQuery(this).find('picture:nth-child(2)');
5867      var po = [];
5868      var ps = -1;
5869      var ia = false;
5870
5871      var getSizes = function () {
5872        po = [fg.offset().left, fg.offset().top, pl.width(), pl.height()];
5873        if (ps === -1) {
5874          ps = (po[2] / 2);
5875          if (ps === 0) {
5876            var visibleParent = fg.parents(':visible');
5877            if(visibleParent.length > 0) {
5878              ps = visibleParent.width() / 2;
5879            }
5880          }
5881        }
5882      };
5883      
5884      var adaptSlider = function(){
5885        pl.css('clip', 'rect(0, ' + ps + 'px, ' + po[3] + 'px, 0)');
5886        sl.css({'left' : ps + 'px', 'height' : po[3] + 'px'});
5887      };
5888      
5889      fg.on('mousedown touchstart', function(event){
5890        event.preventDefault();
5891        event.stopPropagation();
5892        ia = true;
5893      });
5894
5895      fg.on('mousemove touchmove', function(event){
5896        event.stopPropagation();     
5897        if(ia){
5898          var pageX = event.pageX ? event.pageX : event.touches[0].pageX;
5899          ps = pageX - po[0];
5900          ps = ps < 0 ? 0 : (ps > po[2] ? po[2] : ps);
5901          adaptSlider();        
5902        }
5903      });         
5904      
5905      fg.on('mouseup touchend', function(event){
5906        ia = false;
5907      });  
5908      
5909      jQuery(window).on('resize', function(){
5910        getSizes();
5911        adaptSlider();
5912      }); 
5913      
5914      window.setTimeout(function(){
5915        getSizes();
5916        adaptSlider();
5917      }, 200);
5918      window.setTimeout(function(){
5919        getSizes();
5920        adaptSlider();
5921      }, 400);
5922      window.setTimeout(function(){
5923        getSizes();
5924        adaptSlider();
5925      }, 800);      
5926      
5927      getSizes();
5928      adaptSlider();
5929      jQuery(this).addClass('hasInit');         
5930    }
5931  });  
5932}; 
5933
5934jQuery.fn.wSearchSuggest = function(){
5935  
5936  jQuery.each(jQuery(this), function(index){
5937    var cE = jQuery(this);
5938    cE.attr('autocomplete', 'off');
5939
5940    cE.on('keydown', function(event){
5941      if(event.keyCode == 27){
5942        jQuery('#searchSuggestOuter').remove();
5943      }
5944      else if(event.keyCode == 40 || event.keyCode == 38){
5945        event.preventDefault();
5946
5947        if(event.target.value == ''){
5948          return false;
5949        }
5950
5951        var positionSuggestSelected = 0;
5952        if(event.target.getAttribute('data-positionsuggestedselected')){
5953          positionSuggestSelected = positionSuggestSelected + parseInt(event.target.getAttribute('data-positionsuggestedselected'));
5954        }
5955
5956        positionSuggestSelected = event.keyCode == 40 ? positionSuggestSelected + 1 : positionSuggestSelected - 1;
5957        if(positionSuggestSelected > jQuery('#searchSuggestOuter .searchSuggestEntry').length){
5958          positionSuggestSelected = jQuery('#searchSuggestOuter .searchSuggestEntry').length;
5959        }
5960        else if(positionSuggestSelected < 1){
5961          positionSuggestSelected = 1;
5962        }
5963        
5964        if(jQuery('#searchSuggestOuter .searchSuggestEntry:nth-child(' + positionSuggestSelected + ')').data('word')){
5965          event.target.value = jQuery('#searchSuggestOuter .searchSuggestEntry:nth-child(' + positionSuggestSelected + ')').data('word');  
5966          event.target.setAttribute('data-positionsuggestedselected', positionSuggestSelected);
5967        }
5968
5969        jQuery('#searchSuggestOuter .searchSuggestEntry').removeClass('selected');
5970        jQuery('#searchSuggestOuter .searchSuggestEntry:nth-child(' + positionSuggestSelected + ')').addClass('selected');
5971      }
5972    });
5973    
5974    const debounceSuggest = typeof(wDebounceSuggest) != 'undefined' ? wDebounceSuggest : 300;    
5975      
5976    const debouncedHandler = wDebounce(wKeydownSuggest, debounceSuggest);      
5977
5978    cE.on('keyup', function(event){
5979      event.preventDefault();      
5980      if(event.keyCode == 40 || event.keyCode == 38){
5981        event.preventDefault();
5982        return;
5983      }
5984      
5985      wUiTmp['wKeydownSuggestThis'] = jQuery(this);      
5986      debouncedHandler();
5987    });
5988    
5989    cE.on('blur', function(event){
5990      event.preventDefault();
5991      jQuery('#searchSuggestOuter').remove();
5992    }); 
5993    
5994    cE.parent().on('mousedown', function(e){
5995      if(jQuery(e.target).closest('.searchSuggestEntry').length){
5996        jQuery(e.target).closest('#searchSuggestOuter').prev('input').val(jQuery(e.target).closest('.searchSuggestEntry').data('word'));
5997        jQuery(this).closest('form').submit();
5998        jQuery('#searchSuggestOuter').remove();  
5999      }
6000    });
6001  }); 
6002};      
6003
6004wKeydownSuggest = function(){
6005    
6006  var cE = wUiTmp['wKeydownSuggestThis'];
6007  
6008  var searchTerm = cE.val();
6009  
6010  if(typeof(wUiTmp['searchTermNumberResults']) == 'undefined'){
6011    wUiTmp['searchTermNumberResults'] = {};
6012  }
6013  
6014  if(searchTerm != '' && searchTerm != wUiTmp['lastSearchTerm']){
6015
6016    if(wUiTmp['lastSearchTerm'] && searchTerm.indexOf(wUiTmp['lastSearchTerm']) == 0 && wUiTmp['lastSearchTermNumberResults'] == 0){
6017      return;
6018    }
6019
6020    if(wUiTmp['searchTermNumberResults'][searchTerm] && wUiTmp['searchTermNumberResults'][searchTerm] == 0){
6021      return;
6022    }
6023    var project = location.pathname.replace(/[^\/]*$/, '').replace(/^(\/[^\/]*)[^\?]*/, '$1');
6024    if(cE.data('project-search')){
6025      projectSearch = cE.data('project-search');
6026      if(project == '/'){
6027        project = projectSearch.replace(/\s*\!important/, '');
6028      }
6029      else if(projectSearch.indexOf('!important') != -1){
6030        project = projectSearch.replace(/\s*\!important/, '');
6031      }
6032    }
6033    var querystringToAdd = '';
6034    if(cE.data('querystringtoadd')){
6035      querystringToAdd = cE.data('querystringtoadd');
6036    }
6037    var querystringSuggestPath = '';
6038    if(cE.data('suggest-path')){
6039      querystringSuggestPath = '&suggestPath=' + cE.data('suggest-path');
6040    }          
6041    var projectGlobal = wUiTmp['wGlobalProjectPath'];
6042    var search        = 'default';
6043    if(cE.data('id-search')){
6044      search = cE.data('id-search');
6045    }
6046    var url = projectGlobal + '/wGlobal/scripts/php/wSearchSuggest.php?searchTerm=' + encodeURIComponent(searchTerm) + '&project=' + project + '&search=' + search + querystringSuggestPath + querystringToAdd;
6047    if(cE.data('usecache') == '1'){
6048      url = project + '/weblication/wSearchSuggest/searchTerm=' + encodeURIComponent(searchTerm).replace(/~/g, '_WT-IL_').replace(/%/g, '~').toLowerCase() + '.html';
6049    }
6050
6051    jQuery.ajax({type: "GET", url: url, dataType: 'json', success: function(resultData){
6052      var numberResults = 0;
6053      var innerHTMLSuggest = '<div id="searchSuggestOuter"><div id="searchSuggestInner">';
6054      for(word in resultData){
6055        innerHTMLSuggest += '<div class="searchSuggestEntry" data-word="' + word + '">' + word + '</div>';
6056        numberResults++;
6057      }
6058      
6059      wUiTmp['lastSearchTermNumberResults'] = numberResults;
6060      wUiTmp['searchTermNumberResults'][searchTerm] = numberResults;
6061
6062      innerHTMLSuggest += '</div></div>';
6063      jQuery('#searchSuggestOuter').remove();
6064      if(numberResults > 0){
6065        cE.after(innerHTMLSuggest);
6066      }
6067    }});
6068  }
6069  else if(searchTerm != wUiTmp['lastSearchTerm']){
6070    jQuery('#searchSuggestOuter').remove();
6071  }
6072  wUiTmp['lastSearchTerm'] = searchTerm;    
6073};
6074
6075jQuery.fn.wTabcontainer = function(data = {}){
6076
6077  var maxHeightContent = 0;
6078
6079  jQuery.each(jQuery(this), function(){
6080
6081    var tabcontainerCurrent     = jQuery(this);
6082    
6083    if(typeof(wOnBeforeInitTabcontainer) === 'function'){
6084      var rtcEvent = wOnBeforeInitTabcontainer(tabcontainerCurrent);
6085      if(rtcEvent === false){
6086        return false;
6087      }
6088    }
6089    
6090    var tabcontainerID   = tabcontainerCurrent.get(0).id.replace(/tabContainer_/, '');
6091    var tabcontainerTabs = tabcontainerCurrent.find('> .tabsSmall, > .tabsSelectbox, > .tabs, > div > .tabs, > div > div > .tabs, > div > div > div > .tabs, > .containers, > div > .containers, > div > div > .containers');
6092    var curHash          = data['curHashId'] || location.hash;
6093
6094    var options = {};
6095    options['initOpen']         = options['initOpen']         || jQuery(this).attr('data-initopen');
6096    options['rememberSelected'] = options['rememberSelected'] || jQuery(this).data('rememberselected');
6097    options['expandAll']        = options['expandAll'] || jQuery(this).attr('data-expandall');
6098    var activeContent = options['initOpen'] || 0;
6099
6100
6101    if(/^\d+$/.test(activeContent)){
6102      activeContent = parseInt(activeContent) - 1;
6103    }
6104
6105    if(options['rememberSelected'] == '1' || typeof(wEditor) != 'undefined'){
6106      var checkCookieRegExp = new RegExp('registerTab_' + tabcontainerID + '=(\\d+)');
6107      if(checkCookieRegExp.test(document.cookie)){
6108        activeContent = RegExp.$1 - 1;
6109      }
6110    }
6111    
6112    var jQueryHashIdOrig = curHash.replace(/\:/g, '\\:').replace(/\./g, '\\.').replace(/\//g, '\\/').replace(/\&/g, '').replace(/=/g, '').replace(/\[/g, '').replace(/\]/g, '').replace(/\?/g, '');
6113    var jQueryHashId     = jQueryHashIdOrig.replace('open_', 'anchor_');
6114  
6115    if(jQueryHashId != '' && jQueryHashId != '#' && /^#?tab_/.test(jQueryHashId) && jQuery(this).find(jQueryHashId).length > 0){
6116      if(/_(\d+)$/.test(jQuery(jQueryHashId).attr('id'))){
6117        activeContent = RegExp.$1 - 1;
6118      }
6119      else{
6120        var containerIndex = jQuery(jQueryHashId).parents('.container, .containerInvisible').index();
6121        if(containerIndex >= 0){
6122          activeContent = containerIndex;
6123        }
6124      }
6125    }
6126
6127    if(jQueryHashId != '' && jQueryHashId != '#' && jQuery(this).find(jQueryHashIdOrig).length > 0){
6128      if(jQuery(this).find(jQueryHashIdOrig).closest('.container').length > 0){
6129        var closestId = jQuery(this).find(jQueryHashIdOrig).closest('.container').attr('id');
6130        if(/_(\d+)$/.test(closestId)){
6131          activeContent = !isNaN(parseInt(RegExp.$1)) && parseInt(RegExp.$1) >= 1 ? parseInt(RegExp.$1) - 1 : 0;
6132        }  
6133      }  
6134    }  
6135
6136    if(options['initOpen'] !== 'false'){
6137      if(options['expandAll'] == '1'){
6138        tabcontainerCurrent.attr('data-initOpen', 'openAll');
6139        tabcontainerCurrent.find('.containerTab').addClass('containerTabSelected').next('.container').addClass('containerSelected containerSelectedAfterInit').removeClass('containerInvisible');
6140      }
6141      else if(typeof(wEditor) == 'undefined'){   
6142        tabcontainerCurrent.find('> .tabsOuter > .tabs > .tabSelected,> .tabs > .tabSelected').removeClass('tabSelected');
6143        tabcontainerCurrent.find('> .tabsOuter > .tabs > .tab,> .tabs > .tab').eq(activeContent).addClass('tabSelected');
6144        tabcontainerCurrent.find('> .containers > .containerTab,> div > .containers > .containerTab,> div > div > .containers > .activeContent').removeClass('containerTabSelected');        
6145        tabcontainerCurrent.find('> .containers > .containerTab,> div > .containers > .containerTab,> div > div > .containers > .activeContent').eq(activeContent).addClass('containerTabSelected');    
6146        tabcontainerCurrent.find('> .containers > .container,> div > .containers > .container,> div > div > .containers > .container').addClass('containerInvisible');
6147        tabcontainerCurrent.find('> .containers > .container,> div > .containers > .container,> div > div > .containers > .container').eq(activeContent).removeClass('containerInvisible').addClass('containerSelected').addClass('containerSelectedAfterInit');
6148      }
6149      else{
6150        tabcontainerCurrent.find('> div > div > .tabsOuter > .tabs > .tabSelected,> div > div > .tabs > .tabSelected').removeClass('tabSelected');
6151        tabcontainerCurrent.find('> div > div > .tabsOuter > .tabs > .tab,> div > div > .tabs > .tab').eq(activeContent).addClass('tabSelected');
6152        tabcontainerCurrent.find('> div > div > .containers > .containerTab,> div > div > div > .containers > .containerTab,> div > div > div > div > .containers > .activeContent').removeClass('containerTabSelected');        
6153        tabcontainerCurrent.find('> div > div > .containers > .containerTab,> div > div > div > .containers > .containerTab,> div > div > div > div > .containers > .activeContent').eq(activeContent).addClass('containerTabSelected');    
6154        tabcontainerCurrent.find('> div > div > .containers > .container,> div > div > div > .containers > .container,> div > div > div > div > .containers > .container').addClass('containerInvisible');
6155        tabcontainerCurrent.find('> div > div > .containers > .container,> div > div > div > .containers > .container,> div > div > div > div > .containers > .container').eq(activeContent).removeClass('containerInvisible').addClass('containerSelected').addClass('containerSelectedAfterInit');      
6156      }   
6157      if(tabcontainerCurrent.attr('data-initopen') != 0) tabcontainerCurrent.attr('data-numberclicks', parseInt(tabcontainerCurrent.attr('data-numberclicks'))+1);    
6158    }
6159    
6160    var eventsOpen = 'click';
6161  
6162    if(tabcontainerTabs.data('selecttabonmouseover') == '1'){
6163      eventsOpen = 'click mouseover';
6164    }
6165
6166    if(typeof(wEditor) == 'undefined'){ 
6167      /*Barrierefreiheit*/
6168      aE = jQuery.extend(true, {element : tabcontainerCurrent}, wAccessEvents['containerTab']);
6169      wAccessHandler.addEvent(aE, {'idPrefix' : 'containerTab'});
6170    }  
6171    
6172    tabcontainerTabs.children('.tab, .containerTab').on(eventsOpen, function(event){
6173      event.preventDefault();
6174            
6175      var eventType            = event.type;
6176      var headerSelected       = jQuery(this);
6177      var tabcontainerSelected = headerSelected.get(0).id.replace(/.*_/, '');
6178      var displayAccordeon     = tabcontainerCurrent.hasClass('breakChildren');
6179      var numberClicks         = tabcontainerCurrent.attr('data-numberclicks');
6180      var initState            = tabcontainerCurrent.attr('data-initOpen');
6181      var openMultiple         = tabcontainerCurrent.attr('data-openmultiple');
6182      var tabSelected          = jQuery(this).hasClass('tabSelected');
6183          
6184      tabcontainerCurrent.attr('data-numberclicks', tabcontainerCurrent.attr('data-numberclicks') ? parseInt(tabcontainerCurrent.attr('data-numberclicks')) + 1 : 1);
6185      
6186      if(eventType == 'mouseover' && headerSelected.get(0).className.indexOf('containerTab') != -1){
6187        return false;
6188      }     
6189
6190      if(eventType != 'mouseover' && headerSelected.attr('id') && headerSelected.parent().data('pushstateonselect') == '1'){
6191        history.pushState({page: '#' + headerSelected.attr('id')}, '', '#' + headerSelected.attr('id'));
6192      }
6193
6194      var containers = jQuery(this).parent().parent().get(0).className.indexOf('tabsOuter') == 0 ? jQuery(this).parent().parent().parent().find('> .containers,> div > .containers,> div > div > .containers') : jQuery(this).parent().parent().find('> .containers,> div > .containers,> div > div > .containers');
6195
6196      if(typeof(wOnBeforeClickTabcontainer) === 'function'){
6197        var rtcEvent = wOnBeforeClickTabcontainer(headerSelected);
6198        if(rtcEvent === false){
6199          return false;
6200        }
6201      }               
6202      
6203      containers.children('.containerTab').each(function(){
6204        var currentContainerTab = this;
6205        (function(currentContainerTab){
6206          if(currentContainerTab.id == 'containerTab_' + tabcontainerID + '_' + tabcontainerSelected){
6207            if(initState == 'openAll'){
6208              currentContainerTab.className = 'containerTab containerTabSelected';
6209            }
6210            else if(tabSelected != 1 && displayAccordeon && numberClicks != 0 && currentContainerTab.className.indexOf('containerTabSelected') != -1 && currentContainerTab.className.indexOf('containerTabUnselectedAccordeon') == -1){
6211              currentContainerTab.className = 'containerTab containerTabUnselectedAccordeon'; 
6212            }
6213            else{
6214              currentContainerTab.className = 'containerTab containerTabSelected';
6215            }  
6216          }
6217          else{
6218            currentContainerTab.className = 'containerTab';
6219          }         
6220        })(currentContainerTab);
6221      });
6222            
6223      containers.children('.container, .containerSelected, .containerInvisible').each(function(){
6224        var currentContainer = this;
6225        (function(currentContainer){
6226          //console.log(currentContainer.id + ' == container_' + tabcontainerID + '_' + tabcontainerSelected);
6227          if(currentContainer.id == 'container_' + tabcontainerID + '_' + tabcontainerSelected){
6228            if(initState == 'openAll'){
6229              currentContainer.className = 'container containerSelected';
6230              window.setTimeout(function(){jQuery(currentContainer).addClass('containerSelectedAfterInit')}, 32);
6231            }
6232            else if(tabSelected != 1 && displayAccordeon && numberClicks != 0 && currentContainer.className.indexOf('containerSelected') != -1 && currentContainer.className.indexOf('containerInvisibleAccordeon') == -1){
6233              currentContainer.className = 'container containerInvisibleAccordeon'; 
6234            }
6235            else{
6236              currentContainer.className = 'container containerSelected';
6237              window.setTimeout(function(){jQuery(currentContainer).addClass('containerSelectedAfterInit')}, 32);
6238            }              
6239          }
6240          else{
6241            if(openMultiple != '1' || !displayAccordeon){
6242              currentContainer.className = 'container containerInvisible';
6243              window.setTimeout(function(){jQuery(currentContainer).addClass('containerInvisibleAfterInit')}, 32);
6244            }
6245          }
6246        })(currentContainer);
6247      });
6248      
6249      var tabsOuter = jQuery(this).parent().parent();
6250      
6251      if(tabsOuter.hasClass('containersOuter')){
6252        tabsOuter = tabsOuter.parent().find('.tabsOuter');
6253      }
6254      
6255      tabsOuter.find('> .tabsSmall, > .tabsSelectbox, > .tabs, > div > .tabs, > div > div > .tabs, > div > div > div > .tabs').children('.tab').each(function(){
6256        if(this.id == 'tab_' + tabcontainerID + '_' + tabcontainerSelected){ 
6257          jQuery(this).addClass('tabSelected').attr({'tabindex': -1, 'aria-selected': 'true'});
6258        }
6259        else{
6260          jQuery(this).removeClass('tabSelected').attr({'tabindex': 0, 'aria-selected': 'false'});
6261        }           
6262      });      
6263
6264      if(typeof(wEditor) != 'undefined' || options['rememberSelected'] == '1'){
6265        document.cookie = 'registerTab_' + tabcontainerID + '=' + tabcontainerSelected + ';path=/;sameSite=Lax';
6266      }     
6267
6268      if(typeof(wOnAfterClickTabcontainer) === 'function'){
6269        var rtcEvent = wOnAfterClickTabcontainer(headerSelected);
6270        if(rtcEvent === false){
6271          return false;
6272        }
6273      }               
6274      
6275      if(eventType != 'mouseover'){
6276        jQuery(window).trigger('resize');
6277      }
6278      jQuery('.wglBannerSlider').wBannerSlider();
6279      jQuery('.wglSmartSlider').wSmartSlider();
6280      jQuery('.wglPictureGallery').wPictureGallery();
6281    });
6282
6283    if(typeof(wEditor) == 'undefined'){
6284      jQuery(this).find('.container, .containerSelected, .containerInvisible').each(function(index){
6285        if(jQuery(this).html() == ''){
6286          tabcontainerCurrent.find('> .tabs > div:nth-child(' + (index + 1) + ')').remove();
6287        }
6288      });
6289    }
6290  });
6291};
6292
6293wOpenAllTabcontainer = function(id){
6294  jQuery('.wglTabcontainer').attr('data-expandall', '1').attr('data-initopen', '0').wTabcontainer();
6295};
6296
6297wOnBreakChildrenTabContainer = function(el){
6298  //console.log('wOnBreakChildrenTabContainer()');
6299  
6300  var tabContainer = el.closest('.elementTabContainer');
6301  if(!tabContainer.hasClass('breakChildren')){   
6302    tabContainer.find('.tab:first-child').trigger('click');
6303  }
6304};
6305
6306jQuery.fn.wAccordion = function(){
6307
6308  var maxHeightContent = 0;  
6309  
6310  jQuery.each(jQuery(this), function(){
6311
6312    var options = {};
6313
6314    options['initOpen']          = options['initOpen']          || jQuery(this).data('initopen');
6315    options['multiple']          = options['multiple']          || jQuery(this).data('multiple');
6316    options['expandAll']         = options['expandAll']         || jQuery(this).data('expandall');
6317    options['collapsible']       = options['collapsible']       || jQuery(this).data('collapsible');
6318    options['group']             = options['group']             || jQuery(this).data('group');
6319    options['rememberSelected']  = options['rememberSelected']  || jQuery(this).data('rememberselected');
6320    options['addCloserContent']  = options['addCloserContent']  || jQuery(this).data('addclosercontent') || '';
6321    options['slideMode']         = options['slideMode']         || jQuery(this).data('slidemode') || jQuery(this).data('slidemode') || '';
6322    options['slideUpDuration']   = options['slideUpDuration']   || jQuery(this).data('slideup-duration') || jQuery(this).data('slide-duration') || 400;
6323    options['slideDownDuration'] = options['slideDownDuration'] || jQuery(this).data('slidedown-duration') || jQuery(this).data('slide-duration') || 400;
6324    options['slideUpEasing']     = options['slideUpEasing']     || jQuery(this).data('slideup-easing') || jQuery(this).data('slide-easing') || 'swing';
6325    options['slideDownEasing']   = options['slideDownEasing']   || jQuery(this).data('slidedown-easing') || jQuery(this).data('slide-easing') || 'swing';
6326    
6327    var slideDownOptions = {duration : options['slideUpDuration'],   easing : options['slideUpEasing']};
6328    var slideUpOptions   = {duration : options['slideDownDuration'], easing : options['slideDownEasing']};
6329
6330    var accordionID   = jQuery(this).get(0).id.replace(/accordion_/, '');
6331
6332    var activeContent = options['initOpen'];
6333
6334    if(/^\d+$/.test(activeContent)){
6335      activeContent = parseInt(activeContent) - 1;
6336    }
6337    
6338    if(options['rememberSelected'] == '1'){
6339      var checkCookieRegExp = new RegExp('accordionTab_' + accordionID + '=Accordion-(\\d+)');
6340      if(checkCookieRegExp.test(document.cookie)){
6341        activeContent = RegExp.$1 - 1;
6342      }
6343      else{
6344        var checkCookieRegExp = new RegExp('accordionTab_' + accordionID + '=(\\d+)');
6345        if(checkCookieRegExp.test(document.cookie)){
6346          activeContent = RegExp.$1 - 1;
6347        }
6348      }
6349    }
6350    
6351    var jQueryHashId = decodeURIComponent(location.hash.replace(/\./g, '\\.').replace(/\//g, '\\/').replace('open_', 'anchor_').replace(/\&/g, '').replace(/=/g, '')).replace(/\[/g, '').replace(/\]/g, '').replace(/\?/g, '');    
6352
6353    options['active'] = options['active'] || activeContent;
6354            
6355    ignoreFocusout = false;
6356    lastFocusOut  = 0;            
6357
6358    jQuery(this).children('.accordionContent').each(function(index){      
6359      if(options['addCloserContent'] == '1'){
6360        jQuery(this).prepend('<div class="accordionCloserContent" tabindex="0"></div>');
6361
6362        jQuery(this).find('.accordionCloserContent').on('click', function(event){
6363          jQuery(this).parent().prev('.accordionHeader').trigger('click');
6364          wUiTmp['ignoreFocusout'] = true;
6365          setTimeout(function(){
6366            wUiTmp['ignoreFocusout'] = false;
6367          }, 500);      
6368        });
6369        
6370        jQuery(this).find('.accordionCloserContent').keypress(function(event){
6371         if(event.keyCode == 13 || event.keyCode == 32 ){
6372           jQuery(this).trigger('click');
6373           jQuery(this).parent().prev('.accordionHeader').focus();           
6374           event.preventDefault();
6375           wUiTmp['ignoreFocusout'] = true;
6376           setTimeout(function(){
6377             wUiTmp['ignoreFocusout'] = false;
6378           }, 500);              
6379         }
6380        }); 
6381        
6382        jQuery(this).on('focusin', function(event){
6383          wUiTmp['ignoreFocusout'] = true;
6384          setTimeout(function(){
6385            wUiTmp['ignoreFocusout'] = false;
6386          }, 100);             
6387        });
6388        
6389        jQuery(this).on('focusout', function(event){
6390          setTimeout(() => {
6391            if(wUiTmp['lastActionSource'] !== 'mouse' && wUiTmp['lastKey'] !== 'Tab' && wUiTmp['lastKey'] !== 'Escape'){
6392              return false; 
6393            }  
6394            
6395            //console.log(wUiTmp['lastAccordionOpen'] + ' == ' + accordionID + '_' + index);
6396            
6397            if(wUiTmp['ignoreFocusout']){
6398              return false;
6399            }
6400                        
6401            var container = jQuery(this).get(0);
6402
6403            const active = document.activeElement;
6404            if(!container.contains(active)){
6405              jQuery(this).find('.accordionCloserContent').trigger('click');
6406              
6407              wUiTmp['ignoreClick'] = true;
6408              setTimeout(function(){
6409                wUiTmp['ignoreClick'] = false;
6410              }, 300);                
6411            }
6412          }, 20);  
6413        });        
6414      }
6415
6416      var heightContent = jQuery(this).height();
6417      if(heightContent > maxHeightContent){
6418        maxHeightContent = heightContent;
6419      }
6420    });
6421
6422    var lastOpenedEntry = null;
6423
6424    jQuery(this).find('> .listEntry > .listEntryInner > .accordionHeader, > .accordionHeader, > h1, > h2, > h3, > h4').each(function(index){
6425            
6426      if(typeof(wEditor) == 'undefined'){ 
6427        jQuery(this).keypress(function(event){
6428         if(event.keyCode == 13 || event.keyCode == 32 ){
6429           jQuery(this).trigger("click");
6430           event.preventDefault();
6431         }
6432        });  
6433      }
6434      
6435      var openCurrent = false;     
6436      
6437      if(jQueryHashId != '' &&  jQueryHashId != '#' && ('#' + jQuery(this).attr('id') == jQueryHashId || jQuery(this).next('.accordionContent').find(jQueryHashId).length > 0)){
6438        if(/_Accordion-/.test(jQuery(jQueryHashId).attr('id'))){
6439          options['active'] = index;
6440          if(!options['multiple'] && lastOpenedEntry){
6441            lastOpenedEntry.addClass('accordionHeaderHidden').removeClass('accordionHeaderVisible');
6442            lastOpenedEntry.next('.accordionContent').addClass('accordionContentHidden').removeClass('accordionContentVisible').hide();
6443            lastOpenedEntry = null;
6444          }
6445          openCurrent = true;
6446        }
6447        else if(jQuery(jQueryHashId).parents('.accordionContent').length > 0){
6448          options['active'] = index;
6449        }
6450      }
6451      else{
6452        jQueryHashIdAlt = jQueryHashId.replace(/_Accordion-\d+/, '_Accordion');
6453
6454        if(jQueryHashIdAlt != '' && jQueryHashIdAlt != '#' &&  ('#' + jQuery(this).attr('id') == jQueryHashIdAlt || jQuery(this).next('.accordionContent').find(jQueryHashIdAlt).length > 0)){
6455          if(/_Accordion-/.test(jQuery(jQueryHashIdAlt).attr('id'))){
6456            options['active'] = index;
6457            if(!options['multiple'] && lastOpenedEntry){
6458              lastOpenedEntry.addClass('accordionHeaderHidden').removeClass('accordionHeaderVisible');
6459              lastOpenedEntry.next('.accordionContent').addClass('accordionContentHidden').removeClass('accordionContentVisible').hide();
6460              lastOpenedEntry = null;
6461            }
6462            openCurrent = true;
6463          }
6464          else if(jQuery(jQueryHashIdAlt).parents('.accordionContent').length > 0){
6465            options['active'] = index;
6466          }
6467        }
6468      }
6469
6470      if(options['collapsible']){
6471        jQuery(this).addClass('accordionHeaderCollapsible').removeClass('accordionHeaderNoneCollapsible');
6472      }
6473      else{
6474        jQuery(this).addClass('accordionHeaderNoneCollapsible').removeClass('accordionHeaderCollapsible');
6475      }
6476
6477      if(options['expandAll'] || typeof(options['active']) == 'number' && options['active'] == index){
6478        lastOpenedEntry = jQuery(this);
6479        jQuery(this).attr('aria-expanded') ? jQuery(this).attr('aria-expanded', 'true') : jQuery(this).find('.accordionHeaderCaption').attr('aria-expanded', 'true');
6480        jQuery(this).addClass('accordionHeaderVisible').removeClass('accordionHeaderHidden');
6481        jQuery(this).next('.accordionContent').attr('aria-hidden', 'false').addClass('accordionContentVisible').removeClass('accordionContentHidden').show();
6482      }
6483      else{
6484        jQuery(this).attr('aria-expanded') ? jQuery(this).attr('aria-expanded', 'false') : jQuery(this).find('.accordionHeaderCaption').attr('aria-expanded', 'false');        
6485        jQuery(this).addClass('accordionHeaderHidden').removeClass('accordionHeaderVisible');
6486        jQuery(this).next('.accordionContent').attr('aria-hidden', 'true').addClass('accordionContentHidden').removeClass('accordionContentVisible').hide();
6487      }
6488
6489      if(options['heightStyle'] == 'auto'){
6490        jQuery(this).next('.accordionContent').css({'height' : maxHeightContent});
6491      }     
6492
6493      jQuery(this).on('click', function(event, forceOpen){
6494        event.preventDefault();
6495        wUiTmp['ignoreFocusout'] = true;
6496        setTimeout(function() {
6497          wUiTmp['ignoreFocusout'] = false;
6498        }, 500);
6499                
6500        if(wUiTmp['ignoreClick'] && wUiTmp['lastAccordionOpen'] === accordionID + '_' + index){
6501          return false;
6502        }
6503        
6504        var isList = jQuery(this).parent().parent().parent().prop('nodeName') == 'UL' ? true : false;
6505
6506        var headerSelected  = jQuery(this);
6507
6508        forceOpen = typeof(forceOpen) != 'undefined' ? forceOpen : false;
6509
6510        var contentSelected   = jQuery(this).next('.accordionContent');
6511        var accordionContents = isList ? jQuery(this).parent().parent().parent().find('> .listEntry > .listEntryInner > .accordionContent') : jQuery(this).parent().children('.accordionContent');
6512
6513        var hasEntryVisible = false, hasEntryInvisible = false;
6514        
6515        if(typeof(wOnBeforeClickAccordeon) === 'function'){
6516          var rtcEvent = wOnBeforeClickAccordeon(headerSelected);
6517          if(rtcEvent === false){
6518            return false;
6519          }
6520        }       
6521                
6522        accordionContents.each(function(index){
6523                    
6524          if(jQuery(this).get(0) == contentSelected.get(0)){
6525            if(jQuery(this).hasClass('accordionContentVisible')){
6526              hasEntryInvisible = true;
6527            }
6528            else{
6529              hasEntryVisible = true;
6530            }
6531            if(jQuery(this).hasClass('accordionContentVisible') && !forceOpen){     
6532              if(options['collapsible']){                                
6533                jQuery(this).parent().trigger('accordionbeforeactivate', {'newHeader' : contentSelected});
6534                jQuery(this).prev('.accordionHeader').attr('aria-expanded') ? jQuery(this).prev('.accordionHeader').attr('aria-expanded', 'false') : jQuery(this).prev('.accordionHeader').find('.accordionHeaderCaption').attr('aria-expanded', 'false');                 
6535                jQuery(this).prev('.accordionHeader').addClass('accordionHeaderHidden').removeClass('accordionHeaderVisible');
6536                jQuery(this).removeClass('accordionContentVisible');
6537                if(options['slideMode'] === 'transition'){
6538                  jQuery(this).hide();
6539                  jQuery(this).addClass('accordionContentHidden').attr('aria-hidden', 'true').removeAttr('tabindex');
6540                  jQuery(this).parent().trigger('accordionchange', {'newHeader' : headerSelected});                  
6541                }
6542                else{
6543                  jQuery(this).slideUp({duration : slideUpOptions['duration'], easing : slideUpOptions['easing'], complete : function(){
6544                    jQuery(this).addClass('accordionContentHidden').attr('aria-hidden', 'true').removeAttr('tabindex');
6545                    jQuery(this).parent().trigger('accordionchange', {'newHeader' : headerSelected});
6546                  }});
6547                }
6548              }
6549            }
6550            else{              
6551              jQuery(this).prev('.accordionHeader').attr('aria-expanded') ? jQuery(this).prev('.accordionHeader').attr('aria-expanded', 'true') : jQuery(this).prev('.accordionHeader').find('.accordionHeaderCaption').attr('aria-expanded', 'true');                               
6552              jQuery(this).prev('.accordionHeader').addClass('accordionHeaderVisible').removeClass('accordionHeaderHidden');
6553              if(options['collapsible']){
6554                jQuery(this).prev('.accordionHeader').addClass('accordionHeaderCollapsible').removeClass('accordionHeaderNoneCollapsible');
6555              }
6556              else{
6557                jQuery(this).prev('.accordionHeader').addClass('accordionHeaderNoneCollapsible').removeClass('accordionHeaderCollapsible');
6558              }
6559              jQuery(this).removeClass('accordionContentHidden');
6560              if(options['slideMode'] === 'transition'){   
6561                jQuery(this).show();   
6562                wUiTmp['lastAccordionOpen'] = accordionID + '_' + index;
6563                jQuery(this).addClass('accordionContentVisible').attr('aria-hidden', 'false').attr('tabindex', '0').focus().css({'outline' : 'none'});
6564                jQuery(this).find('.accordionCloserContent').focus();
6565                jQuery(this).parent().trigger('accordionchange', {'newHeader' : headerSelected});
6566                jQuery(this).parent().trigger('accordionactivate', {'newHeader' : headerSelected});                
6567              }
6568              else{
6569                jQuery(this).slideDown({duration : slideDownOptions['duration'], easing : slideDownOptions['easing'], complete : function(){
6570                  jQuery(this).addClass('accordionContentVisible').attr('aria-hidden', 'false').attr('tabindex', '0').focus().css({'outline' : 'none'});
6571                  jQuery(this).parent().trigger('accordionchange', {'newHeader' : headerSelected});
6572                  jQuery(this).parent().trigger('accordionactivate', {'newHeader' : headerSelected});
6573                }});
6574              }  
6575            }
6576          }
6577          else {
6578            if(options['multiple'] == true){
6579            }
6580            else{
6581              jQuery(this).prev('.accordionHeader').addClass('accordionHeaderHidden').removeClass('accordionHeaderVisible').attr('aria-expanded', 'false');
6582              jQuery(this).removeClass('accordionContentVisible');
6583              
6584              if(options['slideMode'] === 'transition'){
6585                jQuery(this).hide();
6586              }
6587              else{
6588                jQuery(this).slideUp({duration : slideUpOptions['duration'], easing : slideUpOptions['easing'], complete : function(){
6589                  jQuery(this).addClass('accordionContentHidden').attr('aria-hidden', 'true').removeAttr('tabindex');
6590                }});
6591              }  
6592            }    
6593            if(jQuery(this).hasClass('accordionContentVisible')){
6594              hasEntryVisible = true;
6595            }
6596            else{
6597              hasEntryInvisible = true;
6598            }            
6599          }
6600        });
6601            
6602        if(hasEntryInvisible){
6603          jQuery('#accordionOpener' + accordionID).show();
6604          jQuery('#accordionCloser' + accordionID).hide();
6605        }
6606        else{
6607          jQuery('#accordionOpener' + accordionID).hide();
6608          jQuery('#accordionCloser' + accordionID).show();
6609        }
6610        if(options['multiple'] && accordionContents.parent().find('.accordionContentVisible').length > 0){
6611          jQuery('#accordionOpener' + accordionID).hide();
6612          jQuery('#accordionCloser' + accordionID).show();
6613        }
6614        
6615        if(typeof(wOnAfterClickAccordeon) === 'function'){
6616          wOnAfterClickAccordeon(headerSelected);
6617        }     
6618        try{
6619          var resizeEvent = window.document.createEvent('UIEvents'); 
6620          resizeEvent.initUIEvent('resize', true, false, window, 0); 
6621          window.dispatchEvent(resizeEvent);
6622        }
6623        catch(e){}
6624        jQuery('.wglBannerSlider').wBannerSlider();
6625        jQuery('.wglSmartSlider').wSmartSlider();
6626        jQuery('.wglPictureGallery').wPictureGallery();
6627        
6628        if(options['group'] && options['group'] != ''){
6629          jQuery('.wglAccordion[data-group="' + options['group'] + '"]').each(function(index){
6630            var accordionInGroupID   = jQuery(this).get(0).id.replace(/accordion_/, '');
6631            if(accordionInGroupID != accordionID){
6632              wCloseAllAccordions(accordionInGroupID);               
6633            }
6634          });  
6635        }
6636      });       
6637    });
6638
6639    jQuery(this).on('accordionactivate', function(event, ui){
6640
6641      var headerE = jQuery(ui.newHeader[0]);
6642      
6643      if(headerE.data('noaccactivate') === true){ 
6644        jQuery(this).data('noaccactivate', false);
6645        return false;
6646      }
6647      
6648      if(ui.newHeader[0] && jQuery(ui.newHeader[0]).parent().data('fitinscreen') != 'no'){
6649        try{
6650          var currentHeader          = ui.newHeader;
6651          var offsetTopCurrentHeader = (currentHeader.offset())['top'];
6652          var windowScrollTop        = wUiTmp['lastScrollTop'];
6653          var scrollTopMax           = offsetTopCurrentHeader - wGetScrollTopDiff();
6654          
6655          if(jQuery(ui.newHeader[0]).parent().data('scrolltoponactivate') == 'always'){
6656            var scrollTopDiff = wGetScrollTopDiff();            
6657            jQuery('body, html').animate({scrollTop: offsetTopCurrentHeader - scrollTopDiff});
6658          }
6659          else if(offsetTopCurrentHeader < windowScrollTop){
6660            var scrollTopDiff = wGetScrollTopDiff();            
6661            jQuery('body, html').animate({scrollTop: offsetTopCurrentHeader - scrollTopDiff});
6662          }
6663          else{
6664            var offsetBottomCurrentContent = (jQuery(currentHeader).next('.accordionContent').offset())['top'] + jQuery(currentHeader).next('.accordionContent').outerHeight();
6665            var windowBottom               = windowScrollTop + wUiTmp['lastWindowHeight'];
6666            if(offsetBottomCurrentContent > windowBottom){
6667              var scrollTopToFullvisibility = offsetBottomCurrentContent - windowBottom;
6668              var scrollTopAdapt = windowScrollTop + scrollTopToFullvisibility;
6669              scrollTopAdapt = scrollTopAdapt > scrollTopMax ? scrollTopMax : scrollTopAdapt;
6670              jQuery('body, html').animate({scrollTop: scrollTopAdapt});
6671            }
6672          }
6673        }
6674        catch(e){
6675        }
6676      }  
6677    });
6678
6679    jQuery(this).on('accordionchange', function(event, ui){
6680      
6681      var eventTarget = event.target || event.srcElement;
6682      var id          = eventTarget.id.replace(/accordion_/, '');
6683      var headerE = jQuery(ui.newHeader[0]);
6684      
6685      if(headerE.data('noaccchange') === true){ 
6686        jQuery(this).data('noaccchange', false);
6687        return false;
6688      }
6689      
6690      if(ui.newHeader[0] && jQuery(ui.newHeader[0]).parent().data('pushstateonselect') == '1'){
6691        if(ui.newHeader[0].className.indexOf('accordionHeaderHidden') == -1){
6692          history.pushState({page: '#' + ui.newHeader[0].id}, '', '#' + ui.newHeader[0].id);
6693          wUiTmp['lastPushStateAccordion'] = '#' + ui.newHeader[0].id;          
6694        }
6695        else if('#' + ui.newHeader[0].id == wUiTmp['lastPushStateAccordion']){
6696          var newState = location.href.replace(/#.*/, '');
6697          history.pushState({page: newState}, '', newState);
6698        }
6699      }  
6700      
6701      //if(headerSelected.attr('id') && headerSelected.parent().data('pushstateonselect') == '1'){
6702      //  history.pushState({page: '#' + headerSelected.attr('id')}, '', '#' + headerSelected.attr('id'));
6703      //  wUiTmp['lastPushStateAccordion'] = '#' + headerSelected.attr('id');
6704      //}
6705            
6706      if(options['rememberSelected'] == '1'){
6707        if(ui.newHeader[0]){
6708          if(ui.newHeader[0].className.indexOf('accordionHeaderHidden') != -1){
6709            document.cookie = 'accordionTab_' + id + '=;path=/;sameSite=Lax';
6710          }
6711          else{
6712            document.cookie = 'accordionTab_' + id + '=' + (ui.newHeader[0].getAttribute('data-index') ? ui.newHeader[0].getAttribute('data-index') : ui.newHeader[0].id.replace(/.*_/, '')) + ';path=/;sameSite=Lax';
6713          }
6714        }
6715      }
6716      jQuery(window).trigger('resize');
6717      jQuery('.wglBannerSlider').wBannerSlider();
6718      jQuery('.wglSmartSlider').wSmartSlider();      
6719      jQuery('.wglPictureGallery').wPictureGallery();
6720      jQuery('.wglAccordion .wglTicker').wTicker();    
6721    });   
6722  });
6723};
6724
6725wOpenAllAccordions = function(id){
6726  
6727  jQuery('#accordion_' + id + ' .accordionHeaderHidden').trigger('click');
6728  
6729  jQuery('#accordionOpener' + id).hide();
6730  jQuery('#accordionCloser' + id).show();
6731  jQuery(window).trigger('resize');
6732  jQuery('.wglBannerSlider').wBannerSlider();
6733  jQuery('.wglSmartSlider').wSmartSlider();  
6734  jQuery('.wglPictureGallery').wPictureGallery();
6735  
6736  if(location.hash == wUiTmp['lastPushStateAccordion']){
6737    var newState = location.href.replace(/#.*/, '');
6738    history.pushState({page: newState}, '', newState);
6739  }  
6740};
6741
6742wCloseAllAccordions = function(id){
6743
6744  jQuery('#accordion_' + id + ' .accordionHeaderVisible').trigger('click');
6745
6746  if(location.hash == wUiTmp['lastPushStateAccordion']){
6747    var newState = location.href.replace(/#.*/, '');
6748    history.pushState({page: newState}, '', newState);
6749  }  
6750};
6751
6752jQuery(window).on('hashchange', function(){
6753  
6754  window.setTimeout(function(){
6755    wAdaptOnChangeHash({});
6756  }, 10);   
6757});
6758                  
6759wAdaptOnChangeHash = function(options){
6760  
6761  var jQueryHashId = decodeURIComponent(location.hash.replace(/\./g, '\\.').replace(/\//g, '\\/').replace('open_', 'anchor_').replace(/\&/g, '').replace(/=/g, '')).replace(/\[/g, '').replace(/\]/g, '').replace(/\?/g, '');
6762
6763  if(typeof wOnBeforeAdaptOnChangeHash === 'function') jQueryHashId = wOnBeforeAdaptOnChangeHash(jQueryHashId);
6764
6765  if(typeof wAddSelectedOnNavpointIfHashChanged != 'undefined' && wAddSelectedOnNavpointIfHashChanged){  
6766    jQuery("#blockPage a[href='" + location.hash + "'], #blockPage a[href='" + location.pathname + location.hash + "']").each(function(i, v){
6767      jQuery(v).parent().parent().find('.selected').removeClass('selected');
6768      jQuery(v).parent().addClass('selected');
6769    });
6770  }
6771  
6772  var accordionOfHash = null;
6773  
6774  if(/^#anchor_lightbox_([^_]+)_(\d+)/.test(jQueryHashId)){
6775    if(jQuery('.wglLightbox[data-rel="' + RegExp.$1 + '"]').eq(parseInt(RegExp.$2) > 0 ? parseInt(RegExp.$2) - 1 : 0).length !== 0){
6776      wLightbox(jQuery('.wglLightbox[data-rel="' + RegExp.$1 + '"]').eq(parseInt(RegExp.$2) > 0 ? parseInt(RegExp.$2) - 1 : 0), {});
6777    }
6778  }  
6779
6780  if(/^#\w/.test(jQueryHashId) && jQueryHashId != '#'){
6781    if(jQuery(jQueryHashId).length > 0){ 
6782      accordionOfHash = jQuery(jQueryHashId);
6783    }
6784    else if(jQuery(jQueryHashId.replace(/_Accordion-.*/, '')).length > 0){ 
6785      accordionOfHash = jQuery(jQueryHashId.replace(/_Accordion-.*/, ''));
6786    }    
6787  }  
6788
6789  if(accordionOfHash && accordionOfHash.length > 0){
6790    try{
6791      if(/#anchor/.test(jQueryHashId) && accordionOfHash.parent().attr('id').indexOf('tab_') == 0){
6792        document.location.hash = accordionOfHash.parent().attr('id');
6793        jQueryHashId = '#' + accordionOfHash.parent().attr('id');
6794      }
6795    }catch(e){}
6796    
6797    if(/#tab_/.test(jQueryHashId)){
6798      if(/tab_/.test(accordionOfHash.attr('id'))){
6799        accordionOfHash.trigger('click', [true]);
6800      }
6801      else{
6802        var containerIndex = accordionOfHash.parents('.containerInvisible').index();
6803        if(containerIndex >= 0){
6804          accordionOfHash.parents('.containerInvisible').parent().parent().find('> .tabs > .tab:nth-child(' + (containerIndex + 1) + ')').trigger('click', [true]);
6805        }
6806      }
6807    }
6808    else if(accordionOfHash.hasClass('accordionHeader')){
6809      accordionOfHash.trigger('click', [true]);
6810
6811      var containerIndex = accordionOfHash.parents('.containerInvisible').index();
6812      if(containerIndex >= 0){
6813        accordionOfHash.parents('.containerInvisible').parent().parent().find('> .tabs > .tab:nth-child(' + (containerIndex + 1) + ')').trigger('click', [true]);
6814      }
6815    }
6816    else{
6817      var containerIndex = accordionOfHash.parents('.containerInvisible').index();
6818      if(containerIndex >= 0){
6819        accordionOfHash.parents('.containerInvisible').parent().parent().find('> .tabs > .tab:nth-child(' + (containerIndex + 1) + ')').trigger('click', [true]);
6820      }
6821      accordionOfHash.parents('.accordionContent').prev('.accordionHeader').trigger('click', [true]);
6822    }
6823  }
6824  
6825  window.setTimeout(function(){
6826    if(/^#\w/.test(jQueryHashId) && jQueryHashId != '' && jQueryHashId != '#' && (/#(wFormErrorMessages|anchor_|tab_|_Accordion-)/.test(jQueryHashId) || jQuery(jQueryHashId).hasClass('elementSection'))){
6827      var anchor = jQuery(jQueryHashId.replace(/\./, '\\.'));
6828      if(anchor.length == 0) anchor = jQuery('*[data-id=' +jQueryHashId.replace(/#/, '') +']');
6829      if(anchor.length > 0){
6830         wScrollSmoothToElement(anchor, !/#(wFormErrorMessages|_Accordion-)/.test(jQueryHashId) ? {'setFocusAfterScrolling' : true} : null);
6831        if(jQueryHashId === '#wFormErrorMessages'){
6832          jQuery('#wFormErrorMessages').prepend('<div id="focusAncor" tabindex="0" style="width:1px"></div>');
6833          jQuery('#focusAncor').focus();
6834        }
6835      }
6836    }
6837  }, 120);
6838  if(typeof wOnAfterAdaptOnChangeHash === 'function') jQueryHashId = wOnAfterAdaptOnChangeHash(jQueryHashId);
6839};
6840
6841wsmn = function(ml){
6842  
6843  var mln = '';
6844  for(var i = 0; i < ml.length/3; i++){
6845    mln = ml.substr(i * 3 + 1, 1) + mln;
6846  }
6847  
6848  var pms = '';
6849  if(/(\?.*)/.test(mln)){
6850    pms = RegExp.$1;
6851    pms = pms.replace(/wApos/g, "'");    
6852    mln = mln.replace(/(\?.*)/, '');
6853  }
6854  
6855  mln = mln.replace(/a/g, '@').replace(/e/g, '.').replace(/\*/g, 'a').replace(/;/g, 'e').replace(/:/g, 'o').replace(/,/g, 'u').replace(/\!/g, 'i') + pms;
6856
6857  var rtc = true;
6858  
6859  if(typeof(wOnBeforeClickSendMailNospam) == 'function'){
6860    rtc = wOnBeforeClickSendMailNospam(mln, event);
6861  }
6862  
6863  if(rtc){
6864    top.location.href = 'mailto:' + mln;
6865  }  
6866};
6867
6868jQuery.fn.wMagnifier = function(options){
6869  
6870  if(typeof(wEditor) != 'undefined'){
6871    return false;
6872  }  
6873
6874  var wMagnifierElement      = null;
6875  var wMagnifierImageElement = null;
6876
6877  jQuery.each(jQuery(this), function(){
6878 
6879    jQuery(this).on('mouseover', function(event){
6880
6881      var srcMagnifier = jQuery(this).attr('data-src2x') ? jQuery(this).attr('data-src2x') : jQuery(this).get(0).currentSrc;
6882      var isPicture = false;
6883      
6884      if(jQuery(this).prop('tagName') == 'PICTURE'){  
6885        isPicture = true;
6886        srcMagnifier = jQuery(this).find('source').attr('srcset').replace(/^[\w\W]*,\s*/, '').replace(/ [\w\W]*/, '');
6887        if(/\.webp$/.test(srcMagnifier) && /Safari/i.test(navigator.userAgent)){
6888          srcMagnifier = jQuery(this).find('source').next().attr('srcset').replace(/^[\w\W]*,\s*/, '').replace(/ [\w\W]*/, '');
6889        }        
6890      }  
6891      else if(jQuery(this).parent().prop('tagName') == 'PICTURE'){
6892        srcMagnifier = srcMagnifier.replace(/(\d+)(w(?:2x)?\.(?:jpe?g|webp|png|gif)+)/, function(matches, width, post){return String(width * 2) + post});
6893      }  
6894      
6895      jQuery('.wMagnifier').remove();
6896      jQuery('.wMagnifierMovingArea').remove();
6897
6898      var objectCurrent     = jQuery(this);
6899      objectCurrent.parent().css({'position' : 'relative', 'display' : jQuery(this).css('display') == 'inline-block' ? 'inline-block' : 'block'});
6900      objectCurrent.parent().append('<div id="wMagnifierMovingArea" class="wMagnifierMovingArea" style="z-index:1000;cursor:none;position:absolute;top:0;left:0;width:100%;height:100%"></div>');
6901      objectCurrent.parent().append('<div id="wMagnifier" class="wMagnifier"></div>');
6902      wMagnifierElement = jQuery('#wMagnifier');
6903      wMagnifierMovingAreaElement = jQuery('#wMagnifierMovingArea');
6904      wMagnifierImageElement = objectCurrent;
6905      
6906      var offset = objectCurrent.offset();
6907      objectCurrent.data('offsetLeft', parseInt(offset.left));
6908      objectCurrent.data('offsetTop', parseInt(offset.top));
6909      objectCurrent.data('zoomerWidth', wMagnifierElement.width());
6910      objectCurrent.data('zoomerHeight', wMagnifierElement.height());
6911      objectCurrent.data('imageWidth',  isPicture ? objectCurrent.find('img').width() : objectCurrent.width());
6912      objectCurrent.data('borderLeftWidth', parseInt(wMagnifierElement.css('border-left-width')));
6913      objectCurrent.data('borderTopWidth', parseInt(wMagnifierElement.css('border-top-width')));
6914
6915      //var scale = (isPicture ? objectCurrent.find('img').width() : objectCurrent.width()) / (typeof(objectCurrent.attr('width')) != 'undefined' ? objectCurrent.attr('width') : objectCurrent.attr('data-widthorig'));
6916      var ratio = 2
6917     
6918      var posX = parseInt(typeof(event.pageX !== 'undefined') ? event.pageX : (event.clientX + document.documentElement.scrollLeft)) - wMagnifierImageElement.data('offsetLeft');
6919      var posY = parseInt(typeof(event.pageY !== 'undefined') ? event.pageY : (event.clientY + document.documentElement.scrollTop)) - wMagnifierImageElement.data('offsetTop');
6920      wMagnifierElement.css({'left' : posX - wMagnifierImageElement.data('borderLeftWidth') - wMagnifierImageElement.data('zoomerWidth') / 2, 'top' : posY - wMagnifierImageElement.data('borderTopWidth') - wMagnifierImageElement.data('zoomerHeight') / 2, 'background-position' : String(-posX * ratio + wMagnifierImageElement.data('zoomerWidth') / 2) + 'px ' +  String(-posY * ratio + wMagnifierImageElement.data('zoomerHeight') / 2) + 'px'});
6921      wMagnifierElement.css({'background-image' : 'url(' + srcMagnifier + ')', 'background-repeat' : 'no-repeat'});
6922      wMagnifierElement.css({'background-size' : String((isPicture ? objectCurrent.find('img').width() : objectCurrent.width()) * 2) + 'px'});        
6923
6924      wMagnifierMovingAreaElement.on('mousemove', function(event){
6925        var posX = parseInt(typeof(event.pageX !== 'undefined') ? event.pageX : (event.clientX + document.documentElement.scrollLeft)) - wMagnifierImageElement.data('offsetLeft');
6926        var posY = parseInt(typeof(event.pageY !== 'undefined') ? event.pageY : (event.clientY + document.documentElement.scrollTop)) - wMagnifierImageElement.data('offsetTop');                 
6927        wMagnifierElement.css({'left' : posX - wMagnifierImageElement.data('borderLeftWidth') - wMagnifierImageElement.data('zoomerWidth') / 2, 'top' : posY - wMagnifierImageElement.data('borderTopWidth') - wMagnifierImageElement.data('zoomerHeight') / 2, 'background-position' : String(-posX * ratio + wMagnifierImageElement.data('zoomerWidth') / 2) + 'px ' +  String(-posY * ratio + wMagnifierImageElement.data('zoomerHeight') / 2) + 'px'});
6928      });
6929      wMagnifierMovingAreaElement.on('mouseout click', function(event){
6930        jQuery('.wMagnifier').remove();
6931        jQuery('.wMagnifierMovingArea').remove();
6932      });
6933    });
6934  });
6935};
6936
6937jQuery.fn.wMaximizer = function(options){
6938  jQuery.each(jQuery(this), function(){
6939    jQuery(this).click(function(){
6940      var objectCurrent     = jQuery(this);
6941      return wMaximizer(objectCurrent, options);
6942    });
6943  });
6944};
6945
6946wMaximizer = function(objectCurrent, options){
6947
6948  var objectToMaximize = objectCurrent.parent();
6949  var widthMaximized   = objectToMaximize.parent().width();
6950
6951  if(objectToMaximize.hasClass('wglMaximized')){
6952    objectToMaximize.animate({'max-width' : String(objectToMaximize.data('widthDefault')) + 'px'}, 600, function(){
6953      objectToMaximize.removeClass('wglMaximized');
6954    });
6955  }
6956  else{
6957    objectToMaximize.data('widthDefault', objectToMaximize.width());
6958    objectToMaximize.animate({'max-width' : String(widthMaximized) + 'px'}, 600, function(){
6959      objectToMaximize.addClass('wglMaximized');
6960    });
6961  }
6962};
6963
6964wToggleFavoriteURL = function(button, options){
6965
6966  options = options || {};
6967  var url = "/weblication/grid5/scripts/wPrivate.php?url="+button.getAttribute("data-url")+"&action=";
6968  if(button.getAttribute("data-hasfavoriteurl") == "1"){
6969    url += "removeFavoriteURL";
6970  }
6971  else{
6972    url += "addFavoriteURL";
6973  }
6974  jQuery.ajax({type: "GET", async: true, dataType: "json", url: url,
6975    success: function(result){
6976      if(result == "1"){
6977        button.setAttribute("data-hasfavoriteurl", button.getAttribute("data-hasfavoriteurl") == "1" ? "0" : "1");
6978        if(options["onAfterToggle"]){
6979          eval(options["onAfterToggle"]);
6980        }
6981      }
6982    }
6983  });
6984};
6985
6986jQuery.fn.wAutoheight = function(){ 
6987  
6988  jQuery.each(jQuery(this), function(index){
6989    var ta = jQuery(this);
6990   
6991    var height       = ta.height();
6992    var scrollHeight = ta.prop('scrollHeight');    
6993    var diffHeight   = Math.ceil(parseFloat(ta.css('paddingTop')) + parseFloat(ta.css('paddingBottom')));    
6994    
6995    //console.log(height + ' ' + Math.ceil(ta.height()) + ' ' + diffHeight);      
6996    if(ta.prop('scrollHeight') > Math.ceil(ta.height()) + diffHeight){
6997      ta.height(ta.prop('scrollHeight'));
6998    }
6999
7000    ta.on('keyup change', function(){
7001      var ta = jQuery(this);      
7002      var height       = ta.height();
7003      var scrollHeight = ta.prop('scrollHeight'); 
7004      var diffHeight   = Math.ceil(parseFloat(ta.css('paddingTop')) + parseFloat(ta.css('paddingBottom')));        
7005
7006      //console.log(height + ' ' + Math.ceil(ta.height()) + ' ' + diffHeight);  
7007      if(ta.prop('scrollHeight') > Math.ceil(ta.height()) + diffHeight){
7008        ta.height(ta.prop('scrollHeight'));
7009      }
7010    });
7011  });
7012};
7013
7014jQuery.fn.wInputRange = function(){ 
7015  
7016  jQuery.each(jQuery(this), function(index){
7017    var i = jQuery(this);
7018
7019    i.on('input', function(){
7020      if(jQuery('#' + jQuery(this).attr('id') + '_rangeValue').length != 0){
7021        jQuery('#' + jQuery(this).attr('id') + '_rangeValue').find('.wglRangeValueValue').html(jQuery(this).val());
7022      }
7023    });
7024  });
7025};
7026
7027jQuery.fn.wSmartSlider = function(options){
7028  jQuery.each(jQuery(this), function(){  
7029    wSmartSlider(jQuery(this), options);
7030  });
7031};
7032
7033class wClassSmartSlider{
7034  
7035  constructor(object, options){
7036    this.sl   = object;
7037    this.options = {
7038      slideronlymobile : '0',
7039      breakpoint : '765px',
7040    };
7041    if(options != null){
7042      this.options = options;
7043      for (var key in options) {
7044        if (this.options.hasOwnProperty(key)) {
7045          this.sl.attr('data-' + key, options[key]);
7046        }
7047      }
7048    }
7049    this.slt      = {'sy' : null, 'sxc': null, 'syc' : null, 'dx' : null, 'dy' : null, 'dxp': null, 'dyp' : null};
7050    this.curBKP = this.slw = this.slI = this.slIlinit = this.slI1 = this.slIw = this.slIr = this.slE = this.noP = this.noE = this.noCol = this.noColSlWidth = this.lastPOffset = this.curP = this.curE = null;
7051    this.pNavi = this.scrollBar = null;
7052    this.onafterslidermove = null;
7053    this.options.flip = this.options.animationRaster != null ? this.options.animationRaster : 'bannerWidth';
7054    this.flip = this.options.flip;
7055    this.init();
7056    this.onload = false;
7057  }
7058  
7059  init(){
7060    const self = this;
7061    
7062    if(this.options.slideronlymobile === '1'){
7063      if(!window.matchMedia("(max-width: " + this.options.breakpoint + ")").matches){
7064        self.deactivate();
7065        jQuery(window).on('resize', this.resize.bind(this));
7066        self.sl.data('resize', 'binded');
7067        return false;
7068      }
7069    }
7070    self.activate();
7071    var tmpCol = self.noCol;
7072    this.setVar(true);
7073    self.sl.attr({ 'data-init' : '1'}); 
7074    if(this.sl.attr('data-smartpagenavi') == 'scrollbar'){self.setScrollbar();self.setPageNav();}
7075    else if(this.sl.attr('data-smartpagenavi') == 'scrollbarOnly') self.setScrollbar();
7076    else self.setPageNav();
7077    self.sl.find('.sliderMoverBack').on('click', this.smartSliderMove.bind(this, '-', {'flip' : self.options.flip}));
7078    self.sl.find('.sliderMoverForward').on('click', this.smartSliderMove.bind(this, '+', {'flip' : self.options.flip}));
7079    //self.slI.on('touchstart', this.touch.bind(this)).on('touchmove', this.touch.bind(this)).on('touched', this.touch.bind(this));
7080    //self.slI.on('mousedown', this.touch.bind(this)).on('mousemove', this.touch.bind(this)).on('mouseup', this.touch.bind(this));
7081    //const events = 'touchstart touchmove touchend mousedown mousemove mouseup';
7082    self.slI.get(0).addEventListener('touchstart', this.touch.bind(this), { passive: true });
7083    self.slI.get(0).addEventListener('touchmove', this.touch.bind(this), { passive: true });
7084    self.slI.on('mousedown', this.touch.bind(this)).on('touched', this.touch.bind(this)).on('mousemove', this.touch.bind(this)).on('mouseup', this.touch.bind(this));
7085    if(self.sl.data('resize') != 'binded'){;
7086      jQuery(window).on('resize', this.resize.bind(this));
7087      self.sl.data('resize', 'binded');
7088    }                                      
7089  }
7090  
7091  deactivate(){
7092    const self = this;
7093    if(self.sl.attr('data-deactivated') == '0') {
7094      self.sl.attr('data-deactivated', '1');
7095      var lE = self.sl.children('ul');
7096      if(lE.length > 0){
7097        lE.get(0).style.removeProperty('--cols');
7098        lE.css({'margin-left' : 0});
7099      }
7100    }
7101  }
7102  
7103  activate(){
7104    const self = this;
7105    if(self.sl.attr('data-deactivated') == null ||  self.sl.attr('data-deactivated') == '1') {
7106      self.sl.attr('data-deactivated', '0');
7107      var lE = self.sl.children('ul');
7108      if(lE.length > 0){
7109        lE.get(0).style.setProperty('--cols', self.sl.attr('data-numberentries'));
7110      }
7111    }
7112  }
7113  
7114  setPageNav(){
7115    const self = this;
7116    var pNav = '';
7117    
7118    if(self.noP > 0){
7119      pNav = '<div class="pageNavi">';
7120      for(var i = 0; i < self.noP; i++) pNav += '<div class="page' + (i===0 ? ' selected' : '') + '"></div>';
7121      pNav   += '</div>';
7122    }
7123    if(self.sl.find('.sliderMover').length === 0){
7124      self.sl.append('<div class="sliderMover"><div data-accessevent="smartSlider.pageNavi(back)" class="sliderMoverBack"><span/><span/></div>' + pNav + '<div data-accessevent="smartSlider.pageNavi(forward)" class="sliderMoverForward"><span/><span/></div></div>');
7125    }
7126    else if(self.pNavi != null && self.pNavi.html() !== pNav){
7127      self.pNavi.replaceWith(pNav);
7128    }
7129    self.pNavi = self.sl.find('.pageNavi');
7130    self.sl.find('.page').on('click', function() {var index = self.sl.find('.page').index(this);self.smartSliderMove(index+1, {'flip' : 'bannerWidth'});});
7131  }
7132  
7133  setScrollbar(){
7134    const self = this;
7135    if(self.scrollBar == null){
7136      self.sl.append('<div class="slider-container"><input type="range" id="slider" min="0"  max="'+(self.slIw-self.lastPOffset)+'" value="
71360"></div>');
7137      self.scrollBar = self.sl.find('.slider-container input');
7138      self.scrollBar.on('input', function(){
7139        self.slI.css({'marginLeft': '-' + jQuery(this).val() + 'px'});
7140        //var p = Math.ceil(jQuery(this).val()/(100/self.noP));
7141        //self.options['moveto'] = p = (p === 0 ? 1 : p);
7142      });
7143      self.sl.on('keyup mouseup touchend', function(e){
7144        if(e.target === self.scrollBar.get(0) && jQuery(e.target).attr('type') === 'range'){
7145          var p = Math.ceil(self.scrollBar.val()/self.slw);
7146          var range = Math.ceil((self.scrollBar.val()%self.slw)*100/self.slw);
7147          if(range > 50) p++;
7148          if(self.scrollBar.val() == parseInt(self.scrollBar.attr('max'))) p = self.noP;
7149          if(self.sl.attr('data-moving') != '1') self.smartSliderMove((p), {'moveslider' : false, 'flip' : 'colWidth'});
7150          else {
7151            self.onafterslidermove = function(pos) {
7152              self.smartSliderMove(pos, {'moveslider' : false, 'flip' : 'colWidth'});
7153            };
7154          }
7155        }
7156      });
7157    }
7158    else {
7159      self.scrollBar.attr('max', self.slIw-self.lastPOffset);
7160      var val = (self.curP == 1) ? 0 : Math.ceil(self.curP*100/self.noP)/100*parseInt(self.scrollBar.attr('max'));
7161      self.scrollBar.val(val);
7162    }
7163 }
7164    
7165  setVar(init){
7166    const self = this;
7167    self.slE  = self.sl.find('> div:first-child() > div, > ul:first-child() > li');  
7168    self.slw  = self.sl.width();
7169    if(self.flip == 'colWidth'){
7170      self.slw = self.slE.first().outerWidth();
7171    }
7172    
7173    self.slI  = self.sl.find('> div:first-child(), > ul:first-child()');
7174    self.slIl = parseInt(self.slI.css('margin-left'));
7175    
7176    if(self.slIlinit == null) self.slIlinit = self.slIl;
7177    self.slIw = self.slI.outerWidth();
7178    self.slIr = parseInt(self.slIw) + self.slIl;
7179    self.noE = self.sl.find('> div:not(.sliderMover) > div, > ul > li').length;
7180    if(init){
7181      self.curP  = 1;
7182      self.curE  = 1;
7183      self.sl.attr({'data-currententry' : self.curE , 'data-currentpage' : self.curP , 'data-isfirstentry' : '1', 
7184                   'data-islastentry': self.noE == 1 ? '1' : '0', 'data-numberentries': self.noE, 'data-marginleftinit' : self.slIlinit, 
7185                   'data-isvisiblefirstentry' : '1', 'data-isvisiblelastentry' : (self.slIl - self.slw + self.slIw < 8 ? '1' : '0'),
7186                   'data-numberPages' : self.noP});
7187    }
7188    
7189    /*Anzahl der Spalten die geblättert werden, abhängig vom slw */
7190    self.noCol = Math.ceil((self.slw/self.sl.find('.col, .listEntry').eq(self.curE-1).outerWidth()).toFixed(2)); 
7191    
7192    /*offset, um das letzte Seite nach vorne scrollt */
7193    self.XOffset = self.noCol == 1 || self.flip=='colWidth' ? Math.ceil((self.sl.width()/self.sl.find('.col, .listEntry').eq(self.curE-1).outerWidth()).toFixed(2)) : 1; 
7194    self.lastPOffset = self.XOffset*self.slw; 
7195    var tmpP        = self.noP;
7196    self.noP        = Math.ceil(self.noE/self.noCol); /*Anzahl der Seiten*/
7197    if(tmpP != self.noP && self.flip=='bannerWidth'){
7198      var vh = 100*(self.curE%self.noCol)/self.noCol;
7199      self.curP = Math.ceil(self.curE/self.noCol);
7200      if(self.curP == self.noP) self.curE = self.noE;
7201      else self.curE = (self.curP-1)*self.noCol+1;
7202    }
7203  }
7204  
7205  smartSliderMove(pos, options = {}){
7206    const self = this;
7207    
7208    if(options.flip != null) self.flip = options.flip;
7209    
7210    var mL = '-';
7211    if(self.sl.attr('data-moving') != '1'){
7212      self.sl.attr('data-moving', '1'); 
7213      this.setVar();
7214      var ad   = 600;  
7215      var mwm  = self.slw;  
7216      var mw   = 0;
7217      if(pos == '+' && self.slIr > self.slw){
7218        mL = '-=';
7219        mw = (self.slIr - self.slw) < mwm ? (self.slIr - self.slw) : mwm;
7220        self.curP++;
7221        self.curE += self.noCol;
7222      }
7223      else if(pos == '-' && self.slIl < 0){
7224        mL = '+=';
7225        mw = self.slIl < -mwm ? -mwm : self.slIl;
7226        self.curP--;
7227        self.curE -= self.noCol;
7228        if(mw < 0 ) mw = mw*(-1);
7229      }
7230      else if(pos !== '+' && pos !== '-'){
7231        mw = (pos-1)*mwm;
7232        self.curP = pos;
7233        self.curE = self.curP*self.noCol;
7234      }
7235      if(self.curP == self.noP){
7236        mw = self.slIw - self.lastPOffset; 
7237        mL = '-';
7238      }
7239      
7240      if(self.curP == 1){
7241        mw = 0;
7242        mL = '-';
7243      }
7244      self.sl.attr('data-isvisiblelastentry', (self.noCol != 1 && self.curP == self.noP) ? '1' : '0');    
7245      self.sl.attr('data-isvisiblefirstentry', (self.curP == 1 || self.slIl - mw) > -8 ? '1' : '0');
7246      if(self.sl.attr('data-onvisiblelastentry')){
7247        if(self.sl.attr('data-onvisiblelastentry') == 'showNextElementLink'){
7248          if(self.sl.attr('data-isvisiblelastentry') === '1') self.sl.next('.elementLink').removeClass('hideVisibleLast').addClass('showVisibleLast');
7249          else self.sl.next('.elementLink').removeClass('showVisibleLast').addClass('hideVisibleLast');
7250        }
7251      }
7252      
7253      self.slI.animate({'marginLeft': mL + String(mw) + 'px'}, {duration : ad, complete : function(){
7254        self.sl.attr({'data-moving' : '0', 'data-isfirstentry' : (self.curP == '1' ? '1' : '0'), 'data-islastentry' : (self.curP === (self.noE/self.noCol) ? '1' : '0')});          
7255        if(self.onafterslidermove !== null && typeof self.onafterslidermove == 'function'){
7256          self.onafterslidermove(self.options['moveto']);
7257          self.onafterslidermove = null;
7258        }
7259      }});
7260      self.sl.attr({'data-currententry' : self.curE, 'data-currentpage' : self.curP});
7261    }
7262    
7263    if(self.noP > 0 && self.pNavi !== null && self.pNavi.length > 0){
7264      self.pNavi.children('.selected').removeClass('selected').end()
7265                .children().eq(self.curP-1).addClass('selected'); 
7266    }
7267    if(options['moveslider'] !== false && self.scrollBar !== null && self.scrollBar.length > 0){
7268      var vhcP  = Math.ceil((self.curP)*100/self.noP)/100;
7269      var vhprevP  = Math.ceil((self.curP-1)*100/self.noP)/100;
7270      var vh    = vhcP-vhprevP/2;
7271      var val = self.curP == 1 ? 0 : (self.curP == self.noP ? parseInt(self.scrollBar.attr('max')) : Math.ceil((self.curP-vh)*100/self.noP)/100*parseInt(self.scrollBar.attr('max')));
7272      self.scrollBar.val(val);
7273    }
7274  }
7275  
7276  touch(event) {
7277    const self = this;
7278    const original = event.originalEvent || event;
7279    const type = original.type;
7280    if (type === 'touchstart' || type === 'mousedown') {
7281      const pageX = type === 'touchstart' ? original.touches[0].pageX : original.pageX;
7282      const pageY = type === 'touchstart' ? original.touches[0].pageY : original.pageY;
7283      self.slt['sx'] = pageX;
7284      self.slt['sy'] = pageY - jQuery(window).scrollTop();
7285      self.slt['isClick'] = false;
7286    }
7287    else if (type === 'touchmove' || type === 'mousemove') {
7288      if (self.slt['sx'] != null && self.slt['sy'] != null) {
7289        const pageX = type === 'touchmove' ? original.touches[0].pageX : original.pageX;
7290        const pageY = type === 'touchmove' ? original.touches[0].pageY : original.pageY;
7291        self.slt['sxc'] = pageX;
7292        self.slt['syc'] = pageY - jQuery(window).scrollTop();
7293        self.slt['dx'] = self.slt['sxc'] - self.slt['sx'];
7294        self.slt['dy'] = self.slt['syc'] - self.slt['sy'];
7295        self.slt['dxp'] = Math.abs(self.slt['dx']);
7296        self.slt['dyp'] = Math.abs(self.slt['dy']);
7297        if (self.sl.attr('data-moving') !== '1' && self.slt['dxp'] > 10 && self.slt['dxp'] / self.slt['dyp'] > 1.4) {
7298          if (self.slt['dx'] > 0) {
7299            self.slt['sx'] = self.slt['sy'] = null;
7300            self.smartSliderMove('-', {flip:this.option.flip});
7301          } else {
7302            self.slt['sx'] = self.slt['sy'] = null;
7303            self.smartSliderMove('+', {flip:this.options.flip});
7304          }
7305          self.slt['isClick'] = false;
7306        }
7307      }
7308    }
7309    else if (type === 'touchend' || type === 'mouseup') {
7310      if (!self.slt['isClick']) self.sl.attr('data-istouched', true);
7311      else self.sl.attr('data-istouched', false);
7312      self.slt['sx'] = self.slt['sy'] = null;
7313      self.setVar();
7314    }
7315    event.stopPropagation();
7316    event.stopImmediatePropagation();
7317  }
7318  
7319  resize(event){
7320    const self = this;
7321    var doResize = true;
7322    if(self.slI == null) doResize = false;
7323    if(self.options.slideronlymobile === '1' && !window.matchMedia("(max-width: " + self.options.breakpoint + ")").matches){
7324      if(self.sl.attr('data-init') === undefined){
7325        self.init();
7326        doResize = false;
7327      }
7328      else{
7329        self.deactivate();
7330        doResize = false;
7331      }
7332    }
7333    else if(self.options.slideronlymobile === '1' && window.matchMedia("(max-width: " + self.options.breakpoint + ")").matches){
7334      if(self.sl.attr('data-init') === undefined){
7335        self.init();
7336        doResize = false;
7337      }
7338      self.activate();
7339    }
7340    
7341    if(!doResize) return false;
7342    
7343    var bkpRaster = [415, 576, 768, 992, 1200];
7344    var curBKP = bkpRaster.reduce((acc, bp) => jQuery(window).width() >= bp ? bp : acc, 0);
7345    
7346    if(!self.onload && self.slI.outerWidth() != self.slIw){
7347      self.setVar(true);
7348      self.onload = true;
7349      if(this.sl.attr('data-smartpagenavi') == 'scrollbar'){self.setScrollbar();self.setPageNav();}
7350      else if(this.sl.attr('data-smartpagenavi') == 'scrollbarOnly') self.setScrollbar();
7351      else self.setPageNav();
7352    }
7353    else if(self.curBKP != null && self.curBKP != curBKP){
7354      if(typeof event.originalEvent != 'undefined' && event.originalEvent.isTrusted){
7355        self.sl.find('> div, > ul').css({'margin-left' : 0});
7356        self.setVar(true);
7357        if(this.sl.attr('data-smartpagenavi') == 'scrollbar'){self.setScrollbar();self.setPageNav();}
7358        else if(this.sl.attr('data-smartpagenavi') == 'scrollbarOnly') self.setScrollbar();
7359        else self.setPageNav();
7360      }
7361    }
7362    self.curBKP = curBKP;
7363  }
7364}
7365
7366wSmartSlider = function(sl, options){
7367  if(typeof(window.smartSliderObjects) == 'undefined') window.smartSliderObjects = {};
7368  if(!sl.attr('data-slid')){
7369    sl.attr('data-slid', Math.random().toString(36).substr(2,9));
7370  }
7371  var slId = sl.attr('data-slid');
7372  var slO  = null;
7373  if(window.smartSliderObjects[slId] === undefined){
7374    slO = new wClassSmartSlider(sl, options);
7375    window.smartSliderObjects[slId] = slO;
7376  }
7377  else slO = window.smartSliderObjects[slId];
7378};
7379
7380jQuery.fn.wLightbox = function(optionsLightbox){
7381
7382  jQuery.each(jQuery(this), function(){
7383    if(jQuery(this).prop("tagName") == 'A' && jQuery(this).closest('li[data-target*="box"]').length > 0){
7384      jQuery(this).on('click', function(){
7385        jQuery(this).closest('li[data-target*="box"]').trigger('click');
7386        return false;
7387      });
7388    }
7389    else{
7390      if(jQuery(this).attr('target') != 'embedBody' && jQuery(this).attr('data-hasinitlightbox') != '1'){     
7391        jQuery(this).attr('data-hasinitlightbox', '1');  
7392        jQuery(this).on('click', function(){
7393          return wLightbox(jQuery(this), typeof(optionsLightbox) != 'undefined' ? optionsLightbox : {});
7394        });
7395        jQuery(this).on('submit', function(){
7396          return wLightbox(jQuery(this), typeof(optionsLightbox) != 'undefined' ? optionsLightbox : {});
7397        }); 
7398      }  
7399    }
7400    
7401    if(typeof(wEditor) == 'undefined' && jQuery(this).prop("tagName") == 'PICTURE'){ 
7402      jQuery(this).attr('tabindex', 0);
7403      jQuery(this).keypress(function(event){
7404       if(event.keyCode == 13 || event.keyCode == 32 ){
7405         jQuery(this).trigger("click");
7406         event.preventDefault();
7407       }
7408      });  
7409    }
7410    
7411  });
7412};
7413
7414wLightbox = function(objectCurrent, options){
7415
7416  if(typeof(wEditor) != 'undefined'){
7417    return false;
7418  }
7419
7420  var elementCurrent, src, alt = '', queryString = '', srcOrig, rel, optionsInit = options;
7421  
7422  var openPointerType = '';
7423  
7424  if(typeof(event) !== 'undefined'){
7425   if(typeof(event.pointerType) !== 'undefined'){
7426     openPointerType = event.pointerType;
7427   } 
7428  
7429    wLightboxOpener = event.target;
7430  }  
7431
7432  options = options || {};
7433  
7434  options['objectCurrent'] = objectCurrent;
7435  
7436  if(typeof(objectCurrent.jquery) == 'undefined'){
7437    options = typeof(optionsInit) != 'undefined' ? options : objectCurrent;
7438  }
7439  else if(objectCurrent.attr('data-isinactivelightbox') == '1'){
7440    return false;
7441  }
7442  
7443  lwd = {};
7444  lwd['box']          = {class : 'default', postfix : 'viewmode=blank&linkback=no'};
7445  lwd['boxPicture']   = {class : 'image', scrollIfToHeight : false, imitSizeIfPicture : true, addCopyrightElement : true, addPlayer : false, playerDuration : 5000, allowFullscreen : false};
7446  lwd['boxGallery']   = {class : 'imageFull', scrollIfToHeight : false, limitSizeIfPicture : true, addCopyrightElement : true, addPlayer : true, playerDuration : 5000, showPlayerProgress : true, showEntryPosition : true, animation : 'slidefrombeside' /*[fadein|slidefrombeside|slideout|overlapfrombeside]*/ , allowFullscreen : true, allowTouchSlide : true, animationOverflow : 'visible'};
7447  lwd['boxPdfViewer'] = {class : 'pdfViewer', scrollIfToHeight : false, limitSizeIfPicture : true, addCopyrightElement : false, showEntryPosition : true, showEntriesSelectable : true, showEntriesSelectableThumbnail : true, animation : 'overlapfrombeside' /*[fadein|slidefrombeside|slideout|overlapfrombeside]*/ , allowFullscreen : false, allowTouchSlide : true, animationOverflow : 'visible', allowFullscreen : false, allowZoom : true, animationOverflow : 'hidden', closeOnClickBackground : false};
7448  lwd['boxVideo']     = {class : 'video'};
7449  lwd['boxYoutube']   = {class : 'youtube'};
7450  lwd['boxContent']   = {class : 'content', postfix : 'viewmode=blank&linkback=no'};
7451  lwd['boxForm']      = {class : 'form', postfix : 'viewmode=blank&linkback=no'};
7452  lwd['boxCard']      = {class : 'card', postfix : 'viewmode=blank&linkback=no'};
7453  lwd['boxCart']      = {class : 'cart', postfix : 'viewmode=blank&linkback=no'};
7454  
7455  if(typeof(wLightboxVariants) != 'undefined'){
7456    if(!options['variant']){
7457      if(objectCurrent.attr('data-variant')){
7458        options['variant'] = objectCurrent.attr('data-variant');
7459      }
7460      else if(objectCurrent.prop('tagName') == 'A' && objectCurrent.attr('target') && objectCurrent.attr('target').indexOf('box') != -1){
7461        options['variant'] = objectCurrent.attr('target');
7462      }
7463      else if(objectCurrent.prop('tagName') == 'FORM' && objectCurrent.attr('data-target') && objectCurrent.attr('data-target').indexOf('box') != -1){
7464        options['variant'] = objectCurrent.attr('data-target');
7465      }       
7466      else if(objectCurrent.prop('tagName') == 'PICTURE' || objectCurrent.attr('class') && objectCurrent.attr('class').indexOf('picture') != -1){
7467        if(objectCurrent.closest('.listPictureGallery').length != 0 && wLightboxVariants['boxGallery']){
7468          options['variant'] = 'boxGallery';
7469        }
7470        else{
7471          options['variant'] = 'boxPicture';          
7472        }
7473      }        
7474      else {
7475        options['variant'] = 'box';
7476      }
7477      if(/(box\w+)/.test(objectCurrent.get(0).className)){
7478        options['variant'] = RegExp.$1;
7479      }
7480    }
7481        
7482    if(typeof(objectCurrent.jquery) != 'undefined' && objectCurrent.attr('data-copyright-lightbox')  && objectCurrent.attr('data-onlypicturecopyright-lightbox') != '1'){
7483      options['copyrightText'] = objectCurrent.attr('data-copyright-lightbox'); 
7484    }
7485    
7486    if(typeof wLightboxVariants[options['variant']] === 'undefined'){
7487      if(typeof lwd[options['variant']] !== 'undefined'){
7488        wLightboxVariants[options['variant']] = lwd[options['variant']];
7489      }
7490    }  
7491   
7492    if(wLightboxVariants[options['variant']]){
7493      if(wLightboxVariants[options['variant']]['class'] && !options['class']){
7494        options['class'] = wLightboxVariants[options['variant']]['class'];
7495      }
7496      if(wLightboxVariants[options['variant']]['width'] && !options['width']){
7497        options['width'] = wLightboxVariants[options['variant']]['width'];
7498      }
7499      if(wLightboxVariants[options['variant']]['height'] && !options['height']){
7500        options['height'] = wLightboxVariants[options['variant']]['height'];
7501      }
7502      if(wLightboxVariants[options['variant']]['postfix'] && !options['postfix']){
7503        options['postfix'] = wLightboxVariants[options['variant']]['postfix'];
7504      }
7505      if(wLightboxVariants[options['variant']]['scrollIfToHeight'] && !options['scrollIfToHeight']){
7506        options['scrollIfToHeight'] = wLightboxVariants[options['variant']]['scrollIfToHeight'];
7507      }
7508      if(wLightboxVariants[options['variant']]['limitSizeIfPicture'] && !options['limitSizeIfPicture']){
7509        options['limitSizeIfPicture'] = wLightboxVariants[options['variant']]['limitSizeIfPicture'];
7510      }
7511      if(typeof wLightboxVariants[options['variant']]['closeOnClickBackgroun
7511d'] !== 'undefined'){
7512        options['closeOnClickBackground'] = wLightboxVariants[options['variant']]['closeOnClickBackground'];
7513      }   
7514      if(typeof wLightboxVariants[options['variant']]['type'] !== 'undefined'){
7515        options['type'] = wLightboxVariants[options['variant']]['type'];
7516      } 
7517      if(typeof wLightboxVariants[options['variant']]['pushState'] !== 'undefined'){
7518        options['pushState'] = wLightboxVariants[options['variant']]['pushState'];
7519      } 
7520    }
7521  }
7522    
7523  if(typeof(objectCurrent.jquery) == 'undefined'){
7524    src = options['href'] ? options['href'] : objectCurrent;
7525    rel = '';
7526    objectCurrent = jQuery('<a href="' + src + '" target=""></a>');
7527  }
7528  else if(typeof(options['href']) != 'undefined' && /\//.test(options['href'])){
7529    src = options['href'];
7530    if(objectCurrent.get(0) instanceof Window) objectCurrent = jQuery('<a href="' + src + '" target=""></a>'); 
7531    rel = objectCurrent.attr('data-rel') ? objectCurrent.attr('data-rel') : '';
7532    elementCurrent = objectCurrent.get(0);    
7533    objectCurrent = jQuery('<a href="' + src + '" target=""></a>');
7534  }    
7535  else{
7536    elementCurrent = objectCurrent.get(0);
7537    if(objectCurrent.prop('tagName') == 'FORM'){
7538      src = objectCurrent.attr('action');      
7539      objectCurrent.find('input').each(function(){
7540        var add = true;
7541        if((jQuery(this).attr('type') == 'radio' || jQuery(this).attr('type') == 'checkbox') && !jQuery(this).prop('checked')) add = false;
7542        if(add) queryString += (queryString == '' ? '?' : '&') + jQuery(this).attr('name') + '=' + encodeURIComponent(jQuery(this).val());
7543      });
7544      src += queryString;
7545    }
7546    else{      
7547      src = objectCurrent.attr('data-href') ? objectCurrent.attr('data-href') : objectCurrent.attr('href');
7548      alt = objectCurrent.find('img').attr('alt') ? objectCurrent.find('img').attr('alt') : '';  
7549      
7550      if(!src){
7551        currentImage = objectCurrent.find('img');
7552        rel = objectCurrent.attr('rel');      
7553        if(currentImage){
7554          if(currentImage.parent().prop('tagName') == 'PICTURE' && objectCurrent.parent().attr('data-src')){
7555            src = objectCurrent.parent().attr('data-src');
7556            if(objectCurrent.parent().attr('data-rel')){
7557              rel = objectCurrent.parent().attr('data-rel');
7558            }  
7559          }
7560          else if(currentImage.parent().prop('tagName') == 'PICTURE'){
7561            src = objectCurrent.attr('data-src');
7562          }        
7563          else{
7564            src = objectCurrent.find('img').attr('src');
7565          }
7566        }
7567      }
7568      if(!src){
7569        src = options['href'];
7570      }     
7571      
7572      if(options['limitSizeIfPicture'] && objectCurrent.find('source').length != 0 && objectCurrent.attr('data-lightboxequal') == '1'){
7573        var srcs = [], srcToCheck = '', widthSrcToCheck = 0, srcToUse = '', widthSrcToUse = 10000, windowWidth = parseInt(jQuery(window).width());
7574        objectCurrent.find('source').each(function(){
7575          try{
7576            srcs = jQuery(this).attr('srcset').split(',');
7577            for(var i = 0; i < srcs.length; i++){
7578              srcToCheck = srcs[i].replace(/\s+\w+/, '').trim();
7579              if(/@(\d+)w/.test(srcToCheck)){
7580                widthSrcToCheck = RegExp.$1;
7581                if(widthSrcToCheck >= windowWidth * devicePixelRatio && widthSrcToCheck < widthSrcToUse){
7582                  src = srcToCheck;
7583                  widthSrcToUse = widthSrcToCheck;
7584                }
7585              }
7586            }
7587          }catch(e){}  
7588        });
7589      }
7590    }    
7591    if(!rel){
7592      rel = objectCurrent.attr('data-rel');
7593    }
7594  }
7595
7596  srcOrig = src;
7597
7598  if(options['postfix']){
7599    if(/(.*)(#.*)$/.test(src)){
7600      src = RegExp.$1;
7601      var anchor = RegExp.$2;
7602      src += /\?/.test(src) ? '&' + options['postfix'] + anchor : '?' + options['postfix'] + anchor;
7603    }
7604    else{
7605      src += /\?/.test(src) ? '&' + options['postfix'] : '?' + options['postfix'];
7606    }
7607  }
7608  
7609  if(/^https?\:\/\/([^\/]+)/.test(src) && !/\.(png|jpe?g|gif|webp)$/i.test(src)){
7610    var removeBlank = true;
7611    if(RegExp.$1 == location.host){
7612      removeBlank = false;
7613    }
7614    if(typeof(wHostsAllowViewmodeBlank) !== 'undefined' && wHostsAllowViewmodeBlank != ''){
7615      var regExpAllowViewmmodeBlank = new RegExp(wHostsAllowViewmodeBlank.replace(/\./g, '\\.'));
7616      if(regExpAllowViewmmodeBlank.test(src)){
7617        removeBlank = false;
7618      }
7619    }
7620    if(removeBlank){
7621      src = src.replace('viewmode=blank', '').replace('linkback=no', '');
7622      src = src.replace(/[\?\&]+$/, '');
7623    }
7624  }
7625  
7626  var externalRessourceToConfirm = '';
7627  if(/youtu\.be\/([^\&\?]+)/.test(src) || /youtube(?:-nocookie)?\.com\/watch\?v=([^\&\?]+)/.test(src) || /youtube(?:-nocookie)?\.com\/embed\/([^\&\?]+)/.test(src) || /youtube(?:-nocookie)?\.com\/shorts\/([^\&\?]+)/.test(src)){
7628    options['class'] = 'youtube';
7629    var vu = 'https://www.youtube-nocookie.com/embed/' + RegExp.$1;   
7630    var vqs = '';
7631    if(/(start=\d+)/.test(src)){
7632      vqs += (vqs == '' ? '?' : '&') + RegExp.$1;
7633    }
7634    else if(/(t=\d+)/.test(src)){
7635      vqs += (vqs == '' ? '?' : '&') + 'star' + RegExp.$1;
7636    }    
7637    if(/(end=\d+)/.test(src)){
7638      vqs += (vqs == '' ? '?' : '&') + RegExp.$1;
7639    }
7640    vqs += (vqs == '' ? '?' : '&') + 'autoplay=1&rel=0';    
7641    src = vu + vqs;
7642    externalRessourceToConfirm = 'youtube';
7643  }
7644  else if(/vimeo.com\/(?:video\/)?([\w]+)/.test(src)){
7645    options['class'] = 'youtube';
7646    var vu = 'https://player.vimeo.com/video/' + RegExp.$1;   
7647    var vqs = '';
7648    if(/[\?&](h=\w+)/.test(src)){
7649      vqs += (vqs == '' ? '?' : '&') + RegExp.$1;
7650    }
7651    if(/(start=\d+)/.test(src)){
7652      vqs += (vqs == '' ? '?' : '&') + RegExp.$1;
7653    }    
7654    if(/(end=\d+)/.test(src)){
7655      vqs += (vqs == '' ? '?' : '&') + RegExp.$1;
7656    }
7657    vqs += (vqs == '' ? '?' : '&') + 'autoplay=1';    
7658    src = vu + vqs;
7659    externalRessourceToConfirm = 'vimeo';    
7660  }  
7661  
7662  if(typeof(wConfirmExternVideosInLightbox) != 'undefined' && wConfirmExternVideosInLightbox === false){
7663    externalRessourceToConfirm = '';
7664  }
7665    
7666  var lightboxClassName = 'wLightbox-' + (options['class'] ? options['class'] : 'default');
7667
7668  var contentWidth  = 0;
7669  var contentHeight = 0;
7670
7671  var elementsRel = jQuery("*[data-rel = '" + rel + "']:not([data-isinactivelightbox='1'])");
7672  var numberRel   = elementsRel.length;
7673  var positionRel = 1;
7674  
7675  for(i = 0; i < numberRel; i++){
7676    if(elementCurrent && elementsRel[i] == elementCurrent){
7677      positionRel = i + 1;
7678      break;
7679    }
7680  }
7681
7682  var classPrev = 'wLightboxMoverBack' + (numberRel > 1 && positionRel > 1 ? ' wLightboxMoverBackAvailable' : '');
7683  var classNext = 'wLightboxMoverForward' + (numberRel > 1 && positionRel < numberRel ? ' wLightboxMoverForwardAvailable' : '');
7684  
7685  if(options['pushState'] && positionRel > 0){
7686    let pushStateHash = '#anchor_lightbox_' + rel + '_' + positionRel;
7687    history.pushState({page: pushStateHash}, '', pushStateHash);
7688  }
7689
7690  var boxWasOpened   = true;
7691  var lightboxType   = 'iframe';
7692  var titleInnerHTML = '';
7693  
7694  if(options['type'] == 'inline' || objectCurrent && objectCurrent.attr('data-lightboxtype') == 'inline'){
7695    lightboxType = 'inline';
7696  }
7697  else if(options['type'] == 'ajax' || objectCurrent && objectCurrent.attr('data-lightboxtype') == 'ajax'){
7698    lightboxType = 'inline'; 
7699    options['type'] = 'ajax';                                                                                                               
7700  }  
7701  else if(/\.(jpe?g|gif|webp|png|svg)$/i.test(src.replace(/\?.*/, '')) || options['type'] == 'image' || objectCurrent && objectCurrent.attr('data-lightboxtype') == 'image'){
7702    lightboxType = 'image';
7703  }
7704  else if(/\.(mpeg|mp4|m4v)(\?[^\/]*)*$/i.test(src) || options['type'] == 'video' ||objectCurrent && objectCurrent.attr('data-lightboxtype') == 'video'){
7705    lightboxType = 'video';
7706  }
7707  
7708  if(typeof(wOnBeforeOpenLightbox) === 'function'){
7709    if(wOnBeforeOpenLightbox(src, options) == false){
7710      return false;
7711    }
7712  }
7713  var lE = jQuery('.wLightbox');
7714      
7715  if(jQuery('#wLightbox').length == 0){
7716    if(lightboxType == 'inline'){
7717      options['content'] = options['content'] || '';
7718      options['allowTouchStart'] = typeof(options['allowTouchStart']) != 'undefined' ? options['allowTouchStart'] : false;      
7719      jQuery('<div id="wLightbox" data-type="' + lightboxType + '" class="wLightbox wLightbox-' + options['type'] + ' ' + lightboxClassName + '" data-src="' + src + '"><div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner" ' + (!options['allowTouchStart'] ? ' ontouchstart="event.preventDefault();"' : '') + (!options['allowMouseDown'] ? ' onmousedown="event.preventDefault();"' : '') + '><div class="wLightboxCloser" role="button" aria-label="'+wGetText('close')+'"></div>' + options['content'] + '<div class="wLightboxTitle"></div></div></div></div>').appendTo('body');
7720    }   
7721    else if(lightboxType == 'image'){
7722      if(typeof(wAddRandomIdToImagesInLightbox) != 'undefined' && wAddRandomIdToImagesInLightbox){
7723        src = src + (src.indexOf('?') == -1 ? '?' : '') + String(parseInt(Math.random() * 1000000));
7724      }      
7725            
7726      jQuery('<div id="wLightbox" data-type="' + lightboxType + '" ' + (wLightboxVariants[options['variant']]['showPlayerProgress'] ? ' data-showplayerprogress="1"' : '')+ (wLightboxVariants[options['variant']]['showEntryPosition'] && numberRel > 1 ? ' data-showentryposition="1"' : '') + ' class="wLightbox wLightbox-image ' + lightboxClassName + '" data-src="' + src + '"' + (wLightboxVariants[options['variant']]['allowFullscreen'] ? ' data-allowfullscreen="1"' : '') + '><div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner">' + (wLightboxVariants[options['variant']]['showEntryPosition'] && numberRel > 1 ? '<div class="wLightboxEntries"><div class="wLightboxEntryPosition">' + positionRel + ' / ' + numberRel + '</div><div class="wLightboxEntriesSelectable"></div><div class="wLightboxEntriesSelectableOpener"></div></div>' : '') + (wLightboxVariants[options['variant']]['allowDownload'] && objectCurrent.attr('data-downloadpath') && objectCurrent.attr('data-downloadpath') != '' ? '<div class="wLightboxDownload"><span></span><span></span></div>' : '') + (wLightboxVariants[options['variant']]['allowZoom'] && numberRel > 1 ? '<div class="wLightboxZoom"><span></span><span></span></div>' : '') + (wLightboxVariants[options['variant']]['addPlayer'] && numberRel > 1 ? '<div class="wLightboxPlayer"><span></span><span></span></div>' : '') + (wLightboxVariants[options['variant']]['allowFullscreen'] ? '<div class="wLightboxFullscreen"><span></span><span></span></div>' : '') + '<div class="wLightboxCloser" role="button" aria-label="'+wGetText('close')+'"><span></span><span></span></div><div aria-label="'+wGetText('button_back')+'" class="' + classPrev + '"><span></span><span></span></div><div aria-label="'+wGetText('button_next')+'" role="button" class="' + classNext + '"><span></span><span></span></div><div class="wLightboxImageOuter"><img class="wLightboxImage" src="' + src + '" alt="' + alt + '"/>' + (wLightboxVariants[options['variant']]['addCopyrightElement'] && options['copyrightText'] ? '<div class="wLightboxCopyright">' + options['copyrightText'] + '</div>' : '') + '</div><div class="wLightboxFooter"><div class="wLightboxTitle">' + titleInnerHTML + '</div><div class="wLightboxDescription">' + titleInnerHTML + '</div></div>' + (wLightboxVariants[options['variant']]['showPlayerProgress'] ? ' <div class="wLightboxPlayerProgress"></div>' : '') + '</div></div></div>').appendTo('body');
7727              
7728      if(elementsRel.length > 1 && elementsRel[1].getAttribute('data-src')){
7729        var imgPreload = new Image();
7730        imgPreload.src = elementsRel[1].getAttribute('data-src');
7731      }
7732      if(elementsRel.length > 1 && wLightboxVariants[options['variant']]['showEntriesSelectable'] && numberRel > 1 ){
7733        jQuery('.wLightboxEntries').on('click', function(){
7734          jQuery('.wLightboxEntriesSelectable').toggleClass('open');
7735        });              
7736        
7737        var thumbnailsRel = [];
7738        
7739        if(wLightboxVariants[options['variant']]['showEntriesSelectableThumbnail'] && jQuery(elementsRel[0]).closest('.listInner').length === 1){
7740          thumbnailsRel = jQuery(elementsRel[0]).closest('.listInner').find('.listEntriesPreview img');
7741        }
7742                
7743        for(var j = 0; j < elementsRel.length; j++){
7744          var thumbnailElement = '';
7745          if(thumbnailsRel[j]){
7746            thumbnailElement = '<img class="wLightboxEntrySelectableThumbnail" src="' + thumbnailsRel[j].getAttribute('src') + '" alt="" />';
7747          }
7748          jQuery('.wLightboxEntriesSelectable').append('<div class="wLightboxEntriesSelectablePage' + (j === positionRel - 1 ? ' selected' : '') + '" data-pageid="' + (j + 1) + '">' + thumbnailElement + '<span class="wLightboxEntrySelectablePageId">' + (j + 1) + '</span></div>');   
7749        }
7750        
7751        jQuery('.wLightboxEntriesSelectablePage').on('click', function(){
7752          jQuery('.wLightboxEntriesSelectablePage.selected').removeClass('selected');
7753          jQuery('.wLightboxEntriesSelectablePage').eq(jQuery(this).data('pageid') - 1).addClass('selected');                 
7754          jQuery(elementsRel[jQuery(this).data('pageid') - 1]).trigger('click'); 
7755        });
7756      }
7757    }
7758    else if(lightboxType == 'video'){
7759      var mimeTypeVideo  = 'video/mp4';
7760      jQuery('<div id="wLightbox" data-type="' + lightboxType + '" class="wLightbox wLightbox-video ' + lightboxClassName + '" data-src="' + src + '">
7760<div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner" ontouchstart="event.preventDefault();" onmousedown="event.preventDefault();"><div class="wLightboxCloser"></div><div class="' + classPrev + '"><span></span><span></span></div><div class="' + classNext + '"><span></span><span></span></div><video controls="controls" autoplay="autoplay" style="max-width:100%;width:auto;height:auto;"><source src="' + src + '" type="' + mimeTypeVideo + '" /></video><div class="wLightboxFooter"><div class="wLightboxTitle">' + titleInnerHTML + '</div></div></div></div></div>').appendTo('body');
7761    }
7762    else{ 
7763      var srcIframe = src;
7764      if(document.cookie.indexOf('allowLoadExternRessources=1') == -1 && (externalRessourceToConfirm == 'youtube' || externalRessourceToConfirm == 'vimeo')){
7765        srcIframe = 'about:blank';
7766        if(externalRessourceToConfirm == 'vimeo'){
7767          var urlConfirmExternalRessource = wProjectPath + '/wGlobal/content/privacy/vimeo-start-notice-iframe.php?viewmode=blank';
7768        }
7769        else{
7770          var urlConfirmExternalRessource = wProjectPath + '/wGlobal/content/privacy/youtube-start-notice-iframe.php?viewmode=blank';
7771        }
7772        jQuery.ajax({type: "GET", url: urlConfirmExternalRessource,
7773          success: function(result){
7774            jQuery('#wLightboxIframe').on("load", function(){
7775              var videoStart = (jQuery('#wLightboxIframe').contents().find("#startVideo").length > 0 ? jQuery('#wLightboxIframe').contents().find("#startVideo") : jQuery('#wLightboxIframe').contents().find("html"));
7776              videoStart.on('click', function(){parent.jQuery('#wLightboxIframe').attr('src', parent.jQuery('#wLightboxIframe').data('srcx'));return false;});
7777            });
7778            jQuery('#wLightboxIframe').attr('src', urlConfirmExternalRessource);
7779          },
7780          error: function (xhr, ajaxOptions, thrownError){
7781            if(xhr.status == 404){
7782              jQuery('#wLightboxIframe').attr('src', jQuery('#wLightboxIframe').data('srcx'))
7783            }
7784          }
7785        });  
7786      }
7787      var lightboxHTML = '<div id="wLightbox" data-type="' + lightboxType + '" class="wLightbox wLightbox-iframe ' + lightboxClassName + '" data-src="' + src + '"><div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner"><div class="wLightboxCloser"></div><div class="' + classPrev + '"><span></span><span></span></div><div class="' + classNext + '"><span></span><span></span></div><iframe id="wLightboxIframe" class="wLightboxIframe" data-openpointertype="' + openPointerType + '" allow="autoplay" allowfullscreen="true" data-srcx="' + src + '" src="' + srcIframe + '"></iframe><div class="wLightboxTitle"></div></div></div></div>';
7788      jQuery(lightboxHTML).appendTo('body');      
7789    }
7790    lE = jQuery('#wLightbox');
7791    
7792    jQuery('.wLightboxCloser, .wLightboxBackground').on('click touchend', function(event){
7793      if(jQuery(event.target).hasClass('wLightboxBackground') && options['closeOnClickBackground'] === false){
7794        return false;
7795      }
7796      wLightboxClose(event);
7797    });
7798        
7799    jQuery('.wLightboxFullscreen').on('click', function(){
7800      event.stopPropagation();
7801      if(jQuery('#wLightbox').attr('data-fullscreenstatus') != 'full'){    
7802        jQuery('#wLightbox').attr('data-fullscreenstatus', 'full');
7803        if(typeof jQuery('.wLightbox').get(0).requestFullScreen === 'function'){
7804          jQuery('.wLightbox').get(0).mozRequestFullScreen();
7805        }    
7806        else if(typeof jQuery('.wLightbox').get(0).mozRequestFullScreen === 'function'){
7807          jQuery('.wLightbox').get(0).mozRequestFullScreen();
7808        }    
7809        else if(typeof jQuery('.wLightbox').get(0).webkitRequestFullScreen === 'function'){
7810          jQuery('.wLightbox').get(0).webkitRequestFullScreen();
7811        }
7812      }  
7813      else{
7814        jQuery('#wLightbox').attr('data-fullscreenstatus', '');
7815        document.exitFullscreen();
7816      }
7817    });
7818    
7819    jQuery('.wLightboxZoom').on('click', function(){
7820      event.stopPropagation();
7821      if(jQuery('#wLightbox').attr('data-zoom') != '1'){    
7822        jQuery('#wLightbox').attr('data-zoom', '1');
7823      }  
7824      else{
7825        jQuery('#wLightbox').attr('data-zoom', '');
7826      }
7827    });   
7828    
7829    jQuery('.wLightboxDownload').on('click', function(){
7830      event.stopPropagation();
7831      window.open(objectCurrent.attr('data-downloadpath'));
7832    });      
7833        
7834    jQuery('.wLightboxPlayer').on('click', function(){
7835      event.stopPropagation();      
7836      if(jQuery('#wLightbox').attr('data-playerstatus') != 'play'){
7837
7838        var playerDuration = typeof wLightboxVariants[options['variant']]['playerDuration'] != 'undefined' ? wLightboxVariants[options['variant']]['playerDuration'] : 5000;        
7839
7840        jQuery('.wLightboxPlayerProgress').get(0).style.setProperty('--wLightboxPlayerDuration', String(playerDuration / 1000) + 's');
7841        
7842        jQuery('#wLightbox').attr('data-playerstatus', 'play');
7843                  
7844        if(jQuery('#wLightbox').attr('data-showplayerprogress') == '1'){
7845          jQuery('#wLightbox').attr('data-playerprogress', 'play');
7846        }
7847        
7848        if(elementsRel[jQuery('.wLightboxMoverForward').data('entry') + 1]){
7849          var imgPreload = new Image();
7850          imgPreload.src = elementsRel[jQuery('.wLightboxMoverForward').data('entry') + 1].getAttribute('data-src');
7851        }             
7852        
7853        intervallLightboxPlayer = window.setInterval(function(){
7854          if(jQuery('.wLightboxMoverForwardAvailable').length != 0){
7855            
7856            if(elementsRel[jQuery('.wLightboxMoverForward').data('entry') + 1]){
7857              var imgPreload = new Image();
7858              imgPreload.src = elementsRel[jQuery('.wLightboxMoverForward').data('entry') + 1].getAttribute('data-src');
7859            }
7860            
7861            jQuery('.wLightboxMoverForwardAvailable').trigger('click');
7862            
7863            if(jQuery('#wLightbox').attr('data-showplayerprogress') == '1'){
7864              jQuery('#wLightbox').attr('data-playerprogress', '');
7865              window.setTimeout(function(){
7866                jQuery('#wLightbox').attr('data-playerprogress', 'play');              
7867              }, 32);
7868            }            
7869          }  
7870          else{
7871            jQuery('#wLightbox').attr('data-playerstatus', 'pause');
7872            jQuery('#wLightbox').attr('data-playerprogress', '');            
7873            jQuery('.wLightboxPlayer').hide();
7874            window.clearInterval(intervallLightboxPlayer);
7875          }
7876        }, playerDuration);
7877      }
7878      else{
7879        jQuery('#wLightbox').attr('data-playerstatus', 'pause');
7880        jQuery('#wLightbox').attr('data-playerprogress', '');
7881        window.clearInterval(intervallLightboxPlayer);
7882      }
7883    });    
7884
7885    if(!wUiTmp['hasAEF']){
7886      wUiTmp['hasAEF'] = true;
7887      document.addEventListener('fullscreenchange', function(){
7888        if(!document.fullscreenElement){  
7889         jQuery('.wLightboxFullscreen').show();
7890        }
7891      });   
7892    }
7893
7894    boxWasOpened = false;
7895    jQuery('.wLightbox').addClass('wLightboxStatusLoading');
7896    //wUiTmp['wLightboxOuterWidth'] = jQuery('.wLightboxOuter').width();
7897    //wUiTmp['wLightboxOuterHeight'] = jQuery('.wLightboxOuter').height();
7898  }
7899  else if(lightboxType != lE.data('type')){
7900    if(lightboxType == 'inline'){
7901      options['content'] = options['content'] || '';
7902      lE.data('type', lightboxType)
7903        .data('src', src)
7904        .attr('class', 'wLightbox wLightbox-' + options['type'] + ' ' + lightboxClassName)
7905        .html('<div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner"' + (!options['allowTouchStart'] ? ' ontouchstart="event.preventDefault();"' : '') + (!options['allowMouseDown'] ? ' onmousedown="event.preventDefault();"' : '') + '><div class="wLightboxCloser"></div>' + options['content'] + '<div class="wLightboxTitle"></div></div></div></div>');
7906    }   
7907    else if(lightboxType == 'image'){
7908      lE.data('type', lightboxType)
7909        .data('src', src)
7910        .attr('class', 'wLightbox wLightbox-image ' + lightboxClassName)
7911        .html('<div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner"><div class="wLightboxCloser"><span></span><span></span></div><div class="' + classPrev + '"><span></span><span></span></div><div class="' + classNext + '"><span></span><span></span></div><div class="wLightboxImageOuter"><img class="wLightboxImage" src="' + src + '" alt="' + alt + '"/>' + (wLightboxVariants[options['variant']]['addCopyrightElement'] && options['copyrightText'] ? '<div class="wLightboxCopyright">' + options['copyrightText'] + '</div>' : '') + '</div><div class="wLightboxFooter"><div class="wLightboxTitle">' + titleInnerHTML + '</div><div class="wLightboxDescription">' + titleInnerHTML + '</div></div></div></div></div>');
7912    }
7913    else if(lightboxType == 'video'){   
7914      var mimeTypeVideo  = 'video/mp4';
7915      lE.data('type', lightboxType)
7916        .data('src', src)
7917        .attr('class', 'wLightbox wLightbox-video ' + lightboxClassName)
7918        .html('<div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner" ontouchstart="event.preventDefault();" onmousedown="event.preventDefault();"><div class="wLightboxCloser"></div><div class="' + classPrev + '"><span></span><span></span></div><div class="' + classNext + '"><span></span><span></span></div><video controls="controls" autoplay="autoplay" style="max-width:100%;width:auto;height:auto;"><source src="' + src + '" type="' + mimeTypeVideo + '" /></video><div class="wLightboxFooter"><div class="wLightboxTitle">' + titleInnerHTML + '</div></div></div></div></div>');
7919    }
7920    else{
7921      lE.data('type', lightboxType)
7922        .data('src', src)
7923        .attr('class', 'wLightbox wLightbox-iframe ' + lightboxClassName)
7924        .html('<div class="wLightboxBackground"></div><div class="wLightboxOuter"><div class="wLightboxInner"><div class="wLightboxCloser"></div><div class="' + classPrev + '"><span></span><span></span></div><div class="' + classNext + '"><span></span><span></span></div><iframe id="wLightboxIframe" class="wLightboxIframe" data-openpointertype="' + openPointerType + '" allowfullscreen="true" src="' + src + '"></iframe><div class="wLightboxTitle"></div></div></div></div>');
7925    }
7926    boxWasOpened = false;    
7927    jQuery('.wLightboxCloser, .wLightboxBackground').on('click touchend', function(){
7928      if(jQuery(event.target).hasClass('wLightboxBackground') && options['closeOnClickBackground'] === false){
7929        return false;
7930      }      
7931      wLightboxClose(event);
7932    });
7933    lE.removeClass('wLightboxStatusLoaded').addClass('wLightboxStatusChanging').addClass('wLightboxStatusChanging');    
7934  }  
7935  else{
7936    lE.removeClass('wLightboxStatusLoaded').addClass('wLightboxStatusChanging').addClass('wLightboxStatusChanging');
7937  }
7938    
7939  if(jQuery('.wLightboxEntryPosition').length != 0){
7940    jQuery('.wLightboxEntryPosition').html(positionRel + ' / ' + elementsRel.length);
7941  }
7942    
7943  if(lightboxType == 'inline'){
7944
7945    if(options['type'] == 'ajax'){
7946      if(!options['width']){
7947        options['width'] = 'content';
7948      }
7949      if(!options['height']){
7950        options['height'] = 'content';
7951      }
7952    }
7953    var heightTitle = 0;
7954
7955    if(elementCurrent && elementCurrent.getAttribute('title') && elementCurrent.getAttribute('title') != ''){
7956      jQuery('.wLightboxTitle').show().html(elementCurrent.getAttribute('title'));
7957    }
7958    else{
7959      jQuery('.wLightboxTitle').hide();
7960    }
7961
7962    heightTitle = jQuery('.wLightboxTitle').outerHeight();
7963
7964    var maxWidthBox  = (window.innerWidth ? window.innerWidth : (document.documentElement ? document.documentElement.offsetWidth : document.body.clientWidth))    - (parseInt(j
7964Query('.wLightboxOuter').css('padding-left')) + parseInt(jQuery('.wLightboxInner').css('border-left-width'))) * 2;
7965    var maxHeightBox = (window.innerHeight ? window.innerHeight : (document.documentElement ? document.documentElement.offsetHeight : document.body.clientHeight)) - (parseInt(jQuery('.wLightboxOuter').css('padding-top')) + parseInt(jQuery('.wLightboxInner').css('border-top-width'))) * 2 - heightTitle;
7966
7967    if(/^(\d+)px$/.test(options['width'])){
7968      maxWidthBox = parseInt(RegExp.$1);
7969    }
7970    else if(/^(\d+)%$/.test(options['width'])){
7971      maxWidthBox = parseInt(jQuery(window).width()) * RegExp.$1 / 100;
7972    }
7973
7974    if(/^(\d+)px$/.test(options['height'])){
7975      maxHeightBox = parseInt(RegExp.$1);
7976    }
7977    else if(/^(\d+)%$/.test(options['height'])){
7978      maxHeightBox = parseInt(jQuery(window).height()) * RegExp.$1 / 100;
7979    }
7980
7981    contentWidth = options && options['width'] && /^\d+(.\d+)?$/.test(options['width']) ? options['width'] : maxWidthBox;
7982    contentHeight = options && options['height'] && /^\d+(.\d+)?$/.test(options['height']) ? options['height'] : contentHeight = maxHeightBox;
7983    
7984    var pageRatio    = maxWidthBox / maxHeightBox;
7985    var contentRatio = contentWidth / contentHeight;
7986    var lightboxWidth  = contentWidth;
7987    var lightboxHeight = contentHeight + heightTitle;
7988
7989    if(contentWidth > maxWidthBox || contentHeight > maxHeightBox){
7990      if(contentRatio > pageRatio){
7991        lightboxWidth  = maxWidthBox;
7992        lightboxHeight = Math.round(maxWidthBox / contentRatio) + heightTitle;
7993      }
7994      else{
7995        lightboxWidth  = Math.round(maxHeightBox * contentRatio);
7996        lightboxHeight = maxHeightBox + heightTitle;
7997      }
7998    }
7999
8000    widthAttrib  = String(lightboxWidth) + 'px';
8001    heightAttrib = String(lightboxHeight) + 'px';
8002
8003    if(options['height'] == 'content'){
8004      jQuery('.wLightboxOuter').css({'max-height' : '100%'});
8005    }
8006    else{
8007      jQuery('.wLightboxOuter').css({'height' : heightAttrib});
8008    }
8009
8010    if(options['width'] == 'content'){
8011      jQuery('.wLightboxInner').css({'max-width' : '100%'});
8012    }
8013    else{
8014      jQuery('.wLightboxInner').css({'width' : widthAttrib});
8015    }
8016
8017    jQuery('.wLightboxPrev').data('entry', positionRel - 2);
8018    jQuery('.wLightboxNext').data('entry', positionRel);
8019
8020    if(boxWasOpened){
8021      jQuery('.wLightboxMoverBack').attr('class', classPrev);
8022      jQuery('.wLightboxMoverForward').attr('class', classNext);
8023      jQuery('.wLightbox').addClass('wLightboxStatusLoaded').removeClass('wLightboxStatusLoading');      
8024    }
8025    else{
8026      jQuery('.wLightbox').addClass('wLightboxStatusLoaded').removeClass('wLightboxStatusLoading');
8027      jQuery('.wLightboxInner').on('click touchend', function(event){
8028        event.stopPropagation();
8029      }); 
8030      jQuery('.wLightboxCloser, .wLightboxOuter').on('click touchend', function(event){
8031        if(jQuery(event.target).hasClass('wLightboxBackground') && options['closeOnClickBackground'] === false){
8032          return false;
8033        }        
8034        wLightboxClose(event);
8035      });
8036      jQuery('.wLightboxMoverBack, .wLightboxMoverForward').on('click', function(event){
8037        jQuery('.wLightbox').removeClass('wLightboxStatusLoaded').addClass('wLightboxStatusLoading');
8038        jQuery(elementsRel[jQuery(this).data('entry')]).trigger('click');
8039        event.stopPropagation();
8040      });
8041    }    
8042    
8043    if(options['type'] == 'ajax'){
8044      jQuery.ajax({type: "GET", url: src, success: function(result){
8045        jQuery('.wLightboxCloser').after('<div class="wLightboxContent">' + result + '</div>');
8046        if(options['height'] == 'content'){
8047          jQuery('.wLightboxContent').css({'max-height' : String(lightboxHeight) + 'px'});
8048        }
8049      }});
8050    }
8051  }
8052  else if(lightboxType == 'image'){
8053    var image = new Image();
8054     image.onload = function(){
8055       window.setTimeout(function(){
8056        if(false && /\.(svg)$/i.test(srcOrig)){
8057        }
8058        else{
8059          var imageRatio     = image.width / image.height;
8060          var lightboxWidth  = image.width;
8061          var lightboxHeight = image.height;
8062          var lEInner        = jQuery('.wLightboxInner');
8063          var lEOuter        = jQuery('.wLightboxOuter');
8064          var lETitle        = jQuery('.wLightboxTitle');
8065              
8066          var widthInnerBefore  = 0;
8067          var heightInnerBefore = 0;
8068          var widthInnerCurrent = 0;
8069          var heightInnerCurrent= 0;           
8070          var widthImageBefore  = 0;
8071          var heightImageBefore = 0;
8072          var diffWidthInner    = 0;
8073          var diffHeightInner   = 0;
8074                    
8075          widthInnerBefore   = lEInner.width();
8076          heightInnerBefore  = lEInner.height();
8077          widthInnerCurrent  = lEInner.width();
8078          heightInnerCurrent = lEInner.height();
8079          widthImageBefore   = jQuery('.wLightboxImage').width();
8080          heightImageBefore  = jQuery('.wLightboxImage').height();
8081
8082          lEInner.css({'width' : 'auto', 'height' : 'auto', 'max-height' : 'none', 'opacity' : '1'});
8083
8084          var widthArea  = lEOuter.width();
8085          var heightArea = lEOuter.height();
8086
8087          if(/^(\d+)px$/.test(options['width'])){
8088            widthArea = widthArea < parseInt(RegExp.$1) ? widthArea : parseInt(RegExp.$1);
8089          }
8090          else if(/^(\d+)%$/.test(options['width'])){
8091            widthArea = widthArea < parseInt(jQuery(window).width()) * RegExp.$1 / 100 ? widthArea : parseInt(jQuery(window).width()) * RegExp.$1 / 100;
8092          }
8093
8094          var computedStyle = window.getComputedStyle(lEInner.get(0));
8095
8096          widthArea  = parseInt(computedStyle['max-width']) < widthArea ? parseInt(computedStyle['max-width']) : widthArea;
8097          heightArea = parseInt(computedStyle['max-height']) < heightArea ? parseInt(computedStyle['max-height']) : heightArea;
8098          
8099          widthArea  -= (lEInner.outerWidth() - lEInner.width());
8100          heightArea -= (lEInner.outerHeight() - lEInner.height());
8101
8102          jQuery('.wLightboxFooter').css({'max-width' : String(lEInner.width()) + 'px'});
8103
8104          var areaRatio = widthArea / heightArea;
8105
8106          if(elementCurrent && elementCurrent.getAttribute('data-title') && elementCurrent.getAttribute('data-title') != ''){
8107            lETitle.show().html(elementCurrent.getAttribute('data-title'));
8108          }
8109          else if(elementCurrent && elementCurrent.getAttribute('title') && elementCurrent.getAttribute('title') != ''){
8110            lETitle.show().html(elementCurrent.getAttribute('title'));
8111          }
8112          else{
8113            lETitle.hide();
8114          }
8115
8116          if(elementCurrent && elementCurrent.getAttribute('data-description') != ''){
8117            jQuery('.wLightboxDescription').show();
8118            var diffWidthDescription = parseInt(jQuery('.wLightboxInner').width() - jQuery('.wLightboxDescription').width());
8119            jQuery('.wLightboxDescription').css({'width' : widthArea - diffWidthDescription, 'visibility' : 'hidden'}).show().html(elementCurrent.getAttribute('data-description'));
8120          }
8121          else{
8122            jQuery('.wLightboxDescription').hide();
8123          }
8124              
8125          if(wLightboxVariants[options['variant']] && wLightboxVariants[options['variant']]['addCopyrightElement'] && options['copyrightText']){
8126            if(jQuery('.wLightboxCopyright').length == 0){
8127              jQuery('.wLightboxImageOuter').append('<div class="wLightboxCopyright"/>');
8128            }
8129            jQuery('.wLightboxCopyright').show();
8130            jQuery('.wLightboxCopyright').html(options['copyrightText']);
8131          }
8132          else{
8133            jQuery('.wLightboxCopyright').hide();
8134          }
8135
8136          if(objectCurrent && objectCurrent.attr('data-lightboxdownloadable') == '1'){
8137            jQuery('.wLightboxDownload').remove();
8138            var srcDownload = src;
8139            if(objectCurrent.attr('data-srcdownload')){
8140              srcDownload = objectCurrent.attr('data-srcdownload');
8141            }
8142            jQuery('.wLightboxFooter').addClass('wLightboxFooterHasDownload').append('<div class="wLightboxDownload" data-src="' + srcDownload + '" title="Download"></div>');
8143            jQuery('.wLightboxDownload').on('click', function (event){
8144              window.open(jQuery(this).data('src'));
8145            });
8146          }
8147          else{
8148            jQuery('.wLightboxFooter').removeClass('wLightboxFooterHasDownload');
8149          }
8150
8151          jQuery('.wLightboxDescription').css({'width' : '', 'height' : '', 'max-height' : '', 'visibility' : ''});
8152          if(lEInner.height() >= jQuery(window).height()){
8153            jQuery('.wLightboxDescription').css({'max-height' : '200px', 'overflow-y' : 'auto'});
8154          }
8155          heightFooter = jQuery('.wLightboxFooter').outerHeight();
8156          diffHeight = lEInner.outerHeight() - lEInner.height();
8157
8158          if(image.width > widthArea || image.height > heightArea){
8159            if(imageRatio > areaRatio){
8160              lightboxWidth  = widthArea;
8161              lightboxHeight = Math.round(widthArea / imageRatio) + heightFooter;
8162            }
8163            else{
8164              lightboxWidth  = Math.round((heightArea - heightFooter) * imageRatio);
8165              lightboxHeight = heightArea;
8166            }
8167            lEInner.css({'width' : String(lightboxWidth) + 'px', 'height' : String(lightboxHeight) + 'px', 'max-height' : String(lightboxHeight + diffHeight) + 'px'});
8168          }
8169          else{
8170            lightboxWidth = image.width;
8171            lightboxHeight = image.height + heightFooter;
8172            lEInner.css({'width' : String(lightboxWidth) + 'px', 'height' : String(lightboxHeight) + 'px', 'max-height' : String(lightboxHeight + diffHeight) + 'px'});
8173          }
8174
8175          heightFooter = jQuery('.wLightboxFooter').outerHeight();
8176
8177          var widthArea  = lEOuter.width();
8178          var heightArea = lEOuter.height();
8179          widthInnerCurrent  = lEInner.width();
8180          heightInnerCurrent = lEInner.height();          
8181
8182          if(/^(\d+)px$/.test(options['width'])){
8183            widthArea = widthArea < parseInt(RegExp.$1) ? widthArea : parseInt(RegExp.$1);
8184          }
8185          else if(/^(\d+)%$/.test(options['width'])){
8186            widthArea = widthArea < parseInt(jQuery(window).width()) * RegExp.$1 / 100 ? widthArea : parseInt(jQuery(window).width()) * RegExp.$1 / 100;
8187          }
8188
8189          try{
8190            var computedStyle = window.getComputedStyle(lEInner.get(0));
8191
8192            widthArea   = parseInt(computedStyle['max-width']) < widthArea ? parseInt(computedStyle['max-width']) : widthArea;
8193            heightArea  = parseInt(computedStyle['max-height']) < heightArea ? parseInt(computedStyle['max-height']) : heightArea;
8194
8195            widthArea  -= (lEInner.outerWidth() - lEInner.width());
8196            heightArea -= (lEInner.outerHeight() - lEInner.height());
8197
8198            var areaRatio = widthArea / heightArea;
8199            if(image.width > widthArea || image.height > heightArea){
8200              if(imageRatio > areaRatio){
8201                lightboxWidth  = widthArea;
8202                lightboxHeight = Math.round(widthArea / imageRatio) + heightFooter;
8203              }
8204              else{
8205                lightboxWidth  = Math.round((heightArea - heightFooter) * imageRatio);
8206                lightboxHeight = heightArea;
8207              }
8208              lEInner.css({'width' : String(lightboxWidth) + 'px', 'height' : String(lightboxHeight) + 'px', 'max-height' : String(lightboxHeight + diffHeight) + 'px'});
8209            }
8210            else{
8211              lightboxHeight = image.height + heightFooter;
8212            } 
8213          }catch(e){}
8214
8215          jQuery('.wLightboxMoverBack').data('entry', positionRel - 2);
8216          jQuery('.wLightboxMoverForward').data('entry', positionRel);
8217
8218          lEInner.on('transitionend', function(event){
8219            if(lEInner.data('transisionended') != '1'){
8220              lEInner.data('transisionended', '1');
8221
8222              heightFooter = jQuery('.wLightboxFooter').outerHeight();
8223
8224              var widthArea  = jQuery('.wLightboxOuter').width();
8225              var heightArea = jQuery('.wLightboxOuter').height();
8226
8227              if(/^(\d+)px$/.test(options['width'])){
8228                widthArea = widthArea < parseInt(RegExp.$1) ? widthArea : parseInt(RegExp.$1);
8229              }
8230              else if(/^(\d+)%$/.test(options['width'])){
8231                widthArea = widthArea < parseInt(jQuery(window).width()) * RegExp.$1 / 100 ? widthArea : parseInt(jQuery(window).width()) * RegExp.$1 / 100;
8232              }
8233
8234              var computedStyle = window.getComputedStyle(lEInner.get(0));
8235
8236              widthArea  = parseInt(computedStyle['max-width']) < widthArea ? parseInt(computedStyle['max-width']) : widthArea;
8237              heightArea = parseInt(computedStyle['max-height']) < heightArea ? parseInt(computedStyle['max-height']) : heightArea;
8238              
8239              widthArea  -= (lEInner.outerWidth() - lEInner.width());
8240              heightArea -= (lEInner.outerHeight() - lEInner.height());
8241
8242              var areaRatio = widthArea / heightArea;
8243
8244              if(image.width > widthArea || image.height > heightArea){
8245                if(imageRatio > areaRatio){
8246                  lightboxWidth  = widthArea;
8247                  lightboxHeight = Math.round(widthArea / imageRatio) + heightFooter;
8248                }
8249                else{
8250                  lightboxWidth  = Math.round((heightArea - heightFooter) * imageRatio);
8251                  lightboxHeight = heightArea;
8252                }
8253                lEInner.css({'width' : String(lightboxWidth) + 'px', 'height' : String(lightboxHeight) + 'px', 'max-height' : String(lightboxHeight + diffHeight) + 'px'});
8254              }
8255              else{
8256                lightboxHeight = image.height + heightFooter;
8257              }
8258            }
8259          });
8260        }
8261
8262        if(boxWasOpened){
8263          jQuery('.wLightboxMoverBack').attr('class', classPrev);
8264          jQuery('.wLightboxMoverForward').attr('class', classNext);
8265          
8266          var animationOverflow          = typeof wLightboxVariants[options['variant']]['animationOverflow'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationOverflow'] : 'hidden';            
8267          var animationDistFactorDefault = 120;
8268          var animationDurationDefault   = 600;
8269          var animationEasingDefault     = 'linear';                        
8270
8271          var animationDistFactorIn  = typeof wLightboxVariants[options['variant']]['animationDistFactor'] !== 'undefined' ? (typeof wLightboxVariants[options['variant']]['animationDistFactorIn'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationDistFactorIn'] : wLightboxVariants[options['variant']]['animationDistFactor']) : animationDistFactorDefault;
8272          var animationDistFactorOut = typeof wLightboxVariants[options['variant']]['animationDistFactor'] !== 'undefined' ? (typeof wLightboxVariants[options['variant']]['animationDistFactorOut'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationDistFactorOut'] : wLightboxVariants[options['variant']]['animationDistFactor']) : animationDistFactorDefault;
8273          var animationDurationIn    = typeof wLightboxVariants[options['variant']]['animationDuration'] !== 'undefined' ? (typeof wLightboxVariants[options['variant']]['animationDurationIn'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationDurationIn'] : wLightboxVariants[options['variant']]['animationDuration']) : animationDurationDefault;
8274          var animationDurationOut   = typeof wLightboxVariants[options['variant']]['animationDuration'] !== 'undefined' ? (typeof wLightboxVariants[options['variant']]['animationDurationOut'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationDurationOut'] : wLightboxVariants[options['variant']]['animationDuration']) : animationDurationDefault;
8275          var animationEasingIn      = typeof wLightboxVariants[options['variant']]['animationEasing'] !== 'undefined' ? (typeof wLightboxVariants[options['variant']]['animationEasingIn'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationEasingIn'] : wLightboxVariants[options['variant']]['animationEasing']) : animationEasingDefault;
8276          var animationEasingOut     = typeof wLightboxVariants[options['variant']]['animationEasing'] !== 'undefined' ? (typeof wLightboxVariants[options['variant']]['animationEasingOut'] !== 'undefined' ? wLightboxVariants[options['variant']]['animationEasingOut'] : wLightboxVariants[options['variant']]['animationEasing']) : animationEasingDefault;
8277
8278          var lastDirection = jQuery('.wLightbox').attr('data-lastdirection');          
8279          var animation     = wLightboxVariants[options['variant']]['animation'] ? wLightboxVariants[options['variant']]['animation'].toLowerCase() : '';
8280                    
8281          if(animation == 'slidefrombeside'){
8282            animation = lastDirection == 'back' ? 'slidefromleft' : 'slidefromright';
8283          }
8284          else if(animation == 'overlapfrombeside'){
8285            animation = lastDirection == 'back' ? 'overlapfromleft' : 'overlapfromright';
8286          }          
8287          else if(animation == 'slideout'){
8288            animation = lastDirection == 'back' ? 'slideoutright' : 'slideoutleft';
8289          }           
8290
8291          diffWidthInner  = Math.round((widthInnerBefore  - lEInner.width()) * 1000) / 1000;
8292          diffHeightInner = Math.round((heightInnerBefore - lEInner.height()) * 1000) / 1000;   
8293
8294          if(animation == 'fadein'){
8295                              
8296            if(jQuery('.wLightboxInner').data('entryactive') == '1'){
8297              return;
8298            }
8299            
8300            jQuery('.wLightboxInner').data('entryactive', '1');
8301          
8302            if(animationOverflow == 'visible'){
8303              animationDistFactorDefault = 150;
8304              animationDurationDefault   = 600;
8305              animationEasingDefault     = 'wEaseOut';                
8306              jQuery('.wLightboxInner').css({'overflow' : 'visible'});
8307            }
8308
8309            var lightboxImageNew = jQuery('.wLightboxImage').attr('id', 'wLightboxImageCurrent').clone();
8310            var widthBefore      = widthImageBefore > 0 ?  widthImageBefore  : jQuery('#wLightboxImageCurrent').width();
8311            var heightBefore     = heightImageBefore > 0 ? heightImageBefore : jQuery('#wLightboxImageCurrent').height();
8312                        
8313            var diffMarginLeft = String(-diffWidthInner / 2) + 'px';
8314            var diffMarginTop  = String(-diffHeightInner / 2) + 'px';
8315            
8316            if(widthInnerBefore > widthInnerCurrent + 1){
8317              animationDistFactorOut = animationDistFactorOut * widthInnerBefore / widthInnerCurrent; 
8318            }
8319            
8320            lightboxImageNew.attr('id', 'wLightboxImageNew').attr('src', src).attr('alt', alt).css({'z-index' : '1', 'position' : 'relative', 'opacity' : '0'}).insertBefore("#wLightboxImageCurrent");            
8321            var heightNew  = lightboxImageNew.height();
8322            var leftCurrent = diffMarginLeft;
8323            var topCurrent  = diffMarginTop;
8324            jQuery('#wLightboxImageCurrent').css({'z-index' : '0', position : 'absolute', width : widthBefore, height : heightBefore, top : topCurrent, 'margin-left' : leftCurrent, 'max-height' : 'none', 'max-width' : 'none'});
8325            jQuery('#wLightboxImageCurrent').animate({'opacity': '0.5'}, {duration : animationDurationIn, easing : animationEasingIn, complete : function(){
8326              jQuery('.wLightboxInner').data('entryactive', '');
8327              jQuery('#wLightboxImageNew').attr('id', '');
8328              jQuery('#wLightboxImageCurrent').remove();
8329            }});
8330            lightboxImageNew.animate({'opacity': '1'}, {duration : animationDurationOut, easing : animationEasingOut, complete : function(){}});            
8331          }
8332          else if(animation == 'slideoutleft' || animation == 'slideoutright'){
8333
8334            if(jQuery('.wLightboxInner').data('entryactive') == '1'){
8335              return;
8336            }
8337            
8338            jQuery('.wLightboxInner').data('entryactive', '1');
8339          
8340            if(animationOverflow == 'visible'){
8341              animationDistFactorDefault = 150;
8342              animationDurationDefault   = 600;
8343              animationEasingDefault     = 'wEaseOut';                
8344              jQuery('.wLightboxInner').css({'overflow' : 'visible'});
8345            }
8346
8347            var lightboxImageNew = jQuery('.wLightboxImage').attr('id', 'wLightboxImageCurrent').clone();
8348            var widthBefore      = widthImageBefore > 0 ?  widthImageBefore  : jQuery('#wLightboxImageCurrent').width();
8349            var heightBefore     = heightImageBefore > 0 ? heightImageBefore : jQuery('#wLightboxImageCurrent').height();
8350                        
8351            var diffMarginLeft = String(-diffWidthInner / 2) + 'px';
8352            var diffMarginTop  = String(-diffHeightInner / 2) + 'px';
8353            
8354            if(widthInnerBefore > widthInnerCurrent + 1){
8355              animationDistFactorOut = animationDistFactorOut * widthInnerBefore / widthInnerCurrent; 
8356            }
8357            
8358            var marginLeftInit       = String(animationDistFactorIn) + '%';
8359            var marginLeftCurrentOut = '-' + String(animationDistFactorOut) + '%';
8360            
8361            if(animation == 'slideoutleft'){
8362              marginLeftInit       = 'calc(' + String(animationDistFactorIn) + '% + ' + String(diffWidthInner / 2) + 'px)';
8363            }
8364            else{
8365              marginLeftInit       = 'calc(-' + String(animationDistFactorIn) + '% ' + ' - ' + ' ' + String(diffWidthInner / 2) + 'px)';
8366            }
8367                        
8368            lightboxImageNew.attr('id', 'wLightboxImageNew').attr('src', src).attr('alt', alt).insertBefore("#wLightboxImageCurrent");            
8369            var heightNew  = lightboxImageNew.height();
8370            var leftCurrent = diffMarginLeft;
8371            var topCurrent  = diffMarginTop;
8372            jQuery('#wLightboxImageCurrent').css({position : 'absolute', width : widthBefore, height : heightBefore, top : topCurrent, 'margin-left' : leftCurrent, 'max-height' : 'none', 'max-width' : 'none'});
8373            jQuery('#wLightboxImageCurrent').animate({'left': (animation == 'slideoutleft' ? marginLeftCurrentOut : String(animationDistFactorOut) + '%')}, {duration : animationDurationIn, easing : animationEasingIn, complete : function(){
8374              jQuery('.wLightboxInner').data('entryactive', '');
8375              jQuery('#wLightboxImageNew').attr('id', '');
8376              jQuery('#wLightboxImageCurrent').remove();
8377            }});
8378            //lightboxImageNew.animate({'margin-left': '0'}, {duration : animationDurationOut, easing : animationEasingOut, complete : function(){}});
8379          }
8380          else if(animation == 'overlapfromleft' || animation == 'overlapfromright'){
8381                              
8382            if(jQuery('.wLightboxInner').data('entryactive') == '1'){
8383              return;
8384            }
8385            
8386            jQuery('.wLightboxInner').data('entryactive', '1');
8387          
8388            if(animationOverflow == 'visible'){
8389              animationDistFactorDefault = 150;
8390              animationDurationDefault   = 600;
8391              animationEasingDefault     = 'wEaseOut';                
8392              jQuery('.wLightboxInner').css({'overflow' : 'visible'});
8393            }
8394
8395            var lightboxImageNew = jQuery('.wLightboxImage').attr('id', 'wLightboxImageCurrent').clone();
8396            var widthBefore      = widthImageBefore > 0 ?  widthImageBefore  : jQuery('#wLightboxImageCurrent').width();
8397            var heightBefore     = heightImageBefore > 0 ? heightImageBefore : jQuery('#wLightboxImageCurrent').height();
8398                        
8399            var diffMarginLeft = String(-diffWidthInner / 2) + 'px';
8400            var diffMarginTop  = String(-diffHeightInner / 2) + 'px';
8401            
8402            if(widthInnerBefore > widthInnerCurrent + 1){
8403              animationDistFactorOut = animationDistFactorOut * widthInnerBefore / widthInnerCurrent; 
8404            }
8405            
8406            var marginLeftInit       = String(animationDistFactorIn) + '%';
8407            
8408            if(animation == 'overlapfromright'){
8409              marginLeftInit       = 'calc(' + String(animationDistFactorIn) + '% + ' + String(diffWidthInner / 2) + 'px)';
8410            }
8411            else{
8412              marginLeftInit       = 'calc(-' + String(animationDistFactorIn) + '% ' + ' - ' + ' ' + String(diffWidthInner / 2) + 'px)';
8413            }
8414                        
8415            lightboxImageNew.attr('id', 'wLightboxImageNew').attr('src', src).attr('alt', alt).css({'z-index' : '1', 'position' : 'relative', 'margin-left' : marginLeftInit}).insertBefore("#wLightboxImageCurrent");            
8416            var heightNew  = lightboxImageNew.height();
8417            var leftCurrent = diffMarginLeft;
8418            var topCurrent  = diffMarginTop;
8419            jQuery('#wLightboxImageCurrent').css({'z-index' : '0', position : 'absolute', width : widthBefore, height : heightBefore, top : topCurrent, 'margin-left' : leftCurrent, 'max-height' : 'none', 'max-width' : 'none'});
8420            jQuery('#wLightboxImageCurrent').animate({'opacity': '0.5'}, {duration : animationDurationIn, easing : animationEasingIn, complete : function(){
8421              jQuery('.wLightboxInner').data('entryactive', '');
8422              jQuery('#wLightboxImageNew').attr('id', '');
8423              jQuery('#wLightboxImageCurrent').remove();
8424            }});
8425            lightboxImageNew.animate({'margin-left': '0'}, {duration : animationDurationOut, easing : animationEasingOut, complete : function(){}});            
8426          }  
8427          else if(animation == 'slidefromright' || animation == 'slidefromleft'){
8428                      
8429            if(jQuery('.wLightboxInner').data('entryactive') == '1'){
8430              return;
8431            }
8432            
8433            jQuery('.wLightboxInner').data('entryactive', '1');
8434          
8435            if(animationOverflow == 'visible'){
8436              animationDistFactorDefault = 150;
8437              animationDurationDefault   = 600;
8438              animationEasingDefault     = 'wEaseOut';                
8439              jQuery('.wLightboxInner').css({'overflow' : 'visible'});
8440            }
8441
8442            var lightboxImageNew = jQuery('.wLightboxImage').attr('id', 'wLightboxImageCurrent').clone();
8443            var widthBefore      = widthImageBefore > 0 ?  widthImageBefore  : jQuery('#wLightboxImageCurrent').width();
8444            var heightBefore     = heightImageBefore > 0 ? heightImageBefore : jQuery('#wLightboxImageCurrent').height();
8445                        
8446            var diffMarginLeft = String(-diffWidthInner / 2) + 'px';
8447            var diffMarginTop  = String(-diffHeightInner / 2) + 'px';
8448            
8449            if(widthInnerBefore > widthInnerCurrent + 1){
8450              animationDistFactorOut = animationDistFactorOut * widthInnerBefore / widthInnerCurrent; 
8451            }
8452            
8453            var marginLeftInit       = String(animationDistFactorIn) + '%';
8454            var marginLeftCurrentOut = '-' + String(animationDistFactorOut) + '%';
8455            
8456            if(animation == 'slidefromright'){
8457              marginLeftInit       = 'calc(' + String(animationDistFactorIn) + '% + ' + String(diffWidthInner / 2) + 'px)';
8458            }
8459            else{
8460              marginLeftInit       = 'calc(-' + String(animationDistFactorIn) + '% ' + ' - ' + ' ' + String(diffWidthInner / 2) + 'px)';
8461            }
8462                        
8463            lightboxImageNew.attr('id', 'wLightboxImageNew').attr('src', src).attr('alt', alt).css({'margin-left' : marginLeftInit}).insertBefore("#wLightboxImageCurrent");            
8464            var heightNew  = lightboxImageNew.height();
8465            var leftCurrent = diffMarginLeft;
8466            var topCurrent  = diffMarginTop;
8467            jQuery('#wLightboxImageCurrent').css({position : 'absolute', width : widthBefore, height : heightBefore, top : topCurrent, 'margin-left' : leftCurrent, 'max-height' : 'none', 'max-width' : 'none'});
8468            jQuery('#wLightboxImageCurrent').animate({'left': (animation == 'slidefromright' ? marginLeftCurrentOut : String(animationDistFactorOut) + '%')}, {duration : animationDurationIn, easing : animationEasingIn, complete : function(){
8469              jQuery('.wLightboxInner').data('entryactive', '');
8470              jQuery('#wLightboxImageNew').attr('id', '');
8471              jQuery('#wLightboxImageCurrent').remove();
8472            }});
8473            lightboxImageNew.animate({'margin-left': '0'}, {duration : animationDurationOut, easing : animationEasingOut, complete : function(){}});
8474          }            
8475          else{
8476            jQuery('.wLightboxImage').attr('src', src);
8477          }  
8478        }
8479        else{
8480          
8481          var animation        = wLightboxVariants[options['variant']]['animation'] ? wLightboxVariants[options['variant']]['animation'].toLowerCase() : '';          
8482          var allowTouchSlide  = false;
8483
8484          if(animation == 'slidefrombeside' || animation == 'slideout'){
8485            if(wLightboxVariants[options['variant']]['allowTouchSlide'] !== false){
8486              allowTouchSlide = true;
8487            }
8488          }
8489          else if(wLightboxVariants[options['variant']]['allowTouchSlide'] === true){
8490            allowTouchSlide = true;
8491          }
8492          
8493          if(allowTouchSlide){
8494
8495            var sl  = jQuery('.wLightboxOuter');
8496            var slI = jQuery('.wLightboxInner');
8497
8498            slI.on('touchstart', function(event){
8499              wUiTmp['sltsx'] = typeof(event.originalEvent.touches) != 'undefined' ? event.originalEvent.touches[0].pageX : event.pageX;
8500              wUiTmp['sltsy'] = (typeof(event.originalEvent.touches) != 'undefined' ? event.originalEvent.touches[0].pageY : event.pageY) - jQuery(window).scrollTop();
8501            });
8502
8503            slI.on('touchmove', function(event){
8504              if(!isNaN(wUiTmp['sltsx']) && !isNaN(wUiTmp['sltsy']) && wUiTmp['sltsx'] && wUiTmp['sltsy']){
8505                wUiTmp['sltsxc'] = typeof(event.originalEvent.touches) != 'undefined' ? event.originalEvent.touches[0].pageX : event.pageX;
8506                wUiTmp['sltsyc'] = (typeof(event.originalEvent.touches) != 'undefined' ? event.originalEvent.touches[0].pageY : event.pageY) - jQuery(window).scrollTop();
8507                wUiTmp['sltdx']  = wUiTmp['sltsxc'] - wUiTmp['sltsx'];
8508                wUiTmp['sltdy']  = wUiTmp['sltsyc'] - wUiTmp['sltsy'];
8509                wUiTmp['sltdxp'] = Math.sqrt(Math.pow(parseInt(wUiTmp['sltdx']), 2));
8510                wUiTmp['sltdyp'] = Math.sqrt(Math.pow(parseInt(wUiTmp['sltdy']), 2));
8511
8512                if(sl.attr('data-moving') != '1' && wUiTmp['sltdxp'] > 10 && wUiTmp['sltdxp'] / wUiTmp['sltdyp'] > 1.4){
8513                  if(wUiTmp['sltdx'] > 0){
8514                    wUiTmp['sltsx'] = null;
8515                    wUiTmp['sltsy'] = null;
8516                    jQuery('.wLightboxMoverBackAvailable').trigger('click');
8517                  }
8518                  else if(wUiTmp['sltdx'] < 0){
8519                    wUiTmp['sltsx'] = null;
8520                    wUiTmp['sltsy'] = null;
8521                    jQuery('.wLightboxMoverForwardAvailable').trigger('click');
8522                  }  
8523                }
8524              }
8525            });
8526
8527            slI.on('touchend', function(event){
8528              wUiTmp['sltsx'] = null;
8529              wUiTmp['sltsy'] = null;
8530            });
8531          }  
8532          jQuery('.wLightboxOuter, .wLightboxBackground').on('click touchend', function(event){
8533            if(jQuery(event.target).hasClass('wLightboxBackground') && options['closeOnClickBackground'] === false){
8534              return false;
8535            }            
8536            wLightboxClose(event);
8537          });
8538          jQuery('.wLightboxInner').on('click touchend', function(event){
8539            event.stopPropagation();
8540          });           
8541          jQuery('.wLightboxMoverBack, .wLightboxMoverForward').on('click', function(event){
8542            var lastDirection = event.target.closest('.wLightboxMoverBack') ? 'back' : 'next';    
8543            
8544            jQuery('.wLightbox').attr('data-lastdirection', lastDirection);
8545            
8546            jQuery('.wLightbox').removeClass('wLightboxStatusLoaded').addClass('wLightboxStatusLoading');
8547
8548            if(event.originalEvent && event.originalEvent.isTrusted){
8549              if(jQuery('.wLightboxPlayer').length != 0 && jQuery('#wLightbox').attr('data-playerstatus') == 'play'){
8550                jQuery('.wLightboxPlayer').trigger('click');
8551              }
8552
8553              if(elementsRel[jQuery('.wLightboxMoverForward').data('entry') + 1]){
8554                var imgPreload = new Image();
8555                imgPreload.src = elementsRel[jQuery('.wLightboxMoverForward').data('entry') + 1].getAttribute('data-src');
8556              }
8557            }
8558            jQuery(elementsRel[jQuery(this).data('entry')]).trigger('click');
8559            event.stopPropagation();
8560          });
8561        }
8562
8563        jQuery('.wLightbox').addClass('wLightboxStatusLoaded').removeClass('wLightboxStatusLoading').removeClass('wLightboxStatusChanging');
8564
8565        if(typeof(wOnAfterInitLightbox) === 'function'){
8566		  wOnAfterInitLightbox(objectCurrent, elementsRel);
8567        }
8568      }, 32);
8569    };
8570    image.src = src;
8571  }
8572  else if(lightboxType == 'video'){
8573    
8574    var videoWidth = 0, videoHeight = 0, videoRatio = 0;
8575
8576    if(elementCurrent && elementCurrent.getAttribute('title') && elementCurrent.getAttribute('title') != ''){
8577      jQuery('.wLightboxTitle').show().html(elementCurrent.getAttribute('title'));
8578    }
8579    else{
8580      jQuery('.wLightboxTitle').hide();
8581    }
8582
8583    if(objectCurrent && objectCurrent.attr('data-lightboxdownloadable') == '1'){
8584      jQuery('.wLightboxDownload').remove();
8585      jQuery('.wLightboxFooter').addClass('wLightboxFooterHasDownload').append('<div class="wLightboxDownload" data-src="' + src + '" title="Download"></div>');
8586      jQuery('.wLightboxDownload').on('click', function (event){
8587        window.open(jQuery(this).data('src'));
8588      });
8589    }
8590    else{
8591      jQuery('.wLightboxFooter').removeClass('wLightboxFooterHasDownload');
8592    }
8593
8594    var heightFooter = jQuery('.wLightboxFooter').outerHeight();
8595
8596    var maxWidthBox  = (window.innerWidth ? window.innerWidth : (document.documentElement ? document.documentElement.offsetWidth : document.body.clientWidth))    - (parseInt(j
8596Query('.wLightboxOuter').css('padding-left')) + parseInt(jQuery('.wLightboxInner').css('border-left-width'))) * 2;
8597    var maxHeightBox = (window.innerHeight ? window.innerHeight : (document.documentElement ? document.documentElement.offsetHeight : document.body.clientHeight)) - (parseInt(jQuery('.wLightboxOuter').css('padding-top')) + parseInt(jQuery('.wLightboxInner').css('border-top-width'))) * 2 - heightFooter;
8598
8599    if(/^(\d+)px$/.test(options['width'])){
8600      maxWidthBox = parseInt(RegExp.$1);
8601    }
8602    else if(/^(\d+)%$/.test(options['width'])){
8603      maxWidthBox = parseInt(jQuery(window).width()) * RegExp.$1 / 100;
8604    }
8605
8606    var pageRatio    = maxWidthBox / maxHeightBox;
8607
8608    if(boxWasOpened){
8609      jQuery('.wLightbox source').attr('src', src);
8610      jQuery('.wLightbox video').get(0).load();
8611    }  
8612    
8613    jQuery('.wLightbox video').on('loadedmetadata', function(event){
8614      videoWidth     = jQuery(this).get(0).videoWidth;
8615      videoHeight    = jQuery(this).get(0).videoHeight;
8616
8617      videoRatio     = videoWidth / videoHeight;
8618      lightboxWidth  = videoWidth;
8619      lightboxHeight = videoHeight;
8620
8621      if(videoWidth > maxWidthBox || videoHeight > maxHeightBox){
8622        if(videoRatio > pageRatio){
8623          lightboxWidth  = maxWidthBox;
8624          lightboxHeight = Math.round(maxWidthBox / videoRatio) + heightFooter;
8625        }
8626        else if(videoHeight > maxHeightBox){
8627          lightboxHeight = maxHeightBox - 32;
8628          lightboxWidth  = Math.round(lightboxHeight * videoRatio);
8629        }
8630        else{
8631          lightboxWidth  = Math.round(maxHeightBox * videoRatio);
8632          lightboxHeight = maxHeightBox + heightFooter;
8633        }
8634      }
8635      else{
8636        lightboxHeight = lightboxHeight + heightFooter;
8637      }
8638
8639      widthAttrib  = String(lightboxWidth)  + 'px';
8640      heightAttrib = String(lightboxHeight) + 'px';
8641
8642      jQuery('.wLightboxInner').css({'height' : heightAttrib});
8643      jQuery('.wLightboxInner').css({'width' : widthAttrib});
8644
8645      jQuery('.wLightboxMoverBack').data('entry', positionRel - 2);
8646      jQuery('.wLightboxMoverForward').data('entry', positionRel);
8647
8648      if(boxWasOpened){
8649        jQuery('.wLightboxMoverBack').attr('class', classPrev);
8650        jQuery('.wLightboxMoverForward').attr('class', classNext);
8651        jQuery('.wLightbox').addClass('wLightboxStatusLoaded').removeClass('wLightboxStatusLoading');      
8652      }
8653      else{
8654        jQuery('.wLightbox').addClass('wLightboxStatusLoaded').removeClass('wLightboxStatusLoading');      
8655        jQuery('.wLightboxOuter, .wLightboxBackground').on('click touchend', function(event){
8656          if(jQuery(event.target).hasClass('wLightboxBackground') && options['closeOnClickBackground'] === false){
8657            return false;
8658          }          
8659          wLightboxClose(event);
8660        });
8661        jQuery('.wLightboxInner').on('click touchend', function(event){
8662          event.stopPropagation();
8663        });         
8664        jQuery('.wLightboxMoverBack, .wLightboxMoverForward').on('click', function(event){   
8665          jQuery('.wLightbox').removeClass('wLightboxStatusLoaded').addClass('wLightboxStatusLoading');
8666          jQuery(elementsRel[jQuery(this).data('entry')]).trigger('click');
8667          event.stopPropagation();
8668        });
8669      }          
8670    });
8671    if(typeof(wOnAfterInitLightbox) === 'function'){
8672      wOnAfterInitLightbox();
8673    }
8674  }
8675  else{
8676
8677    var heightTitle = 0;
8678
8679    if(elementCurrent && elementCurrent.getAttribute('title') != ''){
8680      jQuery('.wLightboxTitle').show().html(elementCurrent.getAttribute('title'));
8681    }
8682    else{
8683      jQuery('.wLightboxTitle').hide();
8684    }
8685
8686    heightTitle = jQuery('.wLightboxTitle').outerHeight();
8687
8688    var setSize = false;
8689
8690    var maxWidthBox  = (window.innerWidth ? window.innerWidth : (document.documentElement ? document.documentElement.offsetWidth : document.body.clientWidth))    - (parseInt(jQuery('.wLightboxOuter').css('padding-left')) + parseInt(jQuery('.wLightboxInner').css('border-left-width'))) * 2;
8691    var maxHeightBox = (window.innerHeight ? window.innerHeight : (document.documentElement ? document.documentElement.offsetHeight : document.body.clientHeight)) - (parseInt(j
8691Query('.wLightboxOuter').css('padding-top')) + parseInt(jQuery('.wLightboxInner').css('border-top-width'))) * 2 - heightTitle;
8692
8693    if(/^(\d+)px$/.test(options['width'])){
8694      maxWidthBox = parseInt(RegExp.$1);
8695      setSize = true;
8696    }
8697    else if(/^(\d+)%$/.test(options['width'])){
8698      maxWidthBox = parseInt(jQuery(window).width()) * RegExp.$1 / 100;
8699      setSize = true;
8700    }
8701
8702    if(/^(\d+)px$/.test(options['height'])){
8703      maxHeightBox = parseInt(RegExp.$1);
8704      setSize = true;
8705    }
8706    else if(/^(\d+)%$/.test(options['height'])){
8707      maxHeightBox = parseInt(jQuery(window).height()) * RegExp.$1 / 100;
8708      setSize = true;
8709    }
8710
8711    if(options['width'] && /^\d+(.\d+)?$/.test(options['width'])){
8712      contentWidth = options['width'];
8713      setSize = true;
8714    }
8715    else{
8716      contentWidth = maxWidthBox;
8717    }
8718
8719    if(options['height'] && /^\d+(.\d+)?$/.test(options['height'])){
8720      contentHeight = options['height'];
8721      setSize = true;
8722    }
8723    else{
8724      contentHeight = maxHeightBox;
8725    }
8726
8727    if(setSize){
8728      var pageRatio    = maxWidthBox / maxHeightBox;
8729      var contentRatio = contentWidth / contentHeight;
8730
8731      var lightboxWidth  = contentWidth;
8732      var lightboxHeight = contentHeight + heightTitle;
8733
8734      if(contentWidth > maxWidthBox || contentHeight > maxHeightBox){
8735        if(contentRatio > pageRatio){
8736          lightboxWidth  = maxWidthBox;
8737          lightboxHeight = Math.round(maxWidthBox / contentRatio) + heightTitle;
8738        }
8739        else{
8740          lightboxWidth  = Math.round(maxHeightBox * contentRatio);
8741          lightboxHeight = maxHeightBox + heightTitle;
8742        }
8743      }
8744
8745      widthAttrib  = String(lightboxWidth) + 'px';
8746      heightAttrib = String(lightboxHeight) + 'px';
8747
8748      jQuery('.wLightboxInner').css({'height' : heightAttrib});
8749      jQuery('.wLightboxInner').css({'width' : widthAttrib});
8750    }
8751
8752    jQuery('.wLightboxMoverBack').data('entry', positionRel - 2);
8753    jQuery('.wLightboxMoverForward').data('entry', positionRel);
8754        
8755    if(boxWasOpened){
8756      jQuery('.wLightboxMoverBack').attr('class', classPrev);
8757      jQuery('.wLightboxMoverForward').attr('class', classNext);
8758      jQuery('.wLightboxIframe').attr('src', src);
8759    }
8760    else{
8761      jQuery('.wLightboxOuter, .wLightboxBackground').on('click touchend', function(event){
8762        if(jQuery(event.target).hasClass('wLightboxBackground') && options['closeOnClickBackground'] === false){
8763          return false;
8764        }        
8765        wLightboxClose(event);
8766      });
8767      jQuery('.wLightboxInner').on('click touchend', function(event){
8768        event.stopPropagation();
8769      });       
8770      jQuery('.wLightboxMoverBack, .wLightboxMoverForward').on('click', function(event){
8771        jQuery('.wLightbox').removeClass('wLightboxStatusLoaded').addClass('wLightboxStatusLoading');
8772        jQuery(elementsRel[jQuery(this).data('entry')]).trigger('click');
8773        event.stopPropagation();
8774      });
8775    }    
8776
8777    jQuery('.wLightbox').addClass('wLightboxStatusLoaded').removeClass('wLightboxStatusLoading').removeClass('wLightboxStatusChanging');
8778
8779    if(typeof(wOnAfterInitLightbox) === 'function'){
8780      wOnAfterInitLightbox();
8781    }
8782  }
8783  
8784  if(typeof(wOnAfterInitLightbox) === 'function'){
8785    wOnAfterInitLightbox();
8786  }
8787  jQuery('html').addClass('wglBox');  
8788  jQuery('body').addClass('wglBox');
8789  
8790  /*Barrierefreiheit  Lightbox*/
8791  if(typeof(wAccessibility) !== 'undefined' && wAccessibility['accessEventHandler'] != null && wAccessibility['accessEventHandler'].active && (lightboxType == 'iframe' || lightboxType == 'image' || lightboxType == 'video')){
8792    aEKey = (lightboxType == 'iframe') ? 'wLightboxIframe' : (lightboxType == 'video' ? 'wLightboxVideo' : 'wLightbox');
8793    var aEObject = Object.assign({}, wAccessEvents[aEKey], {
8794      element: jQuery('html.wglBox'),
8795      elementsRel: elementsRel,
8796      openedByElement: objectCurrent,
8797    });
8798    wAccessHandler.addEvent(aEObject);
8799  }
8800  else{
8801    jQuery('.wLightboxCloser, .wLightboxMoverBack, .wLightboxMoverForward').attr('tabindex', 0);
8802    lE.attr('tabindex', 0).focus();
8803
8804    jQuery('html.wglBox').on('keydown', function(e){
8805
8806      var lE = jQuery('.wLightbox');
8807      var cE = jQuery(e.target);
8808      var last = lE.find('[role=button]:visible:last');
8809      var move = '';
8810      var moveObject = { next : jQuery('.wLightboxMoverForward'), back : jQuery('.wLightboxMoverBack')};
8811
8812      if(e.keyCode == 9 && (!jQuery(lE).is('#wLightbox') || !jQuery(cE).is('#wLightbox *') || last.length > 0 && cE.get(0) === last.get(0))){
8813        lE.attr('tabindex', 0).focus();
8814      }
8815      else if(e.keyCode == 39 || e.keyCode == 13 && cE.is('.wLightboxMoverForward')){ 
8816        move = 'next';
8817      }
8818      else if(e.keyCode == 37 || e.keyCode == 13 && cE.is('.wLightboxMoverBack')){ 
8819        move = 'back';
8820      }
8821      else if(e.keyCode == 27 || e.keyCode == 13 && cE.is('.wLightboxCloser')){
8822        wLightboxClose(event);
8823      }
8824
8825      if(move != ''){
8826        jQuery(elementsRel[parseInt(moveObject[move].data('entry'))]).trigger('click');
8827        lE.attr('data-lastdirection', move);
8828        moveObject[move].focus();
8829      }   
8830      e.stopPropagation();
8831      e.stopImmediatePropagation();
8832
8833    });
8834  }
8835  return false;
8836};
8837
8838wLightboxClose = function(event){
8839  
8840  if(typeof event !== 'undefined'){
8841    event.preventDefault();
8842    event.stopPropagation();
8843  }
8844
8845  if(typeof(wOnBeforeCloseLightbox) === 'function'){
8846    if(wOnBeforeCloseLightbox(event) == false) {
8847      return;
8848    }
8849  }
8850  var lE = jQuery('.wLightbox');
8851  if(lE.length === 0){
8852    return false;
8853  }
8854  var triggeredO = jQuery('html picture[data-src^="' + lE.attr('data-src').split('?')[0] + '"]');
8855  if(triggeredO.length == 1) triggeredO.get(0).focus();
8856  lE.remove();
8857  jQuery('html').removeClass('wglBox');    
8858  jQuery('body').removeClass('wglBox');
8859  jQuery(document).off('keydown');
8860  
8861  if(typeof intervallLightboxPlayer != 'undefined'){
8862    window.clearInterval(intervallLightboxPlayer);
8863  }
8864  
8865  if(typeof(wOnAfterCloseLightbox) === 'function'){
8866    wOnAfterCloseLightbox(event);
8867  }    
8868};
8869
8870wStartReadingText = function(element, readerPanelEmbed, options){
8871  //console.log('wStartReadingText');
8872    
8873  var tmp = '';  
8874  var options = options || {};
8875  
8876  var elementsAll   = document.querySelectorAll('*[data-hasconsideredreader="1"]');
8877  for(var i = 0; i < elementsAll.length; i++){
8878    elementsAll[i].removeAttribute('data-hasconsideredreader');
8879  }  
8880  
8881  if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wReaderPanelEmbed') != -1){
8882    readerPanelEmbed.className = 'wReaderPanelEmbed isReading';
8883  }
8884  else if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wAiReader') != -1){
8885    readerPanelEmbed.className = 'wAiReader isReading';
8886    jQuery('.wAiReader .wAiReaderPauseReading').focus();
8887  }  
8888  
8889  jQuery('html').addClass('isReading');
8890 
8891  var elementToReadRoot   = element;   
8892  var textOfElementToRead = '';  
8893  var elementsToReadAll   = elementToReadRoot.querySelectorAll('*');
8894
8895  for(var i = elementsToReadAll.length - 1; i >= 0; i--){
8896    tmp = elementsToReadAll[i];
8897    if(!(tmp.offsetWidth || tmp.offsetHeight || tmp.getClientRects().length)){
8898      tmp.setAttribute('data-ignoreinreader', '1');
8899    }
8900    if(tmp.elementName == 'SUP'){
8901      tmp.setAttribute('data-unwrapinreader', '1'); 
8902    }
8903    if(tmp.className && typeof tmp.className === 'string' && tmp.className.indexOf('wglButton') !== -1){
8904      tmp.setAttribute('data-ignoreinreader', '1'); 
8905    }
8906  }
8907
8908  //var textToRead = (elementToReadRoot.getAttribute('data-readertextpre') ? elementToReadRoot.getAttribute('data-readertextpre') : '') + textOfElementToRead;
8909
8910  var elementsToReadAll = elementToReadRoot.querySelectorAll('*');
8911  var elementsToRead    = [];
8912  for(var i = 0; i < elementsToReadAll.length; i++){
8913    tmp = elementsToReadAll[i];
8914    var hasTextNodes = 0;
8915    for(var j = 0; j < tmp.childNodes.length; j++){
8916      if(tmp.childNodes[j].nodeType == 3){
8917        hasTextNodes = 1;
8918        break;
8919      }
8920    }
8921    if(/(wglButton)/.test(tmp.className)){      
8922    }
8923    else if(/(elementSection|elementBox|elementContainer|sectionInner|elementList|listDefault|listEntryInner)/.test(tmp.className)){      
8924    }    
8925    else if(tmp.firstChild && /(element)/.test(tmp.firstChild.className)){
8926    }
8927    else if(tmp.firstChild && tmp.firstChild == tmp.lastChild && tmp.firstChild.nodeType === 1){
8928    }   
8929    else if(tmp.nodeName == 'FIGURE' && !tmp.closest('*[data-hasconsideredreader="1"]') && tmp.getAttribute('data-ignoreinreader') != '1'){
8930      if(jQuery(tmp).find('figcaption').length !== 0){
8931        elementsToRead.push(jQuery(tmp).find('figcaption').get(0)); 
8932      }
8933      else{
8934        elementsToRead.push(tmp);         
8935      }
8936    }       
8937    else if(tmp.nodeName == 'IMG' && !tmp.closest('*[data-hasconsideredreader="1"]') && tmp.getAttribute('data-ignoreinreader') != '1'){
8938      elementsToRead.push(tmp); 
8939    }     
8940    else if(hasTextNodes && !tmp.closest('*[data-hasconsideredreader="1"]') && tmp.getAttribute('data-ignoreinreader') != '1'){
8941      elementsToRead.push(tmp);
8942      tmp.setAttribute('data-hasconsideredreader', '1');      
8943    }
8944  }   
8945    
8946  for(var i = 0; i < elementsToRead.length; i++){  
8947    if(!jQuery(elementsToRead[i]).attr('data-read-pos')){
8948      jQuery(elementsToRead[i]).on('click', function(){
8949        wReadTextElementPos(jQuery(this).attr('data-read-pos'));
8950      });
8951    }  
8952    jQuery(elementsToRead[i]).addClass('wglElementCanBeRead').attr('data-read-pos', String(i));    
8953  }  
8954    
8955  wUiTmp['readerPanelEmbed']    = readerPanelEmbed;
8956  wUiTmp['elementsToReadStack'] = elementsToRead; 
8957
8958  //for(var i = elementsToReadAll.length - 1; i >= 0; i--){
8959  //  tmp = elementsToReadAll[i];
8960  //}      
8961  
8962  wUiTmp['elementsToReadStackOptions'] = options;
8963  
8964  wReadTextElementNext();
8965};
8966
8967wReadTextElementPos = function(position){
8968  //console.log('wReadTextElementPos(' + position + ')');    
8969  
8970  readerPanelEmbed = wUiTmp['readerPanelEmbed'];  
8971  
8972  if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wReaderPanelEmbed') != -1){
8973    readerPanelEmbed.className = 'wReaderPanelEmbed isReading';
8974  }
8975  else if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wAiReader') != -1){
8976    readerPanelEmbed.className = 'wAiReader isReading';
8977    jQuery('.wAiReader .wAiReaderPauseReading').focus();
8978  }    
8979  
8980  jQuery('.wglElementIsBeingRead').removeClass('wglElementIsBeingRead');  
8981  
8982  if(wUiTmp['elementsToReadStack']){
8983    var options = wUiTmp['elementsToReadStackOptions'];
8984
8985    wUiTmp['elementsToReadStackPosition'] = parseInt(position);
8986
8987    if(wUiTmp['elementsToReadStackPosition'] < wUiTmp['elementsToReadStack'].length){
8988      jQuery('.wglTextIsBeingRead').removeClass('wglTextIsBeingRead');
8989      
8990      if(window.speechSynthesis && window.speechSynthesis.speaking){  
8991        window.speechSynthesis.cancel();
8992      }      
8993      wUiTmp['forceElementReader'] = true;
8994      window.setTimeout(function(){
8995        wUiTmp['forceElementReader'] = false;
8996        wReadTextOfElement(wUiTmp['elementsToReadStack'][wUiTmp['elementsToReadStackPosition']], options);        
8997      }, 800);
8998    }
8999  }
9000};
9001
9002wReadTextElementNext = function(){
9003  //console.log('wReadTextElementNext');
9004  
9005  jQuery('.wglElementIsBeingRead').removeClass('wglElementIsBeingRead');  
9006  
9007  if(wUiTmp['elementsToReadStack']){
9008    var options = wUiTmp['elementsToReadStackOptions'];
9009    
9010    if(window.speechSynthesis && window.speechSynthesis.paused){
9011    }
9012    else{
9013      wUiTmp['elementsToReadStackPosition'] = wUiTmp['elementsToReadStackPosition'] >= 0 ? wUiTmp['elementsToReadStackPosition'] + 1 : 0;
9014    }
9015    if(wUiTmp['elementsToReadStackPosition'] < wUiTmp['elementsToReadStack'].length){
9016      wReadTextOfElement(wUiTmp['elementsToReadStack'][wUiTmp['elementsToReadStackPosition']], options);        
9017    }
9018    else{      
9019      wUiTmp['elementsToReadStack']         = null;
9020      wUiTmp['elementsToReadStackPosition'] = -1;
9021      jQuery('.wglElementCanBeRead').removeClass('wglElementCanBeRead');        
9022      
9023      readerPanelEmbed = wUiTmp['readerPanelEmbed'];
9024      
9025      if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wReaderPanelEmbed') != -1){
9026        readerPanelEmbed.className = 'wReaderPanelEmbed';
9027      } 
9028      else if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wAiReader') != -1){
9029        readerPanelEmbed.className = 'wAiReader';
9030        jQuery('.wAiReader .wAiReaderStartReading').focus();    
9031      }          
9032    }
9033  }
9034};
9035
9036wReadTextOfElement = function(element, options){  
9037  //console.log(element);
9038  
9039  var textOfElementToRead = '';  
9040  var elementToRead       = element.cloneNode(true);
9041  var lastElementToReadType = '';
9042  
9043  wUiTmp['lastElementToReadType'] = wUiTmp['lastElementToReadType'] ?? '';
9044  wUiTmp['lastElementToReadText'] = wUiTmp['lastElementToReadText'] ?? '';
9045  
9046  if(elementToRead.getAttribute('data-ignoreinreader') == '1'){
9047    //console.log('ignore');
9048  }
9049  //else if(element.closest('*[data-hasconsideredreader="1"]')){
9050    //console.log(element);
9051  //}
9052  else if(elementToRead.nodeName == 'IMG'){
9053    var documentLang = document.documentElement.lang.toLowerCase();    
9054    documentLang = /^\w+$/.test(documentLang) ? documentLang + '-' + documentLang : documentLang;
9055    textOfElementToRead = (documentLang.substr(0, 2) == 'de' ? 'Bild: ' : '') + elementToRead.getAttribute('alt');
9056    lastElementToReadType = 'img';
9057  }  
9058  else{    
9059    textOfElementToRead = elementToRead.innerHTML; 
9060    lastElementToReadType = 'element';
9061
9062    var strArray = textOfElementToRead.split(/<script[^>]*>/);
9063    if(strArray.length > 1){
9064      var tmp = '';
9065      for(var i = 0; i < strArray.length; i++){
9066        //console.log(strArray[i].length);
9067        strArray[i] = strArray[i].replace(/[\s\S]*<\/script[^>]*>/, '');
9068        tmp += strArray[i];
9069      }    
9070      textOfElementToRead = tmp;       
9071    }    
9072    
9073    textOfElementToRead = textOfElementToRead.replace(/<sup>(®|©|™)<\/sup>/gi, ""); 
9074    textOfElementToRead = textOfElementToRead.replace(/<img[^>]*alt="([^"]+)"[^>]*>/gi, "<p>\n$1\n</p>"); 
9075    textOfElementToRead = textOfElementToRead.replace(/<\/?sup>/gi, "");     
9076    textOfElementToRead = textOfElementToRead.replace(/\n/gi, " ");   
9077    textOfElementToRead = textOfElementToRead.replace(/&amp;/gi, "&");     
9078    textOfElementToRead = textOfElementToRead.replace(/&(nbsp|lt|gt|quot|apos);/gi, " ");     
9079    textOfElementToRead = textOfElementToRead.replace(/ +/gi, " ");
9080    textOfElementToRead = textOfElementToRead.replace(/<\/p>/gi, "\n\n"); 
9081    textOfElementToRead = textOfElementToRead.replace(/(<div[^>]*class="element)/gi, "\n$1");     
9082    textOfElementToRead = textOfElementToRead.replace(/<\/div>/gi, "\n");      
9083    textOfElementToRead = textOfElementToRead.replace(/<[^>]*>/g, " ");
9084    textOfElementToRead = textOfElementToRead.replace(/ +/gi, " "); 
9085    textOfElementToRead = textOfElementToRead.replace(/\n\s+\n/gi, "\n\n");  
9086    textOfElementToRead = textOfElementToRead.replace(/\n +/gi, "\n");     
9087
9088    textOfElementToRead = textOfElementToRead.trim();
9089  }
9090  
9091  //console.log(textOfElementToRead);
9092    
9093  if(wUiTmp['lastElementToReadType'] === 'img'){
9094    if(wUiTmp['lastElementToReadText'].replace(/^\w+\:/, '').trim() === textOfElementToRead.trim()){
9095      textOfElementToRead = '';
9096    }
9097  }
9098    
9099  wUiTmp['lastElementToReadType'] = lastElementToReadType;  
9100  wUiTmp['lastElementToReadText'] = textOfElementToRead;
9101  
9102  if(textOfElementToRead != ''){
9103    jQuery(element).addClass('wglElementIsBeingRead');
9104    var scrollTopOffset = 80;
9105    var winHeight       = window.innerHeight;
9106    var elementHeight   = jQuery(element).height();
9107    if(winHeight > 640){
9108      if(winHeight > elementHeight + 160){
9109        scrollTopOffset = parseInt((winHeight - elementHeight) / 2);
9110      }
9111    }
9112    wScrollSmoothToElement(element, {'scrollTopOffset' : scrollTopOffset});
9113    wReadText(textOfElementToRead, options);    
9114  }
9115  else{
9116    if(wUiTmp['elementsToReadStack'].length > wUiTmp['elementsToReadStackPosition'] - 1){
9117      if(!wUiTmp['forceElementReader']){
9118        wReadTextElementNext();
9119      }
9120    }
9121  }
9122};
9123
9124wReadText = function(textToRead, options){
9125  //console.log(textToRead);
9126  
9127  if(window.speechSynthesis){
9128    if(!window.speechSynthesis.speaking){  
9129      var textToSpeak = new SpeechSynthesisUtterance(textToRead);
9130      if(options['rate']){
9131        textToSpeak.rate = options['rate'];
9132      }
9133      
9134      var documentLang = document.documentElement.lang;
9135      if(documentLang != ''){
9136        documentLang = /^\w+$/.test(documentLang) ? documentLang + '-' + documentLang : documentLang.toLowerCase();
9137        documentLang = documentLang.replace('en-en', 'en-us');
9138        textToSpeak.lang = documentLang;
9139                
9140        var synth = window.speechSynthesis;
9141        var voices = synth.getVoices();
9142
9143        for(var i = 0; i < voices.length; i++){
9144          if(documentLang == voices[i].lang.toLowerCase() && !/(synthesis|eloquence)/.test(voices[i].voiceURI)){
9145            //console.log(voices[i].voiceURI);
9146            textToSpeak.voice = voices[i];
9147            textToSpeak.lang = voices[i].lang;
9148            break;
9149          }
9150        }
9151      }
9152      
9153      textToSpeak.onend = function(event){
9154        window.setTimeout(function(){
9155          if(!wUiTmp['forceElementReader']){
9156            wReadTextElementNext();
9157          }
9158        }, 300);
9159      };      
9160      
9161      window.speechSynthesis.speak(textToSpeak);
9162    }  
9163    else if(window.speechSynthesis.paused){  
9164      window.speechSynthesis.resume();
9165    }  
9166  } 
9167  else{
9168    alert('Die Vorlesefunktion wird von Ihrem Browser leider nicht unterstützt!');
9169  }
9170};
9171
9172wPauseReadingText = function(element, readerPanelEmbed){
9173  
9174  if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wReaderPanelEmbed') != -1){
9175    readerPanelEmbed.className = 'wReaderPanelEmbed pauseReading';
9176  }  
9177  else if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wAiReader') != -1){
9178    readerPanelEmbed.className = 'wAiReader pauseReading';
9179    jQuery('.wAiReader .wAiReaderStartReading').focus();    
9180  }  
9181  
9182  jQuery('html').addClass('pauseReading');  
9183  
9184  if(window.speechSynthesis){
9185    window.speechSynthesis.pause();
9186  }
9187};
9188
9189wStopReadingText = function(element, readerPanelEmbed){
9190  
9191  if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wReaderPanelEmbed') != -1){
9192    readerPanelEmbed.className = 'wReaderPanelEmbed';
9193  } 
9194  else if(readerPanelEmbed && readerPanelEmbed.className.indexOf('wAiReader') != -1){
9195    readerPanelEmbed.className = 'wAiReader';
9196    jQuery('.wAiReader .wAiReaderStartReading').focus();    
9197  }    
9198  
9199  jQuery('.wglTextIsBeingRead').removeClass('wglTextIsBeingRead');
9200  jQuery('.wglElementCanBeRead').removeClass('wglElementCanBeRead'); 
9201  
9202  jQuery('html').removeClass('isReading').removeClass('pauseReading');    
9203  
9204  if(window.speechSynthesis && window.speechSynthesis.speaking){     
9205    window.speechSynthesis.cancel();
9206  }
9207  
9208  wUiTmp['elementsToReadStack']         = null;
9209  wUiTmp['elementsToReadStackPosition'] = -1;
9210};
9211
9212var rwids = {};
9213
9214jQuery(window).on('load', function(){
9215
9216  if(location.search.indexOf('wContentToDisplay=draft') != -1){
9217    return;
9218  }
9219
9220  if(typeof wDoNotFeedbackImageSizes !== 'undefined' && wDoNotFeedbackImageSizes){
9221
9222  }
9223  else if(typeof(wBrowseEditMode) == 'undefined'){
9224    
9225    var elementSizesStr = '';
9226    var simulationWidth = 0;
9227    var winWidth        = wUiTmp['lastWindowWidth'] ?? jQuery(window).width();
9228    var winWidthSim     = '';
9229    var imageElement    = null;
9230    
9231    const groups = {};
9232
9233    jQuery('[data-htgr="1"][data-rwid]').each(function () {
9234     const rwid = this.dataset.rwid;
9235     (groups[rwid] = groups[rwid] || []).push(this);
9236    });
9237
9238    function getArea(el) {
9239     const rect = el.getBoundingClientRect();
9240     let w = rect.width;
9241     let h = rect.height;
9242
9243     if (!w || !h) {
9244       w = el.naturalWidth || parseInt(el.getAttribute('width'), 10) || 0;
9245       h = el.naturalHeight || parseInt(el.getAttribute('height'), 10) || 0;
9246     }
9247     return w * h;
9248    }
9249
9250    jQuery.each(groups, function (_, els) {
9251     if (els.length < 2) return;
9252
9253     let largest = els[0];
9254     let maxArea = getArea(largest);
9255
9256     for (let i = 1; i < els.length; i++) {
9257       const area = getArea(els[i]);
9258       if (area > maxArea) {
9259         maxArea = area;
9260         largest = els[i];
9261       }
9262     }
9263
9264     els.forEach(el => {
9265       if (el !== largest) el.setAttribute('data-htgr', '0');
9266     });
9267    });    
9268    
9269    jQuery('*[data-htgr="1"]').each(function(){
9270
9271      var i, sources = [], url = '', pathCSS = '', cssTags = null, mediaSizeType = ''; widthMedia = 0, minHeight = '', element = jQuery(this).get(0), rwid = '', elementWidth = 0, elementHeight = 0, pictureRatio = 0, outerElement = null, outerWidth = 0, breakpointRanges = {}, breakpoint;
9272      
9273      try{
9274        rwid = element.getAttribute('data-rwid');
9275        if(!rwids[rwid]){ 
9276          rwids[rwid] = true;
9277          sources = element.getElementsByTagName('source');
9278          
9279          wSimulationElementWidthOffest = typeof wSimulationElementWidthOffest != 'undefined' ? wSimulationElementWidthOffest : 0;          
9280          
9281          for(i = 0; i < sources.length; i++){
9282            if(/(min|max)-width\:\s*(\d+)px/.test(sources[i].getAttribute('media'))){
9283              mediaSizeType = RegExp.$1;
9284              widthMedia    = RegExp.$2;
9285              breakpointRanges[mediaSizeType + ' ' + widthMedia] = {};              
9286              if(mediaSizeType == 'max'){
9287                breakpointRanges[mediaSizeType + ' ' + widthMedia]['type'] = 'max';
9288                breakpointRanges[mediaSizeType + ' ' + widthMedia]['min'] = 0;
9289                breakpointRanges[mediaSizeType + ' ' + widthMedia]['max'] = parseInt(widthMedia);
9290              }
9291              else{
9292                breakpointRanges[mediaSizeType + ' ' + widthMedia]['type'] = 'min';                
9293                breakpointRanges[mediaSizeType + ' ' + widthMedia]['min'] = parseInt(widthMedia);  
9294              }
9295            }
9296          }
9297          
9298          for(i = 0; i < sources.length; i++){
9299            if(/(min|max)-width\:\s*(\d+)px/.test(sources[i].getAttribute('media'))){
9300              mediaSizeType = RegExp.$1;
9301              widthMedia    = RegExp.$2;
9302              smallestMin   = 16000;
9303              if(mediaSizeType == 'min'){
9304                for(key in breakpointRanges){
9305                  if(breakpointRanges[key]['min'] > widthMedia && breakpointRanges[key]['min'] < smallestMin){
9306                    smallestMin = breakpointRanges[key]['min'];
9307                  }
9308                }
9309                breakpointRanges['min ' + widthMedia]['max'] = parseInt(smallestMin) - 1;
9310              }
9311            }
9312          }   
9313          
9314          //console.log(breakpointRanges);
9315                    
9316          for(i = 0; i < sources.length; i++){
9317            if(sources[i].getAttribute('data-sp') && /(min|max)-width\:\s*(\d+)px/.test(sources[i].getAttribute('media'))){
9318              mediaSizeType = RegExp.$1;
9319              widthMedia    = RegExp.$2;
9320
9321              var breakpoint = breakpointRanges[mediaSizeType + ' ' + widthMedia];
9322              if(breakpoint && winWidth >= breakpoint['min'] && winWidth <= breakpoint['max']){
9323                
9324                simulationWidth = sources[i].getAttribute('data-sp');
9325                var hasMaxwidth = false;                
9326
9327                document.documentElement.style.maxWidth = 'none';
9328                document.documentElement.style.width    = String(simulationWidth) + 'px';                  
9329                document.body.style.maxWidth            = 'none';
9330                document.body.style.width               = String(simulationWidth) + 'px';
9331
9332                if(element.nodeName == 'PICTURE'){
9333                   imageElement = (element.getElementsByTagName('img'))[0];
9334
9335                  if(element.parentNode.nodeName == 'FIGURE' && document.defaultView.getComputedStyle(element.parentNode, null).getPropertyValue('display') == 'inline-block'){
9336                    boundingClientRect = imageElement.getBoundingClientRect();
9337                    elementWidth  = Math.ceil(boundingClientRect.width) + wSimulationElementWidthOffest;
9338                    elementHeight = Math.ceil(boundingClientRect.height);
9339                    elementRatio  = elementWidth / elementHeight;
9340                    outerElement  = element.parentNode.parentNode;
9341                    if(element.parentNode.parentNode.nodeName == 'A' && document.defaultView.getComputedStyle(element.parentNode.parentNode, null).getPropertyValue('display') == 'inline'){
9342                      outerElement  = element.parentNode.parentNode.parentNode;
9343                    }     
9344                    if(typeof(window.getComputedStyle(element.parentNode)['max-width']) !== 'undefined' && window.getComputedStyle(element.parentNode)['max-width'] !== '100%'){
9345                      hasMaxwidth = true;
9346                    }                     
9347                  }                
9348                  else{
9349                    boundingClientRect = imageElement.getBoundingClientRect();
9350                    elementWidth  = Math.ceil(boundingClientRect.width) + wSimulationElementWidthOffest;
9351                    elementHeight = Math.ceil(boundingClientRect.height);
9352                    elementRatio  = elementWidth / elementHeight;
9353                    outerElement  = element.parentNode;
9354                    if(typeof(window.getComputedStyle(element)['max-width']) !== 'undefined' && window.getComputedStyle(element)['max-width'] !== '100%'){                  
9355                      hasMaxwidth = true;
9356                    }                        
9357                  }
9358
9359                  if(imageElement.currentSrc){
9360                    if(document.defaultView.getComputedStyle(imageElement, null).getPropertyValue('object-fit') == 'cover'){
9361                      minHeight = elementHeight;
9362                    }
9363                  } 
9364                }
9365                else{
9366                  imageElement = element;                  
9367                  boundingClientRect = element.getBoundingClientRect();
9368                  elementWidth  = Math.ceil(boundingClientRect.width) + wSimulationElementWidthOffest;
9369                  elementHeight = Math.ceil(boundingClientRect.height);
9370                  outerElement  = element.parentNode.parentNode;                  
9371                }
9372                
9373                if(elementWidth < 8 && outerElement.offsetWidth < 16){
9374                  var hasHideIfViewport, anc = outerElement.parentNode, to = 32;
9375                  while(anc && anc.parentNode && to > 0){
9376                    if(anc.className.indexOf('hideIfViewport') != -1){  
9377                      to = 0;
9378                      hasHideIfViewport = true;
9379                      outerElement = anc.parentNode; 
9380                    }          
9381                    anc = anc.parentNode;
9382                    to--;
9383                  }
9384                  if(!hasHideIfViewport){
9385                    document.documentElement.style.maxWidth = '';
9386                    document.documentElement.style.width    = '';                    
9387                    document.body.style.maxWidth = '';
9388                    document.body.style.width    = '';
9389                    continue;
9390                  }
9391                }                
9392
9393                if(hasMaxwidth){
9394                }
9395                else if(outerElement.offsetWidth > elementWidth){
9396                  pictureRatio  = elementWidth / elementHeight;
9397                  elementWidth  = Math.ceil(outerElement.offsetWidth) + wSimulationElementWidthOffest;
9398                  elementHeight = elementWidth / pictureRatio;
9399                }             
9400                
9401                if(typeof wMaxWidthImages != 'undefined' && !isNaN(wMaxWidthImages) && wMaxWidthImages > 0 && elementWidth > wMaxWidthImages){
9402                  elementWidth = wMaxWidthImages;
9403                }
9404
9405                //console.log(imageElement.clone(true).getOwnPropertyNames());
9406                //console.log(imageElement.complete);
9407                if(elementWidth > 0 && elementHeight > 0){
9408                  winWidthSim = document.body.offsetWidth;
9409                  elementSizesStr += (elementSizesStr == '' ? '' : ';') + rwid + ':w' + elementWidth + ',h' + elementHeight + (minHeight != '' && !isNaN(minHeight) ? ',mh' + minHeight : '');
9410                  document.documentElement.style.maxWidth = '';
9411                  document.documentElement.style.width    = '';  
9412                  document.body.style.maxWidth = '';
9413                  document.body.style.width    = '';                                          
9414                  return;
9415                }
9416                document.documentElement.style.maxWidth = '';
9417                document.documentElement.style.width    = '';                    
9418                document.body.style.maxWidth = '';
9419                document.body.style.width    = '';
9420              }
9421            }
9422          }
9423        }
9424      }
9425      catch(e){
9426        document.documentElement.style.maxWidth = '';
9427        document.documentElement.style.width    = '';
9428        document.body.style.maxWidth = '';
9429        document.body.style.width    = '';        
9430      }
9431    });
9432    
9433    //console.log(elementSizesStr);
9434    
9435    if(elementSizesStr != '' && imageElement){
9436      cssTags         = jQuery("link[href*='/optimized/']");
9437      if(cssTags.length > 0){
9438        pathCSS = cssTags.get(0).getAttribute('href').replace(/\/optimized\/.*/, '') + '/design.css';      
9439         
9440        var variantCSS = jQuery('picture[data-htgr="1"]').attr('data-csn');
9441
9442        if(variantCSS && /^\w+$/.test(variantCSS)){
9443          pathCSS = pathCSS.replace(/\.css$/, '_var' + variantCSS + '.css');
9444        } 
9445
9446        var imgTmp = new Image();
9447        imgTmp.src = imageElement.src;
9448
9449        imgTmp.onload = function(){
9450          if(imgTmp.width > 0){
9451            url = '/weblication/grid5/scripts/wImage.php?path=' + pathCSS + '&referrer=' + encodeURIComponent(location.href.replace(/[\?\&]createImageRaster=1/, '')) + '&action=feedbackImageSizes&sw=' + simulationWidth + '&vw=' + winWidth + '(' + winWidthSim + ')' + '&sizes=' + elementSizesStr;
9452            jQuery.ajax({type: "GET", url: url, dataType: 'json', success: function(resultData){}});
9453          } 
9454        };
9455      }  
9456    }
9457  }
9458});
9459
9460wAddFieldsetMultiple = function (fs){
9461  
9462  var fs  = jQuery(fs);   
9463  var p   = fs.parent();  
9464  var a   = fs.closest('form').attr('action');
9465  var cfs = fs.clone();
9466    
9467  if(typeof(wOnBeforeAddFieldsetMultiple) == 'function'){
9468    var cfsTmp = wOnBeforeAddFieldsetMultiple(fs, cfs);
9469    if(cfsTmp !== undefined && cfsTmp !== null) {
9470      cfs = cfsTmp;
9471    }
9472  }     
9473  
9474  var ep  = cfs.attr('data-entrypos') ? parseInt(cfs.attr('data-entrypos')) + 1 : 1; 
9475  var nem = cfs.attr('data-numberentriesmax') ? parseInt(cfs.attr('data-numberentriesmax')) : 64; 
9476  var ai  = cfs.attr('data-updateindex') == '1'; 
9477  var ka  = cfs.attr('data-keepdataonadd') == '1'; 
9478  var n   = [];
9479  
9480  fs.find('input, select, textarea').each(function(i){
9481    if(jQuery(this).attr('name') != 'wFormToken'){    
9482      n.push(jQuery(this).attr('name').replace(/\-\d+(\[\])?$/, '$1'));
9483    }  
9484  });  
9485  
9486  n = [...new Set(n)];  
9487
9488  if(!ka){
9489    jQuery(cfs).find('input, select, textarea').each(function(i){
9490      if(jQuery(this).attr('name') == 'wFormToken'){    
9491        jQuery(this).remove();
9492      }
9493      else{ 
9494        var posNew = ai ? (Math.floor(Math.random() * (2000 - 1000 + 1)) + 1000) : ep
9495                  
9496        if(jQuery(this).attr('id') && jQuery(this).attr('id') != ''){
9497          jQuery(this).attr('id', (jQuery(this).attr('id').replace(/\-\d+(\[\])?$/, '$1') + '-' + posNew).replace(/(\[\])(\-\d)/, '$2$1'));
9498        }
9499        jQuery(this).attr('name', (jQuery(this).attr('name').replace(/\-\d+(\[\])?$/, '$1') + '-' + posNew).replace(/(\[\])(\-\d)/, '$2$1'));
9500
9501        if(jQuery(this).attr('type') == 'checkbox'){
9502          jQuery(this).prop("checked", false);
9503        }
9504        else if(jQuery(this).attr('type') == 'radio'){
9505          jQuery(this).prop("checked", false);
9506        }
9507        else if(jQuery(this).prop('nodeName') == 'SELECT'){
9508          jQuery(this).val('');
9509          jQuery(this).attr('value', '');
9510        }
9511        else if(jQuery(this).prop('nodeName') == 'INPUT'){
9512          jQuery(this).val('');
9513          jQuery(this).attr('value', '');
9514        }        
9515        else{
9516          jQuery(this).val('');
9517          jQuery(this).attr('value', '');
9518          jQuery(this).html('');
9519        }
9520      }
9521    });
9522  }  
9523
9524  cfs.find('.wglErrorMessageInline').remove();
9525  cfs.find('.wglValidationStatusOK').remove();  
9526  cfs.find('.wglContainsErrorMessageInline').removeClass('wglContainsErrorMessageInline'); 
9527  cfs.find('.wglContainsErrorMessageInline').removeClass('wglContainsErrorMessageInline');      
9528  cfs.find('.wglIsInvalid').removeClass('wglIsInvalid');    
9529  cfs.find('.hasDatepicker').removeClass('hasDatepicker');    
9530    
9531  fs.after(cfs);
9532     
9533  wFormElement(cfs);
9534
9535  jQuery(cfs).find('input, textarea, select').each(function(){        
9536    if(jQuery(this).attr('data-validators') && jQuery(this).attr('data-validators') != '' && jQuery(this).attr('name') != 'captchaInput'){          
9537      wAddInlineValidator(jQuery(this));
9538    }
9539  }); 
9540  
9541  cfs.find('.wglUploaderForm').each(function(){
9542    var srcIframe = jQuery(this).attr('src');
9543
9544    if(/&element=([^&]+)/.test(srcIframe)){
9545      var nameNew = (RegExp.$1.replace(/\-\d+(\[\])?$/, '$1') + '-' + ep).replace(/(\[\])(\-\d)/, '$2$1');
9546      srcIframe = srcIframe.replace(/&element=([^&]+)/, '&element=' + nameNew);
9547    }
9548    jQuery(this).attr('src', srcIframe);
9549  });  
9550  
9551  //jQuery(cfs).find('.wglDatepicker').wDatepicker();  
9552  
9553  var url = a + '?action=ce&ep=' + ep + '&ai=' + (ai ? '1' : '0') + '&en=' + n.join('|');
9554  
9555  jQuery.ajax({type: "GET", async: true, dataType: "json", url: url, success: function(r){    
9556    if(typeof(wOnAfterAddFieldsetMultiple) === 'function'){
9557      wOnAfterAddFieldsetMultiple(cfs, ep);
9558    }
9559  }});
9560
9561  var ne = p.find('.containerFormElementsMultiple').length;
9562  
9563  cfs.attr('data-allowadd', ne < nem ? '1' : '0');
9564  
9565  var csids = {}, hasCsids = false;
9566  
9567  p.find('.containerFormElementsMultiple').each(function(i){
9568    csids[jQuery(this).data('containermultiplesid')] = true;
9569    hasCsids = true;
9570  });  
9571  
9572  if(!hasCsids){
9573    csids['wNoCsid'] = true;
9574  }           
9575
9576  for(csid in csids){  
9577
9578    var entries = p.find(csid == 'wNoCsid' ? '.containerFormElementsMultiple' : '.containerFormElementsMultiple[data-containermultiplesid="' + csid + '"]');
9579        
9580    for(var j = entries.length - 1; j >= 0; j--){
9581
9582      var entry = jQuery(entries[j]);
9583      
9584      var ene  = p.find(csid == 'wNoCsid' ? '.containerFormElementsMultiple' : '.containerFormElementsMultiple[data-containermultiplesid="' + csid + '"]').length;
9585      var enem = entry.attr('data-numberentriesmax') ? parseInt(entry.attr('data-numberentriesmax')) : 64;  
9586          
9587      if(j >= 1){
9588        var additionalentryId = j + 1;
9589        entry.attr('data-entrypos', additionalentryId);
9590        entry.attr('data-islast', additionalentryId == ne ? '1' : '0');
9591        entry.attr('data-allowadd', (ene < enem) ? '1' : '0');   
9592        entry.attr('data-allowdelete', (ai || additionalentryId == ene) ? '1' : '0');  
9593
9594        if(ai){
9595
9596          entry.find('label').each(function(i){
9597            if(jQuery(this).attr('for') && jQuery(this).attr('for') != ''){
9598              jQuery(this).attr('for', (jQuery(this).attr('for').replace(/\-\d+(\[\])?$/, '$1') + '-' + additionalentryId).replace(/(\[\])(\-\d)/, '$2$1'));
9599            }
9600          });    
9601
9602          entry.find('input, textarea, select').each(function(){      
9603            if(jQuery(this).attr('id') && jQuery(this).attr('id') != ''){
9604              jQuery(this).attr('id', (jQuery(this).attr('id').replace(/\-\d+(\[\])?$/, '$1') + '-' + additionalentryId).replace(/(\[\])(\-\d)/, '$2$1'));
9605            }
9606            jQuery(this).attr('name', (jQuery(this).attr('name').replace(/\-\d+(\[\])?$/, '$1') + '-' + additionalentryId).replace(/(\[\])(\-\d)/, '$2$1')); 
9607          }); 
9608        }              
9609
9610        entry.find('buttonFormElementsMultipleDelete').each(function(){
9611          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(additionalentryId) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9612        });         
9613        entry.find('buttonFormElementsMultipleAdd').each(function(){
9614          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(additionalentryId) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9615        });         
9616        entry.find('label').each(function(){
9617          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(additionalentryId) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9618        });      
9619      }
9620      else{
9621        entry.attr('data-entrypos', '1');        
9622        entry.attr('data-islast', ene < 2 ? '1' : '0');
9623        entry.attr('data-allowadd', (ene < enem) ? '1' : '0');   
9624        entry.attr('data-allowdelete', '0');  
9625
9626        entry.find('buttonFormElementsMultipleDelete').each(function(){
9627          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(1) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9628        });         
9629        entry.find('buttonFormElementsMultipleAdd').each(function(){
9630          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(1) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9631        });         
9632        entry.find('label').each(function(){
9633          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(1) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9634        });  
9635      }
9636      entry.find('.wglDatepicker').wDatepicker(); 
9637    } 
9638  }
9639};
9640
9641wRemoveFieldsetMultiple = function (fs){ 
9642  
9643  var fs  = jQuery(fs); 
9644  var p   = fs.parent();
9645  var a   = fs.closest('form').attr('action');
9646  var cfs = fs;  
9647  var ep  = cfs.attr('data-entrypos') ? parseInt(cfs.attr('data-entrypos')) : 1;  
9648  var nem = cfs.attr('data-numberentriesmax') ? parseInt(cfs.attr('data-numberentriesmax')) : 64;   
9649  var ai  = cfs.attr('data-updateindex') == '1';
9650  var n   = [];
9651  var ne = p.find('.containerFormElementsMultiple').length;  
9652  
9653  if(typeof(wOnBeforeRemoveFieldsetMultiple) == 'function'){
9654    wOnBeforeRemoveFieldsetMultiple(fs);
9655  }
9656
9657  if(ne == 1){
9658    fs.find('input, textarea, select').each(function(){
9659      if(jQuery(this).attr('name') !== 'wFormToken'){          
9660        if(jQuery(this).attr('type') === 'checkbox' || jQuery(this).attr('type') === 'radio'){
9661          jQuery(this).prop('checked', false);         
9662        }
9663        else{
9664          jQuery(this).val('');
9665        }
9666      }  
9667    });
9668    return;
9669  }
9670  else{
9671    fs.find('input, select, textarea').each(function(i){
9672      if(jQuery(this).attr('name') === 'wFormToken'){          
9673        jQuery(this).closest('form').prepend(jQuery(this));
9674      }
9675      n.push(jQuery(this).attr('name').replace(/\-\d+(\[\])?$/, '$1'));
9676    });
9677
9678    fs.remove();  
9679
9680    var url = a + '?action=re&ep=' + ep + '&ai=' + (ai ? '1' : '0') + '&en=' + n.join('|') ;
9681
9682    jQuery.ajax({type: "GET", async: true, dataType: "json", url: url, success: function(r){
9683      jQuery(fs).remove();
9684      if(typeof(wOnAfterRemoveFieldsetMultiple) === 'function'){
9685        wOnAfterRemoveFieldsetMultiple(p, ep);
9686      }  
9687    }});
9688  }
9689  
9690  ne = p.find('.containerFormElementsMultiple').length;
9691  
9692  cfs.attr('data-allowadd', ne < nem ? '1' : '0');
9693  
9694  var csids = {}, hasCsids = false;
9695  
9696  p.find('.containerFormElementsMultiple').each(function(i){
9697    csids[jQuery(this).data('containermultiplesid')] = true;
9698    hasCsids = true;
9699  });  
9700  
9701  if(!hasCsids){
9702    csids['wNoCsid'] = true;
9703  }
9704                                                  
9705  for(csid in csids){  
9706    
9707    var i = 0;
9708    
9709    p.find(csid == 'wNoCsid' ? '.containerFormElementsMultiple' : '.containerFormElementsMultiple[data-containermultiplesid="' + csid + '"]').each(function(i){
9710
9711      var ene  = p.find(csid == 'wNoCsid' ? '.containerFormElementsMultiple' : '.containerFormElementsMultiple[data-containermultiplesid="' + csid + '"]').length;
9712      var enem = jQuery(this).attr('data-numberentriesmax') ? parseInt(jQuery(this).attr('data-numberentriesmax')) : 64;  
9713            
9714      if(i >= 1){
9715        var additionalentryId = i + 1;
9716        jQuery(this).attr('data-entrypos', additionalentryId);
9717        jQuery(this).attr('data-islast', additionalentryId == ene ? '1' : '0');
9718        jQuery(this).attr('data-allowadd', (ai || additionalentryId == ene) ? '1' : '0');   
9719        jQuery(this).attr('data-allowdelete', (ai || additionalentryId == ene) ? '1' : '0');  
9720
9721        if(ai){
9722          
9723          jQuery(this).find('label').each(function(i){
9724            if(jQuery(this).attr('for') && jQuery(this).attr('for') != ''){
9725              jQuery(this).attr('for', (jQuery(this).attr('for').replace(/\-\d+(\[\])?$/, '$1') + '-' + additionalentryId).replace(/(\[\])(\-\d)/, '$2$1'));
9726            }
9727          });    
9728          
9729          jQuery(this).find('input, textarea, select').each(function(){        
9730            if(jQuery(this).attr('id') && jQuery(this).attr('id') != ''){
9731              jQuery(this).attr('id', (jQuery(this).attr('id').replace(/\-\d+(\[\])?$/, '$1') + '-' + additionalentryId).replace(/(\[\])(\-\d)/, '$2$1'));
9732            }
9733            jQuery(this).attr('name', (jQuery(this).attr('name').replace(/\-\d+(\[\])?$/, '$1') + '-' + additionalentryId).replace(/(\[\])(\-\d)/, '$2$1'));        
9734          }); 
9735        }
9736        jQuery(this).find('buttonFormElementsMultipleDelete').each(function(){
9737          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(additionalentryId) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9738        });         
9739        jQuery(this).find('buttonFormElementsMultipleAdd').each(function(){
9740          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(additionalentryId) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9741        });         
9742        jQuery(this).find('label').each(function(){
9743          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(additionalentryId) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9744        });  
9745      }
9746      else{
9747        jQuery(this).attr('data-entrypos', '1');                
9748        jQuery(this).attr('data-islast', ene < 2 ? '1' : '0');
9749        jQuery(this).attr('data-allowadd', ai || ene < 2 ? '1' : '0');        
9750        jQuery(this).attr('data-allowdelete', '0');  
9751        
9752        if(ai){
9753          jQuery(this).find('input, textarea, select').each(function(){    
9754            if(jQuery(this).attr('id') && jQuery(this).attr('id') != ''){
9755              jQuery(this).attr('id', (jQuery(this).attr('id').replace(/\-\d+(\[\])?$/, '$1')));
9756            }
9757            jQuery(this).attr('name', (jQuery(this).attr('name').replace(/\-\d+(\[\])?$/, '$1')));        
9758          }); 
9759        }        
9760        
9761        jQuery(this).find('buttonFormElementsMultipleDelete').each(function(){
9762          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(1) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9763        });         
9764        jQuery(this).find('buttonFormElementsMultipleAdd').each(function(){
9765          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(1) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9766        });         
9767        jQuery(this).find('label').each(function(){
9768          jQuery(this).html(jQuery(this).html().replace(/<!--wPlaceholderFieldsetMultiple:position-->\d*<\!--\/wPlaceholderFieldsetMultiple:position-->/g, '<!--wPlaceholderFieldsetMultiple:position-->' + String(1) + '<!--/wPlaceholderFieldsetMultiple:position-->'));
9769        });      
9770      }
9771    });
9772  }  
9773};
9774
9775showNoticeExternalLinks = function (){
9776
9777   if(typeof(wEditor) === 'undefined'){
9778     if(typeof wShowNoticeExternalLinks !== 'undefined' && wShowNoticeExternalLinks === true && (wcsrft)){
9779
9780       var pathNotice = wProjectPath + '/wGlobal/content/privacy/externallink-notice.php';
9781       var excludedUrls = [];
9782       if(typeof wExcludeExternalUrlFromNotice !== 'undefined' && wExcludeExternalUrlFromNotice !== ''){
9783         excludedUrls = wExcludeExternalUrlFromNotice.split('|');
9784       }
9785
9786       var links = jQuery('a');
9787       links.each(function (){
9788
9789         var curLink = jQuery(this);
9790         var curLinkHref = curLink.attr('href');
9791
9792         if(curLinkHref && curLinkHref.length > 0){
9793           var isExternal = curLinkHref.match(/^(http[s]?:\/\/)/g);
9794           var isExcluded = curLink.attr('data-excludeExternalUrl') === '1';
9795
9796           for(var e = 0; e < excludedUrls.length; e++ ){
9797             var excludedUrl = excludedUrls[e];
9798             var re = new RegExp(excludedUrl, 'g');
9799             if(curLinkHref.match(re)){
9800               isExcluded = true;
9801             }
9802           }
9803
9804
9805           if(isExternal && isExcluded === false){
9806             curLink.on('click', function (e){
9807               e.preventDefault();
9808               var targetUrl = pathNotice + '?l=' + encodeURIComponent(curLinkHref) + '&wcsrf=' + wcsrft;
9809               //window.location.href = targetUrl;
9810               var clickObj = jQuery('<a href="'+targetUrl+'" target="box"></a>');
9811               clickObj.wLightbox();
9812               clickObj.trigger('click');
9813             })
9814           }
9815         }
9816
9817       });
9818     }
9819   }
9820};
9821
9822var dFactor1     = 0.0;
9823var sDefaults    = '|admin|weblication|cms|user|root|system|test|tester|testa|testo|testi|testu|asdf|abcdefg|abcdef|abcde|abcd|abc|123|1234|12345|login|demo|qwer|qwert|qwerz|qwery|qwertz|qwerty|';
9824var sTypeAlphaL  = 'abcdefghijklmnopqrstuvwxyz';
9825var sTypeAlphaU  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
9826var sTypeNumeric = '0123456789';
9827
9828wGetPwdQuality = function(sPwd, userName){
9829    
9830  if(sPwd == '[$WPASSWORD]'){
9831    sPwd = ''
9832  }
9833  if(sPwd){
9834    var sDefaultsTmp = sDefaults;
9835    if(userName.length > 3){
9836      sDefaultsTmp +=  userName.toLowerCase() + '|';
9837    }
9838
9839    sPwd = sPwd.replace(/20(10|11|12|13|14|15|16|17|18|19|20)$/, '');
9840
9841    sDefaultsTmp = sDefaultsTmp.replace(/^\|/, '').replace(/\|$/, '');
9842
9843    defaultRegExpStrict = new RegExp('^('+ sDefaultsTmp + ')$');
9844    defaultRegExp       = new RegExp('('+ sDefaultsTmp + ')');
9845
9846    sPwd = sPwd.replace(defaultRegExp, '');
9847
9848    var lTypeAlphaL  = 0;
9849    var lTypeAlphaU  = 0;
9850    var lTypeNumeric = 0;
9851    var lTypeSpecial = 0;
9852    var sChars       = '';
9853    for(var nCount = 0; nCount < sPwd.length; nCount++){
9854      var sChar  = sPwd.substring(nCount, nCount + 1);
9855      if((sChar == ' ')){
9856
9857      }
9858      else{
9859        if(sChars.indexOf(sChar) < 0){
9860          sChars += sChar;
9861        }
9862        if(sTypeAlphaL.indexOf(sChar) >= 0){
9863          lTypeAlphaL  += 1;
9864        }
9865        else if(sTypeAlphaU.indexOf(sChar) >= 0){
9866          lTypeAlphaU  += 1;
9867        }
9868        else if(sTypeNumeric.indexOf(sChar) >= 0){
9869          lTypeNumeric += 1;
9870        }
9871        else{
9872          lTypeSpecial += 1;
9873        }
9874      }
9875    }
9876
9877    var a = lTypeAlphaL  * 6;
9878    var b = lTypeAlphaU  * 8;
9879    var c = lTypeNumeric * 9;
9880    var d = lTypeSpecial * 12;    
9881    
9882    var tmp = parseInt((((a + b + c + d) * Math.pow(10, 1)) + 0.5)) / Math.pow(10, 1);
9883
9884    if(lTypeAlphaL == 0){
9885      tmp -= 5;
9886    }
9887    if(lTypeAlphaU == 0){
9888      tmp -= 5;
9889    }
9890    if(lTypeNumeric == 0){
9891      tmp -= 5;
9892    }
9893    if(lTypeSpecial == 0){
9894      tmp -= 5;
9895    }
9896
9897    if(defaultRegExp.test(sPwd.toLowerCase())){
9898      tmp = parseInt(tmp / 2) - 32;
9899      if(tmp < 0){
9900        tmp = -1;
9901      }
9902    }
9903
9904    if(lTypeAlphaL == 0){
9905      tmp -= 5;
9906    }
9907    if(lTypeAlphaU == 0){
9908      tmp -= 5;
9909    }
9910    if(lTypeNumeric == 0){
9911      tmp -= 5;
9912    }
9913    if(lTypeSpecial == 0){
9914      tmp -= 5;
9915    }
9916
9917    if(tmp < 0){
9918      tmp = 0;
9919    }
9920
9921    return tmp;
9922  }
9923  else{
9924    return '0';
9925  }
9926};
9927
9928jQuery.fn.wAddSelectAndClickableWithReturn = function(options){
9929  jQuery.each(jQuery(this), function(){
9930    if(jQuery(this).attr('aria-hidden') !== 'true'){
9931      jQuery(this).attr('tabindex', '0');
9932    }
9933    jQuery(this).on('keydown', function(event){if(event.key === "Enter"){jQuery(this).click()}});    
9934  });
9935};
9936
9937jQuery.fn.wRemoveSelectAndClickableWithReturn = function(options){
9938  jQuery.each(jQuery(this), function(){
9939    jQuery(this).removeAttr('tabindex');
9940    jQuery(this).off('keydown', function(){});    
9941  });
9942};
9943
9944wToggleWaiMenu = function(){
9945  if(typeof(wEditor) == 'undefined'){
9946    if(!jQuery('#wAiMenu').hasClass('open')){
9947      wOpenWaiMenu();
9948    }
9949    else{
9950      wCloseWaiMenu();
9951    }
9952  }  
9953};      
9954    
9955wOpenWaiMenu = function(){
9956  
9957  if(typeof(wEditor) == 'undefined'){
9958    if(typeof(wHasTextsEasyLanguage) !== 'undefined' && wHasTextsEasyLanguage){
9959      jQuery('#wAiSectionEasyLanguage').show();
9960    }
9961    else{
9962      jQuery('#wAiSectionEasyLanguage').hide();
9963    }
9964    
9965    jQuery('#wAiMenu').addClass('open');
9966    jQuery('#wAiMenu *[onclick]').wAddSelectAndClickableWithReturn();        
9967    window.setTimeout(function(){
9968      jQuery('.wAiMenuCloser').focus();
9969    }, 100);
9970    
9971    wEventEscWaiMenu = function(e){
9972      if(e.key === 'Escape'){
9973        event.preventDefault();
9974        jQuery(document).off('keydown', wEventEscWaiMenu);
9975        wCloseWaiMenu();
9976      }
9977    };      
9978    
9979    wEventKeydownWaiMenu = function(e){
9980      if(wAccessHandler.isLastFocusableElement({element : jQuery('#wAiMenu')}, jQuery(e.target))){
9981        jQuery(document).off('keydown', wEventEscWaiMenu);
9982        wCloseWaiMenu();
9983      }
9984    };
9985    
9986    jQuery(document).on('keydown', wEventEscWaiMenu);
9987    jQuery('#wAiMenu').on('keydown', wEventKeydownWaiMenu);
9988  
9989    jQuery('.wAiIcon').focus();    
9990  }  
9991};
9992
9993wCloseWaiMenu = function(setFocus = true){
9994  if(typeof(wEditor) == 'undefined'){
9995    jQuery('#wAiMenu').removeClass('open');
9996    jQuery('#wAiMenu *[onclick]').wRemoveSelectAndClickableWithReturn();
9997    jQuery('#wAiMenu *[onclick]').on('keydown', function(){});
9998    if(setFocus) jQuery('.wAiIcon').focus();
9999  }  
10000};
10001
10002wPersonalizeAccessibility = function(name, value, options){
10003  //console.log('wPersonalizeAccessibility(' + name + ', ' + value + ')');
10004  
10005  if(typeof(name) !== 'undefined' && typeof wOnBeforeChangeAccessibility === 'function'){
10006    wOnBeforeChangeAccessibility(name, value, options);
10007  }
10008    
10009  var options = options || '';
10010      
10011  if(name == 'fontSize'){
10012    if(value == 'toggle'){
10013      value = /waFontSize=(l|xl)/.test(document.cookie) ? '' : 'l';   
10014    }
10015    document.cookie = 'waFontSize=' + value + (options != '' ? ',' + options : '') + ';path=/;sameSite=Lax';
10016  }
10017  else if(name == 'contrast'){
10018    if(value == 'toggle'){
10019      value = /waContrast=l/.test(document.cookie) ? '' : 'l';   
10020    }   
10021    if(options.indexOf('onSelectContrastResetDarkMode:1') != -1){
10022      if(/waDarkMode=1,type:js/.test(document.cookie)){
10023        document.cookie = 'waDarkMode=0,type:js;path=/;sameSite=Lax';        
10024      }
10025      else{
10026        document.cookie = 'waDarkMode=0;path=/;sameSite=Lax';
10027      }
10028    }
10029    document.cookie = 'waContrast=' + value + (options != '' ? ',' + options : '') + ';path=/;sameSite=Lax';
10030  }
10031  else if(name == 'darkMode'){
10032    if(value == 'toggle'){
10033      value = /waDarkMode=1/.test(document.cookie) ? '0' : '1';   
10034    }        
10035    if(options.indexOf('onSelectDarkModeResetContrast:1') != -1){
10036      if(/waContrast=1,type:js/.test(document.cookie)){
10037        document.cookie = 'waContrast=0,type:js;path=/;sameSite=Lax';        
10038      }
10039      else{
10040        document.cookie = 'waContrast=0;path=/;sameSite=Lax';
10041      }      
10042    }
10043    document.cookie = 'waDarkMode=' + value + (options != '' ? ',' + options : '') + ';path=/;sameSite=Lax';
10044  }  
10045  else if(name == 'hideImages'){
10046    if(value == 'toggle'){
10047      value = /waHideImages=1/.test(document.cookie) ? '0' : '1';   
10048    }      
10049    document.cookie = 'waHideImages=' + value + (options != '' ? ',' + options : '') + ';path=/;sameSite=Lax';
10050  }    
10051  else if(name == 'avoidAnimations'){
10052    if(value == 'toggle'){
10053      value = /waAvoidAnimations=1/.test(document.cookie) ? '0' : '1';   
10054    }          
10055    document.cookie = 'waAvoidAnimations=' + value + (options != '' ? ',' + options : '') + ';path=/;sameSite=Lax';
10056  }      
10057  else if(name == 'easyLanguageMode'){
10058    if(value == 'toggle'){
10059      value = /waEasyLanguageMode=1/.test(document.cookie) ? '0' : '1';   
10060    }           
10061    document.cookie = 'waEasyLanguageMode=' + value + (options != '' ? ',' + options : '') + ';path=/;sameSite=Lax';
10062    wSetParameterAndReload('easyLanguageMode', value == '1' ? '1' : '0');
10063    return;
10064  }     
10065  
10066  if(/easyLanguageMode=1/.test(location.search) && !/waEasyLanguageMode=1/.test(document.cookie)){
10067    document.cookie = 'waEasyLanguageMode=1;path=/;sameSite=Lax';    
10068  }
10069  
10070  wConsiderPesonalizeAccessibility();
10071  
10072  if(typeof(name) !== 'undefined' && typeof wOnAfterChangeAccessibility === 'function'){
10073    wOnAfterChangeAccessibility(name, value, options);
10074  }  
10075};
10076
10077wConsiderPesonalizeAccessibility = function(){
10078  
10079  if(typeof(wEditor) != 'undefined'){
10080    return;
10081  }
10082  
10083  var waFontSize         = '';
10084  var waContrast         = '';  
10085  var waDarkMode         = '';
10086  var waHideImages       = '';
10087  var waAvoidAnimations  = '';
10088  var waEasyLanguageMode = ''; 
10089  var styleSheet = null;
10090  
10091  for(var i = 0; i < document.styleSheets.length; i++) {
10092    styleSheet = document.styleSheets[i];
10093    try{if(styleSheet.cssRules !== undefined && styleSheet.href !== undefined && styleSheet.href !== null) break;}
10094    catch(e){}
10095  }
10096         
10097  if(/waFontSize=(\w*)/.test(document.cookie)){
10098    waFontSize = RegExp.$1;
10099    if(waFontSize != ''){
10100      jQuery('html').addClass('waFontSize-' + waFontSize);
10101    }
10102    var computedStyle = window.getComputedStyle(document.documentElement);
10103    var fontSize      = computedStyle.fontSize;
10104    if(typeof wUiTmp['waFontSizeOrig'] === 'undefined'){
10105      wUiTmp['waFontSizeOrig'] = fontSize;
10106    }
10107    if(waFontSize == 'l'){
10108      document.documentElement.style.fontSize = '21px';
10109      jQuery('html').removeClass('waFontSize-xl');    
10110    }
10111    else if(waFontSize == 'xl'){
10112      document.documentElement.style.fontSize = '23px';
10113      jQuery('html').removeClass('waFontSize-l');    
10114    } 
10115    else if(typeof wUiTmp['waFontSizeOrig'] !== 'undefined'){
10116      jQuery('html').removeClass('waFontSize-l').removeClass('waFontSize-xl');              
10117      document.documentElement.style.fontSize = wUiTmp['waFontSizeOrig'];
10118    }
10119  }
10120  else if(typeof wUiTmp['waFontSizeOrig'] !== 'undefined'){
10121    jQuery('html').removeClass('waFontSize-l').removeClass('waFontSize-xl');        
10122    document.documentElement.style.fontSize = wUiTmp['waFontSizeOrig'];
10123  }
10124  
10125  jQuery('span[data-wafontsize]').each(function(){
10126    if(jQuery(this).data('wafontsize') == waFontSize){
10127      jQuery(this).addClass('wAiRangeSelected');
10128    }
10129    else{
10130      jQuery(this).removeClass('wAiRangeSelected');        
10131    }
10132  });  
10133
10134  if(/waContrast=l/.test(document.cookie) || /waContrast=l/.test(location.href)){
10135    jQuery('html').addClass('waContrast-l');
10136    waContrast = 'l';
10137    if(!wUiTmp['hasAddWaContrastRules']){
10138      if(styleSheet){      
10139        var rules = styleSheet.cssRules;
10140        for(var i = 0; i < rules.length; i++){
10141          if(rules[i].type === CSSRule.MEDIA_RULE && rules[i].conditionText.indexOf("prefers-contrast") != -1){
10142            rules[i].media.mediaText = "(min-width: 17px)";
10143          }
10144        }
10145      }  
10146    }
10147    wUiTmp['hasAddWaContrastRules'] = true;
10148    if(/waContrast=l,type:js/.test(document.cookie)){
10149      jQuery(typeof(wSelectorsAddContrast) !== 'undefined' && wSelectorsAddContrast !== '' ? wSelectorsAddContrast : '#blockMain, #blockHeader, #blockBody, #blockFooter').css({'filter' : 'contrast(1.2)'});      
10150    }      
10151  }
10152  else if(/waContrast=/.test(document.cookie)){    
10153    jQuery('html').removeClass('waContrast-l');  
10154    if(styleSheet){    
10155      var rules = styleSheet.cssRules;
10156      for(var i = 0; i < rules.length; i++){
10157        if(rules[i].type === CSSRule.MEDIA_RULE && rules[i].conditionText.indexOf("17px") != -1){
10158          rules[i].media.mediaText = "(prefers-contrast: more)";
10159        }
10160      }
10161      if(/waContrast=0?,type:js/.test(document.cookie)){
10162        jQuery(typeof(wSelectorsAddContrast) !== 'undefined' && wSelectorsAddContrast !== '' ? wSelectorsAddContrast : '#blockMain, #blockHeader, #blockBody, #blockFooter').css({'filter' : ''});      
10163      }
10164    } 
10165    wUiTmp['hasAddWaContrastRules'] = false;  
10166    document.cookie = 'waContrast=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;sameSite=lax';            
10167  }  
10168  
10169  jQuery('span[data-wacontrast]').each(function(){
10170    if(jQuery(this).data('wacontrast') == waContrast){
10171      jQuery(this).addClass('wAiRangeSelected');
10172    }
10173    else{
10174      jQuery(this).removeClass('wAiRangeSelected');        
10175    }
10176  });    
10177    
10178  if(/waDarkMode=1/.test(document.cookie)){
10179    waDarkMode = '1';
10180    jQuery('html').addClass('waDarkMode-1').addClass('waDarkmode-1');
10181    if(!wUiTmp['hasAddWaDarkmodeRules']){
10182      if(styleSheet){      
10183        var rules = styleSheet.cssRules;
10184        for(var i = 0; i < rules.length; i++){
10185          if(rules[i].type === CSSRule.MEDIA_RULE && rules[i].conditionText.indexOf("prefers-color-scheme") != -1){
10186            rules[i].media.mediaText = "(min-width: 18.1px)";
10187          }
10188        }
10189      }
10190    }
10191    wUiTmp['hasAddWaDarkmodeRules'] = true;   
10192    
10193    if(/waDarkMode=1,type:js/.test(document.cookie)){
10194      document.body.style.filter = 'invert(1)';      
10195      jQuery('img').css({'filter' : 'invert(1)'});
10196    }   
10197    else if(/waDarkMode=1,type:js1/.test(document.cookie)){
10198      var styleSheet = document.styleSheets[0].href ? document.styleSheets[0] : document.styleSheets[1];
10199      var rulesTmp = [];
10200      if(styleSheet){
10201        var rules = styleSheet.cssRules;
10202        for(var i = 0; i < rules.length; i++){
10203          if(rules[i].type === window.CSSRule.MEDIA_RULE){
10204            var mediaRules = rules[i].cssRules || rules[i].rules;
10205            for(var j = 0; j < mediaRules.length; j++){
10206              if(mediaRules[j].style){
10207                rulesTmp.push(mediaRules[j]);
10208              }
10209            }
10210          } 
10211          else if(rules[i].style){
10212            rulesTmp.push(rules[i]);
10213          } 
10214        }
10215      }  
10216      
10217      rules = rulesTmp;
10218      
10219      for(var i = 0; i < rules.length; i++){        
10220        if(typeof(rules[i].style) !== 'undefined'){
10221       
10222          if(rules[i].style.color){
10223            rules[i].style.color = '#ffffff';
10224          }
10225          if(rules[i].style.background){
10226            rules[i].style.backgroundColor = '#000000';            
10227          }              
10228          if(rules[i].style.backgroundColor){
10229            rules[i].style.backgroundColor = '#000000';
10230          }        
10231          if(rules[i].style.opacity){
10232            rules[i].style.opacity = '1';
10233          }
10234          if(rules[i].style.boxShadow){
10235            rules[i].style.boxShadow = 'none';
10236          } 
10237          if(rules[i].style.borderColor){
10238            rules[i].style.borderColor = '#ffffff';
10239          }
10240        }
10241      }  
10242    }      
10243  }
10244  else if(/waDarkMode=/.test(document.cookie)){
10245    jQuery('html').removeClass('waDarkMode-1').removeClass('waDarkmode-1');    
10246    if(styleSheet){
10247      var rules = styleSheet.cssRules;    
10248      for(var i = 0; i < rules.length; i++){
10249        if(rules[i].type === CSSRule.MEDIA_RULE && rules[i].conditionText.indexOf("18.1px") != -1){
10250          rules[i].media.mediaText = "(prefers-color-scheme: dark)";
10251        }
10252      }
10253    }
10254
10255    if(/waDarkMode=0?,type:js/.test(document.cookie)){
10256      document.body.style.filter = '';      
10257      jQuery('img').css({'filter' : ''});
10258      document.cookie = 'waDarkMode=;path=/;sameSite=Lax';      
10259    }  
10260    wUiTmp['hasAddWaDarkmodeRules'] = false;
10261    document.cookie = 'waDarkMode=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;sameSite=lax';        
10262  }    
10263  
10264  jQuery('span[data-wadarkmode]').each(function(){
10265    if(jQuery(this).data('wadarkmode') == waDarkMode){
10266      jQuery(this).addClass('wAiRangeSelected');
10267    }
10268    else{
10269      jQuery(this).removeClass('wAiRangeSelected');        
10270    }
10271  });
10272  
10273  if(/waHideImages=1/.test(document.cookie)){
10274    jQuery('html').addClass('waHideImages');    
10275    waHideImages = '1';
10276    if(!wUiTmp['hasAddWaHideImages']){
10277      jQuery('#blockBody img').each(function(){
10278        jQuery(this).attr('data-wahashide', '1');
10279        jQuery(this).css({'opacity' : '0'});
10280        var eA = jQuery('<div class="wglWaHiddenImageAlt"></div>').text(jQuery(this).attr('alt'));
10281        var eB = jQuery(this).parent().is('picture') ? jQuery(this).parent() : jQuery(this);
10282        eA.css({'max-width' : String(eB.parent().innerWidth()) + 'px'})
10283        eB.before(eA);
10284      });
10285      jQuery('#blockBody .elementVideo, #blockBody .listEntry[data-hasvideo="1"] .listEntryInner').each(function(){
10286        var tmpHasHideE  = jQuery(this).find('.listEntryVideo');
10287        var hashHideE    = jQuery(this);
10288        if(jQuery(this).hasClass('listEntryInner') && tmpHasHideE.length > 0){
10289          hashHideE = tmpHasHideE;
10290        }
10291        hashHideE.attr('data-wahashide', '1').attr('data-waopacitybefore', hashHideE.css('opacity')).css({'opacity' : '0'});
10292      });
10293      if(typeof(wAiHideImagesBackground) === 'undefined' || wAiHideImagesBackground){
10294        window.setTimeout(function(){
10295          jQuery('#blockBody *').each(function(){          
10296            var currentBackground = jQuery(this).css('background-image');
10297            if(currentBackground !== 'none'){
10298              jQuery(this).attr('data-wobg', currentBackground);
10299              jQuery(this).css('background-image', 'none');
10300            }
10301          });
10302        }, 50);
10303        window.setTimeout(function(){
10304          jQuery('#blockBody *').each(function(){          
10305            var currentBackground = jQuery(this).css('background-image');
10306            if(currentBackground !== 'none'){
10307              jQuery(this).attr('data-wobg', currentBackground);
10308              jQuery(this).css('background-image', 'none');
10309            }
10310          }); 
10311        }, 200);        
10312      }      
10313    }
10314    wUiTmp['hasAddWaHideImages'] = true;      
10315  }
10316  else if(/waHideImages=/.test(document.cookie)){
10317    jQuery('html').removeClass('waHideImages');      
10318    jQuery('#blockBody img[data-wahashide="1"], #blockBody .elementVideo, #blockBody .listEntry[data-hasvideo="1"] .listEntryInner').each(function(){
10319      var tmpHasHideE = jQuery(this).find('.listEntryVideo');
10320      var hashHideE   = jQuery(this);
10321      if(jQuery(this).hasClass('listEntryInner') && tmpHasHideE.length > 0){
10322        hashHideE = tmpHasHideE;
10323      }
10324      hashHideE.removeAttr('data-wahashide').css({'opacity' : (hashHideE.attr('data-waopacitybefore') ? hashHideE.attr('data-waopacitybefore') : '1')});
10325      jQuery('.wglWaHiddenImageAlt').remove();
10326    });
10327    if(typeof(wAiHideImagesBackground) === 'undefined' || wAiHideImagesBackground){
10328      jQuery('#blockBody *[data-wobg]').each(function(){          
10329        var originalBackground = jQuery(this).attr('data-wobg');
10330        jQuery(this).removeAttr('data-wobg');
10331        jQuery(this).css('background-image', originalBackground);
10332      });  
10333    }     
10334    wUiTmp['hasAddWaHideImages'] = false; 
10335    document.cookie = 'waHideImages=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;sameSite=lax';    
10336  }   
10337  
10338  jQuery('span[data-wahideimages]').each(function(){
10339    if(jQuery(this).data('wahideimages') == waHideImages){
10340      jQuery(this).addClass('wAiRangeSelected');
10341    }
10342    else{
10343      jQuery(this).removeClass('wAiRangeSelected');        
10344    }
10345  });
10346    
10347  if(/waAvoidAnimations=1/.test(document.cookie)){
10348    waAvoidAnimations = '1';
10349    if(!wUiTmp['hasAddWaAvoidAnimations']){
10350      jQuery('html').addClass('waAvoidAnimations'); 
10351      if(typeof bannerSliderPauseAnimationAll == 'function'){
10352        bannerSliderPauseAnimationAll();
10353      }  
10354
10355      if(styleSheet){      
10356        var rules = styleSheet.cssRules;
10357        for(var i = 0; i < rules.length; i++){
10358          if(rules[i].type === CSSRule.MEDIA_RULE && rules[i].conditionText.indexOf("prefers-reduced-motion") != -1){
10359            rules[i].media.mediaText = "(min-width: 18.1px)";
10360          }
10361        }
10362      }      
10363    }
10364
10365    wUiTmp['hasAddWaAvoidAnimations'] = true;      
10366  }  
10367  else if(/waAvoidAnimations=/.test(document.cookie)){   
10368    jQuery('html').removeClass('waAvoidAnimations');  
10369
10370    if(typeof bannerSliderResumeAnimationAll == 'function'){
10371      bannerSliderResumeAnimationAll();
10372    }      
10373    
10374    if(styleSheet){
10375      var rules = styleSheet.cssRules;    
10376      for(var i = 0; i < rules.length; i++){
10377        if(rules[i].type === CSSRule.MEDIA_RULE && rules[i].conditionText.indexOf("18.1px") != -1){
10378          rules[i].media.mediaText = "(prefers-reduced-motion: reduce)";
10379        }
10380      }
10381    }
10382
10383    wUiTmp['hasAddWaAvoidAnimations'] = false;    
10384    document.cookie = 'waAvoidAnimations=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;sameSite=lax';    
10385  }   
10386  
10387  jQuery('span[data-waavoidanimations]').each(function(){
10388    if(jQuery(this).data('waavoidanimations') == waAvoidAnimations){
10389      jQuery(this).addClass('wAiRangeSelected');
10390    }
10391    else{
10392      jQuery(this).removeClass('wAiRangeSelected');        
10393    }
10394  });    
10395  
10396  if(/waEasyLanguageMode=1/.test(document.cookie)){
10397    waEasyLanguageMode = '1';
10398    if(/waEasyLanguageMode=1,addClassHtml:1/.test(document.cookie)){
10399      document.documentElement.className = document.documentElement.className.replace(' wEasyLanguageMode', '') + ' wEasyLanguageMode';
10400    }
10401    window.setTimeout(function(){wArrangeAdditionalPictureWai();}, 320);        
10402    window.setTimeout(function(){wGetMissingEasyLanguages();}, 128);
10403  }  
10404
10405  jQuery('span[data-waeasylanguagemode]').each(function(){
10406    if(jQuery(this).data('waeasylanguagemode') == waEasyLanguageMode){
10407      jQuery(this).addClass('wAiRangeSelected');
10408    }
10409    else{
10410      jQuery(this).removeClass('wAiRangeSelected');        
10411    }
10412  });  
10413  
10414  if(waFontSize != '' || waContrast != '' || waDarkMode != '' || waEasyLanguageMode != '' || waHideImages != '' || waAvoidAnimations != ''){
10415    jQuery('.wAiIcon').addClass('hasMadeSelection');
10416  }
10417  else{
10418    jQuery('.wAiIcon').removeClass('hasMadeSelection');
10419  }
10420};
10421  
10422wGetMissingEasyLanguages = function(){
10423  
10424  if(typeof wUiTmp['hasGetEl'] === 'undefined'){
10425    
10426    var rootEasyLanguages = '#blockContent';
10427    
10428    wUiTmp['elcpids'] = [];
10429    jQuery((rootEasyLanguages != '' ? rootEasyLanguages + ' ' : '') + '*[data-elcpid]').each(function(){ 
10430      wUiTmp['elcpids'].push(jQuery(this).data('elcpid'));
10431    });  
10432    wUiTmp['hasGetEl'] = true;
10433  }
10434
10435  if(wUiTmp['elcpids'].length != 0){
10436    var elcpid   = wUiTmp['elcpids'].shift();
10437    var ajaxURL  = '/weblication/grid5/scripts/wContent.php?action=getTextEasyLanguage&id=' + elcpid + (jQuery('*[data-elcpid="' + elcpid + '"]').hasClass('elementHeadline') || jQuery('*[data-elcpid="' + elcpid + '"]').attr('data-isheadline') === '1' ? '&type=headline' : '');
10438    var buttonQe = jQuery('*[data-elcpid="' + elcpid + '"]').find('.wglButtonEditEmbedElement');
10439
10440    buttonQe.addClass('elprogress');    
10441    buttonQe = buttonQe.clone();
10442
10443    jQuery.ajax({type: "GET", url: ajaxURL, dataType: 'json', async: true, success: function(result){
10444      buttonQe = jQuery('*[data-elcpid="' + elcpid + '"]').find('.wglButtonEditEmbedElement');      
10445      if(result['status'] == 'ok'){
10446        if(jQuery('*[data-elcpid="' + elcpid + '"]').hasClass('elementHeadline')){  
10447          jQuery('*[data-elcpid="' + elcpid + '"]').find('h1, h2, h3, h4, h5, h6, .he').html(result['text']).attr('data-wait', '1');
10448        }
10449        else{
10450          jQuery('*[data-elcpid="' + elcpid + '"]').html(result['text']).attr('data-wait', '1');
10451        }        
10452        jQuery('*[data-elcpid="' + elcpid + '"]').append('<div class="wglInfoAiGeneratedText" aria-hidden="true"></div>');        
10453      }
10454      if(buttonQe.length != 0){
10455        jQuery('*[data-elcpid="' + elcpid + '"]').prepend(buttonQe);    
10456        buttonQe.removeClass('elprogress').addClass('wglButtonEditEmbedElementHasWaiTextAvailableOnTheFly');
10457        buttonQe.find('.wglButtonEditEmbedElementExtended').attr('title', 'Der Text wird von der KI generiert in Leichter Sprache zur Verfügung gestellt. Klicken Sie hier, um den Modus Leichte Sprache zu verlassen.');        
10458        buttonQe.parent().attr('data-wais', '1');
10459      }
10460      if(wUiTmp['elcpids'].length != 0){
10461        window.setTimeout(function(){wGetMissingEasyLanguages();}, 20);
10462      }      
10463    }});
10464  }
10465};
10466  
10467wArrangeAdditionalPictureWai = function(){
10468
10469  jQuery('#blockContent .elementText').each(function(index){  
10470      
10471    var bai = 0, pe = null, he = 0, hp = false, otlb = 0, pb = '', et = jQuery(this);
10472    
10473    if(et.find('.additionalPictureWai').length > 0){ 
10474      
10475      pb = et.css('position');
10476      et.css({'position' : 'relative'});
10477
10478      pe = et.find('.additionalPictureWai').parent().parent(); 
10479      
10480      et.find('.additionalPictureWai[data-pos]:not([data-pos=""])').each(function(index){  
10481        hp = true;
10482        var pi  = jQuery(this).data('pos');
10483        var pit = jQuery(this).offset()['top'];
10484        if(/^\d+$/.test(pi)){
10485          var pp  = pe.find('p:nth-of-type(' + pi + ')');
10486          if(pp.length === 1){
10487            ppt = pp.offset()['top'];
10488            if(ppt > pit){
10489              jQuery(this).css({'margin-top' : String(ppt - pit) + 'px'});
10490            }
10491            else{
10492              otlb = jQuery(this).offset()['top'];
10493              pp.css({'padding-top' : String(otlb - ppt) + 'px'});
10494            }
10495          }
10496        }
10497      });
10498
10499      et.find('.additionalPictureWai').each(function(index){  
10500        var bi = jQuery(this).position().top + jQuery(this).height();
10501        bai = bi;
10502        he  = pe.height();
10503      });  
10504            
10505      if(bai > he){
10506        pe.css({'padding-bottom' : String(parseInt(bai - he)) + 'px'});
10507      }
10508      et.css({'position' : pb});
10509    }
10510  });  
10511};
10512  
10513wGetText = function(id){
10514  id = typeof(id) !== 'undefined' ? id : '';
10515  if(typeof wTexts == 'undefined') wTexts = {};
10516  return (wTexts[id] != null && wUiTmp['lang'] != null && wTexts[wUiTmp['lang']][id] != null) ? wTexts[wUiTmp['lang']][id] : ((wTexts[id] != null && wUiTmp['lang']  != null && wTexts[id][wUiTmp['lang']]) ? wTexts[id][wUiTmp['lang']] : (wTexts[id] != null ? wTexts[id] : id));
10517};
10518
10519wSubmitFormAjax  = function(){
10520
10521  var currentForm = event.target;
10522  var formData    = new FormData(currentForm);
10523  
10524  formData.append('wSubmitFormAjax', '1');  
10525
10526  jQuery.ajax({
10527    url:currentForm.getAttribute('action'),
10528    type:currentForm.getAttribute('method'),
10529    data:formData,
10530    dataType:'json',    
10531    processData:false,
10532    contentType:false,
10533    success: function(response){
10534      if(typeof(wOnAfterSubmitFormAjaxSuccess) === 'function'){
10535        wOnAfterSubmitFormAjaxSuccess(response);
10536      }  
10537      else{      
10538        if(response['redirect']){
10539          location.href = location.href !== response['redirect'] ? response['redirect'] : wSetParameter(response['redirect'], 'wfr', new Date().getTime());
10540        }
10541      }  
10542    },
10543    error: function(xhr, status, error){
10544      if(typeof(wOnAfterSubmitFormAjaxError) === 'function'){
10545        var errorData = {'xhrStatus' : status, 'xhrError' : status};
10546        wOnAfterSubmitFormAjaxError(errorData);
10547      }  
10548      else{
10549        alert('Es ist ein Fehler aufgetreten. Ggf. ist die Netzwerkverbinung gerade unterbrochen. Prüfen Sie die Netzwerkverbindung und versuchen Sie es anschließend noch einmal.');
10550      }
10551    }
10552  });
10553  
10554  return false;
10555};
10556
10557wLoadScript = function(src, callbackOnLoad, cO, options){
10558  let scriptObj = document.createElement('script');
10559  scriptObj.src = src;
10560  if(options['defer'] != undefined) scriptObj.setAttribute('defer', 'defer');
10561  scriptObj.onload = function(){
10562    if(typeof window[callbackOnLoad] == 'function') window[callbackOnLoad](cO, options);
10563  };
10564  document.head.appendChild(scriptObj);
10565};
10566
10567jQuery(document).on('mousedown', function(e){
10568  wUiTmp['lastActionSource'] = 'mouse';  
10569});
10570
10571jQuery(document).on('keydown', function(e){
10572  
10573  if(e.key === 'Escape'){
10574    if(jQuery('#cookieNotice').is(':visible')){
10575      event.preventDefault();
10576      if(typeof closeCookieNotice === 'function'){    
10577        closeCookieNotice();
10578      }
10579      else{
10580        jQuery('#cookieNotice').hide();
10581      } 
10582    }
10583    else if(jQuery('.accordionCloserContent').is(':visible')){
10584      event.preventDefault();  
10585      jQuery('.accordionCloserContent:visible').parent().prev('.accordionHeader').focus();     
10586    }
10587  }
10588  
10589  wUiTmp['lastActionSource'] = 'keyboard';  
10590  wUiTmp['lastKey'] = e.key;
10591});    
10592
10593/*Klasse für die Barrierefreiheit in der design.js wird die Funktion aktiviert über 
10594  wAccessibility['accessEventHandler']       = {active : true};
10595*/
10596class wClassAccessHandler {
10597   
10598  constructor(options){
10599    this.objects = [];
10600    this.objGroups = [];
10601    this.idCount = 0;
10602    this.activeListenerObjects = [];
10603    this.listenerObjects = [];
10604  };
10605  /*
10606    Fügt dem Eventhandler ein AccessEvent hinzu
10607    options accessibilityRules [standard,strict] - Berücksichtigung der Barrierefreiheit-Regeln
10608            idPrefix
10609  */
10610    addEvent(cO, options = []){
10611     
10612    var self = this;
10613    var add = true;
10614    var idPrefix = options['idPrefix'] != null ? options['idPrefix'] : 'accessEvent';
10615     
10616    if(cO.id == null) cO.id = idPrefix + '_' + self.idCount;  
10617    if(cO.id in self.objects && self.objects[cO.id] != null) add = false;
10618    if(cO.element == null){
10619      console.log('The Event has no Element: ' + cO.id);
10620      add = false;
10621    }
10622    else if(cO.accessibilityRules != null){
10623      /*aria-label*/
10624      if(cO.element.attr('aria-label') == null) cO.element.attr('aria-label', cO.element.attr('data-aria-label'));
10625      cO.element.removeAttr('data-aria-label');
10626      /*Falls die Barrierefreiheit-Regeln den Code automatisch bereinigen sollen*/
10627      var accessRules = options['accessibilityRules'] != null ?  options['accessibilityRules'] : {active : false}; 
10628      /*a-tags*/
10629      if(accessRules.active && (accessRules.type != null || accessRules.links != null)){
10630        self.accessiblityRulesLinks(cO, accessRules);
10631      }
10632    }
10633    //console.log('addEvent: ' + add + " id: " + cO.id + " cleanup " + cO.cleanUp);
10634    if(add){
10635      var eventStatus = true;
10636      if(cO.onready != null)  eventStatus = cO.onready(cO);
10637      if(cO.onresize != null)  jQuery(window).on('resize', function(e){cO.onresize(cO);});
10638      if(eventStatus){
10639        var events = ["onkeyup", "onkeydown", "onleave", "onclick", "onmouseout", "onmouseover", "onfocusout", "onfocusin"];
10640        events.forEach(event => {
10641           if(cO[event] != null && typeof self[event] === "function"){
10642             self[event](cO);
10643           }
10644       });
10645      }
10646      cO.init = true;
10647      self.objects[cO.id] = cO;
10648      if(self.objGroups[idPrefix] == null) self.objGroups[idPrefix] = [];
10649      self.objGroups[idPrefix].push(cO);
10650    }
10651    self.idCount++;
10652  }
10653  
10654  accessiblityRulesLinks(cO, accessRules){
10655    cO.element.find('a').each(function(){ 
10656      var cE = jQuery(this);
10657      var linkRules = accessRules.links != null ? accessRules.links : (accessRules.type === 'strict' ? 'redundantTitle|filetypes|unterlinedText' : 'redundantTitle' );
10658      if(linkRules.indexOf('redundantTitle') !== -1 && cE.attr('title') == cE.text()) cE.removeAttr('title'); /*Redundant title text*/
10659      if(linkRules.indexOf('filetypes') !== -1 && cE.attr('href') != undefined){
10660        
10661        var baseHref = cE.attr('href').indexOf('wLinkDetailsSource') !== -1 ? cE.attr('href').split('wLinkDetailsSource=')[1] : cE.attr('href');
10662        baseHref = baseHref !== -1 ? baseHref.split('?')[0] : baseHref;
10663        if(baseHref.indexOf('.') === -1) baseHref = '';
10664        var excludeStr = ['#wEmpty', 'http://', 'https://', '#'];
10665        if(excludeStr.some(extStr => baseHref.indexOf(extStr) !== -1)) baseHref = '';
10666        var exclude = ['.svg', '.html', '.php', '/'];
10667        if(exclude.some(ext => baseHref.endsWith(ext))) baseHref = '';
10668        
10669        if(baseHref != ''){
10670          var tmpExt = baseHref.split('.');
10671          if(tmpExt.length > 1){
10672            var ext = tmpExt.pop().toLowerCase();
10673            var txtE = cE;
10674            if(cE.find('*[data-aeListEntryText="1"]').length > 0) txtE = cE.find('*[data-aeListEntryText="1"]');
10675            else if(cE.children('span.linkEntryText').length > 0) txtE = cE.children('span.linkEntryText');
10676            if(txtE.text().toLowerCase().indexOf(ext) === -1) txtE.text(txtE.text().trim() + ' 
10676(' + ext.toUpperCase() + ')');
10677          }
10678        };  
10679      }
10680      if(linkRules.indexOf('underlinedText') !== -1){ /*Underlined text*/
10681        if(cE[0].attributes.length > 0 && cE.attr('href') != '#wEmpty' && cE.css('text-decoration').includes('underline') && cE.first('span').length == 1) cE.text(cE.first('span').text()); 
10682      }
10683    });
10684  }
10685  
10686  /*Gibt ein einzelnes Event zurück*/
10687  getEvent(id){
10688    return this.objects[id] != null ? this.objects[id] : {};
10689  }
10690  
10691  /*Gibt ein eine Gruppe von Events zurück*/
10692  getEventGroup(id){
10693    return this.objGroups[id] != null ? this.objGroups[id] : [];
10694  }
10695  
10696  /* Initalisiert das onkeydown-Event, Unterstützt alle Keys */
10697  onkeydown(cO){
10698    var self = this;
10699    var evtO = cO.onkeydown;
10700    cO.element.attr('tabindex', cO.onkeydown.tabindex != null ? cO.onkeydown.tabindex : '0');
10701    cO.element.on('keydown.' + cO.id, function(e){
10702      /*Setzt Status zurück*/
10703      self.reset(cO);
10704      const keyEvent = 'key' + (e.key == ' ' ? 'Space' : e.key) + (e.shiftKey ? 'Shift' : '');
10705      
10706      /*trigger : 'onclick'*/
10707      if(keyEvent && typeof evtO[keyEvent] === 'object' && evtO[keyEvent].trigger == 'onclick') {
10708        /*Setzt leave auf true, zB. i.V.m Escape*/
10709        cO.element.data('leave', evtO[keyEvent].leave); 
10710        
10711        if(evtO[keyEvent].element !== undefined) evtO[keyEvent].element.trigger('click');
10712        else cO.element.trigger('click');
10713        
10714        //Callback
10715        if(typeof evtO[keyEvent].onafterclick === 'function') evtO[keyEvent].onafterclick(cO, e);
10716        evtO[keyEvent].clicked = evtO[keyEvent].clicked === undefined ? true : !evtO[keyEvent].clicked;
10717      }
10718      
10719      /*Falls für einen key eine Funktion definiert wurde*/
10720      if (keyEvent && typeof evtO[keyEvent] === 'function') {evtO[keyEvent](cO, e);}
10721      if(typeof evtO.onafterkeydown == 'function') evtO.onafterkeydown(cO, e);
10722    });
10723  }
10724  
10725  /* Initalisiert das onkeyup-Event, Unterstützt alle Keys */
10726  onkeyup(cO){
10727    var self = this;
10728    var evtO = cO.onkeyup;
10729    cO.element.attr('tabindex', cO.onkeydown.tabindex != null ? cO.onkeydown.tabindex : '0');
10730    cO.element.on('keyup.' + cO.id, function(e){
10731      /*Setzt Status zurück*/
10732      self.reset(cO);
10733      const keyEvent = 'key' + (e.key == ' ' ? 'Space' : e.key) + (e.shiftKey ? 'Shift' : '');
10734      
10735      /*trigger : 'onclick'*/
10736      if(keyEvent && typeof evtO[keyEvent] === 'object' && evtO[keyEvent].trigger == 'onclick') {
10737        /*Setzt leave auf true, zB. i.V.m Escape*/
10738        cO.element.data('leave', evtO[keyEvent].leave); 
10739        
10740        if(evtO[keyEvent].element !== undefined) evtO[keyEvent].element.trigger('click');
10741        else cO.element.trigger('click');
10742        
10743        //Callback
10744        if(typeof evtO[keyEvent].onafterclick === 'function') evtO[keyEvent].onafterclick(cO, e);
10745        evtO[keyEvent].clicked = evtO[keyEvent].clicked === undefined ? true : !evtO[keyEvent].clicked;
10746      }
10747      
10748      /*Falls für einen key eine Funktion definiert wurde*/
10749      if (keyEvent && typeof evtO[keyEvent] === 'function') {evtO[keyEvent](cO, e);}
10750      if(typeof evtO.onafterkeyup == 'function') evtO.onafterkeyup(cO, e);
10751    });
10752  }
10753  
10754  /* Die Funktion wird ausgeführt wenn ein Element verlassen (keydown, mouseout, blur) wird.  */
10755  onleave(cO){
10756    var self = this;
10757    var events = '';
10758    const eventNames = ['keydown', 'mouseout', 'blur']; 
10759    for (const eventName of eventNames) {
10760      if(!cO.onleave.events ||cO.onleave.events[eventName] === undefined ||cO.onleave.events[eventName])  events += ' '+eventName + '.' + cO.id;
10761    }
10762    cO.element.on(events, function(e){
10763      //console.log(cO.id + 'onleave hasLeft' + cO.hasleft);
10764      var leave = false;
10765      var off = cO.onleave.off !== undefined ? cO.onleave.off : false;
10766      if(cO.onleave.element == null) cO.onleave.element = cO.element;
10767      if((e.key == 'Tab' || e.key == 'Escape' || e.key === undefined) && (!cO.hasLeft || cO.hasleft !== true)) leave = true;
10768      //console.log('leave --> ' + cO.id + ' leave --> ' + leave + " hasLeft " + (!cO.hasLeft || cO.hasleft !== true));
10769      if(leave){
10770        cO.hasleft = true;
10771        cO.onleave.element.data('leave', cO.hasleft);
10772        //Falls eine Funktion definiert wurde
10773        if(typeof cO.onleave == 'function') cO.onleave(cO, e);
10774        //Falls das Click Event angestossen werden soll definiert wurde
10775        else if(typeof cO.onleave === 'object' && typeof cO.onleave.function == 'function') cO.onleave.function(cO, e);
10776        else if(typeof cO.onleave === 'object' && cO.onleave.trigger == 'onclick') {
10777          cO.onleave.element.trigger('click');
10778        }
10779        //Ausschalten des Events
10780        if(off) cO.element.off(events);
10781        //Stoppt Propagation
10782        if(cO.onleave.stop === true){
10783          e.stopPropagation();
10784          e.stopImmediatePropagation();
10785          e.preventDefault();
10786          cO.onleave.element.data('stop', true);
10787        }
10788      }
10789    });
10790  }
10791  
10792    /*Führt onclick aus*/
10793  onclick(cO){
10794    var self = this;
10795    var events = '';
10796    const eventNames = cO.onclick != null && cO.onclick.events != null ? cO.onclick.events : ['click']; 
10797    var passivListener = '';
10798    for (const eventName of eventNames) {
10799      if(eventName === 'touchstart'){
10800        passivListener += eventName;
10801      }
10802      else events += ' '+eventName + '.' + cO.id;
10803    }
10804    if(passivListener !== ''){
10805      cO.element.get(0).addEventListener('touchstart', function(e){
10806        cO.leave = cO.element.data('leave'); /*Element wurde verlassen*/
10807        cO.stop  = cO.element.data('stop');  /*Funktion wurde gestoppt*/
10808        if(typeof cO.onclick == 'function') cO.onclick(cO, e);
10809        else if(typeof cO.onclick === 'object' && typeof cO.onclick.function == 'function') cO.onclick.function(cO, e);
10810        self.reset(cO);
10811      }, { passive: true });
10812    }
10813    if(events != ''){
10814      cO.element.on(events, function(e){
10815        cO.leave = cO.element.data('leave'); /*Element wurde verlassen*/
10816        cO.stop  = cO.element.data('stop');  /*Funktion wurde gestoppt*/
10817        if(typeof cO.onclick == 'function') cO.onclick(cO, e);
10818        else if(typeof cO.onclick === 'object' && typeof cO.onclick.function == 'function') cO.onclick.function(cO, e);
10819        self.reset(cO);
10820      });
10821    }
10822  };
10823  
10824  /*Führt onmouseout aus*/
10825  onmouseout(cO){
10826    var self = this;
10827    cO.element.on('mouseout.' + cO.id, function(e){
10828      if(typeof cO.onmouseout == 'function'){
10829        cO.onmouseout(cO, e);
10830      }  
10831    });
10832  };
10833  
10834  /*Führt onmouseover aus*/
10835  onmouseover(cO){
10836    var self = this;
10837    cO.element.on('mouseover.' + cO.id, function(e){
10838      if(typeof cO.onmouseover == 'function'){
10839        cO.onmouseover(cO, e);
10840      }  
10841    });
10842  };
10843  
10844  /*Führt onfocusout aus*/
10845  onfocusout(cO){
10846    var self = this;
10847    cO.element.on('focusout.' + cO.id, function(e){
10848      if(typeof cO.onfocusout == 'function'){
10849        setTimeout(() => {
10850          const active = document.activeElement;
10851          if (!jQuery(this).get(0).contains(active)) {
10852        	cO.onfocusout(cO, e);
10853          }
10854        }, 0);
10855      }  
10856    });
10857  };
10858  
10859  /*Führt onfocusin aus*/
10860  onfocusin(cO){
10861    var self = this;
10862    cO.element.on('focusin.' + cO.id, function(e){
10863      if(typeof cO.onfocusin == 'function'){
10864        setTimeout(() => {
10865          const active = document.activeElement;
10866          if(jQuery(this).get(0).contains(active)) {
10867        	cO.onfocusin(cO, e);
10868          }
10869        }, 0);
10870      }  
10871    });
10872  };
10873  
10874  /*Deaktivert für alle focusierbaren Unter-Elemente den Tabindex*/
10875  deactivateTabindex(element){
10876    var focusable = 'input, textarea, select, button, a[href], [tabindex], [aria-role="button"]';
10877    jQuery(element).find(focusable).attr('tabindex', -1);
10878  }
10879  
10880  /*Aktivert für alle focusierbaren Unter-Elemente den Tabindex*/
10881  activateTabindex(element){
10882    var focusable = 'input, textarea, select, button, a[href], [tabindex], [aria-role="button"]';
10883    jQuery(element).find(focusable).attr('tabindex', 0);
10884  }
10885  
10886  /*Setzt auf ein Element den Focus wenn es nicht dem document.activeElement entspricht*/
10887  setFocusToCurElement(elementTarget, options = {}){
10888    var self = this;
10889    var curFocusedE = jQuery(document.activeElement);
10890    var setFocus = false 
10891    if(curFocusedE !== elementTarget && jQuery('#blockPageInner').find(elementTarget).length > 0) setFocus = true;
10892    if(setFocus){
10893      var focusElement = null 
10894      if(self.isFocusableElement(elementTarget)) focusElement = elementTarget;
10895      else focusElement = self.getNextFocusableElement({element: elementTarget});
10896      focusElement.data('tabindex', focusElement.attr('tabindex'));
10897      if(focusElement.length == 1) focusElement.attr('tabindex', 0).focus();
10898      focusElement.data('tabindex') == undefined ? focusElement.removeAttr('tabindex') : focusElement.attr('tabindex', focusElement.data('tabindex'));
10899    }
10900  }
10901   
10902  /*Prüft ob eine element focussierbar ist*/
10903  isFocusableElement(element){
10904    var curE = jQuery(element);
10905    if(curE.length === 0 || curE == null) return false;
10906    var result = true;
10907    if(curE.is(':hidden') || curE.css('visiblity') === 'hidden') result = false;
10908    var nodeName = curE[0].nodeName.toLowerCase();
10909    var tabIndex = curE.attr('tabindex');
10910    const focusableTags = ['input', 'select', 'textarea', 'button', 'object', 'a'];
10911    if(focusableTags.indexOf(nodeName) !== -1){
10912      if(curE.disabled) result = false;
10913      if(nodeName === "a" && !curE.get(0).hasAttribute('href')) result = false;
10914    }
10915    if(tabIndex != null && tabIndex === '-1') result = false;
10916    return result;
10917  }
10918   
10919  /*Setzt wichtige Status zurück*/
10920  reset(cO){
10921    cO.element.data({'leave' : false, 'stop' : false});
10922    cO.leave = false;
10923    cO.stop = false;
10924  }
10925  
10926  /*Prüft ob ein Element das letzte Focussierbare Element in einem Baum ist*/
10927  isLastFocusableElement(cO, element){
10928    var self = this;
10929    var focusable = 'input, textarea, select, button, a[href], [tabindex="0"], [aria-role="button"], video[controls=controls]';
10930    var fE = cO.element.find(focusable).filter(':visible');
10931    var lastFE = fE.last();
10932    if(lastFE.is(element)) return true;
10933    return false;
10934  }
10935  
10936  /*Prüft ob ein Element das erste focussierbare Element in einem Baum ist*/
10937  isFirstFocusableElement(cO, element){
10938    var self = this;
10939    var focusable = 'input, textarea, select, button, a[href], [tabindex="0"], [aria-role="button"], video[controls=controls]';
10940    var fE = cO.element.find(focusable).filter(':visible');
10941    var firstFE = fE.first();
10942    if(firstFE.is(element)) return true;
10943    return false;
10944  }
10945  
10946    /*Gibt das nächste fokussierbare Element einer Baum-Struktur zurück*/
10947  getNextFocusableElement(cO, ancestors = '', noSelf = false){
10948    var self = this;
10949    var focusable = 'input, textarea, select, button, a[href], [tabindex="0"], [aria-role="button"]';
10950    var result    = cO.element;
10951    var nextElements = cO.element.find(focusable);
10952    if(!noSelf && nextElements.length > 0){
10953      result = nextElements.first();
10954    }
10955    else{
10956      ancestors = Array.isArray(ancestors.split("|")) ? ancestors.split('|') : [ancestors];
10957      for (let i = 0; i < ancestors.length; i++) {
10958        var nextElement = cO.element.closest(ancestors[i]).next();
10959        if(nextElement.length > 0 && !wAccessHandler.isFocusableElement(nextElement)){
10960          var nextElements = nextElement.find(focusable);
10961          if(nextElements.length !== 0){
10962            result = nextElements.first();
10963            break;
10964          }
10965        }
10966        else if(nextElement.length > 0){
10967          result = nextElement;
10968          break;
10969        }
10970      }
10971    }
10972    return result;
10973  }
10974  
10975  /*Aktiviert den LayerListener, der auf Events hört außerhalb eines Layers*/
10976  activateLayerListener(cO, e){
10977    var layerE         = cO.element;
10978    var id             = cO.id;
10979    var self           = this;
10980    var eventObject    = jQuery(document);
10981    var focusAfterOpen = null;
10982     
10983    if(self.activeListenerObjects != null && self.activeListenerObjects.indexOf(id) === -1) self.activeListenerObjects.push(id); 
10984    if(self.listenerObjects[id] == null) self.listenerObjects[id] = cO;
10985    if(self.activeListenerObjects.indexOf(id) !== -1){
10986      window.setTimeout(function(){
10987        eventObject.off('keydown.layerListener click.keydown.layerListener').on('keydown.layerListener click.keydown.layerListener', {id : id}, function(e){
10988          
10989          /*Lese hier die Id aus und suche dann das passende LayerObject*/
10990          var layerO    = wAccessHandler.listenerObjects[e.data.id];
10991          var close     = false;
10992          var target    = jQuery(e.target);
10993          var isDesc    = layerO.element.find(target).length > 0;
10994          var isToggler = target.is(layerO.toggler);
10995          var isWall    = layerO.isWall != null ? layerO.isWall : false;
10996          var closeOnClickList = Array.isArray(layerO.closeOnClick) ? layerO.closeOnClick : [layerO.closeOnClick];
10997
10998          /*Diese Deklaration ist notwendig, um zu verhindern, dass der Layer über andere Events (zb Blättern des Banners) geschlossen wird */
10999          var closeOnClick = false;
11000          closeOnClickList.forEach(function(closeOnClickE){
11001            if(closeOnClickE != null && closeOnClickE.is(target)) closeOnClick = true;
11002          });
11003          
11004          if(!isWall && e.type == 'click' && !closeOnClick && !isToggler) close = false;
11005          else if(!isWall && e.type === 'click' && (!isDesc||isToggler|closeOnClick)) close = true; 
11006          else if(!isWall && e.key === 'Enter' && isToggler) close = true; 
11007          else if(!isWall && e.key === 'Escape'){ close = true; }
11008          else if(e.key === 'Tab'){
11009            var focus = false;
11010            if(!isDesc) focus = true;
11011            else if(wAccessHandler.isLastFocusableElement(layerO, target)) focus = true;
11012            if(focus){
11013              e.preventDefault();
11014              if(cO.focusAfterOpen != null) cO.focusAfterOpen.focus(); 
11015              else layerE.attr('tabindex', '0').focus();
11016              e.stopPropagation();
11017              e.stopImmediatePropagation(); 
11018            }
11019          }
11020
11021          if(close){
11022            /*Auf objekteigene Schließenfunktionen prüfen und ausführen*/
11023            if(typeof cO.closeLayer === 'function') cO.closeLayer(cO, e);
11024            else if(cO.toggler != null){ 
11025              self.deactivateLayerListener(cO, e);
11026              cO.toggler.trigger('click');
11027            }
11028          } 
11029
11030          e.stopPropagation();
11031          e.stopImmediatePropagation();
11032        });
11033      }, 10);
11034    }
11035  }
11036  
11037  /*deactiviert den LayerListener, der auf Events hört außerhalb eines Layers*/
11038  deactivateLayerListener(cO, e){
11039    var self = this;
11040    var eventObject = jQuery(document);
11041    self.activeListenerObjects = self.activeListenerObjects.filter(item => item !== cO.id);
11042    eventObject.off('keydown.layerListener click.keydown.layerListener');
11043    if(self.activeListenerObjects.length > 0){
11044      self.activateLayerListener(self.listenerObjects[self.activeListenerObjects[self.activeListenerObjects.length-1]], e);
11045    }
11046  }
11047   
11048};
11049
11050var wAccessHandler = new wClassAccessHandler();
11051var wAccessEvents = [];
11052
11053if(wTexts == null)  var wTexts = [];
11054if(wTexts['de'] == null)  wTexts['de'] = [];
11055if(wTexts['en'] == null)  wTexts['en'] = [];
11056
11057/*
11058  wAccessEvents, werden dem wAccessHandler über addEvent hinzugefügt. 
11059  Können zum Beispiel direkt zugewiesen werden oder über data-accessevent="id"
11060*/
11061
11062/*Suche im Kopfbereich */
11063wAccessEvents['searchbox'] = {
11064  id : 'searchbox',
11065  element  : jQuery('.searchBoxLabel'),
11066  
11067  onclick  : function(cO, e){
11068    if(cO.leave || cO.stop) cO.element.closest('.searchBoxContainer').removeClass('open');
11069    else cO.element.closest('.searchBoxContainer').addClass('open');
11070  },
11071  
11072  onkeydown : {
11073  	keyEscape : {trigger: 'onclick', leave : true},
11074    keyEnter :  {trigger: 'onclick'} 
11075  }
11076};
11077
11078wAccessEvents['searchinput'] = {
11079   id : 'searchinput',
11080   element : jQuery('.searchBoxContainer').find('input.searchTerm'),
11081   onleave : {trigger: 'onclick', stop : true, element : jQuery('.searchBoxLabel'), events: {mouseout : false}}
11082};
11083
11084/*
11085  global.Select
11086  Wird als Grundlage für Elemente verwendet, die über ein individuelles Selectfeld verfügen,  
11087  wie zB. den LanguageSelector verwendet. 
11088*/
11089
11090wAccessEvents['global.select'] = {
11091  id : 'global.selector', 
11092  element          : null, 
11093  containerOptions : [],
11094  isOpened         : false,
11095  
11096  onclick : function(cO, e){
11097    var target = jQuery(e.target);
11098    if(!cO.isOpened && cO.containerOptions.find(target).length === 0) cO.open(cO, e);
11099    else cO.close(cO, e);
11100    
11101    if(cO.isOpened){
11102      cO.element.on('mouseout', function(e){
11103        cO.close(cO, e);
11104      });
11105    }
11106  },
11107
11108  onkeydown : {
11109    keyEnter : { trigger : 'onclick' },
11110    keyTab : function(cO, e){
11111      var target = jQuery(e.target);
11112      var close = false;
11113      /*Target ist innerhalb der EntriesListe */
11114      if(cO.containerOptions.find(target).length > 0){
11115        if(wAccessHandler.isLastFocusableElement({element : cO.containerOptions}, target)) close = true;
11116      }
11117      if(close){
11118        cO.close(cO, e);
11119      }
11120    },
11121    
11122    keyEscape : function(cO, e){
11123      cO.close(cO, e);
11124    }
11125  }
11126};
11127
11128/* Event für den LanguageSelector - basierend auf global.select */
11129/* Event für den LanguageSelector - basierend auf global.select */
11130wAccessEvents['languageSelector'] = Object.assign(wAccessEvents['global.select'], {
11131  id : 'languageSelector',
11132  
11133  onready : function (cO, e){
11134    var langSel = cO.element.find('#languageSelected');
11135    if(langSel.length > 0){
11136      langSel.attr('tabindex', 0).find('span.opener').removeAttr('tabindex');
11137    }
11138    
11139    var langSelectable = cO.element.find('#languageSelectable');
11140    cO.containerOptions = langSelectable;
11141    
11142    cO.onkeydown.tabindex = -1;
11143    return true;
11144  },
11145  
11146  open : function(cO, e){
11147    cO.isOpened = true;
11148    cO.element.addClass('open');
11149  },
11150  
11151  close : function (cO, e){
11152    cO.isOpened = false;
11153    cO.element.removeClass('open');
11154  } 
11155});
11156
11157
11158/*Layer- Events */
11159
11160/*Event für die CookieNotice */
11161wAccessEvents['cookieNotice'] = {
11162  element        : jQuery('#cookieNotice'),
11163  //listener       : wAccessEvents['layerListener'],
11164  toggler        : jQuery('#cookieNotice').find('#cookieNoticeCloser'),
11165  closeOnClick   : [jQuery('#cookieNotice').find('div#cookieNoticeInner')],
11166  focusAfterOpen : jQuery('#cookieNotice').find('div#cookieNoticeInner'),
11167  isActive       : undefined, /*undefined zur Abfrage ob geöffnet*/
11168  
11169  activate : function(cO, options = [], e) {
11170    cO.isActive = true;
11171    cO.isWall = options['isWall'] != null ? options['isWall'] : false;
11172    var focusElement = jQuery('#cookieNoticeCloser');
11173    if(!wAccessHandler.isFocusableElement(focusElement)) focusElement = wAccessHandler.getNextFocusableElement({element : focusElement.next()}, cO.focusOpen);
11174    cO.focusAfterOpen = focusElement;
11175    wAccessHandler.activateLayerListener(cO, e);
11176  },
11177  
11178  deactivate : function(cO,e){
11179    cO.isActive = false;
11180    wAccessHandler.deactivateLayerListener(cO, e);
11181  }
11182  
11183};
11184
11185/*Event für die Inhaltsboxen als Hinweislayer */
11186wAccessEvents['container.box.infoLayerWithToggler'] = {
11187  toggler        : null,
11188  cookieSet      : false,
11189  
11190  onready: function(cO, e){
11191    var id = cO.element.attr('data-infoid') != null ? cO.element.attr('data-infoid') : cO.id;
11192    var curE = cO.element;
11193    curE.prepend('<div class="boxInnerToggler" tabindex="0"></div>');
11194    cO.cookieId = 'hasShownInfo' + id;
11195    cO.showOnlyOnce = curE.attr('data-showonlyonce') != null ? curE.attr('data-showonlyonce') : '';
11196    cO.timeToHideAuto = curE.attr('data-timehideauto') != null ? curE.attr('data-timehideauto') * 1000 : 0;
11197    cO.classToAddAfterTime = curE.attr('data-classtoaddaftertime') != null ? curE.attr('data-classtoaddaftertime') : 'isOpen';
11198    cO.classToRemoveAfterTime = curE.attr('data-classtoremoveaftertime') != null ? curE.attr('data-classtoremoveaftertime') : 'isClosed';
11199    cO.animateAfterTime = curE.attr('data-animateaftertime') != null ? curE.attr('data-animateaftertime') * 1000 : 0;
11200    if(typeof(wEditor) == 'undefined' && document.cookie.indexOf(cO.cookieId + '=1') != -1){
11201      curE.attr('data-hasshownonce', '1');
11202    }
11203    
11204    if(cO.animateAfterTime !== 0 && (cO.showOnlyOnce !== '1' || document.cookie.indexOf(cO.cookieId + '=1') == -1)){
11205      window.setTimeout(function(){
11206        cO.openLayer(cO);
11207      }, cO.animateAfterTime);
11208    }
11209    else cO.openLayer(cO);
11210    
11211    if(cO.timeToHideAuto !== 0){
11212      window.setTimeout(function(){
11213        cO.closeLayer(cO);
11214      }, cO.timeToHideAuto); 
11215    }
11216    
11217    return true;
11218  },
11219  
11220  openLayer : function(cO, e) {
11221    self = this;
11222    cO.element.addClass(cO.classToAddAfterTime).removeClass(cO.classToRemoveAfterTime);
11223    cO.toggler = cO.element.find('.boxInnerToggler');
11224    cO.setCookie(cO, e); 
11225    wAccessHandler.activateLayerListener(cO, e);
11226  },
11227  
11228  closeLayer : function (cO, e){
11229    cO.element.removeClass(cO.classToAddAfterTime).addClass(cO.classToRemoveAfterTime);
11230    cO.setCookie(cO, e); 
11231    wAccessHandler.deactivateLayerListener(cO, e);
11232  },
11233  
11234  setCookie : function(cO, e){
11235    var self = this;
11236    var executeCookieSet = function() {
11237      if(typeof(wEditor) === 'undefined' && !self.cookieSet && !wAccessEvents['cookieNotice'].isActive) {
11238        document.cookie = cO.cookieId + '=1;path=/;sameSite=lax';
11239        self.cookieSet = true;
11240      }
11241    };
11242    if(jQuery('#cookieNotice').length > 0) {
11243      var waitForCookieNotice = function() {
11244        if(typeof wAccessEvents['cookieNotice'].isActive === 'undefined') {
11245          setTimeout(waitForCookieNotice, 100);
11246          return;
11247        }
11248        executeCookieSet();
11249      };
11250      waitForCookieNotice();
11251    } 
11252    else {
11253      executeCookieSet();
11254    }
11255  }
11256};
11257
11258/*
11259  global.listEntry
11260  Wird als Grundlage für Listeeinträge verwendet
11261  
11262*/
11263
11264wAccessEvents['global.listEntry'] = {
11265  accessibilityRules : 'standard',
11266  
11267  onready : function(cO){
11268    if(typeof cO.onBeforeReady == 'function') cO.onBeforeReady(cO);
11269    if(cO.element.find('[href="'+cO.element.attr('data-url')+'"]').length > 0){
11270      cO.element.removeAttr('aria-label').on('click', function(e){
11271        cO.onclick(cO, e);
11272      });
11273      return false;
11274    }
11275    else if(cO.element.find('a').length == 0) cO.element.attr('role', 'link');
11276    return true;
11277  },
11278  
11279  onclick : function(cO, e){
11280    wOpenURL(cO.element.attr('data-url'), cO.element.attr('data-target'), typeof cO.getOpenUrlElement === 'function' ? cO.getOpenUrlElement(cO) : cO.element.get(0));
11281    return false;
11282  },
11283  
11284  onkeydown: {
11285    keyEnter: { trigger: 'onclick' }
11286  }
11287};
11288
11289/*Event für Standard-Listen*/
11290wAccessEvents['default.listEntry'] = Object.assign({
11291  onBeforeReady : function(cO){
11292    if(cO.element.find('[data-accessevent="default.listEntry"]').length == 0) cO.element.removeAttr('onclick'); 
11293  },
11294  
11295  getOpenUrlElement : function(cO){
11296    return cO.element.hasClass('listEntryInner') ? cO.element.parent().get(0) : cO.element.get(0);
11297  }
11298}, wAccessEvents['global.listEntry']);
11299
11300/*Event für Banner-Listen*/
11301wAccessEvents['bannerSlider.listEntry'] = Object.assign({
11302  onBeforeReady : function(cO){
11303    if(cO.element.find('[data-accessevent="bannerSlider.listEntry"]').length == 0) cO.element.removeAttr('onclick').removeAttr('onkeyup').removeAttr('tabindex'); 
11304  },
11305  
11306}, wAccessEvents['global.listEntry']);
11307
11308wAccessEvents['container.box.standard'] = {
11309  accessibilityRules : 'standard',
11310  
11311  onready : function(cO){
11312    var result = true;
11313    if(cO.element.find('[data-accessevent="container.box.standard"]').length == 0) cO.element.removeAttr('onclick').removeAttr('onkeyup').removeAttr('tabindex'); 
11314    if(cO.element.find('[href="'+cO.element.attr('data-url')+'"]').length > 0){
11315      cO.element.removeAttr('aria-label').on('click', function(e){cO.onclick(cO, e);});
11316      result = false;
11317    }
11318    else if(cO.element.find('a').length == 0) cO.element.attr('role', 'link');
11319    return result;
11320  },
11321  
11322  onclick : function(cO, e){
11323    wOpenURL(cO.element.attr('data-url'), cO.element.attr('data-target'), cO.element.get(0));
11324    return false;
11325  },
11326  
11327  onkeydown: {
11328    keyEnter: { trigger: 'onclick' }
11329  }
11330};
11331
11332wAccessEvents['linkList.listEntry'] = {accessibilityRules : 'standard'};
11333wAccessEvents['link.standard']      = {accessibilityRules : 'standard'};
11334
11335wTexts['de']['smartSliderAria_forward'] = 'Vorwärts blättern';
11336wTexts['de']['smartSliderAria_back']    = 'Zurück blättern';
11337
11338wAccessEvents['smartSlider.pageNavi'] = {
11339  onresize : function(cO){ 
11340    cO.element.attr('aria-label', wGetText('smartSliderAria_' + (cO.param != null ? cO.param[0] : '')));
11341    var eCS = cO.element.closest('.elementContainerStandard');
11342    if(eCS.attr('data-numberpages') != '1') cO.element.attr('tabindex', 0); 
11343    else cO.element.removeAttr('tabindex'); 
11344  },
11345  
11346  onkeydown :{
11347    keyEnter: { 
11348      trigger: 'onclick', 
11349      tabindex: '-1',
11350      onafterclick : function(cO, e){
11351        var eCS = cO.element.closest('.elementContainerStandard');
11352        if(eCS.length > 0){
11353          const cI = setInterval(function() {  
11354          if(cO.param == null) clearInterval(cI);
11355          if (eCS.attr('data-moving') != 1){
11356            if(cO.param[0] == 'forward' && eCS.attr('data-islastentry') == 1) eCS.find('[data-accessevent="smartSlider.pageNavi(back)"]').focus();
11357            if(cO.param[0] == 'back' && eCS.attr('data-isfirstentry') == 1) eCS.find('[data-accessevent="smartSlider.pageNavi(forward)"]').focus();
11358            clearInterval(cI);
11359          }}, 200);
11360          setTimeout(function() {clearInterval(cI);}, 800); 
11361        }
11362      }
11363    }
11364  }
11365};
11366
11367/*AccessEvent Lightbox */
11368wAccessEvents['wLightbox'] = {
11369  element     : jQuery('html.wglBox'),
11370  openedByElement  : null, 
11371  elementsRel : null,
11372  parent      : null,
11373  
11374  onready : function(cO, e){
11375    cO.lightbox = jQuery('.wLightbox');
11376    cO.lightbox.attr('tabindex', 0).focus().removeAttr('tabindex');  
11377    cO.moveObject = { next : jQuery('.wLightboxMoverForward'), back : jQuery('.wLightboxMoverBack')};
11378    cO.element.find('.wLightboxPlayer, .wLightboxFullscreen, .wLightboxCloser, .wLightboxMoverBack, .wLightboxMoverForward').attr('tabindex', 0);
11379    cO.closer     = cO.element.find('.wLightboxCloser');
11380    return true;
11381  },
11382  
11383  onkeydown : {
11384    keyTab : function(cO, e){
11385      if(wAccessHandler.isLastFocusableElement({element : cO.lightbox}, jQuery(e.target))){
11386        cO.closer.focus();
11387        event.stopPropagation();
11388        event.stopImmediatePropagation();
11389        event.preventDefault();
11390      }
11391    },
11392    keyArrowLeft: function(cO, e){ if(cO.moveObject.back.length > 0)  cO.move(cO, 'back')}, 
11393    keyArrowRight: function(cO, e){ if(cO.moveObject.next.length > 0) cO.move(cO, 'next')},
11394    keyEnter     : function(cO,e){ 
11395      var target = jQuery(e.target);
11396      if(target.is('.wLightboxMoverForward')) cO.move(cO, 'next');
11397      else if(target.is('.wLightboxMoverBack')) cO.move(cO, 'back');
11398      else if(target.is('.wLightboxPlayer')) target.trigger('click').focus();
11399      else if(target.is('.wLightboxFullscreen')) target.trigger('click').focus();
11400      else if(target.is('.wLightboxCloser')) cO.closeLightbox(cO, e);
11401    },
11402    keyEscape   : function(cO, e){
11403      if(cO.parent != null){
11404        cO.parent.get(0).postMessage({ action: 'closeLightbox' }, '*');
11405      }
11406      else cO.closeLightbox(cO, e);
11407    }
11408  },
11409  
11410  move : function(cO, move){
11411    var curE = jQuery(cO.elementsRel[parseInt(cO.moveObject[move].data('entry'))]);
11412    if(curE.length > 0){
11413      curE.trigger('click');
11414      cO.lightbox.attr('data-lastdirection', move);
11415      cO.moveObject[move].focus();
11416    }
11417  }, 
11418  
11419  closeLightbox : function(cO, e){
11420    wLightboxClose(e);
11421    if(cO.openedByElement != null && cO.openedByElement.length > 0) cO.openedByElement.focus();
11422  } 
11423};
11424
11425wAccessEvents['wLightboxImage'] = jQuery.extend(true, {}, wAccessEvents['wLightbox']);
11426
11427/*Video -- erstelle Deep-Copy von wLightbox und überlagert Funktionen*/
11428wAccessEvents['wLightboxVideo'] = jQuery.extend(true, {}, wAccessEvents['wLightbox']);
11429
11430wAccessEvents['wLightboxVideo'].onkeydown.keyTab = function(cO, e){
11431  var target = jQuery(e.target);
11432  if(cO.lightbox.find('video[controls=controls]').length > 0){
11433    if(e.target.nodeName === 'VIDEO' && wAccessHandler.isLastFocusableElement({element : cO.lightbox}, jQuery(e.target))){
11434      /*Künstlich eingefügtes Element, falls hinter video kein fokussierbares Element enthalten ist.*/
11435      cO.lightbox.find('video').next().prepend('<div style="visiblity:hidden;opacity:0;height:0;width:0;" tabindex="0"></div>');  
11436    }
11437    cO.lightbox.find('video').off('focusout').on('focusout', {event : e, cO : cO}, function(e){
11438      e.preventDefault();
11439      cO.closer.focus();
11440    });
11441  }
11442};
11443
11444/*Iframe -- erstelle Deep-Copy von wLightbox und überlagert Funktionen*/
11445wAccessEvents['wLightboxIframe'] = jQuery.extend(true, {}, wAccessEvents['wLightbox']);
11446
11447wAccessEvents['wLightboxIframe'].onready = function(cO, e){
11448  /*Innerhalb des Iframes*/
11449  if(parent != self){
11450    cO.parent = jQuery(window.parent);
11451  } 
11452  else{
11453    cO.lightbox = jQuery('.wLightbox');
11454    cO.lightbox.attr('tabindex', 0).focus().removeAttr('tabindex');  
11455    cO.moveObject = { next : jQuery('.wLightboxMoverForward'), back : jQuery('.wLightboxMoverBack')};
11456    cO.element.find('.wLightboxCloser, .wLightboxMoverBack, .wLightboxMoverForward').attr('tabindex', 0);
11457    cO.closer     = cO.element.find('.wLightboxCloser');
11458
11459    /*Anmelden Event das auf Message aus der Lightbox hört*/
11460    jQuery(window).on('message.lightbox', {cO : cO}, function(e){
11461      var data = e.originalEvent.data;
11462      var cO   = e.data.cO;
11463      if(data.action == 'focusCloser') cO.closer.attr('tabindex', '0').focus();
11464      else if(data.action == 'closeLightbox') cO.closeLightbox(cO, e);
11465    });
11466    cO.closer.focus();
11467  }
11468  return true;
11469};
11470
11471wAccessEvents['wLightboxIframe'].onkeydown.keyTab = function(cO, e){
11472  /*Innerhalb des Iframes*/
11473  if(cO.parent != null && wAccessHandler.isLastFocusableElement(cO, jQuery(e.target))){
11474    cO.parent.get(0).postMessage({ action: 'focusCloser' }, '*');
11475    event.stopPropagation();
11476    event.stopImmediatePropagation();
11477    event.preventDefault();
11478  }
11479};
11480
11481wAccessEvents['wLightboxIframe'].closeLightbox = function(cO, e){  
11482  wLightboxClose(e);
11483  if(cO.openedByElement != null && cO.openedByElement.length > 0) cO.openedByElement.focus();
11484  jQuery(window).off('message.lightbox');
11485}; 
11486
11487/*Container mit Registerlaschen */
11488wAccessEvents['containerTab'] = {
11489  onready : function(cO){
11490    
11491    cO.element.find('.tabs').children('.tab').each(function(){
11492      aE = jQuery.extend(true, {element : jQuery(this)}, wAccessEvents['containerTab.tab']);
11493      wAccessHandler.addEvent(aE, {'idPrefix' : 'containerTab.tab'});
11494    });
11495   
11496    cO.element.find('.containers').children('.container').each(function(){
11497      aE = jQuery.extend(true, {element : jQuery(this)}, wAccessEvents['containerTab.container']);
11498      wAccessHandler.addEvent(aE, {'idPrefix' : 'containerTab.container'});
11499    });
11500    return true;
11501  },
11502  
11503  onfocusin : function(cO, e){
11504    if(cO.element.data('focusedout') == '1'){
11505      if(cO.element.data('focusedoutlast') == '1') cO.element.find('.tab').last().focus();
11506      wAccessHandler.activateTabindex(cO.element.find('.containerSelected'));
11507      cO.element.data('focusedout', '0').data('focusedoutlast', '0');
11508    }
11509  },
11510  
11511  onfocusout : function(cO, e){
11512    cO.element.data('focusedout', '1');
11513    var lastTab = cO.element.find('.tab').last();
11514    if(jQuery(e.target).attr('id') == lastTab.attr('id')) cO.element.data('focusedoutlast', '1');
11515    wAccessHandler.deactivateTabindex(cO.element.find('.containerSelected'));
11516  }
11517};
11518
11519wAccessEvents['containerTab.tab'] = {
11520  container : null,
11521  tabContainer : null,
11522  
11523  onready : function(cO){
11524    var id = cO.element.attr('id').replace('tab_', 'container_');
11525    if(cO.element.hasClass('.tabSelected')) cO.element.attr('tabindex', '-1');
11526    cO.tabContainer = cO.element.closest('.elementTabContainer');
11527    cO.container = cO.tabContainer.find('#' + id);
11528    cO.element.data('aeid', cO.id);
11529    return true;
11530  },
11531  
11532  onkeydown : {
11533    keyEnter : function(cO, e) { cO.element.trigger('click'); },
11534    keyTab : function(cO, e){
11535      var nextE = null;
11536      var nextFE = null;
11537      if(cO.element.hasClass('tabSelected')){
11538        nextE = cO.container;
11539      }
11540      else if(cO.element.next('.tabSelected').length > 0){
11541        nextE = wAccessHandler.getEvent(cO.element.next('.tabSelected').data('aeid'));
11542        nextE = nextE.container;
11543      }
11544      else if(cO.element.next('.tab').length === 0 && !cO.element.hasClass('.tabSelected')){
11545        nextE = cO.tabContainer.next();
11546      } 
11547      if(nextE !== null){
11548        var nextFE = wAccessHandler.getNextFocusableElement({element : nextE});
11549        if(wAccessHandler.isFocusableElement(nextFE)){
11550          nextFE.focus();
11551          e.preventDefault();
11552          e.stopPropagation();
11553        }
11554      }
11555    },
11556  }
11557};
11558
11559wAccessEvents['containerTab.container'] = {
11560  tab : null,
11561  onready : function(cO){
11562    var id = cO.element.attr('id').replace('container_', 'tab_');
11563    cO.tab = cO.element.closest('.elementTabContainer').find('#' + id);
11564    cO.element.data('aeid', cO.id);
11565    return true;
11566  },
11567  onfocusout : function(cO, e){
11568    if(cO.tab.data('preventFocusOut') !== "1" && cO.tab.next('.tab').length > 0) cO.tab.next('.tab').focus();
11569    cO.tab.data('preventFocusOut', "0");
11570  },
11571  onkeydown : {
11572    tabindex : '-1',
11573    keyTabShift : function(cO, e){
11574      e.preventDefault();
11575      e.stopImmediatePropagation();
11576      var isFirstFE = wAccessHandler.isFirstFocusableElement(cO, jQuery(e.target));
11577      if(isFirstFE && cO.tab.prev('.tab').length > 0) cO.tab.data('preventFocusOut', '1').prev('.tab').focus();
11578    },
11579  }
11580};
11581
11582wAccessEvents['video.intern'] = {
11583  videoControls : null,
11584  isOn : false,
11585  shiftKey : false,
11586  
11587  onready : function(cO, e){
11588    cO.videoControls = cO.element.find('.videoControls');
11589    //cO.element.find('video').attr('tabindex', '-1');
11590    return true;
11591  },
11592  
11593  on : function(cO, e){
11594    cO.init = true;
11595    cO.element.find('*[data-tabindex]').each(function(){
11596      jQuery(this).attr('tabindex', jQuery(this).attr('data-tabindex'));
11597    });
11598    
11599    jQuery(document).off('keydown click').on('keydown click', {cO : cO}, function(e){
11600      var cO = e.data.cO;
11601      var target = e.target;
11602      var reset  = false;
11603      if(e.type == 'keydown' && e.key == 'Tab'){
11604        if(e.shiftKey && wAccessHandler.isFirstFocusableElement(cO, target)) reset = true;
11605        else if(!e.shiftKey && wAccessHandler.isLastFocusableElement(cO, target)) reset = true;
11606      } 
11607      else if(cO.element.find(target).length == 0) reset = true;
11608      if(reset) cO.off(cO, e);
11609    });
11610    
11611  },
11612  
11613  off : function (cO, e){
11614    cO.isOn = false;
11615    cO.shiftKey = e.key != null && e.shiftKey ? true : false;
11616    cO.element.data('initTabindex', false).find('*[data-tabindex]').attr('tabindex', '0');
11617    jQuery(document).off('keydown click');
11618  },
11619    
11620  onfocusin : function(cO, e){
11621    if(cO.videoControls.length > 0 && !cO.isOn) cO.on(cO, e);
11622  },
11623  
11624  onfocusout : function(cO, e){
11625    //focusout steuert nur den focus - der DOM-Baum wird im on-Event zurückgesetzt. 
11626    if(cO.videoControls.length > 0){
11627      var next = null;
11628      if(cO.shiftKey) next = wAccessHandler.getPrevFocusableElement(cO);
11629      else next = wAccessHandler.getNextFocusableElement(cO, '.elementBox|.elementSection', true, true);
11630      next.get(0).focus();
11631    }
11632  }
11633};
11634
11635/*
11636  AccessEventHandler
11637  Meldet für HTML-Elemente die über data-accessevent-Definitionen verfügen, 
11638  die zugehötigen AccessEvents beim AccessHandler an. 
11639 */
11640jQuery.fn.wAccessEventHandler = function(){
11641
11642  if(typeof(wAccessibility) !== 'undefined' && wAccessibility['accessEventHandler'] != null && wAccessibility['accessEventHandler'].active === true){
11643    jQuery(this).each(function(){
11644      var eventId = jQuery(this).attr('data-accessevent');
11645      var param    = [];
11646      if(eventId.indexOf('(') !== -1){
11647        var tmp =  eventId.match(/\(([^)]*)\)/)?.[1] ?? '';
11648        param   = tmp.split('|');
11649        eventId = eventId.split('(')[0];
11650      }
11651      if(wAccessEvents[eventId] != null){
11652        var aeO = Object.assign({}, wAccessEvents[eventId]);
11653        aeO.element = jQuery(this);
11654        if(param.length > 0){
11655          aeO.param = param;
11656        }
11657        var options =  {
11658          'idPrefix' : eventId, 
11659          'accessibilityRules' : wAccessibility['accessEventHandler'] && wAccessibility['accessEventHandler'].accessibilityRules ? wAccessibility['accessEventHandler'].accessibilityRules : 'standard'
11660        };
11661        wAccessHandler.addEvent(aeO, options);
11662      }
11663    });
11664  }
11665};
11666
11667function wDebounce(func, wait){
11668  let timeout;
11669
11670  return function (...args){
11671    const context = this;
11672
11673    clearTimeout(timeout);
11674    timeout = setTimeout(() => {
11675      func.apply(context, args);
11676    }, wait);
11677  };
11678}	
11679
11680function wSetObserverOptions(element){
11681  if(jQuery(element).height()/window.innerHeight > 2){ 
11682    wObserverOptions = {threshold: [0, 0.01, 0.05, 0.5]};
11683  }
11684}

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.