var mapDiv=document.getElementById('map');var coordsDiv=document.getElementById('coords');var map;var points=[[]];var lines=[];var marker=null;var lineWidth=5;var lineColor='#ff0000';var icon=new GIcon(G_DEFAULT_ICON);icon.image='http://www.acme.com/resources/images/markers/red.PNG';icon.shadow='http://www.acme.com/resources/images/markers/shadow.PNG';icon.iconSize=new GSize(20,34);icon.shadowSize=new GSize(37,34);icon.iconAnchor=new GPoint(9,34);icon.infoWindowAnchor=new GPoint(9,2);icon.infoShadowAnchor=new GPoint(18,25);function Setup() {try {if(!GBrowserIsCompatible()) {mapDiv.innerHTML='Sorry, your browser is not compatible with Google Maps.';return;} map=new GMap2(mapDiv,{draggableCursor:'default'});map.addControl(new GLargeMapControl());map.addMapType(WMS_TOPO_MAP);map.addMapType(WMS_DOQ_MAP);map.addControl(new GMapTypeControl());map.addControl(new GScaleControl());GEvent.addListener(map,'click',MapClick);SavePositionZoomTypeCookieOnChanges(map);if(!GetPositionZoomTypeCookie(map)) {var point=GetPointFromIP();if(point!=null) map.setCenter(point,9);else map.setCenter(new GLatLng(0.0,0.0),1);} Display();} catch(e) {GLog.write('Setup:\n'+Props(e));}} function Display() {for(var i=0;i=2) {var line=new GPolyline(points[i],lineColor);map.addOverlay(line);lines.push(line);}} if(points[points.length-1].length>0) {marker=new GMarker(points[points.length-1][points[points.length-1].length-1],{icon:icon});map.addOverlay(marker);} var s='';for(var i=0;i0) {for(var j=0;j';s+='-1
';}} coordsDiv.innerHTML=s;} var clicked=false,doubleClicked;function MapClick(overlay,point) {try {if(overlay==null&&point!=null) {if(clicked) doubleClicked=true;else {clicked=true;doubleClicked=false;setTimeout(MakeCaller(MapClickLater,point),250);}}} catch(e) {GLog.write('MapClick:\n'+Props(e));}} function MapClickLater(point) {try {if(!doubleClicked) {points[points.length-1].push(point);Display();} clicked=false;} catch(e) {GLog.write('MapClickLater:\n'+Props(e));}} function StartNewLine() {if(points[points.length-1].length==0) return;points.push([]);Display();} function DeleteLastPoint() {if(points[points.length-1].length>0) points[points.length-1].length--;if(points[points.length-1].length==0&&points.length>1) points.length--;Display();} function ClearAllPoints() {points=[[]];Display();}