function addMarkers() { mySelect = document.getElementById('selection'); Cape_Girardeau = [];Delta = [];Jackson = [];Millersville = [];Oak_Ridge = [];mySelect.options[mySelect.options.length] = new Option("Cape Girardeau schools",'all=Cape_Girardeau'); mySelect.options[mySelect.options.length] = new Option("Delta schools",'all=Delta'); mySelect.options[mySelect.options.length] = new Option("Jackson schools",'all=Jackson'); mySelect.options[mySelect.options.length] = new Option("Millersville schools",'all=Millersville'); mySelect.options[mySelect.options.length] = new Option("Oak Ridge schools",'all=Oak_Ridge'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.55464172,37.32754517),"
Alma Schrader Elementary School
1360 Randol
Cape Girardeau, MO 63701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alma Schrader Elementary School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.52321625,37.32978058),"
Blanchard Elementary School
1829 N Sprigg St
Cape Girardeau, MO 63701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blanchard Elementary School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.56636047,37.27548981),"
Cape Girardeau Car. & Technical Center
1080 S Silver Springs Rd
Cape Girardeau, MO 63703

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cape Girardeau Car. & Technical Center",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.56655884,37.31040573),"
Central High School
1000 S Silver Springs Rd
Cape Girardeau, MO 63701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central High School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.54493713,37.30796051),"
Central Junior High School
205 Caruthers
Cape Girardeau, MO 63701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Junior High School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.54452515,37.31106949),"
Central Middle School
1900 Thilenius
Cape Girardeau, MO 63701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.57043457,37.32136917),"
Clippard Elementary School
2860 Hopper Rd
Cape Girardeau, MO 63701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clippard Elementary School",'Cape_Girardeau=' + Cape_Girardeau.length); Delta[Delta.length] = createMarker(new GPoint(-89.76689911,37.18239975),"
Delta Elementary School
Po Box 219
Delta, MO 63744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Delta Elementary School",'Delta=' + Delta.length); Delta[Delta.length] = createMarker(new GPoint(-89.76689911,37.18239975),"
Delta High School
Po Box 787
Delta, MO 63744

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Delta High School",'Delta=' + Delta.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.57473755,37.28596115),"
Echo Day Treatment Ctr.
3445 Armstrong Dr
Cape Girardeau, MO 63703

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Echo Day Treatment Ctr.",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.53818512,37.30731583),"
Franklin Elementary School
215 N Louisiana
Cape Girardeau, MO 63701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-93.26392365,44.98011780),"
Girardot Center For Youth
Po Box 936
Cape Girardeau, MO 63702

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Girardot Center For Youth",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.67618561,37.31112289),"
Gordonville Attendance Center
653 State Hwy Z
Cape Girardeau, MO 63701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gordonville Attendance Center",'Cape_Girardeau=' + Cape_Girardeau.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.68589020,37.39440536),"
Jackson Middle School
1651 W Independence St
Jackson, MO 63755

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jackson Middle School",'Jackson=' + Jackson.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.66938019,37.38055038),"
Jackson Senior High School
315 S Missouri
Jackson, MO 63755

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jackson Senior High School",'Jackson=' + Jackson.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.54182434,37.29870987),"
Jefferson Elementary School
520 S Minnesota
Cape Girardeau, MO 63703

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.53034210,37.30295181),"
L. J. Schultz Junior High School
101 S Pacific
Cape Girardeau, MO 63703

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("L. J. Schultz Junior High School",'Cape_Girardeau=' + Cape_Girardeau.length); Millersville[Millersville.length] = createMarker(new GPoint(-89.79907990,37.43289948),"
Millersville Attendance Center
377 State Hwy B
Millersville, MO 63766

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Millersville Attendance Center",'Millersville=' + Millersville.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.47316742,37.38742065),"
Nell Holcomb Elementary School
6547 State Hwy 177
Cape Girardeau, MO 63701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nell Holcomb Elementary School",'Cape_Girardeau=' + Cape_Girardeau.length); Jackson[Jackson.length] = createMarker(new GPoint(-93.12229919,40.19342422),"
North Elementary School
10730 State Hwy W
Jackson, MO 63755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Jackson=' + Jackson.length); Oak_Ridge[Oak_Ridge.length] = createMarker(new GPoint(-89.73560333,37.52099991),"
Oak Ridge Elementary School
Po Box 10
Oak Ridge, MO 63769

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Ridge Elementary School",'Oak_Ridge=' + Oak_Ridge.length); Oak_Ridge[Oak_Ridge.length] = createMarker(new GPoint(-89.73560333,37.52099991),"
Oak Ridge High School
Po Box 10
Oak Ridge, MO 63769

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Ridge High School",'Oak_Ridge=' + Oak_Ridge.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.68607330,37.38828278),"
Orchard Drive Elementary School
1402 Orchard Dr
Jackson, MO 63755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Orchard Drive Elementary School",'Jackson=' + Jackson.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.53544617,37.29026031),"
Parkview
1020 South Parkway Drive
Cape Girardeau, MO 63703

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parkview",'Cape_Girardeau=' + Cape_Girardeau.length); Cape_Girardeau[Cape_Girardeau.length] = createMarker(new GPoint(-89.64366150,37.26213837),"
Parkview State School
1020 S Parkway Dr
Cape Girardeau, MO 63703

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parkview State School",'Cape_Girardeau=' + Cape_Girardeau.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.67221832,37.38100433),"
Primary Annex
444 W Jefferson
Jackson, MO 63755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Primary Annex",'Jackson=' + Jackson.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.69243622,37.38550568),"
Russell Hawkins Jr. High School
210 N West Ln
Jackson, MO 63755

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Russell Hawkins Jr. High School",'Jackson=' + Jackson.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.66091919,37.36666107),"
South Elementary School
1701 S Hope St
Jackson, MO 63755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Jackson=' + Jackson.length); Jackson[Jackson.length] = createMarker(new GPoint(-89.69211578,37.38771057),"
West Lane Elementary School
338 N West Ln
Jackson, MO 63755

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("West Lane Elementary School",'Jackson=' + Jackson.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(Cape_Girardeau); map.removeOverlays(Delta); map.removeOverlays(Jackson); map.removeOverlays(Millersville); map.removeOverlays(Oak_Ridge); 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(Cape_Girardeau);map.removeOverlays(Cape_Girardeau); map.removeOverlays(Delta); map.removeOverlays(Jackson); map.removeOverlays(Millersville); map.removeOverlays(Oak_Ridge); map.addOverlays(Cape_Girardeau); centerByArray(Cape_Girardeau, false, false); cntMarker += Cape_Girardeau.length; map.addOverlays(Delta); centerByArray(Delta, false, false); cntMarker += Delta.length; map.addOverlays(Jackson); centerByArray(Jackson, false, false); cntMarker += Jackson.length; map.addOverlays(Millersville); centerByArray(Millersville, false, false); cntMarker += Millersville.length; map.addOverlays(Oak_Ridge); centerByArray(Oak_Ridge, false, false); cntMarker += Oak_Ridge.length; centerByArray(Cape_Girardeau,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'); } }