function addMarkers(){ mySelect = document.getElementById('selection'); Cape_May_Court_House = [];North_Wildwood = [];Cape_May = [];Wildwood = [];Ocean_City = [];Villas = [];Marmora = [];mySelect.options[mySelect.options.length] = new Option("Cape May schools",'all=Cape_May'); mySelect.options[mySelect.options.length] = new Option("Cape May Court House schools",'all=Cape_May_Court_House'); mySelect.options[mySelect.options.length] = new Option("Marmora schools",'all=Marmora'); mySelect.options[mySelect.options.length] = new Option("North Wildwood schools",'all=North_Wildwood'); mySelect.options[mySelect.options.length] = new Option("Ocean City schools",'all=Ocean_City'); mySelect.options[mySelect.options.length] = new Option("Villas schools",'all=Villas'); mySelect.options[mySelect.options.length] = new Option("Wildwood schools",'all=Wildwood'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.74919300,39.16222400),"
Bishop Mchugh Regional Catholic
2221 N Route 9
Cape May Court House, NJ 08210
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Mchugh Regional Catholic",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.84245500,39.05586600),"
Cape Christian Academy
10 Oyster Road
Cape May Court House, NJ 08210
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cape Christian Academy",'Cape_May_Court_House=' + Cape_May_Court_House.length); North_Wildwood[North_Wildwood.length] = createMarker(new GPoint(-74.80438200,38.99848900),"
Central Bible Academy
123 E 18th Avenue
North Wildwood, NJ 08260
Co-ed school, 4-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Bible Academy",'North_Wildwood=' + North_Wildwood.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.83068400,39.06991400),"
Lillian Whitfield S D A School
3 West 4th Ave
Cape May Court House, NJ 08210
Co-ed school, KG-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lillian Whitfield S D A School",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.92275300,38.93385200),"
Our Lady Star Of Sea School
520 Lafayette Street
Cape May, NJ 08204
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Star Of Sea School",'Cape_May=' + Cape_May.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-74.81173600,38.99311500),"
St. Ann Regional School
2901 New Jersey Avenue
Wildwood, NJ 08260
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Ann Regional School",'Wildwood=' + Wildwood.length); Ocean_City[Ocean_City.length] = createMarker(new GPoint(-74.58252700,39.27406800),"
St. Augustine Regional School
1337 Asbury Avenue
Ocean City, NJ 08226
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Augustine Regional School",'Ocean_City=' + Ocean_City.length); Villas[Villas.length] = createMarker(new GPoint(-74.93411900,39.03205700),"
St. Raymond Regional School
25 E Ocean Avenue
Villas, NJ 08251
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Raymond Regional School",'Villas=' + Villas.length); Marmora[Marmora.length] = createMarker(new GPoint(-74.65320000,39.26490000),"
Tomorrow's World Early Educati
261 Tuckahoe Rd P.o. Box 614
Marmora, NJ 08223
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tomorrow's World Early Educati",'Marmora=' + Marmora.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/////1/' + showArray); map.removeOverlays(Cape_May); map.removeOverlays(Cape_May_Court_House); map.removeOverlays(Marmora); map.removeOverlays(North_Wildwood); map.removeOverlays(Ocean_City); map.removeOverlays(Villas); map.removeOverlays(Wildwood); 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(Cape_May_Court_House);map.removeOverlays(Cape_May); map.removeOverlays(Cape_May_Court_House); map.removeOverlays(Marmora); map.removeOverlays(North_Wildwood); map.removeOverlays(Ocean_City); map.removeOverlays(Villas); map.removeOverlays(Wildwood); map.addOverlays(Cape_May); centerByArray(Cape_May, false, false); cntMarker += Cape_May.length; map.addOverlays(Cape_May_Court_House); centerByArray(Cape_May_Court_House, false, false); cntMarker += Cape_May_Court_House.length; map.addOverlays(Marmora); centerByArray(Marmora, false, false); cntMarker += Marmora.length; map.addOverlays(North_Wildwood); centerByArray(North_Wildwood, false, false); cntMarker += North_Wildwood.length; map.addOverlays(Ocean_City); centerByArray(Ocean_City, false, false); cntMarker += Ocean_City.length; map.addOverlays(Villas); centerByArray(Villas, false, false); cntMarker += Villas.length; map.addOverlays(Wildwood); centerByArray(Wildwood, false, false); cntMarker += Wildwood.length; centerByArray(Cape_May_Court_House,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=1&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; }