function addMarkers() { mySelect = document.getElementById('selection'); Carthage = [];Dallas_City = [];Hamilton = [];La_Harpe = [];Nauvoo = [];Plymouth = [];Augusta = [];Bowen = [];Warsaw = [];mySelect.options[mySelect.options.length] = new Option("Augusta schools",'all=Augusta'); mySelect.options[mySelect.options.length] = new Option("Bowen schools",'all=Bowen'); mySelect.options[mySelect.options.length] = new Option("Carthage schools",'all=Carthage'); mySelect.options[mySelect.options.length] = new Option("Dallas City schools",'all=Dallas_City'); mySelect.options[mySelect.options.length] = new Option("Hamilton schools",'all=Hamilton'); mySelect.options[mySelect.options.length] = new Option("La Harpe schools",'all=La_Harpe'); mySelect.options[mySelect.options.length] = new Option("Nauvoo schools",'all=Nauvoo'); mySelect.options[mySelect.options.length] = new Option("Plymouth schools",'all=Plymouth'); mySelect.options[mySelect.options.length] = new Option("Warsaw schools",'all=Warsaw'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Carthage[Carthage.length] = createMarker(new GPoint(-91.13473511,40.41088486),"
Carthage High School
210 S Adams
Carthage, IL 62321

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carthage High School",'Carthage=' + Carthage.length); Carthage[Carthage.length] = createMarker(new GPoint(-91.13473511,40.41088486),"
Carthage Intermediate School
210 S Adams
Carthage, IL 62321

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Carthage Intermediate School",'Carthage=' + Carthage.length); Carthage[Carthage.length] = createMarker(new GPoint(-91.13473511,40.41088486),"
Carthage Middle School
210 S Adams
Carthage, IL 62321

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Carthage Middle School",'Carthage=' + Carthage.length); Carthage[Carthage.length] = createMarker(new GPoint(-91.13473511,40.41088486),"
Carthage Primary School
210 S Adams
Carthage, IL 62321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carthage Primary School",'Carthage=' + Carthage.length); Dallas_City[Dallas_City.length] = createMarker(new GPoint(-91.15670776,40.62396622),"
Dallas City Elementary School
921 Creamery Hill Rd
Dallas City, IL 62330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dallas City Elementary School",'Dallas_City=' + Dallas_City.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-91.33148193,40.39279938),"
Hamilton Elementary School
1830 Broadway
Hamilton, IL 62341

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Elementary School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-91.34333038,40.39646149),"
Hamilton High School
1100 Keokuk St
Hamilton, IL 62341

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hamilton High School",'Hamilton=' + Hamilton.length); Hamilton[Hamilton.length] = createMarker(new GPoint(-91.34515381,40.39612579),"
Hamilton Junior High School
270 N 10th St
Hamilton, IL 62341

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hamilton Junior High School",'Hamilton=' + Hamilton.length); Carthage[Carthage.length] = createMarker(new GPoint(-91.10649872,40.40879822),"
Hancock County Academy
553 Main St
Carthage, IL 62321

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hancock County Academy",'Carthage=' + Carthage.length); Carthage[Carthage.length] = createMarker(new GPoint(-91.13472748,40.41099930),"
Hancock County Learning Center
553 Main St
Carthage, IL 62321

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hancock County Learning Center",'Carthage=' + Carthage.length); La_Harpe[La_Harpe.length] = createMarker(new GPoint(-90.97313690,40.58362579),"
La Harpe High School
404 W Main St
La Harpe, IL 61450

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("La Harpe High School",'La_Harpe=' + La_Harpe.length); La_Harpe[La_Harpe.length] = createMarker(new GPoint(-90.97313690,40.58362579),"
Laharpe Elementary School
404 W Main St
La Harpe, IL 61450

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laharpe Elementary School",'La_Harpe=' + La_Harpe.length); La_Harpe[La_Harpe.length] = createMarker(new GPoint(-90.97313690,40.58362579),"
Laharpe Junior High School
404 W Main St
La Harpe, IL 61450

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Laharpe Junior High School",'La_Harpe=' + La_Harpe.length); Nauvoo[Nauvoo.length] = createMarker(new GPoint(-91.36759949,40.53900146),"
Nauvoo Elementary School
Po Box 308
Nauvoo, IL 62354

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nauvoo Elementary School",'Nauvoo=' + Nauvoo.length); Nauvoo[Nauvoo.length] = createMarker(new GPoint(-91.36759949,40.53900146),"
Nauvoo-colusa Junior High School
Po Box 308
Nauvoo, IL 62354

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Nauvoo-colusa Junior High School",'Nauvoo=' + Nauvoo.length); Nauvoo[Nauvoo.length] = createMarker(new GPoint(-91.36759949,40.53900146),"
Nauvoo-colusa Senior High School
Po Box 308
Nauvoo, IL 62354

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nauvoo-colusa Senior High School",'Nauvoo=' + Nauvoo.length); Plymouth[Plymouth.length] = createMarker(new GPoint(-90.87010193,40.28779984),"
Southeastern Elementary School
Po Box 249
Plymouth, IL 62367

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southeastern Elementary School",'Plymouth=' + Plymouth.length); Augusta[Augusta.length] = createMarker(new GPoint(-90.95410156,40.23400116),"
Southeastern High School
Po Box 155
Augusta, IL 62311

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeastern High School",'Augusta=' + Augusta.length); Bowen[Bowen.length] = createMarker(new GPoint(-91.06020355,40.23580170),"
Southeastern Junior High School
Po Box 247
Bowen, IL 62316

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeastern Junior High School",'Bowen=' + Bowen.length); Bowen[Bowen.length] = createMarker(new GPoint(-91.06020355,40.23580170),"
Southeastern Middle School
Po Box 247
Bowen, IL 62316

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeastern Middle School",'Bowen=' + Bowen.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-91.42717743,40.35405731),"
Warsaw Elementary School
340 S 11th St
Warsaw, IL 62379

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Warsaw Elementary School",'Warsaw=' + Warsaw.length); Warsaw[Warsaw.length] = createMarker(new GPoint(-91.42931366,40.35508347),"
Warsaw Senior High School
340 S 11th St
Warsaw, IL 62379

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warsaw Senior High School",'Warsaw=' + Warsaw.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(Augusta); map.removeOverlays(Bowen); map.removeOverlays(Carthage); map.removeOverlays(Dallas_City); map.removeOverlays(Hamilton); map.removeOverlays(La_Harpe); map.removeOverlays(Nauvoo); map.removeOverlays(Plymouth); map.removeOverlays(Warsaw); 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(Carthage);map.removeOverlays(Augusta); map.removeOverlays(Bowen); map.removeOverlays(Carthage); map.removeOverlays(Dallas_City); map.removeOverlays(Hamilton); map.removeOverlays(La_Harpe); map.removeOverlays(Nauvoo); map.removeOverlays(Plymouth); map.removeOverlays(Warsaw); map.addOverlays(Augusta); centerByArray(Augusta, false, false); cntMarker += Augusta.length; map.addOverlays(Bowen); centerByArray(Bowen, false, false); cntMarker += Bowen.length; map.addOverlays(Carthage); centerByArray(Carthage, false, false); cntMarker += Carthage.length; map.addOverlays(Dallas_City); centerByArray(Dallas_City, false, false); cntMarker += Dallas_City.length; map.addOverlays(Hamilton); centerByArray(Hamilton, false, false); cntMarker += Hamilton.length; map.addOverlays(La_Harpe); centerByArray(La_Harpe, false, false); cntMarker += La_Harpe.length; map.addOverlays(Nauvoo); centerByArray(Nauvoo, false, false); cntMarker += Nauvoo.length; map.addOverlays(Plymouth); centerByArray(Plymouth, false, false); cntMarker += Plymouth.length; map.addOverlays(Warsaw); centerByArray(Warsaw, false, false); cntMarker += Warsaw.length; centerByArray(Carthage,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'); } }