function addMarkers() { mySelect = document.getElementById('selection'); Alloway = [];Pittsgrove = [];Woodstown = [];Pennsville = [];Elmer = [];Salem = [];Carneys_Point = [];Norma = [];Pedricktown = [];Penns_Grove = [];Quinton = [];Monroeville = [];mySelect.options[mySelect.options.length] = new Option("Alloway schools",'all=Alloway'); mySelect.options[mySelect.options.length] = new Option("Carneys Point schools",'all=Carneys_Point'); mySelect.options[mySelect.options.length] = new Option("Elmer schools",'all=Elmer'); mySelect.options[mySelect.options.length] = new Option("Monroeville schools",'all=Monroeville'); mySelect.options[mySelect.options.length] = new Option("Norma schools",'all=Norma'); mySelect.options[mySelect.options.length] = new Option("Pedricktown schools",'all=Pedricktown'); mySelect.options[mySelect.options.length] = new Option("Penns Grove schools",'all=Penns_Grove'); mySelect.options[mySelect.options.length] = new Option("Pennsville schools",'all=Pennsville'); mySelect.options[mySelect.options.length] = new Option("Pittsgrove schools",'all=Pittsgrove'); mySelect.options[mySelect.options.length] = new Option("Quinton schools",'all=Quinton'); mySelect.options[mySelect.options.length] = new Option("Salem schools",'all=Salem'); mySelect.options[mySelect.options.length] = new Option("Woodstown schools",'all=Woodstown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Alloway[Alloway.length] = createMarker(new GPoint(-75.36428070,39.55960083),"
Alloway Township School
Cedar St
Alloway, NJ 08001

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alloway Township School",'Alloway=' + Alloway.length); Pittsgrove[Pittsgrove.length] = createMarker(new GPoint(-75.15779877,39.55270004),"
Arthur P Schalick High School
718-a Centerton Road
Pittsgrove, NJ 08318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arthur P Schalick High School",'Pittsgrove=' + Pittsgrove.length); Woodstown[Woodstown.length] = createMarker(new GPoint(-75.33070374,39.64440155),"
Arts Science & Technical High School
Box 350
Woodstown, NJ 08098

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arts Science & Technical High School",'Woodstown=' + Woodstown.length); Pennsville[Pennsville.length] = createMarker(new GPoint(-75.50798035,39.66197205),"
Central Park Elementary School
43 Oliver Ave.
Pennsville, NJ 08070

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Park Elementary School",'Pennsville=' + Pennsville.length); Elmer[Elmer.length] = createMarker(new GPoint(-75.25500488,39.60646820),"
Daretown School
404 Daretown Road
Elmer, NJ 08318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Daretown School",'Elmer=' + Elmer.length); Elmer[Elmer.length] = createMarker(new GPoint(-75.15779877,39.55270004),"
Elmer Elementary School
Front Street
Elmer, NJ 08318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elmer Elementary School",'Elmer=' + Elmer.length); Salem[Salem.length] = createMarker(new GPoint(-75.44219971,39.55530167),"
Elsinboro Township Elementary School
631 Salem-fort Elfsborg Road
Salem, NJ 08079

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elsinboro Township Elementary School",'Salem=' + Salem.length); Carneys_Point[Carneys_Point.length] = createMarker(new GPoint(-75.47002900,39.72990000),"
Field St
0144 Field Street
Carneys Point, NJ 08069

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Field St",'Carneys_Point=' + Carneys_Point.length); Salem[Salem.length] = createMarker(new GPoint(-75.46852112,39.56718063),"
John Fenwick Elementary School
183 Smith Street
Salem, NJ 08079

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John Fenwick Elementary School",'Salem=' + Salem.length); Carneys_Point[Carneys_Point.length] = createMarker(new GPoint(-75.47002900,39.72990000),"
Lafayette-pershing
0237 Shell Road
Carneys Point, NJ 08069

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lafayette-pershing",'Carneys_Point=' + Carneys_Point.length); Salem[Salem.length] = createMarker(new GPoint(-75.44219971,39.55530167),"
Lower Alloways Creek Elementary School
967 Main St Canton
Salem, NJ 08079

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lower Alloways Creek Elementary School",'Salem=' + Salem.length); Salem[Salem.length] = createMarker(new GPoint(-75.42329407,39.60064316),"
Mannington Elementary School
495 Route 45
Salem, NJ 08079

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mannington Elementary School",'Salem=' + Salem.length); Woodstown[Woodstown.length] = createMarker(new GPoint(-75.33070374,39.64440155),"
Mary S Shoemaker Elementary School
Mary S. Shoemaker School
Woodstown, NJ 08098

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary S Shoemaker Elementary School",'Woodstown=' + Woodstown.length); Woodstown[Woodstown.length] = createMarker(new GPoint(-75.33070374,39.64440155),"
N J Reg Day-mannington
Box 350
Woodstown, NJ 08098

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("N J Reg Day-mannington",'Woodstown=' + Woodstown.length); Norma[Norma.length] = createMarker(new GPoint(-75.08830261,39.49610138),"
Norma School
P.o. Box 279
Norma, NJ 08347

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Norma School",'Norma=' + Norma.length); Pedricktown[Pedricktown.length] = createMarker(new GPoint(-75.41159821,39.73820114),"
Oldmans Middle School
10 Freed Road
Pedricktown, NJ 08067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oldmans Middle School",'Pedricktown=' + Pedricktown.length); Pittsgrove[Pittsgrove.length] = createMarker(new GPoint(-75.15570068,39.54869080),"
Olivet School
235 Sheep Pen Road
Pittsgrove, NJ 08318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Olivet School",'Pittsgrove=' + Pittsgrove.length); Penns_Grove[Penns_Grove.length] = createMarker(new GPoint(-75.47002900,39.72990000),"
Paul W Carleton
6251 Maple Avenue
Penns Grove, NJ 08069

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Paul W Carleton",'Penns_Grove=' + Penns_Grove.length); Pedricktown[Pedricktown.length] = createMarker(new GPoint(-75.41159821,39.73820114),"
Pedricktown Elementary School
10 Freed Road
Pedricktown, NJ 08067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pedricktown Elementary School",'Pedricktown=' + Pedricktown.length); Pennsville[Pennsville.length] = createMarker(new GPoint(-75.52902985,39.64014053),"
Penn Beach Elementary School
96 Kansas Rd.
Pennsville, NJ 08070

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penn Beach Elementary School",'Pennsville=' + Pennsville.length); Carneys_Point[Carneys_Point.length] = createMarker(new GPoint(-75.47002900,39.72990000),"
Penns Grove High School
0334 Harding Highway
Carneys Point, NJ 08069

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Penns Grove High School",'Carneys_Point=' + Carneys_Point.length); Penns_Grove[Penns_Grove.length] = createMarker(new GPoint(-75.47002900,39.72990000),"
Penns Grove Middle School
6351 Maple Avenue
Penns Grove, NJ 08069

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Penns Grove Middle School",'Penns_Grove=' + Penns_Grove.length); Pennsville[Pennsville.length] = createMarker(new GPoint(-75.51992035,39.64984894),"
Pennsville Memorial High School
110 S. Broadway
Pennsville, NJ 08070

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pennsville Memorial High School",'Pennsville=' + Pennsville.length); Pennsville[Pennsville.length] = createMarker(new GPoint(-75.51467133,39.65227890),"
Pennsville Middle School
4 William Penn Avenue
Pennsville, NJ 08070

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pennsville Middle School",'Pennsville=' + Pennsville.length); Pittsgrove[Pittsgrove.length] = createMarker(new GPoint(-75.16224670,39.52466965),"
Pittsgrove Township Middle School
1082 Almond Road
Pittsgrove, NJ 08318

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pittsgrove Township Middle School",'Pittsgrove=' + Pittsgrove.length); Quinton[Quinton.length] = createMarker(new GPoint(-75.41310120,39.54679871),"
Quinton Township Elementary School
Po Box 365
Quinton, NJ 08072

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Quinton Township Elementary School",'Quinton=' + Quinton.length); Salem[Salem.length] = createMarker(new GPoint(-75.46951294,39.56483078),"
Salem High School
219 Walnut Street
Salem, NJ 08079

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salem High School",'Salem=' + Salem.length); Salem[Salem.length] = createMarker(new GPoint(-75.46807861,39.57024384),"
Salem Middle School
51 New Market Street
Salem, NJ 08079

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Salem Middle School",'Salem=' + Salem.length); Monroeville[Monroeville.length] = createMarker(new GPoint(-75.20182800,39.62903214),"
Upper Pittsgrove Elementary School
235 Pine Tavern Road
Monroeville, NJ 08343

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Upper Pittsgrove Elementary School",'Monroeville=' + Monroeville.length); Pennsville[Pennsville.length] = createMarker(new GPoint(-75.50186920,39.63452148),"
Valley Park Elementary School
63 Mahoney Road
Pennsville, NJ 08070

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley Park Elementary School",'Pennsville=' + Pennsville.length); Woodstown[Woodstown.length] = createMarker(new GPoint(-75.33070374,39.64440155),"
Voc-tech Career Center
Box 350
Woodstown, NJ 08098

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Voc-tech Career Center",'Woodstown=' + Woodstown.length); Woodstown[Woodstown.length] = createMarker(new GPoint(-75.33070374,39.64440155),"
Woodstown High School
Woodstown High School
Woodstown, NJ 08098

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodstown High School",'Woodstown=' + Woodstown.length); Woodstown[Woodstown.length] = createMarker(new GPoint(-75.33070374,39.64440155),"
Woodstown Middle School
Woodstown Middle School
Woodstown, NJ 08098

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Woodstown Middle School",'Woodstown=' + Woodstown.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(Alloway); map.removeOverlays(Carneys_Point); map.removeOverlays(Elmer); map.removeOverlays(Monroeville); map.removeOverlays(Norma); map.removeOverlays(Pedricktown); map.removeOverlays(Penns_Grove); map.removeOverlays(Pennsville); map.removeOverlays(Pittsgrove); map.removeOverlays(Quinton); map.removeOverlays(Salem); map.removeOverlays(Woodstown); 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(Alloway);map.removeOverlays(Alloway); map.removeOverlays(Carneys_Point); map.removeOverlays(Elmer); map.removeOverlays(Monroeville); map.removeOverlays(Norma); map.removeOverlays(Pedricktown); map.removeOverlays(Penns_Grove); map.removeOverlays(Pennsville); map.removeOverlays(Pittsgrove); map.removeOverlays(Quinton); map.removeOverlays(Salem); map.removeOverlays(Woodstown); map.addOverlays(Alloway); centerByArray(Alloway, false, false); cntMarker += Alloway.length; map.addOverlays(Carneys_Point); centerByArray(Carneys_Point, false, false); cntMarker += Carneys_Point.length; map.addOverlays(Elmer); centerByArray(Elmer, false, false); cntMarker += Elmer.length; map.addOverlays(Monroeville); centerByArray(Monroeville, false, false); cntMarker += Monroeville.length; map.addOverlays(Norma); centerByArray(Norma, false, false); cntMarker += Norma.length; map.addOverlays(Pedricktown); centerByArray(Pedricktown, false, false); cntMarker += Pedricktown.length; map.addOverlays(Penns_Grove); centerByArray(Penns_Grove, false, false); cntMarker += Penns_Grove.length; map.addOverlays(Pennsville); centerByArray(Pennsville, false, false); cntMarker += Pennsville.length; map.addOverlays(Pittsgrove); centerByArray(Pittsgrove, false, false); cntMarker += Pittsgrove.length; map.addOverlays(Quinton); centerByArray(Quinton, false, false); cntMarker += Quinton.length; map.addOverlays(Salem); centerByArray(Salem, false, false); cntMarker += Salem.length; map.addOverlays(Woodstown); centerByArray(Woodstown, false, false); cntMarker += Woodstown.length; centerByArray(Alloway,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'); } }