function addMarkers() { mySelect = document.getElementById('selection'); West_Memphis = [];Crawfordsville = [];Earle = [];Marion = [];Turrell = [];Edmondson = [];mySelect.options[mySelect.options.length] = new Option("Crawfordsville schools",'all=Crawfordsville'); mySelect.options[mySelect.options.length] = new Option("Earle schools",'all=Earle'); mySelect.options[mySelect.options.length] = new Option("Edmondson schools",'all=Edmondson'); mySelect.options[mySelect.options.length] = new Option("Marion schools",'all=Marion'); mySelect.options[mySelect.options.length] = new Option("Turrell schools",'all=Turrell'); mySelect.options[mySelect.options.length] = new Option("West Memphis schools",'all=West_Memphis'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.20736694,35.16156387),"
Avondale Elementary School
1402 Crestmere
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Avondale Elementary School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.19108582,35.15354919),"
Bragg Elementary School
309 West Barton
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bragg Elementary School",'West_Memphis=' + West_Memphis.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-90.31670380,35.23160172),"
Crawfordsville Elementary School
Pobox 47
Crawfordsville, AR 72327

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crawfordsville Elementary School",'Crawfordsville=' + Crawfordsville.length); Crawfordsville[Crawfordsville.length] = createMarker(new GPoint(-90.31670380,35.23160172),"
Crawfordsville High School
Pobox 47
Crawfordsville, AR 72327

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crawfordsville High School",'Crawfordsville=' + Crawfordsville.length); Earle[Earle.length] = createMarker(new GPoint(-90.45493600,35.26762700),"
Dunbar Middle School
320 Lee Street
Earle, AR 72331

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dunbar Middle School",'Earle=' + Earle.length); Earle[Earle.length] = createMarker(new GPoint(-90.46189880,35.27759933),"
Earle Elementary School
P.o. Box 637
Earle, AR 72331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Earle Elementary School",'Earle=' + Earle.length); Earle[Earle.length] = createMarker(new GPoint(-90.46894073,35.27428055),"
Earle High School
16432 Hwy 64
Earle, AR 72331

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Earle High School",'Earle=' + Earle.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.15460205,35.15409851),"
East Junior High School
1151 Goodwin St
West Memphis, AR 72301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("East Junior High School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.20423889,35.13683701),"
Faulk Elementary School
908 Vanderbilt
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Faulk Elementary School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.15530396,35.14236450),"
Jackson Elementary School
2395 S.l. Henry St.
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson Elementary School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.15943146,35.15373611),"
Maddux Elementary School
2100 East Barton
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maddux Elementary School",'West_Memphis=' + West_Memphis.length); Marion[Marion.length] = createMarker(new GPoint(-90.19749451,35.21453857),"
Marion Elementary School
235 Military Road
Marion, AR 72364

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marion Elementary School",'Marion=' + Marion.length); Marion[Marion.length] = createMarker(new GPoint(-90.19732666,35.19393539),"
Marion High School
1 Patriot Drive
Marion, AR 72364

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marion High School",'Marion=' + Marion.length); Marion[Marion.length] = createMarker(new GPoint(-90.18948364,35.19726181),"
Marion Intermediate School
100 L.h. Polk
Marion, AR 72364

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marion Intermediate School",'Marion=' + Marion.length); Marion[Marion.length] = createMarker(new GPoint(-90.19766235,35.19397354),"
Marion Junior High School
2 Patriot Drive
Marion, AR 72364

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marion Junior High School",'Marion=' + Marion.length); Marion[Marion.length] = createMarker(new GPoint(-90.19765472,35.19424438),"
Marion Middle School
10 Patriot Drive
Marion, AR 72364

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marion Middle School",'Marion=' + Marion.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.23570600,35.14670300),"
Mid-south Community Coll Tech Center
2000 W. Broadway
West Memphis, AR 72301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mid-south Community Coll Tech Center",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.20822906,35.15347672),"
Richland Elementary School
1011 West Barton
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Richland Elementary School",'West_Memphis=' + West_Memphis.length); Turrell[Turrell.length] = createMarker(new GPoint(-90.25460052,35.33570099),"
Turrell Elementary School
P.o. Box 369
Turrell, AR 72384

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Turrell Elementary School",'Turrell=' + Turrell.length); Turrell[Turrell.length] = createMarker(new GPoint(-90.25460052,35.33570099),"
Turrell High School
P.o. Box 369
Turrell, AR 72384

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Turrell High School",'Turrell=' + Turrell.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.16809082,35.15373993),"
Weaver Elementary School
1280 East Barton
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Weaver Elementary School",'West_Memphis=' + West_Memphis.length); Edmondson[Edmondson.length] = createMarker(new GPoint(-90.31117249,35.10665131),"
Wedlock Elementary School
200 B.j.taylor St.
Edmondson, AR 72332

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wedlock Elementary School",'Edmondson=' + Edmondson.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.19162750,35.15353012),"
West Junior High School
331 W. Barton St
West Memphis, AR 72301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("West Junior High School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.19599915,35.14615631),"
West Memphis High School
501 W. Broadway
West Memphis, AR 72301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Memphis High School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.16522980,35.13719177),"
Wonder Elementary School
801 S. 16 Street
West Memphis, AR 72301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wonder Elementary School",'West_Memphis=' + West_Memphis.length); West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.16752625,35.13646317),"
Wonder Junior High School
1401 Madison St
West Memphis, AR 72301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wonder Junior High School",'West_Memphis=' + West_Memphis.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(Crawfordsville); map.removeOverlays(Earle); map.removeOverlays(Edmondson); map.removeOverlays(Marion); map.removeOverlays(Turrell); map.removeOverlays(West_Memphis); 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(West_Memphis);map.removeOverlays(Crawfordsville); map.removeOverlays(Earle); map.removeOverlays(Edmondson); map.removeOverlays(Marion); map.removeOverlays(Turrell); map.removeOverlays(West_Memphis); map.addOverlays(Crawfordsville); centerByArray(Crawfordsville, false, false); cntMarker += Crawfordsville.length; map.addOverlays(Earle); centerByArray(Earle, false, false); cntMarker += Earle.length; map.addOverlays(Edmondson); centerByArray(Edmondson, false, false); cntMarker += Edmondson.length; map.addOverlays(Marion); centerByArray(Marion, false, false); cntMarker += Marion.length; map.addOverlays(Turrell); centerByArray(Turrell, false, false); cntMarker += Turrell.length; map.addOverlays(West_Memphis); centerByArray(West_Memphis, false, false); cntMarker += West_Memphis.length; centerByArray(West_Memphis,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'); } }