function addMarkers()
{
mySelect = document.getElementById('selection');
Lakeland = [];White_Bear_Lake = [];Bayport = [];Stillwater = [];Cottage_Grove = [];Oakdale = [];Forest_Lake = [];Woodbury = [];Vadnais_Heights = [];Hugo = [];Lake_Elmo = [];Mahtomedi = [];Marine_On_St_Croix = [];Newport = [];St_Paul_Park = [];Scandia = [];mySelect.options[mySelect.options.length] = new Option("Bayport schools",'all=Bayport');
mySelect.options[mySelect.options.length] = new Option("Cottage Grove schools",'all=Cottage_Grove');
mySelect.options[mySelect.options.length] = new Option("Forest Lake schools",'all=Forest_Lake');
mySelect.options[mySelect.options.length] = new Option("Hugo schools",'all=Hugo');
mySelect.options[mySelect.options.length] = new Option("Lake Elmo schools",'all=Lake_Elmo');
mySelect.options[mySelect.options.length] = new Option("Lakeland schools",'all=Lakeland');
mySelect.options[mySelect.options.length] = new Option("Mahtomedi schools",'all=Mahtomedi');
mySelect.options[mySelect.options.length] = new Option("Marine On St Croix schools",'all=Marine_On_St_Croix');
mySelect.options[mySelect.options.length] = new Option("Newport schools",'all=Newport');
mySelect.options[mySelect.options.length] = new Option("Oakdale schools",'all=Oakdale');
mySelect.options[mySelect.options.length] = new Option("Scandia schools",'all=Scandia');
mySelect.options[mySelect.options.length] = new Option("St Paul Park schools",'all=St_Paul_Park');
mySelect.options[mySelect.options.length] = new Option("Stillwater schools",'all=Stillwater');
mySelect.options[mySelect.options.length] = new Option("Vadnais Heights schools",'all=Vadnais_Heights');
mySelect.options[mySelect.options.length] = new Option("White Bear Lake schools",'all=White_Bear_Lake');
mySelect.options[mySelect.options.length] = new Option("Woodbury schools",'all=Woodbury');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Lakeland[Lakeland.length] = createMarker(new GPoint(-92.77080536,44.94202805),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Afton-lakeland Elementary School",'Lakeland=' + Lakeland.length);
White_Bear_Lake[White_Bear_Lake.length] = createMarker(new GPoint(-92.98450470,45.03666687),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative School",'White_Bear_Lake=' + White_Bear_Lake.length);
Bayport[Bayport.length] = createMarker(new GPoint(-92.78080750,45.01861572),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Andersen Elementary School",'Bayport=' + Bayport.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.85552216,45.03101349),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Anthony Lewis House/tlc High School",'Stillwater=' + Stillwater.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.93390656,44.82107925),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Armstrong Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
White_Bear_Lake[White_Bear_Lake.length] = createMarker(new GPoint(-92.98487800,45.04619700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Career And Technical Center",'White_Bear_Lake=' + White_Bear_Lake.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.97097015,45.02090836),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Castle Elementary School",'Oakdale=' + Oakdale.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.97676849,45.25659180),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Century Jr.",'Forest_Lake=' + Forest_Lake.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.95504761,44.85506439),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cottage Grove Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.90758514,44.84057617),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cottage Grove Junior Middle School",'Cottage_Grove=' + Cottage_Grove.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.94775391,44.83383560),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Crestview Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.96430969,44.93971252),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Crosswinds Middle School",'Woodbury=' + Woodbury.length);
Vadnais_Heights[Vadnais_Heights.length] = createMarker(new GPoint(-93.08489227,45.07789612),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Day Training & Habilitation",'Vadnais_Heights=' + Vadnais_Heights.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.95322400,44.83366000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Distance Learning Program",'Cottage_Grove=' + Cottage_Grove.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.90110016,44.91130066),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eagle Park Elementary School",'Woodbury=' + Woodbury.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.94700623,44.97069931),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eagle Point Elementary School",'Oakdale=' + Oakdale.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.93681335,44.81771469),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Childhood Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98851776,45.27686691),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Childhood Sp. Ed. Elementary School",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98045349,45.26821899),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fairview Recovery Services High School",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98851776,45.27686691),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Forest Lake Alc",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98898315,45.27448654),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forest Lake Elementary School",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98235321,45.25986481),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Forest Lake Senior High School",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98419900,45.28191500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Forest Lake Targeted Services",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98848724,45.27275467),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forest View Elementary School",'Forest_Lake=' + Forest_Lake.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.96408081,44.88900757),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gordon Bailey Elementary School",'Woodbury=' + Woodbury.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.91146088,44.84276199),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Grey Cloud Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81182098,45.05549240),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harbor Shelter & Counseling Center",'Stillwater=' + Stillwater.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.94074249,44.82735443),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hillside Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Hugo[Hugo.length] = createMarker(new GPoint(-92.98820496,45.16558075),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hugo Elementary School",'Hugo=' + Hugo.length);
Lake_Elmo[Lake_Elmo.length] = createMarker(new GPoint(-92.88258362,45.00117493),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Elmo Elementary School",'Lake_Elmo=' + Lake_Elmo.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.92870331,44.90253448),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lake Junior Middle School",'Woodbury=' + Woodbury.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98789978,45.26969910),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakes Ed. Center",'Forest_Lake=' + Forest_Lake.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98012200,45.26738300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lakes International Language Admy",'Forest_Lake=' + Forest_Lake.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.83280945,45.05016327),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lily Lake Elementary School",'Stillwater=' + Stillwater.length);
Mahtomedi[Mahtomedi.length] = createMarker(new GPoint(-92.94374847,45.05733871),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mahtomedi Middle School",'Mahtomedi=' + Mahtomedi.length);
Mahtomedi[Mahtomedi.length] = createMarker(new GPoint(-92.95854187,45.07422256),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mahtomedi Preschool",'Mahtomedi=' + Mahtomedi.length);
Mahtomedi[Mahtomedi.length] = createMarker(new GPoint(-92.94450378,45.05733871),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mahtomedi Senior High School",'Mahtomedi=' + Mahtomedi.length);
Marine_On_St_Croix[Marine_On_St_Croix.length] = createMarker(new GPoint(-92.80750275,45.20569992),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Marine Elementary School",'Marine_On_St_Croix=' + Marine_On_St_Croix.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.93434143,44.91300201),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Math & Science Academy",'Woodbury=' + Woodbury.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.80457300,45.02506500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcf-oak Park Heights",'Stillwater=' + Stillwater.length);
Bayport[Bayport.length] = createMarker(new GPoint(-92.78673800,45.02789100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcf-stillwater",'Bayport=' + Bayport.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.92131042,44.90516281),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Middleton Elementary School",'Woodbury=' + Woodbury.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98909760,45.27676392),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Montessori Program",'Forest_Lake=' + Forest_Lake.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81578064,45.05753708),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Heights School, Inc.",'Stillwater=' + Stillwater.length);
Newport[Newport.length] = createMarker(new GPoint(-93.00119019,44.86365509),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Newport Elementary School",'Newport=' + Newport.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98654175,45.28653717),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("North Lakes Academy Charter",'Forest_Lake=' + Forest_Lake.length);
Mahtomedi[Mahtomedi.length] = createMarker(new GPoint(-92.95470428,45.04842377),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("O.h. Anderson Elementary School",'Mahtomedi=' + Mahtomedi.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.80610657,45.04090881),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak Park Elementary School",'Stillwater=' + Stillwater.length);
Lake_Elmo[Lake_Elmo.length] = createMarker(new GPoint(-92.86289215,44.96113968),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oak-land Junior Middle School",'Lake_Elmo=' + Lake_Elmo.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.97952271,44.96072006),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakdale Elementary School",'Oakdale=' + Oakdale.length);
White_Bear_Lake[White_Bear_Lake.length] = createMarker(new GPoint(-93.01231600,45.08269900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oll Academy",'White_Bear_Lake=' + White_Bear_Lake.length);
St_Paul_Park[St_Paul_Park.length] = createMarker(new GPoint(-92.99770355,44.83993530),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oltman Junior Middle School",'St_Paul_Park=' + St_Paul_Park.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.94309235,44.83383560),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Park Senior High School",'Cottage_Grove=' + Cottage_Grove.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.96440887,44.81905746),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pine Hill Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.85552216,45.03101349),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Place",'Stillwater=' + Stillwater.length);
St_Paul_Park[St_Paul_Park.length] = createMarker(new GPoint(-92.98250580,44.83560181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pullman Elementary School",'St_Paul_Park=' + St_Paul_Park.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.95739746,44.82918930),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Red Rock Elementary School",'Cottage_Grove=' + Cottage_Grove.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.94360352,44.91989899),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Red Rock Elementary School",'Woodbury=' + Woodbury.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.95735931,44.91966248),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Royal Oaks Elementary School",'Woodbury=' + Woodbury.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.85807800,45.05696106),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rutherford Elementary School",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81038100,45.05568200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Saint Croix Preparatory Academy",'Stillwater=' + Stillwater.length);
Scandia[Scandia.length] = createMarker(new GPoint(-92.81137085,45.25638962),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Scandia Elementary School",'Scandia=' + Scandia.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.93681335,44.81771469),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Second Opportunity School",'Cottage_Grove=' + Cottage_Grove.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.94641113,44.96472168),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Skyview Community Elementary School",'Oakdale=' + Oakdale.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.94641113,44.96472168),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Skyview Community Middle School",'Oakdale=' + Oakdale.length);
Cottage_Grove[Cottage_Grove.length] = createMarker(new GPoint(-92.93681335,44.81771469),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("So. Washington Alt. Learning Cnt.",'Cottage_Grove=' + Cottage_Grove.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98551941,45.27006531),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Southwest Junior Middle School",'Forest_Lake=' + Forest_Lake.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.82073975,45.03892899),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Special Services",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.82073975,45.03892899),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Special Services-ecse Elementary School",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.85521698,45.03131866),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Croix Valley Alc High School",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81172180,45.04456329),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Stillwater Junior Middle School",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.85113525,45.03112793),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stillwater Senior High School",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81057400,45.05670000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stillwater Special Services-ecse",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.85575000,45.03147400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stillwater Targeted Services",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.82069397,45.06303787),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stonebridge Elementary School",'Stillwater=' + Stillwater.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.96999359,44.96080017),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tartan Senior High School",'Oakdale=' + Oakdale.length);
Oakdale[Oakdale.length] = createMarker(new GPoint(-92.94360352,44.91989899),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tlc 1",'Oakdale=' + Oakdale.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81945000,45.03893400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tlc Ii",'Stillwater=' + Stillwater.length);
Forest_Lake[Forest_Lake.length] = createMarker(new GPoint(-92.98144600,45.26001200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Town Square Center",'Forest_Lake=' + Forest_Lake.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.90888977,44.91465378),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Valley Crossing Community Elementary School",'Woodbury=' + Woodbury.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.90888977,44.91465378),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Valley Crossing Community School",'Woodbury=' + Woodbury.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.90888977,44.91465378),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Valley Crossing Special Ed Elementary School",'Woodbury=' + Woodbury.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.94061700,44.91987600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Valley Crossing Year-around Elementary School",'Woodbury=' + Woodbury.length);
White_Bear_Lake[White_Bear_Lake.length] = createMarker(new GPoint(-92.98457336,45.03971863),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vocational Secondary Ctr.",'White_Bear_Lake=' + White_Bear_Lake.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-92.81057400,45.05670000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wcjc",'Stillwater=' + Stillwater.length);
Mahtomedi[Mahtomedi.length] = createMarker(new GPoint(-92.95499420,45.06233215),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wildwood Elementary School",'Mahtomedi=' + Mahtomedi.length);
Hugo[Hugo.length] = createMarker(new GPoint(-92.90298462,45.12733841),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Withrow Elementary School",'Hugo=' + Hugo.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.97428894,44.93067932),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Woodbury Elementary School",'Woodbury=' + Woodbury.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.97439575,44.92767334),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Woodbury Junior Middle School",'Woodbury=' + Woodbury.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-92.96422577,44.91019058),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Woodbury Senior High School",'Woodbury=' + Woodbury.length);
} // End addStateMarkers JavaScript Function
// Takes an array of markers and centers/zooms map based on marker range
function centerByArray(myArray, recenter, newMaxMin)
{
if (newMaxMin == true)
reMaxMin(myArray);
for (var i = 0; i < myArray.length; i++)
{
var markLng = myArray[i].getPoint().x;
var markLat = myArray[i].getPoint().y;
if (markLat > maxLat) maxLat = markLat;
if (markLng > maxLng) maxLng = markLng;
if (markLat < minLat) minLat = markLat;
if (markLng < minLng) minLng = markLng;
}
if (recenter)
reCenterMap();
}
// Reinit max/mins
function reMaxMin(myArray)
{
maxLng = myArray[0].getPoint().x;
maxLat = myArray[0].getPoint().y;
minLng = myArray[0].getPoint().x;
minLat = myArray[0].getPoint().y;
}
// Recenter map based on global max/mins
function reCenterMap()
{
var bounds = new GLatLngBounds();
bounds.extend(new GLatLng(minLat, minLng));
bounds.extend(new GLatLng(maxLat, maxLng));
var center_lat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) / 2.0;
var center_lng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) / 2.0;
var center = new GLatLng(center_lat, center_lng);
var zoom = map.getBoundsZoomLevel(bounds);
map.setCenter(center,zoom);
//map.setCenter(center,10);
/*
var center = new GPoint( (maxLng + minLng)/2, (maxLat+minLat)/2 );
var delta = new GSize(maxLng - minLng, maxLat - minLat);
var minZoom = map.spec.getLowestZoomLevel(center, delta, map.viewSize);
if (minZoom < 4) minZoom = 4; // Lowest possible zoom is 4
map.centerAndZoom(center, minZoom);
*/
}
// Fires when drop down list of schools changes
function selectChange(selection)
{
var myVal = selection.options[selection.selectedIndex].value;
map.closeInfoWindow();
// Add entire array based on variable type
if (myVal.indexOf('all') != -1 && myVal != 'all')
{
var temp = myVal.split('=');
var showArray = temp[1];
// If Array is > X amount of markers, then open in a new page
if (eval(showArray).length > 20)
// New window depends on whether or not we're on the search page
if (location.href.indexOf('nearby_schools.php') == -1)
window.open(location.href + '/map/' + showArray);
else
window.open('/search////' + showArray);
map.removeOverlays(Bayport);
map.removeOverlays(Cottage_Grove);
map.removeOverlays(Forest_Lake);
map.removeOverlays(Hugo);
map.removeOverlays(Lake_Elmo);
map.removeOverlays(Lakeland);
map.removeOverlays(Mahtomedi);
map.removeOverlays(Marine_On_St_Croix);
map.removeOverlays(Newport);
map.removeOverlays(Oakdale);
map.removeOverlays(Scandia);
map.removeOverlays(St_Paul_Park);
map.removeOverlays(Stillwater);
map.removeOverlays(Vadnais_Heights);
map.removeOverlays(White_Bear_Lake);
map.removeOverlays(Woodbury);
map.addOverlays(eval(showArray));
centerByArray(eval(showArray), true, true); // Center and zoom on set of markers
}
// Add individual markers
if (myVal.indexOf('all') == -1 && myVal != 'all' && myVal.length)
{
var temp = myVal.split('=');
var myArray = temp[0];
var myIndex = parseInt(temp[1]) - 1;
document.getElementById('map').width = "750";
map.removeOverlay(eval(myArray)[myIndex]);
map.addOverlay(eval(myArray)[myIndex]);
GEvent.trigger(eval(myArray)[myIndex],'click');
}
// Show all markers
if (myVal == 'all')
{
cntMarker = 0;
reMaxMin(Lakeland);map.removeOverlays(Bayport);
map.removeOverlays(Cottage_Grove);
map.removeOverlays(Forest_Lake);
map.removeOverlays(Hugo);
map.removeOverlays(Lake_Elmo);
map.removeOverlays(Lakeland);
map.removeOverlays(Mahtomedi);
map.removeOverlays(Marine_On_St_Croix);
map.removeOverlays(Newport);
map.removeOverlays(Oakdale);
map.removeOverlays(Scandia);
map.removeOverlays(St_Paul_Park);
map.removeOverlays(Stillwater);
map.removeOverlays(Vadnais_Heights);
map.removeOverlays(White_Bear_Lake);
map.removeOverlays(Woodbury);
map.addOverlays(Bayport);
centerByArray(Bayport, false, false);
cntMarker += Bayport.length;
map.addOverlays(Cottage_Grove);
centerByArray(Cottage_Grove, false, false);
cntMarker += Cottage_Grove.length;
map.addOverlays(Forest_Lake);
centerByArray(Forest_Lake, false, false);
cntMarker += Forest_Lake.length;
map.addOverlays(Hugo);
centerByArray(Hugo, false, false);
cntMarker += Hugo.length;
map.addOverlays(Lake_Elmo);
centerByArray(Lake_Elmo, false, false);
cntMarker += Lake_Elmo.length;
map.addOverlays(Lakeland);
centerByArray(Lakeland, false, false);
cntMarker += Lakeland.length;
map.addOverlays(Mahtomedi);
centerByArray(Mahtomedi, false, false);
cntMarker += Mahtomedi.length;
map.addOverlays(Marine_On_St_Croix);
centerByArray(Marine_On_St_Croix, false, false);
cntMarker += Marine_On_St_Croix.length;
map.addOverlays(Newport);
centerByArray(Newport, false, false);
cntMarker += Newport.length;
map.addOverlays(Oakdale);
centerByArray(Oakdale, false, false);
cntMarker += Oakdale.length;
map.addOverlays(Scandia);
centerByArray(Scandia, false, false);
cntMarker += Scandia.length;
map.addOverlays(St_Paul_Park);
centerByArray(St_Paul_Park, false, false);
cntMarker += St_Paul_Park.length;
map.addOverlays(Stillwater);
centerByArray(Stillwater, false, false);
cntMarker += Stillwater.length;
map.addOverlays(Vadnais_Heights);
centerByArray(Vadnais_Heights, false, false);
cntMarker += Vadnais_Heights.length;
map.addOverlays(White_Bear_Lake);
centerByArray(White_Bear_Lake, false, false);
cntMarker += White_Bear_Lake.length;
map.addOverlays(Woodbury);
centerByArray(Woodbury, false, false);
cntMarker += Woodbury.length;
centerByArray(Lakeland,true, false);
if (cntMarker > 20)
// New window depends on whether or not we're on the search page
if (location.href.indexOf('schools-by-distance') == -1)
window.open(location.href + '/map/all');
else
window.open('/search////all');
}
}