var mapa; var markers; var home = new Array(); var arr = { 1 : [51.1078852, 17.0385376], 2 : [53.09402405506325, 18.292236328125], 3 : [52.35547370875268, 15.281982421875], 4 : [51.7592485, 19.4559833], 5 : [51.2464536, 22.5684463], 6 : [52.2296756, 21.0122287], 7 : [50.0646501, 19.9449799], 8 : [50.670428, 17.9244381], 9 : [53.1324886, 23.1688403], 10 : [50.0409469, 21.9992806], 11 : [54.3520252, 18.6466384], 12 : [50.2648919, 19.0237815], 13 : [50.8660773, 20.6285677], 14 : [53.778422, 20.4801193], 15 : [52.406374, 16.9251681], 16 : [53.4285438, 14.5528116] } function to_txt() { var state = document.getElementById("sta_sel"); state = state.options[state.selectedIndex].value; var cat = document.getElementById("cat_sel"); cat = cat.options[cat.selectedIndex].value; var price = document.getElementById("price_edit").value; document.location="anonse,state-"+state+",category-"+cat+",price-"+price+".html"; } function info(txt) { document.getElementById("info_box").innerHTML = txt; } function addMarker(lat, lon, ico, id) { var ico1 = new GIcon(); ico1.image = "https://www.bazakoni.pl/img/mapa/"+ico+".png"; ico1.shadow = "https://www.bazakoni.pl/img/mapa/shadow.png"; ico1.iconSize = new GSize(21,31); ico1.infoWindowAnchor = new GPoint(10,35); ico1.iconAnchor = new GPoint(10,31); ico1.shadowSize = new GSize(37,31); var m = new GMarker(new GLatLng(lat,lon),{icon: ico1}); m.item = id; m.box = ""; markers.addMarker(m,0); GEvent.addListener(m,"click",function(){ if ( m.box == 0 ) { GDownloadUrl("anonse,op-get_box,id-"+m.item+".html", function(content, returnCode) { if (returnCode == 200) { m.box = content; }else{ m.box = "Błąd podczas pobierania zawartości

" m.box += "zobacz pełną treść ogłoszenia"; } m.openInfoWindowHtml(m.box); }); }else{ m.openInfoWindowHtml(m.box); } }); GEvent.addListener(m,"dblclick",function(ovr,point){ mapa.setZoom(13); mapa.panTo(point); }); return m; } function addHome() { if ( ! home[0] ) return; var ico1 = new GIcon(); ico1.image = "https://www.bazakoni.pl/img/mapa/0.png"; ico1.shadow = "https://www.bazakoni.pl/img/mapa/shadow.png"; ico1.iconSize = new GSize(21,31); ico1.infoWindowAnchor = new GPoint(10,35); ico1.iconAnchor = new GPoint(10,31); ico1.shadowSize = new GSize(37,31); var m = new GMarker(new GLatLng(home[1],home[2]),{icon: ico1}); m.box = "Twoje położenie domowe:
"+home[3]+"

"; m.box += "zmień"; markers.addMarker(m,0); GEvent.addListener(m,"click",function(){ m.openInfoWindowHtml(m.box); }); GEvent.addListener(m,"dblclick",function(ovr,point){ mapa.setZoom(13); mapa.panTo(point); }); } function state_change() { var state = document.getElementById("sta_sel"); state = state.options[state.selectedIndex].value; if ( state == 0 ){ mapa.setCenter(new GLatLng(52.0,19.5),6); }else{ mapa.setZoom(8); mapa.panTo(new GLatLng(arr[state][0], arr[state][1])); } } function cat_change() { info("Ładowanie danych, proszę czekać..."); markers.clearMarkers(); var cat = document.getElementById("cat_sel"); cat = cat.options[cat.selectedIndex].value; var price = document.getElementById("price_edit").value; GDownloadUrl('anonse,op-get_markers,category-'+cat+',price-'+price+'.html', function(content, returnCode) { if (returnCode == 200) { var xml = GXml.parse(content); var m1 = xml.documentElement.getElementsByTagName("marker"); for( var a=0; a0?0:1; deg = Math.abs(deg); var d = Math.floor(deg); var s = ((deg - Math.floor(deg))*3600); var m = Math.floor(s/60); s = (s - m*60).toFixed(2); if(s<10) s='0'+s; if(m<10) m='0'+m; var sufix = islat==0?['E','W']:['N','S']; return d+'°'+m+'\''+s+'\'\''+sufix[znak]; } function ip_center() { info("Ładowanie danych, proszę czekać..."); GDownloadUrl('anonse,op-get_own_ip.html', function(content, returnCode) { if (returnCode == 200) { var xml = GXml.parse(content); var m = xml.documentElement.getElementsByTagName("marker"); var lat = parseFloat(m[0].getAttribute("lat")); var lon = parseFloat(m[0].getAttribute("lon")); mapa.setCenter(new GLatLng(lat,lon), 10); var mar = new GMarker(new GLatLng(lat,lon)); markers.addMarker(mar,0); mar.txt = "Twój adres IP to "+m[0].getAttribute("ip"); mar.txt += "
Twoje położenie to "+deg2dms(lon,0) + " " + deg2dms(lat,1); mar.txt += " (" + m[0].getAttribute("city")+")"; mar.txt += "
Dane geolokalizacyjne dostarcza www.maxmind.com"; mar.openInfoWindowHtml(mar.txt); info("IP "+m[0].getAttribute("ip")+" Twoje położenie to "+deg2dms(lon,0) + " " + deg2dms(lat,1)+" (" + m[0].getAttribute("city")+")" ); GEvent.addListener(mar,"click",function(ovr,point){ mar.openInfoWindowHtml(mar.txt); }); }else{ info("Błąd podczas lokalizacji Twojego IP. Spróbuj ponownie później"); } }); } function go_home() { if ( ! home[0] ) return; mapa.setCenter(new GLatLng(home[1], home[2]), 9); } function baza_logo() {} baza_logo.prototype = new GControl(); baza_logo.prototype.initialize = function(mapa){ var logo = document.createElement('div'); logo.id = 'logo'; this.mapa = mapa; this.div = logo; mapa.getContainer().appendChild(logo); return logo; } baza_logo.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5, 20)); } var our_area = new GLatLngBounds(); our_area.extend(new GLatLng(49.49667452747044,13.88671875)); our_area.extend(new GLatLng(54.53223884916208,23.46679687)); function mapaStart() { if(GBrowserIsCompatible()) { mapa = new GMap2(document.getElementById("map_container")); mapa.addControl(new baza_logo()); mapa.setCenter(new GLatLng(52.0,19.5),6); mapa.addControl(new GLargeMapControl()); mapa.addControl(new GScaleControl()); mapa.addControl(new GMapTypeControl()); mapa.enableDoubleClickZoom(); mapa.enableContinuousZoom(); mapa.enableScrollWheelZoom(); var maps = mapa.getMapTypes(); for (var i=0; i maxlat) lat = maxlat; else if(lat < minlat) lat = minlat; if(lng > maxlng) lng = maxlng; else if(lng < minlng) lng = minlng; mapa.setCenter(new GLatLng(lat,lng)); } }); markers = new MarkerManager(mapa,{maxZoom: 19}); cat_change(); state_change(); } } var oldonload = window.onload; if (typeof window.onload != "function"){ window.onload = mapaStart; } else { window.onload = function(){ oldonload(); mapaStart(); } }