PageSourceSearch

https://villany.hu/wp-content/plugins/gCube-Booking/modal-behavior.js?ver=2021.12.15

js villany.hu collected 2026-10-02 12:18:26 UTC 24,924 bytes, 727 lines download raw bytes

1/*jslint browser: true, sloppy: true */
2/*global window, jQuery, FSZ, ga */
3
4var gCube = {};
5// gCube.ajaxUrl is defined in dynamically generated js
6// gCube.acc_id is defined in dynamically generated js
7
8
9gCube.jsonStrToObject = function (json_str) {
10	var obj = null;
11	try {
12		obj = eval('(' + json_str + ')');
13	} catch (ex) {
14		throw new Error('gCube.jsonStrToObject("' + json_str + '")\n' + ex.message);
15	}
16	return obj;
17};
18
19
20gCube.getBrowserOS = function () {
21	if (navigator.userAgent.indexOf("iPhone") !== -1) {
22		return "iOS";
23	}
24	if (navigator.platform.indexOf("Mac") !== -1) {
25		return "Mac";
26	}
27	if (navigator.platform.indexOf("X11") !== -1) {
28		return "UNIX";
29	}
30	if (navigator.platform.indexOf("Linux") !== -1) {
31		return "Linux";
32	}
33	if (navigator.platform.indexOf("Win") !== -1) {
34		return "Windows";
35	}
36	return 'unknown';
37};
38
39
40gCube.getFlashVersion = function () {
41	var plugin = null,
42		mime = null,
43		a = null,
44		ver = '-';
45
46	// try IE method
47	if (window.ActiveXObject) {
48		try {
49			a = new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash.9");
50			return a.GetVariable("$version").replace(/,/g, '.').replace('WIN ', '');
51		} catch (ignore) {
52		}
53		try {
54			a = new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash.8");
55			return '8' + a.GetVariable("$version").replace(/,/g, '.').replace('WIN ', '');
56		} catch (ignore) {
57		}
58		try {
59			a = new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
60			return '7' + a.GetVariable("$version").replace(/,/g, '.').replace('WIN ', '');
61		} catch (ignore) {
62		}
63	}
64	// try PluginArray
65	if (navigator.plugins) {
66		plugin = navigator.plugins["Shockwave Flash"];
67		if (plugin) {
68			// save description (something like: "Shockwave Flash 10.0 r12")
69			if (plugin.description) {
70				a = plugin.description.split(/ +/);
71				a = a[2].split(/\./);
72				ver = parseInt(a[0], 10) + '.' + parseInt(a[1], 10);
73			} else {
74				ver = '?';
75			}
76		}
77		return ver;
78	}
79	// try MimeTypeArray (if plugin not found yet)
80	if (navigator.mimeTypes) {
81		mime = navigator.mimeTypes['application/x-shockwave-flash'];
82		if (mime && mime.enabledPlugin) {
83			ver = mime.enabledPlugin.description || mime.description;
84			return ver;
85		}
86	}
87	return '-';
88};
89
90
91// returns all available browser data as a json string
92gCube.getBrowserData = function () {
93	var s = '',
94		os = gCube.getBrowserOS();
95
96	s += '{';
97	s += '"os":"' + os + '",';
98	s += '"ua":"' + navigator.userAgent + '",';
99	s += '"flash":"' + gCube.getFlashVersion() + '",';
100	s += '"screen":{"width":' + window.screen.width + ',"height":' + window.screen.height + ',"color":' + window.screen.colorDepth + '}';
101	s += '}';
102	return s;
103};
104
105
106// show the gray mask and the modal window
107gCube.openModalWindow = function (id) {
108	var modal_div = jQuery(id);
109
110	//jQuery(window).scrollTop(0);
111	jQuery('body').css('margin-top', -1*jQuery(window).scrollTop()).addClass('modal_opened');
112};
113
114
115// set error message for one input item
116gCube.setErrorMsg = function (o, message) {
117	var validator_id = o.attr('id') + '_valid',
118		img = jQuery('#' + validator_id);
119
120	o.addClass('error');
121	o.removeClass('valid');
122	if (!img.length) {
123		throw new Error('Validation indicator (#' + validator_id + ') is missing for input item (#' + o.attr('id') + ')');
124	}
125	img.removeClass('valid');
126	img.addClass('error');
127	img.attr('title', message);
128};
129
130
131// clear error message for one input item
132gCube.clearErrorMsg = function (o) {
133	var validator_id = o.attr('id') + '_valid',
134		img = jQuery('#' + validator_id);
135
136	o.removeClass('error');
137	o.removeClass('valid');
138	if (!img.length) {
139		throw new Error('Validation indicator (#' + validator_id + ') is missing for input item (#' + o.attr('id') + ')');
140	}
141	img.removeClass('valid');
142	img.removeClass('error');
143	img.attr('title', '');
144};
145
146
147// mark input field as valid
148gCube.validFieldMsg = function (o, msg) {
149	var validator_id = o.attr('id') + '_valid',
150		img = jQuery('#' + validator_id);
151
152	o.removeClass('error');
153	o.addClass('valid');
154	if (!img.length) {
155		throw new Error('Validation indicator (#' + validator_id + ') is missing for input item (#' + o.attr('id') + ')');
156	}
157	img.removeClass('error');
158	img.addClass('valid');
159	if (msg) {
160		img.attr('title', msg);
161	}
162};
163
164
165gCube.checkLength = function (o, n, min, max) {
166	var nevelo = (n === 'jelszó' ? 'A' : 'Az');
167	if (o.val().length > max || o.val().length < min) {
168		gCube.setErrorMsg(o, nevelo + " " + n + " mező hossza min " + min + " és max " + max + " karakter lehet.");
169		return false;
170	}
171	return true;
172};
173
174
175gCube.checkRegexp = function (o, regexp, msg, checkThisValue) {
176	var valueToCheck = checkThisValue || o.val();
177
178	if (!(regexp.test(valueToCheck))) {
179		gCube.setErrorMsg(o, msg);
180		return false;
181	}
182	return true;
183};
184
185
186gCube.checkText = function (field, msg) {
187	if (field.val() === '') {
188		gCube.setErrorMsg(field, msg);
189		return false;
190	}
191	gCube.clearErrorMsg(field);
192	return true;
193};
194
195
196gCube.checkNumber = function (field, msg1, msg2) {
197	if (field.val() === '') {
198		gCube.setErrorMsg(field, msg1);
199		return false;
200	}
201	if (false === gCube.checkRegexp(field, /^[0-9]{1,3}$/, msg2)) {
202		return false;
203	}
204	gCube.validFieldMsg(field, '');
205	return true;
206};
207
208
209gCube.checkNumberNot0 = function (field, msg1) {
210	if ('0' === field.val()) {
211		gCube.setErrorMsg(field, msg1);
212		return false;
213	}
214	return true;
215};
216
217
218gCube.checkNumberOptional = function (field, msg1, msg2) {
219	if (!field.val()) {
220		gCube.clearErrorMsg(field);
221		return true;
222	}
223	return gCube.checkNumber(field, msg1, msg2);
224};
225
226
227// used because of i18n date strings
228// Return format: yyyy-mm-dd
229gCube.formatDate = function (d) {
230	if (!d) {
231		return '';
232	}
233	return d.getFullYear() + '-' + (d.getMonth() < 9 ? '0' : '') + (1 + d.getMonth()) + '-' + (d.getDate() < 10 ? '0' : '') + d.getDate();
234};
235
236
237gCube.checkDate = function (field, msg1, msg2) {
238	var dateValue = gCube.formatDate(field.datepicker('getDate'));
239
240	if (field.val() === '') {
241		gCube.setErrorMsg(field, msg1);
242		return false;
243	}
244	if (false === gCube.checkRegexp(field, /^[1-2][0-9]{3}-[0-9]{2}-[0-9]{2}$/, msg2, dateValue)) {
245		return false;
246	}
247	gCube.validFieldMsg(field, '');
248	return true;
249};
250
251
252// arrival must be before departure
253// arrival and departure has to be when the acc is opened
254gCube.checkArrivalDepartureDates = function (date_from, date_to) {
255	var open_from_str = '',
256		open_till_str = '',
257		date_from_val = gCube.formatDate(date_from.datepicker('getDate')),
258		date_to_val = gCube.formatDate(date_to.datepicker('getDate')),
259		date_str = '';
260
261	if (gCube.acc_open_from) {
262		open_from_str = new Date().getFullYear() + '-' + (gCube.acc_open_from < 10 ? '0' + gCube.acc_open_from : gCube.acc_open_from) + '-01';
263		open_till_str = new Date().getFullYear() + '-' + (gCube.acc_open_till < 9 ? '0' + (1 + gCube.acc_open_till) : 1 + gCube.acc_open_till) + '-01';
264		if (date_from_val) {
265			if (date_from_val < open_from_str || date_from_val > open_till_str) {
266				gCube.setErrorMsg(date_from, 'Az érkezésnek nyitvatartási időszakban kell lennie.');
267				return false;
268			}
269		}
270		if (date_to_val) {
271			if (date_to_val < open_from_str || date_to_val > open_till_str) {
272				gCube.setErrorMsg(date_to, 'A távozásnak nyitvatartási időszakban kell lennie.');
273				return false;
274			}
275		}
276	}
277	if (date_from_val && gCube.acc_open_from) {
278		date_str = new Date().getFullYear() + '-' + (gCube.acc_open_from < 10 ? '0' + gCube.acc_open_from : gCube.acc_open_from) + '-01';
279		if (date_from_val < date_str) {
280			gCube.setErrorMsg(date_from, 'Az érkezésnek nyitvatartási időszakban kell lennie.');
281			return false;
282		}
283	}
284	if (date_from_val && date_to_val) {
285		if (date_from_val >= date_to_val) {
286			gCube.setErrorMsg(date_from, 'Az érkezésnek a távozás előtt kell lennie.');
287			gCube.setErrorMsg(date_to, 'A távozásnak az érkezés után kell lennie.');
288			return false;
289		}
290		gCube.validFieldMsg(date_from);
291		gCube.validFieldMsg(date_to);
292		return true;
293	}
294	return true;
295};
296
297
298gCube.checkEmail = function (field, msg1, msg2) {
299	if ('' === field.val()) {
300		gCube.setErrorMsg(field, msg1);
301		return false;
302	}
303	if (false === gCube.checkRegexp(field, /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4}$/, msg2)) {
304		return false;
305	}
306	gCube.validFieldMsg(field, '');
307	return true;
308};
309
310
311gCube.checkUrl = function (field, msg1, msg2) {
312	if ('' === field.val()) {
313		gCube.setErrorMsg(field, msg1);
314		return false;
315	}
316	gCube.clearErrorMsg(field);
317	return gCube.checkRegexp(field, /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, msg2);
318};
319
320
321gCube.checkPassword = function (field) {
322	if (false === gCube.checkLength(field, "jelszó", 4, 16)) {
323		return false;
324	}
325	gCube.clearErrorMsg(field);
326	return gCube.checkRegexp(field, /^([0-9a-zA-Z])+$/, "Csak ékezet nélküli betűket és számokat használhat");
327};
328
329
330gCube.checkName = function (field, msg1, msg2, msg3) {
331	if ('' === field.val()) {
332		gCube.setErrorMsg(field, msg1);
333		return false;
334	}
335	if (false === gCube.checkRegexp(field, /^([0-9a-z \-.öüóőúűáéíÖÜÓÚŐŰÁÉÍ])+$/i, msg2)) {
336		gCube.setErrorMsg(field, msg2);
337		return false;
338	}
339	gCube.validFieldMsg(field, msg3);
340	return true;
341};
342
343
344gCube.checkPhone = function (field, msg1, msg2, msg3) {
345	if ('' === field.val()) {
346		gCube.setErrorMsg(field, msg1);
347	}
348	if (false === gCube.checkLength(field, "", 8, 20)) {
349		return false;
350	}
351	if (false === gCube.checkRegexp(field, /^([0-9 \-+\/])+$/i, msg2)) {
352		return false;
353	}
354	gCube.validFieldMsg(field, msg3);
355	return true;
356};
357
358
359gCube.allowNumbersOnly = function (e) {
360	var charCode = (e.which || e.keyCode);
361	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
362		return false;
363	}
364};
365
366
367// if all mandatory fields are filled, then next button is set to active
368// if any mandatory field is invalid, then next button is set to inactive
369gCube.checkAllFieldsOnPage = function (page) {
370	var allOK = false,
371		hasError = false,
372		nextButton = null;
373
374	switch (page) {
375	case 1:
376		nextButton = jQuery('#next1');
377		allOK = jQuery('#adults').hasClass('valid') && jQuery('#date_from').hasClass('valid') && jQuery('#date_to').hasClass('valid') && jQuery('#fullname').hasClass('valid') && jQuery('#telephone').hasClass('valid') && jQuery('#visitor_email').hasClass('valid');
378		hasError = jQuery('#adults').hasClass('error') || jQuery('#children').hasClass('error') ||
379			jQuery('#fullname').hasClass('error') || jQuery('#telephone').hasClass('error') || jQuery('#visitor_email').hasClass('error');
380		break;
381	}
382	if (allOK) {
383		nextButton.addClass('active');
384	}
385	if (hasError) {
386		nextButton.removeClass('active');
387	}
388	//debug alert('gCube.checkAllFieldsOnPage(' + page + ')\nallOK: ' + allOK + '\nhasError: ' +  hasError);
389};
390
391
392// tabbing - start
393gCube.tabs = {};
394gCube.tabs.parent = null;
395gCube.tabs.init = function (jQueryParentNode) {
396	var tabs = null;
397	// check if init was already called
398	if (jQueryParentNode.hasClass('tabs')) {
399		return;
400	}
401	gCube.tabs.parent = jQueryParentNode;
402	gCube.tabs.selected = 0;
403	tabs = jQuery('> div', gCube.tabs.parent);
404	jQuery.each(tabs, function (index) {
405		var tabNode = tabs[index];
406		// do not hide the 1st tab
407		if (0 === index) {
408			return;
409		}
410		jQuery(tabNode).hide();
411	});
412};
413gCube.tabs.getSelected = function () {
414	return gCube.tabs.selected;
415};
416gCube.tabs.select = function (index) {
417	gCube.tabs.selected = index;
418	tabs = jQuery('> div', gCube.tabs.parent);
419	jQuery.each(tabs, function (idx) {
420		var tabNode = tabs[idx];
421		// do not hide the tab to be selected
422		if (index === idx) {
423			jQuery(tabNode).show();
424		} else {
425			jQuery(tabNode).hide();
426		}
427	});
428};
429// tabbing - end
430
431
432// a tartalom betöltődése után van meghívva (a dinamikusan generált js kódból)
433gCube.modalOnload = function () {
434	var load = true; // loading the page for first time
435
436	gCube.tabs.init(jQuery('#tabs'));
437
438	function onAjaxError(tabNum) {
439		window.alert('AJAX hiba: nem jött vissza adat.');
440		if (tabNum) {
441			gCube.tabs.select(tabNum);
442		}
443	}
444
445	// if close button is clicked
446	jQuery('.window .close').click(function (e) {
447		e.preventDefault(); // cancel the link behavior
448		// köszönő oldalon ne fusson esemény
449		if ( 'block' != jQuery('#tabs-4').css('display') ) {
450			FSZ.virtualPageTracking('/v-bezaras-gomb', 'booking', 'closepage');
451		}
452		gCube.tabs.select(0);
453		jQuery('body').removeClass('modal_opened');
454		mt = parseInt(jQuery('body').css('margin-top'));
455		jQuery('body').css('margin-top', 0);
456		jQuery(window).scrollTop(-1*mt);
457		jQuery('#dialog').removeClass('video');
458		jQuery('.window .close').removeClass('thx');
459	});
460	// if mask is click, click on the close button
461	jQuery('#mask').click(function () {
462		jQuery('.window .close').click();
463	});
464
465
466	// go to next page
467	function pagesHandler(x, mode) {
468		var allOK = true,
469			o = null;
470
471		x = parseInt(x, 10); // be sure that x is numeric
472
473		//debug alert('x: ' + x + '\nload: ' + load);
474
475		if (mode === 'prev') {
476			switch (x) {
477			case 0:
478				jQuery('#next1').addClass('active');
479				gCube.tabs.select(0);
480				break;
481			case 1:
482				jQuery('#next2').addClass('active');
483				gCube.tabs.select(1);
484				break;
485			}
486		}
487		if (mode === 'next') {
488			// szállásfoglalás / ajánlatkérés
489			if (x === 0) {
490				if (load) {
491					jQuery('#next1').addClass('active');
492					o = jQuery('#acc_name_hu').val();
493					FSZ.virtualPageTracking('/v-ajanlatkeres-alapadatok?acc=' + encodeURIComponent(o), 'booking', 'showpage1', o);
494				} else {
495					jQuery('#next1').removeClass('active');
496					if (!jQuery('#no_date').is(':checked')) {
497						allOK = allOK && gCube.checkDate(jQuery('#date_from'), 'Érkezés dátuma nincs megadva.', 'Érvénytelen dátum adat.');
498						allOK = allOK && gCube.checkDate(jQuery('#date_to'), 'Távozás dátuma nincs megadva.', 'Érvénytelen dátum adat.');
499						allOK = allOK && gCube.checkArrivalDepartureDates(jQuery('#date_from'), jQuery('#date_to'));
500					}
501					allOK = allOK && gCube.checkName(jQuery('#fullname'), 'Név nincs megadva.');
502					allOK = allOK && gCube.checkPhone(jQuery('#telephone'), 'Telefonszám nincs megadva.', 'Csak számokat, pluszt(+), kötőjelet(-), perjelet(/), és szóközt használhat.');
503					allOK = allOK && gCube.checkEmail(jQuery('#visitor_email'), 'Az e-levélcím nincs megadva.', 'Érvénytelen e-levélcím.');
504					allOK = allOK && gCube.checkNumber(jQuery('#adults'), 'A felnőttek számát meg kell adni.', 'Kérem, hogy számot adjon meg.');
505					allOK = allOK && gCube.checkNumberNot0(jQuery('#adults'), 'A felnőttek száma nem lehet nulla.');
506					allOK = allOK && gCube.checkNumberOptional(jQuery('#children'), '-', 'Kérem, hogy számot adjon meg.');
507					if (!allOK) {
508						jQuery('#dialog').scrollTop(0);
509						jQuery('#dialog').scrollTop(jQuery('.error').offset().top - 52);
510					}
511					if (allOK) {
512						// add "sending" class to the button, to prevent multiple sending
513						if (jQuery('#next1').hasClass('sending')) {
514							return;
515						}
516						jQuery('#next1').addClass('sending');
517						jQuery.ajax({
518							url: gCube.ajaxUrl,
519							type: "POST",
520							dataType: 'json',
521							data: {
522								'mode':      'saveBookingData',
523								'acc_id':    gCube.acc_id,
524								'action_id': (jQuery('#acc_action_span').attr('data-id') || ''),
525								'action_title': (jQuery('#acc_action_span').attr('data-title') || ''),
526								'acc_name':  gCube.acc_name,
527								'acc_city':  gCube.acc_city,
528								'acc_addr':  gCube.acc_addr,
529								'date_from': gCube.formatDate(jQuery('#date_from').datepicker('getDate')),
530								'date_to':   gCube.formatDate(jQuery('#date_to').datepicker('getDate')),
531								'no_date':   (jQuery('#no_date').is(':checked') ? 1 : 0),
532								'adults':    jQuery('#adults').val(),
533								'children':  jQuery('#children').val(),
534								'message':   jQuery('#message').val(),
535								'fullname':  jQuery('#fullname').val(),
536								'email':     jQuery('#visitor_email').val(),
537								'telephone': jQuery('#telephone').val(),
538								'country':   jQuery('#country').val(),
539								'browser':   gCube.getBrowserData(),
540								'analytics': ((window._gaq && window._gaq.push) || "function" === typeof ga ? 1 : 0)
541							},
542							success: function (data) {
543								var g = window._gaq;
544	
545								jQuery('#next1').removeClass('sending').addClass('active');
546								if (!data) {
547									return false;
548								}
549								if (data.error) {
550									window.alert(data.error);
551									return false;
552								}
553								if (data.debug) {
554									window.alert('---debug---\n\n' + data.debug);
555								}
556								// (virtual) page tracking needs to be before e-commerce tracking
557								o = jQuery('#acc_name_hu').val();
558								FSZ.virtualPageTracking('/v-ajanlatkeres-koszonooldal', 'booking', 'Sikeres ajánlatkérés', o);
559								// google analytics e-commerce tracking
560								if (data.ecommerce) {
561									if (g && g.push) {
562										g.push(['_addTrans',
563											data.ecommerce.transaction_id, // required
564											data.ecommerce.affiliation,    // optional (affiliation or store name string)
565											data.ecommerce.total,          // required (floating point number)
566											data.ecommerce.tax,            // optional (amount of tax, floating point number)
567											data.ecommerce.shipping,       // optional (shipping fee, floating point number)
568											data.ecommerce.city,           // optional (string)
569											data.ecommerce.state,          // optional (string)
570											data.ecommerce.country         // optional (string)
571											]);
572										g.push(['_addItem',
573											data.ecommerce.transaction_id, // required (same as above)
574											data.ecommerce.itemSKU,        // required (SKU/code string)
575											data.ecommerce.itemName,       // required (product name string)
576											data.ecommerce.itemCat,        // optional (category or variation string)
577											data.ecommerce.unitPrice,      // required (floating point number)
578											data.ecommerce.quantity        // required (integer number)
579											]);
580										g.push(['_trackTrans']); //submits transaction to the Analytics servers
581									} else {
582										if (window.console && window.console.log) {
583											window.console.log('would do e-commerce tracking, with data:');
584											window.console.log(data.ecommerce);
585										}
586									}
587									if ('function' === typeof ga) {
588										ga('require', 'ecommerce', 'ecommerce.js');
589										ga('ecommerce:addTransaction', {
590											'id': data.ecommerce.transaction_id,       // required
591											'affiliation': data.ecommerce.affiliation, // optional (affiliation or store name string)
592											'revenue': data.ecommerce.total,           // optional (floating point number)
593											'tax': data.ecommerce.tax,                 // optional (amount of tax, floating point number)
594											'shipping': data.ecommerce.shipping        // optional (shipping fee, floating point number)
595										});
596										ga('ecommerce:addItem', {
597											'id': data.ecommerce.transaction_id, // required (same as above)
598											'sku': data.ecommerce.itemSKU,       // optional (SKU/code string)
599											'name': data.ecommerce.itemName,     // required (product name string)
600											'category': data.ecommerce.itemCat,  // optional (category or variation string)
601											'price': data.ecommerce.unitPrice,   // required (floating point number)
602											'data': data.ecommerce.quantity      // required (integer number)
603										});
604										ga('ecommerce:send'); //submits transaction to the Analytics servers
605										jQuery('.window .close').addClass('thx');
606									} else {
607										if (window.console && window.console.log) {
608											window.console.log('would do universal analytics e-commerce tracking, with data:');
609											window.console.log(data.ecommerce);
610										}
611									}
612								}
613								load = true;
614								jQuery('.window .close').css('filter','brightness(0)');
615								gCube.tabs.select(1);
616							},
617							error: onAjaxError
618						});
619					}
620				}
621			}
622			// no more pages
623		}
624		// next or prev button click is handled
625	}
626
627	jQuery('#dialog a.next').click(function (e) {
628		load = false;
629		var x = gCube.tabs.getSelected();
630		e.preventDefault();
631		pagesHandler(x, 'next');
632	});
633
634	jQuery('#dialog a.prev').click(function () {
635		load = true;
636		var x = gCube.tabs.getSelected();
637		pagesHandler(x - 1, 'prev');
638	});
639
640	// Böngészés folytatása
641	jQuery('#dialog').delegate('#continuebrowsing', 'click', function (e) {
642		e.preventDefault();
643		jQuery('.window .close').click();
644	});
645
646	// attach restrictors and validators
647	jQuery('#adults').bind('change keyup blur', function () {
648		gCube.checkNumber(jQuery('#adults'), 'A felnőttek számát meg kell adni.', 'Kérem, hogy számot adjon meg.');
649		gCube.checkNumberNot0(jQuery('#adults'), 'A felnőttek száma nem lehet nulla.');
650		gCube.checkAllFieldsOnPage(1);
651	});
652	jQuery('#children').bind('change keyup blur', function () {
653		gCube.checkNumberOptional(jQuery('#children'), '-', 'Kérem, hogy számot adjon meg.');
654		gCube.checkAllFieldsOnPage(1);
655	});
656	jQuery('#no_date').click(function () {
657		if (jQuery(this).is(':checked')) {
658			jQuery('#date_from').val('');
659			jQuery('#date_to').val('');
660			gCube.clearErrorMsg(jQuery('#date_from'));
661			gCube.clearErrorMsg(jQuery('#date_to'));
662		}
663		gCube.checkAllFieldsOnPage(1);
664	});
665	jQuery("#date_from,#date_to").datepicker({
666		//showOn: 'both',
667		//buttonText: 'dátumválasztó',
668		//buttonImage: gCube.pluginUrl + '/images/d_picker.png',
669		//buttonImageOnly: true,
670		duration: 100,
671		showMonthAfterYear: true,
672		minDate: new Date(),
673		onSelect: function (dateText, inst) {
674			jQuery('#no_date').attr('checked', false);
675			if ('date_from' === inst.id) {
676				jQuery("#date_to").datepicker("option", 'minDate', jQuery(this).datepicker('getDate'));
677				gCube.checkDate(jQuery('#date_from'), 'Érkezés dátuma nincs megadva.', 'Érvénytelen dátum adat.');
678			} else {
679				gCube.checkDate(jQuery('#date_to'), 'Távozás dátuma nincs megadva.', 'Érvénytelen dátum adat.');
680			}
681			gCube.checkArrivalDepartureDates(jQuery('#date_from'), jQuery('#date_to'));
682			gCube.checkAllFieldsOnPage(1);
683		}
684	});
685	jQuery("#adults,#children").keypress(gCube.allowNumbersOnly);
686	jQuery('#fullname').bind('change keyup blur', function () {
687		gCube.checkName(jQuery('#fullname'), 'A nevet meg kell adni.', 'A név csak betűkből, kötőjelből és pontból állhat.');
688		gCube.checkAllFieldsOnPage(1);
689	});
690	jQuery('#telephone').bind('change keyup blur', function () {
691		gCube.checkPhone(jQuery('#telephone'), 'Telefonszám nincs megadva.', 'Csak számokat, pluszt(+), kötőjelet(-), perjelet(/), és szóközt használhat.');
692		gCube.checkAllFieldsOnPage(1);
693	});
694	jQuery('#visitor_email').bind('change keyup blur', function () {
695		gCube.checkEmail(jQuery('#visitor_email'), 'Az e-levélcím nincs megadva.', 'Érvénytelen e-levélcím.');
696		gCube.checkAllFieldsOnPage(1);
697	});
698
699	// --- add click handler booking button ---
700	jQuery('a.booking_button').click(function (e) {
701		e.preventDefault(); // cancel the link behavior
702		gCube.openModalWindow(jQuery(this).attr('href')); // "dialog" will be passed as arg
703		//akciós ajánlatnál betesszük a modalba a választott akció nevét
704		if (jQuery(this).attr('data-title')) {
705			jQuery('#acc_action_span span').html(jQuery(this).attr('data-title'));
706			jQuery('#acc_action_span').attr('data-title', jQuery(this).attr('data-title'));
707			jQuery('#acc_action_span').attr('data-id', jQuery(this).attr('data-id'));
708		} else {
709			jQuery('#acc_action_span').hide();
710		}
711		gCube.tabs.select(0);
712		load = true;
713		pagesHandler(0, 'next');
714	});
715
716	if (jQuery(window).height() <= 768){
717		jQuery('.window').addClass('fixedtop');
718	}
719
720	// close popup when esc key is pressed (and the popup is visible)
721	jQuery(document).on('keyup', function (e) { 
722		if ("Escape" === e.key && '1' === jQuery('#dialog').css('opacity')) {
723			jQuery('#dialog .close').click();
724		}
725	});
726
727}; // end of function gcube.modalOnload

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.