function addMarkers() { mySelect = document.getElementById('selection'); Montgomery = [];Bristol = [];Plano = [];Oswego = [];Yorkville = [];Newark = [];Millbrook = [];mySelect.options[mySelect.options.length] = new Option("Bristol schools",'all=Bristol'); mySelect.options[mySelect.options.length] = new Option("Millbrook schools",'all=Millbrook'); mySelect.options[mySelect.options.length] = new Option("Montgomery schools",'all=Montgomery'); mySelect.options[mySelect.options.length] = new Option("Newark schools",'all=Newark'); mySelect.options[mySelect.options.length] = new Option("Oswego schools",'all=Oswego'); mySelect.options[mySelect.options.length] = new Option("Plano schools",'all=Plano'); mySelect.options[mySelect.options.length] = new Option("Yorkville schools",'all=Yorkville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Montgomery[Montgomery.length] = createMarker(new GPoint(-88.33861542,41.70965958),"
Boulder Hill Elementary School
163 Boulder Hill Pas
Montgomery, IL 60538

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Boulder Hill Elementary School",'Montgomery=' + Montgomery.length); Bristol[Bristol.length] = createMarker(new GPoint(-88.41390228,41.69599915),"
Bristol Grade School
Po Box 177
Bristol, IL 60512

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bristol Grade School",'Bristol=' + Bristol.length); Plano[Plano.length] = createMarker(new GPoint(-88.53717041,41.65630722),"
Centennial Elementary School
800 S West St
Plano, IL 60545

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centennial Elementary School",'Plano=' + Plano.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.29894200,41.69468500),"
Churchill Elementary School
520 Secretariat Ln
Oswego, IL 60543

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Churchill Elementary School",'Oswego=' + Oswego.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-88.44398499,41.63575745),"
Circle Center Intermediate
901 Mill St
Yorkville, IL 60560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Circle Center Intermediate",'Yorkville=' + Yorkville.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.34185028,41.68439484),"
East View Elementary School
4209 Rte 71
Oswego, IL 60543

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East View Elementary School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.36254120,41.69471359),"
Fox Chase Elementary School
260 Fox Chase Dr N
Oswego, IL 60543

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fox Chase Elementary School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.33713531,41.68169022),"
Kendall Co Opportunity School
33 E Stonehill Rd
Oswego, IL 60543

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kendall Co Opportunity School",'Oswego=' + Oswego.length); Montgomery[Montgomery.length] = createMarker(new GPoint(-88.39719000,41.71605600),"
Lakewood Creek Elementary School
2301 Lakewood Crk
Montgomery, IL 60538

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakewood Creek Elementary School",'Montgomery=' + Montgomery.length); Newark[Newark.length] = createMarker(new GPoint(-88.48208618,41.47862625),"
Lisbon Grade School
127 S Canal St
Newark, IL 60541

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lisbon Grade School",'Newark=' + Newark.length); Montgomery[Montgomery.length] = createMarker(new GPoint(-88.32846832,41.71183395),"
Long Beach Elementary School
67 Long Beach Rd
Montgomery, IL 60538

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Long Beach Elementary School",'Montgomery=' + Montgomery.length); Millbrook[Millbrook.length] = createMarker(new GPoint(-88.55370331,41.59930038),"
Millbrook Junior High School
Po Box 214
Millbrook, IL 60536

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Millbrook Junior High School",'Millbrook=' + Millbrook.length); Newark[Newark.length] = createMarker(new GPoint(-88.57888794,41.54097748),"
Newark Community High School
413 Chicago Rd
Newark, IL 60541

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newark Community High School",'Newark=' + Newark.length); Newark[Newark.length] = createMarker(new GPoint(-88.55110168,41.53150177),"
Newark Elementary School
503 Chicago Rd
Newark, IL 60541

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Newark Elementary School",'Newark=' + Newark.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.33021545,41.70556641),"
Old Post Elementary School
100 Old Post Rd
Oswego, IL 60543

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Old Post Elementary School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.27547500,41.70004000),"
Oswego East High School
1525 Harvey Rd
Oswego, IL 60543

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oswego East High School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.34194946,41.68375015),"
Oswego High School
4250 Rte 71
Oswego, IL 60543

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oswego High School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.35154724,41.68290710),"
Oswego High School Roe Safe School
Rt 71
Oswego, IL 60543

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oswego High School Roe Safe School",'Oswego=' + Oswego.length); Plano[Plano.length] = createMarker(new GPoint(-88.53540039,41.67110443),"
P H Miller Elementary School
904 N Lew St
Plano, IL 60545

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("P H Miller Elementary School",'Plano=' + Plano.length); Plano[Plano.length] = createMarker(new GPoint(-88.54590607,41.66453552),"
Plano High School
704 W Abe St
Plano, IL 60545

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plano High School",'Plano=' + Plano.length); Plano[Plano.length] = createMarker(new GPoint(-88.54590607,41.66453552),"
Plano High School Pace Safe School
704 W Abe St
Plano, IL 60545

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plano High School Pace Safe School",'Plano=' + Plano.length); Plano[Plano.length] = createMarker(new GPoint(-88.53233337,41.65593338),"
Plano Middle School
804 S Hale St
Plano, IL 60545

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Plano Middle School",'Plano=' + Plano.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.34178200,41.64127400),"
Prairie Point Elementary School
3650 Grove Rd
Oswego, IL 60543

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Prairie Point Elementary School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.33512878,41.69549561),"
Thompson Junior High School
440 Boulder Hill Pas
Oswego, IL 60543

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Thompson Junior High School",'Oswego=' + Oswego.length); Oswego[Oswego.length] = createMarker(new GPoint(-88.34801483,41.68022919),"
Traughber Junior High School
61 Franklin St
Oswego, IL 60543

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Traughber Junior High School",'Oswego=' + Oswego.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-88.44787598,41.64899063),"
Yorkville Grade School
201 W Somonauk St
Yorkville, IL 60560

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Yorkville Grade School",'Yorkville=' + Yorkville.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-88.45147705,41.65124512),"
Yorkville High School
797 Game Farm Rd
Yorkville, IL 60560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yorkville High School",'Yorkville=' + Yorkville.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-88.45147705,41.65124512),"
Yorkville High School Roe Safe School
797 Game Farm Rd
Yorkville, IL 60560

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yorkville High School Roe Safe School",'Yorkville=' + Yorkville.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-88.44864600,41.63481200),"
Yorkville Intermediate School
103 Schoolhouse Rd
Yorkville, IL 60560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Yorkville Intermediate School",'Yorkville=' + Yorkville.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-88.45111084,41.65029907),"
Yorkville Middle School
702 Game Farm Rd
Yorkville, IL 60560

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Yorkville Middle School",'Yorkville=' + Yorkville.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(Bristol); map.removeOverlays(Millbrook); map.removeOverlays(Montgomery); map.removeOverlays(Newark); map.removeOverlays(Oswego); map.removeOverlays(Plano); map.removeOverlays(Yorkville); 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(Montgomery);map.removeOverlays(Bristol); map.removeOverlays(Millbrook); map.removeOverlays(Montgomery); map.removeOverlays(Newark); map.removeOverlays(Oswego); map.removeOverlays(Plano); map.removeOverlays(Yorkville); map.addOverlays(Bristol); centerByArray(Bristol, false, false); cntMarker += Bristol.length; map.addOverlays(Millbrook); centerByArray(Millbrook, false, false); cntMarker += Millbrook.length; map.addOverlays(Montgomery); centerByArray(Montgomery, false, false); cntMarker += Montgomery.length; map.addOverlays(Newark); centerByArray(Newark, false, false); cntMarker += Newark.length; map.addOverlays(Oswego); centerByArray(Oswego, false, false); cntMarker += Oswego.length; map.addOverlays(Plano); centerByArray(Plano, false, false); cntMarker += Plano.length; map.addOverlays(Yorkville); centerByArray(Yorkville, false, false); cntMarker += Yorkville.length; centerByArray(Montgomery,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'); } }