function addMarkers() { mySelect = document.getElementById('selection'); Midland = [];Coleman = [];Hope = [];Sanford = [];mySelect.options[mySelect.options.length] = new Option("Coleman schools",'all=Coleman'); mySelect.options[mySelect.options.length] = new Option("Hope schools",'all=Hope'); mySelect.options[mySelect.options.length] = new Option("Midland schools",'all=Midland'); mySelect.options[mySelect.options.length] = new Option("Sanford schools",'all=Sanford'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Midland[Midland.length] = createMarker(new GPoint(-84.21627808,43.64533615),"
Adams Elementary School
1005 Adams Drive
Midland, MI 48642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adams Elementary School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.19371033,43.62553787),"
Ashman Alternative Ed. Ii--m.s.
2900 Dauer Street
Midland, MI 48642

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ashman Alternative Ed. Ii--m.s.",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.24741364,43.58234787),"
Bullock Creek Elementary School
1037 S. Poseyville Road
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bullock Creek Elementary School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.29055023,43.56487274),"
Bullock Creek High School
1420 S. Badour Road
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bullock Creek High School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.29055023,43.56487274),"
Bullock Creek Middle School
644 S. Badour Road
Midland, MI 48640

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bullock Creek Middle School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.24343872,43.62070465),"
Carpenter School
1407 W. Carpenter Street
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carpenter School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.23548889,43.61771774),"
Central Middle School
305 E. Reardon Street
Midland, MI 48640

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.19690704,43.63215256),"
Chestnut Hill School
3900 Chestnut Hill Drive
Midland, MI 48642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chestnut Hill School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.28259277,43.61614609),"
Chippewassee School
919 Smith Road
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chippewassee School",'Midland=' + Midland.length); Coleman[Coleman.length] = createMarker(new GPoint(-84.55999756,43.74340057),"
Coleman Elementary School
Po Box 522
Coleman, MI 48618

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coleman Elementary School",'Coleman=' + Coleman.length); Coleman[Coleman.length] = createMarker(new GPoint(-84.55999756,43.74340057),"
Coleman High School
P.o. Box 522
Coleman, MI 48618

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coleman High School",'Coleman=' + Coleman.length); Coleman[Coleman.length] = createMarker(new GPoint(-84.55999756,43.74340057),"
Coleman Middle School
P.o. Box 522
Coleman, MI 48618

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Coleman Middle School",'Coleman=' + Coleman.length); Midland[Midland.length] = createMarker(new GPoint(-84.27667999,43.64779282),"
Cook Elementary School
5500 Perrine Road
Midland, MI 48642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cook Elementary School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.22682953,43.61963654),"
Eastlawn School
115 Eastlawn Drive
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastlawn School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.40912628,43.58919525),"
Floyd School
725 S. 8 Mile Road
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Floyd School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.27389526,43.64116287),"
H.h. Dow High School
3901 N. Saginaw Road
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("H.h. Dow High School",'Midland=' + Midland.length); Hope[Hope.length] = createMarker(new GPoint(-84.36866760,43.76998520),"
Hillside Early Childhood Center
59 W. Baker Road
Hope, MI 48628

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillside Early Childhood Center",'Hope=' + Hope.length); Midland[Midland.length] = createMarker(new GPoint(-84.23225403,43.64804459),"
Jefferson Middle School
800 W. Chapel Lane
Midland, MI 48640

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jefferson Middle School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.22731018,43.61903381),"
Leiphart High School--alt. Ed.
2279 N. Jefferson Avenue
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Leiphart High School--alt. Ed.",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.19029236,43.60293579),"
Longview Elementary School
337 Lemke Street
Midland, MI 48642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Longview Elementary School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.22708893,43.63292313),"
Mcesa And Sugnet School Classroom Programs
3917 Jefferson Avenue
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcesa And Sugnet School Classroom Programs",'Midland=' + Midland.length); Sanford[Sanford.length] = createMarker(new GPoint(-84.36838531,43.70934296),"
Meridian Elementary School
3353 North M-30
Sanford, MI 48657

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meridian Elementary School",'Sanford=' + Sanford.length); Sanford[Sanford.length] = createMarker(new GPoint(-84.38031006,43.67287064),"
Meridian High School
3303 North Highway M-30
Sanford, MI 48657

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meridian High School",'Sanford=' + Sanford.length); Sanford[Sanford.length] = createMarker(new GPoint(-84.36838531,43.71310806),"
Meridian Junior High School
3475 North M-30
Sanford, MI 48657

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Meridian Junior High School",'Sanford=' + Sanford.length); Midland[Midland.length] = createMarker(new GPoint(-84.18054199,43.56863022),"
Midland Academy Of Advanced & Creative Studies
4653 E. Bailey Bridge Road
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midland Academy Of Advanced & Creative Studies",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.21330261,43.61963654),"
Midland High School
1301 Eastlawn Drive
Midland, MI 48642

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midland High School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.23849487,43.77033997),"
Mills Elementary School
3329 E. Baker Road
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mills Elementary School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.21119690,43.63147736),"
Northeast Middle School
1305 E. Sugnet Road
Midland, MI 48642

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northeast Middle School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.20864868,43.61963654),"
Parkdale Elementary School
1609 Eastlawn Drive
Midland, MI 48642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkdale Elementary School",'Midland=' + Midland.length); Sanford[Sanford.length] = createMarker(new GPoint(-84.36849213,43.70138168),"
Perkins Community Center
3139 North M-30
Sanford, MI 48657

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Perkins Community Center",'Sanford=' + Sanford.length); Midland[Midland.length] = createMarker(new GPoint(-84.29499054,43.59725189),"
Pine River Elementary School
1894 E. Pine River Road
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine River Elementary School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.21374512,43.63348389),"
Plymouth Elementary School
1105 E. Sugnet Road
Midland, MI 48642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Plymouth Elementary School",'Midland=' + Midland.length); Sanford[Sanford.length] = createMarker(new GPoint(-84.40640259,43.76752090),"
Sanford Elementary School
2534 W. River Road
Sanford, MI 48657

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sanford Elementary School",'Sanford=' + Sanford.length); Midland[Midland.length] = createMarker(new GPoint(-84.23985291,43.64952469),"
Siebert School
5700 Siebert Street
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Siebert School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.23399353,43.61530685),"
Special Education Services
600 E. Carpenter Street
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Special Education Services",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.33069611,43.61132050),"
Windover High School
32 S. Homer Road
Midland, MI 48640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Windover High School",'Midland=' + Midland.length); Midland[Midland.length] = createMarker(new GPoint(-84.25930786,43.64773560),"
Woodcrest Elementary School
5500 Drake Street
Midland, MI 48640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodcrest Elementary School",'Midland=' + Midland.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(Coleman); map.removeOverlays(Hope); map.removeOverlays(Midland); map.removeOverlays(Sanford); 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(Midland);map.removeOverlays(Coleman); map.removeOverlays(Hope); map.removeOverlays(Midland); map.removeOverlays(Sanford); map.addOverlays(Coleman); centerByArray(Coleman, false, false); cntMarker += Coleman.length; map.addOverlays(Hope); centerByArray(Hope, false, false); cntMarker += Hope.length; map.addOverlays(Midland); centerByArray(Midland, false, false); cntMarker += Midland.length; map.addOverlays(Sanford); centerByArray(Sanford, false, false); cntMarker += Sanford.length; centerByArray(Midland,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'); } }