function addMarkers() { mySelect = document.getElementById('selection'); Dekalb = [];De_Kalb = [];Cortland = [];Genoa = [];Sandwich = [];Kirkland = [];Hinckley = [];Shabbona = [];Waterman = [];Somonauk = [];Kingston = [];Malta = [];Sycamore = [];mySelect.options[mySelect.options.length] = new Option("Cortland schools",'all=Cortland'); mySelect.options[mySelect.options.length] = new Option("De Kalb schools",'all=De_Kalb'); mySelect.options[mySelect.options.length] = new Option("Dekalb schools",'all=Dekalb'); mySelect.options[mySelect.options.length] = new Option("Genoa schools",'all=Genoa'); mySelect.options[mySelect.options.length] = new Option("Hinckley schools",'all=Hinckley'); mySelect.options[mySelect.options.length] = new Option("Kingston schools",'all=Kingston'); mySelect.options[mySelect.options.length] = new Option("Kirkland schools",'all=Kirkland'); mySelect.options[mySelect.options.length] = new Option("Malta schools",'all=Malta'); mySelect.options[mySelect.options.length] = new Option("Sandwich schools",'all=Sandwich'); mySelect.options[mySelect.options.length] = new Option("Shabbona schools",'all=Shabbona'); mySelect.options[mySelect.options.length] = new Option("Somonauk schools",'all=Somonauk'); mySelect.options[mySelect.options.length] = new Option("Sycamore schools",'all=Sycamore'); mySelect.options[mySelect.options.length] = new Option("Waterman schools",'all=Waterman'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.74537659,41.92322540),"
Chesebro Elementary School
900 Garden St
Dekalb, IL 60115

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chesebro Elementary School",'Dekalb=' + Dekalb.length); De_Kalb[De_Kalb.length] = createMarker(new GPoint(-88.75166321,41.93492508),"
Clinton Rosette Middle School
650 N 1st St
De Kalb, IL 60115

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Clinton Rosette Middle School",'De_Kalb=' + De_Kalb.length); Cortland[Cortland.length] = createMarker(new GPoint(-88.69130707,41.91876221),"
Cortland Elementary School
4418 Maple
Cortland, IL 60112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cortland Elementary School",'Cortland=' + Cortland.length); Genoa[Genoa.length] = createMarker(new GPoint(-88.69276428,42.09963608),"
Davenport Elementary School
123 W 1st St
Genoa, IL 60135

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Davenport Elementary School",'Genoa=' + Genoa.length); De_Kalb[De_Kalb.length] = createMarker(new GPoint(-88.75368500,41.91206741),"
De Kalb High School
1515 S 4th St
De Kalb, IL 60115

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("De Kalb High School",'De_Kalb=' + De_Kalb.length); Genoa[Genoa.length] = createMarker(new GPoint(-88.68959808,42.09849930),"
Genoa Elementary School
602 E Hill St
Genoa, IL 60135

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Genoa Elementary School",'Genoa=' + Genoa.length); Genoa[Genoa.length] = createMarker(new GPoint(-88.70389557,42.10092545),"
Genoa-kingston High School
980 Park Ave
Genoa, IL 60135

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Genoa-kingston High School",'Genoa=' + Genoa.length); Genoa[Genoa.length] = createMarker(new GPoint(-88.68511963,42.09304810),"
Genoa-kingston Middle School
941 W Main St
Genoa, IL 60135

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Genoa-kingston Middle School",'Genoa=' + Genoa.length); De_Kalb[De_Kalb.length] = createMarker(new GPoint(-88.75184631,41.96713638),"
Gwendolyn Brooks Elementary School
3225 Sangamon Rd
De Kalb, IL 60115

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gwendolyn Brooks Elementary School",'De_Kalb=' + De_Kalb.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.62011719,41.64202499),"
Herman E Dummer Middle School
422 S Wells St
Sandwich, IL 60548

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Herman E Dummer Middle School",'Sandwich=' + Sandwich.length); Kirkland[Kirkland.length] = createMarker(new GPoint(-88.86689758,42.09740067),"
Hiawatha Elementary School
Po Box 428
Kirkland, IL 60146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hiawatha Elementary School",'Kirkland=' + Kirkland.length); Kirkland[Kirkland.length] = createMarker(new GPoint(-88.86689758,42.09740067),"
Hiawatha Junior And Senior High School
Po Box 428
Kirkland, IL 60146

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hiawatha Junior And Senior High School",'Kirkland=' + Kirkland.length); Hinckley[Hinckley.length] = createMarker(new GPoint(-88.64679718,41.77489853),"
Hinckley Elementary School
Po Box 1270
Hinckley, IL 60520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hinckley Elementary School",'Hinckley=' + Hinckley.length); Hinckley[Hinckley.length] = createMarker(new GPoint(-88.64679718,41.77489853),"
Hinckley-big Rock High School
Po Box 1210
Hinckley, IL 60520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hinckley-big Rock High School",'Hinckley=' + Hinckley.length); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.74877930,41.92134094),"
Huntley Middle School
821 S 7th St
Dekalb, IL 60115

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Huntley Middle School",'Dekalb=' + Dekalb.length); Shabbona[Shabbona.length] = createMarker(new GPoint(-88.87691498,41.76365280),"
Indian Creek High School
506 Shabbona Rd
Shabbona, IL 60550

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Indian Creek High School",'Shabbona=' + Shabbona.length); Waterman[Waterman.length] = createMarker(new GPoint(-88.77397919,41.76486969),"
Indian Creek Middle School
425 S Elm
Waterman, IL 60556

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Indian Creek Middle School",'Waterman=' + Waterman.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.61420441,41.63843536),"
Indian Valley Area Voc Center
600 Lions Rd
Sandwich, IL 60548

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Indian Valley Area Voc Center",'Sandwich=' + Sandwich.length); Somonauk[Somonauk.length] = createMarker(new GPoint(-88.68460083,41.63309860),"
James R Wood Elementary School
Po Box 278
Somonauk, IL 60552

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James R Wood Elementary School",'Somonauk=' + Somonauk.length); De_Kalb[De_Kalb.length] = createMarker(new GPoint(-88.75158691,41.94878769),"
Jefferson Elementary School
211 Mccormick Dr
De Kalb, IL 60115

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'De_Kalb=' + De_Kalb.length); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.74622345,41.93099594),"
Kec Central Area Voc Center
315 N 6th Street
Dekalb, IL 60115

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kec Central Area Voc Center",'Dekalb=' + Dekalb.length); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.75358582,41.91985321),"
Kec Central Efe 170 High School
901 S 4th St
Dekalb, IL 60115

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kec Central Efe 170 High School",'Dekalb=' + Dekalb.length); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.75358582,41.91985321),"
Kecol
901 S 4th St
Dekalb, IL 60115

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kecol",'Dekalb=' + Dekalb.length); Kingston[Kingston.length] = createMarker(new GPoint(-88.75451660,42.09986115),"
Kingston Elementary School
100 School St
Kingston, IL 60145

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kingston Elementary School",'Kingston=' + Kingston.length); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.75654602,41.91816330),"
Lincoln Elementary School
220 E Sunset Pl
Dekalb, IL 60115

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Dekalb=' + Dekalb.length); Dekalb[Dekalb.length] = createMarker(new GPoint(-88.73937225,41.93853760),"
Littlejohn Elementary School
1121 School St
Dekalb, IL 60115

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Littlejohn Elementary School",'Dekalb=' + Dekalb.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.62001801,41.63929749),"
Lynn G Haskin Elementary School
720 S Wells
Sandwich, IL 60548

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lynn G Haskin Elementary School",'Sandwich=' + Sandwich.length); Malta[Malta.length] = createMarker(new GPoint(-88.86201477,41.93439865),"
Malta Elementary School
507 N 3rd St
Malta, IL 60150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Malta Elementary School",'Malta=' + Malta.length); Sycamore[Sycamore.length] = createMarker(new GPoint(-88.69306946,42.00950241),"
North Elementary School
1680 Brickville Rd
Sycamore, IL 60178

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Sycamore=' + Sycamore.length); Malta[Malta.length] = createMarker(new GPoint(-88.93860300,41.93547000),"
Paul T Wright Elementary School
5068 Rte 38
Malta, IL 60150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Paul T Wright Elementary School",'Malta=' + Malta.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.62841797,41.65751266),"
Prairie View Elementary School
1201 Castle St
Sandwich, IL 60548

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Prairie View Elementary School",'Sandwich=' + Sandwich.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.61509705,41.63869095),"
Sandwich Community High School
515 E Lions Rd
Sandwich, IL 60548

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sandwich Community High School",'Sandwich=' + Sandwich.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.62010193,41.64037323),"
Sandwich Middle School
600 Wells St
Sandwich, IL 60548

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sandwich Middle School",'Sandwich=' + Sandwich.length); Shabbona[Shabbona.length] = createMarker(new GPoint(-88.87509918,41.76686478),"
Shabbona Elementary School
301 W Cherokee St
Shabbona, IL 60550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shabbona Elementary School",'Shabbona=' + Shabbona.length); Somonauk[Somonauk.length] = createMarker(new GPoint(-88.68460083,41.63309860),"
Somonauk High School
Po Box 278
Somonauk, IL 60552

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Somonauk High School",'Somonauk=' + Somonauk.length); Somonauk[Somonauk.length] = createMarker(new GPoint(-88.68460083,41.63309860),"
Somonauk Middle School
Po Box 278
Somonauk, IL 60552

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Somonauk Middle School",'Somonauk=' + Somonauk.length); Sycamore[Sycamore.length] = createMarker(new GPoint(-88.70089722,41.97666168),"
South Prairie Elementary School
820 Borden Ave
Sycamore, IL 60178

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Prairie Elementary School",'Sycamore=' + Sycamore.length); Sycamore[Sycamore.length] = createMarker(new GPoint(-88.68466187,41.98072815),"
Southeast Elementary School
718 S Locust St
Sycamore, IL 60178

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southeast Elementary School",'Sycamore=' + Sycamore.length); Sycamore[Sycamore.length] = createMarker(new GPoint(-88.70226288,41.98498154),"
Sycamore High School
Spartan Trail
Sycamore, IL 60178

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sycamore High School",'Sycamore=' + Sycamore.length); Sycamore[Sycamore.length] = createMarker(new GPoint(-88.68220520,42.00226212),"
Sycamore Middle School
150 Maplewood Dr
Sycamore, IL 60178

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sycamore Middle School",'Sycamore=' + Sycamore.length); De_Kalb[De_Kalb.length] = createMarker(new GPoint(-88.75358582,41.91985321),"
Tyler Elementary School
1021 Alden Cir
De Kalb, IL 60115

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tyler Elementary School",'De_Kalb=' + De_Kalb.length); Sandwich[Sandwich.length] = createMarker(new GPoint(-88.61820984,41.64816284),"
W W Woodbury Elementary School
322 E 3rd St
Sandwich, IL 60548

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W W Woodbury Elementary School",'Sandwich=' + Sandwich.length); Waterman[Waterman.length] = createMarker(new GPoint(-88.77091217,41.77080536),"
Waterman Elementary School
220 N Maple St
Waterman, IL 60556

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Waterman Elementary School",'Waterman=' + Waterman.length); Sycamore[Sycamore.length] = createMarker(new GPoint(-88.69757843,41.99164963),"
West Elementary School
240 Fair St
Sycamore, IL 60178

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Sycamore=' + Sycamore.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(Cortland); map.removeOverlays(De_Kalb); map.removeOverlays(Dekalb); map.removeOverlays(Genoa); map.removeOverlays(Hinckley); map.removeOverlays(Kingston); map.removeOverlays(Kirkland); map.removeOverlays(Malta); map.removeOverlays(Sandwich); map.removeOverlays(Shabbona); map.removeOverlays(Somonauk); map.removeOverlays(Sycamore); map.removeOverlays(Waterman); 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(Dekalb);map.removeOverlays(Cortland); map.removeOverlays(De_Kalb); map.removeOverlays(Dekalb); map.removeOverlays(Genoa); map.removeOverlays(Hinckley); map.removeOverlays(Kingston); map.removeOverlays(Kirkland); map.removeOverlays(Malta); map.removeOverlays(Sandwich); map.removeOverlays(Shabbona); map.removeOverlays(Somonauk); map.removeOverlays(Sycamore); map.removeOverlays(Waterman); map.addOverlays(Cortland); centerByArray(Cortland, false, false); cntMarker += Cortland.length; map.addOverlays(De_Kalb); centerByArray(De_Kalb, false, false); cntMarker += De_Kalb.length; map.addOverlays(Dekalb); centerByArray(Dekalb, false, false); cntMarker += Dekalb.length; map.addOverlays(Genoa); centerByArray(Genoa, false, false); cntMarker += Genoa.length; map.addOverlays(Hinckley); centerByArray(Hinckley, false, false); cntMarker += Hinckley.length; map.addOverlays(Kingston); centerByArray(Kingston, false, false); cntMarker += Kingston.length; map.addOverlays(Kirkland); centerByArray(Kirkland, false, false); cntMarker += Kirkland.length; map.addOverlays(Malta); centerByArray(Malta, false, false); cntMarker += Malta.length; map.addOverlays(Sandwich); centerByArray(Sandwich, false, false); cntMarker += Sandwich.length; map.addOverlays(Shabbona); centerByArray(Shabbona, false, false); cntMarker += Shabbona.length; map.addOverlays(Somonauk); centerByArray(Somonauk, false, false); cntMarker += Somonauk.length; map.addOverlays(Sycamore); centerByArray(Sycamore, false, false); cntMarker += Sycamore.length; map.addOverlays(Waterman); centerByArray(Waterman, false, false); cntMarker += Waterman.length; centerByArray(Dekalb,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'); } }