PageSourceSearch

https://tourist-informator.info/js/main.js

js tourist-informator.info collected 2026-10-02 12:31:16 UTC 39,879 bytes, 1,041 lines download raw bytes

1var defMenuSAOutTimeout, defMenuROutTimeout, searchInterval, gridInterval = {}, scrollPosition = [];
2
3function executeCommand(cmd){
4	document.execCommand(cmd, true, null);
5}
6
7function openGridInfo(xTarget, xAction, xID, xDonefunction){
8	console.log($('#' + xTarget + xID).is(':visible'));
9	if((xAction == 'open') && ($('#' + xTarget + xID).is(':visible') == false)) {
10		clearTimeout(gridInterval[xTarget + xID]);
11		$('#' + xTarget + xID).css({ opacity : '0', display : 'block' }).animate({ height : ($('#article' + xID).height() + 15) + 'px', opacity : '1' }, function(){
12			if(typeof xDonefunction === 'function'){
13				xDonefunction();
14			}
15			$('#' + xTarget + xID).append('<label class="closeGridInfo" onclick=" openGridInfo(\'' + xTarget + '\', \'close\', \'' + xID + '\'); ">×</label>');
16		}); 
17	}else{
18		gridInterval[xTarget + xID] = setTimeout(function(){
19			$('#' + xTarget + xID).animate({ height : '0px', opacity : '0' }, function(){
20				$(this).css({ opacity : '0', display : 'none' });
21			}); 
22		}, 400);
23	}
24}
25
26function listAddToFav(uID, uName, uLat, uLong, uMoveTo){
27	obj 	= '#listAddToFav' + uID;
28	if($(obj)[0].src.indexOf('add-to-favorites-orange-ti.png') == -1){
29		$('#hiddenFrame')[0].src = '/ajax/' + lang + '/add-to-trip-planner.html?id=' + uID + '&name=' + uName + '&lat=' + uLat + '&long=' + uLong;
30		$(obj).fadeOut(400, function(){
31			$(this)[0].src = '/images/add-to-favorites-orange-ti.png';
32			$(this).fadeIn(400, function(){
33				$(this).fadeOut(400, function(){
34					$(this).fadeIn(400, function(){
35						$(this).fadeOut(400, function(){
36							$(this).fadeIn(400);
37							actualizeTripCounter();
38						});
39					});
40				});
41			});
42		});
43	}
44	// moveTo 	= ((uMoveTo.tagType == 'id') ? '#' : ((uMoveTo.tagType == 'class') ? '.' : "[" + uMoveTo.tagType + "='")) + uMoveTo.tagValue + ((uMoveTo.tagType == 'id') ? '' : ((uMoveTo.tagType == 'class') ? '' : "']"));
45	// $(obj).clone().appendTo('#extraContents').css({ 
46	// 	position 	: 'fixed', 
47	// 	top 		: $(obj).offset().top + 'px', 
48	// 	left 		: $(obj).offset().left + 'px', 
49	// 	zIndex 		: '9000000' 
50	// }).animate({ 
51	// 	top 		: ($(moveTo).offset().top - parseInt($(obj).height() / 2)), 
52	// 	left 		: ($(moveTo).offset().left - parseInt($(obj).width() / 2)) 
53	// }, 750, 'swing', function(){ 
54	// 	$(this).fadeOut(); 
55	// });
56	// $('#listAddToFav' + uID).fadeOut();
57}
58
59function actualizeTripCounter(){
60	if($('#trip-counter').length > 0){
61		$.ajax({
62			url 	: '//www.tourist-informator.info/ajax/ro/trip-planner-counter.html', 
63			success : function(xData){
64				$('#trip-counter').html(xData);
65			}
66		});
67	}
68}
69
70function loadGridMap(xName, xID, xLat, xLong){
71	if($('#gridDestination' + xID).html() == ''){
72		$('#gridDestination' + xID).html("<iframe src='/ajax/" + lang + "/map/unit.html?label=&lat=" + xLat + "&long=" + xLong + "&zoom=14' onmouseover=\"clearTimeout(gridInterval['gridDestination" + xID + "']); \" onmouseout=\"openGridInfo('gridDestination', 'close', " + xID + "); \" class='gridIFrame'></iframe>");
73	// }else{
74	// 	$('#gridDestination' + xID).html('');
75	// 	clearTimeout(gridInterval['gridDestination" + xID + "']);
76	}
77}
78
79function defMenuSOver(){
80	clearTimeout(defMenuROutTimeout);
81	clearTimeout(defMenuSAOutTimeout);
82
83	$('#tASearch').removeClass('sSelected'); 
84	$('#tReservation').removeClass('sSelected'); 
85	$('#tSearch').addClass('sSelected'); 
86	
87	$('#usASearch').hide(); 
88	$('#usReservation').hide(); 
89	$('#usSearch').show(); 
90
91}
92
93function defMenuSAOver(){
94	clearTimeout(defMenuROutTimeout);
95	clearTimeout(defMenuSAOutTimeout);
96
97	$('#tSearch').removeClass('sSelected'); 
98	$('#tReservation').removeClass('sSelected'); 
99	$('#tASearch').addClass('sSelected'); 
100	
101	$('#usSearch').hide(); 
102	$('#usReservation').hide(); 
103	$('#usASearch').show(); 
104
105}
106
107function defMenuSAOut(){
108	defMenuSAOutTimeout = setTimeout(function(){
109		$('#tSearch').addClass('sSelected'); 
110		$('#tASearch').removeClass('sSelected'); 
111		$('#tReservation').removeClass('sSelected'); 
112
113		$('#usSearch').show(); 
114		$('#usASearch').hide(); 
115		$('#usReservation').hide(); 
116	}, 150);
117}
118
119function defMenuROver(){
120	clearTimeout(defMenuROutTimeout);
121	clearTimeout(defMenuSAOutTimeout);
122
123	$('#tSearch').removeClass('sSelected'); 
124	$('#tASearch').removeClass('sSelected'); 
125	$('#tReservation').addClass('sSelected'); 
126	
127	$('#usSearch').hide(); 
128	$('#usASearch').hide(); 
129	$('#usReservation').show(); 
130
131}
132
133function defMenuROut(){
134	defMenuROutTimeout = setTimeout(function(){
135		$('#tSearch').addClass('sSelected'); 
136		$('#tReservation').removeClass('sSelected'); 
137		$('#tASearch').removeClass('sSelected'); 
138		
139		$('#usSearch').show(); 
140		$('#usReservation').hide(); 
141		$('#usASearch').hide(); 
142	}, 150);
143}
144
145var doInstantSearchLoading = false, doLocationSearchLoading = false, doCitySearchLoading = false;
146
147function doInstantSearch(searchKey, sLang, what, action, destination){
148	$('#ASTab').removeClass('sSelected');
149	$('#STab').addClass('sSelected');
150	clearTimeout(searchInterval);
151	clearTimeout(searchTimeout);
152	dest = (typeof destination != 'undefined') ? '#' + destination : '#usSearchHere';
153	$(dest).show();
154	searchInterval = setTimeout(function(){
155		if(doInstantSearchLoading){
156			doInstantSearchLoading.abort();
157		}
158		doInstantSearchLoading = $.ajax({
159			url 		: '/ajax/' + sLang + '/instantSearch.html?' + (((typeof what != 'undefined') && (what != '')) ? 'what=' + what + '&' : '') + (((typeof action != 'undefined') && (action != '')) ? 'action=' + action + '&' : '') + 'q=' + escape(searchKey), 
160			crossDomain : true, 
161			success 	: function(xData){
162				$(dest).html(xData);
163				changeAllAHref();
164			}
165		});
166	}, 50);
167}
168
169function doInstantSearchCustomDest(searchKey, sLang, sDest, what, action, noall){
170	$('#ASTab').removeClass('sSelected');
171	$('#STab').addClass('sSelected');
172	clearTimeout(searchInterval);
173	clearTimeout(searchTimeout);
174	$('#' + sDest).show();
175	searchInterval = setTimeout(function(){
176		if(doInstantSearchLoading){
177			doInstantSearchLoading.abort();
178		}
179		doInstantSearchLoading = $.ajax({
180			url 		: '/ajax/' + sLang + '/instantSearch.html?' + ((what) ? 'what=' + what + '&' : '') + ((action) ? 'action=' + action + '&' : '') + ((noall == true) ? 'noall=true&' : '') + 'q=' + escape(searchKey), 
181			crossDomain : true, 
182			success 	: function(xData){
183				$('#' + sDest).html(xData);
184				changeAllAHref();
185			}
186		});
187	}, 50);
188}
189
190function scaleRange(smin, smax, scur, dmin, dmax){
191	return (dmax-dmin)*((scur-smin)/(smax-smin))+dmin;
192}
193
194function doLocationSearch(searchKey, sLang, searchCategories){
195	clearTimeout(searchInterval);
196	clearTimeout(searchTimeout);
197	$('#usLocSearchHere').show();
198	searchInterval = setTimeout(function(){
199		if(doLocationSearchLoading){
200			doLocationSearchLoading.abort();
201		}
202		doLocationSearchLoading = $.ajax({
203			url 		: '/ajax/' + sLang + '/instantLocSearch.html?q=' + escape(searchKey) + ((searchCategories) ? '&c=' + searchCategories : ''), 
204			crossDomain : true, 
205			success 	: function(xData){
206				$('#usLocSearchHere').html(xData);
207				changeAllAHref();
208			}
209		});
210	}, 50);
211}
212
213function doCitySearch(searchKey, sLang){
214	clearTimeout(searchInterval);
215	clearTimeout(searchTimeout);
216	$('#usLocSearchHere').show();
217	searchInterval = setTimeout(function(){
218		if(doCitySearchLoading){
219			doCitySearchLoading.abort();
220		}
221		doCitySearchLoading = $.ajax({
222			url 		: '/ajax/' + sLang + '/instantCitySearch.html?q=' + escape(searchKey), 
223			crossDomain : true, 
224			success 	: function(xData){
225				$('#usLocSearchHere').html(xData);
226				changeAllAHref();
227			}
228		});
229	}, 50);
230}
231
232function loadGoogleMaps(){
233	if(mapIsLoaded == false){
234		var s = document.createElement("script");
235		s.type = "text/javascript";
236		s.src  = "https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&libraries=places&callback=gmap_draw";
237		window.gmap_draw = function(){
238//			alert ("Callback code here");
239		};
240   		$("head").append(s);
241		mapIsLoaded = true;  
242		$.getScript('/js/StyledMarker.js');
243		$.getScript('/js/markerclusterer.js');
244	}
245}
246
247function getMyPositionsSettlement(alertText, lang){
248	if(currLat){
249		$('#hiddenFrame')[0].src='/ajax/' + lang + '/get-current-settlement-by-position.html?lat=' + currLat + '&long=' + currLong;
250	}else{
251		alert(alertText);
252	}
253}
254
255function loadOtherContent(URL, DEST, FUNC){
256	$.ajax({
257		url 			: URL, 
258		crossDomain 	: true, 
259		success 		: function(xData){
260			$('#' + DEST).html(xData);
261			if(typeof FUNC == 'function'){
262				FUNC();
263			}
264		}
265	})
266}
267
268function number_format(number, decimals, dec_point, thousands_sep) {
269	number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
270	var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function (n, prec) {
271		var k = Math.pow(10, prec);
272		return '' + (Math.round(n * k) / k).toFixed(prec);
273	};
274	s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
275	if (s[0].length > 3) {
276		s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
277	}
278	if ((s[1] || '').length < prec) {
279		s[1] = s[1] || '';
280		s[1] += new Array(prec - s[1].length + 1).join('0');
281	}
282	return s.join(dec);
283}
284
285function hideAdmin(){
286	var html = jQuery('html');
287	var scrollPosition = html.data('scroll-position');
288	if(typeof scrollPosition != 'undefined'){
289		html.css('overflow', html.data('previous-overflow'));
290		window.scrollTo(scrollPosition[0], scrollPosition[1])
291	}
292	$('#myaccount').animate({ right : '-100%' });
293}
294
295function openAdmin(adminURL){
296	var scrollPosition = [
297		self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
298		self.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop
299	];
300	var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
301	html.data('scroll-position', scrollPosition);
302	html.data('previous-overflow', html.css('overflow'));
303	html.css('overflow', 'hidden');
304	window.scrollTo(scrollPosition[0], scrollPosition[1]);
305	$('#myaccount')[0].src = adminURL ? adminURL : '/' + lang + '/admin.html'; 
306	$('#myaccount').css({ right : '0px' });
307}
308
309function toggleAdmin(adminURL){
310	if($('#myaccount').css('right') != 0){
311		var scrollPosition = [
312			self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
313			self.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop
314		];
315		var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
316		html.data('scroll-position', scrollPosition);
317		html.data('previous-overflow', html.css('overflow'));
318		html.css('overflow', 'hidden');
319		window.scrollTo(scrollPosition[0], scrollPosition[1]);
320	}else{
321		var html = jQuery('html');
322		var scrollPosition = html.data('scroll-position');
323		html.css('overflow', html.data('previous-overflow'));
324		window.scrollTo(scrollPosition[0], scrollPosition[1])
325	}
326	$('#myaccount')[0].src = adminURL ? adminURL : '/' + lang + '/admin.html'; 
327	$('#myaccount').animate({ right : (($('#myaccount').css('right') == 0) ? '-100%' : '0px') });
328}
329
330function closePopupThis(){
331	mustBeRoot = (typeof mustBeRoot == 'undefined') ? false : mustBeRoot;
332	if(mustBeRoot == true){
333		history.pushState({ url : '/' }, '', '/');
334		loadAjaxURL('/');
335		mustBeRoot = false;
336	}else{
337		history.pushState({ url : prevLocationHref }, '', prevLocationHref);
338		document.title = prevPageTitle;
339	}
340	$('#customContents').html(''); 
341}
342
343var prevLocationHref = '/', prevPageTitle = document.title, openPopupThisObj = '';
344
345function openPopupCallback(e){
346	if($('#customContents').html() == ''){
347		openPopupThis($('#' + e.state.xOBJ), e.state.url, 'left');
348	}
349}
350
351function openPopupThisChHRef(xURL){
352	history.pushState({ 
353		url 		: xURL, 
354		xOBJ 		: openPopupThisObj, 
355		callback 	: 'openPopupCallback'
356	}, '', xURL);
357}
358
359function openPopupThisLoaded(){
360	$('#bottomPopupLoad').fadeOut(); 
361}
362
363function doPopupThis(xOBJ, xURL, xDIR, xGET){
364	if($('#customContents').html() != ''){
365		closePopupThis();
366	}
367	if($('#hBottom').is(':visible')){
368		$('#hBottom').hide();
369	}
370	prevLocationHref 	= location.href;
371	prevPageTitle 		= document.title;
372	openPopupThisObj 	= xOBJ.id;
373	$('#customContents').html("<div id='bubbleWindowContE'></div>" + 
374	"<div id='bubbleWindowCont' style='bottom:40px; '>" + 
375		"<img src='/images/close-white.png' onclick='closePopupThis(); ' style='position:absolute; top:34px; right:34px; height:16px; cursor:pointer; padding:4px; background:#fff; z-index:1; '>" + 
376		"<img src='/images/white-arrow-down.png' style='position:absolute; bottom:10px; left:" + ($(xOBJ).offset().left + parseInt($(xOBJ).width() / 2) - 2) + "px; '>" + 
377		"<table>" + 
378			"<tr>" + 
379				"<td><div style='position:relative; '>" + 
380					"<iframe src='" + xURL + "' onload='openPopupThisLoaded(); ' id='bubbleWindow' name='bubbleWindow'></iframe>" + 
381					"<div id='bottomPopupLoad' style='position:absolute; top:0px; left:0px; width:100%; height:100%; background:#fff; text-align:center; '><div style='padding-top:120px; font-size:14pt; '><img src='/images/ajax-loading-01.gif'><br><span>loading ...</span></div></div>" + 
382				"</div></td>" + 
383			"</tr>" + 
384		"</table>" + 
385	"</div>");
386	return false;
387}
388
389function doPopupSocial(xOBJ){
390	if($('#hBottom').is(':visible')){
391		$('#hBottom').slideUp(400, function(){
392			$('#customContents').html("<div id='bubbleWindowContE'></div><div id='bubbleWindowSocialCont' style='bottom:40px; '><img src='/images/close-white.png' onclick=\"$('#customContents').html(''); \" style='position:absolute; top:34px; right:34px; height:16px; cursor:pointer; padding:4px; background:#fff; '><img src='/images/white-arrow-down.png' style='position:absolute; bottom:10px; left:" + ($(xOBJ).offset().left + parseInt($(xOBJ).width() / 2) - 2) + "px; '><table><tr><td><iframe src='/ajax/" + lang + "/social.html' id='bubbleWindowSocial'></iframe></td></tr></table></div>");
393		}); 
394	}else{
395		$('#customContents').html("<div id='bubbleWindowContE'></div><div id='bubbleWindowSocialCont' style='bottom:40px; '><img src='/images/close-white.png' onclick=\"$('#customContents').html(''); \" style='position:absolute; top:34px; right:34px; height:16px; cursor:pointer; padding:4px; background:#fff; '><img src='/images/white-arrow-down.png' style='position:absolute; bottom:10px; left:" + ($(xOBJ).offset().left + parseInt($(xOBJ).width() / 2) - 2) + "px; '><table><tr><td><iframe src='/ajax/" + lang + "/social.html' id='bubbleWindowSocial'></iframe></td></tr></table></div>");
396	}
397}
398
399function loadDownMap(uID, uName, uLat, uLong){
400	if($('#articleMap' + uID).is(':visible') == false){
401		$('#articleMap' + uID).html("<iframe src='/ajax/" + lang + "/map
401/unit.html?label=" + escape(uName) + "&lat=" + uLat + "&long=" + uLong + "&zoom=16' id='articleMapFrame'></iframe>");
402	}
403	$('#articleMap' + uID).slideToggle();
404}
405
406function voteBar(e, progressObj, progressStyle, isVertical){
407	if(isVertical){
408		progressObj.css({height : e.layerY + 'px'});
409	}else{
410		progressObj.css({width : e.layerX + 'px'});
411	}
412}
413
414function closeWindow(){
415	var html = jQuery('html');
416	var scrollPosition = html.data('scroll-position');
417	html.css('overflow', html.data('previous-overflow'));
418	window.scrollTo(scrollPosition[0], scrollPosition[1])
419	$('#windowBackground').fadeOut(); 
420}
421
422function showWindow(xWidth, xHeight, xTitle, xURL, xCloseIcon){
423	if(! xCloseIcon){
424		xCloseIcon = '/images/w-close.png';
425	}
426	xWidth 	= (xWidth > (window.innerWidth - 40)) ? 'calc(100vw - 20px)' : xWidth + 'px';
427	xHeight = (xHeight > (window.innerHeight - 120)) ? 'calc(100vh - 120px)' : xHeight + 'px';
428	$('#customContents').html('');
429	$('#customContents').html('<table id="windowBackground" style="display:none; z-index:100000; "><tr><td><div><span>' + xTitle + '</span><img src="' + xCloseIcon + '" onclick="closeWindow(); "><iframe src="' + xURL + '" style="width:' + xWidth + '; height:' + xHeight + '; "></iframe></div></td></tr></table>');
430//	alert('x x');
431	
432	var scrollPosition = [
433		self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
434		self.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop
435	];
436	var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
437	html.data('scroll-position', scrollPosition);
438	html.data('previous-overflow', html.css('overflow'));
439	html.css('overflow', 'hidden');
440	window.scrollTo(scrollPosition[0], scrollPosition[1]);
441	
442	$('#windowBackground').fadeIn(); 
443}
444
445function flyWindow(xContent){
446	$('#customContents').html('');
447	$('#customContents').html("<table id='flyBackground'><tr><td><center><div id='flyDiv'><span id='flyClose' onclick='closeFly(); '>×</span>" + xContent + "</div></center></td></tr></table>");
448	$('#flyBackground').show().animate({ top : '0px', opacity : '1' });
449}
450
451function closeFly(){
452	$('#flyBackground').animate({ top : '-200px', opacity : '0' });
453}
454
455function fly(source, target, offset, targetContainer) {
456	var rnd 		= Math.round(10000 * Math.random());
457	var container 	= document.createElement( 'div' );
458
459	var to 			= { x : $(target).offset().left, y : $(target).offset().top };
460	var from 		= { x : $(source).offset().left, y : $(source).offset().top };
461	console.log(from);
462	console.log(to);
463	container.setAttribute( 'id', '__suitcase_container' + rnd );
464	container.setAttribute( 'class', source.className );
465	if(document.all) {
466		container.className = source.className;
467	}
468	container.id = '__suitcase_container' + rnd;
469	if(targetContainer){
470		targetContainer.appendChild(container);
471	}else{
472		source.parentNode.appendChild(container);
473	}
474
475	container.innerHTML 		= source.innerHTML;
476	container.style.position 	= 'absolute';
477	container.style.left 		= (from.x) + 'px';
478	container.style.top 		= from.y + 'px';
479	container.style.width 		= $(source).width() + 'px';
480	container.style.display 	= '';
481
482	$(container).animate({
483		left 	: (to.x + offset.x), 
484		top 	: (to.y + offset.y)
485	}, 1000, function(){
486		setTimeout(function(){
487			$(container).fadeOut();
488		}, 1000);
489	});
490}
491
492function mt_rand(min, max) {
493	//  discuss at: http://phpjs.org/functions/mt_rand/
494	// original by: Onno Marsman
495	// improved by: Brett Zamir (http://brett-zamir.me)
496	//    input by: Kongo
497	//   example 1: mt_rand(1, 1);
498	//   returns 1: 1
499
500	var argc = arguments.length;
501	if (argc === 0) {
502		min = 0;
503		max = 2147483647;
504	} else if (argc === 1) {
505		throw new Error('Warning: mt_rand() expects exactly 2 parameters, 1 given');
506	} else {
507		min = parseInt(min, 10);
508		max = parseInt(max, 10);
509	}
510	return Math.floor(Math.random() * (max - min + 1)) + min;
511}
512
513String.prototype.trim = function(charlist) {
514	//  discuss at: http://phpjs.org/functions/trim/
515	// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
516	// improved by: mdsjack (http://www.mdsjack.bo.it)
517	// improved by: Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev)
518	// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
519	// improved by: Steven Levithan (http://blog.stevenlevithan.com)
520	// improved by: Jack
521	//    input by: Erkekjetter
522	//    input by: DxGx
523	// bugfixed by: Onno Marsman
524	//   example 1: trim('    Kevin van Zonneveld    ');
525	//   returns 1: 'Kevin van Zonneveld'
526	//   example 2: trim('Hello World', 'Hdle');
527	//   returns 2: 'o Wor'
528	//   example 3: trim(16, 1);
529	//   returns 3: 6
530
531	str = this;
532
533	var whitespace, l = 0, i = 0;
534	str += '';
535
536	if (!charlist) {
537		// default list
538		whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
539	} else {
540		// preg_quote custom list
541		charlist += '';
542		whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');
543	}
544
545	l = str.length;
546	for (i = 0; i < l; i++) {
547		if (whitespace.indexOf(str.charAt(i)) === -1) {
548			str = str.substring(i);
549			break;
550		}
551	}
552
553	l = str.length;
554	for (i = l - 1; i >= 0; i--) {
555		if (whitespace.indexOf(str.charAt(i)) === -1) {
556			str = str.substring(0, i + 1);
557			break;
558		}
559	}
560
561	return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
562}
563
564var defaultDiacriticsRemovalap = [
565	{'base':'A', 'letters':'\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'},
566	{'base':'AA','letters':'\uA732'},
567	{'base':'AE','letters':'\u00C6\u01FC\u01E2'},
568	{'base':'AO','letters':'\uA734'},
569	{'base':'AU','letters':'\uA736'},
570	{'base':'AV','letters':'\uA738\uA73A'},
571	{'base':'AY','letters':'\uA73C'},
572	{'base':'B', 'letters':'\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181'},
573	{'base':'C', 'letters':'\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E'},
574	{'base':'D', 'letters':'\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779'},
575	{'base':'DZ','letters':'\u01F1\u01C4'},
576	{'base':'Dz','letters':'\u01F2\u01C5'},
577	{'base':'E', 'letters':'\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E'},
578	{'base':'F', 'letters':'\u0046\u24BB\uFF26\u1E1E\u0191\uA77B'},
579	{'base':'G', 'letters':'\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E'},
580	{'base':'H', 'letters':'\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D'},
581	{'base':'I', 'letters':'\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197'},
582	{'base':'J', 'letters':'\u004A\u24BF\uFF2A\u0134\u0248'},
583	{'base':'K', 'letters':'\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2'},
584	{'base':'L', 'letters':'\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u014
5841\u023D\u2C62\u2C60\uA748\uA746\uA780'},
585	{'base':'LJ','letters':'\u01C7'},
586	{'base':'Lj','letters':'\u01C8'},
587	{'base':'M', 'letters':'\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C'},
588	{'base':'N', 'letters':'\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4'},
589	{'base':'NJ','letters':'\u01CA'},
590	{'base':'Nj','letters':'\u01CB'},
591	{'base':'O', 'letters':'\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C'},
592	{'base':'OI','letters':'\u01A2'},
593	{'base':'OO','letters':'\uA74E'},
594	{'base':'OU','letters':'\u0222'},
595	{'base':'OE','letters':'\u008C\u0152'},
596	{'base':'oe','letters':'\u009C\u0153'},
597	{'base':'P', 'letters':'\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754'},
598	{'base':'Q', 'letters':'\u0051\u24C6\uFF31\uA756\uA758\u024A'},
599	{'base':'R', 'letters':'\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782'},
600	{'base':'S', 'letters':'\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784'},
601	{'base':'T', 'letters':'\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786'},
602	{'base':'TZ','letters':'\uA728'},
603	{'base':'U', 'letters':'\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244'},
604	{'base':'V', 'letters':'\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245'},
605	{'base':'VY','letters':'\uA760'},
606	{'base':'W', 'letters':'\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72'},
607	{'base':'X', 'letters':'\u0058\u24CD\uFF38\u1E8A\u1E8C'},
608	{'base':'Y', 'letters':'\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE'},
609	{'base':'Z', 'letters':'\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762'},
610	{'base':'a', 'letters':'\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250'},
611	{'base':'aa','letters':'\uA733'},
612	{'base':'ae','letters':'\u00E6\u01FD\u01E3'},
613	{'base':'ao','letters':'\uA735'},
614	{'base':'au','letters':'\uA737'},
615	{'base':'av','letters':'\uA739\uA73B'},
616	{'base':'ay','letters':'\uA73D'},
617	{'base':'b', 'letters':'\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253'},
618	{'base':'c', 'letters':'\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184'},
619	{'base':'d', 'letters':'\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A'},
620	{'base':'dz','letters':'\u01F3\u01C6'},
621	{'base':'e', 'letters':'\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD'},
622	{'base':'f', 'letters':'\u0066\u24D5\uFF46\u1E1F\u0192\uA77C'},
623	{'base':'g', 'letters':'\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F'},
624	{'base':'h', 'letters':'\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265'},
625	{'base':'hv','letters':'\u0195'},
626	{'base':'i', 'letters':'\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131'},
627	{'base':'j', 'letters':'\u006A\u24D9\uFF4A\u0135\u01F0\u0249'},
628	{'base':'k', 'letters':'\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3'},
629	{'base':'l', 'letters':'\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747'},
630	{'base':'lj','letters':'\u01C9'},
631	{'base':'m', 'letters':'\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F'},
632	{'base':'n', 'letters':'\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5'},
633	{'base':'nj','letters':'\u01CC'},
634	{'base':'o', 'letters':'\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275'},
635	{'base':'oi','letters':'\u01A3'},
636	{'base':'ou','letters':'\u0223'},
637	{'base':'oo','letters':'\uA74F'},
638	{'base':'p','letters':'\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755'},
639	{'base':'q','letters':'\u0071\u24E0\uFF51\u024B\uA757\uA759'},
640	{'base':'r','letters':'\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783'},
641	{'base':'s','letters':'\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B'},
642	{'base':'t','letters':'\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787'},
643	{'base':'tz','letters':'\uA729'},
644	{'base':'u','letters': '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289'},
645	{'base':'v','letters':'\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C'},
646	{'base':'vy','letters':'\uA761'},
647	{'base':'w','letters':'\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73'},
648	{'base':'x','letters':'\u0078\u24E7\uFF58\u1E8B\u1E8D'},
649	{'base':'y','letters':'\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF'},
650	{'base':'z','letters':'\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763'}
651];
652
653var diacriticsMap = {};
654for (var i=0; i < defaultDiacriticsRemovalap.length; i++){
655	var letters = defaultDiacriticsRemovalap[i].letters;
656	for (var j=0; j < letters.length ; j++){
657		diacriticsMap[letters[j]] = defaultDiacriticsRemovalap[i].base;
658	}
659}
660
661// "what?" version ... http://jsperf.com/diacritics/12
662function removeDiacritics (str) {
663	return str.replace(/[^\u0000-\u007E]/g, function(a){ 
664		return diacriticsMap[a] || a; 
665	});
666}
667
668var printerData = '';
669
670function initPrintPreview() {
671	//MAIN PRINT WINDOW
672	$('cnt_mid').innerHTML = opener.printerData;
673
674	var controls = $$('#print_content a');
675	for (var i=0; i<controls.length; i++){
676		controls[i].onclick = function() {return false;};
677		controls[i].style.cursor = 'default';
678	}
679
680	//RESULT_PAGES
681	if ($('print_content')){
682		var pToolbars = $$('#print_content table.toolbar');
683		for (var i=0; i<pToolbars.length; i++){
684			pToolbars[i].style.display = 'none';
685		}
686		var booking = $$('.booking');
687		for (var i=0; i<booking.length; i++){
688			booking[i].style.display = 'none';
689		}
690
691	}
692	//INFO PAGES
693	if($('g_shadow')){
694		var gallery = $('g_shadow');
695		gallery.style.display = 'none';
696	}
697	if($('cms_language_selector_flags')) {
698		$('cms_language_selector_flags').style.display = 'none';
699	}
700	if($('partner_header_infotxt')) {
701		$('partner_header_infotxt').style.display = 'none';
702	}
703	if($('partner_header_txt')) {
704		$('partner_header_txt').style.marginBottom = '20px';
705	}
706	var offerimgs = $$('img[src="/partner/img/icon_partner_requestoffer_hu.gif"]');
707	for (var i=0; i<offerimgs.length; i++){
708		offerimgs[i].style.display = 'none';
709	}
710	if($('pIP')) {
711		var timgs = $('pIP').select('div.thumbs');
712		for (var i=0; i<timgs.length; i++){
713			timgs[i].style.display = 'none';
714		}
715	}
716	if($('print_content')){
717		var iPageToolbar = $$('#print_content table.toolbar');
718		for (var i=0; i<iPageToolbar.length; i++){
719			iPageToolbar[i].style.display = 'none';
720		}
721	}
722	// SUITCASE
723	if($('cnt_mid')) {
724		var controls = $$('.suitcase_control_tpl');
725		for (var i=0; i<controls.length; i++){
726			controls[i].style.display = 'none';
727		}
728	}
729	// SITEMAP
730	if($('cnt_main_containercol1')) {
731		var holder = document.createElement("div");
732		holder.setAttribute("id","holder");
733		$('cnt_mid').appendChild(holder);
734		var item1 = $('cnt_main_containercol1');
735		var item2 = $('cnt_main_containercol2');
736		var item3 = $('cnt_main_containercol3');
737		$('holder').appendChild(item1);
738		$('holder').appendChild(item2);
739		$('holder').appendChild(item3);
740		$('holder').style.height = $('cnt_main_containercol1').style.height;
741		$('holder').style.width = '420px';
742	}
743
744	//HIDES
745	if($('cnt_result_container_right')){
746		$('cnt_result_container_right').hide();
747	}
748	if($('cnt_result_Issuescontainer_right')){
749		$('cnt_result_Issuescontainer_right').hide();
750	}
751	//GOOGLE_MAP PRINT
752	try{
753		if($('toolbar_td')){
754			$('toolbar_td').innerHTML = $('sidebar_td').innerHTML;
755			$('sidebar_td').innerHTML = '';
756		}
757	}
758	catch(err){}
759	if($('pager')){
760		$('pager').hide();
761	}
762	if($('g_control')) {
763		$('g_control').hide();
764	}
765	if($('g_box')) {
766		$('g_box').style.height = '300px';
767	}
768	if($('g_pic')) {
769		$('g_pic').style.width = '595px';
770	}
771	//REMOVE NOPRINT ELEMENTS
772	try {
773		$$('.noPrint').invoke('remove');
774	}
775	catch(err){}
776
777	//REMOVE CUFON STUFF
778	try {
779		$$('cufon.cufon-canvas').each(function(element) {
780			// parent element
781			var parent = element.up();
782			// element content
783			var content = element.down('cufontext').innerHTML;
784			// if not found try to get it from element's ALT tag
785			if (!content) content = element.readAttribute('alt');
786			// if we still have no content we leave the whole thing alone
787			if (!content) return false;
788			// remove the original element and update parent
789			element.remove();
790			parent.update(content);
791		});
792	}
793	catch(err){}
794
795	window.focus();
796}
797
798function printPage() {
799	$('print_footer').hide();
800	window.print();
801	window.close();
802}
803
804function printDiv(divs,w,h) {
805	var ids = divs.split(',');
806	if(!w) {
807		w = 660;
808	}
809	if(!h) {
810		h = 842;
811		h = 700;
812	}
813	printerData = '';
814	for(var i=0;i<ids.length;i++) {
815		var div = $('#' + ids[i]);
816		if (div.length > 0) printerData += div[0].innerHTML;
817	}
818	console.log(printerData);
819	var WindowObject = window.open('/ajax/' + lang + '/tdmit-index/www/?page=Cms_IndexPage&event=print','printer','width='+w+',height='+h+',scrollbars=1');
820	WindowObject.focus();
821}
822
823function submitFreesearch(formid,textid,ignore) {
824	if($(formid)) {
825		var txt = $(textid).value;
826		if(txt!='' && txt!=ignore) {
827			$(formid).submit();
828		}
829		else {
830			$(textid).value='';
831			$(textid).focus();
832		}
833	}
834}
835
836/*! sprintf.js | Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro> | 3 clause BSD license */
837
838(function(ctx) {
839	var sprintf = function() {
840		if (!sprintf.cache.hasOwnProperty(arguments[0])) {
841			sprintf.cache[arguments[0]] = sprintf.parse(arguments[0]);
842		}
843		return sprintf.format.call(null, sprintf.cache[arguments[0]], arguments);
844	};
845
846	sprintf.format = function(parse_tree, argv) {
847		var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
848		for (i = 0; i < tree_length; i++) {
849			node_type = get_type(parse_tree[i]);
850			if (node_type === 'string') {
851				output.push(parse_tree[i]);
852			}
853			else if (node_type === 'array') {
854				match = parse_tree[i]; // convenience purposes only
855				if (match[2]) { // keyword argument
856					arg = argv[cursor];
857					for (k = 0; k < match[2].length; k++) {
858						if (!arg.hasOwnProperty(match[2][k])) {
859							throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
860						}
861						arg = arg[match[2][k]];
862					}
863				}
864				else if (match[1]) { // positional argument (explicit)
865					arg = argv[match[1]];
866				}
867				else { // positional argument (implicit)
868					arg = argv[cursor++];
869				}
870
871				if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
872					throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
873				}
874				switch (match[8]) {
875					case 'b': arg = arg.toString(2); break;
876					case 'c': arg = String.fromCharCode(arg); break;
877					case 'd': arg = parseInt(arg, 10); break;
878					case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
879					case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
880					case 'o': arg = arg.toString(8); break;
881					case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
882					case 'u': arg = arg >>> 0; break;
883					case 'x': arg = arg.toString(16); break;
884					case 'X': arg = arg.toString(16).toUpperCase(); break;
885				}
886				arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
887				pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
888				pad_length = match[6] - String(arg).length;
889				pad = match[6] ? str_repeat(pad_character, pad_length) : '';
890				output.push(match[5] ? arg + pad : pad + arg);
891			}
892		}
893		return output.join('');
894	};
895
896	sprintf.cache = {};
897
898	sprintf.parse = function(fmt) {
899		var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
900		while (_fmt) {
901			if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
902				parse_tree.push(match[0]);
903			}
904			else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
905				parse_tree.push('%');
906			}
907			else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
908				if (match[2]) {
909					arg_names |= 1;
910					var field_list = [], replacement_field = match[2], field_match = [];
911					if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
912						field_list.push(field_match[1]);
913						while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
914							if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
915								field_list.push(field_match[1]);
916							}
917							else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
918								field_list.push(field_match[1]);
919							}
920							else {
921								throw('[sprintf] huh?');
922							}
923						}
924					}
925					else {
926						throw('[sprintf] huh?');
927					}
928					match[2] = field_list;
929				}
930				else {
931					arg_names |= 2;
932				}
933				if (arg_names === 3) {
934					throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
935				}
936				parse_tree.push(match);
937			}
938			else {
939				throw('[sprintf] huh?');
940			}
941			_fmt = _fmt.substring(match[0].length);
942		}
943		return parse_tree;
944	};
945
946	var vsprintf = function(fmt, argv, _argv) {
947		_argv = argv.slice(0);
948		_argv.splice(0, 0, fmt);
949		return sprintf.apply(null, _argv);
950	};
951
952	/**
953	 * helpers
954	 */
955	function get_type(variable) {
956		return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
957	}
958
959	function str_repeat(input, multiplier) {
960		for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
961		return output.join('');
962	}
963
964	/**
965	 * export to either browser or node.js
966	 */
967	ctx.sprintf = sprintf;
968	ctx.vsprintf = vsprintf;
969})(typeof exports != "undefined" ? exports : window);
970
971
972var Cookie = {
973  data: {},
974  options: {expires: 1, domain: "", path: "/", secure: false},
975
976    init: function(options, data) {
977    
978        Cookie.options = $.extend(Cookie.options, options || {});
979
980        var payload = Cookie.retrieve();
981        if(payload) {
982            Cookie.data = JSON.parse(payload);
983//            Cookie.data = payload.evalJSON();
984        }
985        else {
986            Cookie.data = data || {};
987        }
988        Cookie.store();
989    },
990    getData: function(key) {
991        return Cookie.data[key];
992    },
993    setData: function(key, value) {
994        Cookie.data[key] = value;
995        Cookie.store();
996    },
997    removeData: function(key) {
998        delete Cookie.data[key];
999        Cookie.store();
1000    },
1001    retrieve: function() {
1002        var start = document.cookie.indexOf(Cookie.options.name + "=");
1003
1004        if(start == -1) {
1005            return null;
1006        }
1007        if(Cookie.options.name != document.cookie.substr(start, Cookie.options.name.length)) {
1008            return null;
1009        }
1010
1011        var len = start + Cookie.options.name.length + 1;   
1012        var end = document.cookie.indexOf(';', len);
1013
1014        if(end == -1) {
1015            end = document.cookie.length;
1016        } 
1017        return unescape(document.cookie.substring(len, end));
1018    },
1019    store: function() {
1020        var expires = '';
1021
1022        if (Cookie.options.expires) {
1023            var today = new Date();
1024            expires = Cookie.options.expires * 86400000;
1025            expires = ';expires=' + new Date(today.getTime() + expires);
1026        }
1027
1028        document.cookie = Cookie.options.name + '=' + escape(JSON.stringify(Cookie.data)) + Cookie.getOptions() + expires;
1029    },
1030    erase: function() {
1031        document.cookie = Cookie.options.name + '=' + Cookie.getOptions() + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
1032    },
1033    getOptions: function() {
1034        return (Cookie.options.path ? ';path=' + Cookie.options.path : '') + (Cookie.options.domain ? ';domain=' + Cookie.options.domain : '') + (Cookie.options.secure ? ';secure' : '');      
1035    }
1036};
1037
1038
1039
1040
1041

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.