function addMarkers() { mySelect = document.getElementById('selection'); Cape_May_Court_House = [];Avalon = [];Cape_May = [];Wildwood_Crest = [];Dennisville = [];Wildwood = [];Ocean_City = [];N_Wildwood = [];Villas = [];Sea_Isle_City = [];Stone_Harbor = [];Marmora = [];Petersburg = [];West_Cape_May = [];Woodbine = [];mySelect.options[mySelect.options.length] = new Option("Avalon schools",'all=Avalon'); 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("Dennisville schools",'all=Dennisville'); mySelect.options[mySelect.options.length] = new Option("Marmora schools",'all=Marmora'); mySelect.options[mySelect.options.length] = new Option("N Wildwood schools",'all=N_Wildwood'); mySelect.options[mySelect.options.length] = new Option("Ocean City schools",'all=Ocean_City'); mySelect.options[mySelect.options.length] = new Option("Petersburg schools",'all=Petersburg'); mySelect.options[mySelect.options.length] = new Option("Sea Isle City schools",'all=Sea_Isle_City'); mySelect.options[mySelect.options.length] = new Option("Stone Harbor schools",'all=Stone_Harbor'); mySelect.options[mySelect.options.length] = new Option("Villas schools",'all=Villas'); mySelect.options[mySelect.options.length] = new Option("West Cape May schools",'all=West_Cape_May'); mySelect.options[mySelect.options.length] = new Option("Wildwood schools",'all=Wildwood'); mySelect.options[mySelect.options.length] = new Option("Wildwood Crest schools",'all=Wildwood_Crest'); mySelect.options[mySelect.options.length] = new Option("Woodbine schools",'all=Woodbine'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.79660034,39.10153580),"
Alternative School
148 Crest Haven Road
Cape May Court House, NJ 08210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative School",'Cape_May_Court_House=' + Cape_May_Court_House.length); Avalon[Avalon.length] = createMarker(new GPoint(-74.72599792,39.09569931),"
Avalon Elementary School
235 32nd Street
Avalon, NJ 08202

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Avalon Elementary School",'Avalon=' + Avalon.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.91861725,38.93870163),"
Cape May City Elementary School
921 Lafayette St
Cape May, NJ 08204

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cape May City Elementary School",'Cape_May=' + Cape_May.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.79653168,39.10550308),"
Cape May Co Technical High School
188 Crest Haven Rd.
Cape May Court House, NJ 08210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cape May Co Technical High School",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.92172241,38.96872330),"
Carl T. Mitnick School
905 Seashore Road
Cape May, NJ 08204

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carl T. Mitnick School",'Cape_May=' + Cape_May.length); Wildwood_Crest[Wildwood_Crest.length] = createMarker(new GPoint(-74.84913635,38.96342087),"
Crest Memorial Elementary School
9100 Pacific Ave
Wildwood Crest, NJ 08260

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crest Memorial Elementary School",'Wildwood_Crest=' + Wildwood_Crest.length); Dennisville[Dennisville.length] = createMarker(new GPoint(-74.82550049,39.19300079),"
Dennis Township Elementary School
P.o. Box 363
Dennisville, NJ 08214

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dennis Township Elementary School",'Dennisville=' + Dennisville.length); Dennisville[Dennisville.length] = createMarker(new GPoint(-74.82903400,39.19341000),"
Dennis Twp Middle School
Po Box 363
Dennisville, NJ 08214

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dennis Twp Middle School",'Dennisville=' + Dennisville.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-74.82160187,38.98780060),"
Glenwood Ave Elementary School
Glenwood New York Ave
Wildwood, NJ 08260

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glenwood Ave Elementary School",'Wildwood=' + Wildwood.length); Ocean_City[Ocean_City.length] = createMarker(new GPoint(-74.59519958,39.26459885),"
Intermediate Middle School
19th Bay Ave
Ocean City, NJ 08226

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Intermediate Middle School",'Ocean_City=' + Ocean_City.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.92500305,38.96720123),"
Lower Cape May Regional High School
687 Rt 9
Cape May, NJ 08204

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lower Cape May Regional High School",'Cape_May=' + Cape_May.length); N_Wildwood[N_Wildwood.length] = createMarker(new GPoint(-74.79797363,38.99963760),"
Margaret Mace Elementary School
1201 Atlantic Ave
N Wildwood, NJ 08260

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Margaret Mace Elementary School",'N_Wildwood=' + N_Wildwood.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.92262268,38.97290802),"
Maud Abrams School
714 Town Bank Rd
Cape May, NJ 08204

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maud Abrams School",'Cape_May=' + Cape_May.length); Villas[Villas.length] = createMarker(new GPoint(-74.93907928,39.00923920),"
Memorial School
2600 Bayshore Rd
Villas, NJ 08251

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Memorial School",'Villas=' + Villas.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.82379150,39.08240891),"
Middle School
George E. Bailey Middle School
Cape May Court House, NJ 08210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Middle School",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.82335663,39.07925034),"
Middle Township Elementary 1
215 Eldredge Road
Cape May Court House, NJ 08210

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Middle Township Elementary 1",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.83077240,39.07876205),"
Middle Township Elementary 2
101 West Pacific Ave
Cape May Court House, NJ 08210

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Middle Township Elementary 2",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.82218933,39.07460785),"
Middle Township Elementary No 4
300 E Pacific Ave
Cape May Court House, NJ 08210

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Middle Township Elementary No 4",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.81795502,39.07725525),"
Middle Township High School
300 East Atlantic Avenue
Cape May Court House, NJ 08210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Middle Township High School",'Cape_May_Court_House=' + Cape_May_Court_House.length); Cape_May_Court_House[Cape_May_Court_House.length] = createMarker(new GPoint(-74.79660034,39.10153580),"
Ocean Academy
148 Crest Haven Road
Cape May Court House, NJ 08210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ocean Academy",'Cape_May_Court_House=' + Cape_May_Court_House.length); Ocean_City[Ocean_City.length] = createMarker(new GPoint(-74.59519958,39.26459885),"
Ocean City High School
501 Atlantic Avenue
Ocean City, NJ 08226

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ocean City High School",'Ocean_City=' + Ocean_City.length); Ocean_City[Ocean_City.length] = createMarker(new GPoint(-74.59519958,39.26459885),"
Primary Elementary School
550 West Avenue
Ocean City, NJ 08226

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Primary Elementary School",'Ocean_City=' + Ocean_City.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.92500305,38.96720123),"
Richard M Teitelman School
687 Rt 9
Cape May, NJ 08204

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Richard M Teitelman School",'Cape_May=' + Cape_May.length); Cape_May[Cape_May.length] = createMarker(new GPoint(-74.91965485,38.97124100),"
Sandman Consolidated Middle School
838 Seashore Rd
Cape May, NJ 08204

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sandman Consolidated Middle School",'Cape_May=' + Cape_May.length); Sea_Isle_City[Sea_Isle_City.length] = createMarker(new GPoint(-74.69705200,39.15430069),"
Sea Isle Elementary School
4501 Park Avenue
Sea Isle City, NJ 08243

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sea Isle Elementary School",'Sea_Isle_City=' + Sea_Isle_City.length); Stone_Harbor[Stone_Harbor.length] = createMarker(new GPoint(-74.75858307,39.05637360),"
Stone Harbor Elementary School
275 93rd St.
Stone Harbor, NJ 08247

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stone Harbor Elementary School",'Stone_Harbor=' + Stone_Harbor.length); Marmora[Marmora.length] = createMarker(new GPoint(-74.65125275,39.26350021),"
Upper Township Elementary School
50 Tuckahoe Rd.
Marmora, NJ 08223

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Upper Township Elementary School",'Marmora=' + Marmora.length); Petersburg[Petersburg.length] = createMarker(new GPoint(-74.73303223,39.26127625),"
Upper Township Middle School
525 Perry Rd.
Petersburg, NJ 08270

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Upper Township Middle School",'Petersburg=' + Petersburg.length); Marmora[Marmora.length] = createMarker(new GPoint(-74.64389801,39.26947403),"
Upper Tw Primary School
130 Old Tuckahoe Rd.
Marmora, NJ 08223

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Upper Tw Primary School",'Marmora=' + Marmora.length); West_Cape_May[West_Cape_May.length] = createMarker(new GPoint(-74.93301392,38.94010162),"
West Cape May Elementary School
301 Moore St
West Cape May, NJ 08204

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Cape May Elementary School",'West_Cape_May=' + West_Cape_May.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-74.81903076,38.98567581),"
Wildwood High School
4300 Pacific Ave
Wildwood, NJ 08260

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wildwood High School",'Wildwood=' + Wildwood.length); Wildwood[Wildwood.length] = createMarker(new GPoint(-74.82166900,38.98627500),"
Wildwood Middle School
4300 Pacific Ave.
Wildwood, NJ 08260

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wildwood Middle School",'Wildwood=' + Wildwood.length); Woodbine[Woodbine.length] = createMarker(new GPoint(-74.81652832,39.23530579),"
Woodbine Elementary School
801 Webster Ave
Woodbine, NJ 08270

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodbine Elementary School",'Woodbine=' + Woodbine.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,10); /* 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////' + showArray); map.removeOverlays(Avalon); map.removeOverlays(Cape_May); map.removeOverlays(Cape_May_Court_House); map.removeOverlays(Dennisville); map.removeOverlays(Marmora); map.removeOverlays(N_Wildwood); map.removeOverlays(Ocean_City); map.removeOverlays(Petersburg); map.removeOverlays(Sea_Isle_City); map.removeOverlays(Stone_Harbor); map.removeOverlays(Villas); map.removeOverlays(West_Cape_May); map.removeOverlays(Wildwood); map.removeOverlays(Wildwood_Crest); map.removeOverlays(Woodbine); 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(Avalon); map.removeOverlays(Cape_May); map.removeOverlays(Cape_May_Court_House); map.removeOverlays(Dennisville); map.removeOverlays(Marmora); map.removeOverlays(N_Wildwood); map.removeOverlays(Ocean_City); map.removeOverlays(Petersburg); map.removeOverlays(Sea_Isle_City); map.removeOverlays(Stone_Harbor); map.removeOverlays(Villas); map.removeOverlays(West_Cape_May); map.removeOverlays(Wildwood); map.removeOverlays(Wildwood_Crest); map.removeOverlays(Woodbine); map.addOverlays(Avalon); centerByArray(Avalon, false, false); cntMarker += Avalon.length; 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(Dennisville); centerByArray(Dennisville, false, false); cntMarker += Dennisville.length; map.addOverlays(Marmora); centerByArray(Marmora, false, false); cntMarker += Marmora.length; map.addOverlays(N_Wildwood); centerByArray(N_Wildwood, false, false); cntMarker += N_Wildwood.length; map.addOverlays(Ocean_City); centerByArray(Ocean_City, false, false); cntMarker += Ocean_City.length; map.addOverlays(Petersburg); centerByArray(Petersburg, false, false); cntMarker += Petersburg.length; map.addOverlays(Sea_Isle_City); centerByArray(Sea_Isle_City, false, false); cntMarker += Sea_Isle_City.length; map.addOverlays(Stone_Harbor); centerByArray(Stone_Harbor, false, false); cntMarker += Stone_Harbor.length; map.addOverlays(Villas); centerByArray(Villas, false, false); cntMarker += Villas.length; map.addOverlays(West_Cape_May); centerByArray(West_Cape_May, false, false); cntMarker += West_Cape_May.length; map.addOverlays(Wildwood); centerByArray(Wildwood, false, false); cntMarker += Wildwood.length; map.addOverlays(Wildwood_Crest); centerByArray(Wildwood_Crest, false, false); cntMarker += Wildwood_Crest.length; map.addOverlays(Woodbine); centerByArray(Woodbine, false, false); cntMarker += Woodbine.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'); } }