function addMarkers() { mySelect = document.getElementById('selection'); Annville = [];Lebanon = [];Cleona = [];Cornwall = [];Myerstown = [];Palmyra = [];Fredericksburg = [];Jonestown = [];Schaefferstown = [];mySelect.options[mySelect.options.length] = new Option("Annville schools",'all=Annville'); mySelect.options[mySelect.options.length] = new Option("Cleona schools",'all=Cleona'); mySelect.options[mySelect.options.length] = new Option("Cornwall schools",'all=Cornwall'); mySelect.options[mySelect.options.length] = new Option("Fredericksburg schools",'all=Fredericksburg'); mySelect.options[mySelect.options.length] = new Option("Jonestown schools",'all=Jonestown'); mySelect.options[mySelect.options.length] = new Option("Lebanon schools",'all=Lebanon'); mySelect.options[mySelect.options.length] = new Option("Myerstown schools",'all=Myerstown'); mySelect.options[mySelect.options.length] = new Option("Palmyra schools",'all=Palmyra'); mySelect.options[mySelect.options.length] = new Option("Schaefferstown schools",'all=Schaefferstown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Annville[Annville.length] = createMarker(new GPoint(-76.51167297,40.32358170),"
Annville Cleona Junior Senior High School
500 S White Oak St
Annville, PA 17003

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Annville Cleona Junior Senior High School",'Annville=' + Annville.length); Annville[Annville.length] = createMarker(new GPoint(-76.51412964,40.32707596),"
Annville Elementary School
205 S White Oak St
Annville, PA 17003

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Annville Elementary School",'Annville=' + Annville.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.40308380,40.30995560),"
Cedar Crest High School
115 E Evergreen Rd
Lebanon, PA 17042

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Crest High School",'Lebanon=' + Lebanon.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.40458679,40.30883789),"
Cedar Crest Middle School
101 E Evergreen Rd
Lebanon, PA 17042

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cedar Crest Middle School",'Lebanon=' + Lebanon.length); Cleona[Cleona.length] = createMarker(new GPoint(-76.47410583,40.33531570),"
Cleona Elementary School
50 E Walnut St
Cleona, PA 17042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cleona Elementary School",'Cleona=' + Cleona.length); Cornwall[Cornwall.length] = createMarker(new GPoint(-76.40630341,40.27360153),"
Cornwall Elementary School
Po Box 308
Cornwall, PA 17016

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cornwall Elementary School",'Cornwall=' + Cornwall.length); Annville[Annville.length] = createMarker(new GPoint(-76.58040619,40.39697647),"
East Hanover Elementary School
1098 School House Road
Annville, PA 17003

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Hanover Elementary School",'Annville=' + Annville.length); Myerstown[Myerstown.length] = createMarker(new GPoint(-76.29171753,40.34205246),"
Eastern Lebanon Co Middle School
60 Evergreen Dr
Myerstown, PA 17067

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eastern Lebanon Co Middle School",'Myerstown=' + Myerstown.length); Myerstown[Myerstown.length] = createMarker(new GPoint(-76.28919220,40.34612656),"
Eastern Lebanon Co Senior High School
180 Elco Dr
Myerstown, PA 17067

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Lebanon Co Senior High School",'Myerstown=' + Myerstown.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.43457794,40.36949921),"
Ebenezer Elementary School
1600 Colonial Cir
Lebanon, PA 17046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ebenezer Elementary School",'Lebanon=' + Lebanon.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-76.58404541,40.30815887),"
Forge Road Elementary School
400 S Forge Rd
Palmyra, PA 17078

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forge Road Elementary School",'Palmyra=' + Palmyra.length); Fredericksburg[Fredericksburg.length] = createMarker(new GPoint(-76.42849731,40.45460129),"
Fredericksburg Elementary School
Po Box 27
Fredericksburg, PA 17026

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fredericksburg Elementary School",'Fredericksburg=' + Fredericksburg.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.42142487,40.33810806),"
Harding Elementary School
622 Chestnut St
Lebanon, PA 17042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harding Elementary School",'Lebanon=' + Lebanon.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.40697479,40.34656143),"
Houck Elementary School
315 E Lehman St
Lebanon, PA 17046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Houck Elementary School",'Lebanon=' + Lebanon.length); Myerstown[Myerstown.length] = createMarker(new GPoint(-76.33004761,40.36960983),"
Jackson Elementary School
558 W Main Ave
Myerstown, PA 17067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson Elementary School",'Myerstown=' + Myerstown.length); Jonestown[Jonestown.length] = createMarker(new GPoint(-76.50199890,40.43249893),"
Jonestown Elementary School
Po Box 839
Jonestown, PA 17038

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jonestown Elementary School",'Jonestown=' + Jonestown.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.39575958,40.34168243),"
Lebanon County Ctc
833 Metro Dr
Lebanon, PA 17042

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lebanon County Ctc",'Lebanon=' + Lebanon.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.42270660,40.32731247),"
Lebanon Senior High School
1000 S 8th St
Lebanon, PA 17042

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lebanon Senior High School",'Lebanon=' + Lebanon.length); Jonestown[Jonestown.length] = createMarker(new GPoint(-76.47878265,40.41368866),"
Lickdale Elementary School
40 Fisher Avenue
Jonestown, PA 17038

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lickdale Elementary School",'Jonestown=' + Jonestown.length); Myerstown[Myerstown.length] = createMarker(new GPoint(-76.31620026,40.38750076),"
Myerstown Elementary School
101 S Railroad St
Myerstown, PA 17067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Myerstown Elementary School",'Myerstown=' + Myerstown.length); Annville[Annville.length] = createMarker(new GPoint(-76.51552582,40.32928085),"
North Annville Elementary School
775 North Route 934
Annville, PA 17003

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Annville Elementary School",'Annville=' + Annville.length); Fredericksburg[Fredericksburg.length] = createMarker(new GPoint(-76.42849731,40.45460129),"
Northern Lebanon Middle School
Po Box 100
Fredericksburg, PA 17026

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northern Lebanon Middle School",'Fredericksburg=' + Fredericksburg.length); Fredericksburg[Fredericksburg.length] = createMarker(new GPoint(-76.42849731,40.45460129),"
Northern Lebanon Senior High School
Po Box 100
Fredericksburg, PA 17026

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Lebanon Senior High School",'Fredericksburg=' + Fredericksburg.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-76.59691620,40.31538773),"
Northside Elementary School
301 E Spruce St
Palmyra, PA 17078

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northside Elementary School",'Palmyra=' + Palmyra.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.42773437,40.34973145),"
Northwest Elementary School
900 Maple St
Lebanon, PA 17046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwest Elementary School",'Lebanon=' + Lebanon.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-76.59470367,40.30654907),"
Palmyra Area Middle School
50 W Cherry St
Palmyra, PA 17078

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Palmyra Area Middle School",'Palmyra=' + Palmyra.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-76.58511353,40.29971313),"
Palmyra Area Senior High School
1125 Park Dr
Palmyra, PA 17078

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Palmyra Area Senior High School",'Palmyra=' + Palmyra.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-76.59177399,40.30277252),"
Pine Street Elementary School
50 W Pine St
Palmyra, PA 17078

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Street Elementary School",'Palmyra=' + Palmyra.length); Schaefferstown[Schaefferstown.length] = createMarker(new GPoint(-76.30519867,40.30450058),"
Schaefferstown Elementary School
Oak Carpenter Sts Po Box 346
Schaefferstown, PA 17088

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Schaefferstown Elementary School",'Schaefferstown=' + Schaefferstown.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.36685944,40.31725311),"
South Lebanon Elementary School
1825 S 5th Ave
Lebanon, PA 17042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Lebanon Elementary School",'Lebanon=' + Lebanon.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.40427399,40.33654404),"
Southeast Elementary School
398 E Locust St
Lebanon, PA 17042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southeast Elementary School",'Lebanon=' + Lebanon.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.43276978,40.32701111),"
Southwest Elementary School
1500 Woodland St
Lebanon, PA 17042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Lebanon=' + Lebanon.length); Lebanon[Lebanon.length] = createMarker(new GPoint(-76.37789154,40.36096573),"
Union Canal Elementary School
400 Narrows Dr
Lebanon, PA 17046

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Canal Elementary School",'Lebanon=' + Lebanon.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(Annville); map.removeOverlays(Cleona); map.removeOverlays(Cornwall); map.removeOverlays(Fredericksburg); map.removeOverlays(Jonestown); map.removeOverlays(Lebanon); map.removeOverlays(Myerstown); map.removeOverlays(Palmyra); map.removeOverlays(Schaefferstown); 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(Annville);map.removeOverlays(Annville); map.removeOverlays(Cleona); map.removeOverlays(Cornwall); map.removeOverlays(Fredericksburg); map.removeOverlays(Jonestown); map.removeOverlays(Lebanon); map.removeOverlays(Myerstown); map.removeOverlays(Palmyra); map.removeOverlays(Schaefferstown); map.addOverlays(Annville); centerByArray(Annville, false, false); cntMarker += Annville.length; map.addOverlays(Cleona); centerByArray(Cleona, false, false); cntMarker += Cleona.length; map.addOverlays(Cornwall); centerByArray(Cornwall, false, false); cntMarker += Cornwall.length; map.addOverlays(Fredericksburg); centerByArray(Fredericksburg, false, false); cntMarker += Fredericksburg.length; map.addOverlays(Jonestown); centerByArray(Jonestown, false, false); cntMarker += Jonestown.length; map.addOverlays(Lebanon); centerByArray(Lebanon, false, false); cntMarker += Lebanon.length; map.addOverlays(Myerstown); centerByArray(Myerstown, false, false); cntMarker += Myerstown.length; map.addOverlays(Palmyra); centerByArray(Palmyra, false, false); cntMarker += Palmyra.length; map.addOverlays(Schaefferstown); centerByArray(Schaefferstown, false, false); cntMarker += Schaefferstown.length; centerByArray(Annville,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'); } }