function addMarkers() { mySelect = document.getElementById('selection'); Woodhull = [];Alpha = [];Annawan = [];Atkinson = [];Kewanee = [];Orion = [];Cambridge = [];Colona = [];Galva = [];Geneseo = [];mySelect.options[mySelect.options.length] = new Option("Alpha schools",'all=Alpha'); mySelect.options[mySelect.options.length] = new Option("Annawan schools",'all=Annawan'); mySelect.options[mySelect.options.length] = new Option("Atkinson schools",'all=Atkinson'); mySelect.options[mySelect.options.length] = new Option("Cambridge schools",'all=Cambridge'); mySelect.options[mySelect.options.length] = new Option("Colona schools",'all=Colona'); mySelect.options[mySelect.options.length] = new Option("Galva schools",'all=Galva'); mySelect.options[mySelect.options.length] = new Option("Geneseo schools",'all=Geneseo'); mySelect.options[mySelect.options.length] = new Option("Kewanee schools",'all=Kewanee'); mySelect.options[mySelect.options.length] = new Option("Orion schools",'all=Orion'); mySelect.options[mySelect.options.length] = new Option("Woodhull schools",'all=Woodhull'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Woodhull[Woodhull.length] = createMarker(new GPoint(-90.27780151,41.18859863),"
Alwood Middle/high School
301 E 5th Ave
Woodhull, IL 61490

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alwood Middle/high School",'Woodhull=' + Woodhull.length); Alpha[Alpha.length] = createMarker(new GPoint(-90.37650299,41.19139862),"
Alwood Elementary School
101 East A St
Alpha, IL 61413

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alwood Elementary School",'Alpha=' + Alpha.length); Annawan[Annawan.length] = createMarker(new GPoint(-89.91138458,41.39396286),"
Annawan Grade School
501 W South St
Annawan, IL 61234

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Annawan Grade School",'Annawan=' + Annawan.length); Annawan[Annawan.length] = createMarker(new GPoint(-89.91138458,41.39396286),"
Annawan High School
501 W South St
Annawan, IL 61234

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Annawan High School",'Annawan=' + Annawan.length); Atkinson[Atkinson.length] = createMarker(new GPoint(-90.01567841,41.41691589),"
Atkinson Grade School
109 S State St
Atkinson, IL 61235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atkinson Grade School",'Atkinson=' + Atkinson.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.90592957,41.24894714),"
Belle Alexander Elementary School
1401 Lake St
Kewanee, IL 61443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Belle Alexander Elementary School",'Kewanee=' + Kewanee.length); Orion[Orion.length] = createMarker(new GPoint(-90.38439941,41.35969925),"
C R Hanna Elementary School
Po Box 159
Orion, IL 61273

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("C R Hanna Elementary School",'Orion=' + Orion.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-90.19874573,41.29918289),"
Cambridge Community Grade School
312 S West St
Cambridge, IL 61238

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cambridge Community Grade School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-90.19873047,41.29935455),"
Cambridge Community High School
300 S West St
Cambridge, IL 61238

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cambridge Community High School",'Cambridge=' + Cambridge.length); Cambridge[Cambridge.length] = createMarker(new GPoint(-90.19873047,41.29935455),"
Cambridge Junior High School
300 S West St
Cambridge, IL 61238

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cambridge Junior High School",'Cambridge=' + Cambridge.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92305756,41.24216461),"
Central Elementary School
215 E Central Blvd
Kewanee, IL 61443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Kewanee=' + Kewanee.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92484400,41.24707000),"
Central Junior High School
215 E Central Blvd
Kewanee, IL 61443

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Junior High School",'Kewanee=' + Kewanee.length); Colona[Colona.length] = createMarker(new GPoint(-90.35771942,41.47314072),"
Colona Grade School
700 1st St
Colona, IL 61241

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Colona Grade School",'Colona=' + Colona.length); Atkinson[Atkinson.length] = createMarker(new GPoint(-90.01850128,41.40499878),"
Excel Alternative Program
105 S State St
Atkinson, IL 61235

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Excel Alternative Program",'Atkinson=' + Atkinson.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92951965,41.24932861),"
Franklin School
600 N Lexington Ave
Kewanee, IL 61443

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Franklin School",'Kewanee=' + Kewanee.length); Galva[Galva.length] = createMarker(new GPoint(-90.04467010,41.17473602),"
Galva Elementary School
224 Morgan Rd
Galva, IL 61434

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Galva Elementary School",'Galva=' + Galva.length); Galva[Galva.length] = createMarker(new GPoint(-90.04467010,41.17473602),"
Galva Junior Senior High School
224 Morgan Rd
Galva, IL 61434

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Galva Junior Senior High School",'Galva=' + Galva.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.15141296,41.46203613),"
Geneseo Middle School
333 E Ogden Ave
Geneseo, IL 61254

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Geneseo Middle School",'Geneseo=' + Geneseo.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.93236542,41.24224472),"
Irving Elementary School
609 W Central Blvd
Kewanee, IL 61443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Irving Elementary School",'Kewanee=' + Kewanee.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92729950,41.24670029),"
Iyc Kewanee High School
Po Box 518
Kewanee, IL 61443

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Iyc Kewanee High School",'Kewanee=' + Kewanee.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.15559387,41.46212006),"
J D Darnall Senior High School
700 N State St
Geneseo, IL 61254

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("J D Darnall Senior High School",'Geneseo=' + Geneseo.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.91007996,41.24556351),"
Kewanee High School
1211 E 3rd St
Kewanee, IL 61443

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kewanee High School",'Kewanee=' + Kewanee.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92318726,41.25321579),"
Lyle School
920 N Burr St
Kewanee, IL 61443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lyle School",'Kewanee=' + Kewanee.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.14791870,41.44067764),"
Millikin Elementary School
920 S Congress St
Geneseo, IL 61254

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Millikin Elementary School",'Geneseo=' + Geneseo.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.15308380,41.45729446),"
Northside Elementary School
415 N Russell Ave
Geneseo, IL 61254

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northside Elementary School",'Geneseo=' + Geneseo.length); Orion[Orion.length] = createMarker(new GPoint(-90.38439941,41.35969925),"
Orion High School
Po Box 39
Orion, IL 61273

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Orion High School",'Orion=' + Orion.length); Orion[Orion.length] = createMarker(new GPoint(-90.37500000,41.35246277),"
Orion Middle School
Po Box 129
Orion, IL 61273

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Orion Middle School",'Orion=' + Orion.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.26007843,41.45168686),"
Rock River Coop Alt School
20965 E 900 St
Geneseo, IL 61254

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock River Coop Alt School",'Geneseo=' + Geneseo.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.26007843,41.45168686),"
Rock River Coop Alternative School
20965 E 900th St
Geneseo, IL 61254

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock River Coop Alternative School",'Geneseo=' + Geneseo.length); Geneseo[Geneseo.length] = createMarker(new GPoint(-90.15778351,41.44508362),"
Southwest Elementary School
715 S Center St
Geneseo, IL 61254

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Geneseo=' + Geneseo.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92468262,41.22790527),"
Wethersfield Elementary School
439 Willard St
Kewanee, IL 61443

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wethersfield Elementary School",'Kewanee=' + Kewanee.length); Kewanee[Kewanee.length] = createMarker(new GPoint(-89.92468262,41.22790527),"
Wethersfield Jr/sr High School
439 Willard St
Kewanee, IL 61443

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wethersfield Jr/sr High School",'Kewanee=' + Kewanee.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(Alpha); map.removeOverlays(Annawan); map.removeOverlays(Atkinson); map.removeOverlays(Cambridge); map.removeOverlays(Colona); map.removeOverlays(Galva); map.removeOverlays(Geneseo); map.removeOverlays(Kewanee); map.removeOverlays(Orion); map.removeOverlays(Woodhull); 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(Woodhull);map.removeOverlays(Alpha); map.removeOverlays(Annawan); map.removeOverlays(Atkinson); map.removeOverlays(Cambridge); map.removeOverlays(Colona); map.removeOverlays(Galva); map.removeOverlays(Geneseo); map.removeOverlays(Kewanee); map.removeOverlays(Orion); map.removeOverlays(Woodhull); map.addOverlays(Alpha); centerByArray(Alpha, false, false); cntMarker += Alpha.length; map.addOverlays(Annawan); centerByArray(Annawan, false, false); cntMarker += Annawan.length; map.addOverlays(Atkinson); centerByArray(Atkinson, false, false); cntMarker += Atkinson.length; map.addOverlays(Cambridge); centerByArray(Cambridge, false, false); cntMarker += Cambridge.length; map.addOverlays(Colona); centerByArray(Colona, false, false); cntMarker += Colona.length; map.addOverlays(Galva); centerByArray(Galva, false, false); cntMarker += Galva.length; map.addOverlays(Geneseo); centerByArray(Geneseo, false, false); cntMarker += Geneseo.length; map.addOverlays(Kewanee); centerByArray(Kewanee, false, false); cntMarker += Kewanee.length; map.addOverlays(Orion); centerByArray(Orion, false, false); cntMarker += Orion.length; map.addOverlays(Woodhull); centerByArray(Woodhull, false, false); cntMarker += Woodhull.length; centerByArray(Woodhull,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'); } }