<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="edge">
<style type="text/css">
.gm-style-ti * {
        color: red;
    }
.labels {   
color: red;   
background-color: white;   
font-family: "Verdana", "Arial", sans-serif !important;   
font-size: 10px;   
font-weight: normal;   
text-align: left;   
border: 2px solid black;   
white-space: nowrap;
}

</style>
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes" /> 
<script src="https://cdn.jsdelivr.net/json3/3.3.2/json3.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyArYoC31O3PcQ2dix3LxqvWzLg-ka0ZZ-Y&&language=cs&v=3.10&sensor=true"></script> 
<script type="text/javascript">   
var geocoder;
var map;
var trafficLayer;
var bikeLayer;
var markersArray = [];
function initialize() {
        geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(49.2525855, 16.5884501);
        var myOptions = {
                zoom: 8,
                mapTypeId: '#typ_mapy#',
                disableDefaultUI: true
        };
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);        
        trafficLayer = new google.maps.TrafficLayer();
        bikeLayer = new google.maps.BicyclingLayer();
        map.set("streetViewControl", false);
        #0# 
        codeAddressC("Svitavy", "Center");
        #1#
}
function wait(ms) {
        var start = new Date().getTime();
        var end = start;
        while (end < start + ms) {
                end = new Date().getTime();
        }
}
function showAddress(address) {
        if (geocoder) {
                geocoder.getLatLng(address, function(point) {
                        if (!point) {
                                alert(address + " not found");
                        } else {
                                map.setCenter(point, 15);
                                var marker = new GMarker(point, {
                                        draggable: true
                                });
                                map.addOverlay(marker);
                                GEvent.addListener(marker, "dragend", function() {
                                        marker.openInfoWindowHtml(marker.getLatLng().toUrlValue(6));
                                });
                                GEvent.addListener(marker, "click", function() {
                                        marker.openInfoWindowHtml(marker.getLatLng().toUrlValue(6));
                                });
                                GEvent.trigger(marker, "click");
                        }
                });
        }
}
function codeAddressC(address) {
        wait(500);
        if (geocoder) {
                geocoder.geocode({
                        address: address
                }, function(results, status) {
                        if (status == google.maps.GeocoderStatus.OK) {
                                map.setCenter(results[0].geometry.location);
                        } else {
                                alert("Neznam: " + address);
                        }
                });
        }
}
function codeAddress(address) {
        wait(500);
        if (geocoder) {
                geocoder.geocode({
                        address: address
                }, function(results, status) {
                        if (status == google.maps.GeocoderStatus.OK) {
                                var marker = new google.maps.Marker({
                                        position: results[0].geometry.location,
                                        label: address,
                                        icon: "http://www.mdsoft.cz/point.png",
                                        zIndex: 100,
                                        optimized: false,
                                        title: address
                                });
                                marker.setMap(map);
                        } else {
                                alert("Neznam: " + address);
                        }
                });
        }
}
function codeAddress2(coord1, coord2, co, kde, ident) {
        var icon = {
                url: "http://www.mdsoft.cz/kam.png",
                scaledSize: new google.maps.Size(15, 25)
        };
        var marker = new google.maps.Marker({
                position: new google.maps.LatLng(coord1, coord2),
                icon: icon,
                label: {
                        text: " ",
                        fontColor: "red",
                        fontSize: "5px"
                },
                labelVisible: false,
                optimized: true,
                zIndex: 1,
                title: co
        });
//        marker.setLabel("0");
//        marker.set("labelVisible", false);
        google.maps.event.addListener(marker, "click", function(event) {
                var atext = this.getTitle();
                if (atext.substring(0,1) != "+") {               //"0") {
                        document.getElementById("identrad").value = "A" + ident;
                        this.setIcon("http://www.mdsoft.cz/kamhot.png");
//                        this.setLabel("1");
                        this.setTitle("+" + this.getTitle());
//                        this.set("labelVisible", false);
                } else {
                        document.getElementById("identrad").value = "Z" + ident;
                        this.setIcon(icon);
//                        this.setLabel("0");
                        this.setTitle(atext.substring(1,1000));
//                        this.set("labelVisible", false);
                }
        });
        marker.setMap(map);
}
function GotoLatLng(Lat, Lang) {
        var latlng = new google.maps.LatLng(Lat, Lang);
        map.setCenter(latlng);
        PutMarker(Lat, Lang, Lat + "," + Lang);
}
function ClearMarkers() {
        if (markersArray) {
                for (i in markersArray) {
                        markersArray[i].setMap(null);
                }
        }
}
function PutMarker(Lat, Lang, Msg) {
        var latlng = new google.maps.LatLng(Lat, Lang);
        var marker = new google.maps.Marker({
                position: latlng,
                map: map,
                title: Msg + " (" + Lat + "," + Lang + ")"
        });
        markersArray.push(marker);
}
function TrafficOn() {
        trafficLayer.setMap(map);
}
function TrafficOff() {
        trafficLayer.setMap(null);
}
function BicyclingOn() {
        bikeLayer.setMap(map);
}
function BicyclingOff() {
        bikeLayer.setMap(null);
}
function StreetViewOn() {
        map.set("streetViewControl", true);
}
function StreetViewOff() {
        map.set("streetViewControl", false);
} 
</script> 
</head> 
<body onload="initialize()" >   
<div id="map_canvas" style="width:100%; height:100%;font-family:Verdana;"></div>   
<div id="identr">   <input type="hidden" id="identrad" >  </div>  
</body> 
</html> 
