function addMarkers() { mySelect = document.getElementById('selection'); Lincoln = [];Atlanta = [];Elkhart = [];Emden = [];Hartsburg = [];Mount_Pulaski = [];Middletown = [];mySelect.options[mySelect.options.length] = new Option("Atlanta schools",'all=Atlanta'); mySelect.options[mySelect.options.length] = new Option("Elkhart schools",'all=Elkhart'); mySelect.options[mySelect.options.length] = new Option("Emden schools",'all=Emden'); mySelect.options[mySelect.options.length] = new Option("Hartsburg schools",'all=Hartsburg'); mySelect.options[mySelect.options.length] = new Option("Lincoln schools",'all=Lincoln'); mySelect.options[mySelect.options.length] = new Option("Middletown schools",'all=Middletown'); mySelect.options[mySelect.options.length] = new Option("Mount Pulaski schools",'all=Mount_Pulaski'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.35811615,40.16244125),"
Adams Elementary School
1311 Nicholson Rd
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adams Elementary School",'Lincoln=' + Lincoln.length); Atlanta[Atlanta.length] = createMarker(new GPoint(-89.23513031,40.26392365),"
Atlanta Elementary School
103 Ne 5th St
Atlanta, IL 61723

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atlanta Elementary School",'Atlanta=' + Atlanta.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.36808777,40.15016174),"
Central Elementary School
100 7th St
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.34818268,40.13610077),"
Chester-east Lincoln Elementary School
1300 1500th St
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chester-east Lincoln Elementary School",'Lincoln=' + Lincoln.length); Elkhart[Elkhart.length] = createMarker(new GPoint(-89.45870209,40.01789856),"
Elkhart Elementary School
Po Box 140
Elkhart, IL 62634

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elkhart Elementary School",'Elkhart=' + Elkhart.length); Emden[Emden.length] = createMarker(new GPoint(-89.48490143,40.29449844),"
Emden Elementary School
Po Box 259
Emden, IL 62635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Emden Elementary School",'Emden=' + Emden.length); Hartsburg[Hartsburg.length] = createMarker(new GPoint(-89.44377899,40.24956131),"
Hartsburg-emden Jr-sr High School
400 W Front St
Hartsburg, IL 62643

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hartsburg-emden Jr-sr High School",'Hartsburg=' + Hartsburg.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.37805176,40.14703751),"
Jefferson Elementary School
710 5th St
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.37733459,40.13706207),"
L D C - Activity Center
861 S State St
Lincoln, IL 62656

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("L D C - Activity Center",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.35756100,40.15182300),"
Lincoln Comm High School
1000 Primm Rd
Lincoln, IL 62656

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln Comm High School",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.37100220,40.14799881),"
Lincoln Correctional Center
Po Box 549
Lincoln, IL 62656

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln Correctional Center",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.36698151,40.14997482),"
Lincoln Junior High School
208 Broadway
Lincoln, IL 62656

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincoln Junior High School",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.35829926,40.13700104),"
Lincolnland Technical Ed Center
1000 Primm Rd
Lincoln, IL 62656

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincolnland Technical Ed Center",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.33892059,40.07735825),"
Logan Correctional Center
1096 1350th St
Lincoln, IL 62656

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Logan Correctional Center",'Lincoln=' + Lincoln.length); Mount_Pulaski[Mount_Pulaski.length] = createMarker(new GPoint(-89.28128052,40.00987625),"
Mount Pulaski Elementary School
119 N Garden St
Mount Pulaski, IL 62548

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Pulaski Elementary School",'Mount_Pulaski=' + Mount_Pulaski.length); Mount_Pulaski[Mount_Pulaski.length] = createMarker(new GPoint(-89.28807831,40.00841904),"
Mount Pulaski High School
206 S Spring
Mount Pulaski, IL 62548

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Pulaski High School",'Mount_Pulaski=' + Mount_Pulaski.length); Middletown[Middletown.length] = createMarker(new GPoint(-89.58496857,40.09946442),"
New Holland-middletown Elementary School
75 1250th St
Middletown, IL 62666

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Holland-middletown Elementary School",'Middletown=' + Middletown.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.37529755,40.15413666),"
Northwest Elementary School
506 11th St
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwest Elementary School",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.35823059,40.14549637),"
Washington-monroe Elementary School
1002 Pekin St
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington-monroe Elementary School",'Lincoln=' + Lincoln.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-89.40541840,40.15766144),"
West Lincoln-broadwell Elementary School
2695 Woodlawn Rd
Lincoln, IL 62656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Lincoln-broadwell Elementary School",'Lincoln=' + Lincoln.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(Atlanta); map.removeOverlays(Elkhart); map.removeOverlays(Emden); map.removeOverlays(Hartsburg); map.removeOverlays(Lincoln); map.removeOverlays(Middletown); map.removeOverlays(Mount_Pulaski); 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(Lincoln);map.removeOverlays(Atlanta); map.removeOverlays(Elkhart); map.removeOverlays(Emden); map.removeOverlays(Hartsburg); map.removeOverlays(Lincoln); map.removeOverlays(Middletown); map.removeOverlays(Mount_Pulaski); map.addOverlays(Atlanta); centerByArray(Atlanta, false, false); cntMarker += Atlanta.length; map.addOverlays(Elkhart); centerByArray(Elkhart, false, false); cntMarker += Elkhart.length; map.addOverlays(Emden); centerByArray(Emden, false, false); cntMarker += Emden.length; map.addOverlays(Hartsburg); centerByArray(Hartsburg, false, false); cntMarker += Hartsburg.length; map.addOverlays(Lincoln); centerByArray(Lincoln, false, false); cntMarker += Lincoln.length; map.addOverlays(Middletown); centerByArray(Middletown, false, false); cntMarker += Middletown.length; map.addOverlays(Mount_Pulaski); centerByArray(Mount_Pulaski, false, false); cntMarker += Mount_Pulaski.length; centerByArray(Lincoln,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'); } }