//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(12);
     }    
     
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(44.938557, -93.472366), 12 ,'r',false);
       LoadCityBoundary();
       //LoadCityBoundaryII();
       CityExtent(new VELatLong(44.938557, -93.472366));
       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/Minnetonka/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/Minnetonka/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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/Minnetonka/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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/Minnetonka/PIMAWeb6/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/PIMAWeb/XML/M1_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/Minnetonka/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/M1_Burglary.xml", l);
            map.ImportShapeLayerData(veLayerSpec);

        //veLayerSpec.Type = type;
        //veLayerSpec.ID = 1;
        ////veLayerSpec.LayerSource = txtSource.value;
        //veLayerSpec.LayerSource = "http://gis.logis.org/Minnetonka/PIMAWeb" + theLayerSource;
        //veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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/Minnetonka/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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/Minnetonka/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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/Minnetonka/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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/Minnetonka/PIMAWeb" + theLayerSource;
        veLayerSpec.IconUrl = "http://gis.logis.org/Minnetonka/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(44.9787305,-93.4233402),
        new VELatLong(44.9786949,-93.4208051),
        new VELatLong(44.9786178,-93.4110817),
        new VELatLong(44.9785972,-93.4105608),
        new VELatLong(44.9752987,-93.4105503),
        new VELatLong(44.9752751,-93.4105502),
        new VELatLong(44.9734513,-93.4105398),
        new VELatLong(44.9733974,-93.4105395),
        new VELatLong(44.9733664,-93.4105394),
        new VELatLong(44.9734165,-93.4090688),
        new VELatLong(44.9735784,-93.4043123),
        new VELatLong(44.9734513,-93.4043136),
        new VELatLong(44.9733569,-93.4043148),
        new VELatLong(44.9732269,-93.4043164),
        new VELatLong(44.9731641,-93.4043175),
        new VELatLong(44.9731621,-93.4043175),
        new VELatLong(44.97316,-93.4043176),
        new VELatLong(44.9730774,-93.4043187),
        new VELatLong(44.9730539,-93.4043189),
        new VELatLong(44.9729499,-93.4043204),
        new VELatLong(44.9729264,-93.4043205),
        new VELatLong(44.9728756,-93.4043214),
        new VELatLong(44.9728521,-93.4043215),
        new VELatLong(44.9727362,-93.4043232),
        new VELatLong(44.9727126,-93.4043234),
        new VELatLong(44.971332,-93.4043411),
        new VELatLong(44.9713322,-93.4046393),
        new VELatLong(44.9700454,-93.4046343),
        new VELatLong(44.9700459,-93.4056054),
        new VELatLong(44.9697261,-93.4056101),
        new VELatLong(44.9697157,-93.4056103),
        new VELatLong(44.9697025,-93.4056104),
        new VELatLong(44.96932,-93.4056026),
        new VELatLong(44.9688106,-93.4056155),
        new VELatLong(44.9687933,-93.4056159),
        new VELatLong(44.968309,-93.4055809),
        new VELatLong(44.9683073,-93.4055808),
        new VELatLong(44.9677446,-93.405584),
        new VELatLong(44.9677398,-93.4046582),
        new VELatLong(44.9671674,-93.4046576),
        new VELatLong(44.9671689,-93.4055792),
        new VELatLong(44.9671684,-93.4055792),
        new VELatLong(44.9667049,-93.4055754),
        new VELatLong(44.9658091,-93.4055767),
        new VELatLong(44.9641546,-93.4056085),
        new VELatLong(44.9641503,-93.4045027),
        new VELatLong(44.9641743,-93.4007481),
        new VELatLong(44.9641355,-93.4006841),
        new VELatLong(44.9609904,-93.4007364),
        new VELatLong(44.9567014,-93.4008078),
        new VELatLong(44.9544659,-93.4007587),
        new VELatLong(44.9500817,-93.4006484),
        new VELatLong(44.949547,-93.4006353),
        new VELatLong(44.9460261,-93.4005501),
        new VELatLong(44.9453643,-93.4005966),
        new VELatLong(44.9445418,-93.4006513),
        new VELatLong(44.9445372,-93.4006515),
        new VELatLong(44.9442631,-93.4006616),
        new VELatLong(44.9423046,-93.4007338),
        new VELatLong(44.9422993,-93.3996576),
        new VELatLong(44.9417924,-93.3993211),
        new VELatLong(44.9417849,-93.3993164),
        new VELatLong(44.9416291,-93.3992228),
        new VELatLong(44.9414689,-93.399145),
        new VELatLong(44.9413053,-93.3990831),
        new VELatLong(44.9411391,-93.3990374),
        new VELatLong(44.9409709,-93.3990081),
        new VELatLong(44.9408441,-93.398997),
        new VELatLong(44.9404901,-93.3989792),
        new VELatLong(44.9404987,-93.4007069),
        new VELatLong(44.9386927,-93.4006801),
        new VELatLong(44.9386978,-93.4057616),
        new VELatLong(44.9391119,-93.4057535),
        new VELatLong(44.9395891,-93.4057564),
        new VELatLong(44.9400122,-93.4057586),
        new VELatLong(44.9404533,-93.405759),
        new VELatLong(44.940508,-93.4057877),
        new VELatLong(44.9405172,-93.4108685),
        new VELatLong(44.9423282,-93.4108889),
        new VELatLong(44.9426765,-93.4108968),
        new VELatLong(44.944666,-93.410915),
        new VELatLong(44.9459443,-93.4109289),
        new VELatLong(44.9469569,-93.4109547),
        new VELatLong(44.9494397,-93.4109691),
        new VELatLong(44.9487588,-93.4210576),
        new VELatLong(44.9484821,-93.4210615),
        new VELatLong(44.9484415,-93.4216278),
        new VELatLong(44.9483799,-93.4221903),
        new VELatLong(44.9482974,-93.4227475),
        new VELatLong(44.9481943,-93.4232978),
        new VELatLong(44.948071,-93.4238398),
        new VELatLong(44.9479171,-93.4244078),
        new VELatLong(44.9474384,-93.4261637),
        new VELatLong(44.9460267,-93.4261836),
        new VELatLong(44.9459434,-93.4260665),
        new VELatLong(44.9459457,-93.4256049),
        new VELatLong(44.9445844,-93.4256297),
        new VELatLong(44.9446488,-93.4252796),
        new VELatLong(44.9447102,-93.4248987),
        new VELatLong(44.9447374,-93.4247071),
        new VELatLong(44.9447725,-93.4244282),
        new VELatLong(44.944843,-93.4238246),
        new VELatLong(44.9448635,-93.4236448),
        new VELatLong(44.9454866,-93.4236393),
        new VELatLong(44.9456777,-93.4210784),
        new VELatLong(44.9449979,-93.4211087),
        new VELatLong(44.9437331,-93.4211212),
        new VELatLong(44.9423691,-93.4211461),
        new VELatLong(44.9423397,-93.4160188),
        new VELatLong(44.9391707,-93.4159754),
        new VELatLong(44.9391767,-93.4194507),
        new VELatLong(44.936905,-93.4194196),
        new VELatLong(44.9369132,-93.4200507),
        new VELatLong(44.9369072,-93.4210608),
        new VELatLong(44.9363378,-93.4210517),
        new VELatLong(44.9356987,-93.4210427),
        new VELatLong(44.9356042,-93.42104),
        new VELatLong(44.9351136,-93.4210293),
        new VELatLong(44.9342808,-93.4210454),
        new VELatLong(44.9332229,-93.4210658),
        new VELatLong(44.9329573,-93.4210975),
        new VELatLong(44.9328267,-93.4210966),
        new VELatLong(44.932585,-93.4211153),
        new VELatLong(44.9325801,-93.4213014),
        new VELatLong(44.9325729,-93.4214873),
        new VELatLong(44.9325633,-93.421673),
        new VELatLong(44.9325515,-93.4218584),
        new VELatLong(44.9325374,-93.4220436),
        new VELatLong(44.9325209,-93.4222283),
        new VELatLong(44.9325022,-93.4224127),
        new VELatLong(44.9324812,-93.4225965),
        new VELatLong(44.932458,-93.4227798),
        new VELatLong(44.9324324,-93.4229625),
        new VELatLong(44.9324046,-93.4231445),
        new VELatLong(44.9323746,-93.4233258),
        new VELatLong(44.9323423,-93.4235064),
        new VELatLong(44.9323077,-93.4236861),
        new VELatLong(44.932271,-93.423865),
        new VELatLong(44.9322377,-93.4240175),
        new VELatLong(44.9315558,-93.4225521),
        new VELatLong(44.9315295,-93.4237683),
        new VELatLong(44.9315163,-93.4248918),
        new VELatLong(44.931511,-93.4263096),
        new VELatLong(44.9314231,-93.4264946),
        new VELatLong(44.9313517,-93.4266513),
        new VELatLong(44.9312783,-93.4268062),
        new VELatLong(44.931203,-93.4269593),
        new VELatLong(44.9311928,-93.4269795),
        new VELatLong(44.9311557,-93.4270533),
        new VELatLong(44.9295425,-93.4271267),
        new VELatLong(44.9295595,-93.4281961),
        new VELatLong(44.9295815,-93.4295336),
        new VELatLong(44.9289966,-93.4294504),
        new VELatLong(44.9286373,-93.4292533),
        new VELatLong(44.9279642,-93.4286887),
        new VELatLong(44.9277579,-93.4284896),
        new VELatLong(44.9272242,-93.4279621),
        new VELatLong(44.9270088,-93.4278041),
        new VELatLong(44.9267351,-93.4275692),
        new VELatLong(44.9262317,-93.4273528),
        new VELatLong(44.926149,-93.4266093),
        new VELatLong(44.9248927,-93.426739),
        new VELatLong(44.9245638,-93.4268169),
        new VELatLong(44.9246472,-93.4279033),
        new VELatLong(44.9235615,-93.4279868),
        new VELatLong(44.923556,-93.4278441),
        new VELatLong(44.9218894,-93.4279692),
        new VELatLong(44.9218236,-93.4277292),
        new VELatLong(44.9217495,-93.427078),
        new VELatLong(44.9212314,-93.4271125),
        new VELatLong(44.92123,-93.4271126),
        new VELatLong(44.9208405,-93.4258125),
        new VELatLong(44.9208547,-93.4245663),
        new VELatLong(44.9208636,-93.4232476),
        new VELatLong(44.9204578,-93.4229171),
        new VELatLong(44.9173849,-93.4230485),
        new VELatLong(44.9176298,-93.4221033),
        new VELatLong(44.9171337,-93.4221247),
        new VELatLong(44.9167445,-93.4221467),
        new VELatLong(44.9135377,-93.4222796),
        new VELatLong(44.9063349,-93.421989),
        new VELatLong(44.9063246,-93.4208223),
        new VELatLong(44.9062942,-93.41929),
        new VELatLong(44.9062746,-93.4172634),
        new VELatLong(44.9062496,-93.4142547),
        new VELatLong(44.9062101,-93.4116837),
        new VELatLong(44.9061767,-93.4095089),
        new VELatLong(44.9062002,-93.4079771),
        new VELatLong(44.9061687,-93.4065542),
        new VELatLong(44.9063316,-93.406539),
        new VELatLong(44.9063164,-93.4037574),
        new VELatLong(44.9061354,-93.403759),
        new VELatLong(44.9061278,-93.4014621),
        new VELatLong(44.9025725,-93.4015352),
        new VELatLong(44.9002272,-93.4015719),
        new VELatLong(44.8992774,-93.4015787),
        new VELatLong(44.8988995,-93.4015364),
        new VELatLong(44.8970881,-93.4015404),
        new VELatLong(44.8916409,-93.4015583),
        new VELatLong(44.8918846,-93.405897),
        new VELatLong(44.8920495,-93.4076245),
        new VELatLong(44.8920596,-93.4085713),
        new VELatLong(44.8921049,-93.4097612),
        new VELatLong(44.8921741,-93.4105402),
        new VELatLong(44.8922321,-93.4118211),
        new VELatLong(44.8921747,-93.4128709),
        new VELatLong(44.8921552,-93.4132994),
        new VELatLong(44.8921002,-93.4148014),
        new VELatLong(44.8921071,-93.4153765),
        new VELatLong(44.8920312,-93.4176809),
        new VELatLong(44.8919656,-93.4198941),
        new VELatLong(44.8919539,-93.4199394),
        new VELatLong(44.8919551,-93.4201669),
        new VELatLong(44.8919554,-93.4202171),
        new VELatLong(44.891909,-93.4216763),
        new VELatLong(44.891902,-93.4219387),
        new VELatLong(44.8918718,-93.4229064),
        new VELatLong(44.8915786,-93.4320411),
        new VELatLong(44.8915791,-93.432886),
        new VELatLong(44.8915962,-93.4384695),
        new VELatLong(44.8915992,-93.4392542),
        new VELatLong(44.8915743,-93.4419205),
        new VELatLong(44.8915965,-93.4424592),
        new VELatLong(44.8915966,-93.4424628),
        new VELatLong(44.8914102,-93.443225),
        new VELatLong(44.8916277,-93.4435232),
        new VELatLong(44.8916308,-93.4442155),
        new VELatLong(44.8916819,-93.4469363),
        new VELatLong(44.8917271,-93.4483257),
        new VELatLong(44.8918252,-93.4519919),
        new VELatLong(44.8917687,-93.4523274),
        new VELatLong(44.8918269,-93.4535385),
        new VELatLong(44.891802,-93.4541371),
        new VELatLong(44.8917708,-93.4552046),
        new VELatLong(44.8917854,-93.4560509),
        new VELatLong(44.8917718,-93.4572096),
        new VELatLong(44.8917808,-93.4583162),
        new VELatLong(44.8917557,-93.4600867),
        new VELatLong(44.8917178,-93.4622698),
        new VELatLong(44.8916503,-93.4638876),
        new VELatLong(44.8916392,-93.4643953),
        new VELatLong(44.8914953,-93.4697544),
        new VELatLong(44.8914657,-93.4705983),
        new VELatLong(44.8913989,-93.4714111),
        new VELatLong(44.8913948,-93.4728121),
        new VELatLong(44.8914144,-93.4731166),
        new VELatLong(44.8914417,-93.4773741),
        new VELatLong(44.8914837,-93.4791712),
        new VELatLong(44.8914886,-93.4812154),
        new VELatLong(44.891473,-93.48171),
        new VELatLong(44.8914529,-93.4821914),
        new VELatLong(44.8918013,-93.4880529),
        new VELatLong(44.8920854,-93.4921982),
        new VELatLong(44.8920619,-93.4934847),
        new VELatLong(44.892057,-93.4946043),
        new VELatLong(44.8920103,-93.4950076),
        new VELatLong(44.8919918,-93.4959305),
        new VELatLong(44.891941,-93.4985222),
        new VELatLong(44.89192,-93.4992123),
        new VELatLong(44.8918839,-93.5002663),
        new VELatLong(44.8918724,-93.5008262),
        new VELatLong(44.89179,-93.5031949),
        new VELatLong(44.8917782,-93.5048448),
        new VELatLong(44.8917459,-93.506387),
        new VELatLong(44.8916166,-93.5108238),
        new VELatLong(44.8916207,-93.51323),
        new VELatLong(44.8916215,-93.5137256),
        new VELatLong(44.8915574,-93.5159584),
        new VELatLong(44.8915181,-93.519681),
        new VELatLong(44.8915224,-93.5207081),
        new VELatLong(44.8914916,-93.5225276),
        new VELatLong(44.8914787,-93.5233761),
        new VELatLong(44.8927121,-93.5233523),
        new VELatLong(44.8944587,-93.5233381),
        new VELatLong(44.8956471,-93.5233207),
        new VELatLong(44.8961378,-93.5232975),
        new VELatLong(44.8980511,-93.5232412),
        new VELatLong(44.8986451,-93.5232688),
        new VELatLong(44.9019311,-93.5232539),
        new VELatLong(44.9034618,-93.523225),
        new VELatLong(44.9041459,-93.5232122),
        new VELatLong(44.9059652,-93.5231597),
        new VELatLong(44.9062753,-93.5231507),
        new VELatLong(44.9083817,-93.5231813),
        new VELatLong(44.9100698,-93.5231483),
        new VELatLong(44.9113843,-93.5231333),
        new VELatLong(44.9114922,-93.5231494),
        new VELatLong(44.9116677,-93.5231585),
        new VELatLong(44.9118117,-93.5231598),
        new VELatLong(44.9132325,-93.5231336),
        new VELatLong(44.9168847,-93.5231385),
        new VELatLong(44.9168289,-93.522552),
        new VELatLong(44.9168342,-93.521394),
        new VELatLong(44.9168438,-93.520729),
        new VELatLong(44.9204473,-93.5207119),
        new VELatLong(44.9204455,-93.5201171),
        new VELatLong(44.9204441,-93.5194286),
        new VELatLong(44.9204355,-93.518357),
        new VELatLong(44.9239653,-93.5181626),
        new VELatLong(44.9259456,-93.5181812),
        new VELatLong(44.9273953,-93.5129625),
        new VELatLong(44.927727,-93.5129396),
        new VELatLong(44.9277257,-93.511773),
        new VELatLong(44.928819,-93.5078363),
        new VELatLong(44.9312895,-93.5076728),
        new VELatLong(44.9348576,-93.5074367),
        new VELatLong(44.9348522,-93.5070528),
        new VELatLong(44.9357349,-93.5054127),
        new VELatLong(44.9357551,-93.5056375),
        new VELatLong(44.9358877,-93.5054034),
        new VELatLong(44.9360516,-93.5049886),
        new VELatLong(44.9362707,-93.5042919),
        new VELatLong(44.936376,-93.5038777),
        new VELatLong(44.9364589,-93.5034522),
        new VELatLong(44.9365149,-93.503019),
        new VELatLong(44.9365625,-93.5024162),
        new VELatLong(44.9384128,-93.5023863),
        new VELatLong(44.9393136,-93.5023717),
        new VELatLong(44.93934,-93.5042636),
        new VELatLong(44.9393558,-93.5055493),
        new VELatLong(44.939371,-93.5067871),
        new VELatLong(44.9393826,-93.5074311),
        new VELatLong(44.9420974,-93.5074277),
        new VELatLong(44.9421139,-93.5074277),
        new VELatLong(44.9456983,-93.5074202),
        new VELatLong(44.9456298,-93.5022566),
        new VELatLong(44.9471232,-93.5022215),
        new VELatLong(44.9474789,-93.502202),
        new VELatLong(44.9483836,-93.5022099),
        new VELatLong(44.9485782,-93.5021949),
        new VELatLong(44.9492415,-93.5021826),
        new VELatLong(44.9492395,-93.5020633),
        new VELatLong(44.9495593,-93.5020054),
        new VELatLong(44.9498206,-93.5019554),
        new VELatLong(44.9499509,-93.5019958),
        new VELatLong(44.9501126,-93.5020816),
        new VELatLong(44.951184,-93.5020521),
        new VELatLong(44.9513368,-93.5021057),
        new VELatLong(44.9566139,-93.5021184),
        new VELatLong(44.9637272,-93.5019301),
        new VELatLong(44.9657115,-93.5019604),
        new VELatLong(44.9656614,-93.5014068),
        new VELatLong(44.9657053,-93.5011873),
        new VELatLong(44.9655501,-93.5005627),
        new VELatLong(44.9653958,-93.500159),
        new VELatLong(44.9649909,-93.4992622),
        new VELatLong(44.964766,-93.4988872),
        new VELatLong(44.9640229,-93.4985684),
        new VELatLong(44.9637638,-93.4985542),
        new VELatLong(44.9634541,-93.4985372),
        new VELatLong(44.9624806,-93.4985325),
        new VELatLong(44.9613494,-93.4985799),
        new VELatLong(44.9601496,-93.4987764),
        new VELatLong(44.9594383,-93.4990361),
        new VELatLong(44.9582485,-93.4997549),
        new VELatLong(44.9577205,-93.5003064),
        new VELatLong(44.9574234,-93.5006686),
        new VELatLong(44.9571579,-93.5011047),
        new VELatLong(44.9568926,-93.5013597),
        new VELatLong(44.9566119,-93.5013056),
        new VELatLong(44.9563817,-93.5012611),
        new VELatLong(44.9557455,-93.5008066),
        new VELatLong(44.9555072,-93.5005819),
        new VELatLong(44.9553063,-93.5004144),
        new VELatLong(44.9549683,-93.5003669),
        new VELatLong(44.9539334,-93.5002031),
        new VELatLong(44.9531813,-93.4996267),
        new VELatLong(44.9529018,-93.4994789),
        new VELatLong(44.9525733,-93.499354),
        new VELatLong(44.9522108,-93.4992435),
        new VELatLong(44.9515408,-93.4991694),
        new VELatLong(44.9513253,-93.4991418),
        new VELatLong(44.9509651,-93.4990134),
        new VELatLong(44.9507334,-93.498774),
        new VELatLong(44.9506573,-93.4986087),
        new VELatLong(44.9507169,-93.4984808),
        new VELatLong(44.9507206,-93.4984726),
        new VELatLong(44.9507358,-93.4984401),
        new VELatLong(44.9508125,-93.4984027),
        new VELatLong(44.9510365,-93.4985824),
        new VELatLong(44.9511742,-93.4985773),
        new VELatLong(44.9513118,-93.4985722),
        new VELatLong(44.9516179,-93.4984791),
        new VELatLong(44.9518629,-93.498516),
        new VELatLong(44.9522242,-93.498725),
        new VELatLong(44.9524466,-93.4988659),
        new VELatLong(44.952669,-93.4990068),
        new VELatLong(44.9530058,-93.4991467),
        new VELatLong(44.9534805,-93.4994142),
        new VELatLong(44.9538353,-93.499632),
        new VELatLong(44.9543288,-93.4999207),
        new VELatLong(44.9548234,-93.5001289),
        new VELatLong(44.9552943,-93.5000535),
        new VELatLong(44.9555719,-93.4998764),
        new VELatLong(44.9557716,-93.4996681),
        new VELatLong(44.9558574,-93.4992731),
        new VELatLong(44.9559334,-93.4991313),
        new VELatLong(44.9560292,-93.4992232),
        new VELatLong(44.9562076,-93.4990891),
        new VELatLong(44.9562825,-93.4990067),
        new VELatLong(44.9563782,-93.4987148),
        new VELatLong(44.9564471,-93.4985806),
        new VELatLong(44.9566062,-93.4984635),
        new VELatLong(44.956713,-93.4983849),
        new VELatLong(44.9570606,-93.4980162),
        new VELatLong(44.9573091,-93.4976337),
        new VELatLong(44.9574923,-93.4971036),
        new VELatLong(44.9576692,-93.4961995),
        new VELatLong(44.9576398,-93.495719),
        new VELatLong(44.95763,-93.4954194),
        new VELatLong(44.957585,-93.4949183),
        new VELatLong(44.957553,-93.4944052),
        new VELatLong(44.9575662,-93.4940103),
        new VELatLong(44.9576344,-93.4936149),
        new VELatLong(44.957983,-93.4930981),
        new VELatLong(44.9581211,-93.4928989),
        new VELatLong(44.9582545,-93.4926286),
        new VELatLong(44.9584147,-93.4923209),
        new VELatLong(44.9585114,-93.492123),
        new VELatLong(44.9585557,-93.4919205),
        new VELatLong(44.9633397,-93.4919847),
        new VELatLong(44.9633412,-93.4919847),
        new VELatLong(44.9638397,-93.4919914),
        new VELatLong(44.9638647,-93.4894547),
        new VELatLong(44.9657083,-93.4894382),
        new VELatLong(44.9657127,-93.4889864),
        new VELatLong(44.9675563,-93.4889682),
        new VELatLong(44.9675768,-93.4868885),
        new VELatLong(44.9658717,-93.4869021),
        new VELatLong(44.9659214,-93.4818351),
        new VELatLong(44.9659215,-93.4818323),
        new VELatLong(44.9657829,-93.4818332),
        new VELatLong(44.9657877,-93.4767891),
        new VELatLong(44.9662565,-93.4767851),
        new VELatLong(44.9662587,-93.4767851),
        new VELatLong(44.9706487,-93.4767478),
        new VELatLong(44.97065,-93.4767477),
        new VELatLong(44.9708294,-93.4767462),
        new VELatLong(44.9709319,-93.4767454),
        new VELatLong(44.9709328,-93.4767454),
        new VELatLong(44.9711345,-93.4767436),
        new VELatLong(44.9712003,-93.4767431),
        new VELatLong(44.9713673,-93.4767394),
        new VELatLong(44.9713586,-93.4778542),
        new VELatLong(44.971333,-93.4807353),
        new VELatLong(44.971314,-93.4817991),
        new VELatLong(44.9713285,-93.4817986),
        new VELatLong(44.9741163,-93.4817165),
        new VELatLong(44.9740996,-93.4834176),
        new VELatLong(44.9712972,-93.4835),
        new VELatLong(44.9712876,-93.4844762),
        new VELatLong(44.9712794,-93.485302),
        new VELatLong(44.9712892,-93.4853018),
        new VELatLong(44.9727419,-93.4852623),
        new VELatLong(44.9727298,-93.4864442),
        new VELatLong(44.9744754,-93.4877414),
        new VELatLong(44.9744928,-93.4877544),
        new VELatLong(44.9749083,-93.4871554),
        new VELatLong(44.9753884,-93.4864655),
        new VELatLong(44.9762463,-93.4852308),
        new VELatLong(44.9781788,-93.4877958),
        new VELatLong(44.9767175,-93.489981),
        new VELatLong(44.9746413,-93.4910925),
        new VELatLong(44.9747688,-93.4918843),
        new VELatLong(44.9747723,-93.491886),
        new VELatLong(44.9750345,-93.4935202),
        new VELatLong(44.9769002,-93.4938882),
        new VELatLong(44.9785179,-93.4950102),
        new VELatLong(44.9785605,-93.4918537),
        new VELatLong(44.9785502,-93.4910932),
        new VELatLong(44.9786333,-93.4893629),
        new VELatLong(44.9785877,-93.4873807),
        new VELatLong(44.9785709,-93.4828679),
        new VELatLong(44.9785878,-93.4820607),
        new VELatLong(44.9785867,-93.4817811),
        new VELatLong(44.9785858,-93.4815464),
        new VELatLong(44.9785707,-93.4766064),
        new VELatLong(44.9786627,-93.4715978),
        new VELatLong(44.9786413,-93.4703136),
        new VELatLong(44.97864,-93.4695328),
        new VELatLong(44.9786439,-93.4641716),
        new VELatLong(44.978636,-93.461379),
        new VELatLong(44.9786328,-93.4602594),
        new VELatLong(44.9786552,-93.4601167),
        new VELatLong(44.9786789,-93.4599652),
        new VELatLong(44.9786621,-93.456309),
        new VELatLong(44.9786825,-93.4511785),
        new VELatLong(44.9786841,-93.4507676),
        new VELatLong(44.9786965,-93.4476249),
        new VELatLong(44.9787341,-93.4460738),
        new VELatLong(44.978739,-93.4447971),
        new VELatLong(44.978763,-93.4409494),
        new VELatLong(44.9787648,-93.4404793),
        new VELatLong(44.9787864,-93.437194),
        new VELatLong(44.9787786,-93.436886),
        new VELatLong(44.9787789,-93.4367987),
        new VELatLong(44.9787937,-93.4352907),
        new VELatLong(44.978846,-93.4309234),
        new VELatLong(44.9788463,-93.4308974),
        new VELatLong(44.9788202,-93.4294758),
        new VELatLong(44.9788073,-93.4292981),
        new VELatLong(44.9787528,-93.4258446),
        new VELatLong(44.9787305,-93.4233402)],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;
        }
     }
   }

