PageSourceSearch

https://www.trasa.info/wyznaczanie-trasy--

html trasa.info collected 2026-09-25 01:02:18 UTC 103,625 bytes, 2,338 lines download raw bytes

1<!DOCTYPE HTML>
2<html>
3<head>
4	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	<title> Wyznaczanie trasy &bull; Kalkulator odległości &bull; Dojazd mapa  </title>
5        <meta name="viewport" content="width=device-width, initial-scale=1">
6        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
7                        <link href="/favicon.ico" type="image/x-icon" rel="icon"/><link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/><link rel="stylesheet" type="text/css" href="/css/trasa.css"/><link rel="stylesheet" type="text/css" href="/css/styles.css"/><link rel="stylesheet" type="text/css" href="/js/jnice/jNice.css"/><link rel="stylesheet" type="text/css" href="/js/fancybox/jquery.fancybox-1.3.4.css"/><link rel="stylesheet" type="text/css" href="/css/nsf.css"/>
7<script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
7<script type="text/javascript" src="/js/html5shiv.js" async="async"></script>
7<script type="text/javascript" src="/js/jnice/jquery.jNice.js" async="async"></script>
7<script type="text/javascript" src="/js/slider/slides.jquery.js" async="async"></script>
7<script type="text/javascript" src="/js/jquery-ui-1.8.23.custom.min.js" async="async"></script>
7<script type="text/javascript" src="/js/fancybox/jquery.fancybox-1.3.4.pack.js" async="async"></script>
7<script type="text/javascript" src="/js/geolocator.min.js" async="async"></script>
7<script type="text/javascript" src="/js/tabs.js" async="async"></script>
7	<!-- Enable media queries for old IE -->
8        <!--[if lt IE 9]>
9           
9<script src="https://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
9
10        <![endif]-->
11		
12        <meta name="google-site-verification" content="diUnXFFujFMME3PiWl0vFrFDc3i6KtUYc73SBpmgjl4" />
13            
14        
15        
15<script src="https://fundingchoicesmessages.google.com/i/5443650?ers=3"></script>
15    
16        
16<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3601652009468055" crossorigin="anonymous"></script>
16
17        
17<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
17
18        
18<script async src="https://a.spolecznosci.net/core/dfdf26a08edce97da48eaf67b1c53620/main.js"></script>
18
19        
19<script src="/js/adsGAM.js?v=1"></script>
19
20
21    
22
23	
24
25
26    
27
28<!-- Global site tag (gtag.js) - Google Analytics -->
vendor: 64 bytes, lines 28-29
28
29<script async src="https://www.googletagmanager.com/gtag/js?id=
29UA-3373875-78
vendor: 12 bytes, line 29
29"></script>
30<script>
31  
vendor: 134 bytes, lines 31-35
31window.dataLayer = window.dataLayer || [];
32  function gtag(){dataLayer.push(arguments);}
33  gtag('js', new Date());
34
35  gtag('config', '
35UA-3373875-78
vendor: 4 bytes, line 35
35');
36</script>
36
37
38<!-- Google tag (gtag.js) -->
vendor: 64 bytes, lines 38-39
38
39<script async src="https://www.googletagmanager.com/gtag/js?id=
39G-123X1NXDTC
vendor: 12 bytes, line 39
39"></script>
40<script>
41  
vendor: 134 bytes, lines 41-45
41window.dataLayer = window.dataLayer || [];
42  function gtag(){dataLayer.push(arguments);}
43  gtag('js', new Date());
44
45  gtag('config', '
45G-123X1NXDTC
vendor: 4 bytes, line 45
45');
46</script>
46
47    <link rel='manifest' href='/manifest.json'>
47<script charset='UTF-8' src='https://app.push-ad.com/?run=api/integration/fc0729ab1b3741296cf8a29bf3a573822e64fd0e9c56b03d29c870f857894a05.js' async></script>
47
48
49<style type="text/css">
50  .vj-fixed-mobile.pos-br {
51     top: auto!important;
52     bottom: 0;
53     right: 0;
54  }
55</style>
56
57</head>
58<body>
59		    
60
61
62
63	
64    
65
66<style>
67.cookemessage{
68	cursor:pointer;
69	position:fixed;
70	width:100%;
71        /*height: 50px;*/
72	margin:0 auto;
73	font-family:arial;
74	font-size:12px;
75        bottom: 0;
76        z-index: 1000000;
77        color: #ffffff;
78}
79.cookemessage:hover{
80	color: #ffffff;
81}
82.cookemessage a{
83	text-decoration:underline;
84	color: #ffffff;
85}
86.cookemessage:hover a{
87	color: #ffffff;
88}
89.cookemessagecloseico {
90	background: transparent url('/img/close2.png') 0px 0px no-repeat; 
91	width:	102px;
92	height:	36px;
93	position: absolute;
94	right:	5px
95}
96.cookemessagecloseico:hover{
97
98}
99.opacityholder {
100    position: relative;
101}
102.opacitybox {
103    position: absolute;
104    background: black;
105    width: 100%;
106    height: 100%;
107    opacity: 0.8;
108    filter: alpha(opacity = 80);
109}
110.cookemessagetext {
111    position: relative;
112    width: auto;
113    margin: 10px 117px 0 5px;
114    text-align: left;
115    padding: 15px 0;
116    overflow:hidden;
117}
118.cookemessagetext .bold {
119    font-weight: bold;
120}
121@media all and (max-width: 494px) {
122    .cookemessagecloseico {
123	top: 25px;
124    }
125}
126@media all and (min-width: 495px) and (max-width: 861px) {
127    .cookemessagecloseico {
128	top: 20px;
129    }
130}
131@media all and (min-width: 862px) {
132    .cookemessagecloseico {
133	top: 14px;
134    }
135}
136</style>
137<div id="cookemessagehandler" class="cookemessage">
138        <div id="opacityholder">
139            <div class="opacitybox"></div>
140            <div class="cookemessagetext">
141                <span>Na stronie używamy cookies. Korzystanie z witryny oznacza zgodę na ich wykorzystywanie.</span>
142                                <span>Szczegóły znajdziesz w</span> <a href="/strona/polityka-prywatnosci">Polityce Prywatności.</a>
143                            </div>
144            <div class="cookemessagecloseico"></div>
145        </div>
146</div>
147<script>
148	document.getElementById("cookemessagehandler").onclick = function(){
149		this.parentNode.removeChild(this);
150                var expiredate = new Date();
151                expiredate.setDate(expiredate.getDate() + 365);
152                document.cookie="CakeCookie[cookiemessage]=disable; path=/; expires=" + expiredate.toUTCString();
153	};
154</script>
154
155
156    <div id="container">
157        
158	<div id="header">
159	    <div id="logo-box">
160		<div id="logo">
161					    	<a href="/">Trasa.info</a>		    		</div>
162	    </div>
163            
164            <nav id="menu">
165				<a class="toggle-nav" href="#"></a>
166				<a class="toggle-search" href="#"></a>
167				
168                <ul id="menu-links" class="active-menu" style="z-index: 2147483647">
169                    <li>
170                        <a href="/mapa--" class="">Mapa</a>                        <span class="separator">&bull;</span>
171                    </li>
172                    <li>
173                        <a href="/wyznaczanie-trasy--" class="active">Wyznaczanie trasy</a>                        <span class="separator">&bull;</span>
174                    </li>
175                    <li>
176                        <a href="/lotniska" class="">Lotniska</a>                        <span class="separator">&bull;</span>
177                    </li>
178                    <li>
179                        <a href="/przewodnik" class="">Przewodnik</a>                    <!--
180                    <span class="separator">&bull;</span>
181                                        <span class="separator">&bull;</span>
182                                        <span class="separator">&bull;</span>
183                                        <span class="separator">&bull;</span>
184                                        -->
185                    </li>
186                </ul>
187                
188                
189                
190                
190<script type="text/javascript">
191                    $(document).ready(function() {
192                        $('.toggle-nav').click(function(e) {
193                            $(this).toggleClass('active-menu');
194                            $('#menu ul').toggleClass('active-menu');
195							
196							$('.toggle-search').removeClass('active-search');
197							$('#search-box').removeClass('active-search');
198
199                            e.preventDefault();
200                        });
201						
202						$('.toggle-search').click(function(e) {
203                            $(this).toggleClass('active-search');
204                            $('#search-box').toggleClass('active-search');
205							
206							$('.toggle-nav').addClass('active-menu');
207							$('#menu ul').addClass('active-menu');
208
209                            e.preventDefault();
210                        });
211                        
212                        var searchEl = $("#Phrase");
213                        var labelEl = $("#search-label");
214                        labelEl.live("click",function(){
215                            if(searchEl.hasClass("focus")) {
216                                searchEl.removeClass("focus");
217                                labelEl.removeClass("active");
218                            } else {
219                                searchEl.addClass("focus");
220                                labelEl.addClass("active");
221                            }
222                        });
223                        $(document).live("click",function(e){
224                            var clickedID = e.target.id;
225                            if(clickedID != "search-label" && clickedID != "Phrase") {
226                                if(searchEl.hasClass("focus")) {
227                                    searchEl.removeClass("focus");
228                                    labelEl.removeClass("active");
229                                }
230                            }
231                        });
232                        
233                        $('#Phrase').live('click', function() {
234                            if($(this).val()==='Wyszukaj w serwisie') {
235                                $(this).val('');
236                            }
237                        });
238                        $('#Phrase').live('blur', function() {
239                            if($(this).val()===''){
240                                $(this).val('Wyszukaj w serwisie');
241                            }
242                        });
243                    });
244                    
245                </script>
245
246                <div id="search-box">
247                    <form action="/searchable/search_indexes" id="SearchIndexIndexForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div>                    <label for="Phrase" id="search-label"></label><input name="data[SearchIndex][term]" value="" placeholder="Wyszukaj" id="Phrase" type="text"/>                    <div class="submit"><input type="submit" value=""/></div></form>					<div style="clear: both;"></div>
248				</div>
249                
250                
251            </nav>
252	</div>
253    
254	<!--[if gte IE 9]>
255	  <style type="text/css">
256	    nav#menu {
257	       filter: none;
258	    }
259	    div#menu-links a {
260		filter: none;
261	    }
262	  </style>
263	<![endif]-->
264	<div id="masseges">
265	    	</div>
266	<div id="c-billboard">
267		                <div id='slot_top' style="text-align: center;min-height: 300px;margin: 15px auto;display: flex;align-items: center;justify-content: center;">
268  
268<script>
269    googletag.cmd.push(function() { googletag.display('slot_top'); });
270  </script>
270
271</div>	</div>
272    
273
274<div style="width: 100%;max-width: 1178px;margin: 0 auto;padding: 0 7px;background-color: #fff;margin-bottom:-15px;">
275<div id="remote-info-21" style="min-height: 44px;margin-bottom:15px;"></div>
276<script src="https://netstel.pl/info/21.js?ts=1790298138" async="async"></script>
276
277</div>
278
279
280	<div id="content">
281			
282            
283<script src="https://api.tomtom.com/maps-sdk-for-web/cdn/6.x/6.13.0/services/services-web.min.js"></script>
283
284<link rel='stylesheet' type='text/css' href='https://mapa.info/maps/maplibre-gl.min.css'/>
285<script src="https://mapa.info/maps/maplibre-gl.min.js"></script>
vendor: 1 bytes, line 285
285
286<script src="https://mapa.info/directions/routings.min.js"></script>
286
287
288
289<style type="text/css">
290    div#airports-search input[type="text"], div#maps-search input[type="text"] {width: 225px}
291
292    #leaflet_map {height: 400px !important; width:660px !important; display:none; z-index:0;margin:0 auto; float:none}
293    #google_map {height: 400px !important; width:660px !important; margin:0 auto; float:none}
294    #sticky_side_links {z-index:1000 !important;left:100px !important}
295    @media all and (max-width: 690px) {
296        #leaflet_map {width:100% !important; height:300px !important}
297        #google_map {width:100% !important; height:300px !important}
298        #sticky_side_links {z-index:1000 !important;left:8px !important}
299    }
300
301    .tt-icon.-start {display:block;width:30px;height:30px;background:url('/tomtom/sdk/../img/start.png') no-repeat left top}
302    .tt-icon.-finish {display:block;width:30px;height:30px;background:url('/tomtom/sdk/../img/end.png') no-repeat left top}
303    .tt-icon.-waypoint {display:block;width:30px;height:30px;background:url('/tomtom/sdk/../img/waypoint.png') no-repeat left top}
304    .tt-icon.-petrol-station {display:block;width:30px;height:30px;background:url('/img/stacje.png') no-repeat left top;background-size:contain;
305	margin-left: -20px;
306	margin-top: -60px;
307	width: 40px;
308	height: 60px;
309	transform: translate3d(396px, 192px, 0px);
310	z-index: 192;
311	outline: currentcolor none medium;
312    }
313
314    div#map {position:relative}
315    div.search-on-map {z-index:1000 !important;position:absolute;right:0;top:0;width:340px}
316    div.search-on-map #maps-search form {width:340px !important;right:0 !important}
317
318    .icon_rondo {background:url('/img/rondo.png') no-repeat left top}
319    .icon_turn_left {background:url('/img/turn_left.png') no-repeat left top}
320    .icon_turn_right {background:url('/img/turn_right.png') no-repeat left top}
321    .icon_turn_left_soft {background:url('/img/turn_left_soft.png') no-repeat left top}
322    .icon_turn_right_soft {background:url('/img/turn_right_soft.png') no-repeat left top}
323    .icon_zjedz {background:url('/img/zjedz.png') no-repeat left top}
324
325
326    .popup-yellow {color:#000;font-weight:bold}
327    .popup-yellow .maplibregl-popup-tip {border-top-color:#ffba00;border-bottom-color:#ffba00}
328    .popup-yellow .maplibregl-popup-content {background:#ffba00;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3), 0 6px 20px 0 rgba(0, 0, 0, 0.29);border-radius:8px}
329    .popup-yellow .maplibregl-popup-content a {color:#000;font-size:14px}
330    .popup-yellow .maplibregl-popup-close-button {font-weight:600;background:#000 !important;color:#fff !important;border-radius:20px !important;right:-10px !important;top:-10px !important;width:25px !important;height:25px !important;padding:0 2px 0 1px !important}
331
332    .popup-green {color:#fff;font-weight:bold}
333    .popup-green .maplibregl-popup-tip {border-top-color:#29a56a;border-bottom-color:#29a56a}
334    .popup-green .maplibregl-popup-content {background:#29a56a;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.3), 0 6px 20px 0 rgba(0, 0, 0, 0.29);border-radius:8px}
335    .popup-green .maplibregl-popup-content a {color:#fff;font-size:14px}
336    .popup-green .maplibregl-popup-close-button {font-weight:600;background:#fff !important;color:#29a56a !important;border-radius:20px !important;right:-10px !important;top:-10px !important;width:25px !important;height:25px !important;padding:0 2px 0 1px !important}
337
338    #sticky_side_links {z-index:1000 !important}
339    #search_map_button {position:absolute !important;right:110px !important}
340}
341</style>
342<script type="text/javascript">
343    var current_lonlat = [18.7, 52.4];
344    var markers = [];
345    var lmap = null;
346    var tomtom_map = null;
347    var mapType = 0;
348    var zoom = 6;
349    var routes_info = [];
350    var all_markers_latlng = [];
351    var counter = 0;
352    var stacje_paliw = [[], [], []];
353    var wyapoints_counter_desktop = 0;
354    var wyapoints_counter_mobile = 0;
355    var waypts = [];
356    var geojson = null;
357
358		var markerHeight = 25, markerRadius = 10, linearOffset = 25;
359		var popupOffsets = {
360		 'top': [0, 0],
361		  'top-left': [0,0],
362		  'top-right': [0,0],
363		  'bottom': [0, -markerHeight],
364		  'bottom-left': [linearOffset, (markerHeight - markerRadius + linearOffset) * -1],
365		  'bottom-right': [-linearOffset, (markerHeight - markerRadius + linearOffset) * -1],
366		  'left': [markerRadius, (markerHeight - markerRadius) * -1],
367		  'right': [-markerRadius, (markerHeight - markerRadius) * -1]
368		};
369
370
371function clearTomTomMap() {
372    if (routes_layer) {
373	routes_layer.remove();
374	routes_layer = null;
375    }
376    if (start_marker) {
377	start_marker.remove();
378	start_marker = null;
379    }
380    if (start_marker_popup) {
381	start_marker_popup.remove();
382	start_marker_popup = null;
383    }
384    if (end_marker) {
385	end_marker.remove();
386	end_marker = null;
387    }
388    if (end_marker_popup) {
389	end_marker_popup.remove();
390	end_marker_popup = null;
391    }
392}
393
394function gen_slug(str) {
395    str = str.replace(/^\s+|\s+$/g, ''); // trim
396    str = str.toLowerCase();
397
398    // remove accents, swap ñ for n, etc
399    var from = "ąćęłńóśźżĄĆĘŁŃÓŚŹŻÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a·/_,:;";
400    var to   = "acelnoszzACELNOSZZAAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa------";
401    for (var i=0, l=from.length ; i<l ; i++) {
402	str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
403    }
404
405    str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
406	.replace(/\s+/g, '-') // collapse whitespace and replace by -
407	.replace(/-+/g, '-'); // collapse dashes
408
409    return str;
410};
411
412          function caclCost(_distance){
413                // _distance [km]
414              _distance = (_distance + "").replace(",", ".");
415
416              // Elementy:
417              var eCombustion = document.getElementById('DirectionAverageFuel');
418              var eFuelCost = document.getElementById('DirectionFuelCost');
419              var eDistance = document.getElementById('DirectionDistance');
420              var eCost = document.getElementById('DirectionCosts');
421
422                          if(eDistance != null){
423                      // Zmienne:
424                      var fuelCost = eFuelCost.value.replace(",", ".");// [zł/l]
425                      var combustion = eCombustion.value.replace(",", ".");// [l/100km]
426
427                      if(fuelCost == ""){
428                        fuelCost = 5;
429                        eFuelCost.value = "5";
430                      }
431                      if(combustion == ""){
432                        combustion = 7;
433                        eCombustion.value = "7";
434                      }
435
436
437                      // Akcje:
438                      eDistance.value = _distance;
439                      eCost.value = (parseFloat('' + (_distance * fuelCost * combustion / 100))).toFixed(2);
440                          }
441          }
442
443
444function addDesktopMidpointsRow(values) {
445	    if (!values) {
446		values = ['', '', ''];
447	    }
448	    $elements = $('.mid_points_desktop');
449	    for (var i = 0; i < 3; i++) {
450    		wyapoints_counter_desktop++;
451		var tabindex = wyapoints_counter_desktop + 3;
452    		$($elements[i]).append(
453		    '<span class="label" style="margin-top:20px">Miejsce pośrednie ' + wyapoints_counter_desktop + ':</span>' + 
454		    '<input type="text" name="desktop-text-midpoint-' + wyapoints_counter_desktop + '" id="desktop-text-midpoint-' + wyapoints_counter_desktop + '" class="through desktop-text-midpoint-' + wyapoints_counter_desktop + '" value="' + values[i] + '" tabindex="' + tabindex + '" placeholder="Wpisz lokalizację pośrednią" onfocus="this.placeholder = \'\'" onblur
454="this.placeholder = \'Wpisz lokalizację pośrednią\'" />'
455		);
456	    }
457}
458
459
460function addMobileMidpointsRow(values) {
461	    if (!values) {
462		values = ['', '', ''];
463	    }
464	    $elements = $('.mid_points_mobile');
465	    for (var i = 0; i < 3; i++) {
466    		wyapoints_counter_mobile++;
467    		$($elements[0]).append(
468		    '<span class="label" style="margin-top:20px">Miejsce pośrednie ' + wyapoints_counter_mobile + ':</span>' + 
469		    '<input type="text" name="mobile-text-midpoint-' + wyapoints_counter_mobile + '" id="mobile-text-midpoint-' + wyapoints_counter_mobile + '" class="through mobile-text-midpoint-' + wyapoints_counter_mobile + '" value="' + values[i] + '" placeholder="Wpisz lokalizację pośrednią" />'
470		);
471	    }
472}
473
474function show_markers(id, checked) {
475		        
476    if(!checked){
477	for(var i=0; i<markers[id].length; i++){
478	    markers[id][i].remove();
479	}
480	markers[id] = [];
481    }else{
482	for (var i = 0; i < coords[id][1].length; i++) {
483	    
484	    var lon = parseFloat(coords[id][1][i][0]);
485	    var lat = parseFloat(coords[id][1][i][1]);
486	    if (isNaN(lon) || isNaN(lat)) {
487		continue;
488	    }
489	    var name = coords[id][0] + ": " + coords[id][1][i][2];
490	    var marker = new maplibregl.Marker({ element: createMarkerElement('petrol-station') }).setLngLat([lon, lat]).addTo(tomtom_map);
491	    markers[id].push(marker);
492	}
493    }
494}
495
496
497    $(document).ready(function() {
498		$('#DirectionRoutingForm').on( "submit", function( event ) {
499        		event.preventDefault();
500			for (var i = 0; i < markers.length; i++) {
501				lmap.removeLayer(markers[i])
502			}
503			markers = [];
504			calcRoute();
505		});
506
507
508        $(document).on('click', '#alternatives .osm.alternative-route', function(evt) {
509		$('#speed-cases').empty();
510		$('.aDistance').val((parseFloat($(this).find('#journey-width').text().replace(' km', ''))).toFixed(2));
511		$('.aTime').text($(this).find('#journey-time').text());
512		var distance = $('.aDistance').text();
513		var speeds=['40','60','80','100','120','140'];
514		$.each(speeds,function(i,e){
515		    var hours = distance / e;
516		    hours = parseInt(hours);
517		    var minutes = (distance/e-parseInt(distance/e))*60;
518		    minutes = parseInt(minutes);
519		    $('#speed-cases').append('<li>'+e+'km/h - <strong>'+hours+' h '+minutes+' min</strong></li>');
520		})
521
522	    routeIndex = parseInt($(this).attr('feature_index'));
523	    $(this).parent().children().removeClass('active');
524	    $(this).addClass('active');
525	    if (tomtom_map) {
526		redrawTomTomRoutes(geojson, routeIndex);
527	    }
528        });
529
530	$(document).on('mouseover', '.tabela_tras .osm.alternative-route', function(evt) {
531	});
532	$(document).on('mouseout', '#alternatives span', function(evt) {
533	});
534
535	if (typeof(infoBoxInit) == 'function') {
536	    infoBoxInit();
537	}
538
539        $(document).on("change", 'input[type="text"]', function(){
540            if(document.getElementById('DirectionDistance') != null){
541                caclCost(document.getElementById('DirectionDistance').value);
542            }
543        });
544        $(document).on("click", '#journey-costs input[type="submit"]', function(ev){
545            ev.stopPropagation();
546            ev.preventDefault();
547            caclCost(document.getElementById('DirectionDistance').value);
548        });
549
550        $('#MapHomeForm').on('submit', function (ev) {
551            ev.stopPropagation();
552            ev.preventDefault();
553            searchGeo($('#MapSearchMap').val());
554        });
555
556	$('.poi').on('change', 'input', function(event) {
557	    event.preventDefault();
558
559	    $(this).find('.points').removeClass('active');
560	    show_markers($(this).val(), this.checked);
561	    if (this.checked) {
562		$(this).closest('.points').addClass( "active" );
563	    }
564
565	});
566
567	if (typeof(is_post) != "undefined" && is_post) {
568	    for (var i = 0; i < coords.length; i++) {
569		markers[i] = [];
570		$('.poi').append('<span class="points"><label><input type="checkbox" name="stations" value="'+i+'"> '+coords[i][0]+'</label></span>');
571	    }
572	}
573
574        $('form .tc .adv').on('click', function (ev) {
575            $('#searchForm .more').show();
576            $(this).hide();
577        });
578
579	if ($('#DirectionDriveFrom').val() != '' && $('#DirectionDriveTo').val() != '') {
580	    calcRoute(false);
581	    return;
582	}
583        if ($('#placePlace').val() != '') {
584            searchGeo($('#placePlace').val());
585            return;
586        }
587    });
588
589
590const stringifyJSON = data => {
591  if (data === undefined)
592    return undefined
593  else if (data === null)
594    return 'null'
595  else if (data.constructor === String)
596    return '"' + data.replace(/"/g, '\\"') + '"'
597  else if (data.constructor === Number)
598    return String(data)
599  else if (data.constructor === Boolean)
600    return data ? 'true' : 'false'
601  else if (data.constructor === Array)
602    return '[ ' + data.reduce((acc, v) => {
603      if (v === undefined)
604        return [...acc, 'null']
605      else
606        return [...acc, stringifyJSON(v)]
607    }, []).join(', ') + ' ]'
608  else if (data.constructor === Object)
609    return '{ ' + Object.keys(data).reduce((acc, k) => {
610      if (data[k] === undefined)
611        return acc
612      else
613        return [...acc, stringifyJSON(k) + ':' + stringifyJSON(data[k])]
614    }, []).join(', ') + ' }'
615  else
616    return '{}'
617}
618
619function codeAddress(place, zoom, disable_marker) {
620    //console.log('codeAddress', place);
621    $.ajax({
622        url: '/search/?q=' + encodeURIComponent(place) + '&format=json&addressdetails=1&limit=1',
623        success: function( place_data ) {
624	    if (place_data.length > 0) {
625		$('#sticky_side_links').hide();
626
627		//console.log('place_data', place_data);
628		
629		for (var i = 0; i < markers.length; i++) {
630		    lmap.removeLayer(markers[i])
631		}
632		if (typeof(disable_marker) == 'undefined' || disable_marker != 'disable') {
633		    var point = [place_data[0].lon, place_data[0].lat];
634            	    var marker = new maplibregl.Marker({ element: createMarkerElement('waypoint') }).setLngLat(point).addTo(tomtom_map);
635		    markers.push(marker);
636		    var popup = new maplibregl.Popup({offset: popupOffsets, className: 'popup-yellow'}).setHTML("<strong>" + place + "</strong><br /><a href=\"https://www.booking.com/searchresults.pl.html?dest_type=city&ss=" + encodeURI(place) + ";aid=1484610\">Zarezerwuj hotel</a>");
637		    marker.setPopup(popup).togglePopup();
638		}
639
640		if (typeof(zoom) != 'undefined') {
641		    //console.log('zoom', zoom);
642		    lmap.setView([place_data[0].lat, place_data[0].lon], zoom);
643		} else {
644		    lmap.setView([place_data[0].lat, place_data[0].lon]);
645		}
646	    }
647	},
648    	error: function(xhr, status, error) {
649            console.log(xhr.responseText);
650    	}
651    });
652}
653
654function customFormatTime(seconds) {
655    var h = Math.floor(seconds / 3600);
656    var m = Math.floor((seconds - h*3600)/60);
657    //date = (new Date).clearTime().addSeconds(seconds).toString('H g. mm') + ' min';
658    date = '' + h + ' h ' + m + ' min';
659    return date;
660}
661
662function degreesToRadians(degrees) {
663  return degrees * Math.PI / 180;
664}
665
666function distanceInKmBetweenEarthCoordinates(lat1, lon1, lat2, lon2) {
667  var earthRadiusKm = 6371;
668
669  var dLat = degreesToRadians(lat2-lat1);
670  var dLon = degreesToRadians(lon2-lon1);
671
672  lat1 = degreesToRadians(lat1);
673  lat2 = degreesToRadians(lat2);
674
675  var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
676          Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); 
677  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
678  return earthRadiusKm * c;
679}
680
681
682function in_array(arr, elem) {
683    for (var i = 0; i < arr.length; i++) {
684	if (arr[i] == elem) {
685	    return true;
686	}
687    }
688    return false;
689}
690
691var indices_combinations = [];
692function get_cities_strings(cities_list) {
693    // number of arrays 
694    var n = cities_list.length; 
695  
696    // to keep track of next element in each of the n arrays 
697    var indices = []; 
698  
699    // initialize with first element's index 
700    for (var i = 0; i < n; i++) {
701        indices[i] = 0; 
702    }
703
704    while (1) {
705        // print current combination
706	var result = [];
707        for (var i = 0; i < n; i++) {
708            result.push(cities_list[i].index[indices[i]]);
709	}
710	indices_combinations.push(result);
711  
712        // find the rightmost array that has more 
713        // elements left after the current element  
714        // in that array 
715        var next = n - 1; 
716        while (next >= 0 && (indices[next] + 1 >= cities_list[next].index.length)) 
717            next--; 
718  
719        // no such array is found so no more  
720        // combinations left 
721        if (next < 0) 
722            return; 
723  
724        // if found move to next element in that  
725        // array 
726        indices[next]++; 
727  
728        // for all arrays to the right of this  
729        // array current index again points to  
730        // first element 
731        for (var i = next + 1; i < n; i++) 
732            indices[i] = 0; 
733    } 
734}
735
736function addAlternatives(rt_info) {
737    if (typeof(rt_info) == 'object') {
738	$('#alternatives').empty();
739	var last_route_coords = rt_info[rt_info.length-1].route_coords;
740	var lineLength = distanceInKmBetweenEarthCoordinates(rt_info[0].route_coords[0][0], rt_info[0].route_coords[0][1],
741						last_route_coords[last_route_coords.length-1][0], last_route_coords[last_route_coords.length-1][1]).toFixed(2);
742
743	// konstruujemy drzewo dojazdu łącząc wszystki epunkty pośrednie w 1 całościowy
744	var cities_list = [];
745	var i = 0;
746	for (i = 0; i < rt_info.length; i++) {
747	    if (cities_list.length == 0 || cities_list[cities_list.length-1].city != rt_info[i].start_address) {
748		var o = {city: rt_info[i].start_address, index: [i]}
749		cities_list.push(o);
750	    } else if (cities_list[cities_list.length-1].city == rt_info[i].start_address) {
751		cities_list[cities_list.length-1].index.push(i);
752	    }
753	}
754	//cities_list.push({city: rt_info[i-1].end_address, index: [i]});
755	//console.log(cities_list);
756	
757	indices_combinations = [];
758	get_cities_strings(cities_list);
759	//console.log(indices_combinations);
760
761
762	for (var i = 0; i < indices_combinations.length; i++) {
763	    var first = indices_combinations[i][0];
764	    var last = indices_combinations[i][indices_combinations[i].length-1];
765	    var distance = 0;
766	    var duration = 0;
767	    var indexes_string = '';
768	    //console.log('indices_combinations[i]',indices_combinations[i]);
769	    for (var j = 0; j < indices_combinations[i].length; j++) {
770		var idx = indices_combinations[i][j];
771		indexes_string += '' + idx;
772		if (j < indices_combinations[i].length-1) {
773		    indexes_string += ',';
774		}
775		distance += parseFloat(rt_info[idx].distance);
776		duration += parseFloat(rt_info[idx].duration);
777		//console.log('i',i,'j',j,'idx',idx,'rt_info[idx].distance',rt_info[idx].distance,'rt_info[idx].duration',rt_info[idx].duration,'first',first,'last',last,'duration',duration,'distance',distance);
778	    }
779	    $('#alternatives').append(
780                        '<li class="alt-' + i + ' alternative-route ' + (i == 0 ? 'active' : '') + ' osm" ' + 'indexes="' + indexes_string + '" feature_index="' + i + '">\n\
781                            <span class="rLeft"><span class="rImage"></span><span class="rNumber">Trasa ' + (i + 1) + '</span></span>\n\
782                            <span class="rRight">\n\
783                                <span class="rFirst">\n\
784                                    <span class="rRoute">' + rt_info[first].start_address + ' - ' + rt_info[last].end_address + '</span>\n\
785                                    <span class="rName">Trasa ' + (i + 1) + '</span>\n\
786                                </span>\n\
787                                <span class="rSecond">\n\
788                                    <span class="rDistance">Silniční vzdálenost: <span>' + (parseFloat(''+distance)).toFixed(2) + ' km</span></span>\n\
789                                    <span class="rDistanceL">Vzdálenost vzdušnou čarou: <span>' + lineLength + ' km</span></span>\n\
790                                    <span class="rTime">Čas cesty: <span>' + customFormatTime(duration) + '</span></span>\n\
791                                </span>\n\
792                            </span>\n\
793                        </li>');
794
795	}
796	$('#alternatives').show();
797    }
798}
799
800
801function getItemFromGeoResponse(name, geoResponse) {
802    for (var i = 0; i < geoResponse.length; i++) {
803	if (geoResponse[i].type == 'Geography' && typeof(geoResponse[i].entityType) != 'undefined' && geoResponse[i].entityType == 'Municipality') {
804	    var m1 = geoResponse[i].municipality.toLowerCase();
805	    var m2 = name.toLowerCase();
806	    if (m1 == m2 || gen_slug(m1) == gen_slug(m2)) {
807		return geoResponse[i];
808	    }
809	}
810    }
811    if (geoResponse.length > 0) {
812	return geoResponse[0];
813    }
814    return null;
815}
816
817
818
819
820
821var a_route_coords = [];
822var a_places = [];
823var endIcon = null;
824var startIcon = null;
825var startPoint, endPoint;
826var routes_layer = null;
827var routes_json = null;
828var start_marker = null;
829var end_marker = null;
830var start_marker_popup = null;
831var end_marker_popup = null;
832var colors = ['#00D7FF', '#FF0000', '#4AF046', '#000000', '#FF00D2', '#FFFF00'];
833
834function updateBounds(route_coords, viewport) {
835	    if (typeof(route_coords) == 'undefined' || route_coords.length < 2) {
836		return;
837	    }
838
839	    var len = route_coords.length;
840            bounds = new maplibregl.LngLatBounds();
841            bounds.extend(maplibregl.LngLat.convert([route_coords[0].lon, route_coords[0].lat]));
842            bounds.extend(maplibregl.LngLat.convert([route_coords[len-1].lon, route_coords[len-1].lat]));
843
844            if (viewport) {
845                bounds.extend(maplibregl.LngLat.convert(viewport.topLeftPoint));
846                bounds.extend(maplibregl.LngLat.convert(viewport.btmRightPoint));
847            }
848
849            if (!bounds.isEmpty()) {
850                tomtom_map.fitBounds(bounds, { duration: 0, padding: 50 });
851            }
852};
853
854function updateRoutesBounds(coordinates) {
855            bounds = new maplibregl.LngLatBounds();
856
857            coordinates.forEach(function(point) {
858                bounds.extend(maplibregl.LngLat.convert(point));
859            });
860
861            if (!bounds.isEmpty()) {
862                tomtom_map.fitBounds(bounds, { duration: 0, padding: 50 });
863            }
864};
865
866
867	function createMarkerElement(type) {
868            var element = document.createElement('div');
869            element.className = 'supporting-marker';
870
871            var innerElement = document.createElement('div');
872            innerElement.className = type !== 'supporting' ? 'tt-icon -white -' + type : 'supporting-circle';
873            element.appendChild(innerElement);
874
875            return element;
876        }
877
878        function addRouteMarkers(feature) {
879            if (start_marker) {
880                start_marker.remove();
881		start_marker = null;
882            }
883            if (end_marker) {
884                end_marker.remove();
885		end_marker = null;
886            }
887
888            var startPoint, endPoint;
889            if (feature.geometry.type === 'MultiLineString') {
890                startPoint = feature.geometry.coordinates[0][0]; //get first point from first line
891                endPoint = feature.geometry.coordinates.slice(-1)[0].slice(-1)[0]; //get last point from last line
892            } else {
893                startPoint = feature.geometry.coordinates[0];
894                endPoint = feature.geometry.coordinates.slice(-1)[0];
895            }
896
897	    var place_start = a_places[0];
898	    var place_end = a_places[1];
899
900
901            start_marker = new maplibregl.Marker({ element: createMarkerElement('start') }).setLngLat(startPoint).addTo(tomtom_map);
902            end_marker = new maplibregl.Marker({ element: createMarkerElement('finish') }).setLngLat(endPoint).addTo(tomtom_map);
903
904		var popup = new maplibregl.Popup({offset: popupOffsets, className: 'popup-yellow'}).setHTML("<strong>" + place_start + "</strong><br /><a href=\"https://www.booking.com/searchresults.pl.html?dest_type=city&ss=" + encodeURI(place_start) + ";aid=1484610\">Zarezerwuj hotel</a>");
905		start_marker.setPopup(popup).togglePopup();
906		var popup = new maplibregl.Popup({offset: popupOffsets, className: 'popup-green'}).setHTML("<strong>" + place_end + "</strong><br /><a href=\"https://www.booking.com/searchresults.pl.html?dest_type=city&ss=" + encodeURI(place_end) + ";aid=1484610\">Zarezerwuj hotel</a>");
907		end_marker.setPopup(popup).togglePopup();
908        }
909
910	function clearMap() {
911            if (tomtom_map.getLayer('route')) {
912                tomtom_map.removeLayer('route');
913                tomtom_map.removeSource('route');
914            }
915        }
916
917function remove_route_layers() {
918    for(var i = 0; i < 3; i++) {
919        if (tomtom_map.getLayer('route' + i)) {
920            tomtom_map.removeLayer('route' + i);
921            tomtom_map.removeSource('route' + i);
922        }
923    }
924}
925
926function get_route_layer(index, geometry, color, line_width) {
927	return {
928                        'id': 'route' + index,
929                        'type': 'line',
930                        'source': {
931                            'type': 'geojson',
932                            'data': {'type': 'Feature', 'geometry': geometry}
933                        },
934                        'paint': {
935                            'line-color': color,
936                            'line-width': line_width
937                        }
938	}
939}
940function redrawTomTomRoutes(geojson, routeIndex) {
941    remove_route_layers();
942    for (var index = 0; index < geojson.features.length; index++) {
943	var line_width = (index == routeIndex) ? 6 : 3;
944	var line_color = (index == routeIndex) ? colors[1] : colors[0];
945        tomtom_map.addLayer(get_route_layer(index, geojson.features[index].geometry, line_color, line_width));
946    }
947}
948function drawTomTomRoute(route_coords, locations_string, routeIndex) {
949    if (typeof(routeIndex) == 'undefined' || routeIndex < 0 || routeIndex > 2) {
950	routeIndex = 0;
951    }
952    //console.log('route_coords', route_coords);
953    var locations = '';
954    if (typeof(locations_string) != 'undefined') {
955	locations = locations_string;
956    } else {
957	for (var i = 0; i < route_coords.length; i++) {
958	    if (locations != '') {
959		locations += ':';
960	    }
961	    locations += route_coords[i].lon + ',' + route_coords[i].lat;
962	}
963    }
964    clearTomTomMap();
965    remove_route_layers();
966    var colorIndex = 0;
967
968    var is_mobile = 0;
969
970    //console.log('locations:', locations);
971    //locations = '20.090542,49.880343:19.936856,50.061947';
972    //tt.services.calculateRoute({key: tomtom_key, traffic: false, locations: locations, maxAlternatives: 2})
973    nr.calculateRoute({key: tomtom_key, traffic: false, locations: locations, maxAlternatives: 2})
974	.then(function(response) {
975	    geojson = response.toGeoJson();
976	    console.log('geojson', geojson);
977	    redrawTomTomRoutes(geojson, routeIndex);
978            var bounds = new maplibregl.LngLatBounds();
979            geojson.features[routeIndex].geometry.coordinates.forEach(function(point) {
980		try {
981            	    bounds.extend(maplibregl.LngLat.convert(point));
982		} catch (e) {
983		    for (var k = 0; k < point.length; k++) {
984			bounds.extend(maplibregl.LngLat.convert(point[k]));
985		    }
986		}
987            });
988            tomtom_map.fitBounds(bounds, { duration: 0, padding: 50 });
989
990	    addRouteMarkers(geojson.features[routeIndex]);
991
992	    $('#alternatives').empty();
993	    //console.log('results_count', results_count);
994	    for (var i = 0; i < geojson.features.length; i++) {
995		var current_feature = geojson.features[i];
996		//console.log('i', i, 'current_feature', current_feature);
997
998		$('.pathInfo').show();
999		if (i == routeIndex) {
1000		    $('#speed-cases').empty();
1001		    var a_distance = (parseFloat(''+(current_feature.properties.summary.lengthInMeters/1000))).toFixed(2);
1002		    $('#DirectionDistance').val(a_distance);
1003		    //$('.aDistanceL').text(lineLength);
1004		    $('.aTime').text(customFormatTime(current_feature.properties.summary.travelTimeInSeconds));
1005		    $('.pathInfo .totalDistance').html(a_distance);
1006		    $('.pathInfo .lineDistance').html('');
1007
1008		    var speeds=[40,60,80,100,120,140];
1009		    $.each(speeds,function(i,e){
1010			var hours = a_distance / e;
1011			hours = parseInt(''+hours);
1012			var minutes = (a_distance/e-parseInt(''+(a_distance/e)))*60;
1013			minutes = parseInt(''+minutes);
1014			$('#speed-cases').append('<li>'+e+'km/h - <strong>'+hours+' h '+minutes+' min</strong></li>');
1015			if (i == 1) {
1016			    $('.pathInfo .totalDuration').html(hours+' h '+minutes+' min');
1017			}
1018		    });
1019		}
1020
1021		$('#alternatives').append('<div class="alt-' + i + ' alternative-route ' + (i==routeIndex ? 'active' : '') + ' osm" ' + 'indexes="' + locations + '" feature_index="' + i + '">'
1022                        + '<div class="route-id-div"><span class="route-id">' + (i+1) + '</span></div>'
1023                        + '<div class="route-info-div">'
1024                        + '<span class="route">' 
1025                        + a_places[0] + ' - ' + a_places[a_places.length-1]
1026                        + '</span>'
1027                        + '<span class="distance">Odległość drogowa: <strong id="journey-width">' + (parseFloat(''+(current_feature.properties.summary.lengthInMeters/1000))).toFixed(2) + ' km</strong></span>'
1028                        + '<span class="duration">Czas przejazdu: <strong id="journey-time">' + customFormatTime(current_feature.properties.summary.travelTimeInSeconds) + '</strong></span>'
1029			                        + '</div>'
1030                        + '</div>');
1031	    }
1032    });
1033}
1034
1035function initializeTomTomMap(zoom) {
1036	$('#leaflet_map').show();
1037	$('#google_map').hide();
1038
1039	if (typeof(zoom) == 'undefined' || !zoom) {
1040	    zoom = 8;
1041	}
1042
1043	if (!tomtom_map) {
1044	    // var center_coordinates = [current_lonlat[0], current_lonlat[1]];
1045	    // tomtom_map = tt.map({
1046		// key: tomtom_key,
1047		// container: 'leaflet_map',
1048		// center: center_coordinates,
1049		// zoom: zoom
1050        //     });
1051
1052        var center_coordinates = [current_lonlat[0], current_lonlat[1]];
1053        tomtom_map = new maplibregl.Map({
1054            container: 'leaflet_map',
1055            //style: 'https://mapa.info/maps/v1/style.min.json',
1056            style: 'https://mapa.info/maps/v2/style.min.json',
1057            center: center_coordinates,
1058            zoom: zoom,
1059            maxZoom: 18,
1060            minZoom: 0,
1061        }).addControl(new maplibregl.NavigationControl());
1062	}
1063}
1064
1065function calcTomTomRoute(start, end, waypts) {
1066	$('#leaflet_map').show();
1067	$('#map-canvas').hide();
1068	$('#sticky_side_links').hide();
1069
1070	if (typeof(zoom) == 'undefined' || !zoom) {
1071	    zoom = 8;
1072	}
1073
1074	a_route_coords = [];
1075	a_places = [];
1076
1077	if (!tomtom_map) {
1078	    initializeTomTomMap(zoom);
1079	}
1080
1081	if (tomtom_map) {
1082	    var i = 0;
1083	    var options = {
1084		limit: 1,
1085		unwrapBbox: true
1086		//language: 'pl-PL'
1087	    }
1088
1089	    a_places.push(start);
1090	    for (i = 0; i < waypts.length; i++) {
1091		a_places.push(waypts[i].location);
1092	    }
1093	    a_places.push(end);
1094
1095	    for (i = 0; i < a_places.length; i++) {
1096		a_route_coords[i] = null;
1097	    }
1098            for (i = 0; i < a_places.length; i++) {
1099                $.ajax({type: "GET", url: '/nominatim.php', data: {address: a_places[i], counter: i},
1100                        success: function(result) {
1101                            if (result.msg == 'OK') {
1102                                a_route_coords[parseInt(''+result.counter)] = {lat: result.lat, lon: result.lon};
1103                                //console.log(result);
1104                                draw = true;
1105                                for (k = 0; k < a_route_coords.length; k++) {
1106                                    if (!a_route_coords[k]) {
1107                                        draw = false;
1108                                        break;
1109                                    }
1110                                }
1111                                if (draw) {
1112                                    drawTomTomRoute(a_route_coords);
1113                                }
1114                            } else {
1115                                var options = {
1116                                        limit: 1,
1117                                        unwrapBbox: true
1118                                        //language: 'pl-PL'
1119                                }
1120                                options.query = result.q;
1121                                tt.geocode(options).go(function(geoResponses) {
1122                                    if (geoResponses.length > 0 && geoResponses[0].position) {
1123                                        a_route_coords[parseInt(''+result.counter)] = geoResponses[0].position;
1124                                        $.ajax({type: "GET", url: '/savelocation.php', data: {address: options.query, lat: geoResponses[0].position.lat, lng: geoResponses[0].position.lon}, success: function(result) {} });
1125
1126                                        draw = true;
1127                                        for (k = 0; k < a_route_coords.length; k++) {
1128                                            if (!a_route_coords[k]) {
1129                                                draw = false;
1130                                                break;
1131                                            }
1132                                        }
1133                                        if (draw) {
1134                                            drawTomTomRoute(a_route_coords);
1135                                        }
1136                                    } else {
1137                                        a_route_coords[parseInt(''+result.counter)] = {lat: -1, lon: -1};
1138                                    }
1139                                    //console.log('tomtom: a_route_coords', a_route_coords);
1140                                })
1141                            }
1142                        }
1143                });
1144            }
1145	} else {
1146	    alert('No results found');
1147	}
1148}
1149
1150function calcRoute(autoRouting=true) {
1151        $('.pathInfo').hide();
1152        //$('#alternatives').empty();
1153
1154	if (!document.getElementById('DirectionDriveFrom') || !document.getElementById('DirectionDriveTo')) {
1155	    console.log('Puste miejsce startowe lub docelowe');
1156	    return;
1157	}
1158        var start = document.getElementById('DirectionDriveFrom').value;
1159        var end = document.getElementById('DirectionDriveTo').value;
1160        
1161	start = start.charAt(0).toUpperCase() + start.slice(1);
1162	end = end.charAt(0).toUpperCase() + end.slice(1);
1163	if (start == 'Wpisz lokalizację początkową' || end == 'Wpisz lokalizację docelową' || start=='' || end=='') {
1164	    return;
1165	}
1166
1167	// zerujemy informacje o trasie
1168	routes_info = [];
1169
1170	//alert(start + '-' + end);
1171	var waypts = [];
1172        $('.through').each(function(index) {
1173        var value = $(this).val();   
1174        
1175 	if(value && value != 'Wpisz lokalizację pośrednią' && value != ''){
1176            waypts.push({
1177                    location:value.charAt(0).toUpperCase() + value.slice(1),
1178                    stopover:true
1179                });	    
1180            }           
1181        });
1182	//console.log(start, end, waypts);
1183	$('#directions-panel').empty();
1184
1185    if (autoRouting != true) {
1186        // stop calculating route, display map with markers and alternative routes with buttons to calculate route
1187        displayMapPlaceholder(start,end);
1188        return;
1189    }
1190
1191	calcTomTomRoute(start, end, waypts);
1192}
1193
1194
1195function displayMapPlaceholder(start, end) {
1196    $('#leaflet_map').show();
1197    $('#map-canvas').hide();
1198    $('#sticky_side_links').hide();
1199
1200    if (!tomtom_map) {
1201        initializeTomTomMap(8);
1202    }
1203
1204    var i = 0;
1205    var options = {
1206        limit: 1,
1207        unwrapBbox: true
1208    }
1209
1210    a_places = [];
1211    a_places.push(start);
1212    a_places.push(end);
1213
1214    for (i = 0; i < a_places.length; i++) {
1215        a_route_coords[i] = null;
1216    }
1217
1218    for (i = 0; i < a_places.length; i++) {
1219        $.ajax({type: "GET", url: '/nominatim.php', data: {address: a_places[i], counter: i},
1220            success: function(result) {
1221                if (result.msg == 'OK') {
1222                    a_route_coords[parseInt(''+result.counter)] = {lat: result.lat, lon: result.lon};
1223                    draw = true;
1224                    for (k = 0; k < a_route_coords.length; k++) {
1225                        if (!a_route_coords[k]) {
1226                            draw = false;
1227                            break;
1228                        }
1229                    }
1230                    if (draw) {
1231                        drawTomTomRoutePlaceholder(a_route_coords)
1232                    }
1233                } else {
1234                    tt.services.geocode({key: tomtom_key, query: result.q})
1235                        .then(function(response) {
1236                            geojson = response.toGeoJson();
1237                            point = geojson.features[0].geometry.coordinates;
1238                            a_route_coords[parseInt(''+result.counter)] = {lat: point[1], lon: point[0]};
1239                            $.ajax({type: "GET", url: '/savelocation.php', data: {address: result.q, lat: point[1], lng: point[0]}, success: function(result) {} });
1240                            draw = true;
1241                            for (k = 0; k < a_route_coords.length; k++) {
1242                                if (!a_route_coords[k]) {
1243                                    draw = false;
1244                                    break;
1245                                }
1246                            }
1247                            if (draw) {
1248                                drawTomTomRoutePlaceholder(a_route_coords)
1249                            }
1250                        });
1251                }
1252            }
1253        });
1254    }
1255
1256}
1257
1258function drawTomTomRoutePlaceholder(route_coords, locations_string, routeIndex) {
1259    if (typeof(routeIndex) == 'undefined' || routeIndex < 0 || routeIndex > 2) {
1260	routeIndex = 0;
1261    }
1262    //console.log('route_coords', route_coords);
1263    var locations = '';
1264    if (typeof(locations_string) != 'undefined') {
1265    	locations = locations_string;
1266    } else {
1267        for (var i = 0; i < route_coords.length; i++) {
1268            if (locations != '') {
1269            locations += ':';
1270            }
1271            locations += route_coords[i].lon + ',' + route_coords[i].lat;
1272        }
1273    }
1274    clearTomTomMap();
1275    remove_route_layers();
1276    var colorIndex = 0;
1277
1278    var is_mobile = 0;
1279
1280    var bounds = new maplibregl.LngLatBounds();
1281    for (var i = 0; i < route_coords.length; i++) {
1282        bounds.extend(maplibregl.LngLat.convert(route_coords[i]));
1283    }
1284    tomtom_map.fitBounds(bounds, { duration: 0, padding: 50 });
1285
1286    addRouteMarkers({
1287        'geometry': {
1288            'coordinates': route_coords,
1289            'type': 'none'
1290        }
1291    });
1292
1293    $('#alternatives').empty();
1294    $('#speed-cases').empty();
1295    //console.log('results_count', results_count);
1296    // append style element with class for .placeholder
1297    $('head').append(`<style>
1298    .show-route-btn {position: absolute;
1299    cursor: pointer;
1300    padding: 10px 12px;
1301    background-color: #00923d;
1302    color: #f2f2f2;
1303    border: none;
1304    right: 100px;
1305    top: 50%;
1306    transform: translateY(-50%);
1307    border-radius: 5px;
1308    font-weight: bold;
1309    font-family: Dosis, sans-serif;}
1310    #leaflet_map .show-route-btn{
1311    top: 10px;
1312    right: 50%;
1313    transform: translateX(50%);
1314    }
1315    .show-route-btn-bck {
1316    position: absolute;
1317    background-color: rgba(0,0,0,0);
1318    left:0;
1319    top:0;
1320    width: 100%;
1321    height: 100%;
1322    }
1323    @keyframes showRouteBtnBck {
1324    0% {background-color: rgba(0,0,0,0);}
1325    50% {background-color: rgba(0,0,0,0.1);}
1326    100% {background-color: rgba(0,0,0,0);}
1327    }
1328    </style>`);
1329
1330    // add button to map container
1331    var showRouteBtn = document.createElement('button');
1332    showRouteBtn.className = 'show-route-btn';
1333    showRouteBtn.innerHTML = 'POKAŻ TRASĘ';
1334    showRouteBtn.onclick = function() {
1335        calcFreshRoute();
1336    }
1337
1338    tomtom_map.getContainer().appendChild(showRouteBtn);
1339
1340    for (var i = 0; i < 3; i++) {
1341
1342        $('#alternatives').append('<div style="position:relative" class="alt-' + i + ' alternative-route ' + ' osm" ' + 'indexes="' + locations + '" feature_index="' + i + '">'
1343                        + '<div class="route-id-div"><span class="route-id">' + (i+1) + '</span></div>'
1344                        + '<div class="route-info-div">'
1345                        + '<span class="route">' 
1346                        + a_places[0] + ' - ' + a_places[a_places.length-1]
1347                        + '</span>'
1348                        + '<span class="distance">Odległość drogowa: <strong id="journey-width"></strong></span>'
1349                        + '<span class="duration">Czas przejazdu: <strong id="journey-time"></strong></span>'
1350			                        + '</div>'
1351                        + '<span class="show-route-btn-bck"></span>'
1352                        + '<button class="show-route-btn" onclick="calcFreshRoute()">POKAŻ TRASĘ</button>'
1353                        + '</div>');
1354	}
1355
1356    
1357
1358    return;
1359}
1360
1361function calcFreshRoute(){
1362    calcRoute();
1363    document.querySelectorAll('.show-route-btn').forEach(function(el){
1364        el.remove();
1365    });
1366    // animate show-route-btn-bck background to let user know that we are getting resluts
1367    var showRouteBtnBck = document.querySelectorAll('.show-route-btn-bck');
1368    showRouteBtnBck.forEach(function(el, index){
1369        el.style.animation = 'showRouteBtnBck 1s infinite';
1370        // delay animation for each element
1371        el.style.animationDelay = (index * 0.2) + 's';
1372
1373    });
1374
1375}
1376
1377function searchGeo(place) {
1378    if (!place) {
1379	if (!document.getElementById('MapSearchMap')) {
1380	    return;
1381	}
1382	place = document.getElementById('MapSearchMap').value;
1383	if (!place) {
1384	    return;
1385	}
1386    }
1387
1388	$('#leaflet_map').hide();
1389	$('#google_map').show();
1390
1391    $('#google_map > iframe#google_map_embed').attr('src', 'https://www.google.com/maps/embed/v1/place?q=' + place + '&key=' + google_key + '&language=pl');
1392}
1393
1394</script>
1394
1395
1396<style type="text/css">
1397#sticky_side_links {
1398	z-index: 1000;
1399	left: 100px !important;
1400	top: 300px !important;
1401}
1402</style>
1403
1404<div id="left" style="padding-top: 0px;">
1405<div id="directions-box" class="long wt" style="margin-bottom:0;margin-top:25px; width:854px">
1406	<h1 class="txt">Wyznaczanie trasy</h1>
1407        <form action="/wyznaczanie-trasy--" id="DirectionRoutingForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div>    <div class="input ilong"><label for="DirectionDriveFrom" class="llong">Wyjazd z:</label><div class="letter"></div><input name="data[Direction][drive_from]" value="Wpisz lokalizację początkową" type="text" id="DirectionDriveFrom"/></div>            <div class="input ilong"><label for="DirectionDriveTo" class="llong">Dojazd do:</label><div class="letter"></div><input name="data[Direction][drive_to]" value="Wpisz lokalizację docelową" type="text" id="DirectionDriveTo"/></div>        <div id="select" class="jNice">
1408        <div class="input ilong"><label for="DirectionType" class="llong">Wyznacz po:</label><select name="data[Direction][type]" id="DirectionType">
1409<option value="best">Najkrótszy czas przejazdu</option>
1410<option value="short">Najkrótsza odległość</option>
1411</select></div>    </div>
1412
1413            <div class="input ilong"><label for="DirectionWyapointsThrough" class="llong number-1">Miejsce pośrednie 1*</label><div class="letter"></div><input name="data[Direction][wyapoints][][through]" class="through" value="Wpisz lokalizację pośrednią" type="text"/></div>        <div class="input ilong"><label for="DirectionWyapointsThrough" class="llong number-2">Miejsce pośrednie 2*</label><div class="letter"></div><input name="data[Direction][wyapoints][][through]" class="through" value="Wpisz lokalizację pośrednią" type="text"/></div>        <div class="input ilong"><label for="DirectionWyapointsThrough" class="llong number-3">Miejsce pośrednie 3*</label><div class="letter"></div><input name="data[Direction][wyapoints][][through]" class="through" value="Wpisz lokalizację pośrednią" type="text"/></div>    	<div class="clear"></div>
1414    <div class="checkboxes">
1415		
1416		<div style="float:left;">
1417			<a href="#" id="add_next_input">dodaj więcej miejsc pośrednich</a>		</div>
1418		
1419		<div id="button-submit" style="display: inline-block;margin-left: 200px;"><input id="direction" class="long" type="submit" value="Znajdź trasę"/><div class="clear"></div></div>
1420		
1421		<div class="input checkbox"><input type="hidden" name="data[Direction][avoidTolls]" id="DirectionAvoidTolls_" value="0"/><input type="checkbox" name="data[Direction][avoidTolls]" value="1" id="DirectionAvoidTolls"/><label for="DirectionAvoidTolls">Unikaj dróg płatnych</label></div>        <div class="input checkbox"><input type="hidden" name="data[Direction][avoidHighways]" id="DirectionAvoidHighways_" value="0"/><input type="checkbox" name="data[Direction][avoidHighways]" value="1" id="DirectionAvoidHighways"/><label for="DirectionAvoidHighways">Unikaj autostrad</label></div>        
1422    </div>
1423    </form>        <div class="clear"></div>
1424    
1425    <!--[if lt IE 8]>
1426      <style type="text/css">
1427	div#directions-box div.letter {
1428	   top: 1px;
1429	}
1430      </style>
1431    <![endif]-->
1432    
1433</div>
1434    <div class="no-req-long">*Te pola są nieobowiązkowe..</div>
1435    <div style="height:5px;border-bottom:solid 1px #d5d5d5;width:width:854px"></div>
1436
1437
1438<div style="margin-top:20px">
1439    <div id='750x300_1' style="text-align: center; min-height: 250px;display: flex;align-items: center;justify-content: center;">
1440  
1440<script>
1441    googletag.cmd.push(function() { googletag.display('750x300_1'); });
1442  </script>
1442
1443</div>
1444
1445</div>
1446
1447<script type="text/javascript">
1448    $('#add_next_input').click(function(){
1449        number = parseInt($('label', $("div.ilong:last")).attr('class').replace('llong number-', ''));
1450        if(number < 9){
1451            var len = $('#DirectionRoutingForm input.through').length;
1452            if((len)%3 == 0) {
1453                repaet = [0,1,2];
1454            }else if((len)%3 == 2) {
1455                repaet = [0];
1456            }else if((len)%3 == 1){
1457                repaet = [0,1];
1458            }
1459            repaet.forEach(function(){
1460                addNextInput();
1461            });
1462        }
1463        return false;
1464    });
1465    function addNextInput() {
1466        var last_div = $("div.ilong:last").clone();
1467        var letter = $("div.ilong:last span").text();
1468        var next_letter = letter.substring(0,letter.length-1)+String.fromCharCode(letter.charCodeAt(letter.length-1)+1)
1469        var next_next_letter = next_letter.substring(0,next_letter.length-1)+String.fromCharCode(next_letter.charCodeAt(next_letter.length-1)+1)
1470        $('input', last_div).val('Wpisz lokalizację pośrednią');
1471        $('span', last_div).text(next_letter);
1472        $('span', last_div).attr('class', 'letter-' + next_letter.toLowerCase() + ' dark');
1473        number = parseInt($('label', last_div).attr('class').replace('llong number-', '')) + 1;
1474        $('label', last_div).attr('class', 'llong number-' + number).text('Miejsce pośrednie ' + number + '*');
1475        $('#DirectionDriveTo').parent().find('span').text(next_next_letter).attr('class', 'letter-' + next_next_letter.toLowerCase() + ' middle');
1476        $('#directions-box div.ilong:last').after(last_div);
1477    }
1478</script>
vendor: 2 bytes, line 1478
1478
1479<script type="text/javascript">
1480$(document).ready(function() {
1481	$('#DirectionDriveFrom').live('click', function() {
1482	    if($(this).val()=='Wpisz lokalizację początkową')$(this).val('');
1483	});
1484	$('#DirectionDriveFrom').live('blur', function() {
1485	    if($(this).val()=='')$(this).val('Wpisz lokalizację początkową');
1486	});
1487	$('#DirectionRoutingForm .through').live('click', function() {
1488	    if($(this).val()=='Wpisz lokalizację pośrednią')$(this).val('');
1489	});
1490	$('#DirectionRoutingForm .through').live('blur', function() {
1491	    if($(this).val()=='')$(this).val('Wpisz lokalizację pośrednią');
1492	});
1493	$('#DirectionDriveTo').live('click', function() {
1494	    if($(this).val()=='Wpisz lokalizację docelową')$(this).val('');
1495	});
1496	$('#DirectionDriveTo').live('blur', function() {
1497	    if($(this).val()=='')$(this).val('Wpisz lokalizację docelową');
1498	});
1499});
1500</script>
1500
1501<div>
1502
1503    
1504	<div id="alternatives" class="box"></div>
1505
1506    
1507	<div id="map" class="" style="position:relative">
1508	    	    
1509	    <div id="leaflet_map" class="" style=""></div>
1510	    <div id="google_map" class="fl ">
1511		<iframe id="google_map_embed" frameborder="0" style="border:0;width:100%;height:100%" src="https://www.google.com/maps/embed/v1/place?q=Polska&language=pl&key=AIzaSyCTGQ5N94gHJ56J_NKFBYTP6n6cR6ljuHA"></iframe>
1512	    </div>
1513
1514		<div style="width:100%;clear:both;"></div>
1515	    	    <div style="height:10px"></div>
1516	    	    	    		
1517	    <div id="directions-panel-box">
1518			<div class="back">Pokaż całą trasę</div>
1519			<div class="directions-panel-wrapper">
1520				<div id="directions-panel" class="route-directions-panel-box-handle route-directions-panel-box">
1521				    
1522				</div>
1523				<div class="route-directions-panel-box-more"><div class="route-more">Rozwiń <p class="down-arrow">&rsaquo;</p></div></div>
1524			</div>
1525	    </div>
1526		
1527				
1528
1529    	    		
1530		
1531		<div class="wtp" style="margin-top:20px;">
1532			<div style="width:100%;height:10px;clear:both"></div>
1533<h2 style="float: left;" class="txt">Popularne trasy</h2>
1534<div style="margin-top: 7px;" class="link fr"><a class="cLink" href="/trasy">Zobacz wszystkie >></a></div>
1535<div class="popularRoutes">
1536    <div class="wrapperh3">
1537        <div id="popular">
1538            <div id="popular-center">
1539                <div class="wrapper" style="float:none;">
1540                    <ul>
1541                                                                                                                <li>
1542                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-zakopane" class="cLink">Warszawa - Zakopane</a></div>
1543                                                    </li>
1544                                                                        <li>
1545                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/bialystok-praga" class="cLink">Białystok - Praga</a></div>
1546                                                    </li>
1547                                                                        <li>
1548                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/wroclaw-warszawa" class="cLink">Wrocław - Warszawa</a></div>
1549                                                    </li>
1550                                                                        <li>
1551                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-warszawa" class="cLink">Kraków - Warszawa</a></div>
1552                                                    </li>
1553                                                                        <li>
1554                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/gdansk-warszawa" class="cLink">Gdańsk - Warszawa</a></div>
1555                                                    </li>
1556                                                                        <li>
1557                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-tarnow" class="cLink">Kraków - Tarnów</a></div>
1558                                                    </li>
1559                                                                        <li>
1560                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-katowice" class="cLink">Kraków - Katowice</a></div>
1561                                                    </li>
1562                                                                                                                                            <li>
1563                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-wroclaw" class="cLink">Kraków - Wrocław</a></div>
1564                                                    </li>
1565                                                                        <li>
1566                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/poznan-wroclaw" class="cLink">Poznań - Wrocław</a></div>
1567                                                    </li>
1568                                                                        <li>
1569                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/poznan-szczecin" class="cLink">Poznań - Szczecin</a></div>
1570                                                    </li>
1571                                                                        <li>
1572                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-poznan" class="cLink">Warszawa - Poznań</a></div>
1573                                                    </li>
1574                                                                        <li>
1575                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-gdansk" class="cLink">Kraków - Gdańsk</a></div>
1576                                                    </li>
1577                                                                        <li>
1578                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-wieden" class="cLink">Warszawa - Wiedeń</a></div>
1579                                                    </li>
1580                                                                        <li>
1581                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/wroclaw-paryz" class="cLink">Wrocław - Paryż</a></div>
1582                                                    </li>
1583                                                                                                                                            <li>
1584                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-berlin" class="cLink">Warszawa - Berlin</a></div>
1585                                                    </li>
1586                                                                        <li>
1587                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/lodz-praga" class="cLink">Łódź - Praga</a></div>
1588                                                    </li>
1589                                                                        <li>
1590                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-rzeszow" class="cLink">Kraków - Rzeszów</a></div>
1591                                                    </li>
1592                                                                        <li>
1593                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/lodz-warszawa" class="cLink">Łódź - Warszawa</a></div>
1594                                                    </li>
1595                                                                        <li>
1596                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/szczecin-warszawa" class="cLink">Szczecin - Warszawa</a></div>
1597                                                    </li>
1598                                                                        <li>
1599                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-paryz" class="cLink">Warszawa - Paryż</a></div>
1600                                                    </li>
1601                                                                        <li>
1602                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/bialystok-warszawa" class="cLink">Białystok - Warszawa</a></div>
1603                                                    </li>
1604                                                                                                                                            <li>
1605                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-paryz" class="cLink">Kraków - Paryż</a></div>
1606                                                    </li>
1607                                                                        <li>
1608                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/gdansk-wroclaw" class="cLink">Gdańsk - Wrocław</a></div>
1609                                                    </li>
1610                                                                        <li>
1611                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-rzym" class="cLink">Kraków - Rzym</a></div>
1612                                                    </li>
1613                                                                        <li>
1614                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-wieden" class="cLink">Kraków - Wiedeń</a></div>
1615                                                    </li>
1616                                                                        <li>
1617                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-praga" class="cLink">Warszawa - Praga</a></div>
1618                                                    </li>
1619                                                                        <li>
1620                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-londyn" class="cLink">Warszawa - Londyn</a></div>
1621                                                    </li>
1622                                                                        <li>
1623                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-londyn" class="cLink">Kraków - Londyn</a></div>
1624                                                    </li>
1625                                                                                                                                            <li>
1626                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-nowy-jork" class="cLink">Warszawa - Nowy Jork</a></div>
1627                                                    </li>
1628                                                                        <li>
1629                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/wroclaw-berlin" class="cLink">Wrocław - Berlin</a></div>
1630                                                    </li>
1631                                                                        <li>
1632                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/gdansk-berlin" class="cLink">Gdańsk - Berlin</a></div>
1633                                                    </li>
1634                                                                        <li>
1635                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/poznan-berlin" class="cLink">Poznań - Berlin</a></div>
1636                                                    </li>
1637                                                                        <li>
1638                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/warszawa-bruksela" class="cLink">Warszawa - Bruksela</a></div>
1639                                                    </li>
1640                                                                        <li>
1641                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/wroclaw-londyn" class="cLink">Wrocław - Londyn</a></div>
1642                                                    </li>
1643                                                                        <li>
1644                                                        <div class="txt fs15"><a href="/wyznaczanie-trasy/krakow-zakopane" class="cLink">Kraków - Zakopane</a></div>
1645                                                    </li>
1646                                                                                        </ul>
1647                </div>
1648            </div>
1649        </div>
1650    </div>
1651</div>
1652
1653<style type="text/css">
1654    div#popular div#popular-center div ul li,
1655    div#popular div#popular-center div ul li {
1656        padding: 0 0 5px 0;
1657    }
1658</style>			<div class="clear"></div>
1659		</div>
1660		
1661				
1662	    <div class="extra-info">
1663	        <h3 class="txt">Informacje dodatkowe:</h3>
1664<ul>
1665    <li>
1666	<p>1) Podane miejsca mogą być zarówno miastami czy miejscowościami ale również państwami czy ulicami. Jeśli system nie jest w stanie rozpoznać miejsca należy opisać je używając dodatkowych danych np. dodając nazwę województwa albo podając pełną nazwę ulicy wraz z numerem. W każdym przypadku należy zawsze podać opis zaczynając od najbardziej szczegółowej części adresu (np. ulicy) a kończąc na najbardziej ogólnej (np. kraj).<br />
1667	Przykładowo:<br />
1668	- planując trasę do Bukowiny Tatrzańskiej należy wpisać pełną nazwę tej miejscowości. Miejsce "Bukowina" nie zostanie rozpoznane gdyż w Polsce jest kilka wsi o tej nazwie<br />
1669	- podobnie planując trasę przez aleję Powstańców Warszawy należy wpisać pełną nazwę tej ulicy czyli "Al. Powstańców Warszawy, Warszawa" tak aby system nie miał problemów umiejscowieniem jej na mapie</p>
1670    </li>
1671
1672    <li>
1673	<p>2) Pole wyboru Typ wyszukiwania pozwala zdefiniować czy system ma odszukać trasę o najkrótszej długości czy też trasę, którą pokona się najszybciej. W większości sytuacji obie wyznaczone trasy będą się pokrywać.</p>
1674    </li>
1675    <li>
1676	<p>3) Wyszukiwana trasa może dotyczyć Polski albo dowolnych miejsc w Europie czy świecie.</p>
1677    </li>
1678    <li>
1679	<p>4) Ideą serwisu trasa.info jest rozwiązanie tzw. problemu komiwojażera czyli problemu przed jakim stoją wędrowni 
1679sprzedawcy, którzy mając odwiedzić wszystkie podane miejsca w danymi rejonie muszą tak dobrać kolejność ich odwiedzania aby pokonać jak najkrótszą trasę.</p>
1680    </li>
1681    <li>
1682	<p>5) Wyszukiwanie najkrótszej i najszybszej trasy odbywa się przy pomocy systemu Google maps oraz tzw. algorytmu zachłannego gdyż system sprawdza wszystkie możliwe kombinacje tras szukając optymalnej pod względem odległości i czasu przejazdu. Mapa systemu Google maps obejmuję swoim zasięgiem cały świat i jest ciągle rozwijana.</p>
1683    </li>
1684    <li>
1685	<p>6) Pole Szukaj na mapie w prawym górnym rogu mapy może służyć do lokalizacji pojedynczych miejsc (ulic, miast, państw). Wystarczy wpisać nazwę danego miejsca i nacisnąć przycisk Szukaj</p>
1686    </li>
1687    <li>
1688	<p>7) Dane prezentowane przez system trasa.info udostępniane są na zasadzie tak-jak-jest (AS IS) bez udzielania jakichkolwiek gwarancji czy zapewnień. Rzeczywiste warunki na wyznaczonej trasie mogą różnić się od tych przedstawianych w wyniku robót drogowych, warunków pogodowych, korków lub innych zdarzeń.</p>
1689    </li>
1690</ul>	    </div>
1691	    
1692	</div>
1693	<div class="clear"></div>
1694</div>
1695
1696</div>
1697<aside id="right-box">
1698
1699	<div id="journey-costs" class="box">
1700		<h4 class="txt">Koszt przejazdu</h4> 
1701		<form action="/directions/calculate" id="calculate" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div>		<div class="journey-costs-input input text required"><label for="DirectionAverageFuel">Średnie spalanie</label><input name="data[Direction][average_fuel]" type="text" id="DirectionAverageFuel" required="required"/></div>		<div class="journey-costs-input input text required"><label for="DirectionFuelCost">Koszt paliwa/l</label><input name="data[Direction][fuel_cost]" type="text" id="DirectionFuelCost" required="required"/></div>		<div class="input text"><label for="DirectionDistance">Długość trasy</label><input name="data[Direction][distance]" class="aDistance journey-costs-input input text" value="" type="text" id="DirectionDistance"/></div>		<div class="input text"><label for="DirectionCosts">Koszt</label><input name="data[Direction][costs]" class="costs" value="" disabled="disabled" type="text" id="DirectionCosts"/></div>		<div class="submit"><input type="submit" value="Oblicz"/></div></form>	    
1702	</div>
1703	<div style="width: 100%;height: 0px;clear: both;"></div>
1704
1705		<div class="ads_right sm_hidden">
1706			
1707<div id='half_1' style="text-align: center; margin-bottom: 20px;min-height: 300px;">
1708  
1708<script>
1709    googletag.cmd.push(function() { googletag.display('half_1'); });
1710  </script>
1710
1711</div>
1712			<div style="width: 100%;height: 30px;clear: both;"></div>
1713		</div>
1714		<div style="width: 100%;height: 30px;clear: both;"></div>
1715		<div class="right-aside">
1716			
1717			<h3 class="txt guide aiports fs28">Lotniska</h3>
1718<div id="search-box-aiport">
1719    <form action="/searchable/search_indexes" id="SearchIndexIndexForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST"/></div>    <input name="data[SearchIndex][term]" value="Szukaj" id="aiportsPhrase" type="text"/>    <input type="hidden" name="data[SearchIndex][type]" value="Airport" id="search-type-aiport"/>    <div class="submit"><input type="submit" value=""/></div></form></div>
1720<div class="clear"></div>
1721<div id="home-airportsRight" >
1722    <div class="a-long" >
1723            <div class="popular-box">
1724          <div class="innerContent">
1725                <a href="/lotnisko/charles-de-gaulle" title="Paryż Charles de Gaulle"><img src="/img/galleries/thumb/medium/Paryz_Charles_de_Gaulle-0.JPG" width="145px" height="90px" alt=""/><div class="txt fs13">Paryż Charles de...</div></a>          </div>
1726        </div>
1727            <div class="popular-box">
1728          <div class="innerContent">
1729                <a href="/lotnisko/ciampino" title="Rzym Ciampino"><img src="/img/galleries/thumb/medium/roma_ciampino_wikipedia_badudoy.jpeg" width="145px" height="90px" alt=""/><div class="txt fs13">Rzym Ciampino</div></a>          </div>
1730        </div>
1731            <div class="popular-box">
1732          <div class="innerContent">
1733                <a href="/lotnisko/leonardo-da-vinci-fiumicino" title="Rzym Fiumicino"><img src="/img/galleries/thumb/medium/Aeroporto_di_Roma_Fiumicino_Skyway_to_the_train_station-0.jpg" width="145px" height="90px" alt=""/><div class="txt fs13">Rzym Fiumicino</div></a>          </div>
1734        </div>
1735            <div class="popular-box">
1736          <div class="innerContent">
1737                <a href="/lotnisko/krakow-balice" title="Kraków-Balice"><img src="/img/galleries/thumb/medium/Balice_airport-0.JPG" width="145px" height="90px" alt=""/><div class="txt fs13">Kraków-Balice</div></a>          </div>
1738        </div>
1739            <div class="popular-box">
1740          <div class="innerContent">
1741                <a href="/lotnisko/katowice" title="Katowice-Pyrzowice"><img src="/img/galleries/thumb/medium/Katowice_International_Airport_IATA_KTW_ICAO_EPKT_Pyrzowice_Poland.jpg" width="145px" height="90px" alt=""/><div class="txt fs13">Katowice-Pyrzowice</div></a>          </div>
1742        </div>
1743            <div class="popular-box">
1744          <div class="innerContent">
1745                <a href="/lotnisko/lublinek" title="Łódź-Lublinek"><img src="/img/galleries/thumb/medium/640px_Lotnisko_Lodz_3.jpg" width="145px" height="90px" alt=""/><div class="txt fs13">Łódź-Lublinek</div></a>          </div>
1746        </div>
1747        </div>
1748</div>
1749
1750<script type="text/javascript">
1751    $(document).ready(function() {
1752        $('#aiportsPhrase').live('click', function() {
1753            if($(this).val()==='Szukaj') {
1754                $(this).val('');
1755            }
1756        });
1757        $('#aiportsPhrase').live('blur', function() {
1758            if($(this).val()===''){
1759                $(this).val('Szukaj');
1760            }
1761        });
1762    });
1763</script>
1763
1764
1765
1766<style>
1767    #home-airportsRight .innerContent {
1768        position: absolute;
1769        left: 1px;
1770        right: 1px;
1771        top: 1px;
1772        bottom: 1px;
1773        margin-left: auto;
1774        margin-right: auto;
1775        width: 145px;
1776        height: 130px;
1777        background-color: #f5f5f5;
1778    }
1779    #home-airportsRight .innerContent .txt {
1780        margin: 10px;
1781    }
1782    #home-airportsRight .popular-box {
1783        padding-bottom: 145px;
1784    }
1785    @media all and (max-width : 650px) and (min-width : 361px) {
1786        /* 2 tiles */
1787        #home-airportsRight .popular-box {
1788            width: 50%;
1789            padding-bottom: 145px;
1790        }
1791    }
1792    @media all and (max-width : 900px) and (min-width : 651px) {
1793        /* 3 tiles */
1794        #home-airportsRight .popular-box {
1795            width: 33.3%;
1796            padding-bottom: 145px;
1797        }
1798    }
1799    @media all and (max-width : 1200px) and (min-width : 901px) {
1800        /* 4 tiles */
1801        #home-airportsRight .popular-box {
1802            width: 25%;
1803            padding-bottom: 145px;
1804        }
1805    }
1806    @media all and (min-width : 1201px) {
1807        /* 2 tiles */
1808        #home-airportsRight .popular-box {
1809            width: 50%;
1810            padding-bottom: 145px;
1811        }
1812    }
1813    //
1814</style>
1815		</div>
1816	</aside>
1817	<div class="fr"></div>
1818
1819<script type="text/javascript">
1820      function initialize() {
1821	  
1822	  var s_info = document.createElement("script");
1823		s_info.type = "text/javascript";
1824		s_info.src = "/js/infobox_packed.js";
1825		document.body.appendChild(s_info);
1826		
1827	directionsDisplay = new google.maps.DirectionsRenderer();
1828	directionsService = new google.maps.DirectionsService();
1829	geocoder = new google.maps.Geocoder();
1830	 
1831        var mapOptions = {
1832          zoom: 6,
1833          center: new google.maps.LatLng(51.809, 19.138),
1834          mapTypeId: google.maps.MapTypeId.ROADMAP
1835        };
1836
1837        map = new google.maps.Map(document.getElementById('google_map'),
1838            mapOptions);
1839        google.maps.event.addDomListener(window, 'resize', initialize);
1840        $('#directions-panel').empty();
1841	directionsDisplay.setMap(map);
1842	directionsDisplay.setPanel(document.getElementById('directions-panel'));
1843	polyLinePath = [];
1844	calcRoute();
1845	google.maps.event.addListenerOnce(map, 'idle', function(){
1846		    infoBoxInit();
1847		});
1848      }
1849
1850      function loadScript() {
1851        $('.route-directions-panel-box-more').click(function(){
1852		if($('.route-directions-panel-box-handle').hasClass('route-directions-panel-box')){
1853			$('.route-directions-panel-box-handle').removeClass('route-directions-panel-box');
1854			$('.route-directions-panel-box-more').html('<div class="route-more">Zwiń <p class="up-arrow">&rsaquo;</p></div>');
1855		}
1856		else{
1857			$('.route-directions-panel-box-handle').addClass('route-directions-panel-box');
1858			$('.route-directions-panel-box-more').html('<div class="route-more">Rozwiń <p class="down-arrow">&rsaquo;</p></div>');
1859		}
1860	});
1861        //var script = document.createElement('script');
1862        //script.type = 'text/javascript';
1863
1864        //var key = 'AIzaSyCTGQ5N94gHJ56J_NKFBYTP6n6cR6ljuHA';
1865        //script.src = 'https://maps.googleapis.com/maps/api/js?key=' + key + '&sensor=false&libraries=geometry&' + 'callback=initialize';
1866        //document.body.appendChild(script);
1867      }
1868	  function infoBoxInitClose(){
1869		if(document.getElementById("main-infobox")){
1870		  document.getElementById('main-infobox').style.display='none';
1871        }
1872		if(document.getElementById("sticky_bottom_links")){
1873			document.body.removeChild(document.getElementById("sticky_bottom_links"));
1874		}
1875		if(document.getElementById("sticky_side_links")){
1876			document.getElementById("sticky_side_links").style.display='none';
1877            //hide first link
1878			/*
1879			document.getElementById("sticky_side_links").style.cssText = 'position:absolute;width:280px;height:55px;z-index:100;left:8px;bottom:30px;';
1880            document.getElementById("sticky_side_links").firstChild.style.display='none';
1881			var deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
1882            if(deviceWidth < 900){
1883                document.getElementById("sticky_side_links").style.bottom = '14px';
1884            }*/
1885		}
1886	}
1887	function stickyBottom(inside){
1888		deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
1889		if(deviceWidth < 0 || deviceWidth > 400) return;
1890		
1891		if(document.getElementById("sticky_bottom_links") == null){
1892			var elem = document.createElement('div');
1893			elem.id = "sticky_bottom_links";
1894			elem.style.cssText = 'position:fixed;width:100%;height:70px;z-index:100;bottom:0;font-family: Arial; font-weight:bold; font-size: 12px;';
1895			document.body.appendChild(elem);
1896			document.body.style.paddingBottom = '70px';
1897		}
1898		if(inside){
1899			var main = document.getElementById("sticky_bottom_links");
1900			main.innerHTML = main.innerHTML + inside;
1901		}
1902	}
1903	function stickySide(url){
1904		var deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
1905		var contentWidth = document.getElementById('footer').offsetWidth;
1906		
1907		//if(((deviceWidth-contentWidth)/2) < 270) return;
1908        //if(deviceWidth < 900) return;
1909		
1910		if(document.getElementById("sticky_side_links") == null){
1911			var elem = document.createElement('div');
1912			elem.id = "sticky_side_links";
1913			//elem.style.cssText = 'position:fixed;width:280px;height:100px;z-index:100;right:0;top:50%;margin-top:-50px;';
1914			//document.body.appendChild(elem);
1915			elem.style.cssText = 'position:absolute;width:280px;height:46px;z-index:1000;left:8px;bottom:30px;margin-top:-50px;';
1916            document.getElementById('map').appendChild(elem);
1917			
1918			var link1 = document.createElement('a');
1919			link1.href = url;
1920			link1.rel = "nofollow";
1921			link1.target = "_blank";
1922			link1.style.cssText = "display:block; text-decoration: none;font-family: Arial; font-weight:bold; font-size: 16px;line-height:16px; color: #000;background-color: #eebd28; border-radius: 10px;position: relative;padding: 15px 10px 15px 60px;";
1923			link1.innerHTML='<span style="border-right: 1px solid #238e5b;padding:0 25px;font-size: 14px;display:inline-block;
1923background: url(\'/img/bed-b.png\') no-repeat center center;position: absolute;left:0;top:0;height:100%;"></span>ZAREZERWUJ HOTEL &raquo;';
1924			elem.appendChild(link1);
1925			/*
1926			var link2 = document.createElement('a');
1927			//link2.href = "https://www.rentalcars.com/pl/?cor=pl&affiliateCode=trasainfo";
1928			link2.href = "http://www.comperialead.pl/a/pp_adserwer.php?link=5430a96abb7c4fb58b9cb35fc73308f4";
1929			link2.rel = "nofollow, noindex";
1930			link2.target = "_blank";
1931			link2.style.cssText = "margin-top: 8px;display:block; text-decoration: none;font-family: Arial; font-weight:bold; font-size: 16px;line-height:16px; color: #fff;background-color: #63a16b; border-radius: 10px;position: relative;padding: 15px 10px 15px 60px;";
1932			link2.innerHTML='<span style="border-right: 1px solid #4f8156;padding:0 25px;font-size: 14px;display:inline-block;background: url(\'/img/car-b.png\') no-repeat center center;position: absolute;left:0;top:0;height:100%;"></span>Tanie OC - sprawdź ofertę &raquo;';
1933			elem.appendChild(link2);*/
1934			
1935			if(deviceWidth < 900){
1936				//elem.style.cssText = 'position:absolute;width:270px;height:75px;z-index:100;left:8px;bottom:25px;';
1937				elem.style.cssText = 'position:absolute;width:270px;height:33px;z-index:100;left:8px;bottom:25px;';
1938                link1.style.fontSize = "13px";
1939                link1.style.lineHeight = '13px';
1940                link1.style.borderRadius = '8px';
1941                link1.style.padding = "10px 10px 10px 50px";
1942                link1.firstChild.style.backgroundSize='70%';
1943                link1.firstChild.style.padding = "0 20px";
1944				/*
1945                link2.style.fontSize = "13px";
1946                link2.style.lineHeight = '13px';
1947                link2.style.borderRadius = '8px';
1948                link2.style.padding = "10px 10px 10px 50px";
1949                link2.firstChild.style.backgroundSize='70%';
1950                link2.firstChild.style.padding = "0 20px";*/
1951            }
1952		}
1953	}
1954	function infoBoxInit(){
1955		var link = 'https://www.booking.com/index.pl.html?aid=1484610';
1956
1957		var background = '#29a56a';
1958        var color = '#fff';
1959
1960        var boxText = document.createElement("div");
1961        boxText.id = "main-infobox";
1962    	boxText.style.cssText = "display:block; position: absolute; top: 50%; left: 10px; text-decoration: none;font-family: Arial; font-weight:bold; font-size: 12px; color: #000; border: 1px solid "+background+"; border-radius: 10px; box-shadow: 5px 5px 10px grey; background: "+background+";";
1963		boxText.innerHTML = '<span id="close-info-window" style="cursor: pointer; border-right: 1px solid #238e5b;padding: 10px;font-size: 14px;color: '+color+';display:inline-block;">x</span>'+
1964		'<a href="'+link+'" target="_blank" rel="nofollow" style="background: url(\'/img/bed.png\') no-repeat left 10px center ;display:inline-block; padding: 10px 10px 10px 45px;text-decoration: none; color: '+color+'; font-size: 14px;" >Zarezerwuj Nocleg &raquo;</a>';
1965
1966		//document.getElementById('leaflet_map').appendChild(boxText);
1967
1968		//document.getElementById("close-info-window").onclick = function(){
1969		//    document.getElementById('main-infobox').style.display='none';
1970		//};
1971		
1972		//stickyBottom('<a href="'+link+'" target="_blank" rel="nofollow" style="background: '+background+' url(\'/img/bed.png\') no-repeat left 10px center ;display:block; padding: 10px 10px 10px 45px;width:100%;line-height: 50px;box-sizing:border-box;text-decoration: none; color: '+color+'; font-size: 18px;" >Zarezerwuj Nocleg &raquo;</a>');
1973		stickySide(link);
1974	}
1975	function  infoBox(place, latlng, version='end', sw='50'){
1976		// infobox
1977		var link = 'https://www.booking.com/searchresults.pl.html?dest_type=city&ss='+encodeURIComponent(place)+';aid=1484610';
1978		
1979		var background = '#ffba00';
1980        var color = '#000';
1981        var closeBtn = "/img/close-black.png";
1982        if(version == 'start'){
1983        	background = '#29a56a';
1984        	color = '#fff';
1985        	closeBtn = "/img/close-green.png";
1986        }
1987		
1988        var boxText = document.createElement("a");
1989		boxText.style.cssText = "display:block; text-decoration: none;font-family: Arial; font-weight:bold; font-size: 12px; color: #000; border: 1px solid "+background+"; border-radius: 10px; box-shadow: 5px 5px 10px grey; background: "+background+"; padding: 10px;";
1990		boxText.href = link;
1991		boxText.rel = "nofollow";
1992		boxText.target = "_blank";
1993		boxText.innerHTML = '<span style="display: inline-block;position: absolute;
1993left: -15px;top: 16px;width: 0;height: 0;border-top: 10px solid transparent; border-bottom: 10px solid transparent;border-right: 15px solid '+background+';"></span>'+
1994		'<span style="display:block;margin-bottom: 5px;color: '+color+';white-space: nowrap;">'+place+
1995		'</span><span style="display:block;color: '+color+'; font-size: 14px;" >Zarezerwuj Nocleg &raquo;</span>';
1996
1997		//stickyBottom('<a href="'+link+'" target="_blank" rel="nofollow" style="background-color: '+background+';display:inline-block; padding: 10px;width:'+sw+'%;height:100%;box-sizing:border-box;text-decoration: none;float: left;color: '+color+'; font-size: 14px;" ><span style="display:block;margin-bottom: 5px;color: '+color+';">'+place+'</span>Zarezerwuj Nocleg &raquo;</a>');
1998	
1999		var myOptions = {
2000			 content: boxText
2001			,disableAutoPan: true
2002			,maxWidth: 0
2003			,pixelOffset: [30, -26]
2004			,zIndex: null
2005			,boxStyle: { 
2006			  "min-width": "160px",
2007			  width: "auto"
2008			 }
2009			,closeBoxMargin: "-10px"
2010			,closeBoxURL: closeBtn
2011			,infoBoxClearance: [1, 1]
2012			,isHidden: false
2013			,pane: "floatPane"
2014			,enableEventPropagation: false
2015		};
2016
2017/*
2018        var marker = new google.maps.Marker({
2019		    position: latlng,
2020		    map: map,
2021		    title: 'tmp'
2022		  });
2023*/
2024	//var marker = new L.Marker(latlng);
2025	//    lmap.addLayer(marker);
2026	//    markers.push(marker);
2027    	//    marker.bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();
2028
2029        var ib = new InfoBox(myOptions);
2030	ib.open(lmap, marker);
2031	ibs.push(ib);
2032	}
2033      
2034
2035      function calcRoute__OLD__() {
2036	return;
2037        higways = checkdHighways();
2038        tolls = checkdTolls()
2039        var request = {
2040            origin:start,
2041            destination:end,
2042            waypoints: waypts,
2043	    provideRouteAlternatives: true,
2044            optimizeWaypoints: false,
2045            avoidHighways:higways,
2046            avoidTolls: tolls,
2047            travelMode: google.maps.DirectionsTravelMode.DRIVING
2048        };
2049		
2050		function directionsSuccess(response){
2051			infoBoxInitClose();
2052            directionsDisplay.setDirections(response);
2053            if($('#DirectionType').val() == 'short') {
2054                route_index = getShort(response.routes);
2055            }else {
2056                route_index = 0;
2057            }
2058			infoBox( response.routes[route_index].legs[0].start_address,response.routes[route_index].legs[0].start_location, 'start');
2059			infoBox( response.routes[route_index].legs[0].end_address,response.routes[route_index].legs[0].end_location);
2060			
2061            directionsDisplay.setRouteIndex(route_index);
2062			
2063			locations = getLocations(response.routes[route_index].legs);
2064			width = getWidth(response.routes[route_index].legs);
2065			date = getTime(response.routes[route_index].legs);
2066			getWeather(locations);
2067
2068			
2069			$('#journey-width').empty().append(width + ' km');
2070			$('#journey-time').empty().append(date);
2071			if(! (response.routes[0].legs[0].start_location instanceof google.maps.LatLng)){
2072				response.routes[0].legs[0].start_location = new google.maps.LatLng(response.routes[0].legs[0].start_location);
2073			}
2074			if(! (response.routes[0].legs[response.routes[0].legs.length-1].end_location instanceof google.maps.LatLng)){
2075				response.routes[0].legs[response.routes[0].legs.length-1].end_location = new google.maps.LatLng(response.routes[0].legs[response.routes[0].legs.length-1].end_location);
2076			}
2077			lineLength = google.maps.geometry.spherical.computeDistanceBetween (response.routes[0].legs[0].start_location, response.routes[0].legs[response.routes[0].legs.length-1].end_location);
2078			lineLength = parseInt(parseInt(lineLength)/1000);
2079			$('#journey-line-width').empty().append(lineLength + ' km');
2080			
2081			
2082			
2083			addAlternatives(response.routes.length);
2084			showFullDiv();
2085			showFullMap();
2086		}
2087		if(waypts.length > 0){
2088			directionsService.route(request, function(response, status) {
2089	    
2090			  if (status == google.maps.DirectionsStatus.OK) {
2091				directionsSuccess(response)
2092			  }
2093			});
2094			return;
2095		}
2096
2097		$.post('https://www.wyznaczanie-trasy.pl/routings/searchdirections', {'start': start, 'end': end})
2098		.done(function( data ) {
2099
2100			var result = JSON.parse(data);
2101			if(result.status != ''){
2102				console.log('####loadedDirections####');
2103				var response = JSON.parse(result.response);
2104				
2105				if(result.status == 'OK'){
2106					
2107					directionsSuccess(response);
2108					
2109				}else{
2110					directionsService.route(request, function(response, status) {
2111	    
2112					  if (status == google.maps.DirectionsStatus.OK) {
2113						directionsSuccess(response)
2114					  }
2115					});
2116				}
2117				
2118			}else{
2119				//call google api and save result
2120				directionsService.route(request, function(response, status) {
2121	    
2122				  if (status == google.maps.DirectionsStatus.OK) {
2123					directionsSuccess(response)
2124				  }
2125				});
2126			}
2127		});
2128        
2129      }
2130      
2131      function getShort(routs) {
2132            start = 0;
2133            route_index = 0;
2134 	    $.each(routs, function(index, value) {
2135		if(parseInt((value.legs[0].distance.value)) < start || start == 0) {
2136                    start = parseInt(value.legs[0].distance.value);
2137                    route_index = index;
2138                }
2139	    });
2140            return route_index
2141      }
2142      
2143      function getWidth(legs) {
2144	    var width = 0;
2145	    $.each(legs, function(index, value) {
2146		width += parseInt(value.distance.value);
2147	    });
2148	    width = parseInt(width/1000);
2149	    return width;
2150      
2151      }
2152      
2153      function getTime(legs) {
2154	    var time = 0;
2155	    $.each(legs, function(index, value) {
2156		time += parseInt(value.duration.value);
2157	    });
2158	    date = (new Date).clearTime().addSeconds(time).toString('H g. mm') + ' min';
2159	    return date;
2160      }
2161
2162      function getLocations(legs) {
2163	    var locations = [];
2164	    $.each(legs, function(index, value) {
2165		locations.push(value.start_address);
2166		locations.push(value.end_address);
2167		locations = locations.filter(function(elem, pos) {
2168		    return locations.indexOf(elem) == pos;
2169		})
2170//		locations.reverse();
2171	    });
2172	    return locations;
2173      }
2174      function getWeather(locations) {
2175      $('#weather-aside-widget #weather-div').empty().append('<ul class="small"></ul>');
2176	$('#weather-aside-widget').append('<ul class="small"></ul>');
2177	$.each(locations, function(index, value) {
2178          var place = value.split(',');
2179	    //geocoder.geocode( { 'address': value}, function(results, status) {
2180		//if (status == google.maps.GeocoderStatus.OK) {
2181		    var data = {};
2182		    var letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u'];
2183		    //$.each(results[0].address_components, function(index2, value) {
2184			//data[value.types[0]] = value.short_name;
2185		    //});
2186			data['locality'] = place[0];
2187		    $.ajax({
2188			type: 'POST',
2189			url: 'https://www.trasa.info/weathers/getWetherForGoogleLocation/1',
2190			data: data,
2191			success: function(data) {
2192                            if($('li span.next-day.letter-' + letters[index]).length>0) {
2193                                $('li span.next-day.letter-' + letters[index]).parents('li').remove();
2194                            }
2195			    data = data.replace('<li>', '<li><span class="next-day letter letter-' + letters[index] + '">' + letters[index] + '</span>'
2196                                    + '<span class="weather-country-name">' + place[0] + '</span>');
2197                            $('#weather-aside-widget #weather-div ul').append(data);
2198                            $('#weather-aside-widget').show();
2199			}
2200		    });
2201		//}
2202	    //});
2203	});
2204      }
2205      function addAlternatives_OLD_(length) {
2206			if (length > 0) {
2207					$('#alternatives').empty();
2208					var lineLength = google.maps.geometry.spherical.computeDistanceBetween (directionsDisplay.directions.routes[0].legs[0].start_location, 
2209										directionsDisplay.directions.routes[0].legs[directionsDisplay.directions.routes[0].legs.length-1].end_location);
2210					lineLength = parseInt(parseInt(lineLength)/1000);
2211				for (i=0; i < length; i++) {
2212						if(! (directionsDisplay.directions.routes[i].legs[0].start_location instanceof google.maps.LatLng)){
2213							directionsDisplay.directions.routes[i].legs[0].start_location = new google.maps.LatLng(directionsDisplay.directions.routes[i].legs[0].start_location);
2214						}
2215						if(! (directionsDisplay.directions.routes[i].legs[directionsDisplay.directions.routes[i].legs.length - 1].end_location instanceof google.maps.LatLng)){
2216							directionsDisplay.directions.routes[i].legs[directionsDisplay.directions.routes[i].legs.length - 1].end_location = new google.maps.LatLng(directionsDisplay.directions.routes[i].legs[directionsDisplay.directions.routes[i].legs.length - 1].end_location);
2217						}
2218						var legs = directionsDisplay.directions.routes[i].legs;
2219						$('#alternatives').append('<div class="alt-' + i + ' alternative-route ' + (i==0 ? 'active' : '') + '">'
2220								+ '<div class="route-id-div"><span class="route-id">' + (i+1) + '</span></div>'
2221								+ '<div class="route-info-div">'
2222								+ '<span class="route">' 
2223								+ legs[0].start_address + ' - '
2224								+ legs[legs.length-1].end_address + '</span>'
2225								+ '<span class="distance">Odległość drogowa: <strong id="journey-width">' + getWidth(legs) + ' km</strong></span>'
2226								+ '<span class="duration">Czas przejazdu: <strong id="journey-time">' + getTime(legs) + '</strong></span>'
2227								+ '<span class="lineDistance">Odległość w lini prostej: <strong id="journey-line-width">' + lineLength + ' km</strong></span>'
2228								+ '</div>'
2229								+ '</div>');
2230				}
2231				$('#alternatives').show();
2232			}
2233      }
2234      function checkdHighways() {
2235          if($('#DirectionAvoidHighways').is(':checked')){
2236              return true
2237          }
2238          return false
2239      }
2240      function checkdTolls() {
2241           if($('#DirectionAvoidTolls').is(':checked')){
2242              return true
2243          }
2244          return false         
2245      }
2246      function showFullDiv() {
2247	  $('#directions-panel-box .back').show().parent().show();
2248      }
2249      function showFullMap() {
2250	  directionsDisplay.setRouteIndex(directionsDisplay.routeIndex);
2251      }
2252
2253	$('#directions-panel-box .back').click(function() {
2254	    showFullMap();
2255	    return false;
2256	});
2257	$('#calculate').submit(function(){
2258  	    $.post('/directions/calculate',
2259                {'Direction' : { 
2260                    'average_fuel' : $('#DirectionAverageFuel').val(), 
2261                    'fuel_cost' : $('#DirectionFuelCost').val(), 
2262                    'trip_distance' : $('#alternatives .osm.active #journey-width').text().replace(' km', '')
2263                }}, 
2264                function(data) {
2265                    $('#calculate').html(data);
2266                });	   
2267            return false;
2268	});
2269	
2270        $(document).ready(function() {
2271            loadScript();
2272	    calcRoute(false);
2273        });
2274</script>
2274
2275		<div style="clear: both;"></div>
2276	</div>
2277	<div style="clear: both;"></div>
2278
2279        <div id='slot_bottom' style="text-align: center; margin: 10px 0;min-height: 300px;display: flex;align-items: center;justify-content: center;">
2280  
2280<script>
2281    googletag.cmd.push(function() { googletag.display('slot_bottom'); });
2282  </script>
2282
2283</div>
2284        <div id="footer">
2285			<div style="border-top: 1px solid #dbdbdb;margin:0;"></div>
2286            <a id="footer-logo" href="https://netstel.pl" target="_blank"><img src="/img/logo-foot.png" /></a>
2287            
2288            <div id="footer-menu">
2289			<a href="/strona/polityka-prywatnosci">Polityka prywatności</a>			<span class="footer-menu-sep">|</span>
2290            <a href="/strona/kontakt">Kontakt</a>
2291            <span class="footer-menu-sep">|</span>
2292            <a href="/reklama">Reklama</a>
2293            </div>
2294            <div class="clear"></div>
2295            
2296            
2297<span>&nbsp;</span>
2298
2299
2300
2301            
2302            <div id="footer-copyright">Copyright &copy; 2026 NETSTEL Software. All rights reserved</div>
2303	</div> 
2304
2305    
2305<script>
2306        if($('#footer-link-list').length){
2307
2308            $('#footer-copyright').before('<div class="mobile-footer-div"><select id="mobile-footer"><option>Wybierz serwis</option></select></div>');
2309
2310            $('#footer-link-list').find('a').each(function(index, el) {
2311                //console.log(this);
2312                $('#mobile-footer').append($("<option></option>")
2313                    .attr("value",$(this).attr('href'))
2314                    .text($(this).text())); 
2315            });
2316            $('#footer').on('change', '#mobile-footer', function(event) {
2317                event.preventDefault();
2318                
2319                if($('#mobile-footer').val()){
2320                    window.location = $('#mobile-footer').val();
2321                }
2322                
2323            });
2324
2325        }
2326        
2327	var google_key = 'AIzaSyCTGQ5N94gHJ56J_NKFBYTP6n6cR6ljuHA';
2328	var tomtom_key = 'yjHmj42YD4B1w3yCLARXR2t8kq2LkL0t';
2329    </script>
2329
2330    </div>
2331
2332    
2332<script type="text/javascript"> var _qasp = _qasp || []; _qasp.push(['setFastPAID']);</script>
2332
2333
2334    <div style="height:200px"></div>
2335                
2336		
2336<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"7162ea15b2de46058831caa1be32584f","r":1,"spa":2}' crossorigin="anonymous"></script>
2336
2337</body>
2338</html>

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.