function addMarkers(){ mySelect = document.getElementById('selection'); Downingtown = [];Glenmoore = [];Exton = [];Westtown = [];Malvern = [];Paoli = [];Devon = [];Honey_Brook = [];West_Chester = [];Kimberton = [];Coatesville = [];Chester_Springs = [];Berwyn = [];Kennett_Square = [];Pottstown = [];Strafford = [];mySelect.options[mySelect.options.length] = new Option("Berwyn schools",'all=Berwyn'); mySelect.options[mySelect.options.length] = new Option("Chester Springs schools",'all=Chester_Springs'); mySelect.options[mySelect.options.length] = new Option("Coatesville schools",'all=Coatesville'); mySelect.options[mySelect.options.length] = new Option("Devon schools",'all=Devon'); mySelect.options[mySelect.options.length] = new Option("Downingtown schools",'all=Downingtown'); mySelect.options[mySelect.options.length] = new Option("Exton schools",'all=Exton'); mySelect.options[mySelect.options.length] = new Option("Glenmoore schools",'all=Glenmoore'); mySelect.options[mySelect.options.length] = new Option("Honey Brook schools",'all=Honey_Brook'); mySelect.options[mySelect.options.length] = new Option("Kennett Square schools",'all=Kennett_Square'); mySelect.options[mySelect.options.length] = new Option("Kimberton schools",'all=Kimberton'); mySelect.options[mySelect.options.length] = new Option("Malvern schools",'all=Malvern'); mySelect.options[mySelect.options.length] = new Option("Paoli schools",'all=Paoli'); mySelect.options[mySelect.options.length] = new Option("Pottstown schools",'all=Pottstown'); mySelect.options[mySelect.options.length] = new Option("Strafford schools",'all=Strafford'); mySelect.options[mySelect.options.length] = new Option("West Chester schools",'all=West_Chester'); mySelect.options[mySelect.options.length] = new Option("Westtown schools",'all=Westtown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Downingtown[Downingtown.length] = createMarker(new GPoint(-75.68563900,40.01007900),"
Bishop Shananan High School
220 Woodbine Rd
Downingtown, PA 19335
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Shananan High School",'Downingtown=' + Downingtown.length); Glenmoore[Glenmoore.length] = createMarker(new GPoint(-75.70939600,40.13744100),"
Camphill Special Schools Inc
1784 Fairview Road
Glenmoore, PA 19343
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camphill Special Schools Inc",'Glenmoore=' + Glenmoore.length); Exton[Exton.length] = createMarker(new GPoint(-75.59486900,40.03192800),"
CFS, The School At Church Farm
1001 East Lincoln Highway
Exton, PA 19341
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("CFS, The School At Church Farm",'Exton=' + Exton.length); Westtown[Westtown.length] = createMarker(new GPoint(-75.51049900,39.95044000),"
The Concept School
1120 E. Street Rd
Westtown, PA 19395
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Concept School",'Westtown=' + Westtown.length); Malvern[Malvern.length] = createMarker(new GPoint(-75.49476600,40.07256600),"
The Crossroads School
1681 N Valley Road
Malvern, PA 19355
Co-ed school, KG-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Crossroads School",'Malvern=' + Malvern.length); Paoli[Paoli.length] = createMarker(new GPoint(-75.48191300,40.04458500),"
Delaware Valley Friends School
19 E Central Ave
Paoli, PA 19301
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Delaware Valley Friends School",'Paoli=' + Paoli.length); Downingtown[Downingtown.length] = createMarker(new GPoint(-75.68369000,40.00385700),"
Devereux Day School
600 Boot Road
Downingtown, PA 19335
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Devereux Day School",'Downingtown=' + Downingtown.length); Malvern[Malvern.length] = createMarker(new GPoint(-75.51428500,40.00815000),"
Devereux Mapleton High School
655 Sugartown Rd Box 297
Malvern, PA 19355
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Devereux Mapleton High School",'Malvern=' + Malvern.length); Devon[Devon.length] = createMarker(new GPoint(-75.42368600,40.05386500),"
Devon Preparatory School
363 N. Valley Forge Road
Devon, PA 19333
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Devon Preparatory School",'Devon=' + Devon.length); Honey_Brook[Honey_Brook.length] = createMarker(new GPoint(-75.88150000,40.07780000),"
Gateway Baptist Academy
Po Box 339
Honey Brook, PA 19344
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway Baptist Academy",'Honey_Brook=' + Honey_Brook.length); Honey_Brook[Honey_Brook.length] = createMarker(new GPoint(-75.90578600,40.11175300),"
Honeybrook Mennonite School
733 Welsh Road
Honey Brook, PA 19344
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Honeybrook Mennonite School",'Honey_Brook=' + Honey_Brook.length); West_Chester[West_Chester.length] = createMarker(new GPoint(-75.60549100,40.00986200),"
Kanner Learning Center
390 E Boot Rd
West Chester, PA 19380
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kanner Learning Center",'West_Chester=' + West_Chester.length); Kimberton[Kimberton.length] = createMarker(new GPoint(-75.57622900,40.12964600),"
Kimberton Waldorf School
P O Box 350
Kimberton, PA 19442
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kimberton Waldorf School",'Kimberton=' + Kimberton.length); Coatesville[Coatesville.length] = createMarker(new GPoint(-75.86823900,39.98451500),"
Lan-chester Christian School
200 Airport Road
Coatesville, PA 19320
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lan-chester Christian School",'Coatesville=' + Coatesville.length); Downingtown[Downingtown.length] = createMarker(new GPoint(-75.70816900,40.00552300),"
Landmark Christian School
40 W Pennsylvania Avenue
Downingtown, PA 19335
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Landmark Christian School",'Downingtown=' + Downingtown.length); Malvern[Malvern.length] = createMarker(new GPoint(-75.50950800,40.02888100),"
Malvern Preparatory School
418 S Warren Avenue
Malvern, PA 19355
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Malvern Preparatory School",'Malvern=' + Malvern.length); Chester_Springs[Chester_Springs.length] = createMarker(new GPoint(-75.62657800,40.09000400),"
Montgomery School
1141 Kimberton Road
Chester Springs, PA 19425
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montgomery School",'Chester_Springs=' + Chester_Springs.length); Malvern[Malvern.length] = createMarker(new GPoint(-75.52170600,40.02320800),"
The Phelps School
583 Sugartown Road
Malvern, PA 19355
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("The Phelps School",'Malvern=' + Malvern.length); Paoli[Paoli.length] = createMarker(new GPoint(-75.48250000,40.04230000),"
Royer-greaves School For Blind
Po Box 1007
Paoli, PA 19301
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Royer-greaves School For Blind",'Paoli=' + Paoli.length); Berwyn[Berwyn.length] = createMarker(new GPoint(-75.45134200,40.04564700),"
Timothy School
973 Old Lancaster Road
Berwyn, PA 19312
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Timothy School",'Berwyn=' + Berwyn.length); Glenmoore[Glenmoore.length] = createMarker(new GPoint(-75.72540000,40.10056100),"
Upattinas School
429 Greenridge Road
Glenmoore, PA 19343
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upattinas School",'Glenmoore=' + Glenmoore.length); Kennett_Square[Kennett_Square.length] = createMarker(new GPoint(-75.76248000,39.86960400),"
Upland Country Day School
420 W Street Road
Kennett Square, PA 19348
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upland Country Day School",'Kennett_Square=' + Kennett_Square.length); Paoli[Paoli.length] = createMarker(new GPoint(-75.48250000,40.04230000),"
Vanguard School
Po Box 730
Paoli, PA 19301
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vanguard School",'Paoli=' + Paoli.length); Malvern[Malvern.length] = createMarker(new GPoint(-75.50966500,40.03936300),"
Villa Maria Academy High School
370 Old Lincoln Highway
Malvern, PA 19355
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Villa Maria Academy High School",'Malvern=' + Malvern.length); Coatesville[Coatesville.length] = createMarker(new GPoint(-75.73219800,39.94843100),"
Vtston Quga
1822 Strasburg Rd bldg 1
Coatesville, PA 19320
All-boys school, Ungraded
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Vtston Quga",'Coatesville=' + Coatesville.length); West_Chester[West_Chester.length] = createMarker(new GPoint(-75.57078900,39.98063100),"
West Chester Christian School
1237 Paoli Pike
West Chester, PA 19380
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Chester Christian School",'West_Chester=' + West_Chester.length); Pottstown[Pottstown.length] = createMarker(new GPoint(-75.65490100,40.23067900),"
West-Mont Christian Academy
873 S Hanover Street
Pottstown, PA 19465
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West-Mont Christian Academy",'Pottstown=' + Pottstown.length); West_Chester[West_Chester.length] = createMarker(new GPoint(-75.54397300,39.94937700),"
Westtown School
975 Westtown Road
West Chester, PA 19382
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westtown School",'West_Chester=' + West_Chester.length); Strafford[Strafford.length] = createMarker(new GPoint(-75.40720500,40.05550100),"
Woodlynde School
445 Upper Gulph Road
Strafford, PA 19087
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodlynde School",'Strafford=' + Strafford.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(Berwyn); map.removeOverlays(Chester_Springs); map.removeOverlays(Coatesville); map.removeOverlays(Devon); map.removeOverlays(Downingtown); map.removeOverlays(Exton); map.removeOverlays(Glenmoore); map.removeOverlays(Honey_Brook); map.removeOverlays(Kennett_Square); map.removeOverlays(Kimberton); map.removeOverlays(Malvern); map.removeOverlays(Paoli); map.removeOverlays(Pottstown); map.removeOverlays(Strafford); map.removeOverlays(West_Chester); map.removeOverlays(Westtown); 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(Downingtown);map.removeOverlays(Berwyn); map.removeOverlays(Chester_Springs); map.removeOverlays(Coatesville); map.removeOverlays(Devon); map.removeOverlays(Downingtown); map.removeOverlays(Exton); map.removeOverlays(Glenmoore); map.removeOverlays(Honey_Brook); map.removeOverlays(Kennett_Square); map.removeOverlays(Kimberton); map.removeOverlays(Malvern); map.removeOverlays(Paoli); map.removeOverlays(Pottstown); map.removeOverlays(Strafford); map.removeOverlays(West_Chester); map.removeOverlays(Westtown); map.addOverlays(Berwyn); centerByArray(Berwyn, false, false); cntMarker += Berwyn.length; map.addOverlays(Chester_Springs); centerByArray(Chester_Springs, false, false); cntMarker += Chester_Springs.length; map.addOverlays(Coatesville); centerByArray(Coatesville, false, false); cntMarker += Coatesville.length; map.addOverlays(Devon); centerByArray(Devon, false, false); cntMarker += Devon.length; map.addOverlays(Downingtown); centerByArray(Downingtown, false, false); cntMarker += Downingtown.length; map.addOverlays(Exton); centerByArray(Exton, false, false); cntMarker += Exton.length; map.addOverlays(Glenmoore); centerByArray(Glenmoore, false, false); cntMarker += Glenmoore.length; map.addOverlays(Honey_Brook); centerByArray(Honey_Brook, false, false); cntMarker += Honey_Brook.length; map.addOverlays(Kennett_Square); centerByArray(Kennett_Square, false, false); cntMarker += Kennett_Square.length; map.addOverlays(Kimberton); centerByArray(Kimberton, false, false); cntMarker += Kimberton.length; map.addOverlays(Malvern); centerByArray(Malvern, false, false); cntMarker += Malvern.length; map.addOverlays(Paoli); centerByArray(Paoli, false, false); cntMarker += Paoli.length; map.addOverlays(Pottstown); centerByArray(Pottstown, false, false); cntMarker += Pottstown.length; map.addOverlays(Strafford); centerByArray(Strafford, false, false); cntMarker += Strafford.length; map.addOverlays(West_Chester); centerByArray(West_Chester, false, false); cntMarker += West_Chester.length; map.addOverlays(Westtown); centerByArray(Westtown, false, false); cntMarker += Westtown.length; centerByArray(Downingtown,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; }