function addMarkers(){ mySelect = document.getElementById('selection'); Boyertown = [];Birdsboro = [];Bethel = [];Hamburg = [];Reading = [];Hereford = [];Mertztown = [];Geigertown = [];West_Reading = [];Kempton = [];Temple = [];Mohrsville = [];Myerstown = [];Kutztown = [];Pine_Forge = [];mySelect.options[mySelect.options.length] = new Option("Bethel schools",'all=Bethel'); mySelect.options[mySelect.options.length] = new Option("Birdsboro schools",'all=Birdsboro'); mySelect.options[mySelect.options.length] = new Option("Boyertown schools",'all=Boyertown'); mySelect.options[mySelect.options.length] = new Option("Geigertown schools",'all=Geigertown'); mySelect.options[mySelect.options.length] = new Option("Hamburg schools",'all=Hamburg'); mySelect.options[mySelect.options.length] = new Option("Hereford schools",'all=Hereford'); mySelect.options[mySelect.options.length] = new Option("Kempton schools",'all=Kempton'); mySelect.options[mySelect.options.length] = new Option("Kutztown schools",'all=Kutztown'); mySelect.options[mySelect.options.length] = new Option("Mertztown schools",'all=Mertztown'); mySelect.options[mySelect.options.length] = new Option("Mohrsville schools",'all=Mohrsville'); mySelect.options[mySelect.options.length] = new Option("Myerstown schools",'all=Myerstown'); mySelect.options[mySelect.options.length] = new Option("Pine Forge schools",'all=Pine_Forge'); mySelect.options[mySelect.options.length] = new Option("Reading schools",'all=Reading'); mySelect.options[mySelect.options.length] = new Option("Temple schools",'all=Temple'); mySelect.options[mySelect.options.length] = new Option("West Reading schools",'all=West_Reading'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Boyertown[Boyertown.length] = createMarker(new GPoint(-75.65010000,40.32997500),"
Alpha Omega Christian Academy
35 Popodickon Drive
Boyertown, PA 19512
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alpha Omega Christian Academy",'Boyertown=' + Boyertown.length); Birdsboro[Birdsboro.length] = createMarker(new GPoint(-75.81677100,40.28589300),"
Berks Christian School
926 Philadelphia Ter
Birdsboro, PA 19508
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berks Christian School",'Birdsboro=' + Birdsboro.length); Bethel[Bethel.length] = createMarker(new GPoint(-76.22867100,40.47819500),"
Bethel Dunkard Brethren Church School
5450 Four Point Road
Bethel, PA 19507
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Dunkard Brethren Church School",'Bethel=' + Bethel.length); Hamburg[Hamburg.length] = createMarker(new GPoint(-76.03630600,40.55540800),"
Blue Mountain Academy
2363 Mountain Road
Hamburg, PA 19526
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blue Mountain Academy",'Hamburg=' + Hamburg.length); Reading[Reading.length] = createMarker(new GPoint(-75.90859700,40.33387100),"
Central Catholic High School
1400 Hill Road
Reading, PA 19602
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Catholic High School",'Reading=' + Reading.length); Hereford[Hereford.length] = createMarker(new GPoint(-75.55052900,40.44170700),"
Chapel Mennonite School
42 School House Road
Hereford, PA 18056
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chapel Mennonite School",'Hereford=' + Hereford.length); Reading[Reading.length] = createMarker(new GPoint(-75.91090000,40.32931200),"
Fairview Christian School
410 S 14th St
Reading, PA 19602
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairview Christian School",'Reading=' + Reading.length); Mertztown[Mertztown.length] = createMarker(new GPoint(-75.70090900,40.45210200),"
Gateway Christian School
245 Fredericksville Road
Mertztown, PA 19539
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway Christian School",'Mertztown=' + Mertztown.length); Geigertown[Geigertown.length] = createMarker(new GPoint(-75.83660000,40.20250000),"
High Point Baptist Academy
Po Box 188 200 Chapel Road
Geigertown, PA 19523
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("High Point Baptist Academy",'Geigertown=' + Geigertown.length); Reading[Reading.length] = createMarker(new GPoint(-75.94604400,40.32307300),"
Holy Name High School
955 E Wyomissing Blvd
Reading, PA 19611
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Name High School",'Reading=' + Reading.length); West_Reading[West_Reading.length] = createMarker(new GPoint(-75.94242700,40.33571500),"
John Paul Ii Center For Specia
200 Reading Ave
West Reading, PA 19611
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John Paul Ii Center For Specia",'West_Reading=' + West_Reading.length); Kempton[Kempton.length] = createMarker(new GPoint(-75.90518400,40.63114600),"
Kempton New Church School
583 Hawk Mountain Road
Kempton, PA 19529
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kempton New Church School",'Kempton=' + Kempton.length); Temple[Temple.length] = createMarker(new GPoint(-75.90520000,40.40200000),"
Kidspeace Advances Program School
8th Avenue And Hay Road
Temple, PA 19560
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kidspeace Advances Program School",'Temple=' + Temple.length); Mohrsville[Mohrsville.length] = createMarker(new GPoint(-75.99317200,40.48015700),"
The King's Academy
1562 Main Street
Mohrsville, PA 19541
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The King's Academy",'Mohrsville=' + Mohrsville.length); Myerstown[Myerstown.length] = createMarker(new GPoint(-76.30132200,40.44267000),"
Lebanon Valley Christian School
7821 Lancaster Avenue
Myerstown, PA 17067
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lebanon Valley Christian School",'Myerstown=' + Myerstown.length); Kutztown[Kutztown.length] = createMarker(new GPoint(-75.77648800,40.51852000),"
Lighthouse Christian Academy
5 Penn St, Box 287
Kutztown, PA 19536
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian Academy",'Kutztown=' + Kutztown.length); Pine_Forge[Pine_Forge.length] = createMarker(new GPoint(-75.69110000,40.28270000),"
Pine Forge Academy
Po Box 338
Pine Forge, PA 19548
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Forge Academy",'Pine_Forge=' + Pine_Forge.length); Reading[Reading.length] = createMarker(new GPoint(-75.94992900,40.31640200),"
Reading Sda Jr Academy
309 Kenhorst Blvd
Reading, PA 19607
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Reading Sda Jr Academy",'Reading=' + Reading.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,11); /* 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/////2/' + showArray); map.removeOverlays(Bethel); map.removeOverlays(Birdsboro); map.removeOverlays(Boyertown); map.removeOverlays(Geigertown); map.removeOverlays(Hamburg); map.removeOverlays(Hereford); map.removeOverlays(Kempton); map.removeOverlays(Kutztown); map.removeOverlays(Mertztown); map.removeOverlays(Mohrsville); map.removeOverlays(Myerstown); map.removeOverlays(Pine_Forge); map.removeOverlays(Reading); map.removeOverlays(Temple); map.removeOverlays(West_Reading); 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(Boyertown);map.removeOverlays(Bethel); map.removeOverlays(Birdsboro); map.removeOverlays(Boyertown); map.removeOverlays(Geigertown); map.removeOverlays(Hamburg); map.removeOverlays(Hereford); map.removeOverlays(Kempton); map.removeOverlays(Kutztown); map.removeOverlays(Mertztown); map.removeOverlays(Mohrsville); map.removeOverlays(Myerstown); map.removeOverlays(Pine_Forge); map.removeOverlays(Reading); map.removeOverlays(Temple); map.removeOverlays(West_Reading); map.addOverlays(Bethel); centerByArray(Bethel, false, false); cntMarker += Bethel.length; map.addOverlays(Birdsboro); centerByArray(Birdsboro, false, false); cntMarker += Birdsboro.length; map.addOverlays(Boyertown); centerByArray(Boyertown, false, false); cntMarker += Boyertown.length; map.addOverlays(Geigertown); centerByArray(Geigertown, false, false); cntMarker += Geigertown.length; map.addOverlays(Hamburg); centerByArray(Hamburg, false, false); cntMarker += Hamburg.length; map.addOverlays(Hereford); centerByArray(Hereford, false, false); cntMarker += Hereford.length; map.addOverlays(Kempton); centerByArray(Kempton, false, false); cntMarker += Kempton.length; map.addOverlays(Kutztown); centerByArray(Kutztown, false, false); cntMarker += Kutztown.length; map.addOverlays(Mertztown); centerByArray(Mertztown, false, false); cntMarker += Mertztown.length; map.addOverlays(Mohrsville); centerByArray(Mohrsville, false, false); cntMarker += Mohrsville.length; map.addOverlays(Myerstown); centerByArray(Myerstown, false, false); cntMarker += Myerstown.length; map.addOverlays(Pine_Forge); centerByArray(Pine_Forge, false, false); cntMarker += Pine_Forge.length; map.addOverlays(Reading); centerByArray(Reading, false, false); cntMarker += Reading.length; map.addOverlays(Temple); centerByArray(Temple, false, false); cntMarker += Temple.length; map.addOverlays(West_Reading); centerByArray(West_Reading, false, false); cntMarker += West_Reading.length; centerByArray(Boyertown,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'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }