function addMarkers() { mySelect = document.getElementById('selection'); La_Moille = [];Wyanet = [];Manlius = [];Sheffield = [];Walnut = [];Buda = [];Cherry = [];Dalzell = [];Depue = [];Princeton = [];Spring_Valley = [];Ladd = [];Bureau = [];Malden = [];Neponset = [];Ohio = [];Tiskilwa = [];Van_Orin = [];mySelect.options[mySelect.options.length] = new Option("Buda schools",'all=Buda'); mySelect.options[mySelect.options.length] = new Option("Bureau schools",'all=Bureau'); mySelect.options[mySelect.options.length] = new Option("Cherry schools",'all=Cherry'); mySelect.options[mySelect.options.length] = new Option("Dalzell schools",'all=Dalzell'); mySelect.options[mySelect.options.length] = new Option("Depue schools",'all=Depue'); mySelect.options[mySelect.options.length] = new Option("La Moille schools",'all=La_Moille'); mySelect.options[mySelect.options.length] = new Option("Ladd schools",'all=Ladd'); mySelect.options[mySelect.options.length] = new Option("Malden schools",'all=Malden'); mySelect.options[mySelect.options.length] = new Option("Manlius schools",'all=Manlius'); mySelect.options[mySelect.options.length] = new Option("Neponset schools",'all=Neponset'); mySelect.options[mySelect.options.length] = new Option("Ohio schools",'all=Ohio'); mySelect.options[mySelect.options.length] = new Option("Princeton schools",'all=Princeton'); mySelect.options[mySelect.options.length] = new Option("Sheffield schools",'all=Sheffield'); mySelect.options[mySelect.options.length] = new Option("Spring Valley schools",'all=Spring_Valley'); mySelect.options[mySelect.options.length] = new Option("Tiskilwa schools",'all=Tiskilwa'); mySelect.options[mySelect.options.length] = new Option("Van Orin schools",'all=Van_Orin'); mySelect.options[mySelect.options.length] = new Option("Walnut schools",'all=Walnut'); mySelect.options[mySelect.options.length] = new Option("Wyanet schools",'all=Wyanet'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); La_Moille[La_Moille.length] = createMarker(new GPoint(-89.28730011,41.53889847),"
Allen Junior High School
Po Box 470
La Moille, IL 61330

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Allen Junior High School",'La_Moille=' + La_Moille.length); Wyanet[Wyanet.length] = createMarker(new GPoint(-89.58394623,41.36066437),"
Behavior Disorder Program Coop
109 W 4th St
Wyanet, IL 61379

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Behavior Disorder Program Coop",'Wyanet=' + Wyanet.length); Wyanet[Wyanet.length] = createMarker(new GPoint(-89.58612061,41.36080170),"
Bureau Cnty Coop Alt School
Po Box 381
Wyanet, IL 61379

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bureau Cnty Coop Alt School",'Wyanet=' + Wyanet.length); Manlius[Manlius.length] = createMarker(new GPoint(-89.67790222,41.45149994),"
Bureau Valley Elementary-manlius Elementary School
Po Box 389
Manlius, IL 61338

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bureau Valley Elementary-manlius Elementary School",'Manlius=' + Manlius.length); Sheffield[Sheffield.length] = createMarker(new GPoint(-89.73121643,41.35621262),"
Bureau Valley Elemntry-sheffield Elementary School
306 East St
Sheffield, IL 61361

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bureau Valley Elemntry-sheffield Elementary School",'Sheffield=' + Sheffield.length); Wyanet[Wyanet.length] = createMarker(new GPoint(-89.58394623,41.36066437),"
Bureau Valley Elemntry-wyanet Elementary School
109 W 4th St
Wyanet, IL 61379

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bureau Valley Elemntry-wyanet Elementary School",'Wyanet=' + Wyanet.length); Manlius[Manlius.length] = createMarker(new GPoint(-89.67790222,41.45149994),"
Bureau Valley High School
Po Box 329
Manlius, IL 61338

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bureau Valley High School",'Manlius=' + Manlius.length); Walnut[Walnut.length] = createMarker(new GPoint(-89.60749817,41.54980087),"
Bureau Valley North Elementary School
Po Box 707
Walnut, IL 61376

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bureau Valley North Elementary School",'Walnut=' + Walnut.length); Buda[Buda.length] = createMarker(new GPoint(-89.67948914,41.32580948),"
Bureau Valley South Middle School
Po Box 337
Buda, IL 61314

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bureau Valley South Middle School",'Buda=' + Buda.length); Cherry[Cherry.length] = createMarker(new GPoint(-89.21160126,41.42620087),"
Cherry Grade School
Po Box 219
Cherry, IL 61317

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cherry Grade School",'Cherry=' + Cherry.length); Dalzell[Dalzell.length] = createMarker(new GPoint(-89.17649841,41.35729980),"
Dalzell Grade School
Po Box 200
Dalzell, IL 61320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dalzell Grade School",'Dalzell=' + Dalzell.length); Depue[Depue.length] = createMarker(new GPoint(-89.32080078,41.34379959),"
Depue Elementary School
Po Box 800
Depue, IL 61322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Depue Elementary School",'Depue=' + Depue.length); Depue[Depue.length] = createMarker(new GPoint(-89.32080078,41.34379959),"
Depue High School
Po Box 800
Depue, IL 61322

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Depue High School",'Depue=' + Depue.length); Princeton[Princeton.length] = createMarker(new GPoint(-89.46224976,41.38306427),"
Douglas Elementary School
220 E Lasalle St
Princeton, IL 61356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Douglas Elementary School",'Princeton=' + Princeton.length); Spring_Valley[Spring_Valley.length] = createMarker(new GPoint(-89.21300507,41.32581711),"
Hall High School
800 W Erie St
Spring Valley, IL 61362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hall High School",'Spring_Valley=' + Spring_Valley.length); Princeton[Princeton.length] = createMarker(new GPoint(-89.47381592,41.37633514),"
Jefferson Elementary School
725 W Putnam
Princeton, IL 61356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Princeton=' + Princeton.length); Spring_Valley[Spring_Valley.length] = createMarker(new GPoint(-89.20687866,41.33163834),"
John F Kennedy Elementary School
800 N Richards St
Spring Valley, IL 61362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John F Kennedy Elementary School",'Spring_Valley=' + Spring_Valley.length); La_Moille[La_Moille.length] = createMarker(new GPoint(-89.28730011,41.53889847),"
La Moille High School
Po Box 440
La Moille, IL 61330

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("La Moille High School",'La_Moille=' + La_Moille.length); Ladd[Ladd.length] = createMarker(new GPoint(-89.21734619,41.37903595),"
Ladd Community Consolidated School District 94
232 E Cleveland
Ladd, IL 61329

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ladd Community Consolidated School District 94",'Ladd=' + Ladd.length); Bureau[Bureau.length] = createMarker(new GPoint(-89.37729645,41.28820038),"
Leepertown Elementary School
Po Box 170
Bureau, IL 61315

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leepertown Elementary School",'Bureau=' + Bureau.length); Princeton[Princeton.length] = createMarker(new GPoint(-89.46001434,41.37025452),"
Lincoln Elementary School
501 S Euclid Ave
Princeton, IL 61356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Princeton=' + Princeton.length); Spring_Valley[Spring_Valley.length] = createMarker(new GPoint(-89.19280243,41.32556152),"
Lincoln Elementary School
501 E Erie St
Spring Valley, IL 61362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Spring_Valley=' + Spring_Valley.length); Princeton[Princeton.length] = createMarker(new GPoint(-89.46892548,41.37516403),"
Logan Junior High School
302 W Central Ave
Princeton, IL 61356

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Logan Junior High School",'Princeton=' + Princeton.length); Malden[Malden.length] = createMarker(new GPoint(-89.35910034,41.43790054),"
Malden Grade School
Po Box 216
Malden, IL 61337

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Malden Grade School",'Malden=' + Malden.length); Neponset[Neponset.length] = createMarker(new GPoint(-89.79399872,41.29050064),"
Neponset Elementary School
Po Box 148
Neponset, IL 61345

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Neponset Elementary School",'Neponset=' + Neponset.length); Ohio[Ohio.length] = createMarker(new GPoint(-89.45490265,41.54710007),"
Ohio Com Consolidated Grade School
Po Box 478
Ohio, IL 61349

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ohio Com Consolidated Grade School",'Ohio=' + Ohio.length); Ohio[Ohio.length] = createMarker(new GPoint(-89.45490265,41.54710007),"
Ohio Community High School
Po Box 478
Ohio, IL 61349

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ohio Community High School",'Ohio=' + Ohio.length); Princeton[Princeton.length] = createMarker(new GPoint(-89.46001434,41.37432480),"
Princeton High School
103 S Euclid Ave
Princeton, IL 61356

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Princeton High School",'Princeton=' + Princeton.length); Tiskilwa[Tiskilwa.length] = createMarker(new GPoint(-89.49240112,41.28580093),"
Reagan Middle School
Po Box 329
Tiskilwa, IL 61368

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Reagan Middle School",'Tiskilwa=' + Tiskilwa.length); Wyanet[Wyanet.length] = createMarker(new GPoint(-89.58394623,41.36066437),"
Roe Bureau Cty Alt School
109 W 4th Street
Wyanet, IL 61379

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Roe Bureau Cty Alt School",'Wyanet=' + Wyanet.length); Van_Orin[Van_Orin.length] = createMarker(new GPoint(-89.35430145,41.55130005),"
Van Orin Elementary School
Po Box 7
Van Orin, IL 61374

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Van Orin Elementary School",'Van_Orin=' + Van_Orin.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(Buda); map.removeOverlays(Bureau); map.removeOverlays(Cherry); map.removeOverlays(Dalzell); map.removeOverlays(Depue); map.removeOverlays(La_Moille); map.removeOverlays(Ladd); map.removeOverlays(Malden); map.removeOverlays(Manlius); map.removeOverlays(Neponset); map.removeOverlays(Ohio); map.removeOverlays(Princeton); map.removeOverlays(Sheffield); map.removeOverlays(Spring_Valley); map.removeOverlays(Tiskilwa); map.removeOverlays(Van_Orin); map.removeOverlays(Walnut); map.removeOverlays(Wyanet); 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(La_Moille);map.removeOverlays(Buda); map.removeOverlays(Bureau); map.removeOverlays(Cherry); map.removeOverlays(Dalzell); map.removeOverlays(Depue); map.removeOverlays(La_Moille); map.removeOverlays(Ladd); map.removeOverlays(Malden); map.removeOverlays(Manlius); map.removeOverlays(Neponset); map.removeOverlays(Ohio); map.removeOverlays(Princeton); map.removeOverlays(Sheffield); map.removeOverlays(Spring_Valley); map.removeOverlays(Tiskilwa); map.removeOverlays(Van_Orin); map.removeOverlays(Walnut); map.removeOverlays(Wyanet); map.addOverlays(Buda); centerByArray(Buda, false, false); cntMarker += Buda.length; map.addOverlays(Bureau); centerByArray(Bureau, false, false); cntMarker += Bureau.length; map.addOverlays(Cherry); centerByArray(Cherry, false, false); cntMarker += Cherry.length; map.addOverlays(Dalzell); centerByArray(Dalzell, false, false); cntMarker += Dalzell.length; map.addOverlays(Depue); centerByArray(Depue, false, false); cntMarker += Depue.length; map.addOverlays(La_Moille); centerByArray(La_Moille, false, false); cntMarker += La_Moille.length; map.addOverlays(Ladd); centerByArray(Ladd, false, false); cntMarker += Ladd.length; map.addOverlays(Malden); centerByArray(Malden, false, false); cntMarker += Malden.length; map.addOverlays(Manlius); centerByArray(Manlius, false, false); cntMarker += Manlius.length; map.addOverlays(Neponset); centerByArray(Neponset, false, false); cntMarker += Neponset.length; map.addOverlays(Ohio); centerByArray(Ohio, false, false); cntMarker += Ohio.length; map.addOverlays(Princeton); centerByArray(Princeton, false, false); cntMarker += Princeton.length; map.addOverlays(Sheffield); centerByArray(Sheffield, false, false); cntMarker += Sheffield.length; map.addOverlays(Spring_Valley); centerByArray(Spring_Valley, false, false); cntMarker += Spring_Valley.length; map.addOverlays(Tiskilwa); centerByArray(Tiskilwa, false, false); cntMarker += Tiskilwa.length; map.addOverlays(Van_Orin); centerByArray(Van_Orin, false, false); cntMarker += Van_Orin.length; map.addOverlays(Walnut); centerByArray(Walnut, false, false); cntMarker += Walnut.length; map.addOverlays(Wyanet); centerByArray(Wyanet, false, false); cntMarker += Wyanet.length; centerByArray(La_Moille,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'); } }