Hello

This is the first Google Map app i have created and my javascript
skill are limited (more a php guy)

When the page loads it loads upto 5 markers onto a map (definded by
php if conditions that echo javascript code), everything works find
other then getting the map to zoom out to show all 5 markers on the
map at the same time.

I have been playing with my script for days, changing its structure
and functions etc.

When the pages loads it does the map as it should with out the map
zooming out, the status bar shows the error on page warning.

this is my script as it stands

<script type="text/javascript">
function initialize() {
        if (GBrowserIsCompatible()) {
                var map = new GMap2(document.getElementById("map_canvas"));
                map.setCenter(new GLatLng(53.4989705,-2.1118907), 13);
                var bounds = new GLatLngBounds();
                var location = new GLatLng(53.4989705,-2.1118907);
                var marker = new GMarker(location);
                marker.value = 1;
                GEvent.addListener(marker, "click", function() {
                var myHtml = "<b>#" + "1" + "</b><br/>" + "Your search 
location";
                map.openInfoWindowHtml(location, myHtml);
                });
                map.addOverlay(marker);
                bounds.extend(location);
                var location2 = new GLatLng(53.5390200,-2.1297100);
                createMarker(location2,2,"Booth House ");
                        bounds.extend(location2);
                createMarker(new GLatLng(53.7462530,-1.5942410),3,"City Mills   
        ");
                function createMarker(point, number, message) {
                        var marker = new GMarker(point);
                        marker.value = number;
                        GEvent.addListener(marker, "click", function() {
                        var myHtml = "<b>#" + number + "</b><br/>" + message;
                        map.openInfoWindowHtml(point, myHtml);
                        });
                        map.addOverlay(marker);
                }
                map.setUIToDefault();
                zoomfit();
                function zoomfit() {
                        newzoom = getBoundsZoomLevel(bounds);
                        newcenter = bounds.getCenter();
                        map.setCenter (newcenter,newzoom);
                }
        }
}
</script>


any help would be greatfull as i really need this working and its been
days.

Thank you!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to