function addMarkers(){ mySelect = document.getElementById('selection'); Atco = [];Haddonfield = [];Haddon_Heights = [];Pennsauken = [];Cherry_Hill = [];Gloucester_City = [];Camden = [];Mount_Ephraim = [];Bellmawr = [];mySelect.options[mySelect.options.length] = new Option("Atco schools",'all=Atco'); mySelect.options[mySelect.options.length] = new Option("Bellmawr schools",'all=Bellmawr'); mySelect.options[mySelect.options.length] = new Option("Camden schools",'all=Camden'); mySelect.options[mySelect.options.length] = new Option("Cherry Hill schools",'all=Cherry_Hill'); mySelect.options[mySelect.options.length] = new Option("Gloucester City schools",'all=Gloucester_City'); mySelect.options[mySelect.options.length] = new Option("Haddon Heights schools",'all=Haddon_Heights'); mySelect.options[mySelect.options.length] = new Option("Haddonfield schools",'all=Haddonfield'); mySelect.options[mySelect.options.length] = new Option("Mount Ephraim schools",'all=Mount_Ephraim'); mySelect.options[mySelect.options.length] = new Option("Pennsauken schools",'all=Pennsauken'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Atco[Atco.length] = createMarker(new GPoint(-74.87700000,39.76470000),"
Archway Lower School
Po Box 668 280 Jackson Rd
Atco, NJ 08004
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Archway Lower School",'Atco=' + Atco.length); Atco[Atco.length] = createMarker(new GPoint(-74.89192400,39.78152100),"
The Archway Schools
280 Jackson Rd
Atco, NJ 08004
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Archway Schools",'Atco=' + Atco.length); Haddonfield[Haddonfield.length] = createMarker(new GPoint(-75.02934000,39.90510000),"
Bancroft School
Po Box 20
Haddonfield, NJ 08033
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bancroft School",'Haddonfield=' + Haddonfield.length); Haddon_Heights[Haddon_Heights.length] = createMarker(new GPoint(-75.05450000,39.88490000),"
Baptist Regional School
3rd Station Avenue
Haddon Heights, NJ 08035
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Baptist Regional School",'Haddon_Heights=' + Haddon_Heights.length); Pennsauken[Pennsauken.length] = createMarker(new GPoint(-75.06885400,39.93427500),"
Bishop Eustace Preparatory School
5552 Route 70
Pennsauken, NJ 08109
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Eustace Preparatory School",'Pennsauken=' + Pennsauken.length); Cherry_Hill[Cherry_Hill.length] = createMarker(new GPoint(-75.01409600,39.88498600),"
Brookfield Schools
1009 Haddonfield Berlin Road
Cherry Hill, NJ 08034
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brookfield Schools",'Cherry_Hill=' + Cherry_Hill.length); Cherry_Hill[Cherry_Hill.length] = createMarker(new GPoint(-75.02390000,39.93130000),"
Camden Catholic High School Cherry Hill
300 Cuthbert Road
Cherry Hill, NJ 08002
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camden Catholic High School Cherry Hill",'Cherry_Hill=' + Cherry_Hill.length); Cherry_Hill[Cherry_Hill.length] = createMarker(new GPoint(-75.01368000,39.93661000),"
Delaware Valley Torah Institute
31 Maple Avenue
Cherry Hill, NJ 08002
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Delaware Valley Torah Institute",'Cherry_Hill=' + Cherry_Hill.length); Gloucester_City[Gloucester_City.length] = createMarker(new GPoint(-75.12456300,39.89634700),"
Gloucester Catholic High School
333 Ridgeway Street
Gloucester City, NJ 08030
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gloucester Catholic High School",'Gloucester_City=' + Gloucester_City.length); Pennsauken[Pennsauken.length] = createMarker(new GPoint(-75.08286300,39.93573300),"
Jdt Christian Academy
3600 Earle Street
Pennsauken, NJ 08110
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jdt Christian Academy",'Pennsauken=' + Pennsauken.length); Camden[Camden.length] = createMarker(new GPoint(-75.12305700,39.94746000),"
Jrc Alternative School
315 Cooper Street
Camden, NJ 08102
Co-ed school, 10-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jrc Alternative School",'Camden=' + Camden.length); Mount_Ephraim[Mount_Ephraim.length] = createMarker(new GPoint(-75.08679700,39.88218700),"
The Kings Christian High School
12 West Buckingham Avenue
Mount Ephraim, NJ 08059
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Kings Christian High School",'Mount_Ephraim=' + Mount_Ephraim.length); Cherry_Hill[Cherry_Hill.length] = createMarker(new GPoint(-74.96475800,39.91434500),"
The Kings Christian School
5 Carnegie Plaza
Cherry Hill, NJ 08003
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Kings Christian School",'Cherry_Hill=' + Cherry_Hill.length); Haddonfield[Haddonfield.length] = createMarker(new GPoint(-75.03227200,39.89791300),"
Kingsway Learning Center
144 Kings Highway West
Haddonfield, NJ 08033
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kingsway Learning Center",'Haddonfield=' + Haddonfield.length); Bellmawr[Bellmawr.length] = createMarker(new GPoint(-75.11803700,39.87106500),"
Larc School
1089 Creek Road
Bellmawr, NJ 08031
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Larc School",'Bellmawr=' + Bellmawr.length); Cherry_Hill[Cherry_Hill.length] = createMarker(new GPoint(-75.01745600,39.91195000),"
Living Faith Christian Academy
202 Park Boulevard
Cherry Hill, NJ 08002
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Living Faith Christian Academy",'Cherry_Hill=' + Cherry_Hill.length); Haddonfield[Haddonfield.length] = createMarker(new GPoint(-75.06233700,39.89749700),"
Paul Vi High School
901 Hopkins Road Ste B
Haddonfield, NJ 08033
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paul Vi High School",'Haddonfield=' + Haddonfield.length); Camden[Camden.length] = createMarker(new GPoint(-75.07202500,39.94856400),"
Urban Promise Academy
Po Box 1479
Camden, NJ 08105
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Urban Promise Academy",'Camden=' + Camden.length); Pennsauken[Pennsauken.length] = createMarker(new GPoint(-75.04774300,39.96889200),"
World Harvest Christian Academy
7201 Westfield Avenue
Pennsauken, NJ 08110
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("World Harvest Christian Academy",'Pennsauken=' + Pennsauken.length); Cherry_Hill[Cherry_Hill.length] = createMarker(new GPoint(-75.02429100,39.94556900),"
Y A L E
2127 Church Road
Cherry Hill, NJ 08002
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Y A L E",'Cherry_Hill=' + Cherry_Hill.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(Atco); map.removeOverlays(Bellmawr); map.removeOverlays(Camden); map.removeOverlays(Cherry_Hill); map.removeOverlays(Gloucester_City); map.removeOverlays(Haddon_Heights); map.removeOverlays(Haddonfield); map.removeOverlays(Mount_Ephraim); map.removeOverlays(Pennsauken); 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(Atco);map.removeOverlays(Atco); map.removeOverlays(Bellmawr); map.removeOverlays(Camden); map.removeOverlays(Cherry_Hill); map.removeOverlays(Gloucester_City); map.removeOverlays(Haddon_Heights); map.removeOverlays(Haddonfield); map.removeOverlays(Mount_Ephraim); map.removeOverlays(Pennsauken); map.addOverlays(Atco); centerByArray(Atco, false, false); cntMarker += Atco.length; map.addOverlays(Bellmawr); centerByArray(Bellmawr, false, false); cntMarker += Bellmawr.length; map.addOverlays(Camden); centerByArray(Camden, false, false); cntMarker += Camden.length; map.addOverlays(Cherry_Hill); centerByArray(Cherry_Hill, false, false); cntMarker += Cherry_Hill.length; map.addOverlays(Gloucester_City); centerByArray(Gloucester_City, false, false); cntMarker += Gloucester_City.length; map.addOverlays(Haddon_Heights); centerByArray(Haddon_Heights, false, false); cntMarker += Haddon_Heights.length; map.addOverlays(Haddonfield); centerByArray(Haddonfield, false, false); cntMarker += Haddonfield.length; map.addOverlays(Mount_Ephraim); centerByArray(Mount_Ephraim, false, false); cntMarker += Mount_Ephraim.length; map.addOverlays(Pennsauken); centerByArray(Pennsauken, false, false); cntMarker += Pennsauken.length; centerByArray(Atco,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; }