Hi guys,

really new to this so excuse my bad code but i'm looking to have a map
where a user can click a point ie where they live and if the distance
is further than say 5miles away, a message is displayed but i cant get
it to work please help!!

see code below

<script src="http://maps.google.com/maps?
file=api&v=2&key=**REMOVED**"

type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function loadMap(){
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(55.010455,-7.317671), 15);
GEvent.addListener(map, "click", function(overlay, point){
map.clearOverlays();
if (point) {
map.addOverlay(new GMarker(point));
map.panTo(point);
msg = "Latitude: "+point.lat()+"<br />"+"Longitude: "+point.lng();
document.getElementById("mypoint").innerHTML = msg;
if (point.lat,point.lng).distanceFrom(55.010455,-7.317671) < 5{
   document.write("<B>You are within our delivery area!</B><BR>")
   }
else{
   document.write("<B>You are not within our delivery area! Please
call us on 123456789</B><BR>")
   }
});
}
// arrange for our onload handler to 'listen' for onload events
if (window.attachEvent) {
window.attachEvent("onload", function() {
loadMap();   // Internet Explorer
});
} else {
window.addEventListener("load", function() {
loadMap(); // Firefox and standard browsers
}, false);
}

//]]>

--~--~---------~--~----~------------~-------~--~----~
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