function addMarkers(){ mySelect = document.getElementById('selection'); Villanova = [];Rosemont = [];Aston = [];Radnor = [];Drexel_Hill = [];Springfield = [];Brookhaven = [];Broomall = [];Bryn_Mawr = [];Elwyn = [];Newtown_Square = [];Essington = [];Swarthmore = [];Berwyn = [];Glen_Mills = [];Chester_Heights = [];Glenolden = [];Wayne = [];mySelect.options[mySelect.options.length] = new Option("Aston schools",'all=Aston'); mySelect.options[mySelect.options.length] = new Option("Berwyn schools",'all=Berwyn'); mySelect.options[mySelect.options.length] = new Option("Brookhaven schools",'all=Brookhaven'); mySelect.options[mySelect.options.length] = new Option("Broomall schools",'all=Broomall'); mySelect.options[mySelect.options.length] = new Option("Bryn Mawr schools",'all=Bryn_Mawr'); mySelect.options[mySelect.options.length] = new Option("Chester Heights schools",'all=Chester_Heights'); mySelect.options[mySelect.options.length] = new Option("Drexel Hill schools",'all=Drexel_Hill'); mySelect.options[mySelect.options.length] = new Option("Elwyn schools",'all=Elwyn'); mySelect.options[mySelect.options.length] = new Option("Essington schools",'all=Essington'); mySelect.options[mySelect.options.length] = new Option("Glen Mills schools",'all=Glen_Mills'); mySelect.options[mySelect.options.length] = new Option("Glenolden schools",'all=Glenolden'); mySelect.options[mySelect.options.length] = new Option("Newtown Square schools",'all=Newtown_Square'); mySelect.options[mySelect.options.length] = new Option("Radnor schools",'all=Radnor'); mySelect.options[mySelect.options.length] = new Option("Rosemont schools",'all=Rosemont'); mySelect.options[mySelect.options.length] = new Option("Springfield schools",'all=Springfield'); mySelect.options[mySelect.options.length] = new Option("Swarthmore schools",'all=Swarthmore'); mySelect.options[mySelect.options.length] = new Option("Villanova schools",'all=Villanova'); mySelect.options[mySelect.options.length] = new Option("Wayne schools",'all=Wayne'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Villanova[Villanova.length] = createMarker(new GPoint(-75.36918300,40.02155700),"
Academy-notre Dame De Namur
560 Sproul Road
Villanova, PA 19085
All-girls school, 6-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Academy-notre Dame De Namur",'Villanova=' + Villanova.length); Rosemont[Rosemont.length] = createMarker(new GPoint(-75.32421100,40.02777100),"
Agnes Irwin School
Po Box 407 Ithan Ave Conestoga Rd
Rosemont, PA 19010
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Agnes Irwin School",'Rosemont=' + Rosemont.length); Aston[Aston.length] = createMarker(new GPoint(-75.42655000,39.85160400),"
American Christian School
4150 Market Street
Aston, PA 19014
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("American Christian School",'Aston=' + Aston.length); Radnor[Radnor.length] = createMarker(new GPoint(-75.35322700,40.04843500),"
Archbishop John Carroll High School
211 Matsonford Road
Radnor, PA 19087
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Archbishop John Carroll High School",'Radnor=' + Radnor.length); Drexel_Hill[Drexel_Hill.length] = createMarker(new GPoint(-75.28196800,39.95169800),"
Archbishop Prendergast High School
401 N Lansdowne Avenue
Drexel Hill, PA 19026
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Archbishop Prendergast High School",'Drexel_Hill=' + Drexel_Hill.length); Springfield[Springfield.length] = createMarker(new GPoint(-75.35322700,39.95537100),"
Cardinal O'hara High School
1701 S Sproul Road
Springfield, PA 19064
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cardinal O'hara High School",'Springfield=' + Springfield.length); Brookhaven[Brookhaven.length] = createMarker(new GPoint(-75.39372400,39.87049300),"
The Christian Academy
4301 Chandler Drive
Brookhaven, PA 19015
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Christian Academy",'Brookhaven=' + Brookhaven.length); Broomall[Broomall.length] = createMarker(new GPoint(-75.36095500,39.97533300),"
Cornerstone High School
mailing address 922 Cedar Grove Road
Broomall, PA 19008
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone High School",'Broomall=' + Broomall.length); Bryn_Mawr[Bryn_Mawr.length] = createMarker(new GPoint(-75.34434100,40.01138200),"
Country Day School Of The Sacred Heart
480 S Bryn Mawr Avenue
Bryn Mawr, PA 19010
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Country Day School Of The Sacred Heart",'Bryn_Mawr=' + Bryn_Mawr.length); Elwyn[Elwyn.length] = createMarker(new GPoint(-75.41419000,39.90658500),"
Davidson School, Elwyn Inc.
111 Elwyn Road
Elwyn, PA 19063
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davidson School, Elwyn Inc.",'Elwyn=' + Elwyn.length); Newtown_Square[Newtown_Square.length] = createMarker(new GPoint(-75.37886400,39.99574200),"
Delaware County Christian School
462 Malin Road
Newtown Square, PA 19073
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Delaware County Christian School",'Newtown_Square=' + Newtown_Square.length); Essington[Essington.length] = createMarker(new GPoint(-75.30037100,39.86750200),"
Delaware County Middle School
546 Wanamaker Ave
Essington, PA 19029
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Delaware County Middle School",'Essington=' + Essington.length); Newtown_Square[Newtown_Square.length] = createMarker(new GPoint(-75.40269700,40.02126700),"
Devereux Gateway School
3240 St Davids Rd
Newtown Square, PA 19073
All-girls school, Ungraded
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Devereux Gateway School",'Newtown_Square=' + Newtown_Square.length); Newtown_Square[Newtown_Square.length] = createMarker(new GPoint(-75.42219800,39.98252100),"
The Episcopal Academy
1785 Bishop White Drive
Newtown Square, PA 19073
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Episcopal Academy",'Newtown_Square=' + Newtown_Square.length); Swarthmore[Swarthmore.length] = createMarker(new GPoint(-75.34844500,39.89433700),"
Geoge Crothers Memorial School
401 Rutgers Ave
Swarthmore, PA 19081
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Geoge Crothers Memorial School",'Swarthmore=' + Swarthmore.length); Rosemont[Rosemont.length] = createMarker(new GPoint(-75.35532500,40.01386900),"
Hill Top Preparatory School
737 South Ithan Avenue
Rosemont, PA 19010
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hill Top Preparatory School",'Rosemont=' + Rosemont.length); Berwyn[Berwyn.length] = createMarker(new GPoint(-75.44538200,39.99905000),"
Melmark School
2600 Wayland Rd
Berwyn, PA 19312
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Melmark School",'Berwyn=' + Berwyn.length); Drexel_Hill[Drexel_Hill.length] = createMarker(new GPoint(-75.28197200,39.95170100),"
Monsignor Bonner High School
403 N Lansdowne Avenue
Drexel Hill, PA 19026
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Monsignor Bonner High School",'Drexel_Hill=' + Drexel_Hill.length); Glen_Mills[Glen_Mills.length] = createMarker(new GPoint(-75.51844700,39.88861200),"
Phila Academy For Boys - Girls
700 Baltimore Pike
Glen Mills, PA 19342
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phila Academy For Boys - Girls",'Glen_Mills=' + Glen_Mills.length); Rosemont[Rosemont.length] = createMarker(new GPoint(-75.32920000,40.02260000),"
Presbyterian Children's Village School
452 S Roberts Road
Rosemont, PA 19010
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Presbyterian Children's Village School",'Rosemont=' + Rosemont.length); Chester_Heights[Chester_Heights.length] = createMarker(new GPoint(-75.47580000,39.89000000),"
Rosehill School
P.o. Box 298
Chester Heights, PA 19017
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rosehill School",'Chester_Heights=' + Chester_Heights.length); Glenolden[Glenolden.length] = createMarker(new GPoint(-75.28290800,39.90339700),"
Southside Baptist Academy
5 E Oak Lane
Glenolden, PA 19036
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southside Baptist Academy",'Glenolden=' + Glenolden.length); Newtown_Square[Newtown_Square.length] = createMarker(new GPoint(-75.41484700,39.97530600),"
TALK Institute and School
395 Bishop Hollow Road
Newtown Square, PA 19073
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("TALK Institute and School",'Newtown_Square=' + Newtown_Square.length); Wayne[Wayne.length] = createMarker(new GPoint(-75.38420800,40.05280100),"
Valley Forge Military Academy
1001 Eagle Road
Wayne, PA 19087
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Valley Forge Military Academy",'Wayne=' + Wayne.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(Aston); map.removeOverlays(Berwyn); map.removeOverlays(Brookhaven); map.removeOverlays(Broomall); map.removeOverlays(Bryn_Mawr); map.removeOverlays(Chester_Heights); map.removeOverlays(Drexel_Hill); map.removeOverlays(Elwyn); map.removeOverlays(Essington); map.removeOverlays(Glen_Mills); map.removeOverlays(Glenolden); map.removeOverlays(Newtown_Square); map.removeOverlays(Radnor); map.removeOverlays(Rosemont); map.removeOverlays(Springfield); map.removeOverlays(Swarthmore); map.removeOverlays(Villanova); map.removeOverlays(Wayne); 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(Villanova);map.removeOverlays(Aston); map.removeOverlays(Berwyn); map.removeOverlays(Brookhaven); map.removeOverlays(Broomall); map.removeOverlays(Bryn_Mawr); map.removeOverlays(Chester_Heights); map.removeOverlays(Drexel_Hill); map.removeOverlays(Elwyn); map.removeOverlays(Essington); map.removeOverlays(Glen_Mills); map.removeOverlays(Glenolden); map.removeOverlays(Newtown_Square); map.removeOverlays(Radnor); map.removeOverlays(Rosemont); map.removeOverlays(Springfield); map.removeOverlays(Swarthmore); map.removeOverlays(Villanova); map.removeOverlays(Wayne); map.addOverlays(Aston); centerByArray(Aston, false, false); cntMarker += Aston.length; map.addOverlays(Berwyn); centerByArray(Berwyn, false, false); cntMarker += Berwyn.length; map.addOverlays(Brookhaven); centerByArray(Brookhaven, false, false); cntMarker += Brookhaven.length; map.addOverlays(Broomall); centerByArray(Broomall, false, false); cntMarker += Broomall.length; map.addOverlays(Bryn_Mawr); centerByArray(Bryn_Mawr, false, false); cntMarker += Bryn_Mawr.length; map.addOverlays(Chester_Heights); centerByArray(Chester_Heights, false, false); cntMarker += Chester_Heights.length; map.addOverlays(Drexel_Hill); centerByArray(Drexel_Hill, false, false); cntMarker += Drexel_Hill.length; map.addOverlays(Elwyn); centerByArray(Elwyn, false, false); cntMarker += Elwyn.length; map.addOverlays(Essington); centerByArray(Essington, false, false); cntMarker += Essington.length; map.addOverlays(Glen_Mills); centerByArray(Glen_Mills, false, false); cntMarker += Glen_Mills.length; map.addOverlays(Glenolden); centerByArray(Glenolden, false, false); cntMarker += Glenolden.length; map.addOverlays(Newtown_Square); centerByArray(Newtown_Square, false, false); cntMarker += Newtown_Square.length; map.addOverlays(Radnor); centerByArray(Radnor, false, false); cntMarker += Radnor.length; map.addOverlays(Rosemont); centerByArray(Rosemont, false, false); cntMarker += Rosemont.length; map.addOverlays(Springfield); centerByArray(Springfield, false, false); cntMarker += Springfield.length; map.addOverlays(Swarthmore); centerByArray(Swarthmore, false, false); cntMarker += Swarthmore.length; map.addOverlays(Villanova); centerByArray(Villanova, false, false); cntMarker += Villanova.length; map.addOverlays(Wayne); centerByArray(Wayne, false, false); cntMarker += Wayne.length; centerByArray(Villanova,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; }