function addMarkers() { mySelect = document.getElementById('selection'); Bigfork = [];Cohasset = [];Bovey = [];Deer_River = [];Grand_Rapids = [];Coleraine = [];Keewatin = [];Marble = [];Nashwauk = [];Talmoon = [];Warba = [];Squaw_Lake = [];Togo = [];mySelect.options[mySelect.options.length] = new Option("Bigfork schools",'all=Bigfork'); mySelect.options[mySelect.options.length] = new Option("Bovey schools",'all=Bovey'); mySelect.options[mySelect.options.length] = new Option("Cohasset schools",'all=Cohasset'); mySelect.options[mySelect.options.length] = new Option("Coleraine schools",'all=Coleraine'); mySelect.options[mySelect.options.length] = new Option("Deer River schools",'all=Deer_River'); mySelect.options[mySelect.options.length] = new Option("Grand Rapids schools",'all=Grand_Rapids'); mySelect.options[mySelect.options.length] = new Option("Keewatin schools",'all=Keewatin'); mySelect.options[mySelect.options.length] = new Option("Marble schools",'all=Marble'); mySelect.options[mySelect.options.length] = new Option("Nashwauk schools",'all=Nashwauk'); mySelect.options[mySelect.options.length] = new Option("Squaw Lake schools",'all=Squaw_Lake'); mySelect.options[mySelect.options.length] = new Option("Talmoon schools",'all=Talmoon'); mySelect.options[mySelect.options.length] = new Option("Togo schools",'all=Togo'); mySelect.options[mySelect.options.length] = new Option("Warba schools",'all=Warba'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bigfork[Bigfork.length] = createMarker(new GPoint(-93.53369904,47.69609833),"
Bigfork Elementary School
Box 228
Bigfork, MN 56628

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bigfork Elementary School",'Bigfork=' + Bigfork.length); Bigfork[Bigfork.length] = createMarker(new GPoint(-93.53369904,47.69609833),"
Bigfork Secondary School
Box 228, Huskie Blvd.
Bigfork, MN 56628

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bigfork Secondary School",'Bigfork=' + Bigfork.length); Cohasset[Cohasset.length] = createMarker(new GPoint(-93.64620209,47.25189972),"
Cohasset Elementary School
Box 425
Cohasset, MN 55721

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cohasset Elementary School",'Cohasset=' + Cohasset.length); Bovey[Bovey.length] = createMarker(new GPoint(-93.39179993,47.38029861),"
Connor-jasper Middle School
Box 40
Bovey, MN 55709

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Connor-jasper Middle School",'Bovey=' + Bovey.length); Deer_River[Deer_River.length] = createMarker(new GPoint(-93.87249756,47.43209839),"
Deer River Secondary School
Box 307
Deer River, MN 56636

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deer River Secondary School",'Deer_River=' + Deer_River.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52547455,47.21918106),"
Early Childhood Center
1217 Se 2nd Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Early Childhood Center",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.53919983,47.23939133),"
Forest Lake Elementary School
715 Nw 7th Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Lake Elementary School",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52831268,47.23691177),"
Grand Rapids Alc High School
1851 E Highway 169
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grand Rapids Alc High School",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52831268,47.24158096),"
Grand Rapids Middle School
1000 Ne 8th Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Grand Rapids Middle School",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.54743000,47.24978200),"
Grand Rapids Senior High School
800 Conifer Drive Nw
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grand Rapids Senior High School",'Grand_Rapids=' + Grand_Rapids.length); Coleraine[Coleraine.length] = createMarker(new GPoint(-93.43509674,47.28540039),"
Greenway Senior High School
Box 520
Coleraine, MN 55722

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenway Senior High School",'Coleraine=' + Coleraine.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52996063,47.24048615),"
Itaskin Juvenile Center
820 Nw First Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Itaskin Juvenile Center",'Grand_Rapids=' + Grand_Rapids.length); Keewatin[Keewatin.length] = createMarker(new GPoint(-93.07949829,47.39893723),"
Keewatin Elementary School
300 W 3rd Avenue
Keewatin, MN 55753

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Keewatin Elementary School",'Keewatin=' + Keewatin.length); Deer_River[Deer_River.length] = createMarker(new GPoint(-93.87249756,47.43209839),"
King Elementary School
Box 307
Deer River, MN 56636

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("King Elementary School",'Deer_River=' + Deer_River.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52760315,47.24449921),"
L.e.a.d. Program
820 Nw 1st Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("L.e.a.d. Program",'Grand_Rapids=' + Grand_Rapids.length); Marble[Marble.length] = createMarker(new GPoint(-93.29830170,47.32030106),"
Marble Elementary School
Box 10
Marble, MN 55764

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marble Elementary School",'Marble=' + Marble.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52831268,47.24158096),"
Middle Area Learning Center
1000 Ne 8th Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Middle Area Learning Center",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52020264,47.24066544),"
Murphy Elementary School
822 5th Avenue Ne
Grand Rapids, MN 55744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Murphy Elementary School",'Grand_Rapids=' + Grand_Rapids.length); Nashwauk[Nashwauk.length] = createMarker(new GPoint(-93.16689301,47.37636185),"
Nashwauk Secondary School
400 2nd Street
Nashwauk, MN 55769

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nashwauk Secondary School",'Nashwauk=' + Nashwauk.length); Talmoon[Talmoon.length] = createMarker(new GPoint(-93.79823303,47.60072327),"
North Elementary School
47658 County Road 4
Talmoon, MN 56637

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Talmoon=' + Talmoon.length); Coleraine[Coleraine.length] = createMarker(new GPoint(-93.43509674,47.28540039),"
Northern Lakes Special Ed. Coop.
Box 171
Coleraine, MN 55722

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Lakes Special Ed. Coop.",'Coleraine=' + Coleraine.length); Warba[Warba.length] = createMarker(new GPoint(-93.26657100,47.12896500),"
Northern Lights Community School
P. O. Box 2829
Warba, MN 55793

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Lights Community School",'Warba=' + Warba.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.53948975,47.24987411),"
Northland Educational Center
820 Nw 1st Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northland Educational Center",'Grand_Rapids=' + Grand_Rapids.length); Bovey[Bovey.length] = createMarker(new GPoint(-93.39179993,47.38029861),"
Phillip-murray Elementary School
Box 40
Bovey, MN 55709

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Phillip-murray Elementary School",'Bovey=' + Bovey.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52760315,47.24449921),"
Quad County Telecomm Project
1851 E. Hwy 169
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Quad County Telecomm Project",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.91289520,47.05643845),"
Quad County Vocational Project
1851 E Highway 169
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Quad County Vocational Project",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52369690,47.22806168),"
Riverview Elementary School
300 Se 4th St
Grand Rapids, MN 55744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverview Elementary School",'Grand_Rapids=' + Grand_Rapids.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.53805542,47.22478104),"
Southwest Elementary School
601 Sw 7th Street
Grand Rapids, MN 55744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Grand_Rapids=' + Grand_Rapids.length); Squaw_Lake[Squaw_Lake.length] = createMarker(new GPoint(-94.16500092,47.63159943),"
Squaw Lake Elementary School
Box 427
Squaw Lake, MN 56681

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Squaw Lake Elementary School",'Squaw_Lake=' + Squaw_Lake.length); Grand_Rapids[Grand_Rapids.length] = createMarker(new GPoint(-93.52996063,47.24048615),"
Success Program High School
820 Nw 1st Avenue
Grand Rapids, MN 55744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Success Program High School",'Grand_Rapids=' + Grand_Rapids.length); Togo[Togo.length] = createMarker(new GPoint(-93.21928406,47.78025055),"
Thistledew High School
62741 County Road 551
Togo, MN 55723

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thistledew High School",'Togo=' + Togo.length); Coleraine[Coleraine.length] = createMarker(new GPoint(-93.43509674,47.28540039),"
Vandyke Elementary School
Box 570
Coleraine, MN 55722

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vandyke Elementary School",'Coleraine=' + Coleraine.length); Coleraine[Coleraine.length] = createMarker(new GPoint(-93.42395900,47.28976500),"
Virtual Itasca Academy Of Learning
Greenway High School
Coleraine, MN 55722

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Virtual Itasca Academy Of Learning",'Coleraine=' + Coleraine.length); Togo[Togo.length] = createMarker(new GPoint(-93.21928406,47.78025055),"
Wilderness Endeavors Program High School
62741 County Road 551
Togo, MN 55723

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wilderness Endeavors Program High School",'Togo=' + Togo.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(Bigfork); map.removeOverlays(Bovey); map.removeOverlays(Cohasset); map.removeOverlays(Coleraine); map.removeOverlays(Deer_River); map.removeOverlays(Grand_Rapids); map.removeOverlays(Keewatin); map.removeOverlays(Marble); map.removeOverlays(Nashwauk); map.removeOverlays(Squaw_Lake); map.removeOverlays(Talmoon); map.removeOverlays(Togo); map.removeOverlays(Warba); 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(Bigfork);map.removeOverlays(Bigfork); map.removeOverlays(Bovey); map.removeOverlays(Cohasset); map.removeOverlays(Coleraine); map.removeOverlays(Deer_River); map.removeOverlays(Grand_Rapids); map.removeOverlays(Keewatin); map.removeOverlays(Marble); map.removeOverlays(Nashwauk); map.removeOverlays(Squaw_Lake); map.removeOverlays(Talmoon); map.removeOverlays(Togo); map.removeOverlays(Warba); map.addOverlays(Bigfork); centerByArray(Bigfork, false, false); cntMarker += Bigfork.length; map.addOverlays(Bovey); centerByArray(Bovey, false, false); cntMarker += Bovey.length; map.addOverlays(Cohasset); centerByArray(Cohasset, false, false); cntMarker += Cohasset.length; map.addOverlays(Coleraine); centerByArray(Coleraine, false, false); cntMarker += Coleraine.length; map.addOverlays(Deer_River); centerByArray(Deer_River, false, false); cntMarker += Deer_River.length; map.addOverlays(Grand_Rapids); centerByArray(Grand_Rapids, false, false); cntMarker += Grand_Rapids.length; map.addOverlays(Keewatin); centerByArray(Keewatin, false, false); cntMarker += Keewatin.length; map.addOverlays(Marble); centerByArray(Marble, false, false); cntMarker += Marble.length; map.addOverlays(Nashwauk); centerByArray(Nashwauk, false, false); cntMarker += Nashwauk.length; map.addOverlays(Squaw_Lake); centerByArray(Squaw_Lake, false, false); cntMarker += Squaw_Lake.length; map.addOverlays(Talmoon); centerByArray(Talmoon, false, false); cntMarker += Talmoon.length; map.addOverlays(Togo); centerByArray(Togo, false, false); cntMarker += Togo.length; map.addOverlays(Warba); centerByArray(Warba, false, false); cntMarker += Warba.length; centerByArray(Bigfork,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'); } }