Hi,

Could someone help me?

I'm trying to integrate the Google User Location with the Google Store
Locator.

I've tried many combinations, but I don't manage to make it work.

I'd like 1st. to detect the User Location, if so pass the location to
the Store Locator, and if not pass a fixed map location.

Here is the working code for the User Detection:

http://allmybookings.com/userlocator.php

and here is the code, "integrated", but not really working. Any other
combinations create a conflict. This one, just goes through the User
Locator code, but prints the map.

google.load("maps", "2.x");

function load() {
      if (GBrowserIsCompatible()) {

google.setOnLoadCallback(function() {
    if (google.loader.ClientLocation) {
        var cl = google.loader.ClientLocation;
        var location = [cl.address.city, cl.address.region,
cl.address.country].join(', ');

        createMap(cl.latitude, cl.longitude, location);
    } else {
        document.getElementById('cantfindyou').innerHTML = "CAN'T FIND
YOUR LOCATION";
                            createMap(0,0,"CAN'T FIND YOUR LOCATION");

    }
});

function createMap(lat, lng, location) {
    var mapElement = document.getElementById("map");
    mapElement.style.display = 'block';
    var map = new google.maps.Map2(mapElement);
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new google.maps.LatLng(lat, lng), 13);
    map.openInfoWindow(map.getCenter(), document.createTextNode
(location));
}
        geocoder = new GClientGeocoder();
        map = new GMap2(document.getElementById('map'));
                map.enableDoubleClickZoom();
                map.enableScrollWheelZoom();
        map.addControl(new TextualZoomControl());


                var center = new GLatLng(50.,4.359491); // brussels center
50.823841,4.359491
        map.setCenter(center, 13);

                                searchLocations();
      }
    }
      GSearch.setOnLoadCallback(load);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" 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-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to