<script type="text/javascript">
function initialize(){
function getQueryObject(){
var query=location.search, args={};
query=query.length>0?query.substring(1):'';
var items=query.split('&'), item, name, value, i;
for(i=0; i<items.length; i++){
item=items[i].split('=');
name=decodeURIComponent(item[0]);
value=decodeURIComponent(item[1]);
args[name]=value;
}
return args;
}
var mapOptions={}, query=getQueryObject();
query.lat=query.lat || 0;
query.lng=query.lng || 0;
query.zoom=query.zoom || 0;
mapOptions.center=new google.maps.LatLng(parseFloat(query.lat), parseFloat(query.lng));
mapOptions.mapTypeId=google.maps.MapTypeId.ROADMAP;
mapOptions.zoom=parseInt(query.zoom);
map=new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
google.maps.event.addListener(map, 'click', function(myMouseEvent){
// this event listener is executed when the map is clicked
// it is passed a MouseEvent object: http://code.google.com/apis/maps/documentation/javascript/reference.html#MouseEvent
// convert the MouseEvent LatLng property into a string: http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLng
var clickedLocation=myMouseEvent.latLng.toUrlValue();
// send the clickedLocation string to the B4A Sub HandleMapClick
B4A.CallSub('HandleMapClick', true, clickedLocation);
});
}
var map;
google.maps.event.addDomListenerOnce(window, 'load', initialize);
</script>