function addMarkers() { mySelect = document.getElementById('selection'); Three_Rivers = [];Sturgis = [];Burr_Oak = [];White_Pigeon = [];Centreville = [];Colon = [];Constantine = [];Leonidas = [];Mendon = [];mySelect.options[mySelect.options.length] = new Option("Burr Oak schools",'all=Burr_Oak'); mySelect.options[mySelect.options.length] = new Option("Centreville schools",'all=Centreville'); mySelect.options[mySelect.options.length] = new Option("Colon schools",'all=Colon'); mySelect.options[mySelect.options.length] = new Option("Constantine schools",'all=Constantine'); mySelect.options[mySelect.options.length] = new Option("Leonidas schools",'all=Leonidas'); mySelect.options[mySelect.options.length] = new Option("Mendon schools",'all=Mendon'); mySelect.options[mySelect.options.length] = new Option("Sturgis schools",'all=Sturgis'); mySelect.options[mySelect.options.length] = new Option("Three Rivers schools",'all=Three_Rivers'); mySelect.options[mySelect.options.length] = new Option("White Pigeon schools",'all=White_Pigeon'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.64290619,41.94116974),"
Andrews Elementary School
200 S. Douglas Avenue
Three Rivers, MI 49093

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Andrews Elementary School",'Three_Rivers=' + Three_Rivers.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.40753174,41.80091095),"
Arden Park School
107 Ilene Street
Sturgis, MI 49091

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arden Park School",'Sturgis=' + Sturgis.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.62288666,41.94583893),"
Barrows School
416 Washington Street
Three Rivers, MI 49093

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Barrows School",'Three_Rivers=' + Three_Rivers.length); Burr_Oak[Burr_Oak.length] = createMarker(new GPoint(-85.32679749,41.85169983),"
Burr Oak Elementary School
P.o. Box 337
Burr Oak, MI 49030

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Burr Oak Elementary School",'Burr_Oak=' + Burr_Oak.length); Burr_Oak[Burr_Oak.length] = createMarker(new GPoint(-85.32679749,41.85169983),"
Burr Oak High School
P.o. Box 337
Burr Oak, MI 49030

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Burr Oak High School",'Burr_Oak=' + Burr_Oak.length); White_Pigeon[White_Pigeon.length] = createMarker(new GPoint(-85.67030334,41.79520035),"
Central Elementary School
305 E. Hotchin Street
White Pigeon, MI 49099

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'White_Pigeon=' + White_Pigeon.length); Centreville[Centreville.length] = createMarker(new GPoint(-85.51550293,41.92110062),"
Centreville Elementary School
P.o. Box 158
Centreville, MI 49032

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centreville Elementary School",'Centreville=' + Centreville.length); Centreville[Centreville.length] = createMarker(new GPoint(-85.51550293,41.92110062),"
Centreville High School
P.o. Box 158
Centreville, MI 49032

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centreville High School",'Centreville=' + Centreville.length); Centreville[Centreville.length] = createMarker(new GPoint(-85.51550293,41.92110062),"
Centreville Middle School
P.o. Box 158
Centreville, MI 49032

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Centreville Middle School",'Centreville=' + Centreville.length); Colon[Colon.length] = createMarker(new GPoint(-85.32209778,41.95814514),"
Colon Elementary School
328 E. State Street
Colon, MI 49040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Colon Elementary School",'Colon=' + Colon.length); Colon[Colon.length] = createMarker(new GPoint(-85.31708527,41.95969009),"
Colon High School
400 Dallas Street
Colon, MI 49040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colon High School",'Colon=' + Colon.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.41208649,41.79666138),"
Congress School
421 E. Congress
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Congress School",'Sturgis=' + Sturgis.length); Constantine[Constantine.length] = createMarker(new GPoint(-85.66769409,41.83630753),"
Constantine High School
One Falcon Dr
Constantine, MI 49042

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Constantine High School",'Constantine=' + Constantine.length); Constantine[Constantine.length] = createMarker(new GPoint(-85.66605377,41.83549500),"
Constantine Middle School
260 W Sixth Street
Constantine, MI 49042

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Constantine Middle School",'Constantine=' + Constantine.length); Centreville[Centreville.length] = createMarker(new GPoint(-85.51550293,41.92110062),"
Covered Bridge School
P.o. Box 158
Centreville, MI 49032

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covered Bridge School",'Centreville=' + Centreville.length); Constantine[Constantine.length] = createMarker(new GPoint(-85.66282654,41.83333588),"
Eastside Elementary School
935 White Pigeon Road
Constantine, MI 49042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastside Elementary School",'Constantine=' + Constantine.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.39861298,41.80163956),"
Eastwood School
909 Franks Avenue
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastwood School",'Sturgis=' + Sturgis.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.35037994,41.79169083),"
Fawn River School
69090 Carls Road
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fawn River School",'Sturgis=' + Sturgis.length); Centreville[Centreville.length] = createMarker(new GPoint(-85.50694200,41.89464200),"
Great Start Program
62445 Shimmel Road
Centreville, MI 49032

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Great Start Program",'Centreville=' + Centreville.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.62459564,41.93300629),"
Huss School-alternative Academy
1008 8th Street
Three Rivers, MI 49093

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Huss School-alternative Academy",'Three_Rivers=' + Three_Rivers.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.41608429,41.80856323),"
Jerolene School
303 E. Jerolene Street
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jerolene School",'Sturgis=' + Sturgis.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.66520691,41.93956375),"
Johnnycake School
15464 Millard Road
Three Rivers, MI 49093

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Johnnycake School",'Three_Rivers=' + Three_Rivers.length); Leonidas[Leonidas.length] = createMarker(new GPoint(-85.23039246,42.08742523),"
Leonidas Child Development C Elementary School
30945 Church Street
Leonidas, MI 49066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leonidas Child Development C Elementary School",'Leonidas=' + Leonidas.length); Leonidas[Leonidas.length] = createMarker(new GPoint(-85.35227966,42.02109909),"
Leonidas Child Development Center
30945 Church Street
Leonidas, MI 49066

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leonidas Child Development Center",'Leonidas=' + Leonidas.length); White_Pigeon[White_Pigeon.length] = createMarker(new GPoint(-85.67030334,41.79520035),"
Little Chief's Village School
P.o. Box 488
White Pigeon, MI 49099

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Little Chief's Village School",'White_Pigeon=' + White_Pigeon.length); Mendon[Mendon.length] = createMarker(new GPoint(-85.45252991,42.01123810),"
Mendon Elementary School
306 Lane Street
Mendon, MI 49072

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mendon Elementary School",'Mendon=' + Mendon.length); Mendon[Mendon.length] = createMarker(new GPoint(-85.44950104,42.01369858),"
Mendon Middle/high School
148 Kirby Road
Mendon, MI 49072

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mendon Middle/high School",'Mendon=' + Mendon.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.63220215,41.94350815),"
Norton Elementary School
59692 A.l. Jones Road
Three Rivers, MI 49093

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Norton Elementary School",'Three_Rivers=' + Three_Rivers.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.44013977,41.91923523),"
Nottawa Community School
26438 M-86
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nottawa Community School",'Sturgis=' + Sturgis.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.63583374,42.01776123),"
Park Community School
53806 Wilbur Road
Three Rivers, MI 49093

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Park Community School",'Three_Rivers=' + Three_Rivers.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.42620850,41.79933548),"
Park School
603 Neuman
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Park School",'Sturgis=' + Sturgis.length); Centreville[Centreville.length] = createMarker(new GPoint(-85.51550293,41.92110062),"
Pathfinder Center
62445 Shimmel Road
Centreville, MI 49032

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pathfinder Center",'Centreville=' + Centreville.length); Constantine[Constantine.length] = createMarker(new GPoint(-85.67264557,41.83433914),"
Riverside Elementary School
600 W. 6th Street
Constantine, MI 49042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Elementary School",'Constantine=' + Constantine.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.63451385,41.95019531),"
Ruth Hoppin School
415 N. Main Street
Three Rivers, MI 49093

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ruth Hoppin School",'Three_Rivers=' + Three_Rivers.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.41869400,41.80025000),"
Sturgis High School
216 Vinewood Avenue
Sturgis, MI 49091

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sturgis High School",'Sturgis=' + Sturgis.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.41896820,41.80106354),"
Sturgis Middle School
1400 E. Lafayette
Sturgis, MI 49091

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sturgis Middle School",'Sturgis=' + Sturgis.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.63640000,41.94266700),"
Three Rivers High School
700 6th Avenue
Three Rivers, MI 49093

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Three Rivers High School",'Three_Rivers=' + Three_Rivers.length); Three_Rivers[Three_Rivers.length] = createMarker(new GPoint(-85.61933136,41.95344162),"
Three Rivers Middle School
1101 Jefferson Avenue
Three Rivers, MI 49093

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Three Rivers Middle School",'Three_Rivers=' + Three_Rivers.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.41120148,41.81063843),"
Wall School
702 E. Lafayette Street
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wall School",'Sturgis=' + Sturgis.length); Sturgis[Sturgis.length] = createMarker(new GPoint(-85.42618561,41.79484558),"
Wenzel School
403 S. Park Street
Sturgis, MI 49091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wenzel School",'Sturgis=' + Sturgis.length); White_Pigeon[White_Pigeon.length] = createMarker(new GPoint(-85.67030334,41.79520035),"
White Pigeon Jr/sr High School
410 E. Prairie Avenue
White Pigeon, MI 49099

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("White Pigeon Jr/sr High School",'White_Pigeon=' + White_Pigeon.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(Burr_Oak); map.removeOverlays(Centreville); map.removeOverlays(Colon); map.removeOverlays(Constantine); map.removeOverlays(Leonidas); map.removeOverlays(Mendon); map.removeOverlays(Sturgis); map.removeOverlays(Three_Rivers); map.removeOverlays(White_Pigeon); 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(Three_Rivers);map.removeOverlays(Burr_Oak); map.removeOverlays(Centreville); map.removeOverlays(Colon); map.removeOverlays(Constantine); map.removeOverlays(Leonidas); map.removeOverlays(Mendon); map.removeOverlays(Sturgis); map.removeOverlays(Three_Rivers); map.removeOverlays(White_Pigeon); map.addOverlays(Burr_Oak); centerByArray(Burr_Oak, false, false); cntMarker += Burr_Oak.length; map.addOverlays(Centreville); centerByArray(Centreville, false, false); cntMarker += Centreville.length; map.addOverlays(Colon); centerByArray(Colon, false, false); cntMarker += Colon.length; map.addOverlays(Constantine); centerByArray(Constantine, false, false); cntMarker += Constantine.length; map.addOverlays(Leonidas); centerByArray(Leonidas, false, false); cntMarker += Leonidas.length; map.addOverlays(Mendon); centerByArray(Mendon, false, false); cntMarker += Mendon.length; map.addOverlays(Sturgis); centerByArray(Sturgis, false, false); cntMarker += Sturgis.length; map.addOverlays(Three_Rivers); centerByArray(Three_Rivers, false, false); cntMarker += Three_Rivers.length; map.addOverlays(White_Pigeon); centerByArray(White_Pigeon, false, false); cntMarker += White_Pigeon.length; centerByArray(Three_Rivers,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'); } }