PageSourceSearch

https://upa.lt/static/themes/site/js/script.js?v1.4.3

js upa.lt collected 2026-09-26 09:24:36 UTC 62,202 bytes, 2,321 lines download raw bytes

1$(document).ready(function () {
2	if (!$("#popup_window").length) { // init if not in dialog view
3		select2();
4		fancybox();
5		validate();
6		slick_carousel();
7		mobile_sidebar();
8		gallery_hash();
9		youtube_hash();
10		fixed_header();
11		print_v();
12		highlight_search_results();
13		init_questions_toggler_hash();
14		catalog_gallery();
15		file_input();
16		iframe_adaptability();
17		reportbug_form();
18		show_more();
19		postformwidget_validate();
20		init_contacts();
21		tooltipster();
22
23		sidebar_menu();
24		scroll_top();
25
26		set_widgetcalendar_data();
27		showDayEvent();
28		EventCalendar();
29		toggle_items();
30		loadTitlepageCalendar();
31		init_showmessage();
32		upa_services();
33		contentblock();
34		iframeContactMap();
35		caleran();
36	}
37});
38
39$(window).on('load', function () {
40	$('.equalheight').responsiveEqualHeightGrid();
41	if ($(window).width() < 768) {
42		mobile_overflow_tables();
43	}
44
45//	$('input[type="date"]').on('click', function (e) {
46//		e.preventDefault();
47//	})
48
49	addAriaLabelToMobileMenu();
50
51	Date.prototype.toDateInputValue = (function () {
52		var local = new Date(this);
53		local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
54		return local.toJSON().slice(0, 10);
55	});
56	Date.prototype.toDateInputValueTomorrow = (function () {
57		var local = new Date(this);
58		local.setDate(local.getDate() + 1);
59		local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
60		return local.toJSON().slice(0, 10);
61	});
62
63	const today = new Date();
64	const tomorrow = new Date(today);
65	$('#caleran_start').val(new Date().toDateInputValue());
66	$('#caleran_end').val(new Date().toDateInputValueTomorrow());
67});
68
69$(window).scroll(function () {
70	var scroll = $(window).scrollTop();
71
72	//>=, not <=
73	if (scroll >= 100) {
74		//clearHeader, not clearheader - caps H
75		$(".header_container.home").addClass("scrolled");
76		$(".header_container.home .logo .default").addClass("scrolled");
77		$(".header_container.home .logo .white").hide();
78
79	} else {
80		$(".header_container.home").removeClass("scrolled");
81		$(".header_container.home .logo .default").removeClass("scrolled");
82		$(".header_container.home .logo .white").show();
83
84
85
86
87	}
88}); //missing );
89
90function globalJsTranslations() {
91	function getAlltranslations() {
92		if (typeof global_js_trans == 'undefined') {
93			return false;
94		}
95
96		return global_js_trans;
97	}
98
99	function getTrans(val) {
100		if (typeof global_js_trans == 'undefined') {
101			return false;
102		}
103		if (typeof val == "undefined" || val == '') {
104			return false;
105		}
106		if (typeof global_js_trans[val] == "undefined") {
107			return false;
108		}
109		return global_js_trans[val];
110	}
111
112	return {
113		getAll: getAlltranslations,
114		getTr: getTrans
115	};
116}
117
118function select2() {
119	$("select").select2({
120		"minimumResultsForSearch": -1
121	});
122
123	// use this class if placeholder is needed. 
124	// Translation added as data attribute: <select data-placeholder="{'choise_value'|t}">
125	// Also, first option in select element has to be empty: <option value=""></option>
126	$("select.select2_with_dynamic_placeholder").select2({
127		"minimumResultsForSearch": -1,
128		placeholder: function () {
129			$(this).data('placeholder');
130		}
131	});
132}
133
134
135function slick_carousel() {
136	// Slick carousel docs:
137	//http://kenwheeler.github.io/slick/
138
139	if ($("#title_slides").length) {
140		$('#title_slides').slick({
141			dots: false,
142			arrows: true,
143			infinite: true,
144			speed: 2000,
145			fade: true,
146			cssEase: 'ease',
147			touchThreshold: 100,
148			autoplay: false,
149			autoplaySpeed: 5000,
150			responsive: [
151
152				{
153					breakpoint: 1200,
154					settings: {
155						arrows: false,
156					}
157
158				},
159			],
160		});
161
162		$('#title_slides').on('afterChange', function (event, slick, currentSlide, nextSlide) {
163			//console.log(slick);
164		});
165	}
166
167	if ($(".promoblock_slider").length) {
168		$('.promoblock_slider').slick({
169			dots: false,
170			arrows: true,
171			infinite: true,
172			slidesToShow: 6,
173			responsive: [
174				{
175					breakpoint: 1024,
176					settings: {
177						slidesToShow: 5,
178					}
179				},
180				{
181					breakpoint: 600,
182					settings: {
183						slidesToShow: 4,
184					}
185				},
186				{
187					breakpoint: 480,
188					settings: {
189						slidesToShow: 3,
190					}
191				},
192				{
193					breakpoint: 420,
194					settings: {
195						slidesToShow: 2,
196					}
197				}],
198			slidesToScroll: 1,
199			speed: 180,
200			cssEase: 'linear',
201			rows: 0
202		});
203	}
204}
205
206
207function fancybox() {
208	// FB3 docs: https://fancyapps.com/fancybox/3/docs
209	//  Translations inside libs/localization/
210
211	// News preview
212	$("a.news_image").fancybox({
213		btnTpl: {
214			zoom: false
215		}
216	});
217
218	// News gallery 
219	$("a.fancybox_gallery").fancybox({
220		thumbs: false,
221		transitionEffect: "slide",
222		clickContent: false,
223		btnTpl: {
224			zoom: false
225		}
226	});
227
228	// From Tinymce
229	$("a[rel=fancybox]").fancybox({
230		btnTpl: {
231			zoom: false
232		}
233	});
234
235	// Ajax call
236	$("a.fancybox_ajax").fancybox({
237		type: "ajax",
238		touch: false // disable drag cursor
239	});
240
241	// Iframe call
242	$("a.fancybox_iframe").fancybox({
243		type: "iframe",
244		touch: false // disable drag cursor
245	});
246}
247
248function gallery_popup() {
249	$('.gallery_popup').on("click", function () {
250		$(".album_loading").show();
251		var $this = $(this);
252		var url = $(this).data("fancy-link");
253		$.ajax({
254			url: url,
255			type: "GET",
256			success: function (data) {
257				$(".album_loading").fadeOut("fast");
258				var photos = [];
259				$.each(data.photos, function (i) {
260					var obj = {
261						"src": this.img_itemimage,
262						"thumb": this.img_itemimage_thumb
263					};
264					if (this.title) {
265						obj.subHtml = '<div class="photo_title">' + this.title + '</div>';
266					}
267					photos.push(obj);
268				});
269				$this.lightGallery({
270					dynamic: true,
271					dynamicEl: photos,
272					speed: 300,
273					hideBarsDelay: 1000,
274					closable: false,
275					loop: false,
276					download: false,
277					enableDrag: false,
278					thumbWidth: 112,
279					thumbContHeight: 83,
280					thumbMargin: 10,
281					toogleThumb: false,
282					galleryId: $this.data("id")
283				});
284				$this.on('onAfterOpen.lg', function (event, index, fromTouch, fromThumb) {
285					$(".lg").append("<div class='album_title lg-toolbar'><div class='album_title_text'>" + data.title + "</div></div>")
286				});
287			},
288			error: function () {
289				$(".album_loading").fadeOut("fast");
290				alert('Load error.');
291			}
292		});
293
294
295	});
296}
297
298function youtube_popup() {
299	$('.youtube_popup').on("click", function () {
300
301		$(".album_loading").show();
302		var $this = $(this);
303		var url = $(this).data("fancy-link");
304		$.ajax({
305			url: url,
306			type: "GET",
307			success: function (data) {
308				$(".album_loading").fadeOut("fast");
309				var photos = [];
310				var obj = {
311					"src": data.youtube_share_link,
312					"thumb": data.img_itemimage_thumb,
313					//"poster":  data.img_itemimage_thumb
314				};
315				if (data.title) {
316					obj.subHtml = '<div class="photo_title">' + data.title + '</div>';
317				}
318				photos.push(obj);
319				$this.lightGallery({
320					dynamic: true,
321					dynamicEl: photos,
322					speed: 300,
323					hideBarsDelay: 1000,
324					closable: false,
325					loop: false,
326					download: false,
327					enableDrag: false,
328					thumbWidth: 112,
329					thumbContHeight: 83,
330					thumbMargin: 10,
331					toogleThumb: false,
332					//youtubePlayerParams: {autoplay:0 },
333					counter: false,
334					videoMaxWidth: '900px',
335					addClass: "youtubegallery_popup",
336					fullScreen: false
337				});
338			},
339			error: function () {
340				$(".album_loading").fadeOut("fast");
341				alert('Load error.');
342			}
343		});
344
345
346	});
347}
348
349
350function validate() {
351	var options = {
352		highlight: function (element, errorClass, validClass) {
353			if ($(element).closest(".type_item").length) {
354				$(element).closest(".type_item").removeClass(validClass).addClass(errorClass);
355			}
356		},
357		unhighlight: function (element, errorClass, validClass) {
358			if ($(element).closest(".type_item").length) {
359				$(element).closest(".type_item").removeClass(errorClass).addClass(validClass);
360			}
361		},
362		errorPlacement: function (error, element) {
363			$(element).closest(".type_item").find('.type_error').append(error);
364		},
365	}
366	if ($("#forms_form").length) {
367		$("#forms_form").validate(options);
368		$("#forms_form select").change(function () {
369			$(this).valid();
370		});
371		$("#forms_form input[type='file']").change(function () {
372			$(this).valid();
373		});
374	}
375	if ($("#letter_form").length) { // Postform
376		$("#letter_form").validate(options);
377	}
378	if ($("#poll_form").length) {
379		$("#poll_form").validate(options);
380		$("#poll_form select").change(function () {
381			$(this).valid();
382		});
383		$("#poll_form input[type='file']").change(function () {
384			$(this).valid();
385		});
386	}
387	if ($("#subscription_form").length) {
388		$("#subscription_form").validate(options);
389	}
390	if ($("#poll_widget").length) {
391		$("#poll_widget").validate(options);
392	}
393	if ($("#sitelogin_widget").length) {
394		$("#sitelogin_widget").validate(options);
395	}
396	if ($("#duk_form").length) {
397		$("#duk_form").validate(options);
398	}
399	if ($(".comment-form").length) {
400		$(".comment-form").validate(options);
401	}
402	if ($("#sitelogin_form").length) {
403		$("#sitelogin_form").validate(options);
404	}
405	if ($("#faq_form").length) {
406		$("#faq_form").validate(options);
407	}
408	if ($("#subscription_form_index").length) {
409		$("#subscription_form_index").validate(options);
410	}
411	if ($("#remind_pass_form").length) {
412		$("#remind_pass_form").validate(options);
413	}
414
415	if ($('#custom_validate').length) {
416		$("#custom_validate").validate(options);
417		$("#custom_validate select").change(function () {
418			$(this).valid();
419		});
420		$("#custom_validate input[type='file']").change(function () {
421			$(this).valid();
422		});
423	}
424}
425
426
427function mobile_sidebar() {
428	var $m = $("#mobile_menu").mmenu({
429		"extensions": [
430			"border-full",
431			"theme-white"
432		],
433		"offCanvas": {
434			"position": "right"	//meniu sliding from right side
435		},
436		"counters": false,
437		"slidingSubmenus": false,
438//		"navbar": {
439//			"title": " "
440//		},
441//		"navbars": [
442//			{
443//				"position": "top",
444//			}
445//		]
446	}, {
447		selectedClass: "active"
448	});
449
450	$(window).bind("pageshow", function (event) {
451		if (event.originalEvent.persisted) { //bugfix - iphone safari history state leaves menu open. Close it!
452			setTimeout(function () {
453				var API = $m.data("mmenu");
454				API.close();
455			}, 50);
456		}
457	});
458}
459
460/**
461 * Creates new hashchange event callback
462 * 
463 * @param {Object} arg = {callback: callback_function, rule: {RegExp|String}, bubbling: {true|false}}  
464 * @param {Object} hashControllerObj
465 * @returns {null|hashCallBack}
466 */
467function hashCallBack(arg, hashControllerObj) {
468	this.callback;
469	this.bubbling = false;
470	this.rule = null;
471	this.hashObj = hashControllerObj;
472	this.lock = false;
473	var self = this;
474
475	/**
476	 * Constructor
477	 * @param {Object} arg
478	 * @returns {hashCallBack|null}
479	 */
480	this.init = function (arg) {
481		if (this.setCallback(arg.callback)) {
482			if (arg.bubbling) {
483				this.bubbling = arg.bubbling;
484			}
485			this.setRule(arg.rule);
486			window.addEventListener("hashchange", self.call, this.bubbling);
487			return this;
488		}
489		return null;
490	};
491
492	/**
493	 * 
494	 * @param {Event} e
495	 * @returns {null|String} callback response | null
496	 */
497	this.call = function (e) {
498		if (self.checkRule(self.hashObj.get()) && !self.lock) {
499			return self.callback(e, self);
500		}
501		return null;
502	};
503
504	/**
505	 * Check if event callback will be executed
506	 * @param {String} str hash string to test rule
507	 * @returns {Boolean}
508	 */
509	this.checkRule = function (str) {
510		return (!this.rule || this.rule.test(str));
511	};
512
513	/**
514	 * Set event callback execution rule.
515	 * @param {String|RegExp} rule
516	 */
517	this.setRule = function (rule) {
518		if (typeof (rule) !== 'undefined' && rule != '') {
519			if (typeof (rule) !== 'object') {
520				this.rule = new RegExp(rule);
521			} else {
522				this.rule = rule;
523			}
524		}
525	};
526
527	/**
528	 * 
529	 * @param {String|Function} callback
530	 * @returns {Boolean} Return true if callback is valid function, otherwise - false
531	 */
532	this.setCallback = function (callback) {
533		if (typeof (callback) === 'string') {
534			if (typeof (window[callback]) === 'function') {
535				this.callback = window[callback];
536				return true;
537			}
538			return false;
539		} else if (typeof (callback) === 'function') {
540			this.callback = callback;
541			return true;
542		}
543		return false;
544	};
545
546	return this.init(arg);
547}
548;
549
550/**
551 * hashChange event controller
552 * @example register hashController.register({
553 *			callback: (function(){} | "functioNname" | object.method),
554 *			rule: (new RegExp("^[a-z]+$", "i") | "^[a-z]+$"),
555 *			bubbling: false
556 * });
557 * @type hashController
558 */
559var hashController = new function () {
560
561	this.db = new Array();
562	var self = this;
563	/**
564	 * 
565	 * @param {Object} callbackParams {
566	 *			callback: (function(){} | "functioNname" | object.method),
567	 *			rule: (new RegExp("^[a-z]+$", "i") | "^[a-z]+$"),
568	 *			bubbling: false
569	 * }
570	 * @returns {hashCallBack}
571	 */
572	this.register = function (callbackParams) {
573		var cb = new hashCallBack(callbackParams, this);
574		self.db.push(cb);
575		return cb;
576	};
577
578	/**
579	 * 
580	 * @returns {string} hash string without '#'
581	 */
582	this.get = function () {
583		return location.hash.replace(/^#/, '');
584	};
585
586	this.set = function (hash) {
587		location.hash = hash;
588	};
589
590	this.clear = function () {
591		//this.set(''); // deleted, because jumps to top page 
592		history.replaceState({}, document.title, location.pathname);
593	};
594
595	this.replace = function (hash) {
596		history.replaceState({}, document.title, location.pathname + '#' + hash);
597	};
598
599	this.trigger = function () {
600		for (var i = 0; i < self.db.length; i++) {
601			if (document.createEvent) {
602				var e = document.createEvent("Event");
603				e.initEvent("hashchange", true, true);//,window,0,0,0,0,0,false,false,false,false,0,null);
604			} else {
605				var e = new Event('hashchange', {});
606			}
607			self.db[i].call(e);
608		}
609	};
610
611};
612/**
613 * Alias for hashController
614 * @type @exp;hashController
615 */
616var hc = hashController;
617
618/**
619 * @example hc.register({callback: function(e, h){
620 *			console.log(h.get());
621 *		}});
622 *
623 *		hc.set('raudona');
624 */
625
626$(document).ready(function () {
627	hc.trigger();
628});
629
630function galleryWrapper() {
631	this.photos = new Array();
632	this.album_data;
633	this.album_id;
634	this.photo_id = '';
635	this.dataUrl = '';
636	this.isOpen = false;
637	this.base_url = location.pathname + '/';
638	this.hcb;
639
640	this.gallery_options = {
641		dynamic: true,
642		speed: 300,
643		hideBarsDelay: 2000,
644		closable: false,
645		loop: true,
646		download: false,
647		enableDrag: false,
648		thumbWidth: 112,
649		thumbContHeight: 93,
650		thumbMargin: 10,
651		showAfterLoad: false,
652		toogleThumb: false,
653		galleryId: this.album_id
654	};
655
656	if (arguments[0] && typeof (arguments[0]) === 'object') {
657		$.extend(this.gallery_options, arguments[0]);
658	}
659
660	var self = this;
661
662	this.getElement = function () {
663		if (!document.getElementById(this.album_id)) {
664			$('body').append('<div id="' + this.album_id + '" style="display:none;"></div>');
665		}
666		return $('#' + this.album_id);
667	};
668
669	this.init = function () {
670		if (!this.isOpen) {
671			$(".album_loading").show();
672			$.ajax({
673				url: this.dataUrl,
674				type: "GET",
675				dataType: "json",
676				contentType: "application/json",
677				success: function (data) {
678					self.album_data = data;
679					self.setPhotos(data);
680					if (self.photos.length > 0) {
681						self.initgallery();
682						$(".album_loading").fadeOut("fast");
683					} else {
684						$(".album_loading").fadeOut("fast");
685						self.close();
686					}
687				},
688				error: function () {
689					$(".album_loading").fadeOut("fast");
690					alert('Load error.');
691				}
692			});
693		}
694	};
695
696	this.setPhotos = function (data) {
697		if (typeof (data.photos) !== 'undefined') {
698			for (var i = 0; i < data.photos.length; i++) {
699				var obj = {
700					src: ($(window).width() > 800 ? data.photos[i].img__original : data.photos[i].img_itemimage)
701				};
702				if (typeof (data.photos[i].img_itemimage_thumb) !== 'undefined') {
703					obj.thumb = data.photos[i].img_itemimage_thumb;
704				} else {
705					obj.thumb = data.photos[i].img_listimage;
706				}
707				if (data.photos[i].title) {
708					obj.subHtml = '<div class="photo_title">' + data.photos[i].title + '</div>';
709				}
710				self.photos.push(obj);
711			}
712		}
713	};
714
715	this.initgallery = function () {
716		var cont = this.getElement();
717		if (this.photo_idx > 0 && this.photos.length > this.photo_idx) {
718			this.gallery_options.index = this.photo_idx;
719		}
720		this.gallery_options.dynamicEl = this.photos;
721		this.gallery_options.galleryId = this.album_id;
722		$(cont).lightGallery(this.gallery_options);
723		this.isOpen = true;
724		this.galleryEvents(cont);
725	};
726
727	this.galleryEvents = function (cont) {
728		$(cont).on('onAfterOpen.lg', function () {
729			if ($("#album_title").length) {
730				$("#album_title").html(self.album_data.title);
731			} else {
732				$(".lg").append("<div class='album_title lg-toolbar'><div id='album_title' class='album_title_text'>" + self.album_data.title + "</div></div>");
733			}
734			if (!$(".gallery_share").length) {
735				$(".lg-toolbar.group").append("<div class='gallery_share'><div class='share_icon'></div><div class='share_drop'><div class='share_fb'></div><div class='share_gplus'></div></div></div>");
736				//$("<div class='gallery_share'><div class='share_icon'></div><div class='share_drop'><div class='share_fb'></div><div class='share_gplus'></div></div></div>").insertAfter(".lg-fullscreen");
737
738				$(".lg-outer").on("click", function () {
739					$(".share_drop").slideUp("fast");
740					$(".share_icon").removeClass("active");
741				});
742				$(".share_icon").on("click", function (e) {
743					$(this).addClass("active");
744					e.stopPropagation();
745					$(this).parent().find(".share_drop").slideToggle("fast");
746				});
747
748				$(".share_fb").on("click", function (e) {
749					$(".share_drop").slideUp("fast");
750					$(".share_icon").removeClass("active");
751					window.open("https://www.facebook.com/sharer/sharer.php?u=" + escape(window.location.href), 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
752					return false;
753				});
754				$(".share_gplus").on("click", function (e) {
755					$(".share_drop").slideUp("fast");
756					$(".share_icon").removeClass("active");
757					window.open("https://plus.google.com/share?url=" + escape(window.location.href), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');
758					return false;
759				});
760			}
761			if (self.photo_idx > 0) {
762				$(cont).data('lightGallery').slide(self.photo_idx);
763			}
764		});
765		$(cont).on('onCloseAfter.lg', function () {
766			self.hcb.hashObj.clear();
767			self.close();
768		});
769		$(cont).on('onAfterSlide.lg', function (event, index, fromTouch, fromThumb) {
770			self.hcb.hashObj.replace('!' + self.album_id + '/photo' + $(cont).data('lightGallery').index);
771//			setTimeout(function(){self.ignore(false);}, 50);
772		});
773	};
774
775	this.route = function (e, hcb) {
776		this.hcb = hcb;
777		var parts = this.hcb.hashObj.get().replace(/^\!/, '').split('/');
778		this.album_id = parts[0];
779
780		this.dataUrl = this.getUrl();
781
782		this.ignore(true);
783		if (parts.length > 1 && /^photo[0-9]+$/.test(parts[1])) {// && typeof(this.photos_index[parts[1]]) !== 'undefined'){
784			var nr = parts[1].replace(/^photo([0-9]+)$/, '$1');
785			if (!this.isOpen && this.photo_idx != nr) {
786				this.photo_idx = parseInt(nr);
787			}
788//			else if(this.isOpen){
789//				var cont = this.getElement();
790//				console.log(parseInt(nr));
791//				$(cont).data('lightGallery').slide(parseInt(nr));
792//			}
793		}
794		if (!this.isOpen) {
795			this.init();
796		}
797	};
798
799	this.close = function () {
800		this.ignore(false);
801		this.photos = new Array();
802		this.album_data = null;
803		this.album_id = '';
804		this.dataUrl = '';
805		this.photo_idx = '';
806		this.isOpen = false;
807		//this.hcb = null;
808	};
809
810	this.ignore = function () {
811		this.hcb.lock = !!arguments[0];
812	};
813	this.isIgnored = function () {
814		return !!this.hcb.lock;
815	};
816	this.getUrl = function () {
817		var url = this.getElement().data('url');
818		if (!url || url === '') {
819			url = this.base_url + this.album_id;//location.pathname + '/albumdata/' + this.album_id;
820		}
821		return url;
822	};
823	//this.route();
824}
825;
826
827function gallery_hash() {
828	var wr = new galleryWrapper();
829	wr.base_url = location.pathname + '/albumdata/';
830	hc.register({
831		callback: function (e, hcb) {
832			wr.route(e, hcb);
833		},
834		rule: new RegExp("^\!album[0-9]+(/photo[0-9]+)*$")
835	});
836	$('.gallery_list, .search_results, .assoc_gallery_cont').on("click", ".gallery_popup", function () {
837		location.hash = '!' + $(this).attr('id');
838	});
839
840}
841
842function youtube_hash() {
843
844	var wry = new galleryWrapper({
845		loop: false,
846		youtubePlayerParams: {
847			//autoplay: 0,
848			rel: 0/*,
849			 showinfo: 0*/
850		},
851		counter: false,
852		videoMaxWidth: '900px',
853		addClass: "youtubegallery_popup",
854		fullScreen: false
855	});
856
857	wry.base_url = location.pathname + '/itemdata/';
858
859	wry.setPhotos = function (data) {
860		var obj = {
861			src: data.youtube_share_link,
862			thumb: data.imgthumbnail//,
863					//poster: data.imgposter // reikalingas jei norim autoplay=0
864		};
865		if (data.title) {
866			obj.subHtml = '<div class="photo_title">' + data.title + '</div>';
867		}
868		wry.photos.push(obj);
869	};
870
871	wry.galleryEvents = function (cont) {
872		$(cont).on('onCloseAfter.lg', function () {
873			wry.hcb.hashObj.clear();
874			wry.close();
875		});
876	};
877
878	hc.register({
879		callback: function (e, hcb) {
880			wry.route(e, hcb);
881		},
882		rule: new RegExp("^\!yt[0-9]+$")
883	});
884	$('.youtube_list, .search_results, .assoc_gallery_cont').on("click", ".youtube_popup", function () {
885		location.hash = '!' + $(this).attr('id');
886	});
887}
888
889function getMoreNews(url) {
890	$('.more_btn_cont').remove();
891	$('.loader_content').show();
892	$.ajax({
893		url: url,
894		cache: false
895	}).done(function (html) {
896		$('.news_list').append(html);
897		imagesLoaded($('.news_list'), function () {
898			equalheight_list_items('.equalheight');
899		});
900		$('.loader_content').hide();
901	});
902}
903
904function getMoreAlbums(url) {
905	$('.more_btn_cont').remove();
906	$('.loader_content').show();
907	$.ajax({
908		url: url,
909		cache: false
910	}).done(function (html) {
911		$('.gallery_list').append(html);
912		imagesLoaded($('.gallery_list'), function () {
913			equalheight_list_items('.equalheight');
914		});
915		$('.loader_content').hide();
916	});
917}
918
919function getMoreVideos(url) {
920	$('.more_btn_cont').remove();
921	$('.loader_content').show();
922	$.ajax({
923		url: url,
924		cache: false
925	}).done(function (html) {
926		$('.youtube_list').append(html);
927		imagesLoaded($('.youtube_list'), function () {
928			equalheight_list_items('.equalheight');
929		});
930		$('.loader_content').hide();
931	});
932}
933
934
935var isMobile = {
936	Android: function () {
937		return navigator.userAgent.match(/Android/i);
938	},
939	BlackBerry: function () {
940		return navigator.userAgent.match(/BlackBerry/i);
941	},
942	iOS: function () {
943		return navigator.userAgent.match(/iPhone|iPad|iPod/i);
944	},
945	Opera: function () {
946		return navigator.userAgent.match(/Opera Mini/i);
947	},
948	Windows: function () {
949		return navigator.userAgent.match(/IEMobile/i);
950	},
951	any: function () {
952		return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
953	}
954};
955
956
957function fixed_header() {
958	$('.container-fluid').click(function () {
959		$(".langs_drop_cont").slideUp("fast");
960		$(".langs_cont").removeClass("dropped");
961	});
962
963	$(".current_lang_cont").click(function (e) {
964		e.stopPropagation();
965		$(this).parent().toggleClass("dropped");
966		$(this).parent().find(".langs_drop_cont").slideToggle("fast");
967	});
968
969	// Fixes the fixed header in iOS
970	if (isMobile.iOS()) {
971		var $body;
972		if ('ontouchstart' in window) {
973			$body = $("body");
974			document.addEventListener('focusin', function () {
975				return $body.addClass("fixfixed");
976			});
977			return document.addEventListener('focusout', function () {
978				$body.removeClass("fixfixed");
979				return setTimeout(function () {
980					return $(window).scrollLeft(0);
981				}, 20);
982			});
983		}
984	}
985
986}
987
988function print_v() {
989	$(".print_button").click(function () {
990		window.print();
991	});
992}
993
994function highlight_search_results() {
995	if ($('.search_results').length) {
996		var query = $('.search_results').data('text');
997		$(".search_results").highlight(query);
998	}
999
1000}
1001
1002var EwSiteApp = angular.module('EwSiteApp', [])
1003		.config(['$provide', function ($provide) {
1004				$provide.decorator('$browser', ['$delegate', function ($delegate) {
1005						$delegate.onUrlChange = function () {};
1006						$delegate.url = function () {
1007							return "";
1008						};
1009						return $delegate;
1010					}]);
1011			}]);
1012EwSiteApp.filter('u2date', ['$filter', function ($filter) {
1013		return function (udate) {
1014			var format = 'yyyy-MM-dd';
1015			if (arguments[1]) {
1016				format = arguments[1];
1017			}
1018			return $filter('date')(udate * 1000, format);
1019		};
1020	}]);
1021EwSiteApp.controller('CommentsCtrl', ['$scope', '$http', '$attrs', '$log', function ($scope, $http, $attrs, $log) {
1022		$scope.postUrl = '';
1023		$scope.getUrl = '';
1024		$scope.hash_key = '';
1025		$scope.isconfirm = false;
1026		$scope.errors = [];
1027		$scope.comments = {
1028			list: []
1029		};
1030		$scope.all_displayed = false;
1031
1032		$scope.clearCommentsForm = function () {
1033			$scope.comment.name = "";
1034			$scope.comment.email = "";
1035			$scope.comment.comment = "";
1036			$scope.errors = [];
1037			$scope.commentform.$setPristine();
1038		};
1039
1040//jsonp -comentaru listui
1041
1042		$scope.submit = function () {
1043			if ($scope.postUrl !== '') {
1044				$scope.isconfirm = false;
1045				$http({
1046					method: 'POST',
1047					url: $scope.postUrl + '?hash_key=' + $scope.hash_key,
1048					data: $scope.comment,
1049					xsrfCookieName: $scope.hash_key
1050				}).then(function (response) {
1051					if (response.data.data.success) {
1052						$scope.clearCommentsForm();
1053						$scope.isconfirm = response.data.data.isconfirm;
1054						if (!$scope.isconfirm) {
1055							$scope.getList(1);
1056						}
1057					} else if (angular.isDefined(response.data.data.messages)) {
1058//					$log.debug(data.data.message);
1059						$scope.errors = response.data.data.messages;
1060					}
1061					if (angular.isDefined(response.data.data.debug)) {
1062						$log.debug(response.data.data.debug);
1063					}
1064					if (!$scope.isconfirm) {
1065						$('html, body').animate({
1066							scrollTop: $(".comments_list").offset().top - 10
1067						}, 300);
1068					}
1069				}, function (response) {
1070					console.log(['Error', response]);
1071				});
1072			}
1073		};
1074
1075		$scope.getList = function (getall) {
1076			if (getall == 1) {
1077				$scope.all_displayed = true;
1078			}
1079			if ($scope.getUrl !== '') {
1080				$http({
1081					method: 'GET',
1082					url: $scope.getUrl + '?getall=' + getall + ';hash_key=' + $scope.hash_key,
1083				}).then(function (response) {
1084					$scope.comments.list = response.data.list;
1085					if (getall == 0 && response.data.totalRows <= $scope.limit) {
1086						$scope.all_displayed = true;
1087					}
1088				}, function (response) {
1089					console.log(['Error', response]);
1090				});
1091			}
1092		};
1093
1094		$scope.hasErrors = function () {
1095			return $scope.errors.length > 0;
1096		};
1097
1098
1099
1100
1101	}]).directive('commentsContainer', function () {
1102	return {
1103		restrict: 'A',
1104		link: function (scope, element, attr) {
1105			scope.postUrl = '';
1106			scope.getUrl = '';
1107			scope.hash_key = '';
1108			scope.limit = 10;
1109			if (attr.postUrl !== '') {
1110				scope.postUrl = attr.postUrl;
1111			}
1112			if (attr.id !== '') {
1113				scope.hash_key = attr.id;
1114			}
1115			if (attr.limit !== '') {
1116				scope.limit = attr.limit;
1117			}
1118			if (attr.getUrl !== '') {
1119				scope.getUrl = attr.getUrl;
1120				scope.getList(0);
1121			}
1122
1123		}
1124	};
1125});
1126
1127function init_questions_toggler_hash() {
1128
1129	this.$ct = $('.category-title');
1130	this.$tt = $('.topic-title');
1131	this.offset = ($('.fixed_header').is(':visible')) ? 50 : 0;
1132
1133	var self = this;
1134
1135	this.getArgs = function () {
1136		var query = window.location.hash;
1137		query = query.substr(1)
1138		var args = new Array();
1139		query.split("/").forEach(function (part) {
1140			var item = part.split("-");
1141			args[item[0]] = item[1];
1142		});
1143		return args;
1144	};
1145	var args = this.getArgs();
1146
1147	if (typeof args['c'] !== 'undefined') {
1148		$('[data-category-id="' + args['c'] + '"]').find('.category-title').attr('data-category-role', 'open').next('.topics').removeClass('hidden').addClass('visible');
1149		$('[data-category-id="' + args['c'] + '"]').next('.topics').slideDown("fast");
1150		$('html,body').animate({scrollTop: $('[data-category-id="' + args['c'] + '"]').offset().top - 10 - this.offset + 'px'}, 'fast');
1151	}
1152
1153	if (typeof args['t'] !== 'undefined') {
1154		$('[data-topic-id="' + args['t'] + '"]').attr('data-topic-role', 'open').next('.topic-description').removeClass('hidden').addClass('visible');
1155		$('[data-topic-id="' + args['t'] + '"]').next('.topic-description').slideDown("fast");
1156		$('html,body').animate({scrollTop: $('[data-topic-id="' + args['t'] + '"]').offset().top - 10 - this.offset + 'px'}, 'fast');
1157	}
1158
1159	this.hide = function (sel) {
1160		return sel.slideUp("fast").removeClass('visible').addClass('hidden');
1161	};
1162
1163	this.show = function (sel) {
1164		return sel.slideDown("fast").removeClass('hidden').addClass('visible');
1165	};
1166
1167	this.ctEvent = function () {
1168		this.$ct.click(function () {
1169
1170			if ($(this).attr('data-category-role') === 'close') {
1171				var cur = $(this);
1172
1173				self.hide(self.$ct.attr('data-category-role', 'close').next('.topics')).not($(this));
1174				self.hide(self.$tt.attr('data-topic-role', 'close').next('.topic-description'));
1175				self.show($(this).attr('data-category-role', 'open').next('.topics'));
1176
1177				window.location.hash = '#c-' + $(this).attr('data-category-id');
1178
1179			} else if ($(this).attr('data-category-role') === 'open') {
1180
1181				self.hide(self.$ct.attr('data-category-role', 'close').next('.topics'));
1182				self.hide(self.$tt.attr('data-topic-role', 'close').next('.topic-description'));
1183				self.hide($(this).attr('data-category-role', 'close').next('.topics'));
1184				history.pushState("", document.title, window.location.pathname + window.location.search);
1185
1186			}
1187		});
1188	};
1189
1190	this.ttEvent = function () {
1191		this.$tt.click(function () {
1192			if ($(this).attr('data-topic-role') === 'close') {
1193				var cur = $(this);
1194				self.hide($('.no-topics')).prev('.category-title').attr('data-category-role', 'close');
1195
1196				self.hide(self.$tt.parent('.topics:not(.show)').not($(this).parent()));
1197				self.$tt.parent().prev('.category-title').not($(this).parent().prev('.category-title')).attr('data-category-role', 'close');
1198				self.hide(self.$tt.not($(this)).attr('data-topic-role', 'close').next('.topic-description').not($(this).next('.topic-description')));
1199
1200				self.show($(this).attr('data-topic-role', 'open').next('.topic-description'));
1201
1202				history.pushState("", document.title, window.location.pathname + window.location.search + '#c-' + $(this).attr('data-category-id') + '/' + 't-' + $(this).attr('data-topic-id'));
1203
1204			} else if ($(this).attr('data-topic-role') === 'open') {
1205
1206				self.hide($('.no-topics')).prev('.category-title').attr('data-category-role', 'close');
1207
1208				self.hide(self.$tt.parent('.topics:not(.show)').not($(this).parent()));
1209				self.$tt.parent().prev('.category-title').not($(this).parent().prev('.category-title')).attr('data-category-role', 'close');
1210				self.hide(self.$tt.not($(this)).attr('data-topic-role', 'close').next('.topic-description').not($(this).next('.topic-description')));
1211
1212				self.hide($(this).attr('data-topic-role', 'close').next('.topic-description'));
1213
1214				window.location.hash = '#c-' + $(this).attr('data-category-id');
1215			}
1216		});
1217	};
1218
1219	this.initEvents = function () {
1220		this.ctEvent();
1221		this.ttEvent();
1222	};
1223
1224	this.initEvents();
1225
1226}
1227
1228function catalog_gallery() {
1229	$(".catalog_gallery a").click(function (e) {
1230		e.preventDefault();
1231		e.stopPropagation();
1232		$(".catalog_gallery a").removeClass("active_ph");
1233		$(this).addClass("active_ph");
1234		$("a.full_photo_preview").removeClass("current_photo");
1235		$(".main_photo a.photo" + $(this).data("href")).addClass("current_photo");
1236	});
1237}
1238
1239
1240function file_input() {
1241	$("input[type=file]").nicefileinput({});
1242}
1243
1244function mobile_overflow_tables() {
1245	if ($(".content_template").length) {
1246		$('.content_template table').each(function () {
1247			var element = $(this);
1248			// Create the wrapper element
1249			var scrollWrapper = $('<div />', {
1250				'class': 'scrollable',
1251				'html': '<div />' // The inner div is needed for styling
1252			}).insertBefore(element);
1253			// Store a reference to the wrapper element
1254			element.data('scrollWrapper', scrollWrapper);
1255			// Move the scrollable element inside the wrapper element
1256			element.appendTo(scrollWrapper.find('div'));
1257			// Check if the element is wider than its parent and thus needs to be scrollable
1258			if (element.outerWidth() > element.parent().outerWidth()) {
1259				element.data('scrollWrapper').addClass('has-scroll');
1260			}
1261			// When the viewport size is changed, check again if the element needs to be scrollable
1262			$(window).on('resize orientationchange', function () {
1263				if (element.outerWidth() > element.parent().outerWidth()) {
1264					element.data('scrollWrapper').addClass('has-scroll');
1265				} else {
1266					element.data('scrollWrapper').removeClass('has-scroll');
1267				}
1268			});
1269		});
1270	}
1271}
1272
1273EwSiteApp.service("ajaxSearch", ['$http', '$q', function ($http, $q) {
1274		return({
1275			search: search
1276		});
1277
1278		function search(url) {
1279			var cfg = {
1280				method: 'GET',
1281				url: url
1282			};
1283			if (arguments[1]) {
1284				cfg.params = arguments[1];
1285			}
1286			var request = $http(cfg);
1287			return(request.then(succesHandler, errorHandler));
1288		}
1289		;
1290
1291		function succesHandler(response) {
1292			return response.data;
1293		}
1294
1295		function errorHandler(response) {
1296			if (!angular.isObject(response.data) || !response.data.message) {
1297				return($q.reject("An unknown error occurred."));
1298			}
1299			return($q.reject(response.data.message));
1300		}
1301		;
1302	}]);
1303
1304EwSiteApp.controller('SuggestSearchCtrl', ['$scope', '$log', 'ajaxSearch', function ($scope, $log, ajaxSearch) {
1305		$scope.searchUrl = '';
1306		$scope.sdquery = '';
1307		$scope.searchresults = [];
1308		$scope.total = 0;
1309		$scope.search_url = '';
1310		$scope.templates = {
1311			title_description: 'search/title_description.html',
1312			img_title: 'search/img_title.html',
1313			img_title_description: 'search/img_title_description.html',
1314			module_gallery: 'search/module_gallery.html',
1315			module_youtubegallery: 'search/module_youtubegallery.html',
1316		};
1317		$scope.str_len = 100;
1318
1319		$scope.find = function () {
1320			if ($scope.searchUrl !== '') {
1321				ajaxSearch.search($scope.searchUrl, {sdquery: $scope.sdquery}).then(function (results) {
1322					if ($scope.sdquery === '') {
1323						$scope.clear();
1324					} else {
1325						$scope.displaySuggestions(results);
1326						$scope.total = results.total;
1327						$scope.search_url = results.search_url;
1328
1329					}
1330				}, function (response) {
1331					$log.error(response);
1332				});
1333			}
1334		};
1335		$scope.displaySuggestions = function (results) {
1336			$scope.searchresults = results.data;
1337		};
1338		$scope.clear = function () {
1339			$scope.sdquery = '';
1340			$scope.total = 0;
1341			$scope.displaySuggestions([]);
1342		};
1343		$scope.getDataTemplate = function (data) {
1344			if (data.module === 'gallery' || data.module === 'photoalbums') {
1345				data.display_options.template.id = 'module_gallery';
1346			}
1347			if (data.module === 'youtubegallery') {
1348				data.display_options.template.id = 'module_youtubegallery';
1349			}
1350			if (typeof (data.display_options.template.id) !== 'undefined' && typeof ($scope.templates[data.display_options.template.id]) !== 'undefined') {
1351				return $scope.templates[data.display_options.template.id];
1352			}
1353			return $scope.templates.title_description;
1354		};
1355		$scope.changeLocationHash = function (data, name, varname) {
1356			var hash = '!' + name + data.display_options.vars[varname];
1357			location.hash = hash;
1358		};
1359	}]).directive('suggestSearchContainer', function () {
1360	return {
1361		restrict: 'A',
1362		link: function (scope, element, attr) {
1363			scope.searchUrl = '';
1364			if (attr.searchUrl !== '') {
1365				scope.searchUrl = attr.searchUrl;
1366			}
1367		}
1368	};
1369});
1370
1371function iframe_adaptability() {
1372
1373	var $container = $(".content_template");
1374	var $iframes = $("iframe");
1375
1376	$container.find($iframes).each(function () {
1377		$(this).wrap("<div class='iframe_wrapper'></div>");
1378	});
1379}
1380
1381function getMoreInstagramPhotos(url) {
1382	$('.more_btn_cont').remove();
1383	$('.loader_content').show();
1384	$.ajax({
1385		url: url,
1386		cache: true
1387	}).done(function (html) {
1388		$('.instagram_list').append(html);
1389		$('.loader_content').hide();
1390	});
1391}
1392
1393
1394function reportbug_form() {
1395	if ($("#reportbug_form_wrapper").length) {
1396		$(".reportbug_link a").fancybox({
1397			type: "inline",
1398			padding: [55, 10, 30, 20],
1399			margin: [10, 0, 10, 0],
1400			afterClose: function () {
1401				$(".bugreport_form").find(".bugreport_form_infos").hide();
1402				$(".bugreport_form").find(".one_item").show();
1403				$(".bugreport_form").find(".reportbug_submit").show();
1404				$(".bugreport_form").find(".phpcaptcha_container").show();
1405			}
1406		});
1407
1408		$(".bugreport_form").validate({
1409			highlight: function (element, errorClass, validClass) {
1410				if ($(element).closest(".type_item").length) {
1411					$(element).closest(".type_item").removeClass(validClass).addClass(errorClass);
1412				}
1413			},
1414			unhighlight: function (element, errorClass, validClass) {
1415				if ($(element).closest(".type_item").length) {
1416					$(element).closest(".type_item").removeClass(errorClass).addClass(validClass);
1417				}
1418			},
1419			errorPlacement: function (error, element) {
1420				$(element).closest(".type_item").find('.type_error').append(error);
1421			},
1422			submitHandler: function (form) {
1423				if ($(".bugreport_form").hasClass("currently_sending")) { // if btn inactive
1424					return false;
1425				}
1426				var data = $(form).serialize();
1427				var url = $(form).data("url");
1428				var $form = $(".bugreport_form");
1429				$form.addClass("currently_sending");
1430				$.ajax({
1431					type: "POST",
1432					url: url,
1433					data: data,
1434					success: function (data) {
1435						$form.removeClass("currently_sending");
1436						var $infoc = $(".bugreport_form_infos");
1437						$infoc.find(".info_cont").fadeOut("fast").html();
1438						$infoc.find(".error_cont").fadeOut("fast");
1439						$infoc.find(".error_cont .errors_list").html();
1440						if ($(".phpcaptcha_container", $form).length) {
1441							var captchasrc = $form.find("#captcha_value_image").attr("src");
1442							$form.find("#captcha_value_image").attr("src", captchasrc.split("?")[0] + "?r=" + Math.random());
1443						}
1444						if (!data.data.success) {
1445							$infoc.fadeIn("fast");
1446							$infoc.find(".error_cont").fadeIn("fast").find(".errors_list").html('<p>' + data.data.errors.join("</p><p>") + '</p>');
1447							$(".fancybox-inner").animate({scrollTop: 0 + 'px'}, 'fast');
1448
1449						} else {
1450							$infoc.fadeIn("fast");
1451							$infoc.find(".info_cont").fadeIn("fast").html('<p>' + data.data.message + '</p>');
1452							$form.find("input").not("[name=SITEXSRF]").val('');
1453							$form.find("textarea").val('');
1454							$form.find(".one_item").fadeOut("fast");
1455							$form.find(".reportbug_submit").fadeOut("fast");
1456							$form.find(".phpcaptcha_container").fadeOut("fast");
1457						}
1458					}
1459				});
1460				return false;
1461			}
1462		});
1463	}
1464}
1465
1466function show_more() {
1467	$('.blocks_container').find('.show_more').click(function () {
1468		$(this).toggleClass('active');
1469		$(this).parent('.text_container').next('.block_more_info').slideToggle('fast').toggleClass('open');
1470	});
1471
1472	$('.blocks_container').find('.show_less').click(function () {
1473		$(this).parents('.single_block').find('.show_more').removeClass('active');
1474		$(this).parent('.block_more_info').slideUp('fast').removeClass('open');
1475	});
1476
1477	$('.videos_list').find('.show_video_desc').click(function () {
1478		$(this).toggleClass('active');
1479		$(this).next('.resource_video_desc').slideToggle('fast');
1480	});
1481}
1482
1483function postformwidget_validate() {
1484	var $form = $("#postformwidget_form");
1485	if ($form.length) {
1486		$form.validate({
1487			submitHandler: function (form) {
1488				if ($form.hasClass("currently_sending")) {
1489					return false;
1490				}
1491				var data = $(form).serialize();
1492				var url = $(form).data("url");
1493				$form.addClass("currently_sending");
1494				$.ajax({
1495					type: "POST",
1496					url: url,
1497					data: data,
1498					success: function (data) {
1499						$form.removeClass("currently_sending");
1500						var $infoc = $(".postformwidget_infos");
1501						$infoc.find(".info_cont").fadeOut("fast").html();
1502						$infoc.find(".error_cont").fadeOut("fast");
1503						$infoc.find(".error_cont .errors_list").html();
1504						if (!data.data.success) {
1505							$infoc.fadeIn("fast");
1506							$infoc.find(".error_cont").fadeIn("fast").find(".errors_list").html('<p>' + data.data.errors.join("</p><p>") + '</p>');
1507						} else {
1508							$infoc.fadeIn("fast");
1509							$infoc.find(".info_cont").fadeIn("fast").html('<p>' + data.data.message + '</p>');
1510							$form.find("input").val('');
1511							$form.find("textarea").val('');
1512							$form.find(".input_holder").fadeOut("fast");
1513							$form.find(".contact_block_title").fadeOut("fast");
1514							$form.find(".recaptcha_cont").fadeOut("fast");
1515							$form.find(".button_holder").fadeOut("fast");
1516							setTimeout(function () {
1517								$(window).trigger('resize');
1518							}, 450);
1519						}
1520					}
1521				});
1522				return false;
1523			}
1524		});
1525	}
1526}
1527
1528function init_contacts() {
1529	if ($(".contacts_struct_cont").length) {
1530		$('#search_by_field').change(function () {
1531			$('#search_by_label').text($("#search_by_field option[value='" + $(this).val() + "']").text());
1532		});
1533	}
1534}
1535
1536// http://iamceege.github.io/tooltipster/
1537function tooltipster() {
1538	if ($(".tooltip").length) {
1539		$('.tooltip').tooltipster({
1540			delay: 15
1541		});
1542	}
1543}
1544/** EUCOOKIE */
1545
1546EwSiteApp.controller('EuCookieCtrl', ['$scope', '$http', '$attrs', '$log', function ($scope, $http, $attrs, $log) {
1547		$scope.data = {};
1548		$scope.state = 0;
1549		$scope.pop = false;
1550		$scope.showLine = true;
1551		$scope.message = '';
1552		$scope.loading = false;
1553		$scope.error = false;
1554
1555		if ($scope.state == 1) {
1556			$scope.showLine = false;
1557		}
1558		$scope.hiddeLine = function () {
1559			$scope.showLine = false;
1560		};
1561		$scope.closePopup = function () {
1562			$scope.pop = false;
1563		};
1564		$scope.showPop = function () {
1565			$scope.pop = !$scope.pop;
1566		};
1567		$scope.storeChoises = function () {
1568			$scope.loading = true;
1569
1570			$http({
1571				method: 'POST',
1572				url: unescape($attrs.storeUrl),
1573				data: $scope.data,
1574				xsrfCookieName: secure_xsrf_name,
1575				xsrfHeaderName: 'X-' + secure_xsrf_name
1576			}).then(function (response) {
1577				if (typeof (response.data.message) !== 'undefined' && response.data.message) {
1578					$scope.message = response.data.message;
1579					$scope.loading = false;
1580					$scope.closePopup();
1581					$scope.hiddeLine();
1582				} else {
1583					$scope.error = true;
1584					$scope.loading = false;
1585				}
1586			}, function (response) {
1587				console.log(['Error', response]);
1588			});
1589		};
1590	}]);
1591
1592function sidebar_menu() {
1593	if ($(".submenu_block").length > 0) {
1594		var $parent = $(".submenu_block");
1595		var $icons = $parent.find('.icon-chevron-down');
1596
1597		if ($icons.length > 0) {
1598			$icons.each(function () {
1599				var sliding = false;
1600
1601				$(this).click(function (e) {
1602					e.preventDefault();
1603
1604					if (!sliding) {
1605						sliding = true;
1606
1607						if (!$(this).parents('li').hasClass('show')) {
1608							$(this).parents('ul').children('li.show').removeClass('show').children('ul').slideUp(150);
1609							$(this).parents('ul').children('li').removeClass('prev next');
1610						}
1611
1612						$(this).parents('li').toggleClass('show').removeClass('prev next');
1613						$(this).parents('li').prev().toggleClass('prev');
1614						$(this).parents('li').next().toggleClass('next');
1615						$(this).parent().next().slideToggle(150, function () {
1616							sliding = false;
1617						});
1618					}
1619				});
1620			});
1621		}
1622	}
1623}
1624
1625function scroll_top() {
1626	if ($('.scroll_top').length > 0) {
1627		$('.scroll_top button').click(function () {
1628			$('html, body').animate({
1629				scrollTop: 0
1630			}, 300);
1631		});
1632	}
1633}
1634
1635// titlepage calendar
1636var calendar_data = {
1637	baseurl: '',
1638	month: ''
1639};
1640
1641function set_widgetcalendar_data() {
1642	calendar_data.baseurl = $('#widget_calendar').data('baseurl');
1643	calendar_data.month = $('#widget_calendar').data('month');
1644}
1645
1646function getCalendarMonth(month) {
1647	loadMonth(month);
1648}
1649
1650function loadMonth(month) {
1651	calendar_data.month = month;
1652	loadCalendar();
1653}
1654
1655function loadCalendar() {
1656	$.ajax({
1657		url: calendar_data.baseurl + '/' + calendar_data.month,
1658		cache: false
1659	}).done(function (html) {
1660		$('#events_calendar').html(html);
1661		showDayEvent();
1662		showCurrentMonthEvents();
1663	});
1664}
1665
1666function showDayEvent() {
1667	var activeDay = $('#widget_calendar .calendar_container .day.active');
1668	var $calendar_cont = $('.events_calendar_block');
1669
1670	if ($("#widget_calendar .calendar_container").length > 0) {
1671		activeDay.each(function () {
1672			var $day = $(this);
1673			$day.on("click", function (e) {
1674				e.stopPropagation();
1675				activeDay.removeClass('selected');
1676				$day.addClass('selected');
1677				$calendar_cont.find('.firstload').hide();
1678				$calendar_cont.find('.day_events').hide();
1679				$calendar_cont.find('.day_events[data-selected-day="' + $day.data('day') + '"]').show();
1680			});
1681		});
1682	}
1683}
1684
1685function showCurrentMonthEvents() {
1686	var days = document.querySelectorAll('.items_list .day_events');
1687	var i = 0;
1688	var event_list = [];
1689
1690	for (i; i < days.length; i++) {
1691		var dataid = days[i].getAttribute('data-id');
1692		var includes = event_list.includes(dataid);
1693
1694		if (null !== dataid && !includes) {
1695			days[i].classList.add('show');
1696			event_list.push(dataid);
1697		}
1698	}
1699
1700	if (event_list.length < 1) {
1701		showNoEventMessage();
1702	}
1703}
1704
1705function showNoEventMessage() {
1706	var container = document.querySelector('.section_events .items_list');
1707	if (null !== container) {
1708		var element = document.createElement('span');
1709		element.innerHTML = no_events;
1710		element.classList.add('no_tasks');
1711		container.appendChild(element);
1712	}
1713}
1714
1715function EventCalendar(params) {
1716	var self = this;
1717	var calendar = {
1718		calendar_query: {
1719			category_id: 0,
1720			location_id: 0,
1721			month: '', //$("#content_calendar").attr('data-month')
1722			innerpage: 1,
1723			year: 0,
1724		},
1725		calendar_data: {
1726			baseurl: '',
1727			month: '',
1728			day: ''
1729		}
1730	};
1731
1732	calendar.init = function () {
1733		calendar.set_widgetcalendar_data();
1734		calendar.calendarFilters();
1735//		calendar.calendarPaginate();
1736		calendar.showDayEventInner();
1737		calendar.changeMonth();
1738	};
1739
1740
1741	calendar.set_widgetcalendar_data = function () {
1742		calendar.calendar_data.baseurl = $('#widget_calendar').data('baseurl');
1743		calendar.calendar_data.month = $('#widget_calendar').data('month');
1744	};
1745
1746	calendar.changeMonth = function () {
1747		$('.eventscalendar_list .prev_month, .eventscalendar_list .next_month').click(function () {
1748			calendar.getCalendarMonthInner($(this).attr('data-id'));
1749		});
1750	};
1751
1752	calendar.getCalendarMonthInner = function (month) {
1753		calendar.calendar_query.month = month;
1754		calendar.loadMonthInner();
1755	};
1756
1757	calendar.loadMonthInner = function () {
1758		calendar.loadCalendarInner();
1759	};
1760
1761	calendar.calendarFilters = function () {
1762		$(".filters .categories").change(function () {
1763			calendar.calendar_query.category_id = $(this).val();
1764			calendar.loadMonthInner();
1765		});
1766
1767		$(".filters .locations").change(function () {
1768			calendar.calendar_query.location_id = $(this).val();
1769			calendar.loadMonthInner();
1770		});
1771
1772		$(".filters .years").change(function () {
1773			calendar.calendar_query.year = $(this).val();
1774			calendar.getCalendarMonthInner($(this).val());
1775		});
1776
1777		$(".filters .limit").change(function () {
1778			$(".filters .limit .item").removeClass('active');
1779			$(this).addClass('active');
1780			calendar.calendarPaginate($(this).val());
1781		});
1782	};
1783
1784	calendar.clearCalendarFilters = function () {
1785		calendar.calendar_query.location_id = 0;
1786		calendar.calendar_query.year = 0;
1787		calendar.calendar_query.month = '';
1788		calendar.calendar_query.category_id = 0;
1789		calendar.loadMonthInner();
1790	}
1791
1792	calendar.initClearCalendarFiltersBtn = function () {
1793		var btns = document.querySelectorAll('.filters .clear_filter');
1794		if (null === btn) {
1795			return;
1796		}
1797
1798		for (var i = 0; i < btns.length; i++) {
1799			var btn = btns[i];
1800			btn.addEventListener('click', calendar.clearCalendarFilters);
1801		}
1802	};
1803
1804	calendar.loadCalendarInner = function (month) {
1805		var $calendar_cont = $('#content_calendar');
1806		var url = $calendar_cont.data('baseurl');
1807		var url_month = calendar.calendar_query.month;
1808		if (url_month == '') {
1809			url_month = $("#content_calendar").attr('data-month');
1810		}
1811		var ajaxUrl = url + '/' + url_month;//calendar.calendar_query.month
1812		$.ajax({
1813			url: ajaxUrl,
1814			cache: false,
1815			data: calendar.calendar_query
1816		}).done(function (html) {
1817			$calendar_cont.html(html).promise().done(function (arg1) {
1818				$('.eql_event').responsiveEqualHeightGrid();
1819				select2();
1820				toggle_items();
1821			});
1822			calendar.showDayEventInner();
1823			calendar.changeMonth();
1824			calendar.initClearCalendarFiltersBtn();
1825		});
1826	};
1827
1828	calendar.showDayEventInner = function (fromAjax) {
1829		var $calendar_cont = $('#content_calendar');
1830		var loader = $('#content_calendar').find('.loader_item');
1831		loader.hide();
1832
1833		if ($calendar_cont.length > 0 && $("#events_calendar").length > 0) {
1834			$('.day_withevents.active .day_number').each(function () {
1835				$(this).on("click", function (e) {
1836					e.stopPropagation();
1837					var $tm;
1838					var $day = $(this);
1839					clearTimeout($tm);
1840					$('.day_withevents.active').removeClass('selected');
1841					$(this).parent().addClass('selected');
1842					$calendar_cont.find('.day_events:not(.calendar_item):not(.loader_item):not(.empty_item)').hide();
1843					$('.pagination-container').hide();
1844					loader.show();
1845					calendar.calendar_data.day = $day.data('day');
1846					$tm = setTimeout(function () {
1847						loader.hide();
1848						$calendar_cont.find('.day_events[data-selected-day="' + $day.data('day') + '"]').show();
1849						calendar.calendarPaginate();
1850					}, 300);
1851
1852				});
1853			});
1854
1855			if ($('.day_withevents.active.current').length > 0) {
1856				$('.day_withevents.active.current .day_number').trigger('click').addClass('open');
1857			} else if ($('.day_withevents.active').length > 0) {
1858				$($('.day_withevents.active .day_number')[0]).trigger('click').addClass('open');
1859			}
1860
1861			calendar.calendarFilters();
1862		}
1863
1864	};
1865
1866	calendar.calendarPaginate = function (perpage) {
1867		if ($('.eventscalendar_list .list').length > 0 && calendar.calendar_data.day) {
1868
1869			$(".eventscalendar_list .pagination-container").remove();
1870
1871			if (typeof (perpage) === 'undefined') {
1872				var perpage = $("#content_calendar").attr('data-perpage');
1873			}
1874			$('.eventscalendar_list .list .day_events[data-selected-day="' + calendar.calendar_data.day + '"]').paginathing({
1875				perPage: perpage,
1876				firstLast: false,
1877				prevText: "&lsaquo;",
1878				nextText: '&rsaquo;'
1879			});
1880		}
1881	};
1882
1883	calendar.init();
1884}
1885
1886function loadTitlepageCalendar() {
1887	if ($('.tp_widget_calendar').length > 0 && typeof $('.tp_widget_calendar').data('month') !== 'undefined' && $('.tp_widget_calendar').data('month') !== '') {
1888		getCalendarMonth($('.tp_widget_calendar').data('month'));
1889	}
1890}
1891
1892function toggle_items() {
1893	$('.btn_toggle').click(function () {
1894		$(this).parent().parent().find('.toggle_content').toggleClass('active');
1895		$(this).toggleClass('rotate');
1896	});
1897}
1898
1899function addAriaLabelToMobileMenu() {
1900	var elementsList = document.querySelectorAll('a.mm-next');
1901
1902	if (elementsList.length < 1) {
1903		return;
1904	}
1905
1906	for (var i = 0; i < elementsList.length; i++) {
1907		var element = elementsList[i];
1908		element.setAttribute('aria-label', globalJsTranslations().getTr('next'));
1909	}
1910}
1911
1912// Chartjs
1913var htmlLegendPlugin = {
1914	id: 'htmlLegend',
1915	afterUpdate: function (chart, args, options) {
1916		var legendContainer = document.getElementById(options.containerID);
1917
1918		// Remove old legend labels
1919		while (legendContainer.firstChild) {
1920			legendContainer.firstChild.remove();
1921		}
1922
1923		// Reuse the built-in legendItems generator
1924		var labels = chart.options.plugins.legend.labels.generateLabels(chart);
1925
1926		labels.forEach(function (label) {
1927			var div = document.createElement('div');
1928			div.classList.add('chart-legend__item');
1929
1930			// Color box
1931			var colorBox = document.createElement('span');
1932			colorBox.classList.add('icon');
1933			colorBox.style.background = label.fillStyle;
1934			div.appendChild(colorBox);
1935
1936			// Text box
1937			var textBox = document.createElement('span');
1938			textBox.classList.add('text');
1939			textBox.classList.add('text1320');
1940			textBox.textContent = label.text;
1941			div.appendChild(textBox);
1942
1943			if (chart.config.type == 'pie' || chart.config.type == 'doughnut') {
1944				// Value box
1945				var valueBox = document.createElement('span');
1946				valueBox.classList.add('value');
1947				valueBox.classList.add('text1320');
1948				valueBox.textContent = chart.data.datasets[0].data[label.index];
1949				div.appendChild(valueBox);
1950			}
1951
1952			legendContainer.appendChild(div);
1953		});
1954	}
1955};
1956
1957var customChartJsTooltip = {
1958	enabled: false,
1959
1960	external: function (context) {
1961		// Tooltip Element
1962		var tooltipEl = document.getElementById('chartjs-tooltip');
1963
1964		// Create element on first render
1965		if (!tooltipEl) {
1966			tooltipEl = document.createElement('div');
1967			tooltipEl.id = 'chartjs-tooltip';
1968			tooltipEl.classList.add('chartjs-tooltip');
1969			document.body.appendChild(tooltipEl);
1970		}
1971
1972		// Hide if no tooltip
1973		var tooltipModel = context.tooltip;
1974		if (tooltipModel.opacity === 0) {
1975			tooltipEl.style.opacity = 0;
1976			return;
1977		}
1978
1979		// Set caret Position
1980		tooltipEl.classList.remove('above', 'below', 'no-transform');
1981		if (tooltipModel.yAlign) {
1982			tooltipEl.classList.add(tooltipModel.yAlign);
1983		} else {
1984			tooltipEl.classList.add('no-transform');
1985		}
1986
1987		function getDataValue(item) {
1988			return item.formattedValue;
1989		}
1990
1991//		Set Text
1992		if (tooltipModel.dataPoints) {
1993			var titleLines = tooltipModel.title || [];
1994			var bodyLines = tooltipModel.dataPoints.map(getDataValue);
1995			var innerHtml = '';
1996
1997			// Head content
1998			if (titleLines.length > 0) {
1999				innerHtml += '<div class="chartjs-tooltip__h">';
2000				titleLines.forEach(function (title) {
2001					innerHtml += '<div class="chartjs-tooltip__h-item">' + title + '</div>';
2002				});
2003				innerHtml += '</div>';
2004			}
2005			// Head content END
2006
2007			// Body content
2008			innerHtml += '<div class="chartjs-tooltip__b">';
2009			bodyLines.forEach(function (body, i) {
2010				var colors = tooltipModel.labelColors[i];
2011				var style = 'background:' + colors.backgroundColor;
2012				var span = '<span class="color" style="' + style + '"></span>';
2013				innerHtml += '<div class="chartjs-tooltip__b-item">' + span + body + '</div>';
2014			});
2015			innerHtml += '</div>';
2016			// Body content END
2017
2018			tooltipEl.innerHTML = innerHtml;
2019		}
2020//
2021		var position = context.chart.canvas.getBoundingClientRect();
2022
2023		// Display, position, and set styles for font
2024		tooltipEl.style.opacity = 1;
2025		tooltipEl.style.left = position.left + window.pageXOffset + tooltipModel.x + 'px';
2026		tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.y + 'px';
2027//		tooltipEl.style.left = position.left + window.pageXOffset + tooltipModel.caretX + 'px';
2028//		tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + 'px';
2029	}
2030};
2031
2032function init_showmessage() {
2033	if ($('#showmessage').length > 0) {
2034		if (!!$('#showmessage').data('key') && !!$('#showmessage').data('expires')) {
2035			var cookie_key = $('#showmessage').data('key');
2036			var cookie_expires = $('#showmessage').data('expires');
2037
2038			if (!$.cookie(cookie_key)) {
2039				$('#showmessage').find('.mygtukas').click(function () {
2040					$.cookie(cookie_key, 1, {expires: cookie_expires, path: '/'});
2041					$.fancybox.close();
2042				});
2043
2044				$.fancybox.open({
2045					src: "#showmessage",
2046					opts: {
2047						afterClose: function () {
2048							$.cookie(cookie_key, 1, {expires: cookie_expires, path: '/'});
2049						}
2050					}
2051				});
2052			}
2053		} else {
2054			$('#showmessage').find('.mygtukas').click(function () {
2055				$.fancybox.close();
2056			});
2057			$.fancybox.open({
2058				src: "#showmessage",
2059			});
2060		}
2061	}
2062}
2063
2064function upa_services() {
2065	var cont = $('.upa_services_wrapper');
2066	var title = $('.upa_services_wrapper .category .title');
2067	var subtitle = $('.upa_services_wrapper .content .subtitle');
2068	var subwrap = $('.upa_services_wrapper .content .subwrap');
2069
2070	title.click(function () {
2071		$(this).toggleClass("open");
2072		$(this).next().toggle();
2073	})
2074
2075	subtitle.click(function () {
2076		$(this).toggleClass("open");
2077		$(this).parent().next().toggle();
2078	})
2079}
2080
2081function checkForm(form) {
2082	if (!form.terms.checked) {
2083		return false;
2084	}
2085	return true;
2086}
2087
2088function contentblock() {
2089	$('.s--textimgtop').wrapAll("<div class='s--textimgtop-wrapper' />");
2090}
2091
2092function iframeContactMap() {
2093	if ($('.iframe_wrapper_contact').length) {
2094		$('.iframe_wrapper_contact').click(function () {
2095			$('.iframe_wrapper_contact iframe').css("pointer-events", "auto");
2096		});
2097
2098		$(".iframe_wrapper_contact").mouseleave(function () {
2099			$('.iframe_wrapper_contact iframe').css("pointer-events", "none");
2100		});
2101	}
2102}
2103
2104
2105//function test() {
2106//	var startDate,
2107//			endDate,
2108//			updateStartDate = function () {
2109//				startPicker.setStartRange(startDate);
2110//				endPicker.setStartRange(startDate);
2111//				endPicker.setMinDate(startDate);
2112//			},
2113//			updateEndDate = function () {
2114//				startPicker.setEndRange(endDate);
2115//				startPicker.setMaxDate(endDate);
2116//				endPicker.setEndRange(endDate);
2117//			},
2118//			startPicker = new Pikaday({
2119//				field: document.getElementById('datepicker-start'),
2120//				minDate: new Date(),
2121//				onSelect: function () {
2122//					startDate = this.getDate();
2123//					updateStartDate();
2124//				}
2125//			}),
2126//			endPicker = new Pikaday({
2127//				field: document.getElementById('datepicker-end'),
2128//				minDate: new Date(),
2129//				onSelect: function () {
2130//					endDate = this.getDate();
2131//					updateEndDate();
2132//				}
2133//			}),
2134//			_startDate = startPicker.getDate(),
2135//			_endDate = endPicker.getDate();
2136//
2137//	if (_startDate) {
2138//		startDate = _startDate;
2139//		updateStartDate();
2140//	}
2141//
2142//	if (_endDate) {
2143//		endDate = _endDate;
2144//		updateEndDate();
2145//	}
2146//}
2147
2148EwSiteApp.controller('SubscriptionWidgetCtrl', ['$scope', '$http', '$attrs', '$log', function ($scope, $http, $attrs, $log) {
2149		$scope.postUrl = '';
2150		$scope.message = '';
2151		$scope.errors = [];
2152		$scope.formSubmitted = false;
2153		$scope.loading = false;
2154
2155		$scope.clearForm = function () {
2156			$scope.errors = [];
2157			$scope.loading = false;
2158			$scope.subscription.email = "";
2159			$scope.subscription.terms = false;
2160			$scope.subscription.website = "";
2161			$scope.subscription_form.$setPristine();
2162		};
2163
2164		$scope.send = function () {
2165			if ($scope.postUrl !== '') {
2166				$scope.loading = true;
2167
2168				$http({
2169					method: 'POST',
2170					url: unescape($scope.postUrl),
2171					data: $scope.subscription,
2172					xsrfCookieName: secure_xsrf_name,
2173					xsrfHeaderName: 'X-' + secure_xsrf_name
2174				}).then(function (response) {
2175					if (response.data.data.success && typeof response.data.data.message !== 'undefined' && response.data.data.message !== '') {
2176						$scope.formSubmitted = true;
2177						$scope.message = response.data.data.message;
2178						$scope.clearForm();
2179					} else if (angular.isDefined(response.data.data.errors)) {
2180						$scope.loading = false;
2181						$scope.errors = response.data.data.errors;
2182					}
2183				}, function (response) {
2184					console.log(['Error', response]);
2185				});
2186			}
2187		};
2188
2189		$scope.searchOnEnter = function (e) {
2190			if (e.which === 13 && !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
2191				e.preventDefault();
2192				$scope.send();
2193			}
2194		};
2195
2196		$scope.hasErrors = function () {
2197			return $scope.errors.length > 0;
2198		};
2199
2200	}]).directive('subscriptionWidgetContainer', function () {
2201	return {
2202		restrict: 'A',
2203		link: function (scope, element, attr) {
2204			scope.postUrl = '';
2205			if (attr.postUrl !== '') {
2206				scope.postUrl = attr.postUrl;
2207			}
2208		}
2209	};
2210});
2211var startDate, endDate, startInstance, endInstance;
2212function caleran() {
2213	var fillInputs = function () {
2214		startInstance.$elem.val(startDate ? startDate.locale(startInstance.config.format).format(startInstance.config.format) : "");
2215		endInstance.$elem.val(endDate ? endDate.locale(endInstance.config.format).format(endInstance.config.format) : "");
2216	};
2217//	var userLanguage = navigator.language || navigator.userLanguage;
2218//	if (userLanguage == "en") {
2219//		userLanguage = "de";
2220//	}
2221	$("#caleran_start").caleran({
2222//		startEmpty: $("#caleran_start").val() === "",
2223		startOnMonday: true,
2224		startDate: $("#caleran_start").val(),
2225		endDate: $("#caleran_end").val(),
2226		format: "YYYY-MM-DD",
2227		enableKeyboard: false,
2228		showFooter: false,
2229		minDate: moment.now(),
2230		locale: current_lang,
2231		oninit: function (instance) {
2232			startInstance = instance;
2233			if (!instance.config.startEmpty && instance.config.startDate) {
2234				instance.$elem.val(instance.config.startDate.locale(instance.config.format).format(instance.config.format));
2235				startDate = instance.config.startDate.clone();
2236			}
2237		},
2238		onbeforeshow: function (instance) {
2239			if (startDate) {
2240				startInstance.config.startDate = startDate;
2241				endInstance.config.startDate = startDate;
2242			}
2243			if (endDate) {
2244				startInstance.config.endDate = endDate.clone();
2245				endInstance.config.endDate = endDate.clone();
2246			}
2247			fillInputs();
2248			instance.updateHeader();
2249			instance.reDrawCells();
2250		},
2251		onfirstselect: function (instance, start) {
2252			startDate = start.clone();
2253			startInstance.globals.startSelected = false;
2254			startInstance.hideDropdown();
2255			endInstance.showDropdown();
2256			endInstance.config.minDate = startDate.clone();
2257			endInstance.config.startDate = startDate.clone();
2258			endInstance.config.endDate = null;
2259			endInstance.globals.startSelected = true;
2260			endInstance.globals.endSelected = false;
2261			endInstance.globals.firstValueSelected = true;
2262			endInstance.setDisplayDate(start);
2263			if (endDate && startDate.isAfter(endDate)) {
2264				endInstance.globals.endDate = endDate.clone();
2265			}
2266			endInstance.updateHeader();
2267			endInstance.reDrawCells();
2268			fillInputs();
2269		},
2270	});
2271	$("#caleran_end").caleran({
2272//		startEmpty: $("#caleran_end").val() === "",
2273		startDate: $("#caleran_start").val(),
2274		startOnMonday: true,
2275		endDate: $("#caleran_end").val(),
2276		format: "YYYY-MM-DD",
2277		enableKeyboard: false,
2278		autoCloseOnSelect: true,
2279		showFooter: false,
2280		minDate: moment().add(1, 'days'),
2281		locale: current_lang,
2282		oninit: function (instance) {
2283			endInstance = instance;
2284			if (!instance.config.startEmpty && instance.config.endDate) {
2285				instance.$elem.val(instance.config.endDate.locale(instance.config.format).format(instance.config.format));
2286				endDate = instance.config.endDate.clone();
2287			}
2288		},
2289		onbeforeshow: function (instance) {
2290			if (startDate) {
2291				startInstance.config.startDate = startDate;
2292				endInstance.config.startDate = startDate;
2293			}
2294			if (endDate) {
2295				startInstance.config.endDate = endDate.clone();
2296				endInstance.config.endDate = endDate.clone();
2297			}
2298			fillInputs();
2299			instance.updateHeader();
2300			instance.reDrawCells();
2301		},
2302		onafterselect: function (instance, start, end) {
2303			startDate = start.clone();
2304			endDate = end.clone();
2305			endInstance.hideDropdown();
2306			startInstance.config.endDate = endDate.clone();
2307			startInstance.globals.firstValueSelected = true;
2308			fillInputs();
2309			endInstance.globals.startSelected = true;
2310			endInstance.globals.endSelected = false;
2311		},
2312		onafterhide: function () {
2313			if (startDate && endDate && startDate.isAfter(endDate)) {
2314				var swap = startDate.clone();
2315				startDate = endDate.clone();
2316				endDate = swap;
2317				fillInputs();
2318			}
2319		}
2320	});
2321}

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.