function addMarkers() { mySelect = document.getElementById('selection'); Altamont = [];Effingham = [];Beecher_City = [];Dieterich = [];Edgewood = [];Shumway = [];Teutopolis = [];mySelect.options[mySelect.options.length] = new Option("Altamont schools",'all=Altamont'); mySelect.options[mySelect.options.length] = new Option("Beecher City schools",'all=Beecher_City'); mySelect.options[mySelect.options.length] = new Option("Dieterich schools",'all=Dieterich'); mySelect.options[mySelect.options.length] = new Option("Edgewood schools",'all=Edgewood'); mySelect.options[mySelect.options.length] = new Option("Effingham schools",'all=Effingham'); mySelect.options[mySelect.options.length] = new Option("Shumway schools",'all=Shumway'); mySelect.options[mySelect.options.length] = new Option("Teutopolis schools",'all=Teutopolis'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Altamont[Altamont.length] = createMarker(new GPoint(-88.74552155,39.05571747),"
Altamont Grade School
407 S Edwards St
Altamont, IL 62411

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Altamont Grade School",'Altamont=' + Altamont.length); Altamont[Altamont.length] = createMarker(new GPoint(-88.74092102,39.05971909),"
Altamont High School
7 S Ewing St
Altamont, IL 62411

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Altamont High School",'Altamont=' + Altamont.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.54226100,39.10509600),"
Aspire Alternative High School
1901 S 4th Ste 213
Effingham, IL 62401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aspire Alternative High School",'Effingham=' + Effingham.length); Beecher_City[Beecher_City.length] = createMarker(new GPoint(-88.80650330,39.18470001),"
Beecher City Grade School
Po Box 98
Beecher City, IL 62414

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beecher City Grade School",'Beecher_City=' + Beecher_City.length); Beecher_City[Beecher_City.length] = createMarker(new GPoint(-88.80650330,39.18470001),"
Beecher City Junior Senior High School
Po Box 97
Beecher City, IL 62414

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beecher City Junior Senior High School",'Beecher_City=' + Beecher_City.length); Dieterich[Dieterich.length] = createMarker(new GPoint(-88.43750000,39.06063843),"
Bishop Creek Grade School
19970 E 1000th Ave
Dieterich, IL 62424

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bishop Creek Grade School",'Dieterich=' + Dieterich.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.54797363,39.07168579),"
Central Grade School
10421 N Us Hwy 45
Effingham, IL 62401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Grade School",'Effingham=' + Effingham.length); Dieterich[Dieterich.length] = createMarker(new GPoint(-88.42459869,39.01610184),"
Dieterich Elementary School
Po Box 187
Dieterich, IL 62424

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dieterich Elementary School",'Dieterich=' + Dieterich.length); Dieterich[Dieterich.length] = createMarker(new GPoint(-88.42459869,39.01610184),"
Dieterich Jr/sr High School
Po Box 187
Dieterich, IL 62424

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dieterich Jr/sr High School",'Dieterich=' + Dieterich.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.54762268,39.08003235),"
Early Learning Center
3224 S Banker
Effingham, IL 62401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Early Learning Center",'Effingham=' + Effingham.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.53847504,39.12236786),"
East Side Pre-school
205 N 1st St
Effingham, IL 62401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Side Pre-school",'Effingham=' + Effingham.length); Edgewood[Edgewood.length] = createMarker(new GPoint(-88.67179871,38.89419937),"
Edgewood Grade School
Po Box 207
Edgewood, IL 62426

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgewood Grade School",'Edgewood=' + Edgewood.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.55715179,39.11657715),"
Effingham High School
1301 W Grove Ave
Effingham, IL 62401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Effingham High School",'Effingham=' + Effingham.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.55602264,39.11759567),"
Effingham Junior High School
600 S Henrietta St
Effingham, IL 62401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Effingham Junior High School",'Effingham=' + Effingham.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.54061890,39.12157440),"
Esp Safe Schools Program Middle School
1901 S 4th Ste 213
Effingham, IL 62401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Esp Safe Schools Program Middle School",'Effingham=' + Effingham.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.52387238,39.20243454),"
Green Creek Grade School
20117 N 1525th St
Effingham, IL 62401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Creek Grade School",'Effingham=' + Effingham.length); Shumway[Shumway.length] = createMarker(new GPoint(-88.65602112,39.18333817),"
Shumway Grade School
304 S West St
Shumway, IL 62461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shumway Grade School",'Shumway=' + Shumway.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.54374695,39.11176300),"
South Side Grade School
211 W Douglas Ave
Effingham, IL 62401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Side Grade School",'Effingham=' + Effingham.length); Teutopolis[Teutopolis.length] = createMarker(new GPoint(-88.46939850,39.13306046),"
Teutopolis Grade School
309 E Main St
Teutopolis, IL 62467

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Teutopolis Grade School",'Teutopolis=' + Teutopolis.length); Teutopolis[Teutopolis.length] = createMarker(new GPoint(-88.48495483,39.13003922),"
Teutopolis High School
801 W Main
Teutopolis, IL 62467

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Teutopolis High School",'Teutopolis=' + Teutopolis.length); Teutopolis[Teutopolis.length] = createMarker(new GPoint(-88.48466492,39.13370514),"
Teutopolis Junior High School
904 W Water St
Teutopolis, IL 62467

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Teutopolis Junior High School",'Teutopolis=' + Teutopolis.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.61462402,39.09265518),"
Tlc Funkhouser
12073 N 1000th Rd
Effingham, IL 62401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tlc Funkhouser",'Effingham=' + Effingham.length); Effingham[Effingham.length] = createMarker(new GPoint(-88.55297852,39.11953735),"
West Side Grade School
900 W Edgar Ave
Effingham, IL 62401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Side Grade School",'Effingham=' + Effingham.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(Altamont); map.removeOverlays(Beecher_City); map.removeOverlays(Dieterich); map.removeOverlays(Edgewood); map.removeOverlays(Effingham); map.removeOverlays(Shumway); map.removeOverlays(Teutopolis); 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(Altamont);map.removeOverlays(Altamont); map.removeOverlays(Beecher_City); map.removeOverlays(Dieterich); map.removeOverlays(Edgewood); map.removeOverlays(Effingham); map.removeOverlays(Shumway); map.removeOverlays(Teutopolis); map.addOverlays(Altamont); centerByArray(Altamont, false, false); cntMarker += Altamont.length; map.addOverlays(Beecher_City); centerByArray(Beecher_City, false, false); cntMarker += Beecher_City.length; map.addOverlays(Dieterich); centerByArray(Dieterich, false, false); cntMarker += Dieterich.length; map.addOverlays(Edgewood); centerByArray(Edgewood, false, false); cntMarker += Edgewood.length; map.addOverlays(Effingham); centerByArray(Effingham, false, false); cntMarker += Effingham.length; map.addOverlays(Shumway); centerByArray(Shumway, false, false); cntMarker += Shumway.length; map.addOverlays(Teutopolis); centerByArray(Teutopolis, false, false); cntMarker += Teutopolis.length; centerByArray(Altamont,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'); } }