var lslPageName = "default"; var hasMediaPlayer = false; var openInPopup = false; var trackMarkers = []; var gpsiesMarkers = []; var webcamsMarkers = []; var wikipediaLayer = null; var youtubeLayer = null; var panoramioLayer = null; var enableWikipediaLayerAtStartup = false; var enablePanoramioLayerAtStartup = false; var enableYoutubeLayerAtStartup = false; var currentTrackOverlay = null; var currentRouteOverlay = null; var dontReloadUponNextMove = false; var sportTranslations = new Object(); var infoWindow = new google.maps.InfoWindow(); function openInfoWindowHtml(text, marker, map) { infoWindow.setContent(text), infoWindow.open(map, marker); } function closeInfoWindow() { infoWindow.close(); } function ajaxPost(url, data, callback) { var passData = data; var AJAX = null; if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject("Microsoft.XMLHTTP"); } if (AJAX==null) { return false } else { AJAX.open("POST", url, true); AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); AJAX.onreadystatechange = function() { if (AJAX.readyState==4 || AJAX.readyState=="complete") { callback(AJAX.responseText, AJAX.status); } } AJAX.send(passData); return true; } } sportTranslations['ball-playing']='Ballspielen' sportTranslations['canoeing']='Kanufahren' sportTranslations['climbing']='Klettern' sportTranslations['cross-country-skiing']='Langlaufen' sportTranslations['cycling']='Radfahren' sportTranslations['driving']='Autofahren' sportTranslations['drone-flying']='Drohnenflug' sportTranslations['ebike']='E-Bike' sportTranslations['fitness-training']='Fitness-Training' sportTranslations['geocaching']='Geocaching' sportTranslations['golfing']='Golfen' sportTranslations['hiking']='Wandern' sportTranslations['ice-skating']='Schlittschuhlaufen' sportTranslations['motorcycling']='Motorrad fahren' sportTranslations['mountainbiking']='Mountainbiken' sportTranslations['mushing']='Hundeschlitten fahren' sportTranslations['nordic-walking']='Nordic Walking' sportTranslations['promenading']='Spazieren gehen' sportTranslations['race-biking']='Rennrad fahren' sportTranslations['resting']='Ausruhen' sportTranslations['riding']='Reiten' sportTranslations['rollerblading']='Rollerbladen' sportTranslations['rowing']='Rudern' sportTranslations['running']='Jogging' sportTranslations['sailing']='Segeln' sportTranslations['sightseeing']='Sightseeing' sportTranslations['skiing']='Skifahren' sportTranslations['ski-touring']='Skitouren gehen' sportTranslations['sledding']='Schlittenfahren' sportTranslations['snowboarding']='Snowboarden' sportTranslations['snowshoeing']='Schneeschuhwandern' sportTranslations['soaring']='Segelfliegen' sportTranslations['spinning']='Spinning' sportTranslations['stand-up-paddling']='Stand Up Paddling' sportTranslations['stretching']='Stretching' sportTranslations['swimming']='Schwimmen' sportTranslations['walking']='Walking' sportTranslations['weightlifting']='Gewichtheben' sportTranslations['windsurfing']='Windsurfen' function translateSport(sport) { var sportT = sportTranslations[sport]; if( sportT != null && sportT.length > 0 ) return sportT; else return sport; } function persistLayerOnOff(pageName, layerName, isSwitchedOn) { var url = "/services/setBooleanUserParameter.jsp"; var data = "name=" + layerName + "_" + pageName + "&value=" + (isSwitchedOn?"true":"false"); ajaxPost(url, data, function(data, responseCode) { var xml = parseXml(data); var messages = xml.documentElement.getElementsByTagName("message"); var message = messages[0].getAttribute("content"); if( message.indexOf("Error:") >= 0 ) { alert(message); } else { reloadTracks(map); if( pageName == "routePlanner" ) { // RoutePlanner manages its own placemarks rethinkOverlays(); } } }); } function getBoundingBox(domElement) { var offsetWidth = domElement.offsetWidth; var offsetHeight = domElement.offsetHeight; for (var lx = 0, ly = 0; domElement != null; lx += domElement.offsetLeft - domElement.scrollLeft, ly += domElement.offsetTop - domElement.scrollTop, domElement = domElement.offsetParent); return { x:lx, y:ly, w:offsetWidth, h:offsetHeight, toString: function() { return "x = " + this.x + ", y = " + this.y + ", w = " + this.w + ", h = " + this.h; } }; } function setLayerSelectionLayerSize() { var mapDiv = document.getElementById("map"); var mapBB = getBoundingBox(mapDiv); var layersSelectionLayerDiv = document.getElementById("layersSelectionLayer"); var layersSelectionCloseLayerDiv = document.getElementById("layersSelectionCloseLayer"); var layersSelectionOpenLayerDiv = document.getElementById("layersSelectionOpenLayer"); var layersSelectionInfoMessageDiv = document.getElementById("message"); var width = 250; // mapBB.w / 4; var closeLayerHeight = 35; layersSelectionLayerDiv.style.top = (closeLayerHeight + mapBB.y + closeLayerHeight) + 'px'; layersSelectionLayerDiv.style.left = (mapBB.x + mapBB.w - width) + 'px'; layersSelectionLayerDiv.style.width = width + 'px'; layersSelectionLayerDiv.style.height = (mapBB.h - closeLayerHeight - closeLayerHeight) + 'px'; layersSelectionCloseLayerDiv.style.top = (mapBB.y + closeLayerHeight) + 'px'; layersSelectionCloseLayerDiv.style.left = (mapBB.x + mapBB.w - width) + 'px'; layersSelectionCloseLayerDiv.style.width = width + 'px'; layersSelectionCloseLayerDiv.style.height = closeLayerHeight + 'px'; layersSelectionOpenLayerDiv.style.top = (mapBB.y + closeLayerHeight) + 'px'; layersSelectionOpenLayerDiv.style.left = (mapBB.x + mapBB.w - 90) + 'px'; layersSelectionOpenLayerDiv.style.visibility = 'visible'; layersSelectionInfoMessageDiv.style.top = (mapBB.y + mapBB.h - 30) + 'px'; layersSelectionInfoMessageDiv.style.left = (mapBB.x + mapBB.w - 610) + 'px'; layersSelectionInfoMessageDiv.style.visibility = 'visible'; } function closeLayersSelectionLayer() { var layersSelectionLayerDiv = document.getElementById("layersSelectionLayer"); var layersSelectionCloseLayerDiv = document.getElementById("layersSelectionCloseLayer"); layersSelectionLayerDiv.style.visibility = 'hidden'; layersSelectionCloseLayerDiv.style.visibility = 'hidden'; } function openLayersSelectionLayer() { var layersSelectionLayerDiv = document.getElementById("layersSelectionLayer"); var layersSelectionCloseLayerDiv = document.getElementById("layersSelectionCloseLayer"); layersSelectionLayerDiv.style.visibility = 'visible'; layersSelectionCloseLayerDiv.style.visibility = 'visible'; } function showWikipediaLayer(show){ } function showYoutubeLayer(show){ if(show){ if(youtubeLayer == null ) { youtubeLayer = new GLayer("com.youtube.all"); } map.addOverlay(youtubeLayer); } else { if(youtubeLayer) { if( youtubeLayer != null ) { map.removeOverlay(youtubeLayer); youtubeLayer = null; } } } } function showPanoramioLayer(show){ if(show){ if(panoramioLayer == null) { panoramioLayer = new google.maps.panoramio.PanoramioLayer(); } panoramioLayer.setMap(map); } else { if(panoramioLayer) { if( panoramioLayer != null ) { panoramioLayer.setMap(null); panoramioLayer = null; } } } } function setLSLParams(lslPageName_, hasMediaPlayer_, openInPopup_) { lslPageName = lslPageName_; hasMediaPlayer = hasMediaPlayer_; openInPopup = openInPopup_; } // called in onload function initLayers() { if( enableWikipediaLayerAtStartup ) showWikipediaLayer(true); if( enablePanoramioLayerAtStartup ) showPanoramioLayer(true); if( enableYoutubeLayerAtStartup ) showYoutubeLayer(true); } function reloadTracks(map) { if( dontReloadUponNextMove ) { dontReloadUponNextMove = false; return; } document.getElementById("message").innerHTML = 'aktualisiere ...'; var bounds = map.getBounds(); if( bounds == null ) return; var minLat = bounds.getSouthWest().lat(); var maxLat = bounds.getNorthEast().lat(); var minLng = bounds.getSouthWest().lng(); var maxLng = bounds.getNorthEast().lng(); //document.getElementById("message").innerHTML = minLat + " " + maxLat + " " + minLng; var url = "/services/tracksCSV_V5.jsp?lslPageName=" + lslPageName + "&minLat=" + minLat + "&maxLat=" + maxLat + "&minLng=" + minLng + "&maxLng=" + maxLng; ajaxPost(url, "", function(data, responseCode) { for (var i = 0; i < trackMarkers.length; i++) { //map.removeOverlay(trackMarkers[i]); trackMarkers[i].setMap(null); } trackMarkers.length = 0; var trackCount = 0; var routeCount = 0; var photoCount = 0; var videoCount = 0; var audioCount = 0; var userCount = 0; var placemarkCount = 0; for(;;) { if( data == null || data.length == 0 ) break; var line = ""; var p = data.indexOf("\n"); if( p < 0 ) p = data.indexOf("\r"); if( p >= 0 ) { line = data.substring(0, p); data = data.substring(p + 1); } else { line = data; data = ""; } line = trim(line); if( line.length == 0 ) continue; // dos compatibility if (line.substring(line.length - 1,line.length) == '\r') { line = line.substring(0,line.length - 1); } var f = line.split("|"); if( f.length < 4 ) continue; var type = f[0]; var lat = f[1]; var lng = f[2]; var point = new google.maps.LatLng(parseFloat(lat), parseFloat(lng)); if(type == 'T') { var marker = createTrackMarker(point, f, map); trackCount++; } else { if(type == 'R') { var marker = createRouteMarker(point, f, map); routeCount++; } else { if(type == 'U') { var marker = createUserMarker(point, f, map); userCount++; } else { if(type == 'V') { var marker = createVideoMarker(point, f, map); videoCount++; } else { if(type == 'A') { var marker = createAudioMarker(point, f, map); audioCount++; } else { if(type == 'W') { var marker = createPlacemarkMarker(point, f, map); placemarkCount++; } else { if(type == 'O') { var marker = createOutdooractiveMarker(point, f, map); routeCount++; } else { var marker = createPhotoMarker(point, f, map); photoCount++; } } } } } } } trackMarkers.push(marker); //TODO map.addOverlay(marker); } var infoText = ""; infoText += ((trackCount==50)?">":"") + trackCount + ' Tracks '; infoText += ((routeCount==50)?">":"") + routeCount + ' Routen ' infoText += ((photoCount==50)?">":"") + photoCount + ' Fotos '; infoText += ((audioCount==50)?">":"") + audioCount + ' Audios '; infoText += ((videoCount==50)?">":"") + videoCount + ' Videos '; infoText += ((userCount==50)?">":"") + userCount + ' Leute '; if( trackCount == 50 || routeCount == 50 || photoCount == 50 || audioCount == 50 || videoCount == 50 || userCount == 50 ) infoText += '- hineinzoomen für mehr'; document.getElementById("message").innerHTML = infoText; writeCookie("lat", map.getCenter().lat(), 60); writeCookie("lng", map.getCenter().lng(), 60); writeCookie("zoom", map.getZoom(), 60); }); reloadGPSies(map); reloadWebcams(map); } function makeTrainingUri(title, sport, trainingID) { var uri = title; if( title == null || title.length == 0 ) uri = sport; if( uri.length > 64 ) uri = uri.substr(0, 64); uri = uri.replace(/[\/\?\%\&\;\"\\ ]/g, "-"); uri = uri.replace(/--/g, "-"); uri = uri.replace(/--/g, "-"); uri = uri.replace(/--/g, "-"); return "/trainings/" + encodeURI(uri) + "_" + trainingID; } function createPlacemarkMarker(point, f, map) { var placemarkSubType = f[3]; var placemarkID = f[4]; var title = f[5]; var ownerName = f[6]; var url = f[7]; var description = f[8]; var pmMarker = new google.maps.Marker({ position: point, icon: getIcon("wp_" + placemarkSubType.toLowerCase()), map: map } ); var text = "
" + "" + title + "
" + description + "
"; if( url != null && url.length != 0 ) { text += "" + url + "
"; } text += "
"; if( userName != undefined ) if( userName != null && userName.length > 0 && userName != 'null' && userName != 'anonymous' ) { text += "Ortsmarke in den Download-Warenkorb legen
"; } text += "Als GPX-Datei herunterladen
"; text += "Als KML-Datei herunterladen
"; text += "
"; google.maps.event.addListener(pmMarker, "click", function() { openInfoWindowHtml(text, pmMarker, map); dontReloadUponNextMove = true; }); return pmMarker; } function putPlacemarkToCart(placemarkID) { if( userName == null || userName.length == 0 || userName == 'null' ) { alert('Sie müssen eingeloggt sein, um diese Aktion durchzuführen.'); return; } var url = "/routePlanner/services/putItemToCart.jsp?r=" + Math.random() + "&linkedObjectID=" + placemarkID + "&userName=" + userName + "&itemType=placemark"; ajaxPost(url, "", function(data, responseCode) { var xml = parseXml(data); var messages = xml.documentElement.getElementsByTagName("message"); var message = messages[0].getAttribute("content"); if( message.indexOf("Error:") >= 0 ) { alert(message); } else { alert('Ortsmarke wurde in den Download-Warenkorb gelegt.'); updateCartShortInfo(); } }); } function createTrackMarker(point, f, map) { var trainingID = f[3]; var userName = f[4]; var trainingMonthDir = f[5]; var trainingDir = f[6]; var title = f[7]; var sport = f[8]; var distanceKM = f[9]; var distanceMI = f[10]; var duration = f[11]; var firstPhotoIndex = parseInt(f[12]); var distanceStr = '' + distanceKM+' km'; //var marker = new google.maps.Marker(point, getSportIcon(sport)); var marker = new google.maps.Marker({ position: point, icon: getSportIcon(sport), map: map } ); var text = "
"; text += "GPS-Sport.net Training " + title + "
"; text += " "; //text += " "; text += "" + "" + "" + "" + "" + "
Sportart: " + translateSport(sport) + "
Sportler: " + userName + "
Distanz: " + distanceStr + "
Dauer: " + duration + "

"; if( firstPhotoIndex > 0 ) text += "
"; //if( parseInt(trainingID) > 60000 ) // text += "
"; var targetTxt = openInPopup?"target='_blank'":""; text += "
Details anzeigen"; text += "
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; // read polyline document.getElementById("message").innerHTML = "Track wird geladen ..."; var url = "/services/trackPolyline.jsp?trainingID=" + trainingID; ajaxPost(url, "", function(data, responseCode) { var encodedPolyline = ""; var encodedPolylineLevels = ""; var p = data.indexOf("\n"); if( p < 0 ) p = data.indexOf("\r"); if( p >= 0 ) { encodedPolyline = trim(data.substring(0, p)).replace(/\\\\/g, "\\"); data = data.substring(p + 1); } p = data.indexOf("\n"); if( p < 0 ) p = data.indexOf("\r"); if( p >= 0 ) { encodedPolylineLevels = trim(data.substring(0, p)); } if( currentTrackOverlay != null ) currentTrackOverlay.setMap(null);; if( encodedPolyline.length > 0 ) { currentTrackOverlay = createTrackPolyline(encodedPolyline, encodedPolylineLevels, "#3B00C0"); currentTrackOverlay.setMap(map); } document.getElementById("message").innerHTML = "fertig"; }); }); return marker; } function createOutdooractiveMarker(point, f, map) { var tourID = f[3]; var title = f[4]; var description = f[5]; var sport = f[6]; var thumbnailURL = f[7]; var url = f[8]; var distanceKM = f[9]; var distanceMI = f[10]; var duration = f[11]; var ascentM = f[12]; var ascentFT = f[13]; var descentM = f[14]; var descentFT = f[15]; var difficulty = f[16]; var distanceStr = '' + distanceKM+' km'; var ascentStr = '' + ascentM+' m'; var descentStr = '' + descentM+' m'; var difficultyStr = "leicht"; if( difficulty == '2' ) difficultyStr = "mittel"; if( difficulty == '3' ) difficultyStr = "schwierig"; var marker = new google.maps.Marker({ position: point, icon: getOutdooractiveRouteIcon(sport), map: map } ); var text = "
"; var openOutdooractiveJS = "openOutdooractiveWindow(\"" + url + "\")"; text += "" + title + "

"; text += "
"; text += "" + "" + "" + "" + "" + "" + "" + "
Sportart: " + translateSport(sport) + "
Distanz: " + distanceStr + "
Dauer: " + duration + "
Aufstieg: " + ascentStr + "
Abstieg: " + descentStr + "
Schwierigkeit: " + difficultyStr + "
"; text += "
" + description + "
"; text += "
Powered by outdooractive"; text += "
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; }); return marker; } function openOutdooractiveWindow(url) { window.open(url, "outdooractive", ""); } function createPhotoMarker(point, f, map) { var marker = new google.maps.Marker({ position: point, icon: getIcon("photo_small"), map: map } ); var trainingID = f[3]; var trainingObjectID = f[4]; var userName = f[5]; var trainingMonthDir = f[6]; var trainingDir = f[7]; var index = f[8]; var image = "/home/" + getUserSubDir(userName) + "/" +userName + "/" + trainingMonthDir + "/" + trainingDir + "/thumb_" + index + ".jpg"; var text = "" + "
" + "" + ""; if( hasMediaPlayer ) text += "" + "Media-Player starten
"; var targetTxt = openInPopup?"target='_blank'":""; text += "" + "Training anzeigen"; "
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; }); return marker; } function createVideoMarker(point, f, map) { var marker = new google.maps.Marker({ position: point, icon: getIcon("video"), map: map }); var trainingID = f[3]; var trainingObjectID = f[4]; var userName = f[5]; var trainingMonthDir = f[6]; var trainingDir = f[7]; var index = f[8]; var file = "/home/" + getUserSubDir(userName) + "/" + userName + "/" + trainingMonthDir + "/" + trainingDir + "/_video_" + index + ".flv"; var text = "

"; if( hasMediaPlayer ) text += "" + "Media-Player starten"; var targetTxt = openInPopup?"target='_blank'":""; text += "" + "" + "Training anzeigen"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; }); return marker; } function createAudioMarker(point, f, map) { var marker = new google.maps.Marker({ position: point, icon: getIcon("audio"), map: map }); var trainingID = f[3]; var trainingObjectID = f[4]; var userName = f[5]; var trainingMonthDir = f[6]; var trainingDir = f[7]; var index = f[8]; var file = "/home/" + getUserSubDir(userName) + "/" + userName + "/" + trainingMonthDir + "/" + trainingDir + "/_audio_" + index + ".mp3"; var text = "

"; if( hasMediaPlayer ) text += "" + "Media-Player starten"; var targetTxt = openInPopup?"target='_blank'":""; text += "" + "" + "Training anzeigen"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; }); return marker; } function makeRouteUri(title, routeID) { var uri = title; if( title == null || title.length == 0 ) uri = "x"; if( uri.length > 64 ) uri = uri.substr(0, 64); uri = uri.replace(/[\/\?\%\&\;\"\\ ]/g, "-"); uri = uri.replace(/--/g, "-"); uri = uri.replace(/--/g, "-"); uri = uri.replace(/--/g, "-"); return "/routes/" + encodeURI(uri) + "_" + routeID; } function createRouteMarker(point, f, map) { var routeID = f[3]; var userName = f[4]; var title = f[5]; var sport = f[6]; var cityName = f[7]; var countryName = f[8]; var distanceKM = f[9]; var distanceMI = f[10]; var ascentM = f[11]; var ascentFT = f[12]; var descentM = f[13]; var descentFT = f[14]; var distanceStr = '' + distanceKM+' km'; var ascentStr = '' + ascentM+' m'; var descentStr = '' + descentM+' m'; var routeIcon = null; if( sport == null || sport.length == 0 || sport == "null") { sport = "unbekannt"; routeIcon = getIcon('rt_default'); } else { routeIcon = getRouteIcon(sport); } var marker = new google.maps.Marker({ position: point, icon: routeIcon, map: map } ); var text = "
"; text += "GPS-Sport Navigations-Route
" + title + "


"; //text += // " "; text += "" + "" + "" + "" + "" + "" + "
Ort: " + cityName + " (" + countryName + ")
Sportler: " + userName + "
Sportart: " + translateSport(sport) + "
Distanz: " + distanceStr + "
Aufstieg: " + ascentStr + "
Abstieg: " + descentStr + "

"; //text += "

"; var targetTxt = openInPopup?"target='_blank'":""; text += " Details anzeigen"; text += "
Im Routenplaner öffnen" + "
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; // read polyline document.getElementById("message").innerHTML = "Track wird geladen ..."; var url = "/services/routePolyline.jsp?routeID=" + routeID; ajaxPost(url, "", function(data, responseCode) { var encodedPolyline = ""; var encodedPolylineLevels = ""; var p = data.indexOf("\n"); if( p < 0 ) p = data.indexOf("\r"); if( p >= 0 ) { encodedPolyline = trim(data.substring(0, p)).replace(/\\\\/g, "\\"); data = data.substring(p + 1); } p = data.indexOf("\n"); if( p < 0 ) p = data.indexOf("\r"); if( p >= 0 ) { encodedPolylineLevels = trim(data.substring(0, p)); } if( currentRouteOverlay != null ) currentRouteOverlay.setMap(null);; if( encodedPolyline.length > 0 ) { currentRouteOverlay = createTrackPolyline(encodedPolyline, encodedPolylineLevels, "#C0003B"); currentRouteOverlay.setMap(map); } document.getElementById("message").innerHTML = "fertig"; }); }); return marker; } function createUserMarker(point, f, map) { var userID = f[3]; var userName = f[4]; var iconName = f[5]; var lastSeen = f[6]; var deltaText = f[7]; deltaText = deltaText.replace("$m", "Minuten"); deltaText = deltaText.replace("$h", "Stunden"); deltaText = deltaText.replace("$d", "Tage"); lastSeen += " (" + deltaText + " " + "zurück" + ")"; var marker = new google.maps.Marker({ position: point, icon: getIcon(iconName) }); var targetTxt = openInPopup?"target='_blank'":""; var text = "" + //"" + "
" + userName + "
" + "Zuletzt gesehen: " + lastSeen + "
" + "Benutzer-Homepage öffnen
" + //"
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; }); return marker; } function createTrackPolyline(markerNode) { var encodedPoints = markerNode.getAttribute("polyline"); var encodedLevels = markerNode.getAttribute("polylineLevels"); return createTrackPolyline(encodedPoints, encodedLevels); } function createTrackPolyline(encodedPoints, encodedLevels, trackColor) { var polyline = new google.maps.Polyline({ geodesic: true, strokeColor: trackColor, strokeOpacity: 1.0, strokeWeight: 4, path: google.maps.geometry.encoding.decodePath(encodedPoints) }); return polyline; } function createMarker(point, text, map) { var marker = new google.maps.Marker({ position: point, map: map } ); googl.maps.events.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); }); return marker; } function reloadGPSies(map) { if( !document.forms.lslForm.lslGPSies.checked ) { for (var i = 0; i < gpsiesMarkers.length; i++) { gpsiesMarkers[i].setMap(null);; } return; } var bounds = map.getBounds(); var minLat = bounds.getSouthWest().lat(); var maxLat = bounds.getNorthEast().lat(); var minLng = bounds.getSouthWest().lng(); var maxLng = bounds.getNorthEast().lng(); var url = "/layersSelectionLayer/lslProxy_V1.jsp?t=g&BBOX=" + minLng + "," + minLat + "," + maxLng + "," + maxLat + "&limit=50&filetype=kml&device=Run.GPS" + "&pageName=" + lslPageName; ajaxPost(url, "", function(data, responseCode) { for (var i = 0; i < gpsiesMarkers.length; i++) { //map.removeOverlay(gpsiesMarkers[i]); gpsiesMarkers[i].setMap(null); } gpsiesMarkers.length = 0; data = trim(data); var p = data.indexOf('<'); if( p > 0 ) data = data.substring(p); var xml = parseXml(data); var tracks = xml.documentElement.getElementsByTagName("track"); for (i=0; i < tracks.length; i++) { createGPSiesMarker(xml, i, map); } }); } function createGPSiesMarker(xml, i, map) { var track = xml.documentElement.getElementsByTagName('track').item(i); var descNode = track.getElementsByTagName('description').item(0); var description = "-"; if( descNode ) description = descNode.firstChild.data; var fileID = xml.documentElement.getElementsByTagName('fileId').item(i).firstChild.data; var title = xml.documentElement.getElementsByTagName('title').item(i).firstChild.data; var lat = xml.documentElement.getElementsByTagName('startPointLat').item(i).firstChild.data; var lng = xml.documentElement.getElementsByTagName('startPointLon').item(i).firstChild.data; var distanceM = parseFloat(xml.documentElement.getElementsByTagName('trackLengthM').item(i).firstChild.data); var point = new google.maps.LatLng(parseFloat(lat), parseFloat(lng)); var marker = new google.maps.Marker({ position: point, icon: getIcon("gpsies-cow"), map: map } ); var text = "
" + "" + title + "
" + "Distanz: " + formatDistanceKM(distanceM / 1000.0) + " km
" + "Beschreibung: " + description + "
"; text += "
"; text += "powered by GPSies.com
"; text += "
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); dontReloadUponNextMove = true; }); gpsiesMarkers.push(marker); } function reloadWebcams(map) { if( !document.forms.lslForm.lsl_webcams.checked ) { for (var i = 0; i < webcamsMarkers.length; i++) { webcamsMarkers[i].setMap(null);; } return; } var bounds = map.getBounds(); var minLat = bounds.getSouthWest().lat(); var maxLat = bounds.getNorthEast().lat(); var minLng = bounds.getSouthWest().lng(); var maxLng = bounds.getNorthEast().lng(); var url = "/layersSelectionLayer/lslWebcamsProxy.jsp?" + "maxLat=" + maxLat + "&" + "maxLng=" + maxLng + "&" + "minLat=" + minLat + "&" + "minLng=" + minLng; ajaxPost(url, "", function(data, responseCode) { for (var i = 0; i < webcamsMarkers.length; i++) { webcamsMarkers[i].setMap(null); } webcamsMarkers.length = 0; for(;;) { if( data == null || data.length == 0 ) break; var line = ""; var p = data.indexOf("\n"); if( p < 0 ) p = data.indexOf("\r"); if( p >= 0 ) { line = data.substring(0, p); data = data.substring(p + 1); } else { line = data; data = ""; } line = trim(line); if( line.length == 0 ) continue; var f = line.split("|"); if( f.length < 4 ) continue; createWebcamMarker(f, map); } }); } function createWebcamMarker(f, map) { var user = f[0]; var userid = f[1]; var title = f[2]; var lat = f[3]; var lng = f[4]; var url = f[5]; var iconurl = f[6]; var point = new google.maps.LatLng(parseFloat(lat), parseFloat(lng)); var marker = new google.maps.Marker( { position: point, icon: getIcon("webcam"), map: map } ); var text = "" + title + "
" + "
" + "
" + user + "
" + "Webcams provided by webcams.travel

"; text = "
" + "" + title + "
" + "
by " + user + "
" + "Webcams provided by webcams.travel

" + "
" + "" + "" + "" + "
"; google.maps.event.addListener(marker, "click", function() { openInfoWindowHtml(text, marker, map); }); webcamsMarkers.push(marker); } function searchGoogleV3() { var address = document.forms['searchForm'].search.value; if( address != null && address.length != 0 ) showAddress(address, 13); return false; } var geocoder = new google.maps.Geocoder(); function showAddress(address, zoomLevel) { geocoder.geocode( { address: address }, function(results, status) { if (status != google.maps.GeocoderStatus.OK) { alert("Ort " + address + " nicht gefunden (Beispiele: \'London, UK\', \'New York\', \'48.123 11.123\')"); } else { var point = results[0].geometry.location; map.setCenter(point, zoomLevel); var marker = new google.maps.Marker({ position: point, map: map } ); openInfoWindowHtml(address, marker, map); reloadTracks(map); } } ); }