

        var personMarker = null;
        var historyPolyline = null;
        var historyPolylineBG = null;
        var historyPolylinePoints = new Array();
        var setMapToPosition = true;
        
        function reloadPosition(userName, displayUserName)
        {
            var messageDiv = document.getElementById("message");
            if(messageDiv != null) messageDiv.innerHTML = "<b>" + txt_requesting_position_info + " ...</b>";
            
            var url = "/services/positionXML.jsp?userName=" + userName + "&r=" + Math.random();
            GDownloadUrl(url, function(data, responseCode) {
                var xml = GXml.parse(data);
                var markers = xml.documentElement.getElementsByTagName("marker");
                var markerNode = markers[0];
                var lat = markerNode.getAttribute("lat");
                var lng =  markerNode.getAttribute("lng");
                var speed =  parseFloat(markerNode.getAttribute("speed"));
                var alt =  parseInt(markerNode.getAttribute("alt"));
                var heartRate =  parseInt(markerNode.getAttribute("heartRate"));
                var cadence =  parseInt(markerNode.getAttribute("cadence"));
                var distanceM =  parseInt(markerNode.getAttribute("distanceM"));
                var durationSec =  parseInt(markerNode.getAttribute("durationSec"));
                var city = markerNode.getAttribute("city");
                var country = markerNode.getAttribute("country");
                var posUpdateTimestamp = markerNode.getAttribute("posUpdateTimestamp");
                var newPos = new GLatLng(lat, lng);
                if( lat != 0.0 || lng != 0.0 )
                {
                    personMarker.setPoint(newPos);
                    if( setMapToPosition ) map.panTo(newPos);

                    if( historyPolyline != null ) map.removeOverlay(historyPolyline);
                    if( historyPolylineBG != null ) map.removeOverlay(historyPolylineBG);
                    historyPolylinePoints.push(newPos);
                    historyPolylineBG = new GPolyline(historyPolylinePoints, "#ffffff", 15, 0.5);
                    map.addOverlay(historyPolylineBG);
                    historyPolyline = new GPolyline(historyPolylinePoints, "#ff0000", 5, 0.8);
                    map.addOverlay(historyPolyline);

                    var text = "";
                    if( displayUserName ) text += userName + ": ";
                    text += lat + " " + lng + " " + txt_near + " " + city + " (" + country + ") " + txt_on + " " + posUpdateTimestamp;
                    if( alt > 0 ) text += ", Alt: " + formatAltitudeM(alt) + " m " +
                        " (" + formatAltitudeFT(alt) + " ft) ";
                    if( speed > 0 ) text += ", Spd: " + formatSpeedKMH(speed) + " km/h " +
                        " ("  + formatSpeedMPH(speed) + " mph) ";
                    if( heartRate > 0 ) text += ", HR: " + heartRate + " bpm ";
                    if( cadence > 0 ) text += ", Cad: " + (cadence / 10.0) + " /min ";
                    if( distanceM > 0 ) text += ", Dist: " +
                        formatDistanceKM(distanceM / 1000.0) + " km " +
                        " (" + formatDistanceMI(distanceM / 1000.0) + " mi) ";
                    if( durationSec > 0 ) text += ", Dur: " + formatTimeStopWatch(durationSec) + " ";
                    var posTextDiv = document.getElementById("posText");
                    if(posTextDiv != null) posTextDiv.innerHTML = text;
                }
                var messageDiv = document.getElementById("message");
                if(messageDiv != null) messageDiv.innerHTML = txt_live_tracking_update;
                window.setTimeout("reloadPosition('" + userName + "', " + displayUserName + ")", 5000);
            });
        }

    function createMarker(point, text, sport) {
        var marker = new GMarker(point, getSportIcon(sport));
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(text);
        });
        return marker;
    }

