//LOGIS GIS 57050 Duluth St, Golden Valley, MN
//Keith Anderson GIS Analyst - September 2008
//
//
//Javscript functionality for PIMA Web, a public crime mapping application

function youJSFunction()
{
alert("my check box")
}

var map = null;
var doingsearch = false;
var pinid=0;
var layerid=1;
     
function DrawPoly(id,points,width,color)
     {
     poly = new VEPolyline(id,points);
     poly.SetWidth(width);
     poly.SetColor(color);
     map.AddPolyline(poly);
     }
     
function DeleteCityBoundary()         
     {            
     map.DeleteAllPolylines();                
     }
     
function CityExtent(latlong)
     {
     map.SetCenter(latlong);
     map.SetZoomLevel(13);
     }    
     
function DeleteLayer(layerid)
    {            
     map.DeleteLayer(layerid);         
    }         

function DeleteShapeLayer(layer)
         {
            map.DeleteShapeLayer(layer);
            ShapeLayerInfo();
         }

function DeleteAllLayersNew()
      {         
      //alert(1);
      map.DeleteAllShapeLayers();         
      layer = null; 
      
      //if (document.getElementById('chkRoad').checked == true);  
      //{
      //alert(2);
      //document.getElementById('chkRoad').checked=false;
      //document.getElementById('chkPark').checked=false;
      //document.getElementById('chkAnimal').checked=false;
      //document.getElementById('chkDist').checked=false;
      document.getElementById('chkBurg').checked=false;
      document.getElementById('chkArson').checked=false;
      document.getElementById('chkTheft').checked=false;
      document.getElementById('chkVehicle').checked=false;
      document.getElementById('chkDamage').checked=false;
      document.getElementById('chkRob').checked=false;

      //alert(3);
      //}   
      }
      
               
function OnPIMALoad()
     { 
       map = new VEMap('mymapcontroldiv');
        
       //map.LoadMap();
       map.LoadMap(new VELatLong(45.03556, -93.36404), 123 ,'r',false);
       LoadCityBoundary();
       LoadCityBoundaryII();
       CityExtent(new VELatLong(45.03556, -93.36404));
       map.AttachEvent("onchangeview", function(e) {
        
        if (doingsearch==true){

         var ll = map.GetCenter();
        
         var pin = new VEPushpin(pinid, ll,
         //'http://www.myfavoriteplaceonearth.com/images/target.gif','Center of map','');
          'http://gis.logis.org/Crystal/PIMAWeb6/Images/pinBlack.gif','Zoom to Address','');
         map.AddPushpin(pin);
         pinid++;
         
         doingsearch=false;
         document.getElementById('resultarea').innerHTML = "&nbsp; Lat/Long: " + ll.toString();
        } 
       }); 
     }
     
function SearchClick() 
    {
       var whereterm = document.getElementById('txtFind').value;
       doingsearch = true;
       map.Find('', whereterm,1);
    }
    
    
function AddXMLLayer(type, theURL, theLayerSource)
     {
        var veLayerSpec = new VELayerSpecification();

        veLayerSpec.Type = type;
        veLayerSpec.ID = layerid;
        //veLayerSpec.LayerSource = txtSource.value;
        veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        veLayerSpec.Method = 'get';
        //veLayerSpec.FnCallback = onFeedLoad;
        map.AddLayer(veLayerSpec);
        layerid++;
        //Map.AttachEvent("onchangeview", function_name);
        //CityExtent(new VELatLong(44.938557, -93.472366));
     }
     
function AddXMLLayerBurglariesxx(type, theURL, theLayerSource)
     {
        var veLayerSpec = new VELayerSpecification();

        veLayerSpec.Type = type;
        veLayerSpec.ID = 1;
        //veLayerSpec.LayerSource = txtSource.value;
        veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        veLayerSpec.Method = 'get';
        //veLayerSpec.FnCallback = onFeedLoad;
        map.AddLayer(veLayerSpec);
        layerid++;
        //Map.AttachEvent("onchangeview", function_name);
        //CityExtent(new VELatLong(44.938557, -93.472366));
     }
     
function AddMyLayerBurglaries(type)
         {
         
            //test.value = txtSource.value;
            var l = new VEShapeLayer();
            var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb6/XML/CY_Burglary.xml", l);
            map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
           
         }


function DeleteAllLayers()
{         
 map.DeleteAllShapeLayers();         
 layer = null;
}



var pinid = 0;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////// Roads -Calls for Service
var Road = null;

function ToggleRoad()
{
//alert(1);
if(document.getElementById('chkRoad').checked==true)
    {
    //alert(2);
    AddLayerRoad(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerRoad();
    }
}

function AddLayerRoad(type)
{
    Road = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_RoadDR.xml", Road);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Road.SetTitle("Road");
}

function DeleteLayerRoad()      
{         
if(Road != null)         
    {            
    map.DeleteShapeLayer(Road);            
    Road = null;         
    }      
}
////////////////////

/////////////////// Park -Calls for Service
var Park = null;

function TogglePark()
{
//alert(1);
if(document.getElementById('chkPark').checked==true)
    {
    //alert(2);
    AddLayerPark(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerPark();
    }
}

function AddLayerPark(type)
{
    Park = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Park.xml", Park);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Park.SetTitle("Park");
}

function DeleteLayerPark()      
{         
if(Park != null)         
    {            
    map.DeleteShapeLayer(Park);            
    Park = null;         
    }      
}
////////////////////

/////////////////// Animal -Calls for Service
var Animal = null;

function ToggleAnimal()
{
//alert(1);
if(document.getElementById('chkAnimal').checked==true)
    {
    //alert(2);
    AddLayerAnimal(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerAnimal();
    }
}

function AddLayerAnimal(type)
{
    Animal = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Animal.xml", Animal);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Animal.SetTitle("Animal");
}

function DeleteLayerAnimal()      
{     
   
if(Animal != null)         
    {
    map.DeleteShapeLayer(Animal);            
    Animal = null;         
    }      
}
////////////////////

/////////////////// Disturbance -Calls for Service
var Dist = null;

function ToggleDist()
{
//alert(1);
if(document.getElementById('chkDist').checked==true)
    {
    //alert(2);
    AddLayerDist(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerDist();
    }
}

function AddLayerDist(type)
{
    Dist = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Dist.xml", Dist);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Dist.SetTitle("Dist");
}

function DeleteLayerDist()      
{         
if(Dist != null)         
    {            
    map.DeleteShapeLayer(Dist);            
    Dist = null;         
    }      
}
////////////////////

/////////////////// Burglaries - Reports
var Burg = null;

function ToggleBurg()
{
//alert(1);
if(document.getElementById('chkBurg').checked==true)
    {
    //alert(2);
    AddLayerBurg(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerBurg();
    }
}

function AddLayerBurg(type)
{
    Burg = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Burglary.xml", Burg);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Burg.SetTitle("Burg");
}

function DeleteLayerBurg()      
{         
if(Burg != null)         
    {            
    map.DeleteShapeLayer(Burg);            
    Burg = null;         
    }      
}
////////////////////

/////////////////// Damage - Reports
var Damage = null;

function ToggleDamage()
{
//alert(1);
if(document.getElementById('chkDamage').checked==true)
    {
    //alert(2);
    AddLayerDamage(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerDamage();
    }
}

function AddLayerDamage(type)
{
    Damage = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_CRIMINAL DAMAGE PROPERTY.xml", Damage);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Damage.SetTitle("Damage");
}

function DeleteLayerDamage()      
{         
if(Damage != null)         
    {            
    map.DeleteShapeLayer(Damage);            
    Damage = null;         
    }      
}
////////////////////

/////////////////// Arson - Reports
var Arson = null;

function ToggleArson()
{
//alert(1);
if(document.getElementById('chkArson').checked==true)
    {
    //alert(2);
    AddLayerArson(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerArson();
    }
}

function AddLayerArson(type)
{
    Arson = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Arson.xml", Arson);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Arson.SetTitle("Damage");
}

function DeleteLayerArson()      
{         
if(Arson != null)         
    {            
    map.DeleteShapeLayer(Arson);            
    Arson = null;         
    }      
}
////////////////////

/////////////////// Theft - Reports
var Theft = null;

function ToggleTheft()
{
//alert(1);
if(document.getElementById('chkTheft').checked==true)
    {
    //alert(2);
    AddLayerTheft(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerTheft();
    }
}

function AddLayerTheft(type)
{
    Theft = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Theft.xml", Theft);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Theft.SetTitle("Theft");
}

function DeleteLayerTheft()      
{         
if(Theft != null)         
    {            
    map.DeleteShapeLayer(Theft);            
    Theft = null;         
    }      
}
////////////////////

/////////////////// Vehicle - Reports
var Vehicle = null;

function ToggleVehicle()
{
//alert(1);
if(document.getElementById('chkVehicle').checked==true)
    {
    //alert(2);
    AddLayerVehicle(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerVehicle();
    }
}

function AddLayerVehicle(type)
{
    Vehicle = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Theft Vehicle.xml", Vehicle);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Vehicle.SetTitle("Vehicle");
}

function DeleteLayerVehicle()      
{         
if(Vehicle != null)         
    {            
    map.DeleteShapeLayer(Vehicle);            
    Vehicle = null;         
    }      
}
////////////////////

/////////////////// Robbery - Reports
var Rob = null;

function ToggleRob()
{
//alert(1);
if(document.getElementById('chkRob').checked==true)
    {
    //alert(2);
    AddLayerRob(VEDataType.GeoRSS, true);
    }
else
    {
    //alert(3);
    DeleteLayerRob();
    }
}

function AddLayerRob(type)
{
    Rob = new VEShapeLayer();
    var veLayerSpec = new VEShapeSourceSpecification(type, "http://gis.logis.org/Crystal/PIMAWeb/XML/CY_Robbery.xml", Rob);
    map.ImportShapeLayerData(veLayerSpec, onFeedLoad);
    Rob.SetTitle("Rob");
}

function DeleteLayerRob()      
{         
if(Rob != null)         
    {            
    map.DeleteShapeLayer(Rob);            
    Rob = null;         
    }      
}
////////////////////

function onFeedLoad(layer)
         {
            var count = layer.GetShapeCount();
            for (var i = 0; i < count; i++)
            {
              var shape = layer.GetShapeByIndex(i);
              //test.value = shape.IconId;
              shape.SetCustomIcon("<img src='" + shape.IconId + "'/>");
            }

            //alert('RSS or Collection loaded. There are '+count+' items in this list.');
         }
         
         
//New Find Function for v6.1
function dosearch()
{
map.Find(null, document.getElementById('txtWhere').value, null, null, null, null, null, null, null, true, onfound);
}

function onfound(layer, resultsArray, places, hasMore, veErrorMessage)
{
if (places) 
    {
    var shape = new VEShape(VEShapeType.Pushpin, places[0].LatLong);
    //shape.SetTitle(infoTitle);
    shape.SetDescription(document.getElementById('txtWhere').value);
    var icon = "<img src='http://gis.logis.org/Crystal/PIMAWeb/Images/pinblack.gif'>";
    shape.SetCustomIcon(icon);                    
    map.AddShape(shape);
    }
}       
///////////

  
function AddXMLLayerBurglaries(type, theURL, theLayerSource)
     {
        //var veLayerSpec = new VELayerSpecification();
        
        
            var l = new VEShapeLayer();
            var veLayerSpec = new VEShapeSourceSpecification(type, "http://localhost/PIMAWeb/XML/CY_Burglary.xml", l);
            map.ImportShapeLayerData(veLayerSpec);

        //veLayerSpec.Type = type;
        //veLayerSpec.ID = 1;
        ////veLayerSpec.LayerSource = txtSource.value;
        //veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        //veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        //veLayerSpec.Method = 'get';
        ////veLayerSpec.FnCallback = onFeedLoad;
        //map.AddLayer(veLayerSpec);
        //layerid++;
        ////Map.AttachEvent("onchangeview", function_name);
        ////CityExtent(new VELatLong(44.938557, -93.472366));
     }
function AddXMLLayerRobberies(type, theURL, theLayerSource)
     {
        var veLayerSpec = new VELayerSpecification();

        veLayerSpec.Type = type;
        veLayerSpec.ID = 2;
        //veLayerSpec.LayerSource = txtSource.value;
        veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        veLayerSpec.Method = 'get';
        //veLayerSpec.FnCallback = onFeedLoad;
        map.AddLayer(veLayerSpec);
        layerid++;
        //Map.AttachEvent("onchangeview", function_name);
        //CityExtent(new VELatLong(44.938557, -93.472366));
     }     
     
function AddXMLLayerArsons(type, theURL, theLayerSource)
     {
        var veLayerSpec = new VELayerSpecification();

        veLayerSpec.Type = type;
        veLayerSpec.ID = 3;
        //veLayerSpec.LayerSource = txtSource.value;
        veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        veLayerSpec.Method = 'get';
        //veLayerSpec.FnCallback = onFeedLoad;
        map.AddLayer(veLayerSpec);
        layerid++;
        //Map.AttachEvent("onchangeview", function_name);
        //CityExtent(new VELatLong(44.938557, -93.472366));
     }     
     
function AddXMLLayerThefts(type, theURL, theLayerSource)
     {
        var veLayerSpec = new VELayerSpecification();

        veLayerSpec.Type = type;
        veLayerSpec.ID = 4;
        //veLayerSpec.LayerSource = txtSource.value;
        veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        veLayerSpec.Method = 'get';
        //veLayerSpec.FnCallback = onFeedLoad;
        map.AddLayer(veLayerSpec);
        layerid++;
        //Map.AttachEvent("onchangeview", function_name);
        //CityExtent(new VELatLong(44.938557, -93.472366));
     }

function AddXMLLayerVehicleThefts(type, theURL, theLayerSource)
     {
        var veLayerSpec = new VELayerSpecification();

        veLayerSpec.Type = type;
        veLayerSpec.ID = 5;
        //veLayerSpec.LayerSource = txtSource.value;
        veLayerSpec.LayerSource = "http://gis.logis.org/Crystal/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Crystal/PIMAWeb" + theURL;
        veLayerSpec.Method = 'get';
        //veLayerSpec.FnCallback = onFeedLoad;
        map.AddLayer(veLayerSpec);
        layerid++;
        //Map.AttachEvent("onchangeview", function_name);
        //CityExtent(new VELatLong(44.938557, -93.472366));
     }
     
     
function DeletePin(id)         
     {              
         try            
         {                 
             if (id!=null)                
            {                
                map.DeletePushpin(id);                
            }                
             else                
            {                
                map.DeleteAllPushpins();                
            }            
         }            
          catch (err)            
         {                
             alert(err.message);            
         }         
     }   

function DeleteAllPins()
    {
	map.DeleteAllPushpins();
    }
     
function LoadCityBoundary()
     {
     DrawPoly('1',[new VELatLong(45.0657286,-93.3397071),
new VELatLong(45.0619123,-93.3396957),
new VELatLong(45.0596254,-93.3396889),
new VELatLong(45.0582686,-93.339627),
new VELatLong(45.058263,-93.3392009),
new VELatLong(45.0582631,-93.3391986),
new VELatLong(45.0582785,-93.3385354),
new VELatLong(45.0575769,-93.3384219),
new VELatLong(45.0565207,-93.3390354),
new VELatLong(45.0526819,-93.3398155),
new VELatLong(45.0487822,-93.3398297),
new VELatLong(45.0484255,-93.339831),
new VELatLong(45.0437518,-93.3398458),
new VELatLong(45.0403363,-93.3398535),
new VELatLong(45.0400012,-93.3398544),
new VELatLong(45.0400006,-93.3411813),
new VELatLong(45.0399761,-93.341847),
new VELatLong(45.0399792,-93.3423228),
new VELatLong(45.039982,-93.3428759),
new VELatLong(45.0399851,-93.3433521),
new VELatLong(45.0399876,-93.3440056),
new VELatLong(45.0399902,-93.3446555),
new VELatLong(45.0400068,-93.345108),
new VELatLong(45.0399973,-93.345277),
new VELatLong(45.0399832,-93.3454808),
new VELatLong(45.0399907,-93.3459705),
new VELatLong(45.040001,-93.3485013),
new VELatLong(45.0400368,-93.3489862),
new VELatLong(45.0400324,-93.3500097),
new VELatLong(45.0393526,-93.3500365),
new VELatLong(45.0381781,-93.3499452),
new VELatLong(45.037602,-93.3499441),
new VELatLong(45.0367918,-93.3499415),
new VELatLong(45.0354775,-93.3499371),
new VELatLong(45.0354655,-93.3494494),
new VELatLong(45.03344,-93.3494454),
new VELatLong(45.0327062,-93.3494766),
new VELatLong(45.0327228,-93.3513914),
new VELatLong(45.0327402,-93.3530467),
new VELatLong(45.0327521,-93.3550158),
new VELatLong(45.0327573,-93.3562457),
new VELatLong(45.0322262,-93.3562476),
new VELatLong(45.029566,-93.3562501),
new VELatLong(45.0278421,-93.3562501),
new VELatLong(45.0271849,-93.3562496),
new VELatLong(45.0260461,-93.3562469),
new VELatLong(45.0255285,-93.3562489),
new VELatLong(45.0255099,-93.3549881),
new VELatLong(45.0254914,-93.3536963),
new VELatLong(45.0254737,-93.3521531),
new VELatLong(45.0254598,-93.3508035),
new VELatLong(45.0254324,-93.3494812),
new VELatLong(45.0241539,-93.3495186),
new VELatLong(45.022106,-93.3494946),
new VELatLong(45.0216375,-93.349606),
new VELatLong(45.0215026,-93.3495667),
new VELatLong(45.021336,-93.3495963),
new VELatLong(45.0208275,-93.3495388),
new VELatLong(45.0204947,-93.3495561),
new VELatLong(45.0204947,-93.3495553),
new VELatLong(45.0204984,-93.3493498),
new VELatLong(45.0204946,-93.3491541),
new VELatLong(45.0204927,-93.3490559),
new VELatLong(45.0204927,-93.3490547),
new VELatLong(45.0204893,-93.3484739),
new VELatLong(45.0205086,-93.3478384),
new VELatLong(45.0205066,-93.3440674),
new VELatLong(45.020515,-93.342764),
new VELatLong(45.0205189,-93.3414452),
new VELatLong(45.0205093,-93.3401457),
new VELatLong(45.0205358,-93.3388075),
new VELatLong(45.0205261,-93.3375275),
new VELatLong(45.0205208,-93.336247),
new VELatLong(45.0205111,-93.3349749),
new VELatLong(45.0205058,-93.3336988),
new VELatLong(45.0189778,-93.3337038),
new VELatLong(45.0186198,-93.3337049),
new VELatLong(45.0168679,-93.3337325),
new VELatLong(45.0168606,-93.3350092),
new VELatLong(45.0168479,-93.336266),
new VELatLong(45.0168621,-93.3375266),
new VELatLong(45.0168674,-93.3388065),
new VELatLong(45.0168905,-93.3401175),
new VELatLong(45.016891,-93.3414324),
new VELatLong(45.0169052,-93.3427314),
new VELatLong(45.0169041,-93.3430717),
new VELatLong(45.0169146,-93.3440812),
new VELatLong(45.016954,-93.3488521),
new VELatLong(45.016954,-93.348858),
new VELatLong(45.0169541,-93.3488684),
new VELatLong(45.0169505,-93.3491181),
new VELatLong(45.0169505,-93.3491214),
new VELatLong(45.0169537,-93.3493313),
new VELatLong(45.0169538,-93.3493353),
new VELatLong(45.0169609,-93.3495835),
new VELatLong(45.0144582,-93.3496119),
new VELatLong(45.0108707,-93.3496325),
new VELatLong(45.0090117,-93.3496613),
new VELatLong(45.0073237,-93.3496555),
new VELatLong(45.0073234,-93.3497517),
new VELatLong(45.0072738,-93.3512699),
new VELatLong(45.0072929,-93.3538258),
new VELatLong(45.0073027,-93.3550204),
new VELatLong(45.0073035,-93.3561918),
new VELatLong(45.0073096,-93.3568943),
new VELatLong(45.0069673,-93.3568888),
new VELatLong(45.0069753,-93.3579722),
new VELatLong(45.0073191,-93.3579765),
new VELatLong(45.0073002,-93.3586897),
new VELatLong(45.0072732,-93.3601208),
new VELatLong(45.0072835,-93.362568),
new VELatLong(45.0072889,-93.363709),
new VELatLong(45.0072874,-93.3641496),
new VELatLong(45.0072932,-93.3651743),
new VELatLong(45.0073247,-93.3665776),
new VELatLong(45.007312,-93.3677105),
new VELatLong(45.0073213,-93.3690251),
new VELatLong(45.0073101,-93.3697214),
new VELatLong(45.0073262,-93.3702934),
new VELatLong(45.0112738,-93.3702506),
new VELatLong(45.0121831,-93.3702521),
new VELatLong(45.013646,-93.370248),
new VELatLong(45.0137195,-93.3752977),
new VELatLong(45.0109964,-93.3751844),
new VELatLong(45.0109915,-93.3753009),
new VELatLong(45.0110258,-93.3759107),
new VELatLong(45.0109794,-93.3790669),
new VELatLong(45.0109888,-93.3802936),
new VELatLong(45.0110739,-93.3871008),
new VELatLong(45.0110877,-93.3896759),
new VELatLong(45.0110986,-93.3903843),
new VELatLong(45.0146639,-93.390315),
new VELatLong(45.0156632,-93.3903047),
new VELatLong(45.0165005,-93.3902882),
new VELatLong(45.0164964,-93.3888416),
new VELatLong(45.016488,-93.3873296),
new VELatLong(45.0164881,-93.3859954),
new VELatLong(45.0164767,-93.3853615),
new VELatLong(45.0200921,-93.3854157),
new VELatLong(45.0201182,-93.3826617),
new VELatLong(45.0201171,-93.3802834),
new VELatLong(45.0196085,-93.3802812),
new VELatLong(45.0173805,-93.380274),
new VELatLong(45.0158365,-93.3802868),
new VELatLong(45.0146078,-93.3802648),
new VELatLong(45.0146072,-93.377732),
new VELatLong(45.0155794,-93.3777475),
new VELatLong(45.0157862,-93.3778107),
new VELatLong(45.0182502,-93.3777732),
new VELatLong(45.0182071,-93.3752993),
new VELatLong(45.018238,-93.3727427),
new VELatLong(45.0200386,-93.372708),
new VELatLong(45.0218616,-93.3727036),
new VELatLong(45.021878,-93.3718021),
new VELatLong(45.0218698,-93.3701662),
new VELatLong(45.0223965,-93.3701608),
new VELatLong(45.024431,-93.3701501),
new VELatLong(45.0260026,-93.3701678),
new VELatLong(45.0315515,-93.3702389),
new VELatLong(45.0328433,-93.3702444),
new VELatLong(45.0335275,-93.3702409),
new VELatLong(45.0335544,-93.3710119),
new VELatLong(45.0364733,-93.3709824),
new VELatLong(45.0364851,-93.3715241),
new VELatLong(45.0364719,-93.3728087),
new VELatLong(45.0382678,-93.3728085),
new VELatLong(45.0400638,-93.3728047),
new VELatLong(45.0418643,-93.3728005),
new VELatLong(45.0424989,-93.3727935),
new VELatLong(45.0436737,-93.3728079),
new VELatLong(45.0436776,-93.3715968),
new VELatLong(45.0436774,-93.3702853),
new VELatLong(45.0445822,-93.3702598),
new VELatLong(45.0455139,-93.370277),
new VELatLong(45.0464936,-93.3703037),
new VELatLong(45.0473412,-93.3703268),
new VELatLong(45.0473355,-93.3728568),
new VELatLong(45.0478596,-93.3728517),
new VELatLong(45.049417,-93.3728269),
new VELatLong(45.0509885,-93.3729391),
new VELatLong(45.0518338,-93.3729248),
new VELatLong(45.0531933,-93.3728773),
new VELatLong(45.05372,-93.3728735),
new VELatLong(45.0536751,-93.3714568),
new VELatLong(45.0537145,-93.3703977),
new VELatLong(45.0546614,-93.3685067),
new VELatLong(45.0546463,-93.3703867),
new VELatLong(45.0554902,-93.3703717),
new VELatLong(45.0554951,-93.370955),
new VELatLong(45.0546534,-93.3709785),
new VELatLong(45.0546519,-93.3714238),
new VELatLong(45.0546673,-93.3722324),
new VELatLong(45.0546698,-93.3728436),
new VELatLong(45.0561911,-93.372885),
new VELatLong(45.0561824,-93.3741406),
new VELatLong(45.054687,-93.3741409),
new VELatLong(45.0546794,-93.3741409),
new VELatLong(45.0546728,-93.3730719),
new VELatLong(45.0519833,-93.3730644),
new VELatLong(45.0519806,-93.3734651),
new VELatLong(45.0519719,-93.3747537),
new VELatLong(45.0519772,-93.3753836),
new VELatLong(45.0536247,-93.375277),
new VELatLong(45.0536305,-93.3757517),
new VELatLong(45.0547037,-93.3757597),
new VELatLong(45.0546951,-93.3747472),
new VELatLong(45.0555233,-93.3747463),
new VELatLong(45.0554973,-93.3754349),
new VELatLong(45.0583659,-93.3753813),
new VELatLong(45.0583617,-93.3766427),
new VELatLong(45.0582987,-93.3766395),
new VELatLong(45.0554421,-93.3766043),
new VELatLong(45.0555101,-93.3773816),
new VELatLong(45.0547179,-93.3773748),
new VELatLong(45.0547321,-93.3785434),
new VELatLong(45.0554342,-93.3785512),
new VELatLong(45.0582968,-93.3785784),
new VELatLong(45.0583085,-93.380471),
new VELatLong(45.060226,-93.3804618),
new VELatLong(45.060667,-93.3804922),
new VELatLong(45.0615944,-93.380459),
new VELatLong(45.0620356,-93.380431),
new VELatLong(45.0620243,-93.3784188),
new VELatLong(45.062016,-93.3727334),
new VELatLong(45.0620043,-93.3707712),
new VELatLong(45.0611443,-93.3706159),
new VELatLong(45.0611459,-93.3702756),
new VELatLong(45.0619878,-93.3703106),
new VELatLong(45.0630456,-93.3703071),
new VELatLong(45.064342,-93.3702889),
new VELatLong(45.0656699,-93.3702554),
new VELatLong(45.0656857,-93.3667443),
new VELatLong(45.0656865,-93.3661006),
new VELatLong(45.0656868,-93.3660991),
new VELatLong(45.0656935,-93.3657123),
new VELatLong(45.065694,-93.3655583),
new VELatLong(45.0656901,-93.3653796),
new VELatLong(45.0656748,-93.364551),
new VELatLong(45.0656719,-93.3626106),
new VELatLong(45.0656349,-93.3600877),
new VELatLong(45.0657019,-93.3498379),
        new VELatLong(45.0657286,-93.3397071)],3,new VEColor(255,0,0,1));
     }
     
         
function LoadCityBoundaryII()
     {
     DrawPoly('2',[new VELatLong(45.026918,-93.3799883),
new VELatLong(45.0268846,-93.3752779),
new VELatLong(45.0261664,-93.3749645),
new VELatLong(45.0255331,-93.3752585),
new VELatLong(45.0218669,-93.3752058),
new VELatLong(45.0218773,-93.380222),
new VELatLong(45.0250504,-93.3802847),
new VELatLong(45.0259101,-93.3802757),
        new VELatLong(45.026918,-93.3799883)],3,new VEColor(255,0,0,1));
     }
    
     
     
function ResizeMap() //resize
{
  if (map != null)
  {  
    if( typeof( window.innerWidth ) == 'number' )
    {
    //Non-IE
    map.Resize(window.innerWidth,window.innerHeight);
    } 
    else if( document.documentElement && ( document.documentElement.clientWidth
       || document.documentElement.clientHeight ) )
    {
    //IE 6+ in 'standards compliant mode'
    map.Resize(document.documentElement.clientWidth
      ,document.documentElement.clientHeight);
    }
  }
}

function UnloadMap() //dispose map etc
{
  if (map != null)
  {
    map.Dispose();
  }
} 

function checkAll(check) {
   for (i=0;i<6;i++) {
     if (check) { 
        document.forms['signup'].chbx[i].checked=true;
        }
     else {
        document.forms['signup'].chbx[i].checked=false;
        }
     }
   }
