﻿//    <!-- Authored by Tim Richards, March 2008 -->
var bordermap_marker_Address = null;            // The property address as a GMarker
var bordermap_latlng_Address = null;            // The property address

// border
var polygon;
var arrVerts = new Array();     // The path of vertices they can add to

function bordermap_add(lat, lng) {
    if (!gmap_add())
        return;
    else {
        var z = 14; 
        if ( lat>90 || lat<-90 || lng>180 || lng<-180 ) {
            bordermap_latlng_Address = gmap_LatLng_US; z = gmap_iZoomUS; 
        } else
            bordermap_marker_Address = new GMarker(bordermap_latlng_Address = new GLatLng(lat, lng));
            
        gmap_map.setCenter(arrVerts.length==0 ? bordermap_latlng_Address : arrVerts[0], z);
    }
}

function bordermap_boo() {
    gmap_map.clearOverlays();
    gmap_map.addOverlay(polygon = new GPolygon(arrVerts, "#f33f00", 1, 1, "#ff0000", 0.2, {clickable: false}));
    var acres = polygon.getArea() * 0.000247105381;     // convert sq. m.
    document.getElementById("lblArea").innerHTML = "Area: " + acres.toFixed(acres<20 ? 2 : 1) + " acres ";
}
