function addMarkers(){ mySelect = document.getElementById('selection'); Warminster = [];Bensalem = [];Southampton = [];Yardley = [];Tullytown = [];Fairless_Hills = [];Sellersville = [];Newtown = [];Quakertown = [];Plumsteadville = [];Levittown = [];New_Hope = [];Ottsville = [];Holland = [];Langhorne = [];mySelect.options[mySelect.options.length] = new Option("Bensalem schools",'all=Bensalem'); mySelect.options[mySelect.options.length] = new Option("Fairless Hills schools",'all=Fairless_Hills'); mySelect.options[mySelect.options.length] = new Option("Holland schools",'all=Holland'); mySelect.options[mySelect.options.length] = new Option("Langhorne schools",'all=Langhorne'); mySelect.options[mySelect.options.length] = new Option("Levittown schools",'all=Levittown'); mySelect.options[mySelect.options.length] = new Option("New Hope schools",'all=New_Hope'); mySelect.options[mySelect.options.length] = new Option("Newtown schools",'all=Newtown'); mySelect.options[mySelect.options.length] = new Option("Ottsville schools",'all=Ottsville'); mySelect.options[mySelect.options.length] = new Option("Plumsteadville schools",'all=Plumsteadville'); mySelect.options[mySelect.options.length] = new Option("Quakertown schools",'all=Quakertown'); mySelect.options[mySelect.options.length] = new Option("Sellersville schools",'all=Sellersville'); mySelect.options[mySelect.options.length] = new Option("Southampton schools",'all=Southampton'); mySelect.options[mySelect.options.length] = new Option("Tullytown schools",'all=Tullytown'); mySelect.options[mySelect.options.length] = new Option("Warminster schools",'all=Warminster'); mySelect.options[mySelect.options.length] = new Option("Yardley schools",'all=Yardley'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Warminster[Warminster.length] = createMarker(new GPoint(-75.09935700,40.20847800),"
Archbishop Wood High School
655 York Road
Warminster, PA 18974
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Archbishop Wood High School",'Warminster=' + Warminster.length); Bensalem[Bensalem.length] = createMarker(new GPoint(-74.95761800,40.12453700),"
Bensalem Baptist School
3351 Richlieu Rd
Bensalem, PA 19020
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bensalem Baptist School",'Bensalem=' + Bensalem.length); Southampton[Southampton.length] = createMarker(new GPoint(-75.03838100,40.18065700),"
Bethanna
1030 Second Street Pike
Southampton, PA 18966
Co-ed school, 3-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethanna",'Southampton=' + Southampton.length); Yardley[Yardley.length] = createMarker(new GPoint(-74.82781700,40.20765800),"
Bucus County Yeshiva High School
905 Big Oak Road
Yardley, PA 19067
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bucus County Yeshiva High School",'Yardley=' + Yardley.length); Tullytown[Tullytown.length] = createMarker(new GPoint(-74.81292900,40.14159600),"
Christ The King Christian Academy
465 Main St
Tullytown, PA 19007
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ The King Christian Academy",'Tullytown=' + Tullytown.length); Fairless_Hills[Fairless_Hills.length] = createMarker(new GPoint(-74.85223700,40.16217000),"
Conwell Egan Catholic High School
611 Wistar Road
Fairless Hills, PA 19030
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conwell Egan Catholic High School",'Fairless_Hills=' + Fairless_Hills.length); Fairless_Hills[Fairless_Hills.length] = createMarker(new GPoint(-74.86855400,40.16582000),"
Faith Baptist Christian Academy
1515 Wistar Road
Fairless Hills, PA 19030
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Baptist Christian Academy",'Fairless_Hills=' + Fairless_Hills.length); Sellersville[Sellersville.length] = createMarker(new GPoint(-75.31321000,40.36916600),"
Faith Christian Academy
700 N Main Street
Sellersville, PA 18960
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Sellersville=' + Sellersville.length); Newtown[Newtown.length] = createMarker(new GPoint(-74.94020000,40.24580000),"
George School
Box 4000 Rt 413
Newtown, PA 18940
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("George School",'Newtown=' + Newtown.length); Bensalem[Bensalem.length] = createMarker(new GPoint(-74.94624300,40.07998000),"
Holy Ghost Prep
2429 Bristol Pike
Bensalem, PA 19020
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Holy Ghost Prep",'Bensalem=' + Bensalem.length); Quakertown[Quakertown.length] = createMarker(new GPoint(-75.25379600,40.47011500),"
Lahay Christian School
1639 Mission Rd
Quakertown, PA 18951
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lahay Christian School",'Quakertown=' + Quakertown.length); Warminster[Warminster.length] = createMarker(new GPoint(-75.08876500,40.19070800),"
Middle Earth Academy
299 Jacksonville Road
Warminster, PA 18974
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Middle Earth Academy",'Warminster=' + Warminster.length); Plumsteadville[Plumsteadville.length] = createMarker(new GPoint(-75.14814100,40.39415600),"
Plumstead Christian School
Po Box 216 5765 Old Easton Rd
Plumsteadville, PA 18949
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Plumstead Christian School",'Plumsteadville=' + Plumsteadville.length); Levittown[Levittown.length] = createMarker(new GPoint(-74.88070600,40.16498300),"
Queen Of The Universe Day Center
2477 Trenton Road
Levittown, PA 19056
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Queen Of The Universe Day Center",'Levittown=' + Levittown.length); New_Hope[New_Hope.length] = createMarker(new GPoint(-74.98841300,40.38185200),"
Solebury School
6832 Phillips Mill Road
New Hope, PA 18938
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Solebury School",'New_Hope=' + New_Hope.length); Ottsville[Ottsville.length] = createMarker(new GPoint(-75.16310000,40.47552000),"
Tinicum Art And Science
Po Box 576 85 Sherman Road
Ottsville, PA 18942
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tinicum Art And Science",'Ottsville=' + Ottsville.length); Sellersville[Sellersville.length] = createMarker(new GPoint(-75.31555500,40.40424900),"
Upper Bucks Christian School
754 E Rockhill Rd
Sellersville, PA 18960
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upper Bucks Christian School",'Sellersville=' + Sellersville.length); Holland[Holland.length] = createMarker(new GPoint(-74.98254100,40.20609400),"
Villa Joseph Marie High School
1180 Holland Road
Holland, PA 18966
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Villa Joseph Marie High School",'Holland=' + Holland.length); Langhorne[Langhorne.length] = createMarker(new GPoint(-74.91000000,40.17670000),"
Woods Services
Route 213
Langhorne, PA 19047
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woods Services",'Langhorne=' + Langhorne.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(Bensalem); map.removeOverlays(Fairless_Hills); map.removeOverlays(Holland); map.removeOverlays(Langhorne); map.removeOverlays(Levittown); map.removeOverlays(New_Hope); map.removeOverlays(Newtown); map.removeOverlays(Ottsville); map.removeOverlays(Plumsteadville); map.removeOverlays(Quakertown); map.removeOverlays(Sellersville); map.removeOverlays(Southampton); map.removeOverlays(Tullytown); map.removeOverlays(Warminster); map.removeOverlays(Yardley); 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(Warminster);map.removeOverlays(Bensalem); map.removeOverlays(Fairless_Hills); map.removeOverlays(Holland); map.removeOverlays(Langhorne); map.removeOverlays(Levittown); map.removeOverlays(New_Hope); map.removeOverlays(Newtown); map.removeOverlays(Ottsville); map.removeOverlays(Plumsteadville); map.removeOverlays(Quakertown); map.removeOverlays(Sellersville); map.removeOverlays(Southampton); map.removeOverlays(Tullytown); map.removeOverlays(Warminster); map.removeOverlays(Yardley); map.addOverlays(Bensalem); centerByArray(Bensalem, false, false); cntMarker += Bensalem.length; map.addOverlays(Fairless_Hills); centerByArray(Fairless_Hills, false, false); cntMarker += Fairless_Hills.length; map.addOverlays(Holland); centerByArray(Holland, false, false); cntMarker += Holland.length; map.addOverlays(Langhorne); centerByArray(Langhorne, false, false); cntMarker += Langhorne.length; map.addOverlays(Levittown); centerByArray(Levittown, false, false); cntMarker += Levittown.length; map.addOverlays(New_Hope); centerByArray(New_Hope, false, false); cntMarker += New_Hope.length; map.addOverlays(Newtown); centerByArray(Newtown, false, false); cntMarker += Newtown.length; map.addOverlays(Ottsville); centerByArray(Ottsville, false, false); cntMarker += Ottsville.length; map.addOverlays(Plumsteadville); centerByArray(Plumsteadville, false, false); cntMarker += Plumsteadville.length; map.addOverlays(Quakertown); centerByArray(Quakertown, false, false); cntMarker += Quakertown.length; map.addOverlays(Sellersville); centerByArray(Sellersville, false, false); cntMarker += Sellersville.length; map.addOverlays(Southampton); centerByArray(Southampton, false, false); cntMarker += Southampton.length; map.addOverlays(Tullytown); centerByArray(Tullytown, false, false); cntMarker += Tullytown.length; map.addOverlays(Warminster); centerByArray(Warminster, false, false); cntMarker += Warminster.length; map.addOverlays(Yardley); centerByArray(Yardley, false, false); cntMarker += Yardley.length; centerByArray(Warminster,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; }