﻿// Create Map Overview -------------------------
    function MapOverview()
    {
        //var ovcontrol = new GOverviewMapControl(new GSize(165,165));
        //map.addControl(ovcontrol);
        //var ov_map = ovcontrol.getOverviewMap();
        //ovcontrol.hide();
        //GEvent.addListener(map, 'maptypechanged', function(){ov_map.setMapType(G_NORMAL_MAP);});

    }
    
    
// Draw Filled Circle ---------------------------
    function drawPolygon(lat, lng, radius) 
    {
        var d2r = Math.PI/180;     // degrees to radians
        var r2d = 180/Math.PI;     // radians to degrees
        var PGsides = 36;          // no of sides of polygon (use 36 for circle)
        var PGtrans = 0.2;         // transparency 0 - 1
        var PGwidth = 1;           // width pixels
        var PGcolor = '#0000ff';   // polygon color blue

        var PGlat = (radius/3963)*r2d; // using 3963 miles as earth's radius
        var PGlng = PGlat/Math.cos(lat*d2r);
        var PGpoints = [];
        for (var i=-1; i < PGsides; i++) 
        {
            var theta = ((2*i+1)/PGsides-0.5)*Math.PI;
            PGx = lng + (PGlng * Math.cos(theta));
            PGy = lat + (PGlat * Math.sin(theta));
            PGpoints.push(new GLatLng(PGy, PGx));
            bounds.extend(new GLatLng(PGy, PGx));
        };
        map.addOverlay(new GPolygon(PGpoints,PGcolor,PGwidth, PGtrans,PGcolor,PGtrans));
    } 
    
    
// Pan To Latitude/Longitude -------------------
    function pan(lat, lng)
    {
        window.setTimeout(function() {map.panTo(new GLatLng(lat, lng));}, 1000); 
    }
  
    
// Pan To Marker -------------------------------
    function panToMarker(id)
    {
        GEvent.trigger(markers[id], "click");
    }
    

// Create Marker -------------------------------
    function createMarker(point, description) 
    {  
        var marker = new GMarker(point);  
        if (description != '')
        {
            GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(description + "</b>");});  
        }
        
        markers[i] = marker;
        i++;
        
        return marker;
    }
