PageSourceSearch

https://desiree-forschung.de/weblication/grid5/gui/scripts/grid.js?av=a9fa3f

js desiree-forschung.de collected 2026-10-04 13:29:46 UTC 182,520 bytes, 5,439 lines download raw bytes

1var ns            = (document.layers) ? 1 : 0;
2var ie            = (document.all) || navigator.userAgent.match(/Trident.*rv\:?\s*\d+\./) ? 1 : 0;
3var edge          = (navigator.userAgent.indexOf("Edge") != -1) ? 1 : 0;
4var dom           = (document.getElementById) ? 1 : 0;
5var mac           = (navigator.platform.indexOf("Mac") != -1) ? 1 : 0;
6var gecko         = (navigator.userAgent.indexOf("Gecko") != -1) ? 1 : 0;
7var iPad          = (navigator.userAgent.indexOf("iPad") != -1) ? 1 : 0;
8var isSafari      = (navigator.userAgent.indexOf("Safari") != -1 && navigator.userAgent.indexOf("Chrome") == -1) ? 1 : 0;
9var firefox       = (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Minefield") != -1 || navigator.userAgent.indexOf("MozillaDeveloperPreview") != -1) ? 1 : 0;
10var chrome        = (navigator.userAgent.indexOf("Chrome") != -1) ? 1 : 0;
11var geckoVers     = parseFloat(navigator.userAgent.replace(/.*rv:(\d+\.\d+).*/, '$1'));
12var geckoVersFull = parseFloat(navigator.userAgent.replace(/.*rv:(\d+)\.(\d+\.\d+).*/, '$1$2'));
13var ieVers        = ie ? (navigator.appVersion.match(/MSIE\s*(\d+\.\d+)/) ? navigator.appVersion.match(/MSIE\s*(\d+\.\d+)/)[1] : navigator.userAgent.match(/Trident.*rv\:?\s*(\d+)\./)[1]) : 0;
14
15var wWindowsOpened  = [];
16
17(function(){
18
19  var wDocument = function(){};
20  var wEvent    = function(){};
21
22  if(!window.Element){
23    Element = function(){};
24  }
25  
26  wDocument.dragMode          = 0;
27  wDocument.dragOnChange      = null
28  wDocument.mouseXStartDrag   = 0;
29  wDocument.mouseYStartDrag   = 0;
30  wDocument.elementXStartDrag = 0;
31  wDocument.elementYStartDrag = 0;
32  wDocument.hasHideBlocker    = false;
33
34  wDocument.mouseX = 0;
35  wDocument.mouseY = 0;
36  wDocument.mouseXAbs = 0;
37  wDocument.mouseYAbs = 0;
38
39  wDocument.eventHandler = {};
40  
41  wDocument.tmp = {};
42  
43  wDocument.body = document.body;
44  
45  wDocument.loadJS = function(src, callbackOnLoad){
46    var scriptElement = document.createElement('script');
47    scriptElement.setAttribute('type', 'text/javascript');
48    scriptElement.setAttribute('src', src);
49    if(typeof(callbackOnLoad) == 'function'){
50      scriptElement.wAddEvent('load', callbackOnLoad);
51    }
52    document.getElementsByTagName('head')[0].appendChild(scriptElement);
53  }
54  
55  wDocument.loadCSS = function(src){
56    var styleElement = document.createElement('link');
57    styleElement.setAttribute('type', 'text/css');
58    styleElement.setAttribute('rel', 'stylesheet');    
59    styleElement.setAttribute('href', src);
60    document.getElementsByTagName('head')[0].appendChild(styleElement);
61  };
62
63  wDocument.element = wDocument.node = function(selector){
64    if(/^[a-zA-Z0-9\-_\:]+$/.test(selector) && !/^(body|html|iframe|script|link|li|ul|div|span|table|tr|td|a|img|picture|figure|p|select|input|textarea|button|source)$/.test(selector)){
65      selector = '#' + selector;
66    }
67
68    return wDocument.elements(selector)[0];
69  };  
70  
71  wDocument.elementOf = function(root, selector){
72    if(/^[a-zA-Z0-9\-_\:]+$/.test(selector) && !/^(body|html|iframe|script|link|li|ul|div|span|table|tr|td|a|img|picture|figure|p|select|input|textarea|button|source)$/.test(selector)){
73      selector = '#' + selector;
74    }         
75    return wDocument.elements(selector, null, root)[0];
76  };  
77
78  wDocument.elements = function(selector, callback, root){
79
80    var i;
81    
82    var rootOfSelector = root || document;
83    
84    if(!selector){
85      return new Array();
86    }    
87
88    if(typeof selector == 'object'){
89      if(selector.tagName || selector.length == undefined){
90        elements = new Array;
91        elements.push(selector);
92        return elements;
93      }
94      else{
95        return selector;
96      }
97    }
98
99    var elementTmp  = null;
100    var elementsTmp = new Array();
101    var elements    = new Array();
102    
103    if(!selector){
104      return new Array();
105    }
106    else if(rootOfSelector.querySelectorAll && !/\/\//.test(selector)){
107      if(/^[a-zA-Z0-9\-_\:]+$/.test(selector) && !/^(body|html|iframe|script|link|li|ul|div|span|table|tr|td|a|img|picture|figure|p|select|input|textarea|button|source)$/.test(selector)){
108        selector = '#' + selector;
109      }     
110
111      try{
112        elementTmp = rootOfSelector.querySelectorAll(selector);
113      }
114      catch(e){
115        console.log('Selector Error: ' + selector);
116
117      }
118      for(i = 0; i < elementTmp.length; i++) {
119        elements.push(elementTmp[i]);
120      }     
121    }
122    else if(/^\*/.test(selector)){
123      elements = document.getElementsByTagName('*');
124    }
125    else if(/^\./.test(selector)){
126      elementsTmp = document.getElementsByTagName('*');
127      var classNameSelector = selector.replace(/^\./, '');
128
129      for(i = 0; i < elementsTmp.length; i++){
130        if((' ' + elementsTmp[i].className + ' ').indexOf(' ' + classNameSelector + ' ') != -1){
131          elements.push(elementsTmp[i]);
132        }
133      }
134    }
135    else if(/^(body|html|li|ul|div|span|table|tr|td|a|picture|figure|img|p|select|input|textarea|source)$/.test(selector)){
136      elements = document.getElementsByTagName(selector);
137    }
138    else if(/^#?\w+/.test(selector)){
139      elementTmp = document.getElementById(selector.replace(/^#/, ''));
140      if(elementTmp){
141        elements.push(elementTmp);
142      }
143    }
144    
145    if(/\[(\w+)\s*(\*)?='([^']*)'/.test(selector)){
146      var name     = RegExp.$1;
147      var operator = RegExp.$2;
148      var value    = RegExp.$3;
149      elementsTmp = elements;
150      elements = new Array();
151      for(i = 0; i < elementsTmp.length; i++){
152        if(operator == ''){
153          if(elementsTmp[i].getAttribute(name) && elementsTmp[i].getAttribute(name) === value){
154            elements.push(elementsTmp[i]);
155          }  
156        }
157        else if(operator == '1'){
158          if(elementsTmp[i].getAttribute(name) && elementsTmp[i].getAttribute(name) !== value){
159            elements.push(elementsTmp[i]);
160          }  
161        }        
162        else if(operator == '*'){
163          if(elementsTmp[i].getAttribute(name) && elementsTmp[i].getAttribute(name).indexOf(value) > -1){
164            elements.push(elementsTmp[i]);
165          }  
166        }
167        else if(operator == '^'){
168          if(elementsTmp[i].getAttribute(name) && elementsTmp[i].getAttribute(name).indexOf(value) === 0){
169            elements.push(elementsTmp[i]);
170          }  
171        }        
172      }
173    }
174    
175    if(typeof callback == 'function'){
176      for(i = 0; i < elements.length; i++){
177        callback(elements[i]);
178      }
179    }
180    else if(typeof callback == 'string'){
181      if(arguments[1] == 'wSetCSS'){
182        wDocument.wSetCSS(elements, arguments[2], arguments[3]);
183      }
184      else if(arguments[1] == 'addClass'){
185        wDocument.wAddClass(elements, arguments[2]);
186      }
187      else if(arguments[1] == 'addEvent'){
188        wDocument.wAddEvent(elements, arguments[2], arguments[3]);
189      }
190      else if(arguments[1] == 'toggleDisplay'){
191        wDocument.toggleDisplay(elements, arguments[2], arguments[3]);
192      }
193    }
194
195    return elements;
196  };
197  
198  wDocument.checkSelector = function(element, selector){
199
200    var result = false;
201
202    if(!selector){
203      result = true;
204    }
205    else if(/^\*/.test(selector)){
206      result = true;
207    }
208    else if(/^\./.test(selector)){
209      var classNameSelector = selector.replace(/^\./, '');
210      if((' ' + element.className + ' ').indexOf(' ' + classNameSelector + ' ') != -1){
211        result = true;
212      }
213    }
214    else if(/^(li|ul|div|span|table|tr|td|a|img|p|select|input|textarea)$/.test(selector)){
215      var tagName = RegExp.$1.toLowerCase();
216      if(element.tagName.toLowerCase() == tagName){
217        result = true;
218      }
219    }
220    else if(/^#?\w+/.test(selector)){
221      var elementId = RegExp.$1.toLowerCase();
222      if(element.id == elementId){
223        result = true;
224      }
225    }
226    
227    if(result && /\[(\w+)\s*([\*\^\!])?='([^']*)'/.test(selector)){
228      result = false; 
229      var name     = RegExp.$1;
230      var operator = RegExp.$2;
231      var value    = RegExp.$3;
232
233      if(operator == ''){
234        if(element.getAttribute(name) && element.getAttribute(name) === value){
235          result = true;
236        }  
237      }
238      else if(operator == '!'){
239        if(element.getAttribute(name) && element.getAttribute(name) !== value){
240          result = true;
241        }  
242      }        
243      else if(operator == '*'){
244        if(element.getAttribute(name) && element.getAttribute(name).indexOf(value) > -1){
245          result = true;
246        }  
247      }
248      else if(operator == '^'){
249        if(element.getAttribute(name) && element.getAttribute(name).indexOf(value) === 0){
250          result = true;
251        }  
252      }        
253    }
254    return result;
255  };
256  
257  wDocument.wParentOrSelf = function(element, selector){
258    
259    if(this != window && this && this.length || this.nodeType){
260      selector = arguments[0];
261      element  = this;
262    }
263
264    var parentElement = element;
265    
266    var timeout = 32;
267    
268    do{
269      if(!parentElement){
270        return null;
271      }
272      if(!selector){
273        return parentElement;
274      }
275      if(wDocument.checkSelector(parentElement, selector)){
276        return parentElement;
277      }
278      parentElement = parentElement.parentNode;      
279
280      timeout--;              
281    }while(timeout > 0 && parentElement.parentNode.nodeType == 1 && parentElement != parentElement.parentNode);
282    return null;
283  };   
284  
285  wDefinePrototypeMethod(Element.prototype, "wParentOrSelf", wDocument.wParentOrSelf);        
286  
287  wDocument.wParent = function(element, selector){
288    
289    if(this != window && this && this.length || this.nodeType){
290      selector = arguments[0];
291      element  = this;
292    }
293
294    var parentElement = element;
295    var timeout = 32;
296    while(timeout > 0 && parentElement.parentNode.nodeType == 1 && parentElement != parentElement.parentNode){
297      parentElement = parentElement.parentNode;
298      if(!selector){
299        return parentElement;
300      }
301      if(wDocument.checkSelector(parentElement, selector)){
302        return parentElement;
303      }
304
305      timeout--;              
306    }
307    return element;
308  };  
309  
310  wDefinePrototypeMethod(Element.prototype, "wParent", wDocument.wParent);          
311
312  wDocument.wAncestor = function(element, selector){
313
314    if(this != window && this && this.length || this.nodeType){
315      selector = arguments[0];
316      element  = this;
317    }
318    
319    var parentElement = element;
320    var timeout = 32;
321    try{
322      while(timeout > 0 && parentElement && parentElement.parentNode.nodeType == 1 && parentElement != parentElement.parentNode){
323        parentElement = parentElement.parentNode;
324        if(!selector){
325          return parentElement;
326        }
327        if(wDocument.checkSelector(parentElement, selector)){
328          return parentElement;
329        }
330  
331        timeout--;
332      }
333    }
334    catch(e){}
335    return null;
336  };
337  
338  wDefinePrototypeMethod(Element.prototype, "wAncestor", wDocument.wAncestor);      
339
340  wDocument.wSetCSS = function(elements, attribute, value, keepOldAsTmp){
341
342    if(this != window && this && this.length || this.nodeType){
343      keepOldAsTmp = arguments[2];
344      value        = arguments[1];
345      attribute    = arguments[0];
346      elements    = wDocument.elements(this);
347    }
348    else{
349      elements = wDocument.elements(elements);
350    }
351    
352    try{
353      attribute = attribute.replace(/-(\w)/, function(match){return match[1].toUpperCase()});
354    }
355    catch(e){
356      
357    }
358    
359    for(var i = 0; i < elements.length; i++){      
360      if(keepOldAsTmp){
361        elements[i].setAttribute('data-styleTmp-' + attribute, elements[i].style[attribute]);
362      }
363      elements[i].style[attribute] = value;
364    }
365    return elements;
366  };
367
368  wDefinePrototypeMethod(Array.prototype, "wSetCSS", wDocument.wSetCSS);
369  wDefinePrototypeMethod(Element.prototype, "wSetCSS", wDocument.wSetCSS);  
370
371  wDocument.wRestoreCSS = function(elements, attribute){
372
373    if(this != window && this && this.length || this.nodeType){
374      attribute    = arguments[0];
375      elements    = wDocument.elements(this);
376    }
377    else{
378      elements = wDocument.elements(elements);
379    }
380
381    attribute = attribute.replace(/-(\w)/, function(match){return match[1].toUpperCase()});
382    for(var i = 0; i < elements.length; i++){
383      elements[i].style[attribute] = elements[i].getAttribute('data-styleTmp-' + attribute);
384    }
385    return elements;
386  };
387
388  wDefinePrototypeMethod(Array.prototype, "wRestoreCSS", wDocument.wRestoreCSS);
389  wDefinePrototypeMethod(Element.prototype, "wRestoreCSS", wDocument.wRestoreCSS);  
390
391  wDocument.wSetClass = function(elements, className){
392
393    if(this != window && this && this.length || this.nodeType){
394      className = arguments[0];
395      elements = wDocument.elements(this);
396    }
397    else{
398      elements = wDocument.elements(elements);
399    }
400
401    for(var i = 0; i < elements.length; i++){
402      elements[i].className = className;
403    }
404    return elements;
405  }; 
406
407  wDefinePrototypeMethod(Array.prototype, "wSetClass", wDocument.wSetClass);
408  wDefinePrototypeMethod(Element.prototype, "wSetClass", wDocument.wSetClass);  
409
410  wDocument.wToggleClass = function(elements, className){
411
412    if(this != window && this && this.length || this.nodeType){
413      className = arguments[0];
414      elements = wDocument.elements(this);
415    }
416    else{
417      elements = wDocument.elements(elements);
418    }
419
420    for(var i = 0; i < elements.length; i++){
421      var classCurr = elements[i].className;
422      if(!classCurr || classCurr === ''){
423        elements[i].className = className;
424      }
425      else if((' ' + classCurr + ' ').indexOf(' ' + className + ' ') == -1){
426        elements[i].className = classCurr + ' ' + className;
427      }
428      else{
429        elements[i].className = (' ' + classCurr + ' ').replace(' ' + className + ' ', ' ').replace(/\s+/, ' ').replace(/^\s+/, '').replace(/\s+$/, '');
430        if(elements[i].className == 'undefined'){
431          elements[i].className = '';
432          elements[i].removeAttribute('class');
433        }
434      }
435    }
436    return elements;
437  };  
438
439  wDefinePrototypeMethod(Array.prototype, "wToggleClass", wDocument.wToggleClass);
440  wDefinePrototypeMethod(Element.prototype, "wToggleClass", wDocument.wToggleClass);  
441
442  wDocument.wAddClass = function(elements, className){
443
444    if(this != window && this && this.length || this.nodeType){
445      className = arguments[0];
446      elements = wDocument.elements(this);
447    }
448    else{
449      elements = wDocument.elements(elements);
450    }
451
452    for(var i = 0; i < elements.length; i++){
453      var classCurr = elements[i].className;
454
455      if(!classCurr || classCurr === ''){
456        elements[i].className = className;
457      }
458      else if((' ' + classCurr + ' ').indexOf(' ' + className + ' ') == -1){
459        elements[i].className = classCurr + ' ' + className;
460      }
461    }
462    return elements;
463  };
464
465  wDefinePrototypeMethod(Array.prototype, "wAddClass", wDocument.wAddClass);
466  wDefinePrototypeMethod(Element.prototype, "wAddClass", wDocument.wAddClass);  
467  
468  wDocument.wRemoveClass = function(elements, className){
469
470    if(this != window && this && this.length || this.nodeType){
471      className = arguments[0];
472      elements = wDocument.elements(this);
473    }
474    else{
475      elements = wDocument.elements(elements);
476    }
477
478    for(var i = 0; i < elements.length; i++){
479      var classCurr = elements[i].className;
480      if(!classCurr || classCurr === ''){       
481      }
482      else if((' ' + classCurr + ' ').indexOf(' ' + className + ' ') != -1){              
483        elements[i].className = (' ' + classCurr + ' ').replace(' ' + className + ' ', ' ').replace(/\s+/, ' ').replace(/^\s+/, '').replace(/\s+$/, '');
484        if(elements[i].className == 'undefined'){
485          elements[i].className = '';
486          elements[i].removeAttribute('class');
487        }
488      }     
489    }
490    return elements;
491  };  
492  
493  wDefinePrototypeMethod(Array.prototype, "wRemoveClass", wDocument.wRemoveClass);
494  wDefinePrototypeMethod(Element.prototype, "wRemoveClass", wDocument.wRemoveClass);  
495
496  wDocument.wHasClass = function(element, className){
497
498    if(this != window && this && this.length || this.nodeType){
499      className = arguments[0];      
500      element = this;
501    }
502    else{
503      element = wDocument.element(element);
504    }    
505    if(!element){
506      return false;
507    }
508    return (' ' + element.className + ' ').indexOf(' ' + className + ' ') != -1 ? true : false;              
509  };   
510
511  wDefinePrototypeMethod(Array.prototype, "wHasClass", wDocument.wHasClass);
512  wDefinePrototypeMethod(Element.prototype, "wHasClass", wDocument.wHasClass); 
513   
514  wDocument.wGetData = function(element, name){
515
516    if(this != window && this && this.length || this.nodeType){
517      name = arguments[0];      
518      element = this;
519    }
520
521    return element.getAttribute('data-' + name.toLowerCase());
522  };  
523  
524  wDefinePrototypeMethod(Element.prototype, "wGetData", wDocument.wGetData);  
525  
526  wDocument.wSetData = function(element, name, value){
527    if(this != window && this && this.length || this.nodeType){
528      value = arguments[1];  
529      name  = arguments[0];   
530      element  = this;
531    }
532    element.setAttribute('data-' + name.toLowerCase(), value);
533  };
534
535  wDefinePrototypeMethod(Element.prototype, "wSetData", wDocument.wSetData);  
536  
537  wDocument.wRemoveData = function(element, name){
538    if(this != window && this && this.length || this.nodeType){
539      value = arguments[1];  
540      name  = arguments[0];   
541      element  = this;
542    }
543    element.removeAttribute('data-' + name.toLowerCase());
544  };    
545
546  wDefinePrototypeMethod(Element.prototype, "wRemoveData", wDocument.wRemoveData);    
547  
548  wDocument.wGetAttribute = function(elements, attributeName){
549
550    if(this != window && this && this.length || this.nodeType){
551      attributeName  = arguments[0];
552      elements = wDocument.elements(this);
553    }
554    else{
555      elements = wDocument.elements(elements);
556    }
557
558    try{
559      return elements[0].getAttribute(attributeName);
560    }
561    catch(e){
562      return '';
563    }
564  };
565
566  wDefinePrototypeMethod(Array.prototype, "wGetAttribute", wDocument.wGetAttribute);
567  wDefinePrototypeMethod(Element.prototype, "wGetAttribute", wDocument.wGetAttribute);   
568
569  wDocument.wSetAttribute = function(elements, attributeName, attributeValue){
570
571    if(this != window && this && this.length || this.nodeType){
572      attributeValue = arguments[1];
573      attributeName  = arguments[0];
574      elements = wDocument.elements(this);
575    }
576    else{
577      elements = wDocument.elements(elements);
578    }
579
580    for(var i = 0; i < elements.length; i++){
581      elements[i].setAttribute(attributeName, attributeValue);
582    }
583    return elements;
584  };
585
586  wDefinePrototypeMethod(Array.prototype, "wSetAttribute", wDocument.wSetAttribute);
587  wDefinePrototypeMethod(Element.prototype, "wSetAttribute", wDocument.wSetAttribute); 
588    
589  wDocument.wGetValue = function(elements){
590
591    if(this != window && this && this.length || this.nodeType){
592      attributeName  = arguments[0];
593      elements = wDocument.elements(this);
594    }
595    else{
596      elements = wDocument.elements(elements);
597    }
598
599    try{
600      if(elements[0].nodeName == 'select'){
601        return elements[0].item(elements[0].selectedIndex).value;
602      }
603      return elements[0].value;
604    }
605    catch(e){
606      return '';
607    }
608  };
609
610  wDefinePrototypeMethod(Array.prototype, "wGetValue", wDocument.wGetValue);
611  wDefinePrototypeMethod(Element.prototype, "wGetValue", wDocument.wGetValue); 
612  
613  wDocument.wSetValue = function(elements, value, triggerOnChange){
614
615    if(this != window && this && this.length || this.nodeType){
616      triggerOnChange = arguments[1];      
617      value           = arguments[0];
618      elements = wDocument.elements(this);
619    }
620    else{
621      elements = wDocument.elements(elements);
622    }
623
624    triggerOnChange = typeof(triggerOnChange) == 'undefined' ? true : triggerOnChange;
625
626    for(var i = 0; i < elements.length; i++){
627      elements[i].value = value;
628      if(triggerOnChange){
629        wDocument.wTriggerEvent(elements[i], 'change');
630      }
631    }
632    return elements;
633  };
634
635  wDefinePrototypeMethod(Array.prototype, "wSetValue", wDocument.wSetValue);
636  wDefinePrototypeMethod(Element.prototype, "wSetValue", wDocument.wSetValue); 
637  
638  wDocument.prepend = function(elements, node){
639
640    var i;
641    
642    if(this != window && this && this.length || this.nodeType){
643      node     = arguments[0];
644      elements = wDocument.elements(this);
645    }
646    else{
647      elements = wDocument.elements(elements);
648    }
649    var nodesToInsert = new Array();
650
651    if(typeof node == 'string'){
652      var nodeInnerHTML = document.createElement('div');
653      nodeInnerHTML.innerHTML = node;
654      for(i = 0; i < nodeInnerHTML.childNodes.length; i++){
655        nodesToInsert.push(nodeInnerHTML.childNodes[i]);
656      }
657    }
658    else{
659      nodesToInsert.push(node);
660    }
661
662    for(i = 0; i < elements.length; i++){
663      for(var j = 0; j < nodesToInsert.length; j++){
664        if(elements[i].childNodes.length > 0){
665          elements[i].insertBefore(nodesToInsert[j], elements[i].firstChild);
666        }
667        else{
668          elements[i].appendChild(nodesToInsert[j]);          
669        }        
670      }
671    }
672    return elements;
673  };
674
675  wDefinePrototypeMethod(Array.prototype, "prepend", wDocument.prepend);
676  wDefinePrototypeMethod(Element.prototype, "prepend", wDocument.prepend); 
677  
678  wDocument.append = function(elements, node){
679
680    if(typeof(elements) === 'undefined'){
681      return elements;
682    }
683
684    var i;
685
686    if(this != window && this && this.length || this.nodeType){
687      node     = arguments[0];
688      elements = wDocument.elements(this);
689    }
690    else{
691      elements = wDocument.elements(elements);
692    }
693    var nodesToInsert = new Array();
694
695    if(typeof node == 'string'){
696      var nodeInnerHTML = document.createElement('div');
697      nodeInnerHTML.innerHTML = node;
698      for(i = 0; i < nodeInnerHTML.childNodes.length; i++){
699        nodesToInsert.push(nodeInnerHTML.childNodes[i]);
700      }
701    }
702    else{
703      nodesToInsert.push(node);
704    }
705
706    for(i = 0; i < elements.length; i++){
707      for(var j = 0; j < nodesToInsert.length; j++){
708        elements[i].appendChild(nodesToInsert[j]);
709      }
710    }
711    return elements;
712  };
713
714  wDefinePrototypeMethod(Array.prototype, "append", wDocument.append);
715    
716  wDocument.addEventListener = wDocument.wAddEvent = function(elements, type, callback){
717
718    var i, j, element, types;
719    if(elements == window || elements == top){
720      elements = new Array(elements);
721    }
722    else if(this && this.length || this.nodeType){
723      callback = arguments[1];
724      type     = arguments[0];
725      elements = wDocument.elements(this);
726    }
727    else{
728      elements = wDocument.elements(elements);
729    }
730    
731    for(i = 0; i < elements.length; i++){
732      try{
733        if(elements[i].addEventListener){
734          types  = type.split(',');
735          for(j = 0; j < types.length; j++){
736            elements[i].addEventListener(types[j].trim(), callback, false); 
737          }
738        }
739        else{
740          element = elements[i];
741          (function(element, event){
742            types  = type.split(',');
743            for(j = 0; j < types.length; j++){
744              elements[i].attachEvent('on' + types[j].replace(/^\s+|\s+$/g, ''), function(event){callback.call(element, event)});
745            }  
746          })(element, event);            
747        }
748      }
749      catch(e){
750        
751      }
752    }
753  };
754
755  wDefinePrototypeMethod(Array.prototype, "wAddEvent", wDocument.wAddEvent);
756  wDefinePrototypeMethod(Element.prototype, "wAddEvent", wDocument.wAddEvent); 
757
758  wDocument.wRemoveEvent = function(elements, type, callback){
759
760    if(elements == window){
761      elements = new Array(window);
762    }
763    else if(typeof(elements) == 'object' && elements === elements.window){
764      elements = new Array(elements);
765    }
766    else if(this && this.length || this.nodeType){
767      callback = arguments[1];
768      type     = arguments[0];
769      elements = wDocument.elements(this);
770    }
771    else{
772      elements = wDocument.elements(elements);
773    }
774
775    for(var i = 0; i < elements.length; i++){
776      try{
777        if(elements[i].removeEventListener){
778          elements[i].removeEventListener(type, callback, false);
779        }
780        else{
781           var element = elements[i];
782           (function(element, event){
783            elements[i].detachEvent('on' + type, function(event){callback.call(element, event)});
784          })(element, event);            
785        }
786      }
787      catch(e){
788      }
789    }
790  };
791  
792  wDocument.addEventElement = function(element, type, callback){
793
794    try{
795      if(element.addEventListener){
796        element.addEventListener(type, callback, false);
797      }
798      else{
799        var ftmp = function(){
800          callback.call(element, event);
801        }
802        element.attachEvent('on' + type, ftmp);
803      }
804    }
805    catch(e){
806
807    }
808  };  
809
810  wDocument.toggleAttribute = function(elements, attribute, defaultStr, altStr){
811
812    if(this != window && this && this.length){
813      options  = arguments[0];
814      elements = wDocument.elements(this);
815    }
816    else{
817      elements = wDocument.elements(elements);
818    }
819
820    for(var i = 0; i < elements.length; i++){
821      var element = elements[i];
822      if(element.getAttribute(attribute)){
823        var value    = element.getAttribute(attribute);
824        if(value == defaultStr){
825          element.setAttribute(attribute, altStr);
826        }
827        else if(value == altStr){
828          element.setAttribute(attribute, defaultStr);
829        }
830        else{
831          var newValue = value.replace(defaultStr, altStr);
832          if(value != newValue){
833            element.setAttribute(attribute, newValue);
834          }
835          else{
836            newValue = value.replace(altStr, defaultStr);
837            element.setAttribute(attribute, newValue);
838          }
839        }
840      }
841    }
842  };
843
844  wDefinePrototypeMethod(Array.prototype, "toggleAttribute", wDocument.toggleAttribute);
845  
846  wDocument.toggleStyle = function(elements, style, defaultStr, altStr){
847
848   if(this && this.length){
849      options  = arguments[0];
850      elements = wDocument.elements(this);
851    }
852    else{
853      elements = wDocument.elements(elements);
854    }
855
856    for(var i = 0; i < elements.length; i++){
857      var element = elements[i];
858      var value    = element.style[style];
859      if(value == defaultStr){
860        element.style[style] = altStr;
861      }
862      else if(value == altStr){
863    	  element.style[style] = defaultStr;
864      }
865      else{
866        var newValue = value.replace(defaultStr, altStr);
867        if(value != newValue){
868          element.style[style] = newValue;
869        }
870        else{
871          newValue = value.replace(altStr, defaultStr);
872          element.style[style] = newValue;
873        }
874      }
875    }
876  };
877
878  wDefinePrototypeMethod(Array.prototype, "toggleStyle", wDocument.toggleStyle);
879  
880  wDocument.toggleDisplay = function(elements, options){
881
882   if(this != window && this && this.length){
883      options  = arguments[0];
884      elements = wDocument.elements(this);
885    }
886    else{
887      elements = wDocument.elements(elements);
888    }
889
890    for(var i = 0; i < elements.length; i++){
891
892      if(wDocument.getCurrentStyle(elements[i], 'display') != 'none'){
893
894        wDocument.hide(elements[i], options);
895      }
896      else{
897        wDocument.show(elements[i], options);
898      }
899    }
900  };
901  
902  wDefinePrototypeMethod(Array.prototype, "toggleDisplay", wDocument.toggleDisplay);  
903  
904  wDocument.wIsDisplayed = function(element){
905
906    if(this != window && this && this.length || this.nodeType){
907      element = this;
908    }
909    else{
910      element = wDocument.element(element);
911    }    
912
913    if(wDocument.getCurrentStyle(element, 'display') != 'none'){
914      return true;
915    }
916    return false;              
917  };  
918
919  wDefinePrototypeMethod(Array.prototype, "wIsDisplayed", wDocument.wIsDisplayed);
920  
921  wDocument.show = function(elements, options){
922
923   if(this != window && this && this.length){
924      options  = arguments[0];
925      elements = wDocument.elements(this);
926    }
927    else{
928      elements = wDocument.elements(elements);
929    }
930
931    for(var i = 0; i < elements.length; i++){
932      var element = elements[i];
933
934      if(element.getAttribute('data-anchorId') != null && element.getAttribute('data-anchorId') != ''){
935        var anchorElement = wDocument.element(element.getAttribute('data-anchorId'));
936        element.style.top  = String(anchorElement.offsetTop) + 'px';
937        element.style.left = String(anchorElement.offsetLeft) + 'px';
938      }
939
940      if(options && options['animate'] == 'height'){
941
942
943        wDocument.animateShowHeight(element, options['height'], options['speed'], options['raster'], options['callback']);
944      }
945      else if(options && options['animate'] == 'fade'){
946
947        wDocument.animateShowFade(element, options['opacity'], options['speed'], options['raster'], options['callback']);
948      }
949
950      try{
951        if(options && typeof options['display'] == 'string'){
952          element.style.display = options['display'];
953        }
954        else{
955          if(typeof element.getAttribute('data-display-orig') == 'string' && element.getAttribute('data-display-orig') != ''){
956            element.style.display = element.getAttribute('data-display-orig');
957          }
958          else if(element.tagName && (element.tagName == 'INPUT' || element.tagName == 'SELECT')){
959            element.style.display = 'inline-block';
960          }
961          else if(element.tagName && element.tagName == 'TR'){
962            element.style.display = 'table-row';
963          }
964          else{          
965            element.style.display = 'block';
966          }
967        }
968
969        if(options && typeof options['bottomMax'] == 'number'){
970          var elementBottom = element.offsetTop + parseInt(element.style.marginTop) + element.offsetHeight;
971          var diffHeight = options['bottomMax'] - elementBottom;
972          if(diffHeight < 0){
973            element.style.marginTop = String(parseInt(element.style.marginTop) + diffHeight) + 'px';
974          }
975        }
976        if(options && typeof options['rightMax'] == 'number'){
977          var elementRight = element.offsetLeft + (element.style.marginLeft == '' ? 0 : parseInt(element.style.marginLeft)) + element.offsetWidth;
978          var diffWidth = options['rightMax'] - elementRight;
979          if(diffWidth < 0){
980            element.style.marginLeft = String((element.style.marginLeft == '' ? 0 : parseInt(element.style.marginLeft)) + diffWidth) + 'px';
981          }
982        }
983      }
984      catch(e){}
985    }
986  };
987
988  wDefinePrototypeMethod(Array.prototype, "show", wDocument.show);
989  
990  wDocument.animateShowFade = function(elements, newOpacity, speed){
991
992    elements = wDocument.elements(elements);
993
994    for(var i = 0; i < elements.length; i++){
995
996      var element = elements[i];
997
998      if(!newOpacity){
999        newOpacity = 1;
1000      }
1001
1002      if(!speed){
1003        speed = 32;
1004      }
1005
1006      var useOpacity = typeof element.style.opacity != 'undefined' ? true : false;
1007
1008      if(element.style.display == 'none'){
1009        element.style.display = 'block';
1010        element.style.opacity = 0;
1011      }
1012
1013      var currentOpacity = useOpacity ? element.style.opacity : element.filters.alpha.opacity / 100;
1014            
1015      if(currentOpacity == ''){
1016        currentOpacity = 0;
1017      }      
1018
1019      var step = 0.1;
1020
1021      if(currentOpacity < newOpacity){
1022        if(step >= newOpacity - currentOpacity){
1023          if(!useOpacity){
1024            element.style.filter = "alpha(opacity=" + (newOpacity * 100) + ")";
1025          }
1026          else{
1027            element.style.opacity = newOpacity;
1028          }
1029        }
1030        else{
1031          if(!useOpacity){
1032            element.style.filter = "alpha(opacity=" + (parseFloat(currentOpacity) + step * 100) + ")";
1033          }
1034          else{
1035            element.style.opacity = parseFloat(currentOpacity) + step;
1036          }
1037          setTimeout(function(){wDocument.animateShowFade(element, newOpacity);}, speed);
1038        }
1039      }
1040      else if(currentOpacity > newOpacity){
1041        if(step >= currentOpacity - newOpacity){
1042          if(!useOpacity){
1043            element.style.filter = "alpha(opacity=" + (newOpacity * 100) + ")";
1044          }
1045          else{
1046            element.style.opacity = newOpacity;
1047          }
1048        }
1049        else{
1050          if(!useOpacity){
1051            element.style.filter = "alpha(opacity=" + (parseFloat(currentOpacity) - step * 100) + ")";
1052          }
1053          else{
1054            element.style.opacity = parseFloat(currentOpacity) + step;
1055          }
1056          setTimeout(function(){wDocument.animateShowFade(element, newOpacity);}, speed);
1057        }
1058      }
1059    }
1060  };
1061
1062  wDefinePrototypeMethod(Array.prototype, "animateShowFade", wDocument.animateShowFade);
1063
1064  wDocument.animateHideFade = function(elements, newOpacity, speed, callback){
1065
1066    elements = wDocument.elements(elements);
1067
1068    for(var i = 0; i < elements.length; i++){
1069
1070      var element = elements[i];
1071
1072      if(!newOpacity){
1073        newOpacity = 0;
1074      }
1075
1076      if(!speed){
1077        speed = 32;
1078      }
1079
1080      var useOpacity = typeof element.style.opacity != 'undefined' ? true : false;
1081
1082      var currentOpacity = useOpacity ? element.style.opacity : element.filters.alpha.opacity / 100;
1083      
1084      if(currentOpacity == ''){
1085        currentOpacity = 1;
1086      }
1087
1088      var step = 0.1;
1089
1090
1091
1092
1093
1094      if(currentOpacity > newOpacity){
1095
1096        if(step >= currentOpacity - newOpacity){
1097          if(!useOpacity){
1098            element.style.filter = "alpha(opacity=" + (newOpacity * 100) + ")";
1099          }
1100          else{
1101            element.style.opacity = newOpacity;
1102          }
1103          if(typeof(callback) == 'function'){
1104            callback();
1105          }
1106        }
1107        else{
1108          if(!useOpacity){
1109            element.style.filter = "alpha(opacity=" + (parseFloat(element.filters.alpha.opacity) + step * 100) + ")";
1110          }
1111          else{
1112            element.style.opacity = Math.round((parseFloat(currentOpacity) - step) * 100) / 100;
1113          }
1114          setTimeout(function(){wDocument.animateHideFade(element, newOpacity, speed, callback);}, speed);
1115        }
1116      }
1117      else if(currentOpacity < newOpacity){
1118        if(step >= newOpacity - currentOpacity){
1119          if(!useOpacity){
1120            element.style.filter = "alpha(opacity=" + (newOpacity * 100) + ")";
1121          }
1122          else{
1123            element.style.opacity = newOpacity;
1124          }
1125          if(typeof(callback) == 'function'){
1126            callback();
1127          }
1128        }
1129        else{
1130          if(!useOpacity){
1131            element.style.filter = "alpha(opacity=" + (parseFloat(element.filters.alpha.opacity) - step * 100) + ")";
1132          }
1133          else{
1134            element.style.opacity = Math.round((parseFloat(currentOpacity) - step) * 100) / 100;
1135          }
1136          setTimeout(function(){wDocument.animateHideFade(element, newOpacity, speed, callback);}, speed);
1137        }
1138      }
1139      else{
1140        if(typeof(callback) == 'function'){
1141          callback();
1142        }
1143      }
1144    }
1145  };
1146
1147  wDefinePrototypeMethod(Array.prototype, "animateHideFade", wDocument.animateHideFade);
1148
1149  wDocument.animateWinHeight = function(newHeight, speed, raster, direction, callback){
1150
1151    if(!raster){
1152      raster = 2;
1153    }
1154
1155    var currentWidth  = getWinWidth();
1156    var currentHeight = getWinHeight();
1157    var tmpHeight     = currentHeight;
1158    var heightDiff    = newHeight - currentHeight;
1159
1160    var steps = new Array();
1161
1162    for(var i = 0; i < 100; i++){
1163      if(newHeight - tmpHeight > 0){
1164        var step = parseInt((tmpHeight - currentHeight) / raster) + 3;
1165        if(step > 48){
1166          step = 48;
1167        }
1168        if(step > newHeight - tmpHeight){
1169          step = newHeight - tmpHeight;
1170        }
1171
1172        tmpHeight = tmpHeight + step;
1173      }
1174      else if(newHeight - tmpHeight < 0){
1175        var step = parseInt((currentHeight - tmpHeight) / raster) + 3;
1176        if(step > 48){
1177          step = 48;
1178        }
1179        if(step > tmpHeight - newHeight){
1180          step = tmpHeight - newHeight;
1181        }
1182
1183        tmpHeight = tmpHeight - step;
1184      }
1185
1186      steps.push(tmpHeight);
1187      if(tmpHeight == newHeight){
1188        break;
1189      }
1190    }
1191
1192    for(var i = 0; i < steps.length; i++){
1193
1194      window.resizeTo(currentWidth, steps[i]);
1195    }
1196
1197  };
1198
1199  wDocument.animateShowHeight = function(elements, newHeight, speed, raster, callback){
1200
1201    elements = wDocument.elements(elements);
1202
1203
1204    for(var i = 0; i < elements.length; i++){
1205
1206      var element = elements[i];
1207
1208      if(typeof newHeight == 'undefined'){
1209        if(element.wGetData('newheight')){
1210          newHeight = element.wGetData('newheight');
1211        }
1212        else{
1213
1214          newHeight = parseInt(/\d+/.test(wDocument.getCurrentStyle(element, 'height')) ? wDocument.getCurrentStyle(element, 'height') : 0);            
1215
1216          if(newHeight == 0){          
1217            var elementTmp = element.cloneNode(true);
1218
1219            elementTmp.style.position   = 'absolute';
1220            elementTmp.style.visibility = 'hidden';
1221            elementTmp.style.display    = 'block';
1222
1223            element.parentNode.insertBefore(elementTmp, element);
1224
1225            newHeight = elementTmp.offsetHeight;
1226
1227
1228
1229            element.parentNode.removeChild(elementTmp);
1230
1231          }       
1232          element.wSetData('newheight', newHeight);
1233        }
1234        element.style.height  = String(0) + 'px';
1235        element.style.display = 'block';           
1236
1237      }
1238
1239      if(!speed){
1240        speed = 32;
1241      }
1242      
1243      if(!raster){
1244        raster = 3;
1245      }    
1246
1247
1248      var currentHeight = parseInt(element.offsetHeight);
1249
1250      var heightDiff = 0;
1251
1252      if(element.style.height != ''){
1253        heightDiff = currentHeight - parseInt(element.style.height);
1254      }
1255
1256
1257      if(currentHeight < newHeight){
1258        var step = parseInt((newHeight - currentHeight) / raster) + 3;
1259        if(step > 64){
1260          step = 64;
1261        }
1262        if(step >= newHeight - currentHeight){
1263          element.style.height = String(newHeight) + 'px';
1264          if(typeof(callback) == 'function'){
1265            callback();
1266          }          
1267        }
1268        else{
1269          element.style.height = String(currentHeight - heightDiff + step) + 'px';
1270          setTimeout(function(){wDocument.animateShowHeight(element, newHeight, speed, raster, callback);}, speed);
1271        }
1272      }
1273      else{
1274        element.wRemoveData('newheight');
1275        element.style.height = String(newHeight) + 'px';
1276        if(typeof(callback) == 'function'){
1277          callback();
1278        }
1279      }
1280    }
1281  };
1282
1283  wDefinePrototypeMethod(Array.prototype, "animateShowHeight", wDocument.animateShowHeight);
1284
1285  wDocument.animateHideHeight = function(elements, newHeight, speed, raster, callback){
1286
1287    elements = wDocument.elements(elements);    
1288
1289    if(!speed){
1290      speed = 32;
1291    }
1292
1293    if(!raster){
1294      raster = 3;
1295    }      
1296
1297    for(var i = 0; i < elements.length; i++){
1298
1299      var element = elements[i];
1300
1301      var currentHeight  = parseInt(element.offsetHeight);
1302
1303
1304      
1305      var animationSteps = isNaN(parseInt(element.wGetData('animationsteps'))) ? 0 : parseInt(element.wGetData('animationsteps'));
1306      var lastHeight     = isNaN(parseInt(element.wGetData('lastheight'))) ? 99 : parseInt(element.wGetData('lastheight'));
1307
1308
1309      if(animationSteps < 16 && currentHeight > newHeight + 3 && currentHeight != lastHeight){
1310        wDocument.wSetCSS(element, 'overflow', 'hidden');
1311        element.wSetData('animationsteps', animationSteps +  1);
1312        element.wSetData('newheight', newHeight);
1313        var step = parseInt((currentHeight - newHeight) / raster) + 3;
1314        if(step > currentHeight - newHeight){
1315          step = currentHeight - newHeight;
1316        }
1317        element.style.height = String(currentHeight -  step) + 'px';
1318        element.wSetData('lastheight', currentHeight);
1319        setTimeout(function(){
1320          wDocument.animateHideHeight(elements, newHeight, speed, raster, callback);
1321        }, speed);
1322      }
1323      else{
1324        element.style.display = 'none';
1325        element.style.height = '';
1326        element.wSetData('newheight', '');
1327        element.wSetData('animationsteps', 0);
1328        wDocument.wRestoreCSS(element, 'overflow');
1329        if(typeof(callback) == 'function'){
1330          callback();
1331        }
1332      }
1333    }
1334  };
1335
1336  wDefinePrototypeMethod(Array.prototype, "animateHideHeight", wDocument.animateHideHeight);
1337  
1338  wDocument.wRemove = function(elements, options){
1339
1340   if(this && this.length){
1341      options  = arguments[0];
1342      elements = wDocument.elements(this);
1343    }
1344    else{
1345      elements = wDocument.elements(elements);
1346    }
1347
1348    for(var i = elements.length - 1; i >= 0; i--){
1349      elements[i].parentNode.removeChild(elements[i]);
1350    }
1351  };
1352
1353  wDefinePrototypeMethod(Array.prototype, "wRemove", wDocument.wRemove);
1354
1355  wDocument.hide = function(elements, options){
1356
1357   if(this && this.length){
1358      options  = arguments[0];
1359      elements = wDocument.elements(this);
1360    }
1361    else{
1362      elements = wDocument.elements(elements);
1363    }
1364    
1365    options = options || {}
1366    
1367    var callbackDelay = function(){
1368      for(var i = 0; i < elements.length; i++){
1369        
1369var element = elements[i];
1370        if(options['animate'] == 'height'){
1371
1372          wDocument.animateHideHeight(element, 0, options['speed'], options['raster'], options['callback']);
1373        }
1374        else if(options['animate'] == 'fade'){
1375
1376          wDocument.animateHideFade(element, 0, options['speed'], options['callback']);
1377        }
1378        else{
1379          if(element.style.display != 'none'){
1380            element.setAttribute('data-display-orig', element.style.display);        
1381          }      
1382          element.style.display = 'none';         
1383        }
1384      }
1385    };
1386    if(options['delay']){
1387      window.setTimeout(callbackDelay, parseInt(options['delay'])); 
1388    }
1389    else{
1390      callbackDelay();  
1391    }
1392  };
1393
1394  wDefinePrototypeMethod(Array.prototype, "hide", wDocument.hide);
1395
1396  wDocument.each = function(elements, callback){
1397
1398   if(this && this.length){
1399      callback = arguments[0];
1400      elements = wDocument.elements(this);
1401    }
1402    else{
1403      elements = wDocument.elements(elements);
1404    }
1405    
1406    callback = callback || function(){};
1407    
1408    for(var i = 0; i < elements.length; i++){
1409      wDocument.currentElement = elements[i];      
1410      element = elements[i];
1411      
1412      (function(callback, element, i){
1413        callback(element, i);
1414      })(callback, element, i);        
1415      
1416    }    
1417  };
1418
1419  wDocument.fadeTo = function(elements, opacity){
1420
1421    elements = wDocument.elements(elements);
1422
1423    for(var i = 0; i < elements.length; i++){
1424      var element = elements[i];
1425      if(element.filters && element.filters.alpha){
1426    	element.filters.alpha.opacity = opacity * 100;
1427      }
1428      else{
1429        element.style.opacity = opacity;
1430      }
1431    }
1432  };
1433
1434  wDefinePrototypeMethod(Array.prototype, "fadeTo", wDocument.fadeTo);
1435  
1436  wDocument.scrollTop = function(elements, newScrollTop, speed, options){
1437
1438    elements = wDocument.elements(elements);
1439    
1440    options = options || {};
1441
1442    for(var i = 0; i < elements.length; i++){
1443
1444      var element = elements[i];
1445
1446      if(!speed){
1447        speed = 32;
1448      }
1449
1450      var step = 0;
1451
1452      
1453      options['timeout'] = options['timeout'] || 0;
1454      
1455      options['timeout'] ++;
1456      
1457      if(options['timeout'] > 16){
1458        return false;
1459      }
1460
1461
1462      var currentScrollTop = parseInt(element.scrollTop);
1463      
1464      if(newScrollTop > element.scrollHeight){
1465        newScrollTop = element.scrollHeight;
1466      }
1467      
1468      var context = null;
1469
1470      if(newScrollTop > currentScrollTop){
1471        step = parseInt((newScrollTop - currentScrollTop) / 3) + 3;
1472        if(step >= newScrollTop - currentScrollTop){
1473          step = newScrollTop - currentScrollTop;
1474          element.scrollTop = currentScrollTop + step;
1475        }
1476        else{
1477          element.scrollTop = currentScrollTop + step;
1478          context = this;
1479          setTimeout(function(){context.scrollTop(element, newScrollTop, speed, options);}, speed);
1480        }
1481      }
1482      else if(newScrollTop < currentScrollTop){
1483        step = parseInt((currentScrollTop - newScrollTop) / 3) + 3;
1484        if(step >= currentScrollTop - newScrollTop){
1485          step = currentScrollTop - newScrollTop;
1486          element.scrollTop = currentScrollTop - step;
1487        }
1488        else{
1489          element.scrollTop = currentScrollTop - step;
1490          context = this;
1491          setTimeout(function(){context.scrollTop(element, newScrollTop, speed, options);}, speed);
1492        }
1493      }
1494    }
1495    return true;
1496  };
1497
1498  wDefinePrototypeMethod(Array.prototype, "scrollTop", wDocument.scrollTop);
1499  
1500  wDocument.wFitInScreen = function(elements, options){
1501
1502    elements = wDocument.elements(elements);
1503
1504    for(var i = 0; i < elements.length; i++){
1505
1506      var element = elements[i];
1507
1508      if(!options){
1509        options = {};
1510      }
1511
1512      if(!options['diffRight']){
1513    	  options['diffRight'] = 0;
1514      }
1515      if(!options['diffBottom']){
1516    	  options['diffBottom'] = 0;
1517      }
1518      if(!options['paddingBottom']){
1519    	  options['paddingBottom'] = 0;
1520      }
1521      if(!options['paddingLeft']){
1522    	  options['paddingLeft'] = 0;
1523      }      
1524
1525      var winWidth     = getWinWidth();
1526      var winHeight    = getWinHeight();
1527      var winTop       = getWinScrollTop() + 0;
1528      var winLeft      = getWinScrollLeft();
1529      var winRight     = winLeft + winWidth - options['diffRight'];
1530      var winBottom    = winTop + winHeight - 0;
1531      var offsetWidth  = element.offsetWidth;
1532      var offsetHeight = element.offsetHeight;
1533      var offsetTop    = wDocument.getOffsetAbsTop(element);
1534      var offsetLeft   = wDocument.getOffsetAbsLeft(element);
1535      var offsetRight  = offsetLeft + offsetWidth;
1536      var offsetBottom = offsetTop + offsetHeight;
1537      var moveByX      = 0;
1538      var moveByY      = 0;
1539      var cssPosition  = wDocument.getCurrentStyle(element, 'position');
1540
1541
1542
1543
1544
1545      
1546      if(options['mode'] == 'abs'){
1547
1548
1549
1550        if(offsetHeight > winHeight - options['diffBottom']){
1551          element.style.height = String(winHeight - options['diffBottom']) + 'px';
1552        }
1553        else{
1554          element.style.height = '';
1555        }
1556      }
1557      else if(options['mode'] == 'minimize'){
1558
1559        if(winBottom < offsetBottom){
1560          element.style.height = String(offsetHeight - (offsetBottom - winBottom) - options['diffBottom']) + 'px';
1561        }
1562        else{
1563          element.style.height = '';
1564        }
1565      }
1566      else{
1567        if(offsetLeft - options['paddingLeft'] < winLeft && cssPosition != 'fixed'){
1568          moveByX = winLeft - offsetLeft - options['paddingLeft'];
1569        }
1570        else if(offsetRight > winRight){
1571    	    moveByX = winRight - offsetRight;
1572        }
1573
1574
1575
1576
1577
1578
1579        if(offsetTop - (options['marginTopElement'] ? options['marginTopElement'] : 0) < winTop && cssPosition != 'fixed'){
1580    	    moveByY = winTop - (offsetTop - (options['marginTopElement'] ? options['marginTopElement'] : 0));
1581
1582        }
1583        else if(offsetBottom + options['paddingBottom'] > winBottom){
1584          moveByY = winBottom - offsetBottom - options['paddingBottom'];
1585
1586
1587
1588
1589
1590
1591        }
1592
1593
1594        if(moveByX != 0 || moveByY != 0){
1595    	    wDocument.wMoveBy(element, moveByX, moveByY);
1596        }
1597      }
1598      
1599      var diffTop = (typeof options['diffTop'] != 'undefined' ? parseInt(options['diffTop']) : 0);
1600      
1601      if(options['overflowTop'] === false && wDocument.getOffsetAbsTop(element) < diffTop){
1602        var diffTopRel = -(parseInt(wDocument.getOffsetAbsTop(element)) - diffTop);
1603        wDocument.wMoveBy(element, 0, diffTopRel);
1604        if(diffTop + element.offsetHeight > winHeight){
1605          if(options['elementToAdaptHeight']){
1606            options['elementToAdaptHeight'].style.height = String(options['elementToAdaptHeight'].offsetHeight - diffTopRel) + 'px';     
1607          }
1608          else{
1609            element.style.height = String(element.offsetHeight - diffTopRel) + 'px';     
1610          } 
1611        }
1612      }
1613    }
1614  };
1615
1616  wDefinePrototypeMethod(Array.prototype, "wFitInScreen", wDocument.wFitInScreen);
1617
1618  wDocument.wMoveBy = function(elements, x, y){
1619
1620    elements = wDocument.elements(elements);
1621
1622    for(var i = 0; i < elements.length; i++){
1623
1624      var element = elements[i];
1625
1626      if(x != 0){
1627        if(element.style.position == 'absolute' && element.style.left != ''){
1628          element.style.left = String(parseInt(element.style.left) + x) + 'px';
1629        }
1630        else{
1631          element.style.marginLeft = String(parseInt(element.style.marginLeft != '' ? element.style.marginLeft : 0) + x) + 'px';
1632        }
1633      }
1634      if(y != 0){
1635        if(element.style.position == 'absolute' && element.style.top != ''){
1636          element.style.top = String(parseInt(element.style.top) + y) + 'px';
1637        }
1638        else{
1639          element.style.marginTop = String(parseInt(element.style.marginTop != '' ? element.style.marginTop : 0) + y) + 'px';
1640        }
1641      }
1642    }
1643  };
1644  
1645  wDefinePrototypeMethod(Array.prototype, "wMoveBy", wDocument.wMoveBy);  
1646
1647  wDocument.focusAndSelectAll = function(elements){
1648
1649    elements = wDocument.elements(elements);
1650
1651    var element = elements[0];
1652
1653    element.select();
1654
1655    var selectionStart = 0;
1656    var selectionEnd   = element.value.length;
1657
1658    if(this.createTextRange){
1659      var selRange = this.createTextRange();
1660      selRange.collapse(true);
1661      selRange.moveStart('character', selectionStart);
1662      selRange.moveEnd('character', selectionEnd);
1663      selRange.select();
1664    }
1665    else if(this.setSelectionRange){
1666      element.setSelectionRange(selectionStart, selectionEnd);
1667    }
1668    else if(this.selectionStart){
1669      element.selectionStart = selectionStart;
1670      element.selectionEnd   = selectionEnd;
1671    }
1672  };�
1673
1674
1675
1676
1677
1678
1679
1680
1681  wDocument.setSelectedSelectbox = function(selectbox, valuesSelected, setSelectedAttribute){
1682
1683    for(var i = 0; i < selectbox.options.length; i++){
1684      for(var j = 0; j < valuesSelected.length; j++){
1685
1686        if(selectbox.options[i].value == valuesSelected[j]){
1687          selectbox.options[i].selected = true;
1688          if(setSelectedAttribute){
1689            selectbox.options[i].setAttribute('selected', 'selected');
1690          }
1691        }
1692        else{
1693          if(setSelectedAttribute){
1694            selectbox.options[i].removeAttribute('selected');
1695          }          
1696        }
1697      }
1698    }
1699  };  
1700  
1701  wDocument.getOffsetAbsReferenceLeft = function(element){
1702
1703    if(typeof element !== 'object'){
1704      element = document.getElementById(element);
1705    }
1706
1707
1708    var offsetAbs = 0;
1709    var currentElement = element.offsetParent;
1710    while(currentElement){
1711      if(wDocument.getCurrentStyle(currentElement, 'position') == 'relative'){
1712        offsetAbs     += currentElement.offsetLeft + (currentElement.style.borderLeftWidth != '' ? + parseInt(currentElement.style.borderLeftWidth) : 0);
1713      }  
1714      currentElement = currentElement.offsetParent;
1715    }
1716
1717    return offsetAbs;
1718  };  
1719
1720  wDocument.getOffsetAbsLeft = function(element, elementRoot){
1721
1722    if(typeof element !== 'object'){
1723      element = document.getElementById(element);
1724    }
1725
1726
1727    if(typeof(elementRoot) == 'undefined'){
1728      elementRoot = document.body;
1729    }
1730    
1731    var offsetAbs = 0;
1732    var currentElement = element;
1733    while(currentElement && currentElement != elementRoot){
1734
1735      offsetAbs     += currentElement.offsetLeft + (currentElement.style.borderLeftWidth != '' ? + parseInt(currentElement.style.borderLeftWidth) : 0);
1736      currentElement = currentElement.offsetParent;
1737    }
1738
1739    return offsetAbs;
1740  };
1741
1742  wDocument.getOffsetAbsLeft2 = function(element, elementRoot){
1743
1744    if(typeof element !== 'object'){
1745      element = document.getElementById(element);
1746    }
1747
1748    if(typeof(elementRoot) == 'undefined'){
1749      elementRoot = document.body;
1750    }
1751
1752    var offsetAbs = 0;
1753    var currentElement = element;
1754    var i = 0;
1755    while(currentElement && currentElement != elementRoot){
1756
1757
1758
1759      offsetAbs     += currentElement.offsetLeft -  (currentElement.style.borderLeftWidth != '' ? + parseInt(currentElement.style.borderLeftWidth) : 0);
1760      currentElement = currentElement.offsetParent;
1761      i++;
1762    }
1763
1764    return offsetAbs;
1765  }
1766  
1767  wDocument.getOffsetAbsReferenceTop = function(element){
1768
1769    if(typeof element !== 'object'){
1770      element = document.getElementById(element);
1771    }
1772
1773
1774    var offsetAbs = 0;
1775    var currentElement = element.offsetParent;
1776    while(currentElement){
1777      if(wDocument.getCurrentStyle(currentElement, 'position') == 'relative'){
1778        offsetAbs     += currentElement.offsetTop + (currentElement.style.borderTopWidth != '' ? + parseInt(currentElement.style.borderTopWidth) : 0);
1779      }  
1780      currentElement = currentElement.offsetParent;
1781    }
1782
1783    return offsetAbs;
1784  };  
1785
1786  wDocument.getOffsetAbsTop = function(element, elementRoot){
1787
1788    if(typeof element !== 'object'){
1789      element = document.getElementById(element);
1790    }
1791    
1792    if(typeof(elementRoot) == 'undefined'){
1793      elementRoot = document.body;
1794    }
1795
1796    var offsetAbs = 0;
1797    var currentElement = element;
1798    var i = 0;
1799    while(currentElement && currentElement != elementRoot){
1800
1801
1802
1803      offsetAbs     += currentElement.offsetTop - (i > 0 ? currentElement.scrollTop : 0) + (currentElement.style.borderTopWidth != '' ? + parseInt(currentElement.style.borderTopWidth) : 0);
1804      currentElement = currentElement.offsetParent;
1805      i++;
1806    }
1807
1808    return offsetAbs;
1809  }
1810
1811  wDocument.getOffsetAbsTop2 = function(element, elementRoot){
1812
1813    if(typeof element !== 'object'){
1814      element = document.getElementById(element);
1815    }
1816
1817    if(typeof(elementRoot) == 'undefined'){
1818      elementRoot = document.body;
1819    }
1820
1821    var offsetAbs = 0;
1822    var currentElement = element;
1823    var i = 0;
1824    while(currentElement && currentElement != elementRoot){
1825
1826
1827
1828      offsetAbs     += currentElement.offsetTop -  (currentElement.style.borderTopWidth != '' ? + parseInt(currentElement.style.borderTopWidth) : 0);
1829      currentElement = currentElement.offsetParent;
1830      i++;
1831    }
1832
1833    return offsetAbs;
1834  }
1835  
1836
1837  wDocument.getOffsetAbsTopSuggest = function(element, elementRoot){
1838
1839    
1840    if(wDocument.wIsChildOf(element, wDocument.element('#wEditorConfigExpanded'))){
1841      return wDocument.getOffsetAbsTopSelectboxVariant(element, elementRoot);
1842    }  
1843    else{  
1844      if(typeof element !== 'object'){
1845        element = document.getElementById(element);
1846      }
1847  
1848      if(typeof(elementRoot) == 'undefined'){
1849        elementRoot = document.body;
1850      }
1851  
1852      var offsetAbs = 0;
1853      var currentElement = element;
1854      var i = 0;
1855      while(currentElement && currentElement != elementRoot){
1856
1857
1858
1859        offsetAbs     += currentElement.offsetTop -  (currentElement.style.borderTopWidth != '' ? + parseInt(currentElement.style.borderTopWidth) : 0);
1860        currentElement = currentElement.offsetParent;
1861        i++;
1862      }
1863
1864      return offsetAbs;
1865    }
1866  }
1867  
1868  wDocument.getOffsetAbsTopSelectboxVariant = function(element, elementRoot){
1869
1870
1871
1872    if(typeof element !== 'object'){
1873      element = document.getElementById(element);
1874    }
1875
1876    if(typeof(elementRoot) == 'undefined'){
1877      elementRoot = document.body;
1878    }
1879
1880    var offsetAbs = 0;
1881    var currentElement = element;
1882    var i = 0;
1883    var currentCssPosition = '';
1884    var lastCssPosition    = '';
1885    var offsetAbsAll = 0;
1886
1887    var currentElements = new Array();
1888
1889    while(currentElement && currentElement != elementRoot){
1890      currentElements.push(currentElement);
1891      currentElement = currentElement.parentNode;
1892      i++;
1893    }
1894    
1895    for(i = currentElements.length - 2; i >= 0; i--){
1896      currentElement     = currentElements[i];
1897      currentCssPosition = wDocument.getCurrentStyle(currentElement, 'position');
1898
1899      if(lastCssPosition == 'static'){
1900        offsetAbs = currentElement.offsetTop - currentElement.scrollTop + (currentElement.style.borderTopWidth != '' ? + parseInt(currentElement.style.borderTopWidth) : 0);
1901      }
1902      else{
1903        offsetAbsAll += currentElement.offsetTop - currentElement.scrollTop + (currentElement.style.borderTopWidth != '' ? + parseInt(currentElement.style.borderTopWidth) : 0);
1904      }
1905
1906
1907      lastCssPosition = currentCssPosition;
1908    }
1909
1910    offsetAbsAll += offsetAbs;
1911
1912    return offsetAbsAll;
1913  }
1914
1915  wDocument.getOffsetAbsTopRaw = function(element, elementRoot){
1916
1917    if(typeof element !== 'object'){
1918      element = document.getElementById(element);
1919    }
1920
1921    var clientRect = element.getBoundingClientRect();
1922    return clientRect.top;   
1923  }
1924
1925  wDocument.isPositionFixed = function(element){
1926
1927    if(typeof element !== 'object'){
1928      element = document.getElementById(element);
1929    }
1930
1931    var currentElement = element;
1932    while(currentElement.parentNode && currentElement.parentNode.nodeName != 'BODY'){
1933      if(wDocument.getCurrentStyle(currentElement, 'position') == 'fixed'){
1934        return true;
1935      }
1936      currentElement = currentElement.parentNode;
1937    }
1938    return false;
1939  };
1940
1941  wDocument.getCurrentStyle = function(element, name){
1942
1943    if(typeof element !== 'object'){
1944      element = wDocument.element(element);
1945    }
1946
1947    if(element.currentStyle){
1948      return element.currentStyle[name];
1949    }
1950    else{
1951      return document.defaultView.getComputedStyle(element, null).getPropertyValue(name);
1952    }
1953  };
1954
1955  wDocument.getScrollTop = function(element){
1956
1957    if(typeof element !== 'object'){
1958      element = document.getElementById(element);
1959    }
1960    return element.scrollTop;
1961  };
1962
1963  wDocument.setUnselectable = function(elements){
1964
1965    elements = wDocument.elements(elements);
1966
1967    for(var i = 0; i < elements.length; i++){
1968      if(elements[i].nodeType == 1){
1969        elements[i].style.MozUserSelect = 'none';
1970        var elementChild = elements[i].firstChild;
1971        while(elementChild){
1972          if(elementChild.nodeType == 1){
1973            wDocument.setUnselectable(elementChild);
1974          }
1975          elementChild = elementChild.nextSibling;
1976        }
1977      }
1978    }
1979  };
1980
1981  wDocument.setCurrentScrollposition = function(){
1982    
1983  };
1984
1985  wDocument.slider = function(elements, options){
1986
1987    if(this && this.length || this.nodeType){
1988      options  = arguments[0];
1989      elements = wDocument.elements(this);
1990    }
1991    else{
1992      elements = wDocument.elements(elements);
1993    }
1994
1995    if(options == undefined){
1996      options = {};
1997    }
1998
1999    for(var i = 0; i < elements.length; i++){
2000
2001      var element      = elements[i];
2002      var optionsLocal = options;
2003
2004      if(optionsLocal['value'] == undefined){
2005        optionsLocal['value'] = element.getAttribute('data-value');
2006        if(optionsLocal['value'] == undefined){
2007          optionsLocal['value'] = 100;
2008        }
2009      }
2010      
2011      if(optionsLocal['min'] == undefined){
2012        optionsLocal['min'] = element.getAttribute('data-min');
2013        if(optionsLocal['min'] == undefined){
2014          optionsLocal['min'] = 0;
2015        }
2016      }      
2017
2018      if(optionsLocal['max'] == undefined){
2019        optionsLocal['max'] = element.getAttribute('data-max');
2020        if(optionsLocal['max'] == undefined){
2021          optionsLocal['max'] = 100;
2022        }
2023      }
2024
2025      if(optionsLocal['steps'] == undefined){
2026       optionsLocal['steps'] = element.getAttribute('data-steps');
2027        if(optionsLocal['steps'] == undefined){
2028          optionsLocal['steps'] = optionsLocal['max'];
2029        }
2030      }
2031
2032      if(optionsLocal['theme'] == undefined){
2033       optionsLocal['theme'] = element.getAttribute('data-theme');
2034        if(optionsLocal['theme'] == undefined){
2035          optionsLocal['theme'] = '';
2036        }
2037      }
2038
2039      if(optionsLocal['onChange'] == undefined){
2040        optionsLocal['onChange'] = element.getAttribute('data-onChange');
2041        if(optionsLocal['onChange'] == undefined){
2042          optionsLocal['onChange'] = function(){};
2043        }
2044      }
2045
2046      if(optionsLocal['direction'] == undefined){
2047        optionsLocal['direction'] = element.getAttribute('data-direction');
2048      }
2049
2050      wDocument.wAddClass(element, 'wui-slider' + (optionsLocal['theme'] != '' ? '-' + optionsLocal['theme'] : '') + (optionsLocal['direction'] == 'vertical' ? '-v' : ''));
2051      wDocument.wAddEvent(element, 'mousedown', function(event){
2052        var clickX = 0;
2053        var clickY = 0;
2054        if(event.offsetX != undefined){
2055          clickX   = event.offsetX;
2056          clickY   = event.offsetY;
2057        }
2058        else if(event.layerX != undefined){
2059          clickX   = event.layerX;
2060          clickY   = event.layerY;
2061        }
2062        else{
2063          clickX    = event.clientX;
2064          clickY    = event.clientY;
2065        }
2066        wDocument.setValueSliderClick(this, clickX, clickY);
2067      });
2068
2069      element.setAttribute('data-max', optionsLocal['max']);
2070      element.setAttribute('data-min', optionsLocal['min']);
2071      element.setAttribute('data-steps', optionsLocal['steps']);
2072      element.setAttribute('data-direction', optionsLocal['direction']);
2073      var eventHandlerID = parseInt(Math.random() * 1000000);
2074      element.setAttribute('data-wEuid', eventHandlerID);
2075      wDocument.eventHandler[eventHandlerID] = optionsLocal['onChange'];
2076
2077      wDocument.append(element, '<div class="wui-slider' + (optionsLocal['theme'] != '' ? '-' + optionsLocal['theme'] : '') + (optionsLocal['direction'] == 'vertical' ? '-v' : '') + '-handle"></div>');
2078      if(element.firstChild && element.firstChild.nodeType && element.firstChild.nodeType == 8){
2079        element.firstChild.parentNode.removeChild(element.firstChild);
2080      }
2081      wDocument.elements(element.firstChild).wAddEvent('mousedown', function(event){
2082
2083        event.stopPropagation();
2084        wDocument.startDrag(this, {'onmove' : wDocument.onMouseMoveSlider});
2085      });
2086
2087      if(optionsLocal['value'] != undefined){
2088        element.setAttribute('data-value', optionsLocal['value']);
2089        wDocument.setValueSlider(element, optionsLocal['value']);
2090      }
2091
2092      element = elements[i];
2093    }
2094  };
2095
2096  wDefinePrototypeMethod(Array.prototype, "slider", wDocument.slider);
2097  wDefinePrototypeMethod(Element.prototype, "slider", wDocument.slider);  
2098
2099  wEvent.wGetSrcElement = function(eventObject){
2100
2101    if(!eventObject){
2102      return null;
2103    }
2104   
2105    return eventObject.srcElement || eventObject.target || eventObject.relatedTarget;
2106  };
2107
2108  wDocument.setValueSliderClick = function(element, clickX, clickY){
2109
2110    var width     = element.offsetWidth - 2;
2111    var height    = element.offsetHeight - 2;
2112    var min       = wDocument.wGetAttribute(element, 'data-min');
2113    var max       = wDocument.wGetAttribute(element, 'data-max');
2114    var direction = wDocument.wGetAttribute(element, 'data-direction');
2115
2116    var position = clickX;
2117    if(direction == 'vertical'){
2118      position = clickY;
2119    }
2120
2121    var size = width;
2122    if(direction == 'vertical'){
2123      size = height;
2124    }
2125
2126
2127    var valueNew     = Math.round(position / size * max);
2128
2129    wDocument.setValueSlider(element, valueNew);
2130  };
2131
2132  wDocument.setValueSlider = function(element, valueNew){
2133
2134    var width     = element.offsetWidth == 0 ? parseInt(element.style.width) - 2 : element.offsetWidth - 2;
2135    var height    = element.offsetHeight == 0 ? parseInt(element.style.height) - 2 : element.offsetHeight- 2;
2136    var min       = wDocument.wGetAttribute(element, 'da
2136ta-min');    
2137    var max       = wDocument.wGetAttribute(element, 'data-max');
2138    var direction = wDocument.wGetAttribute(element, 'data-direction');
2139    var steps     = wDocument.wGetAttribute(element, 'data-steps');
2140
2141    var size = width;
2142    if(direction == 'vertical'){
2143      size = height;
2144    }
2145
2146
2147
2148
2149    var valueRaster = valueNew;
2150
2151    if(steps != undefined && steps != '' && steps != 0){
2152      var raster = max / steps;
2153      valueRaster = Math.round(valueNew / raster) * raster;
2154    }
2155
2156    var positionStep = valueRaster * size / max;
2157    
2158    if(positionStep < min){
2159      positionStep = min;
2160    }
2161
2162
2163    if(direction == 'vertical'){
2164      element.firstChild.style.top = String(positionStep - 1) + 'px';
2165    }
2166    else{
2167      element.firstChild.style.left = String(positionStep - 1) + 'px';
2168
2169    }
2170    wDocument.wSetAttribute(element, 'data-value', valueRaster);
2171    var uid = wDocument.wGetAttribute(element, 'data-weuid');
2172
2173      wDocument.eventHandler[uid](element);
2174
2175  };
2176
2177  wDocument.onChangeSlider = function(position){
2178
2179    var min       = wDocument.wGetAttribute(wDocument.elementDragged.parentNode, 'data-min');
2180    var max       = wDocument.wGetAttribute(wDocument.elementDragged.parentNode, 'data-max');
2181    var direction = wDocument.wGetAttribute(wDocument.elementDragged.parentNode, 'data-direction');
2182
2183    var size = 0;
2184    if(direction == 'vertical'){
2185      size = wDocument.elementDragged.parentNode.offsetHeight - 2;
2186    }
2187    else{
2188      size = wDocument.elementDragged.parentNode.offsetWidth - 2;
2189    }
2190
2191    var valueNew     = Math.round(max / size * position);
2192
2193    if(valueNew < min){
2194      valueNew = min;
2195    }
2196
2197    wDocument.setValueSlider(wDocument.elementDragged.parentNode, valueNew);
2198  };
2199  
2200  wDocument.makeDraggable = function (panel, handle) {
2201    let isDragging = false;
2202    let startX, startY, origLeft, origTop;
2203
2204    handle.addEventListener('mousedown', (e) => {
2205      isDragging = true;
2206      const rect = panel.getBoundingClientRect();
2207      startX = e.clientX;
2208      startY = e.clientY;
2209      origLeft = rect.left;
2210      origTop = rect.top;
2211      panel.style.right = 'auto';
2212      panel.style.bottom = 'auto';
2213      panel.style.left = origLeft + 'px';
2214      panel.style.top = origTop + 'px';
2215      e.preventDefault();
2216    });
2217
2218    document.addEventListener('mousemove', (e) => {
2219      if (!isDragging) return;
2220      panel.style.left = (origLeft + e.clientX - startX) + 'px';
2221      panel.style.top = (origTop + e.clientY - startY) + 'px';
2222    });
2223
2224    document.addEventListener('mouseup', () => { isDragging = false; });
2225  }  
2226  
2227  wDocument.wDraggable = function(elements, options){
2228    
2229    if(this && this.length || this.nodeType){
2230      options  = arguments[0];
2231      elements = wDocument.elements(this);
2232    }
2233    else{
2234      elements = wDocument.elements(elements);
2235    }
2236    
2237    for(var i = 0; i < elements.length; i++){
2238      elements[i].wAddEvent('mousedown', function(event){
2239        event.stopPropagation();
2240        wDocument.startDrag(this, {'onAfterStartDrag' : options['onAfterStartDrag'], 'onAfterEndDrag' : options['onAfterEndDrag']});
2241      });
2242    }  
2243  };
2244  
2245  wDefinePrototypeMethod(Element.prototype, "wDraggable", wDocument.wDraggable);  
2246  
2247  wDocument.startDrag = function (element, options){
2248
2249    if(element != wDocument.dragedElement){
2250      wDocument.dragMode = 0;
2251    }
2252
2253
2254    wDocument.elementDragged     = element;
2255
2256    if(options['dragMode'] == 'absDefault'){
2257      var elementDragedTmp = element.cloneNode(true);
2258
2259      wDocument.fadeTo(elementDragedTmp, 0.2);
2260      wDocument.elementDragged.parentNode.insertBefore(elementDragedTmp, wDocument.elementDragged);
2261      wDocument.wSetCSS(wDocument.elementDragged, 'zIndex', '12000', true);
2262      wDocument.wSetCSS(wDocument.elementDragged, 'width', String(wDocument.elementDragged.offsetWidth) + 'px', true);
2263      wDocument.wSetCSS(wDocument.elementDragged, 'height', String(wDocument.elementDragged.offsetHeight) + 'px', true);
2264      wDocument.wSetCSS(wDocument.elementDragged, 'backgroundColor', 'white', true);
2265      wDocument.wSetCSS(wDocument.elementDragged, 'position', 'absolute', true);
2266      var divsInElement = wDocument.elementDragged.getElementsByTagName('DIV');
2267      for(var i = 0; i < divsInElement.length; i++){
2268        if(divsInElement[i].getAttribute('data-wdocumentordered')){
2269          wDocument.hide(divsInElement[i]);
2270        }        
2271      }
2272    }
2273
2274
2275
2276    wDocument.elementXStartDrag        = wDocument.elementDragged.style.left != '' ? parseInt(wDocument.elementDragged.style.left) : 0;    
2277    wDocument.elementYStartDrag        = wDocument.elementDragged.style.top != '' ? parseInt(wDocument.elementDragged.style.top) : 0;
2278
2279    wDocument.elementXOffsetReferenceStartDrag = wDocument.getOffsetAbsReferenceLeft(wDocument.elementDragged);
2280    wDocument.elementYOffsetReferenceStartDrag = wDocument.getOffsetAbsReferenceTop(wDocument.elementDragged);
2281
2282    wDocument.elementXOffsetStartDrag  = wDocument.getOffsetAbsLeft(wDocument.elementDragged);
2283    wDocument.elementYOffsetStartDrag  = wDocument.getOffsetAbsTop(wDocument.elementDragged);   
2284    
2285    if(typeof options['onAfterStartDrag'] == 'function'){
2286      options['onAfterStartDrag']();
2287    }
2288
2289    document.onmousemove         = typeof options['onmove'] == 'function' ? options['onmove'] : function(event){
2290
2291      
2292      if(document.all){
2293        wDocument.mouseX    = event.clientX;
2294        wDocument.mouseY    = event.clientY;
2295        wDocument.mouseXAbs = event.clientX + document.documentElement.scrollLeft;
2296        wDocument.mouseYAbs = event.clientY + document.documentElement.scrollTop;
2297      }
2298      else{
2299        wDocument.mouseX    = event.pageX;
2300        wDocument.mouseY    = event.pageY;
2301        wDocument.mouseXAbs = event.pageX;
2302        wDocument.mouseYAbs = event.pageY;
2303      }
2304
2305      if(wDocument.dragMode == 0){
2306        wDocument.mouseXStartDrag = wDocument.mouseX
2307        wDocument.mouseYStartDrag = wDocument.mouseY;
2308        wDocument.dragMode = 1;
2309      }
2310
2311      wDocument.elementDragged.style.left = String(wDocument.elementXStartDrag + (wDocument.mouseX - wDocument.mouseXStartDrag)) + 'px';
2312      wDocument.elementDragged.style.top = String(wDocument.elementYStartDrag + (wDocument.mouseY - wDocument.mouseYStartDrag)) + 'px';
2313    };
2314    
2315    if(typeof options['onAfterEndDrag'] == 'function'){
2316      document.onmouseup = options['onAfterEndDrag'];
2317      wDocument.wAddEvent(document, 'mouseup', wDocument.onMouseUp);
2318    }
2319    else{
2320      document.onmouseup         = options['onmouseup'] ? options['onmouseup'] : wDocument.onMouseUp;      
2321    }    
2322    document.onselectstart       = function(){return false;}
2323  };
2324
2325  wDocument.onMouseMoveSlider = function(e){
2326
2327    if(document.all){
2328      e = event;
2329      wDocument.mouseX    = event.clientX;
2330      wDocument.mouseY    = event.clientY;
2331
2332      wDocument.mouseXAbs = event.clientX + document.documentElement.scrollLeft;
2333      wDocument.mouseYAbs = event.clientY + document.documentElement.scrollTop;
2334    }
2335    else{
2336      wDocument.mouseX    = e.pageX;
2337      wDocument.mouseY    = e.pageY;
2338      wDocument.mouseXAbs = e.pageX;
2339      wDocument.mouseYAbs = e.pageY;
2340    }
2341
2342    if(wDocument.dragMode == 0){
2343      wDocument.mouseXStartDrag = wDocument.mouseX - wDocument.elementDragged.offsetLeft - 8;
2344      wDocument.mouseYStartDrag = wDocument.mouseY - wDocument.elementDragged.offsetTop - 8;
2345      wDocument.dragMode = 1;
2346    }
2347
2348    var direction = wDocument.wGetAttribute(wDocument.elementDragged.parentNode, 'data-direction');
2349
2350
2351    if(direction == 'vertical'){
2352      position =  wDocument.mouseY - wDocument.mouseYStartDrag;
2353      if(position < 0){
2354        position = 0;
2355      }
2356      if(position > wDocument.elementDragged.parentNode.offsetHeight - 2){
2357        position = wDocument.elementDragged.parentNode.offsetHeight - 2;
2358      }
2359
2360      wDocument.onChangeSlider(position);
2361    }
2362    else{
2363      position =  wDocument.mouseX - wDocument.mouseXStartDrag;
2364      if(position < 0){
2365        position = 0;
2366      }
2367      if(position > wDocument.elementDragged.parentNode.offsetWidth - 2){
2368        position = wDocument.elementDragged.parentNode.offsetWidth - 2;
2369      }
2370      wDocument.onChangeSlider(position);
2371    }
2372  };
2373
2374  wDocument.onMouseUp = function(){
2375    document.onmousemove = function(){};
2376    document.onselectstart = function(){return true;}
2377  }
2378
2379  wDocument.getCookieValue = function(name){
2380
2381    var regExp = new RegExp(name+'=([^;]*)');
2382    if(regExp.test(document.cookie)){
2383      regExp.exec(document.cookie);
2384      return RegExp.$1;
2385    }
2386    else{
2387      return '';
2388    }
2389  }
2390
2391  wDocument.wLayer = function(elements, options){
2392
2393    if(this && this.length || this.nodeType){
2394      options  = arguments[0];
2395      elements = wDocument.elements(this);
2396    }
2397    else{
2398      elements = wDocument.elements(elements);
2399    }
2400
2401    for(var i = 0; i < elements.length; i++){
2402      var id = elements[i].id;
2403      if(id){
2404        elements[i].removeAttribute('id');
2405        elements[i].style.display = 'block';
2406        wDocument.wAddEvent(elements[i], 'mouseover', function(event){event.stopPropagation()});
2407        wDocument.wWrap(elements[i], '<div class="wglLayer" id="' + id + '" data-anchorID="' + options['anchor'] + '" style="display:none;position:absolute;margin:-10px;padding:10px;" onmouseover="wDocument.hide(this)"/>');
2408      }
2409    }
2410  }
2411
2412  wDefinePrototypeMethod(Array.prototype, "wLayer", wDocument.wLayer);
2413  wDefinePrototypeMethod(Element.prototype, "wLayer", wDocument.wLayer);    
2414
2415  wDocument.wTriggerEvent = function(elements, eventName){
2416
2417
2418    if(this && this.length || this.nodeType){
2419      eventName  = arguments[0];
2420      elements = wDocument.elements(this);
2421    }
2422    else{
2423      elements = wDocument.elements(elements);
2424    }
2425
2426    for(var i = 0; i < elements.length; i++){    
2427
2428
2429
2430
2431
2432
2433      try{
2434  
2435        if(typeof elements[i]['on' + eventName] == 'function'){
2436          elements[i]['on' + eventName].call(elements[i]);
2437        }
2438        else if(document.createEvent){
2439          var htmlEvent = document.createEvent("HTMLEvents");
2440          htmlEvent.initEvent(eventName, false, true);
2441          if(elements[i].alert && elements[i].document){
2442            window.dispatchEvent(htmlEvent);
2443          }
2444          else{
2445            elements[i].dispatchEvent(htmlEvent);
2446          }
2447        }
2448        else if(document.createEventObject){
2449          var eventObject = document.createEventObject();
2450          elements[i].fireEvent('on' + eventName, eventObject);
2451        }
2452      }
2453      catch(e){
2454        console.log(e);
2455        if(/cross-origin/.test(e.message)){
2456          console.log('CMS WARNING: Vermutlich haben Sie ein Quelltextelement oder ein iFrame in der Seite, welches In
2456halte aus einer anderen Domain einbindet. Deaktivieren Sie die Ausführung des Elementes im Editor, um das Problem zu lösen.');
2457        }
2458      }
2459    }
2460  }
2461
2462  wDefinePrototypeMethod(Element.prototype, "wTriggerEvent", wDocument.wTriggerEvent);    
2463
2464  wFileselector_onselect = function(value){
2465    
2466  }
2467  
2468  wDocument.wUi = function(elements, options){
2469               
2470    var i, j, k, uiElement, evalStr, uiColorVariable, uiColorTransparency;
2471
2472    if(this && this.length || this.nodeType){
2473      options  = arguments[0];
2474      elements = wDocument.elements(this);
2475    }
2476    else{
2477      elements = wDocument.elements(elements);
2478    }
2479    
2480    options = options || [];
2481 
2482    for(i = 0; i < elements.length; i++){
2483      var el = elements[i];
2484      if(el.tagName == 'INPUT'){
2485        if(el.getAttribute('class').indexOf('wui-input-file') != -1){
2486          uiElement = document.createElement('div');
2487          uiElement.setAttribute('class', 'wui-input-container');
2488          el.setAttribute('data-onselectfile', 'triggerOnChange');                    
2489          var uiFileSelector = document.createElement('div');
2490          uiFileSelector.setAttribute('class', 'wui-input-file-selector');
2491          uiFileSelector.wAddEvent('click', function (event){
2492            var path         = '';
2493            var pathIfEmpty  = this.previousSibling.getAttribute('data-pathIfEmpty') ? this.previousSibling.getAttribute('data-pathIfEmpty') : '';
2494            var currentValue = this.previousSibling.value.replace(/^#/, '');
2495
2496            if(path == ''){
2497              if(currentValue == ''){
2498                if(pathIfEmpty != ''){
2499                  path = pathIfEmpty;
2500                }
2501              }
2502              else if(currentValue.indexOf('http') == -1){
2503                path = currentValue;
2504              }
2505            }  
2506
2507            var url = '/weblication/grid5/scripts/wFileselector.php?action=show&path=' + encodeURIComponent(path) + '&id=' + this.previousSibling.id + '&wcsrf=' + wCsrf;
2508            wOpenWin(url, 'wSmartbrowser', 920, 540, {allowDesktab : false});           
2509          });
2510          
2511          el.wInsertBefore(uiElement);
2512          uiElement.appendChild(el);
2513          uiElement.appendChild(uiFileSelector);  
2514          wDocument.wAddEvent(el, 'change', function(event){
2515            this.nextSibling.style.backgroundColor = this.value;
2516          });
2517        }          
2518        else if(el.getAttribute('class').indexOf('wui-input-color') != -1){
2519          el.setAttribute('data-onselectcolor', 'triggerOnChange');                                                    
2520          uiElement = document.createElement('div');
2521          uiElement.setAttribute('class', 'wui-input-container');
2522          var uiColorSelector = document.createElement('div');
2523          uiColorSelector.setAttribute('class', 'wui-input-color-selector');
2524          uiColorSelector.setAttribute('data-allowTransparency', el.getAttribute('data-allowTransparency'));
2525          var uiColorSelectorBg = document.createElement('div');
2526          uiColorSelectorBg.setAttribute('class', 'wui-input-color-selector-bg');
2527          
2528          if(el.value && el.value != ''){
2529            wDocument.setColorselectorColor(el, uiColorSelector);
2530          }
2531
2532          var showColorValue = el.getAttribute('data-showcolorvalue');
2533          uiColorVariable     = false;
2534          uiColorContrast     = false;
2535          uiColorTransparency = false;
2536          
2537          if(showColorValue == '1' && !/^baseColor/.test(el.id)){
2538
2539            uiColorVariable = document.createElement('div');
2540            uiColorVariable.setAttribute('class', 'wui-input-color-variable');
2541            uiColorVariable.wSetData('inputid', el.id);
2542            uiColorVariable.title = 'Der Farbwert basiert auf dieser Variable';
2543
2544            uiColorTransparency = document.createElement('input');
2545            uiColorTransparency.placeholder = '100%';
2546            uiColorTransparency.setAttribute('class', 'wui-input-color-transparency');
2547            uiColorTransparency.title = 'Hier können Sie die Deckraft in Prozent festlegen.';
2548
2549            el.wSetData('value', el.value);
2550            var valueOnly = el.value;
2551            if(/rgba\((\$\w+)\s*\,\s*([\d\.\%]+)/.test(valueOnly)){
2552              valueOnly = RegExp.$1;
2553            }
2554            else if(/rgba\((#\w+)\s*\,\s*([\d\.\%]+)/.test(valueOnly)){
2555              valueOnly = RegExp.$1;
2556            }
2557            el.wSetData('valueonly', valueOnly);
2558
2559            if(typeof(colorDatas) != 'undefined'){
2560              if(el.value.substr(0, 1) == '$'){
2561                if(el.value != colorDatas[el.value.substr(1).replace(/\s+\!\w+/, '')]){
2562                  uiColorVariable.innerHTML = 'basiert auf ' + el.value;
2563                  el.value = colorDatas[el.value.substr(1).replace(/\s+\!\w+/, '')];
2564                  el.parentNode.parentNode.wAddClass('wui-input-color-hasVariable');
2565                }
2566              }
2567              else if(/rgba\((\$\w+)\s*\,\s*([\d\.\%]+)/.test(el.value)){
2568                colorWithoutRGBA = RegExp.$1;
2569                transparencyValue = RegExp.$2;
2570
2571                if(el.value != colorDatas[colorWithoutRGBA.substr(1).replace(/\s+\!\w+/, '')]){
2572                  uiColorVariable.innerHTML = 'basiert auf ' + colorWithoutRGBA;
2573                  el.value = colorDatas[colorWithoutRGBA.substr(1).replace(/\s+\!\w+/, '')];
2574                  el.setAttribute('data-transparency', transparencyValue);
2575                  var transparencyValueDisplay = transparencyValue;
2576                  if(/^\d?\.\d+$/.test(transparencyValue)){
2577                    transparencyValueDisplay = String(transparencyValue * 100) + '%';
2578                  }
2579                  else if(transparencyValue == '1'){
2580                    transparencyValueDisplay = '100%';
2581                  }
2582                  uiColorTransparency.value = transparencyValueDisplay;
2583                  el.parentNode.parentNode.wAddClass('wui-input-color-hasVariable');
2584                  el.parentNode.parentNode.wAddClass('wui-input-color-hasTransparency');
2585                }
2586              }
2587              else if(/rgba\((#\w+)\s*\,\s*([\d\.\%]+)/.test(el.value)){
2588                colorWithoutRGBA = RegExp.$1;
2589                transparencyValue = RegExp.$2;
2590
2591                el.value = colorWithoutRGBA;
2592                el.setAttribute('data-transparency', transparencyValue);
2593                var transparencyValueDisplay = transparencyValue;
2594                if(/^\d?\.\d+$/.test(transparencyValue)){
2595                  transparencyValueDisplay = String(transparencyValue * 100) + '%';
2596                }
2597                else if(transparencyValue == '1'){
2598                  transparencyValueDisplay = '100%';
2599                }
2600                uiColorTransparency.value = transparencyValueDisplay;
2601                el.parentNode.parentNode.wRemoveClass('wui-input-color-hasVariable');
2602                el.parentNode.parentNode.wAddClass('wui-input-color-hasTransparency');
2603              }
2604            }
2605
2606            if(el.value == 'transparent'){
2607              el.parentNode.parentNode.wAddClass('wui-input-color-isTransparency');
2608            }
2609
2610
2611
2612          }
2613                    
2614          if(uiColorTransparency){
2615            uiElement.wAddClass('canHaveTransparence');
2616            uiColorTransparency.wAddEvent('change', function (event){
2617
2618              var currentColorInput = wDocument.elementOf(this.parentNode, '.wui-input-color');
2619              currentColorInput.setAttribute('data-transparency', this.value);
2620
2621              changeVariable(currentColorInput, {eventSource : 'transparency'});
2622
2623              uiElement
2624            });
2625          }
2626          
2627          if(showColorValue == '1' && /^(baseColorPrimary|fontColor|symbolColor|colorLink)/.test(el.id)){  
2628            if(wVersionGrid >= 20){
2629              uiColorContrast = document.createElement('div');
2630              uiColorContrast.setAttribute('class', 'wui-input-color-contrast');
2631              uiColorContrast.wSetData('inputcid', el.id);
2632              uiColorContrast.innerHTML = '';
2633            }
2634          }          
2635
2636          uiColorSelector.wAddEvent('click', function (event){
2637                      
2638            var color = this.previousSibling.previousSibling.value.replace(/^#/, '').replace(/((\s*\!\w+)+)/g, '');
2639            if(/\$/.test(color)){
2640              var currentColorSelector = wDocument.elementOf(this.previousSibling.previousSibling.parentNode, '.wui-input-color-selector');
2641              color = document.defaultView.getComputedStyle(currentColorSelector, null).getPropertyValue('background-color');
2642
2643            }
2644
2645            var url = '/weblication/grid5/gui/scripts/wColorselector.html?color=' + color + '&allowTransparency=' + (this.getAttribute('data-allowtransparency') == '1' ? '1' : '') + '&value=' + encodeURIComponent(this.previousSibling.previousSibling.value) + '&id=' + this.previousSibling.previousSibling.id;
2646            wOpenPopup(url, 'wColorselector', 260, 324, {allowDesktab : false, hideStatusbar : true});
2647          });
2648          
2649          el.wInsertBefore(uiElement);
2650          uiElement.appendChild(el);
2651          uiElement.appendChild(uiColorSelectorBg);
2652          uiElement.appendChild(uiColorSelector);
2653          if(uiColorTransparency){
2654            uiElement.appendChild(uiColorTransparency);
2655          }
2656          
2657          if(uiColorContrast){
2658            uiElement.appendChild(uiColorContrast);     
2659          }       
2660
2661          if(uiColorVariable){
2662            uiElement.appendChild(uiColorVariable);
2663            uiColorVariable.wAddEvent('click', function (event){
2664
2665              wDocument.wRemove('.wui-input-color-variable-selector');
2666              var classSelected = '', currentColorInput = wDocument.elementOf(this.parentNode, '.wui-input-color'), uiColorVariableSelector = document.createElement('div');
2667              uiColorVariableSelector.setAttribute('class', 'wui-input-color-variable-selector');
2668              var elementInnerHTML = '<div class="wui-input-color-variable-selector-blocker" onmouseover="wDocument.wRemove(\'.wui-input-color-variable-selector\');"><div class="wui-input-color-variable-selector-pre" onmouseover="event.stopPropagation()"></div><div class="wui-input-color-variable-selector-inner" onmouseover="event.stopPropagation()">';
2669              for(var colorDataKey 
2669in colorDatas){
2670                if(/^baseColor/.test(colorDataKey)){
2671
2672                  classSelected = currentColorInput.wGetData('value') == '$' + colorDataKey ? ' selected' : '';
2673                  elementInnerHTML += '<div class="entry' + classSelected + '" onclick="selectColorVariable(\'' + this.wGetData('inputid') + '\', \'$' + colorDataKey + '\')"><div class="wui-input-color-variable-selector-color" style="background:' + colorDatas[colorDataKey] + '"></div>Mit Variable verknüpfen: ' + colorDataKey + '</div>';
2674                }
2675              }
2676              if(currentColorInput){
2677                if(/\$/.test(currentColorInput.wGetData('value'))){
2678                  elementInnerHTML += '<div class="entry" onclick="resolveColorVariable(\'' + this.wGetData('inputid') + '\', \'$' + colorDataKey + '\')"><div class="wui-input-color-variable-selector-color" style="background:' + currentColorInput.value + '"></div>Von der Variable lösen</div>';
2679                }
2680              }
2681              elementInnerHTML += '</div></div>';
2682              uiColorVariableSelector.innerHTML = elementInnerHTML;
2683              this.parentNode.appendChild(uiColorVariableSelector);
2684              wDocument.wFitInScreen(uiColorVariableSelector);
2685            });
2686          }
2687        }
2688
2689        if(typeof(options['change']) == 'function'){
2690          wDocument.wAddEvent(el, 'change', options['change']);
2691        }
2692      }
2693      else if(el.tagName == 'SELECT' && el.getAttribute('multiple') != '1' && el.getAttribute('data-wui-disabled') != '1'){
2694        if(el.getAttribute('data-wui-wuiid')){
2695          wDocument.wRemove('#' + el.getAttribute('data-wui-wuiid'));
2696        }
2697        else{
2698          el.setAttribute('data-wui-wuiid', 'wuiid-' + String(parseInt(Math.random() * 100000)));
2699        }
2700        if(el.previousSibling && el.previousSibling.nodeType == 1 && el.previousSibling.wHasClass('wui-select')){
2701          el.previousSibling.parentNode.removeChild(el.previousSibling);
2702        }
2703        uiElement = document.createElement('div');
2704        uiElement.className = 'wui-select';   
2705        uiElement.onclick = function(event){event.stopPropagation()};     
2706        if(el.getAttribute('data-value')){
2707          for(j = 0; j < el.options.length; j++){
2708            if(el.options[j].value == el.getAttribute('data-value')){
2709              el.selectedIndex = j;
2710              break;
2711            }
2712          }
2713        }
2714                
2715        var styleAttr = el.getAttribute('style');
2716        if(el.getAttribute('data-hasAddUI') != '1' && styleAttr){
2717
2718        }
2719        
2720        var hiddenRoot = el.getAttribute('data-wui-roothidden');
2721        
2722        var attributeStyleSelected = '';
2723        var backgroundColorSelected = el.style.backgroundColor;
2724        if(backgroundColorSelected && backgroundColorSelected != ''){
2725          attributeStyleSelected = 'background-color:' + backgroundColorSelected + ';';
2726        }
2727        var fontColorSelected = el.style.color;
2728        if(fontColorSelected && fontColorSelected != ''){
2729          attributeStyleSelected += 'color:' + fontColorSelected;
2730        }    
2731        
2732        selectableId = 'ws' + String(parseInt(Math.random() * 10000));
2733        if(el.selectedIndex >=0){
2734          uiHTML = '<div class="wui-select-selected ' + (el.options[el.selectedIndex].getAttribute('data-iconclass') && el.options[el.selectedIndex].getAttribute('data-iconclass') != '' ? 'wui-select-selected-icon wui-select-selected-icon-' + el.options[el.selectedIndex].getAttribute('data-iconclass') : '') + (el.options[el.selectedIndex].getAttribute('data-icon') && el.options[el.selectedIndex].getAttribute('data-icon') != '' ? ' wui-select-selected-icon" style="background-image:url(\'' + el.options[el.selectedIndex].getAttribute('data-icon') + '\')' : '') + '" data-addinfoselected="' + (el.getAttribute('data-addinfoselected') === '1' && el.options[el.selectedIndex].getAttribute('data-info') ? '1' : '0') + '"' + ' data-value="' + el.options[el.selectedIndex].value + '" style="' + attributeStyleSelected + '"' + (el.options[el.selectedIndex].getAttribute('data-iconclass') && el.options[el.selectedIndex].getAttribute('data-iconclass') != '' ? ' data-iconclass="' + el.options[el.selectedIndex].getAttribute('data-iconclass') + '"': '') + '>';
2735          uiHTML += el.options[el.selectedIndex].text;
2736          if(el.getAttribute('data-addinfoselected') === '1' && el.options[el.selectedIndex].getAttribute('data-info') && el.options[el.selectedIndex].getAttribute('data-info') !== ''){
2737            uiHTML += '<span class="wui-select-item-info">' + el.options[el.selectedIndex].getAttribute('data-info') + '<span>';
2738          }
2739          uiHTML += (el.options[el.selectedIndex].text === "" ? "&#160;" : "") + '</div>';
2740        }
2741        else{
2742          uiHTML = '<div class="wui-select-selected data-value="">&#160;</div>';
2743        }
2744        
2745        uiHTML += '<div id="' + selectableId + '" class="wui-select-selectable">';
2746        for(j = 0; j < el.length; j++){
2747          additionalAttributes = ' ';
2748          selectItemCaption = hiddenRoot && hiddenRoot != '' ? el.options[j].text.replace(new RegExp('(' + hiddenRoot.replace('/', '\\/') + ')'), '<span style="color:#c0c0c0;pointer-events:none">$1</span>') : el.options[j].text;
2749          
2750          if(el.options[j].getAttribute('disabled') == 'disabled'){
2751            additionalAttributes = ' data-disabled="disabled"';
2752            if(selectItemCaption == ''){
2753              additionalAttributes = ' data-isdelimiter="1"';
2754            }
2755          }
2756          
2757          uiHTML += '<div' + additionalAttributes + ' ' + (el.options[j].getAttribute('data-iconclass') && el.options[j].getAttribute('data-iconclass') != '' ? 'class="wui-select-item wui-select-item-icon wui-select-item-icon-' + el.options[j].getAttribute('data-iconclass') + '" data-iconclass="' + el.options[j].getAttribute('data-iconclass') + '"' : '') + ' style="' + (el.options[j].getAttribute('style') && el.options[j].getAttribute('style') != '' ? el.options[j].getAttribute('style') : '') + (el.options[j].getAttribute('data-icon') && el.options[j].getAttribute('data-icon') != '' ? ';background-image:url(\'' + el.options[j].getAttribute('data-icon') + '\')" data-icon="' + el.options[j].getAttribute('data-icon') + '" class="wui-select-item wui-select-item-icon' : '" class="wui-select-item') + '" data-value="' + el.options[j].value + '">' + (selectItemCaption !== '' ? selectItemCaption : '&#160;');
2758          uiHTML += (el.options[j].getAttribute('data-info') && el.options[j].getAttribute('data-info') !== '' ? '<span class="wui-select-item-info">' + el.options[j].getAttribute('data-info') + '</span>' : '');
2759          uiHTML += '</div>';
2760        }
2761        uiHTML += '</div>';           
2762        uiElement.innerHTML = uiHTML;
2763
2764        wDocument.wAddEvent(uiElement.firstChild, 'click', function(event){
2765
2766          var srcElement   = wEvent.wGetSrcElement(event);
2767          var elementToFit = srcElement.nextSibling;
2768          var valueCurrent = srcElement.getAttribute('data-value');
2769          
2770          var entriesSelectable = wDocument.elements('div.wui-select-item', null, elementToFit);
2771          for(var k = 0; k < entriesSelectable.length; k++){
2772            if(entriesSelectable[k].getAttribute('data-value') == valueCurrent){
2773              entriesSelectable[k].wAddClass('selected');
2774            }
2775            else{
2776              entriesSelectable[k].wRemoveClass('selected');
2777            }
2778          }
2779
2780          if(wDocument.getCurrentStyle(elementToFit, 'display') != 'none'){
2781            wDocument.hide('.wui-select-selectable');
2782            return false;
2783          }
2784
2785          wDocument.hide('.wui-select-selectable');
2786          if(wDocument.getCurrentStyle(elementToFit, 'display') == 'none'){
2787            wDocument.show(elementToFit);
2788            wDocument.tmp['currentSelect'] = elementToFit;
2789            if(elementToFit.offsetWidth < srcElement.offsetWidth){
2790              elementToFit.style.width = String(srcElement.offsetWidth) + 'px';
2791            }
2792
2793
2794
2795            var diffBottom = getWinHeight() + getWinScrollTop() - wDocument.getOffsetAbsTop2(srcElement) - elementToFit.offsetHeight;
2796
2797            var maxHeight = getWinHeight() + getWinScrollTop() - wDocument.getOffsetAbsTop2(srcElement) - 50;
2798            if(maxHeight > getWinHeight()){
2799              maxHeight = getWinHeight();
2800            }
2801            
2802            if(el.getAttribute('data-ui-maxheight') !== 'none'){             
2803              if(wDocument.element('.wui-mask-projectOptions')){
2804                maxHeight = 240;
2805              }
2806              if(maxHeight < 40){
2807                maxHeight = 40;
2808              }
2809            }
2810
2811
2812
2813
2814
2815            if(el.wGetData('adaptheight') !== '0' && elementToFit.offsetHeight >= maxHeight){
2816              elementToFit.style.height = String(maxHeight) + 'px';
2817            }
2818            else{
2819              elementToFit.style.height = 'auto';            
2820            }
2821            if(el.wGetData('fitinscreen') == '1'){
2822              wDocument.wFitInScreen(elementToFit, {'diffRight' : 3, 'diffBottom' : 3});
2823            }
2824          }
2825          else{
2826            wDocument.hide(elementToFit);
2827          }
2828        });
2829        var toca = el.getAttribute('data-toca');
2830        wDocument.wAddEvent(wDocument.elements('.wui-select-item', null, uiElement), 'click', function(event){
2831          var srcElement = wEvent.wGetSrcElement(event);
2832          if(srcElement.className.indexOf('wui-select-item-info') !== -1){
2833            srcElement = srcElement.parentNode;
2834          }         
2835          var hasChanged = srcElement.parentNode.parentNode.nextSibling.value != srcElement.getAttribute('data-value') ? true : false;
2836          srcElement.parentNode.parentNode.nextSibling.value = srcElement.getAttribute('data-value');
2837          var newHtmlSelected = srcElement.innerHTML;
2838          if(!srcElement.parentNode.previousSibling.getAttribute('data-addinfoselected') || srcElement.parentNode.previousSibling.getAttribute('data-addinfoselected') === '0'){
2839            newHtmlSelected = srcElement.firstChild.textContent;
2840          }
2841          srcElement.parentNode.previousSibling.innerHTML    = newHtmlSelected;
2842          srcElement.parentNode.previousSibling.setAttribute('data-value', srcElement.getAttribute('data-value'));
2843          var backgroundColorSelected = srcElement.style.backgroundColor;
2844          if(backgroundColorSelected && backgroundColorSelected != ''){
2845            srcElement.parentNode.previousSibling.style.backgroundColor = backgroundColorSelected;
2846          }
2847          var fontColorSelected = srcElement.style.color;
2848          if(fontColorSelected && fontColorSelected != ''){
2849            srcElement.parentNode.previousSibling.style.color = fontColorSelected;
2850          }          
2851          
2852          if(srcElement.getAttribute('data-icon')){
2853            srcElement.parentNode.previousSibling.style.backgroundImage = 'url(' + srcElement.getAttribute('data-icon') + ')';
2854            srcElement.parentNode.previousSibling.setAttribute('data-icon', srcElement.getAttribute('data-icon'));
2855          }
2856          if(srcElement.getAttribute('data-iconclass')){
2857            srcElement.parentNode.previousSibling.className = 'wui-select-selected wui-select-selected-icon wui-select-selected-icon-' + srcElement.getAttribute('data-iconclass');
2858          }
2859          wDocument.hide(srcElement.parentNode);
2860          if(hasChanged || toca == 1){
2861            wDocument.wTriggerEvent(srcElement.parentNode.parentNode.nextSibling, 'change');
2862          }
2863        });
2864
2865        if(!wDocument.tmp['haetcs']){
2866          wDocument.wAddEvent(document, 'click', function(event){
2867            if(wDocument.tmp['peocd']){
2868              return;
2869            }
2870            try{
2871              var srcElement = wEvent.wGetSrcElement(event);
2872              if(srcElement && srcElement.className.indexOf('wui-select') == -1 && !wDocument.wIsChildOf(srcElement, wDocument.tmp['currentSelect']) && wDocument.tmp['currentSelect']){
2873                wDocument.hide(wDocument.tmp['currentSelect']);
2874              }
2875            }
2876            catch(e){
2877            }
2878          });
2879        }
2880        
2881        el.wInsertBefore(uiElement);
2882        
2883        el.setAttribute('data-hasAddUI', '1');
2884
2885        wDocument.hide(el);
2886        if(typeof(options['change']) == 'function'){
2887          wDocument.wAddEvent(el, 'change', options['change']);
2888        }        
2889      }      
2890      else{�  
2891        if(el.className.indexOf('wui-tabs') != -1){
2892          var childNodes = el.childNodes;
2893          for(j = 0; j < childNodes.length; j++){
2894            if(childNodes[j].nodeType == 1 && childNodes[j].nodeName == 'UL'){
2895              var childNodesTabs = childNodes[j].childNodes;
2896              for(k = 0; k < childNodesTabs.length; k++){
2897                if(childNodesTabs[k].nodeType == 1 && childNodesTabs[k].nodeName == 'LI'){
2898                  wDocument.wAddEvent(childNodesTabs[k], 'click', function(event){
2899                    if(this.getAttribute('data-tabid') != 'unselectable'){
2900                      wDocument.wSelectTab(this.parentNode.parentNode, this.getAttribute('data-tabid'));
2901                    }
2902                  });
2903                  if(typeof(options['click']) == 'function'){
2904                    wDocument.wAddEvent(childNodesTabs[k], 'click', options['click']);
2905                  }                   
2906                }
2907              }
2908              if(options['selectedTab']){
2909                wDocument.wSelectTab(el, options['selectedTab']);
2910              }
2911            }            
2912          }
2913        }
2914      }
2915    }  
2916  }
2917  
2918  wDefinePrototypeMethod(Array.prototype, "wUi", wDocument.wUi);
2919  wDefinePrototypeMethod(Element.prototype, "wUi", wDocument.wUi);    
2920
2921  wDocument.getColorValueInput = function(input, options){
2922
2923
2924    var value         = input.value;
2925    var transparency  = input.wGetData('transparency');
2926    var dataValue     = input.wGetData('value');
2927    var dataValueOnly = input.wGetData('valueonly');
2928
2929
2930
2931
2932    if(options && options['eventSource'] == 'transparency'){
2933      value = dataValueOnly;
2934    }
2935    else if(options && options['eventSource'] == 'preview'){
2936
2937    }
2938    else if(options && options['eventSource'] == 'extern'){
2939      value = dataValueOnly ? dataValueOnly : value;
2940    }
2941    else{
2942      input.wSetData('value', value);
2943
2944      var valueOnly = value;
2945      if(/rgba\((\$\w+)\s*\,\s*([\d\.\%]+)/.test(value)){
2946        valueOnly = RegExp.$1;
2947      }
2948      else if(/rgba\((#\w+)\s*\,\s*([\d\.\%]+)/.test(value)){
2949        valueOnly = RegExp.$1;
2950      }
2951
2952    }
2953
2954    if(transparency && transparency != ''){
2955
2956
2957      if(/^\d?\.\d+$/.test(transparency) && transparency < 1 && transparency >= 0){
2958        value = 'rgba(' + value + ', ' + transparency + ')';
2959      }
2960      else if(/^(\d+(\.\d+)?)\%$/.test(transparency) && transparency != '100%'){
2961        transparency = RegExp.$1 / 100;
2962        if(/rgba\((\d+\s*,\s*\d+\s*,\s*\d+\s*)\,\s*([\d\.\%]+)/.test(value)){
2963          value = 'rgba(' + RegExp.$1 + ', ' + transparency + ')';
2964        }
2965        else if(/rgb\((\d+\s*,\s*\d+\s*,\s*\d+\s*)/.test(value)){
2966          value = 'rgba(' + RegExp.$1 + ', ' + transparency + ')';
2967        }
2968        else if(/rgba\((\$\w+)\s*\,\s*([\d\.\%]+)/.test(value)){
2969          value = 'rgba(' + RegExp.$1 + ', ' + transparency + ')';
2970        }
2971        else if(/rgba\((#\w+)\s*\,\s*([\d\.\%]+)/.test(value)){
2972          value = 'rgba(' + RegExp.$1 + ', ' + transparency + ')';
2973        }
2974        else{
2975          value = 'rgba(' + value + ', ' + transparency + ')';
2976        }
2977      }
2978      else{
2979        var currentColorInputTransparency = wDocument.elementOf(input.parentNode, '.wui-input-color-transparency');
2980        if(currentColorInputTransparency){
2981          currentColorInputTransparency.value = '';
2982        }
2983      }
2984
2985    }
2986
2987    return value;
2988  };
2989
2990  wDocument.setColorselectorColor = function (element, uiColorSelector, options){
2991
2992
2993    try{
2994      uiColorSelector = uiColorSelector || element.nextSibling.nextSibling;
2995
2996      
2997      var value = element.value.replace(/\s*\!(global|default)/g, '');
2998
2999      if(options && options['useValue']){
3000        value = wDocument.getColorValueInput(element, {eventSource : 'preview'});
3001      }
3002      else if(element.wGetData('showcolorvalue') == '1'){
3003        value = wDocument.getColorValueInput(element, {eventSource : 'extern'});
3004      }
3005
3006      var finalColor = value;
3007
3008      uiColorSelector.wRemoveClass('hasBrightnessDarkness');
3009
3010      if(/rgba\(\s*([\$\#\w]+)\s*,\s*([0-9\.\%]+)\s*\)/.test(value)){
3011        var functionColor = RegExp.$1;
3012        var functionParam = RegExp.$2;
3013        var rgbColor = '';
3014
3015        if(typeof(colorDatas) != 'undefined' && functionColor.substr(0, 1) == '$'){
3016          functionColor = colorDatas[functionColor.substr(1).replace(/\s+\!\w+/, '')];
3017        }
3018
3019        if(functionColor.substr(0, 1) == '#'){
3020          var rgbArray = getColorsRGB(functionColor);
3021          rgbColor = rgbArray[0] + ', ' + rgbArray[1] + ', ' + rgbArray[2];
3022        }
3023        else{
3024          rgbColor = functionColor;
3025        }
3026
3027        if(/^(\d+(?:\.\d+)?)\%$/.test(functionParam)){
3028          functionParam = RegExp.$1 / 100;
3029        }
3030
3031        finalColor = 'rgba(' + rgbColor + ', ' + functionParam + ')';
3032        
3033        uiColorSelector.style.backgroundColor = finalColor;
3034      }
3035      else if(/(darken|lighten)\(\s*([\$\#\w]+)\s*,\s*([0-9\.]+)\%\s*\)/.test(value)){
3036        var type = RegExp.$1;
3037        var functionColor = RegExp.$2;
3038        var functionParam = RegExp.$3;
3039        var rgbColor = '';
3040        
3041        if(typeof(colorDatas) != 'undefined' && functionColor.substr(0, 1) == '$'){
3042          functionColor = colorDatas[functionColor.substr(1).replace(/\s+\!\w+/, '')];
3043        }
3044   
3045        if(functionColor.substr(0, 1) == '#'){
3046          var rgbArray = getColorsRGB(functionColor);
3047          rgbColor = rgbArray[0] + ', ' + rgbArray[1] + ', ' + rgbArray[2];
3048        }
3049        else{
3050          rgbColor = functionColor;
3051        }
3052        finalColor = 'rgba(' + rgbColor + ', 1)';
3053        uiColorSelector.style.backgroundColor = finalColor;
3054        if(type == 'darken'){
3055          uiColorSelector.style.filter = 'brightness(' + (1 - functionParam / 100) + ')';
3056        }
3057        else{
3058          uiColorSelector.style.filter = 'brightness(' + (1 + functionParam / 100) + ')';
3059        }
3060        uiColorSelector.wAddClass('hasBrightnessDarkness');
3061      }
3062      else if(typeof(colorDatas) != 'undefined' && value.substr(0, 1) == '$'){
3063        finalColor = colorDatas[value.substr(1).replace(/\s+\!\w+/, '')];
3064        uiColorSelector.style.backgroundColor = colorDatas[value.substr(1).replace(/\s+\!\w+/, '')];
3065      }
3066      else{
3067        uiColorSelector.style.backgroundColor = value;
3068      }
3069    }
3070    catch(e){}
3071  }
3072  
3073  wDocument.wSelectTab = function(element, tabId){
3074    
3075    var i;
3076    var childNodes = element.childNodes;
3077    for(i = 0; i < childNodes.length; i++){
3078      if(childNodes[i].nodeType == 1 && childNodes[i].nodeName == 'DIV'){
3079        if(tabId == childNodes[i].getAttribute('data-tabid')){
3080          wDocument.show(childNodes[i]);
3081        }
3082        else{
3083          wDocument.hide(childNodes[i]);
3084        }
3085      }
3086    }
3087    childNodes = element.firstChild.nodeType == 1 ? element.firstChild.childNodes : element.firstChild.nextSibling.childNodes;
3088    for(i = 0; i < childNodes.length; i++){
3089      if(childNodes[i].nodeType == 1 && childNodes[i].nodeName == 'LI'){
3090        if(tabId == childNodes[i].getAttribute('data-tabid')){
3091          childNodes[i].wAddClass('wui-tab-selected');
3092        }
3093        else{
3094          childNodes[i].wRemoveClass('wui-tab-selected');
3095        }
3096      }
3097    }                    
3098  }
3099  
3100  wDocument.wSelectButton = function(button){
3101
3102    var childNodes = button.parentNode.childNodes; 
3103    for(var i = 0; i < childNodes.length; i++){
3104      if(childNodes[i].nodeType == 1 && childNodes[i].nodeName == 'A'){
3105
3106        if(childNodes[i] == button){
3107          childNodes[i].wAddClass('wui-button-selected');
3108        }
3109        else{
3110          childNodes[i].wRemoveClass('wui-button-selected')
3111        }
3112      }
3113    }                    
3114  }  
3115
3116  wDocument.wMoveAttribute = function(elementSource, elementDest, attributeName){
3117    elementDest.setAttribute(attributeName, elementSource.getAttribute(attributeName));
3118    elementSource.removeAttribute(attributeName);
3119  }
3120
3121  wDocument.wGetPrevElement = function(element, className){
3122
3123    if(this && this.length || this.nodeType){
3124      className  = arguments[0];
3125      element = this;
3126    }
3127
3128    var timeout = 1024;
3129
3130    while(timeout > 0 && element.previousSibling){
3131      element = element.previousSibling;
3132      if(element.nodeType == 1){
3133        if(!className){
3134          return element;
3135        }
3136        else if(element.className.indexOf(className) != -1){
3137          return element;
3138        }
3139      }
3140      timeout--;
3141    }
3142  }
3143
3144  wDefinePrototypeMethod(Element.prototype, "wGetPrevElement", wDocument.wGetPrevElement);  
3145  
3146  wDocument.wGetNextElement = function(element, className){
3147
3148    if(this && this.length || this.nodeType){
3149      className  = arguments[0];
3150      element = this;
3151    }
3152
3153    var timeout = 1024;
3154
3155    while(timeout > 0 && element.nextSibling){
3156      element = element.nextSibling;
3157      if(element.nodeType == 1){
3158        if(!className){
3159          return element;
3160        }
3161        else if(element.className.indexOf(className) != -1){
3162          return element;
3163        }
3164      }
3165      timeout--;
3166    }
3167  }
3168
3169  wDefinePrototypeMethod(Element.prototype, "wGetNextElement", wDocument.wGetNextElement);  
3170
3171  wDocument.wInsertBefore = function(elements, innerHTMLToAdd){
3172
3173    if(this && this.length || this.nodeType){
3174      innerHTMLToAdd  = arguments[0];
3175      elements = wDocument.elements(this);
3176    }
3177    else{
3178      elements = wDocument.elements(elements);
3179    }
3180
3181    for(var i = 0; i < elements.length; i++){
3182      var elementInsertBefore = document.createElement('div');
3183
3184      if(typeof(innerHTMLToAdd) == 'object'){
3185        elementInsertBefore.appendChild(innerHTMLToAdd);               
3186      }
3187      else{      
3188        elementInsertBefore.innerHTML = innerHTMLToAdd; 
3189      }  
3190      elements[i].parentNode.insertBefore(elementInsertBefore.firstChild, elements[i]);
3191    }
3192  }
3193  
3194  wDefinePrototypeMethod(Array.prototype, "wInsertBefore", wDocument.wInsertBefore);
3195  wDefinePrototypeMethod(Element.prototype, "wInsertBefore", wDocument.wInsertBefore);    
3196  
3197  wDocument.wInsertAfter = function(elements, node){
3198
3199    var i, j;
3200
3201    if(this && this.length || this.nodeType){
3202      node     = arguments[0];
3203      elements = wDocument.elements(this);
3204    }
3205    else{
3206      elements = wDocument.elements(elements);
3207    }
3208    
3209    var nodesToInsert = new Array();
3210
3211    if(typeof node == 'string'){
3212      var nodeInnerHTML = document.createElement('div');
3213      nodeInnerHTML.innerHTML = node;
3214      for(i = 0; i < nodeInnerHTML.childNodes.length; i++){
3215        nodesToInsert.push(nodeInnerHTML.childNodes[i]);
3216      }
3217    }
3218    else{
3219      nodesToInsert.push(node);
3220    }
3221
3222    for(i = 0; i < elements.length; i++){
3223      if(elements[i].nextSibling){
3224        var nextSiblingTmp = elements[i].nextSibling;
3225        for(j = 0; j < nodesToInsert.length; j++){          
3226          elements[i].parentNode.insertBefore(nodesToInsert[j], nextSiblingTmp);
3227        }
3228      }  
3229      else{
3230        for(j = 0; j < nodesToInsert.length; j++){        
3231          elements[i].parentNode.appendChild(nodesToInsert[j]);
3232        }
3233      }
3234    }
3235    return elements;
3236  }
3237
3238  wDefinePrototypeMethod(Array.prototype, "wInsertAfter", wDocument.wInsertAfter);
3239  wDefinePrototypeMethod(Element.prototype, "wInsertAfter", wDocument.wInsertAfter);    
3240
3241  wDocument.wCreateElement = function(outerHTML){
3242
3243    var elementTmp = document.createElement('div');
3244    elementTmp.innerHTML = outerHTML;
3245   
3246    return elementTmp.firstChild;
3247  }
3248
3249  wDocument.wWrap = function(elements, innerHTMLToWrap){
3250
3251    if(this && this.length || this.nodeType){
3252      innerHTMLToWrap  = arguments[0];
3253      elements = wDocument.elements(this);
3254    }
3255    else{
3256      elements = wDocument.elements(elements);
3257    }
3258
3259    for(var i = 0; i < elements.length; i++){
3260      var elementWrap       = document.createElement('div');
3261      elementWrap.innerHTML = innerHTMLToWrap;
3262
3263      elements[i].style.position = 'static';
3264
3265      var elementInsertTmp = document.createElement('div');
3266      elements[i].parentNode.insertBefore(elementInsertTmp, elements[i]);
3267      elementWrap.firstChild.appendChild(elements[i]);
3268      elementInsertTmp.parentNode.insertBefore(elementWrap.firstChild, elementInsertTmp);
3269    }
3270  }
3271
3272  wDefinePrototypeMethod(Array.prototype, "wInsertAfter", wDocument.wInsertAfter);
3273  wDefinePrototypeMethod(Element.prototype, "wInsertAfter", wDocument.wInsertAfter);    
3274
3275  wDocument.wWrapInner = function(elements, innerHTMLToWrap){
3276
3277    if(this && this.length || this.nodeType){
3278      innerHTMLToWrap  = arguments[0];
3279      elements = wDocument.elements(this);
3280    }
3281    else{
3282      elements = wDocument.elements(elements);
3283    }
3284
3285    for(var i = 0; i < elements.length; i++){
3286      var elementTmp = document.createElement('div');
3287      elementTmp.innerHTML = innerHTMLToWrap;
3288      while(elements[i].firstChild){
3289        elementTmp.firstChild.appendChild(elements[i].firstChild);
3290      }
3291      elements[i].innerHTML = elementTmp.innerHTML;
3292    }
3293  }
3294
3295  wDefinePrototypeMethod(Array.prototype, "wWrapInner", wDocument.wWrapInner);
3296  wDefinePrototypeMethod(Element.prototype, "wWrapInner", wDocument.wWrapInner);    
3297
3298  wDocument.wUnwrap = function(elements){
3299
3300    if(this && this.length || this.nodeType){
3301      innerHTMLToWrap  = arguments[0];
3302      elements = wDocument.elements(this);
3303    }
3304    else{
3305      elements = wDocument.elements(elements);
3306    }
3307
3308    for(var i = 0; i < elements.length; i++){
3309      while(elements[i].firstChild){
3310        elements[i].parentNode.insertBefore(elements[i].firstChild, elements[i]);
3311      }
3312      elements[i].parentNode.removeChild(elements[i]);
3313    }
3314  }
3315
3316  wDefinePrototypeMethod(Array.prototype, "wUnwrap", wDocument.wUnwrap);
3317  wDefinePrototypeMethod(Element.prototype, "wUnwrap", wDocument.wUnwrap);    
3318
3319  wDocument.wAppend = function(elements, innerHTMLToAppend){
3320
3321    if(this && this.length || this.nodeType){
3322      innerHTMLToAppend  = arguments[0];
3323      elements = wDocument.elements(this);
3324    }
3325    else{
3326      elements = wDocument.elements(elements);
3327    }
3328
3329    for(var i = 0; i < elements.length; i++){
3330      var elementTmp = document.createElement('div');
3331      elementTmp.innerHTML = innerHTMLToAppend;
3332      elements[i].appendChild(elementTmp.firstChild);
3333    }
3334  }
3335
3336  wDefinePrototypeMethod(Array.prototype, "wAppend", wDocument.wAppend);
3337  wDefinePrototypeMethod(Element.prototype, "wAppend", wDocument.wAppend);    
3338
3339  wDocument.wPrepend = function(elements, innerHTMLToAppend){
3340
3341    if(this && this.length || this.nodeType){
3342      innerHTMLToAppend  = arguments[0];
3343      elements = wDocument.elements(this);
3344    }
3345    else{
3346      elements = wDocument.elements(elements);
3347    }
3348
3349    for(var i = 0; i < elements.length; i++){
3350      var elementTmp = document.createElement('div');
3351      elementTmp.innerHTML = innerHTMLToAppend;
3352      if(elements[i].firstChild){
3353        elements[i].insertBefore(elementTmp.firstChild, elements[i].firstChild);
3354      }
3355      else{
3356        elements[i].appendChild(elementTmp.firstChild);
3357      }
3358    }
3359  }
3360
3361  wDefinePrototypeMethod(Array.prototype, "wPrepend", wDocument.wPrepend);
3362  wDefinePrototypeMethod(Element.prototype, "wPrepend", wDocument.wPrepend);    
3363
3364  wDocument.wChangeElementName = function(elements, elementName){
3365
3366    if(this && this.length || this.nodeType){
3367      elementName  = arguments[0];
3368      elements = wDocument.elements(this);
3369    }
3370    else{
3371      elements = wDocument.elements(elements);
3372    }
3373
3374    var newElements = new Array();
3375
3376    for(var i = 0; i < elements.length; i++){
3377      var newElementWithChangedName = document.createElement(elementName);
3378      for(var j = 0; j < elements[i].attributes.length; j++){
3379        var attributeOfElement = elements[i].attributes[j];
3380        newElementWithChangedName.setAttribute(attributeOfElement.name, attributeOfElement.value);
3381      }
3382      
3383      elements[i].parentNode.insertBefore(newElementWithChangedName, elements[i]);
3384      while(elements[i].firstChild){
3385        newElementWithChangedName.appendChild(elements[i].firstChild);
3386      }
3387      elements[i].parentNode.removeChild(elements[i]);
3388      newElements.push(newElementWithChangedName);
3389    }
3390    return newElements;
3391  }
3392
3393  wDefinePrototypeMethod(Array.prototype, "wChangeElementName", wDocument.wChangeElementName);
3394  wDefinePrototypeMethod(Element.prototype, "wChangeElementName", wDocument.wChangeElementName);    
3395
3396  wDocument.wReplaceElementByHTML = function(elements, html){
3397    
3398    if(this && this.length || this.nodeType){
3399      elementName  = arguments[0];
3400      elements = wDocument.elements(this);
3401    }
3402    else{
3403      elements = wDocument.elements(elements);
3404    }
3405
3406    for(var i = 0; i < elements.length; i++){
3407      var textNode = document.createTextNode(html);
3408      elements[i].parentNode.replaceChild(textNode, elements[i]);
3409    }
3410  }
3411
3412  wDefinePrototypeMethod(Array.prototype, "wReplaceElementByHTML", wDocument.wReplaceElementByHTML);
3413  wDefinePrototypeMethod(Element.prototype, "wReplaceElementByHTML", wDocument.wReplaceElementByHTML);    
3414
3415  wDocument.wIsChildOf = function(element, parent){
3416
3417    if(this && this.length || this.nodeType){
3418      parent  = arguments[0];
3419      element = this;
3420    }
3421
3422    if(typeof element !== 'object'){
3423      element = document.getElementById(element);
3424    }
3425
3426    if(typeof parent !== 'object'){
3427      parent = document.getElementById(parent);
3428    }
3429
3430    var ancestor       = element;
3431    var ancestorBefore = null;
3432    var timeout = 16;
3433    while(ancestor && ancestor != ancestorBefore && timeout > 0){
3434
3435      if(ancestor == parent){
3436        return true;
3437      }
3438      ancestorBefore = ancestor;
3439      ancestor       = ancestor.parentNode;
3440      timeout--;
3441    }
3442    return false;
3443  };
3444
3445  wDefinePrototypeMethod(Array.prototype, "wIsChildOf", wDocument.wIsChildOf);
3446  wDefinePrototypeMethod(Element.prototype, "wIsChildOf", wDocument.wIsChildOf);    
3447
3448  this.getCaretPosition = function(element){
3449   
3450    if(this && this.length || this.nodeType){
3451      element = this;
3452    }
3453
3454    if(typeof element !== 'object'){
3455      element = document.getElementById(element);
3456    }
3457
3458    if(typeof parent !== 'object'){
3459      parent = document.getElementById(parent);
3460    }   
3461    
3462    if(element.selectionStart){
3463      return element.selectionStart;
3464    }
3465    else if(document.selection){
3466
3467      var currentSelection = document.selection.createRange();
3468
3469      currentSelection.moveStart('character', - element.value.length);
3470      return currentSelection.text.length;
3471    }
3472    return 0;
3473  }
3474
3475  wDefinePrototypeMethod(Element.prototype, "getCaretPosition", wDocument.getCaretPosition);    
3476
3477  this.setCaretPosition = function(element, position){
3478
3479    if(this && this.length || this.nodeType){
3480      position  = arguments[0];      
3481      element = this;      
3482    }
3483
3484    if(typeof element !== 'object'){
3485      element = document.getElementById(element);
3486    }
3487
3488    if(typeof parent !== 'object'){
3489      parent = document.getElementById(parent);
3490    }   
3491    
3492    element.focus();
3493
3494    var selectionStart = position;
3495    var selectionEnd   = position;
3496
3497    if(element.createTextRange){
3498      var selRange = element.createTextRange();
3499      selRange.collapse(true);
3500      selRange.moveStart('character', selectionStart);
3501      selRange.moveEnd('character', selectionEnd);
3502      selRange.select();
3503    }
3504    else if(element.setSelectionRange){
3505
3506      element.setSelectionRange(selectionStart, selectionEnd);
3507    }
3508    else if(element.selectionStart){
3509
3510      element.selectionStart = selectionStart;
3511      element.selectionEnd   = selectionEnd;
3512    }
3513  }
3514  
3515  wDefinePrototypeMethod(Element.prototype, "setCaretPosition", wDocument.setCaretPosition);      
3516
3517  wDocument.showProgress = function(text){
3518    wDocument.wRemove('wProgressInfo');
3519    if(text){
3520      wDocument.append(document.body, '<div id="wProgressInfo" style="display:-webkit-box;-webkit-box-pack:center;-webkit-box-align:center;cursor:wait;position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff;opacity:0.5;font-size:42px;text-align:center;font-weight:bold;"><div style="text-align:center">
3520' + text + '</div></div>');      
3521    }
3522    else{
3523      wDocument.append(document.body, '<div id="wProgressInfo" style="cursor:wait;position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff;opacity:0.5"/>');
3524    }
3525  }
3526
3527  wDocument.hideProgress = function(){
3528    wDocument.wRemove('wProgressInfo');
3529  }  
3530
3531  wDocument.ready = function(callback){
3532
3533    if(document.addEventListener){
3534      document.addEventListener('DOMContentLoaded', callback, false);
3535    }
3536    else if(document.attachEvent){
3537      document.attachEvent('onreadystatechange', function(e){callback.call()});
3538    }
3539  }
3540
3541  String.prototype.decodeSpecialChars = function(){
3542
3543    return this.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, '&');
3544  };
3545
3546  String.prototype.encodeSpecialChars = function(){
3547
3548    return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
3549  };
3550
3551  String.prototype.convertToFileName = function(){
3552
3553    return this.replace(/Ä/g, 'Ae').replace(/Ö/g, 'Oe').replace(/Ü/g, 'Ue').replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss').replace(/[^a-zA-Z0-9\.\@_-]+/g, '-').replace(/-+/g, '-').replace(/-+/g, '-').replace(/^-+/, '');
3554  };
3555  
3556  String.prototype.convertToPathName = function(){
3557
3558    return this.replace(/Ä/g, 'Ae').replace(/Ö/g, 'Oe').replace(/Ü/g, 'Ue').replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss').replace(/[^\/a-zA-Z0-9\.\@_-]+/g, '-');
3559  };  
3560  
3561  String.prototype.convertToFileNameOnly = function(){
3562    
3563    return this.replace(/Ä/g, 'Ae').replace(/Ö/g, 'Oe').replace(/Ü/g, 'Ue').replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss').replace(/[^a-zA-Z0-9\.\@_-]+/g, '-').replace(/-+/g, '-').replace(/-+/g, '-').replace(/^[-\.]+/, '').replace(/[-\.]+$/, '');
3564  };    
3565  
3566  String.prototype.convertToDirName = function(){
3567
3568    return this.replace(/Ä/g, 'Ae').replace(/Ö/g, 'Oe').replace(/Ü/g, 'Ue').replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss').replace(/[^a-zA-Z0-9\@_-]+/g, '-').replace(/-+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
3569  };  
3570  
3571  String.prototype.converPathToLowerCase = function(){
3572
3573    var path = this;
3574    if(/(.*)(\.w[A-Z]\w+\.php)$/.test(path)){ 
3575      path = RegExp.$1.toLowerCase() + RegExp.$2;
3576    }
3577    else if(/(.*)(\.w[A-Z][^\.]*(\.[a-z]*)?)/.test(path)){ 
3578      path = RegExp.$1.toLowerCase() + RegExp.$2;
3579    }    
3580    else{
3581      path = path.toLowerCase();
3582    }
3583    return path;
3584  };
3585  
3586  String.prototype.convertToReg = function(){
3587
3588    return this.replace(/\(/g, '\\(').replace(/\)/g, '\\)').replace(/\+/g, '\\+').replace(/\*/g, '\\*');
3589  };  
3590
3591  if(typeof jQuery != 'undefined' && jQuery){
3592    jQuery.fn.addEvent = wDocument.addEvent;
3593    jQuery.fn.wSetCSS  = wDocument.wSetCSS;
3594  }
3595
3596  window.wDocument = wDocument;
3597  window.wEvent    = wEvent;
3598
3599})();
3600
3601function getWinHeight(){
3602  return window.innerHeight ? window.innerHeight : (document.documentElement ? document.documentElement.offsetHeight : document.body.clientHeight);
3603}
3604
3605function getWinWidth(){
3606  return window.innerWidth ? window.innerWidth : (document.documentElement ? document.documentElement.offsetWidth : document.body.clientWidth);
3607}
3608
3609function getWinScrollTop(){
3610  return window.scrollY ? window.scrollY : (window.document.documentElement.scrollTop ? window.document.documentElement.scrollTop : window.document.body.scrollTop);
3611}
3612
3613function getWinScrollLeft(){
3614  return window.scrollX ? window.scrollX : (window.document.documentElement.scrollLeft ? window.document.documentElement.scrollLeft : window.document.body.scrollLeft);
3615}
3616
3617function getParameter(name){
3618  var paramReg = new RegExp('[\?|\&]' + name + '=([^\&]+)');
3619  if(paramReg.test(location.search)){
3620    return decodeURIComponent(RegExp.$1.split("+").join(" "));
3621  }
3622  return '';
3623}
3624
3625function setParameter(url, name, value){
3626  var paramReg = new RegExp('([\?|\&])' + name + '=([^\&]+)');
3627  if(paramReg.test(location.search)){
3628    url = url.replace(paramReg, RegExp.$1 + name + '=' + value);
3629  }
3630  else if(url.indexOf('?') != -1){
3631    url += '&' + name + '=' + value;
3632  }
3633  else{
3634    url += '?' + name + '=' + value;
3635  }
3636  return url;
3637}
3638
3639function wSetParameter(url, name, value){
3640  var paramReg = new RegExp('([\?|\&])' + name + '=([^\&]*)');
3641  
3642  if(paramReg.test(url)){
3643    if(value == ''){
3644      url = url.replace(paramReg, RegExp.$1);
3645      url = url.replace(/[\?|\&]$/, '');
3646    }
3647    else{
3648      url = url.replace(paramReg, RegExp.$1 + name + '=' + value);
3649    }
3650  }
3651  else if(value == ''){
3652  }  
3653  else if(url.indexOf('?') != -1){
3654    url += '&' + name + '=' + value;
3655  }
3656  else{
3657    url += '?' + name + '=' + value;
3658  }
3659    
3660  url += '&';  
3661  url = url.replace(/&\w+(\[\])?=&/, '');  
3662  url = url.replace('?&', '?');
3663  url = url.replace(/&&+/g, '&');
3664  url = url.replace(/&$/, '');  
3665  return url;
3666}
3667
3668function trmo(currentElement){
3669  parent.trmox(currentElement)
3670}�
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681function wSetElementValue(nodeObject, attributeValue, addIfNotExists){
3682
3683  let i;
3684  let hasSelected = false;
3685  
3686  addIfNotExists = typeof(addIfNotExists) !== 'undefined' && addIfNotExists;
3687
3688
3689
3690  if(attributeValue){
3691	  if(nodeObject.tagName == 'SELECT'){
3692	    for(i = 0; i < nodeObject.options.length; i++){
3693
3694	      if(nodeObject.options[i].value == attributeValue){
3695
3696	        nodeObject.options[i].selected = true;
3697          hasSelected = true;
3698	      }
3699	    }
3700
3701
3702      if(addIfNotExists && !hasSelected){
3703        nodeObject.add(new Option(attributeValue, attributeValue, true, true));
3704      }      
3705	  }
3706	  else{
3707	    nodeObject.value = attributeValue;
3708	  }
3709	}
3710	else {
3711	  if(nodeObject.tagName == 'SELECT'){
3712	    for(i = 0; i < nodeObject.options.length; i++){
3713	      nodeObject.options[i].selected = false;
3714	    }
3715	  }
3716	  else{
3717	   nodeObject.value = '';
3718	  }
3719	}
3720}
3721
3722function wShowBlocker(options){
3723
3724  options = options || {};
3725
3726  delay = options['displayDelay'] ? options['displayDelay'] : 0;
3727
3728  var frameBlocker = top;
3729
3730  if(top.window['wt'] == 'be'){
3731    frameBlocker = self;
3732  }
3733  else if(options['target'] == 'self' || typeof(frameBlocker.openMainMenu) != 'undefined'){
3734    frameBlocker = self;
3735  }
3736  else if(self.name == 'filemanagerEmbedPanel'){
3737    frameBlocker = self;
3738  }
3739  else if(typeof(wFilemanager) != 'undefined'){
3740    frameBlocker = self;
3741  }
3742  
3743  if(!frameBlocker.wDocument){
3744    frameBlocker = self;
3745  }
3746
3747  frameBlocker.wDocument.wRemove(typeof options['id'] == 'string' ? '#' + options['id'] : '#wBlocker');
3748  var blocker          = frameBlocker.document.createElement('DIV');
3749  blocker.className    = 'wui-page-blocker' + (options['displayDelay'] > 0 ? ' wui-page-blocker-init' : '') + (options['blocker'] ? ' wui-page-blocker-' + options['blocker'] : '');
3750  blocker.id           = typeof options['id'] == 'string' ? options['id'] : 'wBlocker';
3751  blocker.style.height = String(frameBlocker.document.body.offsetHeight) + 'px';
3752  try{
3753    frameBlocker.document.body.appendChild(blocker);
3754  }
3755  catch(e){}
3756  if(options['displayDelay'] > 0){
3757    window.setTimeout(function(){
3758      wDocument.wRemoveClass('#' + blocker.id, 'wui-page-blocker-init');
3759    }, options['displayDelay']);
3760  }
3761}
3762  
3763function wHideBlocker(options){
3764  
3765  options = options || {};
3766
3767  var frameBlocker = top;
3768
3769  if(top.window['wt'] == 'be'){
3770    frameBlocker = self;
3771  }
3772  else if(options['target'] == 'self' || typeof(frameBlocker.openMainMenu) != 'undefined'){
3773    frameBlocker = self;
3774  }
3775  else if(self.name == 'filemanagerEmbedPanel'){
3776    frameBlocker = self;
3777  }
3778  else if(typeof(wFilemanager) != 'undefined'){
3779    frameBlocker = self;
3780  }
3781
3782  if(!frameBlocker.wDocument){
3783    frameBlocker = self;
3784  }
3785
3786  frameBlocker.wDocument.hasHideBlocker = true;
3787  frameBlocker.wDocument.wRemove(typeof options['id'] == 'string' ? '#' + options['id'] : '#wBlocker');
3788}
3789
3790function wOpenEditor(path, redirectEndEdit, referrer, template, target, selectedTab, anchor, options){
3791
3792  options = options || {};
3793
3794  var width   = options['width'] ? options['width'] : (screen.availWidth > 1920 ? 1920 : screen.availWidth - 36);
3795  var height  = options['height'] ? options['height'] : (screen.availHeight > 1200 ? 1200 : screen.availHeight - 96);
3796  
3797  target      = target || '';
3798  selectedTab = selectedTab || '';  
3799  anchor      = anchor || '';   
3800
3801  if(target.match(/popup\((\d+),\s*(\d+)\)/)){
3802    width  = RegExp.$1;
3803    height = RegExp.$2;
3804  }
3805
3806  if(/\/wGlobal\/content\/variables\/default\.wVariables\.php$/.test(path)){
3807    width = 1000;
3808  }
3809  else if(/\/wdExtension\.php/.test(path)){
3810    width = 820;
3811    height = 540;
3812  }  
3813  else if(path.indexOf('.wNavigation.php') >= 0 && typeof wil != 'undefined' && wil == '1'){
3814    width  = 520;
3815
3816  }
3817  else if(path.indexOf('.wNavigation.php') >= 0 || path.indexOf('.wCategories.php') >= 0){
3818    if(target != 'be-full'){
3819      width  = 900;
3820      height = 640;
3821    }
3822    else{
3823      if(screen.availWidth <= 1100){
3824        width   = screen.availWidth;
3825      }
3826      else if(screen.availWidth < 1600){
3827        width   = screen.availWidth - 48;
3828      }
3829      else{
3830        width   = 1600;
3831      }
3832    }
3833  }    
3834  
3835  var url = '';
3836
3837  if(top.wt == 'be'){
3838    url = '/weblication/grid5/scripts/wFilemanager.php?action=startedit&path=' + path + '&referrer=' + referrer + '&redirectEndEdit=' + redirectEndEdit + '&selectedTab=' + selectedTab + '&anchor=' + anchor;
3839    if(target != '_blank'){
3840      top.wUiMask.showDesk(url);
3841    }
3842    else{
3843      wOpenWin(url, '', width, height, {'allowDesktab' : false});
3844    }
3845  }
3846  else if(parent && parent.name == 'wInnerMain'){
3847    url = '/weblication/grid5/scripts/wFilemanager.php?action=startedit&path=' + path + '&referrer=' + referrer + '&redirectEndEdit=' + redirectEndEdit + '&selectedTab=' + selectedTab + '&anchor=' + anchor;
3848    location.href = url;
3849  }
3850  else if(template && template != ''){
3851    url = '/weblication/grid5/apps/wEditorWd8/index.php?action=startedit&target=be&path=' + path + '&referrer=' + referrer + '&redirectEndEdit=' + redirectEndEdit + '&template=' + template + '&selectedTab=' + selectedTab + '&anchor=' + anchor;
3852    wOpenWin(url, '', width, height, 'resizable=yes');
3853  }
3854  else{
3855    url = '/weblication/grid5/scripts/wFilemanager.php?action=startedit&target=be&path=' + path + '&referrer=' + referrer + '&redirectEndEdit=' + redirectEndEdit + '&selectedTab=' + selectedTab + '&anchor=' + anchor;
3856    if(target == 'self'){
3857      location.href = url + '&display=self';
3858    }
3859    else if(target == 'smart'){
3860      location.href = url + '&display=smart';
3861    }
3862    else if(target == 'inline'){
3863      if(typeof wBrowseEditUserType != 'undefined' && wBrowseEditUserType == 'admin'){
3864        wOpenWin(url, '', width, height, 'resizable=yes');
3865      }
3866      else{
3867        location.href = url + '&display=inline';
3868      }
3869    }
3870    else if(target == 'inlineAll'){
3871      location.href = url + '&display=inlineAll';
3872    }
3873    else{
3874      wOpenWin(url, '', width, height, 'resizable=yes');
3875    }
3876  }
3877}
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892function wGetUrl(url, functionResult, options){
3893    
3894  try{
3895    var request = null;
3896
3897    if(document.all){
3898      request = new ActiveXObject("Microsoft.XMLHTTP");
3899    }
3900    else{
3901      request = new XMLHttpRequest();
3902    }
3903    
3904    request.open((options && options['method'] == 'HEAD' ? 'HEAD' : 'GET'), url, true);
3905    if(options && options['mimeType'] == 'text/plain'){
3906      request.overrideMimeType('text/plain');
3907    }
3908
3909    request.onreadystatechange = function(){
3910      if(request.readyState == 4){
3911
3912
3913          if(options && options['dataType'] == 'json'){
3914            try{
3915              responseData = JSON.parse(request.responseText);
3916            }
3917            catch(e){
3918
3919
3920
3921              responseData = {};
3922            }            
3923            if(typeof(functionResult) == 'function'){
3924              functionResult(responseData, request.status);
3925            }
3926          }
3927          else{
3928            if(typeof(functionResult) == 'function'){            
3929              functionResult(request.responseText, request.status);
3930            }
3931          }
3932
3933      }
3934    };
3935    request.send('');
3936  }
3937  catch(e){}    
3938}
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953function wGetUrlPost(url, functionResult, options){
3954
3955  if(typeof(functionResult) == 'function'){
3956  
3957     var request = new XMLHttpRequest(); // ActiveXObject braucht heute niemand mehr (IE < 7)
3958  
3959     var queryString = '';
3960     if(url.indexOf('?') != -1){
3961       var urlData = url.split('?');
3962       url = urlData[0];
3963       queryString = urlData[1];
3964     }
3965  
3966     if(url == ''){
3967       url = location.href;
3968     }
3969     request.open('POST', url, true);
3970     request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
3971  
3972     request.onreadystatechange = function(){
3973       if(request.readyState == 4){
3974
3975         if(request.status == 0){
3976           return;
3977         }
3978         if(options && options['dataType'] == 'json'){
3979           var responseData = {};
3980           try{
3981             responseData = JSON.parse(request.responseText);
3982           }
3983           catch(e){
3984             console.log(url, e);
3985           }
3986           functionResult(responseData, request.status);
3987         }
3988         else{
3989           functionResult(request.responseText, request.status);
3990         }
3991       }
3992     };
3993     request.send(queryString);
3994  
3995    return request;
3996  }
3997}
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010function wGetRequestUrlForm(form, considerUnchecked){
4011  
4012  var i, inputs, textareas;
4013  
4014  if(!form){
4015    return '';
4016  }
4017  
4018  var queryString = '';
4019
4020  inputs = form.getElementsByTagName('INPUT');
4021  
4022  for(i = 0; i < inputs.length; i++){  
4023    if(inputs[i].type == 'radio'){
4024      if(inputs[i].checked == true){
4025        queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].value) + '&';
4026      }
4027      else if(considerUnchecked){
4028        queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].getAttribute('data-valueempty')) + '&';
4029      }
4030    }
4031    else if(inputs[i].type == 'checkbox'){
4032      if(inputs[i].checked == true){
4033        queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].value) + '&';
4034      }
4035      else if(considerUnchecked){
4036        queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].getAttribute('data-valueempty')) + '&';
4037      }
4038    }
4039    else{
4040      queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].value) + '&';  
4041    }
4042  }
4043
4044  textareas = form.getElementsByTagName('TEXTAREA');
4045  
4046  for(i = 0; i < textareas.length; i++){
4047    queryString += textareas[i].name + '=' + encodeURIComponent(textareas[i].value) + '&';
4048  }    
4049
4050  inputs = form.getElementsByTagName('SELECT');
4051
4052  for(i = 0; i < inputs.length; i++){   
4053    if(inputs[i].multiple){
4054      for(var j = 0;j < inputs[i].options.length; j++){
4055        if(inputs[i].options[j].selected){             
4056          queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].options[j].value) + '&';             
4057        }
4058      }        
4059    }
4060    else{
4061      queryString += inputs[i].name + '=' + encodeURIComponent(inputs[i].value) + '&';
4062    }
4063  }   
4064  
4065  queryString = queryString.replace(/&$/, '');
4066  
4067  return '?' + queryString;
4068}�
4069
4070
4071
4072
4073
4074
4075
4076
4077function wRememberPageDataBeforeReload(){
4078
4079  document.cookie = 'wlst=' + getWinScrollTop() + ';sameSite=Lax';
4080  document.cookie = 'wlsl=' + getWinScrollLeft() + ';sameSite=Lax';
4081  
4082  var editorConfigMask = wDocument.element('#wEditorConfigExpanded');
4083  if(editorConfigMask){
4084    var configMaskInnerScroll = wDocument.elementOf(editorConfigMask, '.wEditorElementConfiguration');
4085    if(configMaskInnerScroll){
4086      document.cookie = 'wcst=' + configMaskInnerScroll.scrollTop + ';sameSite=Lax';
4087    }
4088  }
4089  
4090  var editorExtensionArea = wDocument.element('#wEditorExtensionArea');
4091  if(editorExtensionArea){
4092    var displayEditorExtensionArea = wDocument.getCurrentStyle(editorExtensionArea, 'dis
4092play');
4093    document.cookie = 'wdea=' + displayEditorExtensionArea + ';sameSite=Lax';    
4094  }  
4095}�
4096
4097
4098
4099
4100var wWeblicationPopup = null;
4101var wWeblicationPopupBlocker = null;
4102var wWeblicationPopupElementBlur = '';
4103
4104function wOpenPopup(url, name, width, height, options){
4105
4106  options = options || {};
4107  
4108  wWeblicationPopupElementBlur = '';
4109
4110  if(typeof(options['elementBlur']) !== 'undefined'){
4111    wWeblicationPopupElementBlur = '#' + options['elementBlur'];
4112    let elementBlur = wDocument.element(wWeblicationPopupElementBlur);
4113    if(elementBlur){
4114      elementBlur.style.filter = 'blur(8px)';
4115    }
4116  }
4117  
4118  let allowClose = typeof(options['allowClose']) === 'undefined' && options['allowClose'];
4119
4120  if(width == 'max'){
4121    width = window.innerWidth;
4122  }
4123  
4124  if(height == 'max'){
4125    height = window.innerHeight;
4126  }
4127
4128  if(wDocument.element('#wWeblicationPopup')){
4129    wDocument.wRemove('#wWeblicationPopup');
4130    wDocument.wRemove('#wWeblicationPopupBlocker');
4131  }
4132
4133  wWeblicationPopupBlocker           = document.createElement('DIV');
4134  wWeblicationPopupBlocker.id        = 'wWeblicationPopupBlocker';
4135  if(allowClose){
4136    wWeblicationPopupBlocker.className = 'wui-popup-blocker wui-popup-blocker-init';    
4137    wWeblicationPopupBlocker.onclick   = function(){wClosePopup()};
4138  }
4139  else{
4140    wWeblicationPopupBlocker.className = 'wui-popup-blocker wui-popup-blocker-init wui-popup-blocker-nocloser';    
4141
4142  }
4143  window.setTimeout(function(){
4144    wDocument.wAddClass('#wWeblicationPopupBlocker', 'wui-popup-blocker-loaded');
4145  }, 10);
4146
4147  document.body.appendChild(wWeblicationPopupBlocker);
4148
4149  wWeblicationPopup                = document.createElement('DIV');
4150  wWeblicationPopup.id             = 'wWeblicationPopup';
4151  wWeblicationPopup.className      = 'wui-popup wui-popup-init';
4152  wWeblicationPopup.wSetData('name', name);
4153  wWeblicationPopup.wSetData('width', width);
4154  wWeblicationPopup.wSetData('height', height);
4155  wWeblicationPopup.wSetData('options', options);   
4156  
4157  if(options['content'] == 'html'){
4158    wWeblicationPopup.innerHTML        = (options['hideHeader'] != true ? '<div id="wWeblicationPopupHeader" class="wui-popup-header">' + (typeof(options) && options['title'] != 'undefined' ? options['title'] : '') + '</div>' : '') + '<div id="wWeblicationPopupFrameProtector" style="position:absolute;width:100%;height:100%;display:none;"></div><div style="width:100%;height:100%;background-color:#ffffff">' + url + '</div>';
4159    document.body.appendChild(wWeblicationPopup);
4160
4161    if(wDocument.element('#wWeblicationPopupHeader')){
4162      wDocument.element('#wWeblicationPopupHeader').innerHTML = this.contentDocument.title;
4163    }
4164    wDocument.wAddClass('#wWeblicationPopup', 'wui-popup-loaded');    
4165  }
4166  else{
4167    if(options['hideStatusbar']){
4168      wWeblicationPopup.innerHTML        = (options['hideHeader'] != true ? '<div id="wWeblicationPopupHeader" class="wui-popup-header">' + (typeof(options) && options['title'] != 'undefined' ? options['title'] : '') + '</div>' : '') + '<div id="wWeblicationPopupFrameProtector" style="position:absolute;width:100%;height:100%;display:none;"></div><iframe id="wWeblicationPopupFrame" style="background-color:#ffffff;width:100%;height:calc(100% - 24px);margin-top:24px" frameborder="0" src="about:blank"></iframe>';
4169    }
4170    else{
4171      wWeblicationPopup.innerHTML        = (options['hideHeader'] != true ? '<div id="wWeblicationPopupHeader" class="wui-popup-header">' + (typeof(options) && options['title'] != 'undefined' ? options['title'] : '') + '</div>' : '') + '<div id="wWeblicationPopupFrameProtector" style="position:absolute;width:100%;height:100%;display:none;"></div><iframe id="wWeblicationPopupFrame" style="background-color:#ffffff;width:100%;height:100%" frameborder="0" src="about:blank"></iframe>';
4172    }
4173  
4174    document.body.appendChild(wWeblicationPopup);
4175    wWeblicationPopup.wDraggable({'onAfterStartDrag' : function(){wDocument.show('#wWeblicationPopupFrameProtector');}, 'onAfterEndDrag' : function(){wDocument.hide('#wWeblicationPopupFrameProtector');}});
4176    wDocument.wAddEvent('#wWeblicationPopupFrame', 'load', function(event){
4177      try{
4178        if(wDocument.element('#wWeblicationPopupHeader')){
4179          wDocument.element('#wWeblicationPopupHeader').innerHTML = this.contentDocument.title;
4180        }
4181        wDocument.wAddClass('#wWeblicationPopup', 'wui-popup-loaded');
4182        this.contentWindow.opener = this.contentWindow.parent;      
4183      }
4184      catch(e){
4185      }
4186    });
4187    
4188    wDocument.element('#wWeblicationPopupFrame').contentDocument.location.href = url;
4189  }  
4190
4191  var winWidth  = window.innerWidth ? window.innerWidth : document.body.clientWidth;
4192  var winHeight = window.innerHeight ? window.innerHeight : document.body.clientHeight;
4193  
4194  var popupWidth  = width ? width : parseInt(wWeblicationPopup.wGetData('width') ? wWeblicationPopup.wGetData('width') : 640);
4195  var popupHeight = height ? height : parseInt(wWeblicationPopup.wGetData('height') ? wWeblicationPopup.wGetData('height') : 480);
4196
4197  var offsetLeft = parseInt((winWidth  - wWeblicationPopup.offsetWidth) / 2);
4198  var offsetTop  = parseInt((winHeight -  wWeblicationPopup.offsetHeight) / 2); 
4199
4200  if(document.documentElement && document.documentElement.className.indexOf('isMobileSafari') != -1){
4201    offsetTop = 80;
4202  }
4203
4204  marginLeft = - popupWidth / 2;
4205  marginTop  = - popupHeight / 2;
4206
4207  if(popupWidth > winWidth){
4208    popupWidth = winWidth;
4209    offsetLeft = 0;
4210    marginLeft = 0;
4211  }
4212
4213  if(popupHeight > winHeight - 80){
4214    popupHeight = winHeight;
4215    offsetTop = 0;
4216    marginTop = 0;
4217  }
4218
4219  wWeblicationPopup.style.left = String(offsetLeft) + 'px';
4220  wWeblicationPopup.style.top  = String(offsetTop) + 'px';
4221  wWeblicationPopup.style.marginLeft = String(marginLeft) + 'px';
4222  wWeblicationPopup.style.marginTop = String(marginTop) + 'px';
4223  wWeblicationPopup.style.width = String(popupWidth) + 'px';
4224  wWeblicationPopup.style.height = String(popupHeight) + 'px';
4225
4226  return true;
4227}
4228
4229function wClosePopup(){
4230
4231  wDocument.wRemove(wWeblicationPopup);
4232  wDocument.wRemove(wWeblicationPopupBlocker);
4233  wWeblicationPopup = null;
4234  
4235  if(wWeblicationPopupElementBlur !== ''){
4236    let elementBlur = wDocument.element(wWeblicationPopupElementBlur);
4237    if(elementBlur){
4238      elementBlur.style.filter = '';
4239    }  
4240  }
4241  return true;
4242}�
4243
4244
4245
4246
4247function wOpenWin(url, name, width, height, options){
4248
4249  options = options || '';
4250
4251  var maximizeHeight = false;
4252
4253  if(width == ''){
4254    var regWidth = /width=(\d+)/;
4255    regWidth.exec(options);
4256    width = RegExp.$1;
4257    if(width == ''){
4258      width = 640;
4259    }
4260  }
4261  else if(width == 'max'){
4262    width = screen.availWidth;
4263  }
4264
4265  if(height == ''){
4266    var regHeight = /height=(\d+)/;
4267    regHeight.exec(options);
4268    height = RegExp.$1;
4269    if(height == ''){
4270      height = 480;
4271    }
4272  }
4273  else if(height == 'max'){
4274    height = screen.availHeight;
4275    maximizeHeight = true;
4276  }
4277
4278
4279  if(typeof name != 'undefined'){
4280    name = name.replace(/\W/g, '');
4281  }
4282
4283  if(!name && !width && !height && !options){
4284    return window.open(url, name);
4285  }
4286  
4287  if(mac && isSafari){
4288    height += 45;
4289  }
4290
4291
4292
4293
4294
4295  if(top.wt != 'be'){
4296    if(!/resizable/.test(options)){
4297      options = 'resizable=yes,scrollbars=yes,status=no,location=no';
4298    }
4299    options = options.replace(/resizable=no/, 'resizable=yes');
4300  }
4301
4302  
4303  var diffWidth  = top.window.outerWidth  - top.window.innerWidth;
4304  var diffHeight = top.window.outerHeight - top.window.innerHeight;
4305
4306  var posLeft = parseInt(options['left'] ? options['left'] : (screen.availWidth / 2)  - ((width + diffWidth)  / 2));
4307  var posTop  = parseInt(options['top'] ? options['top'] : (screen.availHeight / 2) - ((height + diffHeight) / 2));
4308
4309
4310
4311  
4312  if(maximizeHeight){
4313    height -= 60;
4314  }
4315
4316
4317
4318  if(top.wt == 'be' && options['allowDesktab'] != false && typeof(wUiMask.getDeskIdOfWindow) == 'function'){
4319    var deskIdOfWindow = wUiMask.getDeskIdOfWindow(window);
4320    top.wUiMask.showDesk(url, options['title'], {'deskIdOfOpener' : deskIdOfWindow, 'currentWindow' : self});
4321  }
4322  else{
4323    var windowFeatures = 'top='+posTop+',left='+posLeft+',width='+width+',height='+height+',' + options;
4324    if(isSafari && (typeof(event) === 'undefined' || !event.metaKey)){
4325      windowFeatures = '';
4326    }    
4327
4328    var rtc = window.open(url, name, windowFeatures);
4329
4330    window.setTimeout(function(){
4331      try{
4332        if(/\/wIDE/.test(rtc.location.href)){
4333          top.wDocument.tmp['wWindowIDE'] = rtc;
4334        }
4335      }
4336      catch(e){}  
4337    }, 1000);
4338
4339    if(ie && ieVers >= 11){
4340      return rtc;
4341    }
4342
4343    if(!rtc){
4344      var link = document.createElement('A');
4345      link.href = "javascript:window.open('" + url + "', '', 'width=" + width + ",height=" + height + "');document.getElementById('wPopupBlocker').parentNode.removeChild(document.getElementById('wPopupBlocker'));void(0);";
4346      link.className = 'popupLink';
4347      link.innerHTML = 'Fenster jetzt Öffnen';
4348      var popupBlockerBox = document.createElement('DIV');
4349      popupBlockerBox.className = 'wPopupblocker';
4350      popupBlockerBox.id = 'wPopupBlocker';
4351      var popupBlockerBoxInner = document.createElement('DIV');
4352      popupBlockerBoxInner.className = 'popupBlockerInner';
4353
4354      var textBeforeLink = document.createElement('SPAN');
4355      textBeforeLink.innerHTML = 'Der Browser hat das Öffnen eines neuen Fensters über den Popup-Blocker verhindert!&#160;';
4356
4357      popupBlockerBoxInner.appendChild(textBeforeLink);
4358
4359      popupBlockerBox.appendChild(popupBlockerBoxInner);
4360
4361      popupBlockerBoxInner.appendChild(link);
4362      document.body.insertBefore(popupBlockerBox, document.body.firstChild);
4363    }
4364    return rtc;
4365  }
4366}
4367
4368function wEmbedString(elementId, string, options){
4369
4370  options = options || {};
4371
4372  if(options['onlyBody']){
4373    string = string.replace(/[\s\S]*<body[^>]*>([\s\S]*)<\/body>[\s\S]*/m, '$1');
4374  }
4375  else if(options['elementOnly']){
4376    string = string.replace(/[\s\S]*<body[^>]*>([\s\S]*)<\/body>[\s\S]*/m, '$1');
4377  }
4378
4379  string = wActivateFunctions(string);
4380
4381  if(document.getElementById(elementId)){
4382    document.getElementById(elementId).innerHTML = string;
4383  }
4384}�
4385
4386
4387
4388
4389
4390
4391
4392
4393function wActivateFunctions(string){
4394
4395  var origString = string;
4396  string   = string.replace(/[\n\r]+/g, '~_wnl_~');
4397  string   = string.replace(/= function/g, '~_wfunc_~');
4398  string   = string.replace(/= 'function'/g, '~_wfuncext_~');
4399  string   = string.replace(/= "function"/g, '~_wfuncext_~');
4400  string   = string.replace(/<\/SCRIPT>/, '</script>');
4401
4402  var scripts  = string.split('<' + '/' + 's' + 'cript>');
4403  var jsString = '';
4404
4405  for(var i = 0; i < scripts.length - 1; i++){
4406
4407    var scriptStr = scripts[i].replace(/.*<script[^>]*>/i, '');
4408
4409    jsString += scriptStr;
4410  }
4411
4412  jsString     = jsString.replace(/~_wnl_~/g, "\n");
4413
4414  string = string.replace(/~_wnl_~/g, "\n");
4415  string = string.replace(/~_wfuncext_~/g, "= 'function'");
4416
4417  var jsFunctions = jsString.split(/function\s*/);
4418
4419  for(var i = 0; i < jsFunctions.length; i++){
4420    if(jsFunctions[i] != ''){
4421      if(jsFunctions[i].search(/function|~_wfunc_~|~_wfuncext_~/i) != -1){
4422        jsFunctions[i] = jsFunctions[i].replace(/~_wfunc_~/g, "= function");
4423        jsFunctions[i] = jsFunctions[i].replace(/~_wfuncext_~/g, "= 'function'");
4424      }
4425      var tempReplace  = jsFunctions[i].search(/(\w+)\s?\(/);
4426      var functionName = RegExp.$1;
4427
4428      var regexp = new RegExp('function ' + functionName);
4429      if(origString.search(regexp) != -1){
4430        var jsFunction = jsFunctions[i].replace(/(\w+)\s?\(/, 'DOLLAR_1_TMP = function(');
4431        jsFunction = jsFunction.replace('DOLLAR_1_TMP', RegExp.$1);
4432      }
4433      else{
4434        var jsFunction = jsFunctions[i];
4435      }
4436      jsFunction = jsFunction.replace(/\/\*\]\]>\*\/\/\*<!\[CDATA\[\*\//, '');
4437      try{
4438        console.log(jsFunction);
4439      }catch(e){}
4440    }
4441  }
4442
4443  return string;
4444}
4445
4446wToggleDisplay = wDocument.toggleDisplay;
4447
4448wWeblicationMessagebox = null;
4449
4450wMessageboxObject = {};�
4451
4452
4453
4454
4455
4456
4457
4458
4459function wInfobox(id, title, content, buttons, type){
4460  wMessagebox({'type': type,
4461               'title': title,
4462               'content': content,
4463               'buttons': [{'caption': TEXT_OK, 'icon': 'ok', 'selected' : true, 'action': function(){}}]
4464              });
4465}
4466
4467function wMessagebox(options){
4468
4469
4470  var frameMessagebox = top;
4471  
4472  let isBanner = typeof options['mode'] !== 'undefined' && options['mode'] === 'banner';  
4473
4474  if(top.window['wt'] == 'be'){
4475    if(!isBanner){
4476      wShowBlocker({'id' : 'blockerMessagebox'});
4477    }
4478    frameMessagebox = self;
4479  }
4480  else{
4481    if(!isBanner){
4482      wShowBlocker({'id' : 'blockerMessagebox'});
4483    }  
4484    if(typeof(frameMessagebox.openMainMenu) != 'undefined'){
4485      frameMessagebox = self;
4486    }
4487    else if(self.name == 'filemanagerEmbedPanel'){
4488      frameMessagebox = self;
4489    }
4490    else if(typeof(wFilemanager) != 'undefined'){
4491      frameMessagebox = self;
4492    }
4493  }
4494  
4495  if(!frameMessagebox.wDocument){
4496    frameMessagebox = self;
4497  }
4498  
4499  if(typeof options['fadeout'] !== 'undefined' && options['fadeout'] > 0){
4500    window.setTimeout(function(){wCloseMessagebox()}, 1000 * options['fadeout']);
4501  }
4502  
4503  frameMessagebox.wDocument.wRemove('#wWeblicationMessagebox');
4504
4505  wWeblicationMessagebox                = frameMessagebox.document.createElement('DIV');
4506  wWeblicationMessagebox.id             = 'wWeblicationMessagebox';
4507  wWeblicationMessagebox.className      = 'wui-messagebox' + (isBanner ? ' wui-messagebox-banner' : '') + ' wui-messagebox-init' + (typeof(options['title']) === 'undefined' || options['title'] === '' ? ' wui-messagebox-notitle' : '');
4508  wWeblicationMessagebox.style.visibility = 'hidden';
4509
4510
4511
4512  
4513  wWeblicationMessageboxInner            = frameMessagebox.document.createElement('DIV');
4514  wWeblicationMessageboxInner.className  = 'wui-messagebox-inner';  
4515  
4516  if(typeof(options['title']) !== 'undefined' && options['title'] !== ''){
4517    wMessageboxTitle = frameMessagebox.document.createElement('DIV');
4518    wMessageboxTitle.className = 'wui-messagebox-title';
4519    wMessageboxTitle.innerHTML = options['title'];
4520    
4521    wWeblicationMessageboxInner.appendChild(wMessageboxTitle);
4522  }
4523  
4524  if(options['type']){
4525    wMessageboxIcon = frameMessagebox.document.createElement('span');
4526    wMessageboxIcon.className = 'wui-messagebox-icon wui-messagebox-icon-' + options['type'];
4527
4528  }
4529  
4530  wWeblicationMessageboxInner.appendChild(wMessageboxIcon);
4531
4532  wMessageboxContentOuter = frameMessagebox.document.createElement('DIV');
4533  wMessageboxContentOuter.className = 'wui-messagebox-content-outer';
4534    
4535  wMessageboxContent = frameMessagebox.document.createElement('DIV');
4536  wMessageboxContent.className = 'wui-messagebox-content';
4537  wMessageboxContent.innerHTML = options['content'];
4538  
4539  wWeblicationMessageboxInner.appendChild(wMessageboxContentOuter);
4540
4541  wMessageboxContentOuter.appendChild(wMessageboxContent);
4542  
4543  wMessageboxObject.functionsReturn = new Array();
4544
4545  if(typeof(options['buttons']) != 'undefined'){
4546    
4547    wMessageboxButtons = frameMessagebox.document.createElement('DIV');
4548    wMessageboxButtons.className = 'wui-messagebox-buttons';
4549
4550    wWeblicationMessageboxInner.appendChild(wMessageboxButtons);  
4551    
4552    wMessageboxObject.numberButtons = options['buttons'].length;
4553    
4554    for(var i = options['buttons'].length - 1; i >= 0; i--){
4555      wMessageboxButton = frameMessagebox.document.createElement('button');
4556
4557
4558      wMessageboxButton.setAttribute('data-index', i);
4559
4560      wMessageboxObject.functionsReturn[i] = options['buttons'][i]['action'];
4561
4562
4563      if(options['buttons'][i]['id']){
4564        wMessageboxButton.setAttribute('id', options['buttons'][i]['id']);
4565      }
4566      
4567      if(options['buttons'][i]['selected']){
4568        wMessageboxButton.className      = 'wui-button wui-button-focus';        
4569        wMessageboxObject.functionReturn = options['buttons'][i]['action'];
4570        wMessageboxObject.selectedButton = i;
4571      }
4572      else{
4573        wMessageboxButton.className = 'wui-button';        
4574      }
4575
4576      if(options['buttons'][i]['class']){
4577        wMessageboxButton.className += ' ' + options['buttons'][i]['class'];
4578      }
4579      
4580      wMessageboxButton.innerHTML = options['buttons'][i]['caption'];
4581      if(options['buttons'][i]['closeOnlyOnReturnTrue']){
4582        actionButton = options['buttons'][i]['action'];
4583        (function(actionButton){
4584          wMessageboxButton.wAddEvent('click', function(){
4585            if(typeof(actionButton) == 'function' && actionButton()){
4586              wCloseMessagebox();
4587            }
4588          });
4589        })(actionButton);
4590      }
4591      else{
4592        wMessageboxButton.wAddEvent('click', function(){wCloseMessagebox()});
4593        wMessageboxButton.wAddEvent('click', options['buttons'][i]['action']);
4594      }
4595      wWeblicationMessageboxInner.appendChild(wMessageboxButton);
4596    }
4597  }
4598
4599  wWeblicationMessagebox.appendChild(wWeblicationMessageboxInner);
4600
4601  frameMessagebox.document.body.appendChild(wWeblicationMessagebox);
4602  if(frameMessagebox.wDocument && frameMessagebox.wDocument.element('.wui-mask')){
4603    frameMessagebox.wDocument && frameMessagebox.wDocument.element('.wui-mask').wAddClass('wui-has-messagebox');
4604  }
4605
4606  if(wMessageboxContent.offsetHeight <= 16){
4607    wMessageboxContent.wAddClass('wui-messagebox-content-single');
4608  }
4609
4610  wAdaptMessagebox();
4611  wWeblicationMessagebox.wRemoveClass('wui-messagebox-init');
4612  if(typeof options['allowKeydown'] === 'undefined' || options['allowKeydown'] === false){
4613    wDocument.wAddEvent(frameMessagebox, 'keydown', wMessageboxEventListener);
4614  }
4615}
4616
4617var wMessageboxEventListener = function(event){
4618
4619  if(!event.ctrlKey){
4620    event.preventDefault();                
4621    event.stopPropagation();  
4622  }
4623
4624  var frameMessagebox = top;
4625  if(typeof(frameMessagebox.openMainMenu) != 'undefined'){
4626    frameMessagebox = self;
4627  }
4628
4629  if(self.name == 'filemanagerEmbedPanel'){
4630    frameMessagebox = self;
4631  }
4632  else if(typeof(wFilemanager) != 'undefined'){
4633    frameMessagebox = self;
4634  }
4635  
4636  if(event.keyCode == 27){    
4637    wCloseMessagebox();
4638  }
4639  else if(event.keyCode == 13){
4640    wCloseMessagebox();
4641    if(typeof wMessageboxObject.functionReturn == 'function'){
4642      wMessageboxObject.functionReturn();    
4643    }
4644  }
4645  else if(event.keyCode == 39){
4646    if(wMessageboxObject.selectedButton < wMessageboxObject.numberButtons - 1){
4647      frameMessagebox.wDocument.element('#wWeblicationMessagebox button[data-index=\'' + wMessageboxObject.selectedButton + '\']').wRemoveClass('wui-button-focus');
4648      wMessageboxObject.selectedButton++;
4649      frameMessagebox.wDocument.element('#wWeblicationMessagebox button[data-index=\'' + wMessageboxObject.selectedButton + '\']').wAddClass('wui-button-focus');
4650      wMessageboxObject.functionReturn = wMessageboxObject.functionsReturn[wMessageboxObject.selectedButton];
4651    }
4652  }
4653  else if(event.keyCode == 37){
4654    if(wMessageboxObject.selectedButton > 0){
4655      frameMessagebox.wDocument.element('#wWeblicationMessagebox button[data-index=\'' + wMessageboxObject.selectedButton + '\']').wRemoveClass('wui-button-focus');
4656      wMessageboxObject.selectedButton--;
4657      frameMessagebox.wDocument.element('#wWeblicationMessagebox button[data-index=\'' + wMessageboxObject.selectedButton + '\']').wAddClass('wui-button-focus');
4658      wMessageboxObject.functionReturn = wMessageboxObject.functionsReturn[wMessageboxObject.selectedButton];    
4659    }
4660  }  
4661};�
4662
4663
4664
4665
4666
4667
4668
4669
4670function wAdaptMessagebox(){
4671
4672  
4673  if(wWeblicationMessagebox){
4674
4675    var currentHeight    = getWinHeight();
4676    var messageboxHeight = wWeblicationMessagebox.offsetHeight;
4677
4678    if(messageboxHeight > currentHeight){
4679      messageboxHeight = currentHeight;
4680
4681      var messegeboxInnerHeight = currentHeight - 96;
4682
4683      var contentElement = wDocument.elementOf(wWeblicationMessagebox, '.wui-messagebox-content');
4684      contentElement.style.height = String(messegeboxInnerHeight) + 'px';
4685    }
4686
4687    wWeblicationMessagebox.style.marginTop  = '-' + String(messageboxHeight / 2) + 'px';
4688    wWeblicationMessagebox.style.marginLeft = '-' + String(wWeblicationMessagebox.offsetWidth / 2) + 'px';
4689    wWeblicationMessagebox.style.visibility = 'visible';
4690  }
4691}�
4692
4693
4694
4695
4696
4697
4698
4699
4700function wHasMessagebox(){
4701
4702
4703  var frameMessagebox = top;
4704
4705  if(top.window['wt'] == 'be'){
4706    frameMessagebox = self;
4707  }
4708  else if(typeof(frameMessagebox.openMainMenu) != 'undefined'){
4709    frameMessagebox = self;
4710  }
4711  if(self.name == 'filemanagerEmbedPanel'){
4712    frameMessagebox = self;
4713  }
4714  else if(typeof(wFilemanager) != 'undefined'){
4715    frameMessagebox = self;
4716  }
4717  
4718  return frameMessagebox.wDocument.element('#wWeblicationMessagebox') ? true : false;
4719}�
4720
4721
4722
4723
4724
4725
4726
4727
4728function wCloseMessagebox(){
4729
4730
4731  var frameMessagebox = top;
4732
4733  if(top.window['wt'] == 'be'){
4734    frameMessagebox = self;
4735  }
4736  else if(typeof(frameMessagebox.openMainMenu) != 'undefined'){
4737    frameMessagebox = self;
4738  }
4739  if(self.name == 'filemanagerEmbedPanel'){
4740    frameMessagebox = self;
4741  }
4742  else if(typeof(wFilemanager) != 'undefined'){
4743    frameMessagebox = self;
4744  }
4745  
4746  wHideBlocker();
4747  wHideBlocker({'id' : 'blockerMessagebox'});
4748  
4749  wDocument.wRemoveEvent(frameMessagebox, 'keydown', wMessageboxEventListener);  
4750
4751  if(!frameMessagebox.wDocument){
4752    frameMessagebox = self;
4753  }
4754
4755  if(frameMessagebox.wDocument.element('#wWeblicationMessagebox')){    
4756    if(frameMessagebox.wDocument.element('#wWeblicationMessagebox').wHasClass('wui-messagebox-banner')){
4757      frameMessagebox.wDocument.element('#wWeblicationMessagebox').wAddClass('wui-messagebox-closed');
4758      window.setTimeout(function(){
4759        frameMessagebox.wDocument.wRemove('#wWeblicationMessagebox');
4760      }, 300);
4761    }
4762    else{
4763      frameMessagebox.wDocument.wRemove('#wWeblicationMessagebox');
4764    }
4765  }
4766  if(frameMessagebox.wDocument && frameMessagebox.wDocument.element('.wui-mask')){
4767    frameMessagebox.wDocument && frameMessagebox.wDocument.element('.wui-mask').wRemoveClass('wui-has-messagebox');
4768  }
4769  
4770  wWeblicationMessagebox = null;
4771}�
4772
4773
4774
4775
4776
4777
4778
4779
4780function wSetFavicon(path){       
4781  
4782  var elementHead = document.getElementsByTagName('head')[0];
4783  
4784  var hasFavicon = false;
4785  
4786  for(var i = elementHead.childNodes.length - 1; i >= 0; i--){
4787    if(elementHead.childNodes[i].nodeType == 1 && elementHead.childNodes[i].nodeName == 'LINK' && elementHead.childNodes[i].getAttribute('type') == 'image/x-icon'){
4788      if(elementHead.childNodes[i].getAttribute('href') != path){
4789        elementHead.childNodes[i].setAttribute('href', path);
4790      }
4791      hasFavicon = true;
4792    }
4793  }
4794  
4795  if(!hasFavicon){
4796    var link  = document.createElement('link');
4797    link.type = 'image/x-icon';
4798    link.rel  = 'shortcut icon';
4799    link.href = path;
4800    document.getElementsByTagName('head')[0].appendChild(link); 
4801  }
4802}      �
4803
4804
4805
4806
4807
4808
4809
4810
4811function wGetStatusSoap(soapStr){
4812
4813  if(soapStr.indexOf('<w:status>1</w:status>') > -1){
4814    return 1;
4815  }
4816  else{
4817    return 0;
4818  }
4819}�
4820
4821
4822
4823
4824
4825
4826
4827
4828function wGetDataSoap(soapStr){
4829
4830  if(/<w:data>(.*)<\/w:data>/.test(soapStr)){
4831    return RegExp.$1;
4832  }
4833  else{
4834    return '';
4835  }
4836}�
4837
4838
4839
4840
4841
4842
4843
4844
4845function wGetFaultCode(soapStr){
4846
4847  var searchFaultCode = soapStr.search(/<faultcode>(.*)<\/faultcode>/);
4848
4849  if(searchFaultCode > -1){
4850
4851    return RegExp.$1;
4852  }
4853  else{
4854    return '0';
4855  }
4856}�
4857
4858
4859
4860
4861
4862
4863
4864
4865function wGetCookieValue(name){
4866  
4867  var regExp = new RegExp('' + name + '=([^;]*)');
4868
4869  if(regExp.test(document.cookie)){
4870
4871    return RegExp.$1;
4872  }
4873  else{
4874    return '';
4875  }
4876}�
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887function wGetQuerystringValue(name, querystring){
4888  
4889  querystring = querystring || location.search;
4890  querystring = '&' + querystring.replace(/^[\?|&]/, '');
4891  
4892  var regExp = new RegExp('&' + name + '=([^&]+)');
4893  if(regExp.test(querystring)){
4894    try{
4895      return decodeURI(RegExp.$1).replace(/\+/g, ' ');
4896    }
4897    catch(e){
4898      return '';
4899    }
4900  }
4901  else{
4902    return '';
4903  }
4904}�
4905
4906
4907
4908
4909
4910
4911
4912
4913function wLoadXml(str){
4914
4915  var domObject = null;
4916
4917  if(document.all){
4918    domObject = new ActiveXObject("MSXML.DomDocument");
4919    if(!domObject.loadXML(str)){
4920      throw "wLoadXml Parse error";
4921    }
4922  }
4923  else{
4924    domParser = new DOMParser();
4925    domObject = domParser.parseFromString(str, "text/xml");
4926  }
4927  return domObject;
4928}�
4929
4930
4931
4932
4933
4934
4935
4936
4937function wExtractJsToExecute(str){
4938  
4939  var result   = '';
4940  var strArray = str.split(/<script[^>]*>
4940/);
4941  for(var i = 1; i < strArray.length; i++){
4942    strArray[i] = strArray[i].replace(/<\/script[^>]*>[\s\S]*/m, '') + ';';
4943    result += strArray[i];
4944  }
4945  return result;
4946}
4947
4948var wHash = function(){
4949
4950  this.data   = new Object();
4951  this.length = 0;
4952
4953  this.setValue = function(key, value){
4954    this.data[key] = value;
4955    this.length = 0;
4956    for(var tmp in this.data){
4957      this.length++;
4958    }
4959  };
4960
4961  this.getValue = function(key){
4962    return this.data[key];
4963  };
4964
4965  this.remove = function(key){
4966    delete this.data[key];
4967    this.length = 0;
4968    for(var tmp in this.data){
4969      this.length++;
4970    }
4971  };
4972
4973  this.getLength = function(){
4974    return this.length;
4975  };
4976};
4977
4978var wOpenQuickAccess = function(type){
4979
4980  wDocument.wRemove('#wQuickAccess');
4981  
4982  if(typeof wUserType !== 'undefined'){
4983    if(wUserType !== 'admin' && wUserType !== 'standard'){
4984      return;
4985    }
4986  }
4987  
4988  if(typeof wVersionGrid === 'undefined' && self !== top){
4989    wVersionGrid = top.wVersionGrid;
4990  }
4991
4992  if(type == 'functions' && typeof(wBrowseEditMode) != 'undefined'){
4993    var quickAccessHTML = '<div id="wQuickAccess" class="wui-quickaccess wui-quickaccess-functions" onclick="wCloseQuickAccess()" data-wv="' + wVersionGrid + '"><div id="wQuickAccessInner" onclick="event.stopPropagation();"><div id="wQuickAccessFunctionsHeader" onclick="wCloseQuickAccess()"><input type="text" id="wQuickAccessFunctionsInput" placeholder="Quickfilter" autocomplete="off" onclick="event.stopPropagation();"/><div id="wQuickAccessFunctionsCloser" onclick="wCloseQuickAccess()" style="display: block;"></div></div><div id="wQuickAccessFunctionsEntries"><div id="wQuickAccessFunctionsGroupMain"><div id="wQuickAccessFunctionsEntriesLastModified"></div></div><div id="wQuickAccessFunctionsGroupSub"></div></div></div></div>';
4994    wDocument.element('body').wPrepend(quickAccessHTML);
4995    initQuickAccessFunctions();
4996  }
4997  else{
4998    
4999    var csrfParam = '';
5000    if(typeof(wCsrf) !== 'undefined'){
5001      csrfParam = '&wcsrf=' + wCsrf;
5002    }
5003    else if(typeof(parent.wCsrf) !== 'undefined'){
5004      csrfParam = '&wcsrf=' + parent.wCsrf;
5005    }  
5006    
5007    if(csrfParam !== ''){
5008      var urlQuickAccess = '/weblication/grid5/apps/wIDE/index.php?action=quickaccess' + (top.wt == 'be' ? '&editor=code' : '') + csrfParam;
5009      var quickAccessHTML = '<div id="wQuickAccess" class="wui-quickaccess wui-quickaccess-files" onclick="wCloseQuickAccess()"><div onclick="event.stopPropagation();"><iframe id="iframeQuickAccess" src="' + urlQuickAccess + '"></iframe></div></div>';
5010      wDocument.element('body').wPrepend(quickAccessHTML);
5011    }
5012  }
5013
5014  document.documentElement.wAddClass('wQuickAccessVisible');
5015}
5016
5017var wCloseQuickAccess = function(){
5018  wDocument.wRemove('#wQuickAccess');
5019  document.documentElement.wRemoveClass('wQuickAccessVisible');
5020}
5021
5022var wOpenMessagecenter = function(path, messageId){
5023
5024  wDocument.wRemove('#wLayerMessagecenter');
5025  
5026  if(typeof(messagecenterDisabled) != 'undefined' && messagecenterDisabled){
5027    return false;
5028  }
5029  
5030  var context = (typeof(wPathPageCur) != 'undefined' ? wPathPageCur : location.pathname);  
5031  
5032  if(typeof(path) == 'undefined' || !path || path == ''){
5033    path = '';
5034  }
5035 
5036  var urlMessagecenter = '/weblication/grid5/scripts/wSystem.php?action=showMessagecenter&path=' + path + '&context=' + context + (typeof messageId !== 'undefined' ? '&messageId=' + messageId : '') + '&wcsrf=' + wCsrf;
5037
5038  var messagecenterHTML = '<div id="wLayerMessagecenter" class="wui-layer-messagecenter" onclick="wCloseMessagecenter()"><div onclick="event.stopPropagation();"><iframe id="iframeMessagecenter" src="' + urlMessagecenter + '"></iframe></div></div>';
5039  wDocument.element('body').wPrepend(messagecenterHTML);
5040  if(wDocument.element('#wglBePanelMessages[data-hasnewmessages=\'1\']')){
5041    wDocument.element('#wglBePanelMessages').setAttribute('data-hasnewmessages', '0');
5042  }    
5043}
5044
5045var wCloseMessagecenter = function(){
5046  wDocument.wRemove('#wLayerMessagecenter');
5047}
5048
5049if(!window['hskde']){
5050
5051  window['hskde'] = true; 
5052
5053  wDocument.wAddEvent(window, 'keydown', function(event){
5054
5055
5056    
5057    var fqa = top.frames.wglFramePage ? self : top;
5058    fqa = top;
5059    
5060    if(event.keyCode == 27){
5061      if(typeof(top.wCloseQuickAccess) == 'function' && top.wDocument.element('#wQuickAccess')){
5062        event.preventDefault();
5063        top.wCloseQuickAccess();
5064      }
5065      if(typeof(top.wCloseMessagecenter) == 'function' && top.wDocument.element('#wLayerMessagecenter')){
5066        event.preventDefault();      
5067        top.wCloseMessagecenter();
5068      }      
5069    }
5070    else if((event.ctrlKey || event.metaKey) && !(event.ctrlKey && event.metaKey) && event.keyCode == 69){
5071      if(event.key && event.key == '€'){
5072        return;
5073      }
5074      else if(event.altKey){
5075        return;
5076      }
5077
5078      event.preventDefault();
5079            
5080      if(typeof(fqa.wOpenQuickAccess) == 'function'){
5081        if(typeof(fqa.wUserType) == 'undefined'){
5082          return false;
5083        }
5084        if(typeof(fqa.wCloseQuickAccess) == 'function' && fqa.wDocument.element('#wLayerMessagecenter')){
5085          fqa.wCloseMessagecenter();
5086        }
5087
5088        if(fqa.wDocument.element('.wui-quickaccess-functions')){
5089          fqa.wCloseQuickAccess('functions');
5090        }
5091        else{
5092          fqa.wOpenQuickAccess('functions');
5093        }
5094      }
5095    }
5096    else if((event.ctrlKey || event.metaKey) && !(event.ctrlKey && event.metaKey) && event.keyCode == 77){
5097      if(event.altKey || event.shiftKey){
5098        return;
5099      }
5100
5101      if(typeof(top.wOpenMessagecenter) == 'function'){
5102        if(typeof(top.wCloseMessagecenter) == 'function' && top.wDocument.element('#wQuickAccess')){  
5103          top.wCloseQuickAccess();
5104        }            
5105        top.wOpenMessagecenter();
5106      }
5107    }    
5108  });
5109}�
5110
5111
5112
5113
5114
5115
5116
5117
5118wShowFeedback = function (){
5119
5120  var url = '/weblication/grid5/scripts/wSystem.php?action=getUserInfo';
5121  wGetUrl(url, function(responseData){
5122
5123    var lang = typeof(wUserLanguage) != 'undefined' ? wUserLanguage : 'de';
5124
5125    feedbackFormHTML  = '<div id="wFeedbackForm" class="wui-feedback" onclick="wHideFeedback();">';
5126    feedbackFormHTML += '<div onclick="event.stopPropagation();">';
5127    feedbackFormHTML += '<div class="wui-feedback-title">' + (lang == 'en' ? 'Feedback' : 'Feedback, Wünsche, Anregungen') + '</div><div onclick="wHideFeedback();" class="wui-feedback-closer"></div>';
5128    feedbackFormHTML += '<div class="wui-feedback-smileys"><div onclick="this.parentNode.parentNode.className=\'fbpos\'" class="wui-feedback-smiley-pos"></div><div onclick="this.parentNode.parentNode.className=\'fbneutral\'" class="wui-feedback-smiley-neutral"></div><div onclick="this.parentNode.parentNode.className=\'fbneg\'" class="wui-feedback-smiley-neg"></div></div>';
5129    feedbackFormHTML += '<div class="wui-feedback-caption">' + (lang == 'en' ? 'Data to be sent' : 'Mitzusendende Daten') + '</div>';
5130    feedbackFormHTML += '<div class="wui-feedback-infos-sent-container">';
5131    feedbackFormHTML += '<div class="wui-feedback-infos-sent" title="Domain: ' + location.origin + '"><input type="checkbox" id="cbinfosentlocationorigin" name="infosent" checked="checked" value="locationorigin"/><label for="cbinfosentlocationorigin">Domain</label></div>';
5132    feedbackFormHTML += '<div class="wui-feedback-infos-sent" title="' + location.pathname + location.search + '"><input type="checkbox" id="cbinfosentlocationpath" name="infosent" checked="checked" value="locationpath"/><label for="cbinfosentlocationpath">' + (lang == 'en' ? 'Path' : 'Pfad') + '</label></div>';
5133    feedbackFormHTML += '<div class="wui-feedback-infos-sent" title="Benutzertyp: ' + responseData['userType'] + '"><input type="checkbox" id="cbinfosentusertype" name="infosent" checked="checked" value="usertype"/><label for="cbinfosentusertype">' + (lang == 'en' ? 'Usertype' : 'Benutzertyp') + '</label></div>';
5134    feedbackFormHTML += '<div class="wui-feedback-infos-sent" title="Benutzername: ' + responseData['userName'] + '"><input type="checkbox" id="cbinfosentusername" name="infosent" value="username"/><label for="cbinfosentusername">' + (lang == 'en' ? 'Username' : 'Benutzername') + '</label></div>';
5135    feedbackFormHTML += '</div>';
5136    feedbackFormHTML += '<div class="wui-feedback-caption">' + (lang == 'en' ? 'Optional comment' : 'Optionaler Kommentar') + '</div>';
5137    feedbackFormHTML += '<textarea id="feedbackText" name="feedbacktext"></textarea>';
5138    feedbackFormHTML += '<div></div>';
5139    feedbackFormHTML += '<div class="wui-button wui-button-feedback" onclick="wSendFeedback()"><span>' + (lang == 'en' ? 'Send feedback' : 'Feedback senden') + '</span></div>';
5140    feedbackFormHTML += '<div class="wui-feedback-info">' + (lang == 'en' ? 'We appreciate your feedback and will consider it in future product development.' : 'Wir freuen uns über Ihr Feedback und berücksichtigen es gerne bei der Weiterentwicklung Ihres Produktes.') + '</div>';
5141    feedbackFormHTML += '<div class="wui-feedback-info-extended">' + (lang == 'en' ? 'Please use the Support Formular for support requests.' : 'Für Supportanfragen nutzen Sie bitte das Supportformular!') + '</div>';
5142    feedbackFormHTML += '<iframe style="display:none" id="iframeFeedback" name="iframeFeedback" src="about:blank"></iframe></div>';
5143    feedbackFormHTML += '</div>';
5144    top.document.body.wAppend(feedbackFormHTML);
5145  }, {'dataType' : 'json'});
5146};�
5147
5148
5149
5150
5151
5152
5153
5154
5155wSendFeedback = function (){
5156
5157  var url = '/weblication/grid5/scripts/wSystem.php?action=getUserInfo';
5158  wGetUrl(url, function(responseData){
5159
5160    var url = 'https://www.weblication.de/feedback.php?';
5161
5162    feedbackType = 'neutral';
5163    if(wDocument.element('#wFeedbackForm > div').wHasClass('fbpos')){
5164      feedbackType = 'pos';
5165    }
5166    else if(wDocument.element('#wFeedbackForm > div').wHasClass('fbneg')){
5167      feedbackType = 'neg';
5168    }
5169
5170    url += 'type=' + feedbackType;
5171
5172    if(wDocument.element('#cbinfosentlocationorigin').checked){
5173      url += '&locationorigin=' + encodeURIComponent(location.origin);
5174    }
5175
5176    if(wDocument.element('#cbinfosentlocationpath').checked){
5177      url += '&locationpath=' + encodeURIComponent(location.pathname);
5178    }
5179
5180    if(wDocument.element('#cbinfosentusertype').checked){
5181      url += '&usertype=' + encodeURIComponent(responseData['userType']);
5182    }
5183
5184    if(wDocument.element('#cbinfosentusername').checked){
5185      url += '&username=' + encodeURIComponent(responseData['userName']);
5186    }
5187
5188    url += '&comment=' + encodeURIComponent(wDocument.element('#feedbackText').value);
5189
5190    document.getElementById('iframeFeedback').contentWindow.location.href = url;
5191
5192    var lang = typeof(wUserLanguage) != 'undefined' ? wUserLanguage : 'de';
5193
5194    window.setTimeout(function(){
5195      wDocument.element('#wFeedbackForm > div').innerHTML = '<div class="wui-feedback-infoaftersent">' + (lang == 'en' ? 'Thank you for your feedback!' : 'Vielen Dank für Ihr Feedback!') + '</div>';
5196      window.setTimeout(function(){
5197        wDocument.hide('#wFeedbackForm', {'animate' : 'fade'});
5198      }, 1600);
5199      window.setTimeout(function(){
5200        wDocument.wRemove('#wFeedbackForm');
5201      }, 3000);
5202    }, 400);
5203  }, {'dataType' : 'json'});
5204};
5205
5206wParseMessageText = function(messageText, context){
5207  
5208  var version = 19;
5209
5210  if(typeof wApplicationVersion !== 'undefined'){
5211    version = wApplicationVersion;
5212  } 
5213  else if(typeof wVersionGrid !== 'undefined'){
5214    version = wVersionGrid;
5215  } 
5216  else if(typeof appVersion !== 'undefined'){
5217    version = appVersion;
5218  }     
5219  
5220  messageText = '\n' + messageText + '\n';
5221  messageText = messageText.replace(/ $/, '');
5222  messageText = messageText.replace(/</g, '&lt;').replace(/>/g, '&gt;');  
5223    
5224  messageText = messageText.replace(/\n== *([^\n]+) *==/g, '\n<div style="font-weight:bold;margin-bottom:2px">$1</div>');
5225  messageText = messageText.replace(/\n= *([^\n]+) *=/g, '\n<div style="font-weight:bold;font-size:16px;margin-bottom:6px">$1</div>');
5226      
5227  if(context !== 'messageCenter'){
5228    messageText = messageText.replace(/\n\[(o|x)\] *([^\n]+)/g, function(match, p1, p2){
5229      var eln = p2.replace(/\W+/g, '_');
5230      return '\n<span style="font-weight:bold;font-size:18px !important;padding-right:4px">' + (p1 == 'x' ? '&#9745;' : '&#9744;') + '</span>' + p2;
5231    });      
5232  }
5233  else{  
5234    messageText = messageText.replace(/\n\[(o|x)\] *([^\n]+)/g, function(match, p1, p2){var eln = p2.replace(/\W+/g, '_');return '\n<div class="wui-contentMessage-line-todo-checkbox' + (p1 == 'x' ? ' checked' : '') + '" onclick="event.stopPropagation();wOnClickCheckboxTodo(\'' + eln + '\', \'' + p2 + '\')"><span class="cb" id="' + eln + '"></span><span class="lb" for="' + eln + '">' + p2 + '</span></div>'});
5235    messageText = messageText.replace(/\n\[p(;[^\]]+)?\] *([^\n]+)/g, function(match, p1, p2){
5236    var eln   = p2.replace(/\W+/g, '_');
5237    var datas = p1;
5238    var users = [];
5239    var usersMarkup = '';
5240    var checkedUserCur =  false;
5241    if(/u:([^;]+)/.test(datas)){
5242      users = RegExp.$1.split(',');
5243      for(var j = 0; j < users.length; j++){
5244        let userNameDisplay = users[j];
5245        if(users[j] == wUserCur){
5246          checkedUserCur = true;
5247        }
5248        usersMarkup += '<span class="poll-user' + (users[j] == wUserCur ? ' current' : '') + '">' + userNameDisplay + '</span>';                     
5249      }
5250    }
5251    usersMarkup = '<div class="wui-contentMessage-line-poll-state"><span class="poll-count">' + users.length + '</span>' + usersMarkup + '</div>\n';
5252    
5253    return '\n<div class="wui-contentMessage-line-poll"><div class="wui-contentMessage-line-poll-checkbox' + (checkedUserCur ? ' checked' : '') + '" onclick="event.stopPropagation();wOnClickCheckboxPoll(\'' + eln + '\', \'' + p2 + '\')"><span class="cb" id="' + eln + '"></span><span class="lb" for="' + eln + '">' + p2 + '</span></div>' + usersMarkup + '</div>';
5254  });
5255  messageText = messageText.replace(/\n\[t(;[^\]]+)?\] *([^\n]+)/g, function(match, p1, p2){
5256    var eln   = p2.replace(/\W+/g, '_');
5257    var datas = p1;
5258    var users = [];
5259    var statusMarkup   = '';
5260    var usersMarkup    = '';
5261    var checkedUserCur =  false;
5262    var currentState   = 'todo';
5263    if(/s:([^;]+)/.test(datas)){
5264      currentState = RegExp.$1;
5265    }
5266    if(/u:([^;]+)/.test(datas)){
5267      users = RegExp.$1.split(',');
5268      for(var j = 0; j < users.length; j++){
5269        let userNameDisplay = users[j];
5270        if(users[j] == wUserCur){
5271          checkedUserCur = true;
5272        }
5273        usersMarkup += '<span class="task-user' + (users[j] == wUserCur ? ' current' : '') + '">' + userNameDisplay + '</span>';                     
5274      }
5275    }            
5276    
5277    statusMarkup  = '<div class="task-state ' + currentState + '">';
5278    statusMarkup += '<span class="task-state-entry todo">Zu erledigen</span><span class="task-state-entry inProgress">In Bearbeitung</span><span class="task-state-entry done">Erledigt</span>';
5279  
5280    statusMarkup += usersMarkup;�
5281    statusMarkup += '</div>\n';
5282    
5283    return '\n<div class="wui-contentMessage-line-task" onclick="event.stopPropagation();wOnClickCheckboxPoll(\'' + eln + '\', \'' + p2 + '\')"><div><span class="lb" for="' + eln + '">' + p2 + '</span></div>' + statusMarkup + '</div>';
5284  });
5285  }       
5286  
5287  messageText = messageText.replace(/\;\-\)/g, '<img style="width:10px" src="/weblication/grid5/gui/images/smilies/blink.png" />');            
5288  messageText = messageText.replace(/\:\-\)/g, '<img style="width:10px" src="/weblication/grid5/gui/images/smilies/smile.png" />');                      
5289  messageText = messageText.replace(/\n\/\/ *([^\n]+)/g, '<div style="color:#a0a0a0">$1</div>');            
5290
5291  messageText = messageText.replace(/<\/div>\n/g, '</div>');
5292  messageText = messageText.replace(/\[((?:https?\:)?\/?\/[^\]]+)\]/g, function(match, p1){
5293    var link = p1, text = p1;
5294    if(/^([^ ]+) ([\w\W]+\.(?:svg|jpe?g|gif|png))/i.test(link)){
5295      var url = RegExp.$1;
5296      var src = RegExp.$2;
5297      
5298      var imgStyle = '';
5299      if(/imgStyle="([^"]+)"/i.test(link)){
5300        imgStyle = RegExp.$1;
5301      }  
5302      return '<a href="' + url + '" target="_blank" onclick="event.stopPropagation()"><img src="' + src + '" style="' + imgStyle + '"/></a>';            
5303    }   
5304    else if(/^([\w\W]+\.(?:svg|jpe?g|gif|png))/i.test(link)){
5305      var src = RegExp.$1;
5306      
5307      var imgStyle = '';
5308      if(/style="([^"]+)"/i.test(link)){
5309        imgStyle = RegExp.$1;
5310      }  
5311      return '<img src="' + src + '" style="' + imgStyle + '"/>';            
5312    }        
5313    else if(/^([^ ]+) ([\w\W]+)/.test(link)){
5314      link = RegExp.$1;
5315      text = RegExp.$2;
5316      return '<a href="' + link + '" target="_blank" onclick="event.stopPropagation()">
5316' + text + '</a>';      
5317    }
5318    return '<a href="' + link + '" target="_blank" onclick="event.stopPropagation()">' + text + '</a>';      
5319  });   
5320  
5321  messageText = messageText.replace(/^\n/, '').replace(/\n$/, '');  
5322  
5323  return messageText;
5324
5325}
5326
5327wShowMaskHtaccessLoginData = function(){
5328  var htmlMessagebox = '<div id="wFormToSetAuthData" style="margin:0;border:none"><h4>Zugangsdaten der Webseite eingeben</h4><div><label for="htaccessName">Benutzername</label><input class="wui-input" id="htaccessName" value=""/></div><div><label for="htaccessPassword">Password</label><input class="wui-input" type="password" id="htaccessPassword" value=""/></div></div>';
5329  
5330  wMessagebox({
5331    'type': 'info',
5332    'title': 'Zugangsdaten eingeben',
5333    'content': htmlMessagebox,
5334    'buttons': [{'caption': 'Mit Zugangsdaten laden', 'icon': 'ok', 'closeOnlyOnReturnTrue' : true, 'action': function(){
5335       wSetHtaccessLoginDataAndReload();
5336      }} , {'caption': 'Abbrechen', 'icon': 'cancel', 'selected' : true, 'action': function(){}}],
5337    'allowKeydown' : true
5338    });
5339};
5340
5341wSetHtaccessLoginDataAndReload = function(){
5342  
5343  var pathToSet = typeof(pathProject) !== 'undefined' && pathProject != '' ? pathProject : '/';
5344  url = '/weblication/grid5/scripts/wPrivate.php?action=setHtaccessData&path=' + pathToSet + '&httpAuthUser=' + encodeURIComponent(top.wDocument.element('#htaccessName').value) + '&httpAuthPassword=' + encodeURIComponent(top.wDocument.element('#htaccessPassword').value) + '&wcsrf=' + wCsrf;
5345
5346  wGetUrl(url, function(responseStr){
5347    top.location.reload();
5348  });
5349};�
5350
5351
5352
5353
5354
5355
5356
5357
5358wHideFeedback = function (){
5359  wDocument.wRemove('#wFeedbackForm');
5360};�
5361
5362
5363
5364
5365
5366
5367wShowAiTextsLayer = function (path, options){
5368
5369  
5370  options = typeof(options) !== 'undefined' ? options : {};
5371
5372
5373
5374
5375  
5376  if(typeof(options['input']) !== 'undefined' && options['input']){
5377    if(options['input'].indexOf('wysiwyg_') === 0){
5378      wWysiwyg.toggleEditMode(options['input']);
5379      wWysiwyg.toggleEditMode(options['input']);
5380    }
5381  }
5382  
5383  if(typeof(options['template']) !== 'undefined' && options['template']){
5384    options['template'] = options['template'].replace(/wValueOfWebtag\:(\w+)/, function(matches, webtagId){
5385      return wDocument.element('#' + webtagId).value
5386    });
5387  }  
5388  
5389  var frameSeo = parent.wDocument.element('#frameSeo');
5390  if(location.href.indexOf('action=showSeo') != -1 && frameSeo){
5391    frameSeo.wAddClass('aiExpanded');
5392  }  
5393
5394  var aiFrame = document.getElementById('wCurrentIframeAiTexts');
5395    
5396  if(!aiFrame){
5397    aiFrame    = document.createElement('iframe');
5398    aiFrame.id = 'wCurrentIframeAiTexts';
5399    aiFrame.style.border = 'none';
5400    aiFrame.style.float  = 'left';
5401    aiFrame.style.width  = '40%';
5402    aiFrame.style.height = '100%';
5403  }
5404  
5405  let contextType = 'page';
5406  
5407  if(location.href.indexOf('action=showSeo') !== -1){
5408    contextType = 'editorMeta';
5409  }
5410  
5411  aiFrame.src = '/weblication/grid5/scripts/wAi.php?action=showmaskaitexts&contextType=' + contextType + '&path=' + path + (typeof(options['input']) !== 'undefined' && options['input'] != '' ? '&input=' + options['input'] : '') + (typeof(options['template']) !== 'undefined' && options['template'] != '' ? '&template=' + options['template'] : '') + '&wcsrf=' + wCsrf;
5412
5413  document.body.insertBefore(aiFrame, document.body.firstChild);
5414};
5415
5416function wDebounceFunction(func, wait){
5417  let timeout;
5418
5419  return function (...args){
5420    const context = this;
5421
5422    clearTimeout(timeout);
5423    timeout = setTimeout(() => {
5424      func.apply(context, args);
5425    }, wait);
5426  };
5427}
5428
5429function wDefinePrototypeMethod(prototype, name, fn) {
5430  Object.defineProperty(prototype, name, {
5431    value: fn,
5432    writable: true,
5433    configurable: true,
5434    enumerable: false
5435  });
5436}
5437
5438window['hasLoadGridJS'] = true;
5439

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.