function addMarkers() { mySelect = document.getElementById('selection'); Bronson = [];Coldwater = [];Quincy = [];Union_City = [];mySelect.options[mySelect.options.length] = new Option("Bronson schools",'all=Bronson'); mySelect.options[mySelect.options.length] = new Option("Coldwater schools",'all=Coldwater'); mySelect.options[mySelect.options.length] = new Option("Quincy schools",'all=Quincy'); mySelect.options[mySelect.options.length] = new Option("Union City schools",'all=Union_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bronson[Bronson.length] = createMarker(new GPoint(-85.18853760,41.87324142),"
Anderson Elementary School
546 E. Chicago Street
Bronson, MI 49028

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Anderson Elementary School",'Bronson=' + Bronson.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.01738739,41.95273590),"
Bisd Sp. Ed. Programs In Local School Districts
200 Bishop Avenue
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bisd Sp. Ed. Programs In Local School Districts",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.93125916,41.88378143),"
Branch Area Careers Center
366 Morse Street
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Branch Area Careers Center",'Coldwater=' + Coldwater.length); Bronson[Bronson.length] = createMarker(new GPoint(-85.18933868,41.86853409),"
Bronson Jr/sr High School
450 E. Grant Street
Bronson, MI 49028

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bronson Jr/sr High School",'Bronson=' + Bronson.length); Bronson[Bronson.length] = createMarker(new GPoint(-85.18963623,41.87335205),"
Chicago Street School
501 E. Chicago Street
Bronson, MI 49028

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chicago Street School",'Bronson=' + Bronson.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.01087952,41.93970490),"
Coldwater Alternative High School
95 S. Fremont Street
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coldwater Alternative High School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.01034546,41.94875717),"
Coldwater High School
275 N. Fremont Street
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coldwater High School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.01788330,41.95273590),"
Dorothy Legg Learning Center
212 Bishop
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dorothy Legg Learning Center",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.97111511,41.95305634),"
Early Education Elementary School
398d Willowbrook Road
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Early Education Elementary School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.97777557,43.65910339),"
Girard Elementary School
1011 School Drive
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Girard Elementary School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.00532532,41.94791794),"
Jefferson Elementary School
15 Vans Avenue
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Coldwater=' + Coldwater.length); Quincy[Quincy.length] = createMarker(new GPoint(-84.88075256,41.94033813),"
Jennings Elementary School
44 E Liberty Street
Quincy, MI 49082

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jennings Elementary School",'Quincy=' + Quincy.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.97880554,41.85823441),"
Lakeland Elementary School
519 Otis Road
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakeland Elementary School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.00907898,41.94895554),"
Larsen Elementary School
25 Parkhurst Avenue
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Larsen Elementary School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.01453400,41.95138168),"
Legg Middle School
175 Green Street
Coldwater, MI 49036

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Legg Middle School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.99633789,41.93236160),"
Lincoln Elementary School
70 Tibbits Street
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.99787140,41.95014954),"
Pansophia Academy
52 Abbott Avenue
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pansophia Academy",'Coldwater=' + Coldwater.length); Quincy[Quincy.length] = createMarker(new GPoint(-84.88086700,41.94303513),"
Quincy High School
18 Colfax Street
Quincy, MI 49082

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Quincy High School",'Quincy=' + Quincy.length); Quincy[Quincy.length] = createMarker(new GPoint(-84.88124084,41.94309616),"
Quincy Middle School
32 Fulton Street
Quincy, MI 49082

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Quincy Middle School",'Quincy=' + Quincy.length); Bronson[Bronson.length] = createMarker(new GPoint(-85.20052338,41.86796570),"
Ryan Elementary School
461 Rudd Street
Bronson, MI 49028

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ryan Elementary School",'Bronson=' + Bronson.length); Union_City[Union_City.length] = createMarker(new GPoint(-85.14077759,42.06189346),"
Sherwood Elementary School
430 St Joseph St
Union City, MI 49094

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherwood Elementary School",'Union_City=' + Union_City.length); Union_City[Union_City.length] = createMarker(new GPoint(-85.14077759,42.06189346),"
Union City Elementary School
430 St Joseph Street
Union City, MI 49094

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union City Elementary School",'Union_City=' + Union_City.length); Union_City[Union_City.length] = createMarker(new GPoint(-85.14077759,42.06189346),"
Union City High School
430 St. Joseph Street
Union City, MI 49094

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Union City High School",'Union_City=' + Union_City.length); Union_City[Union_City.length] = createMarker(new GPoint(-85.14077759,42.06189346),"
Union City Middle School
430 St. Joseph Street
Union City, MI 49094

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Union City Middle School",'Union_City=' + Union_City.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-84.93125916,41.88378143),"
Waldron Learning Center
214 Bishop Avenue
Coldwater, MI 49036

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waldron Learning Center",'Coldwater=' + Coldwater.length); Coldwater[Coldwater.length] = createMarker(new GPoint(-85.00869751,41.91080093),"
Washington School
71 Morse Street
Coldwater, MI 49036

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington School",'Coldwater=' + Coldwater.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(Bronson); map.removeOverlays(Coldwater); map.removeOverlays(Quincy); map.removeOverlays(Union_City); 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(Bronson);map.removeOverlays(Bronson); map.removeOverlays(Coldwater); map.removeOverlays(Quincy); map.removeOverlays(Union_City); map.addOverlays(Bronson); centerByArray(Bronson, false, false); cntMarker += Bronson.length; map.addOverlays(Coldwater); centerByArray(Coldwater, false, false); cntMarker += Coldwater.length; map.addOverlays(Quincy); centerByArray(Quincy, false, false); cntMarker += Quincy.length; map.addOverlays(Union_City); centerByArray(Union_City, false, false); cntMarker += Union_City.length; centerByArray(Bronson,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'); } }