function addMarkers() { mySelect = document.getElementById('selection'); Alexander = [];Jacksonville = [];Franklin = [];Meredosia = [];Murrayville = [];Concord = [];Waverly = [];mySelect.options[mySelect.options.length] = new Option("Alexander schools",'all=Alexander'); mySelect.options[mySelect.options.length] = new Option("Concord schools",'all=Concord'); mySelect.options[mySelect.options.length] = new Option("Franklin schools",'all=Franklin'); mySelect.options[mySelect.options.length] = new Option("Jacksonville schools",'all=Jacksonville'); mySelect.options[mySelect.options.length] = new Option("Meredosia schools",'all=Meredosia'); mySelect.options[mySelect.options.length] = new Option("Murrayville schools",'all=Murrayville'); mySelect.options[mySelect.options.length] = new Option("Waverly schools",'all=Waverly'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Alexander[Alexander.length] = createMarker(new GPoint(-90.04029846,39.73289871),"
Alexander Elementary School
Po Box 140
Alexander, IL 62601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alexander Elementary School",'Alexander=' + Alexander.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23114900,39.74520000),"
Arc
747 W Lafayette
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arc",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23989105,39.73776245),"
Arc Middle School
747 W Lafayette Ave
Jacksonville, IL 62650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Arc Middle School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.22455597,39.74627686),"
Clay Court Elementary School
310 N Clay Ct
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clay Court Elementary School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23989105,39.73776245),"
Educational Support Program High School
747 W Lafayette Ave
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Educational Support Program High School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.21968079,39.74681854),"
Eisenhower Elementary School
1901 W Lafayette Ave
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eisenhower Elementary School",'Jacksonville=' + Jacksonville.length); Franklin[Franklin.length] = createMarker(new GPoint(-90.07250214,39.61320114),"
Franklin East Grade School
Po Box 199
Franklin, IL 62638

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin East Grade School",'Franklin=' + Franklin.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.22560120,39.72773743),"
Franklin Elementary School
352 Franklin Dr
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Jacksonville=' + Jacksonville.length); Franklin[Franklin.length] = createMarker(new GPoint(-90.07250214,39.61320114),"
Franklin Jr/sr High School
Po Box 199
Franklin, IL 62638

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin Jr/sr High School",'Franklin=' + Franklin.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.21735382,39.73433685),"
Il Sch For Visually Impaired
658 E State St
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Il Sch For Visually Impaired",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.25080109,39.73366165),"
Illinois School For Deaf
125 S Webster St
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Illinois School For Deaf",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.24414062,39.71613693),"
Ivan K Garrison Center
936 W Michigan Ave
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ivan K Garrison Center",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.17186737,39.72333527),"
Jacksonville Correctional Center
2268 E Morton Ave
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jacksonville Correctional Center",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23877716,39.74843216),"
Jacksonville High School
1211 N Diamond St
Jacksonville, IL 62650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jacksonville High School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.22438049,39.74041367),"
Jefferson School
733 N Clay St
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.24792480,39.72725296),"
Jonathan Turner Junior High School
664 Lincoln Ave
Jacksonville, IL 62650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jonathan Turner Junior High School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23180389,39.74173737),"
Lincoln Elementary School
320 W Independence
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Jacksonville=' + Jacksonville.length); Meredosia[Meredosia.length] = createMarker(new GPoint(-90.55940247,39.79650116),"
Meredosia-chambersburg Elementary School
Po Box 440
Meredosia, IL 62665

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meredosia-chambersburg Elementary School",'Meredosia=' + Meredosia.length); Meredosia[Meredosia.length] = createMarker(new GPoint(-90.55940247,39.79650116),"
Meredosia-chambersburg High School
Po Box 440
Meredosia, IL 62665

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meredosia-chambersburg High School",'Meredosia=' + Meredosia.length); Meredosia[Meredosia.length] = createMarker(new GPoint(-90.55940247,39.79650116),"
Meredosia-chambersburg Junior High School
Po Box 440
Meredosia, IL 62665

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Meredosia-chambersburg Junior High School",'Meredosia=' + Meredosia.length); Murrayville[Murrayville.length] = createMarker(new GPoint(-90.22940063,39.57229996),"
Murrayville-woodson Elementary School
Po Box 170
Murrayville, IL 62668

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Murrayville-woodson Elementary School",'Murrayville=' + Murrayville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.22891998,39.76475143),"
North Jacksonville School
1626 State Hwy 78
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Jacksonville School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23188782,39.71008682),"
South Jacksonville Elementary School
1700 S West St
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Jacksonville Elementary School",'Jacksonville=' + Jacksonville.length); Concord[Concord.length] = createMarker(new GPoint(-90.37274170,39.81647110),"
Triopia Grade School
2206 Arenzvlle-cocrd
Concord, IL 62631

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Triopia Grade School",'Concord=' + Concord.length); Concord[Concord.length] = createMarker(new GPoint(-90.37274170,39.81647110),"
Triopia Junior Senior High School
2204 Arenzlle-cocrd
Concord, IL 62631

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Triopia Junior Senior High School",'Concord=' + Concord.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.22628021,39.74542618),"
Walnut Court Early Years Program Elementary School
110 Walnut Ct
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Court Early Years Program Elementary School",'Jacksonville=' + Jacksonville.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-90.23612213,39.73019028),"
Washington Elementary School
524 S Kosciusko
Jacksonville, IL 62650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Jacksonville=' + Jacksonville.length); Waverly[Waverly.length] = createMarker(new GPoint(-89.94470215,39.57949829),"
Waverly Elementary School
Po Box 108
Waverly, IL 62692

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Waverly Elementary School",'Waverly=' + Waverly.length); Waverly[Waverly.length] = createMarker(new GPoint(-89.95987701,39.59284592),"
Waverly High School
201 N Miller St
Waverly, IL 62692

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waverly High School",'Waverly=' + Waverly.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(Alexander); map.removeOverlays(Concord); map.removeOverlays(Franklin); map.removeOverlays(Jacksonville); map.removeOverlays(Meredosia); map.removeOverlays(Murrayville); map.removeOverlays(Waverly); 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(Alexander);map.removeOverlays(Alexander); map.removeOverlays(Concord); map.removeOverlays(Franklin); map.removeOverlays(Jacksonville); map.removeOverlays(Meredosia); map.removeOverlays(Murrayville); map.removeOverlays(Waverly); map.addOverlays(Alexander); centerByArray(Alexander, false, false); cntMarker += Alexander.length; map.addOverlays(Concord); centerByArray(Concord, false, false); cntMarker += Concord.length; map.addOverlays(Franklin); centerByArray(Franklin, false, false); cntMarker += Franklin.length; map.addOverlays(Jacksonville); centerByArray(Jacksonville, false, false); cntMarker += Jacksonville.length; map.addOverlays(Meredosia); centerByArray(Meredosia, false, false); cntMarker += Meredosia.length; map.addOverlays(Murrayville); centerByArray(Murrayville, false, false); cntMarker += Murrayville.length; map.addOverlays(Waverly); centerByArray(Waverly, false, false); cntMarker += Waverly.length; centerByArray(Alexander,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'); } }