function addMarkers() { mySelect = document.getElementById('selection'); Austin = [];Brownsdale = [];Grand_Meadow = [];Leroy = [];Lyle = [];Rose_Creek = [];Adams = [];mySelect.options[mySelect.options.length] = new Option("Adams schools",'all=Adams'); mySelect.options[mySelect.options.length] = new Option("Austin schools",'all=Austin'); mySelect.options[mySelect.options.length] = new Option("Brownsdale schools",'all=Brownsdale'); mySelect.options[mySelect.options.length] = new Option("Grand Meadow schools",'all=Grand_Meadow'); mySelect.options[mySelect.options.length] = new Option("Leroy schools",'all=Leroy'); mySelect.options[mySelect.options.length] = new Option("Lyle schools",'all=Lyle'); mySelect.options[mySelect.options.length] = new Option("Rose Creek schools",'all=Rose_Creek'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Austin[Austin.length] = createMarker(new GPoint(-92.97879028,43.66844559),"
Austin Alc
401 Third Avenue Nw
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Austin Alc",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97861600,43.66924900),"
Austin Area Learning Cntr. - Summer
401 Third Avenue Nw
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Austin Area Learning Cntr. - Summer",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.96460100,43.66769400),"
Austin Community Learning Center
912 First Avenue Ne
Austin, MN 55912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Austin Community Learning Center",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97879028,43.66844559),"
Austin Gerard Residential
401 3rd Avenue Nw
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Austin Gerard Residential",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97879028,43.66844559),"
Austin Senior High School
301 3rd Street Nw
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Austin Senior High School",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97233300,43.66659000),"
Austin Targeted Services
805 8th Avenue Nw
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Austin Targeted Services",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.99661255,43.66515732),"
Banfield Elementary School
301 17th Street Sw
Austin, MN 55912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Banfield Elementary School",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97879028,43.66844559),"
Bank School
301 Nw Third Street
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bank School",'Austin=' + Austin.length); Brownsdale[Brownsdale.length] = createMarker(new GPoint(-92.86789703,43.71910095),"
Brownsdale Elementary School
Latham And Mill Street
Brownsdale, MN 55918

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brownsdale Elementary School",'Brownsdale=' + Brownsdale.length); Austin[Austin.length] = createMarker(new GPoint(-92.95091248,43.66306305),"
Ellis Middle School
1700 4th Avenue Se
Austin, MN 55912

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ellis Middle School",'Austin=' + Austin.length); Grand_Meadow[Grand_Meadow.length] = createMarker(new GPoint(-92.55249786,43.70759964),"
Grand Meadow Elementary School
Box 68
Grand Meadow, MN 55936

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grand Meadow Elementary School",'Grand_Meadow=' + Grand_Meadow.length); Grand_Meadow[Grand_Meadow.length] = createMarker(new GPoint(-92.55249786,43.70759964),"
Grand Meadow Secondary School
Box 68
Grand Meadow, MN 55936

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Grand Meadow Secondary School",'Grand_Meadow=' + Grand_Meadow.length); Grand_Meadow[Grand_Meadow.length] = createMarker(new GPoint(-92.56971400,43.70628500),"
Grand Meadow Senior High School
Box 68
Grand Meadow, MN 55936

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grand Meadow Senior High School",'Grand_Meadow=' + Grand_Meadow.length); Leroy[Leroy.length] = createMarker(new GPoint(-92.50579834,43.53620148),"
Leroy Elementary School
Box 1000
Leroy, MN 55951

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leroy Elementary School",'Leroy=' + Leroy.length); Leroy[Leroy.length] = createMarker(new GPoint(-92.50579834,43.53620148),"
Leroy Secondary School
Box 1000
Leroy, MN 55951

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Leroy Secondary School",'Leroy=' + Leroy.length); Lyle[Lyle.length] = createMarker(new GPoint(-92.94458008,43.50471878),"
Lyle Elementary School
700 E 2nd Street
Lyle, MN 55953

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lyle Elementary School",'Lyle=' + Lyle.length); Lyle[Lyle.length] = createMarker(new GPoint(-92.94523100,43.50936800),"
Lyle Secondary
700 E 2nd Street
Lyle, MN 55953

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lyle Secondary",'Lyle=' + Lyle.length); Austin[Austin.length] = createMarker(new GPoint(-92.98059845,43.67979813),"
Mn Sheriff Ranch School Shelter
1918 4th Street Se
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mn Sheriff Ranch School Shelter",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.98059845,43.67979813),"
Mn Sheriff Ranch-correctional
Route 3, Box 604
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mn Sheriff Ranch-correctional",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.94670868,43.66669083),"
Neveln Elementary School
1918 E Oakland Avenue
Austin, MN 55912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Neveln Elementary School",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97233300,43.66659000),"
Ranch School Shelter
1918 4th Street Se
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ranch School Shelter",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.99361420,43.64856339),"
Southgate Elementary School
1601 Sw 19th Avenue
Austin, MN 55912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southgate Elementary School",'Austin=' + Austin.length); Rose_Creek[Rose_Creek.length] = createMarker(new GPoint(-92.84059906,43.61069870),"
Southland Elementary School
Box 157
Rose Creek, MN 55970

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southland Elementary School",'Rose_Creek=' + Rose_Creek.length); Adams[Adams.length] = createMarker(new GPoint(-92.72290039,43.56470108),"
Southland Middle School
Box 351
Adams, MN 55909

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southland Middle School",'Adams=' + Adams.length); Adams[Adams.length] = createMarker(new GPoint(-92.72290039,43.56470108),"
Southland Senior High School
Box 351
Adams, MN 55909

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southland Senior High School",'Adams=' + Adams.length); Austin[Austin.length] = createMarker(new GPoint(-92.98373413,43.67386246),"
Sumner Elementary School
805 8th Avenue Nw
Austin, MN 55912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sumner Elementary School",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.97233300,43.66659000),"
Targeted Services Summer Program
1918 E Oakland Avenue
Austin, MN 55912

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Targeted Services Summer Program",'Austin=' + Austin.length); Austin[Austin.length] = createMarker(new GPoint(-92.96950531,43.65251160),"
Woodson Community School
1601 4th Street Se
Austin, MN 55912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodson Community School",'Austin=' + Austin.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(Adams); map.removeOverlays(Austin); map.removeOverlays(Brownsdale); map.removeOverlays(Grand_Meadow); map.removeOverlays(Leroy); map.removeOverlays(Lyle); map.removeOverlays(Rose_Creek); 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(Austin);map.removeOverlays(Adams); map.removeOverlays(Austin); map.removeOverlays(Brownsdale); map.removeOverlays(Grand_Meadow); map.removeOverlays(Leroy); map.removeOverlays(Lyle); map.removeOverlays(Rose_Creek); map.addOverlays(Adams); centerByArray(Adams, false, false); cntMarker += Adams.length; map.addOverlays(Austin); centerByArray(Austin, false, false); cntMarker += Austin.length; map.addOverlays(Brownsdale); centerByArray(Brownsdale, false, false); cntMarker += Brownsdale.length; map.addOverlays(Grand_Meadow); centerByArray(Grand_Meadow, false, false); cntMarker += Grand_Meadow.length; map.addOverlays(Leroy); centerByArray(Leroy, false, false); cntMarker += Leroy.length; map.addOverlays(Lyle); centerByArray(Lyle, false, false); cntMarker += Lyle.length; map.addOverlays(Rose_Creek); centerByArray(Rose_Creek, false, false); cntMarker += Rose_Creek.length; centerByArray(Austin,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'); } }