var layers=new Array(); var layersVisibility=new Array(); var gMap; function showHideLayer(name) { if (layersVisibility[name]) { hideLayer(name); return 'off'; } else { showLayer(name); return 'on'; } } function showLayer(name) { if (layers[name]==undefined) return; layersVisibility[name]=true; for (i=0;i 0) html = html + "

" + caption + "

"; else "

" + caption + "

" //html += "
" + point; marker.openInfoWindowHtml(html); }); return marker; } GEvent.addListener(gMap, "click", function(overlay, point) { if (overlay){ //marker clicked! } else document.getElementById('coordinates').value = point.x + ',' + point.y; }); addIntoLayer('default', createMarker(new GLatLng(50.4902305556,15.1351055556), 0, 'HRAD KOST','katalog/hrad-kost/','markerA.png')); showLayer('default'); updateStatusBar(); // Mouse wheel zoom - Attach event handlers ----- gMap.enableDoubleClickZoom(); gMap.enableContinuousZoom(); GEvent.addDomListener(container, "DOMMouseScroll", wheelZoom); GEvent.addDomListener(container, "mousewheel", wheelZoom); // ---------------------------------------------- } } // Mouse wheel zoom - Event handler ----- function wheelZoom(event) { if (wheelZooming) { return; } wheelZooming = true; // zoomRect and rectIcon are global variables!!! zoomRect = new GMarker(mouseLatLng,{icon:rectIcon}); gMap.addOverlay(zoomRect); if (event.cancelable) { event.preventDefault(); } gMap.closeInfoWindow(); if((event.detail || -event.wheelDelta) < 0) { window.setTimeout(function(){ gMap.removeOverlay(zoomRect); gMap.zoomIn(mouseLatLng,true,true); wheelZooming = false; },200); } else { window.setTimeout(function(){ gMap.removeOverlay(zoomRect); gMap.zoomOut(mouseLatLng,true); wheelZooming = false; },200); } return false; } // End event handler ----- // Nothing related to mouse wheel zoom below this line --------------------------- function moveEnd() { updateStatusBar(); } function zoomEnd(oldZ,zoom) { updateStatusBar(); } function updateStatusBar() { var center = gMap.getCenter(); var zoom = gMap.getZoom(); var bounds = gMap.getBounds(); var SW = bounds.getSouthWest(); var NE = bounds.getNorthEast(); var oCoords = document.getElementById("coords"); //oCoords.innerHTML = 'Map center: (' + center.y.toFixed(6) + ',' + center.x.toFixed(6) + ') - zoom: ' + zoom; //oCoords.innerHTML += '
'; //oCoords.innerHTML += 'SW: ' + SW.y.toFixed(6) + ', ' + SW.x.toFixed(6); //oCoords.innerHTML += '
'; //oCoords.innerHTML += 'NE: ' + NE.y.toFixed(6) + ', ' + NE.x.toFixed(6); } function resizeMap() { //container.style.width = document.body.clientWidth - 180 + 'px'; //container.style.height = document.body.clientHeight - 100 + 'px'; if (gMap) { gMap.checkResize(); } } function mouseMove(mousePt) { mouseLatLng = mousePt; var zoom = gMap.getZoom(); var oStatusDiv = document.getElementById("mouseTrack") var mousePx = normalProj.fromLatLngToPixel(mousePt, zoom); //oStatusDiv.innerHTML = 'Mouse LatLng: ' + mousePt.y.toFixed(6) + ', ' + mousePt.x.toFixed(6) ; //oStatusDiv.innerHTML += '
'; //oStatusDiv.innerHTML += 'Mouse Px: ' + mousePx.x + ', ' + mousePx.y; //oStatusDiv.innerHTML += '
'; //oStatusDiv.innerHTML += 'Tile: ' + Math.floor(mousePx.x / 256) + ', ' + Math.floor(mousePx.y / 256); } window.addEvent('load', function() { initialize(); }); window.addEvent('unload', function() { GUnload(); });