function addMarkers() { mySelect = document.getElementById('selection'); Stanhope = [];Vernon = [];Wantage = [];Hopatcong = [];Newton = [];Branchville = [];Franklin = [];Greendell = [];Hamburg = [];Sparta = [];Sussex = [];Lafayette = [];Montague = [];Ogdensburg = [];Layton = [];Stillwater = [];mySelect.options[mySelect.options.length] = new Option("Branchville schools",'all=Branchville'); mySelect.options[mySelect.options.length] = new Option("Franklin schools",'all=Franklin'); mySelect.options[mySelect.options.length] = new Option("Greendell schools",'all=Greendell'); mySelect.options[mySelect.options.length] = new Option("Hamburg schools",'all=Hamburg'); mySelect.options[mySelect.options.length] = new Option("Hopatcong schools",'all=Hopatcong'); mySelect.options[mySelect.options.length] = new Option("Lafayette schools",'all=Lafayette'); mySelect.options[mySelect.options.length] = new Option("Layton schools",'all=Layton'); mySelect.options[mySelect.options.length] = new Option("Montague schools",'all=Montague'); mySelect.options[mySelect.options.length] = new Option("Newton schools",'all=Newton'); mySelect.options[mySelect.options.length] = new Option("Ogdensburg schools",'all=Ogdensburg'); mySelect.options[mySelect.options.length] = new Option("Sparta schools",'all=Sparta'); mySelect.options[mySelect.options.length] = new Option("Stanhope schools",'all=Stanhope'); mySelect.options[mySelect.options.length] = new Option("Stillwater schools",'all=Stillwater'); mySelect.options[mySelect.options.length] = new Option("Sussex schools",'all=Sussex'); mySelect.options[mySelect.options.length] = new Option("Vernon schools",'all=Vernon'); mySelect.options[mySelect.options.length] = new Option("Wantage schools",'all=Wantage'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Stanhope[Stanhope.length] = createMarker(new GPoint(-74.70648193,40.93700027),"
Byram Lakes Elementary School
11 Mansfield Drive
Stanhope, NJ 07874

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Byram Lakes Elementary School",'Stanhope=' + Stanhope.length); Stanhope[Stanhope.length] = createMarker(new GPoint(-74.71118927,40.93741989),"
Byram Township Consolidated Elementary School
55 Lackawanna Drive
Stanhope, NJ 07874

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Byram Township Consolidated Elementary School",'Stanhope=' + Stanhope.length); Stanhope[Stanhope.length] = createMarker(new GPoint(-74.70889900,40.90351500),"
Byram Twp Intermediate
12 Mansfield Drive
Stanhope, NJ 07874

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Byram Twp Intermediate",'Stanhope=' + Stanhope.length); Vernon[Vernon.length] = createMarker(new GPoint(-74.51239777,41.18709946),"
Cedar Mountain School
P.o. Box 420
Vernon, NJ 07462

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Mountain School",'Vernon=' + Vernon.length); Wantage[Wantage.length] = createMarker(new GPoint(-74.60671234,41.22918320),"
Clifton E. Lawrence Elementary School
31 Ryan Road
Wantage, NJ 07461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clifton E. Lawrence Elementary School",'Wantage=' + Wantage.length); Hopatcong[Hopatcong.length] = createMarker(new GPoint(-74.66230011,40.94010162),"
Durban Ave Middle School
P.o. Box 1029
Hopatcong, NJ 07843

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Durban Ave Middle School",'Hopatcong=' + Hopatcong.length); Newton[Newton.length] = createMarker(new GPoint(-74.70497131,41.03859711),"
Florence M. Burd Elementary School
219 Newton Sparta Road
Newton, NJ 07860

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Florence M. Burd Elementary School",'Newton=' + Newton.length); Branchville[Branchville.length] = createMarker(new GPoint(-74.73892212,41.13717270),"
Frankford Township Elementary School
2 Pines Road
Branchville, NJ 07826

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frankford Township Elementary School",'Branchville=' + Branchville.length); Franklin[Franklin.length] = createMarker(new GPoint(-74.58650208,41.11550140),"
Franklin Elementary School
50 Washington Avenue
Franklin, NJ 07416

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Franklin=' + Franklin.length); Newton[Newton.length] = createMarker(new GPoint(-74.81543732,41.03460693),"
Fredon Township Elementary School
459 Route 94
Newton, NJ 07860

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fredon Township Elementary School",'Newton=' + Newton.length); Vernon[Vernon.length] = createMarker(new GPoint(-74.51239777,41.18709946),"
Glen Meadow Middle School
P.o. Box 516
Vernon, NJ 07462

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Glen Meadow Middle School",'Vernon=' + Vernon.length); Greendell[Greendell.length] = createMarker(new GPoint(-74.82129669,40.97380066),"
Green Hills School
P.o. Box 14
Greendell, NJ 07839

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Hills School",'Greendell=' + Greendell.length); Newton[Newton.length] = createMarker(new GPoint(-74.75026703,41.05358124),"
Halsted Saint Middle School
59 Halsted Street
Newton, NJ 07860

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Halsted Saint Middle School",'Newton=' + Newton.length); Hamburg[Hamburg.length] = createMarker(new GPoint(-74.57424927,41.15360641),"
Hamburg Elementary School
30 Linwood Avenue
Hamburg, NJ 07419

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamburg Elementary School",'Hamburg=' + Hamburg.length); Hamburg[Hamburg.length] = createMarker(new GPoint(-74.59226600,41.13965800),"
Hardyston Middle School
183 Wheatsworth Road
Hamburg, NJ 07419

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hardyston Middle School",'Hamburg=' + Hamburg.length); Franklin[Franklin.length] = createMarker(new GPoint(-74.58650208,41.11550140),"
Hardyston Township Elementary School
50 Route 23
Franklin, NJ 07416

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hardyston Township Elementary School",'Franklin=' + Franklin.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.63775635,41.02216721),"
Helen Morgan Elementary School
100 Stanhope Road
Sparta, NJ 07871

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Helen Morgan Elementary School",'Sparta=' + Sparta.length); Sussex[Sussex.length] = createMarker(new GPoint(-74.59349823,41.23080063),"
High Point Regional High School
299 Pigeon Hill Road
Sussex, NJ 07461

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("High Point Regional High School",'Sussex=' + Sussex.length); Hopatcong[Hopatcong.length] = createMarker(new GPoint(-74.66230011,40.94010162),"
Hopatcong High School
P.o. Box 1029
Hopatcong, NJ 07843

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hopatcong High School",'Hopatcong=' + Hopatcong.length); Hopatcong[Hopatcong.length] = createMarker(new GPoint(-74.66230011,40.94010162),"
Hopatcong Middle School
P.o. Box 1029
Hopatcong, NJ 07843

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hopatcong Middle School",'Hopatcong=' + Hopatcong.length); Hopatcong[Hopatcong.length] = createMarker(new GPoint(-74.66230011,40.94010162),"
Hudson Maxim Elementary School
P.o. Box 1029
Hopatcong, NJ 07843

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hudson Maxim Elementary School",'Hopatcong=' + Hopatcong.length); Newton[Newton.length] = createMarker(new GPoint(-74.74586487,41.09748077),"
Kittatinny Regional High School
77 Halsey Road
Newton, NJ 07860

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kittatinny Regional High School",'Newton=' + Newton.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-74.66053009,41.13022995),"
Lafayette Twp. Elementary School
178 Beaver Run Road
Lafayette, NJ 07848

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lafayette Twp. Elementary School",'Lafayette=' + Lafayette.length); Stanhope[Stanhope.length] = createMarker(new GPoint(-74.70339966,40.91920090),"
Lenape Val Regional High School
P.o. Box 578
Stanhope, NJ 07874

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lenape Val Regional High School",'Stanhope=' + Stanhope.length); Stanhope[Stanhope.length] = createMarker(new GPoint(-74.70775604,40.90470886),"
Linden Ave School
19 Linden Avenue
Stanhope, NJ 07874

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Linden Ave School",'Stanhope=' + Stanhope.length); Newton[Newton.length] = createMarker(new GPoint(-74.70520020,41.03264236),"
Long Pond Middle School
707 Limecrest Rd.
Newton, NJ 07860

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Long Pond Middle School",'Newton=' + Newton.length); Vernon[Vernon.length] = createMarker(new GPoint(-74.51239777,41.18709946),"
Lounsberry Hollow Middle School
P.o. Box 219
Vernon, NJ 07462

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lounsberry Hollow Middle School",'Vernon=' + Vernon.length); Newton[Newton.length] = createMarker(new GPoint(-74.79959869,41.06629944),"
Marian Mc Keown Elementary School
One School Road
Newton, NJ 07860

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marian Mc Keown Elementary School",'Newton=' + Newton.length); Newton[Newton.length] = createMarker(new GPoint(-74.75354767,41.04602051),"
Merriam Ave. Elementary School
81 Merriam Avenue
Newton, NJ 07860

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Merriam Ave. Elementary School",'Newton=' + Newton.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.63780212,41.03479767),"
Mohawk Avenue School
18 Mohawk Ave.
Sparta, NJ 07871

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mohawk Avenue School",'Sparta=' + Sparta.length); Montague[Montague.length] = createMarker(new GPoint(-74.75340271,41.29999924),"
Montague Township Elementary School
475 Route 206
Montague, NJ 07827

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montague Township Elementary School",'Montague=' + Montague.length); Newton[Newton.length] = createMarker(new GPoint(-74.75867462,41.05033112),"
Newton High School
44 Ryerson Avenue
Newton, NJ 07860

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newton High School",'Newton=' + Newton.length); Ogdensburg[Ogdensburg.length] = createMarker(new GPoint(-74.59310150,41.08019638),"
Ogdensburg Elementary School
100 Main Street
Ogdensburg, NJ 07439

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ogdensburg Elementary School",'Ogdensburg=' + Ogdensburg.length); Vernon[Vernon.length] = createMarker(new GPoint(-74.51239777,41.18709946),"
Rolling Hills Elementary School
P.o. Box 769
Vernon, NJ 07462

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rolling Hills Elementary School",'Vernon=' + Vernon.length); Layton[Layton.length] = createMarker(new GPoint(-74.84329987,41.20410156),"
Sandyston Walpack Consolidated Elementary School
P.o. Box 128
Layton, NJ 07851

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sandyston Walpack Consolidated Elementary School",'Layton=' + Layton.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.67678070,41.02627563),"
Sparta Alpine Elementary School
151 Andover Road
Sparta, NJ 07871

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sparta Alpine Elementary School",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.62200165,41.05379868),"
Sparta High School
70 West Mountain Road
Sparta, NJ 07871

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sparta High School",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.60520172,41.05969620),"
Sparta Middle School
350 Main Street
Sparta, NJ 07871

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sparta Middle School",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.66642761,41.07582855),"
Special Children's School
010 Gail Court
Sparta, NJ 07871

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Special Children's School",'Sparta=' + Sparta.length); Stillwater[Stillwater.length] = createMarker(new GPoint(-74.87860107,41.03580093),"
Stillwater Township Elementary School
P.o. Box 12
Stillwater, NJ 07875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stillwater Township Elementary School",'Stillwater=' + Stillwater.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.65056610,41.09925079),"
Sussex City Technical High School
105 North Church Road
Sparta, NJ 07871

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sussex City Technical High School",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-74.65407562,41.09630966),"
Sussex County Charter School For Technology
105 North Church Road
Sparta, NJ 07871

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sussex County Charter School For Technology",'Sparta=' + Sparta.length); Sussex[Sussex.length] = createMarker(new GPoint(-74.61302948,41.20568085),"
Sussex Middle School
10 Loomis Avenue
Sussex, NJ 07461

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sussex Middle School",'Sussex=' + Sussex.length); Hopatcong[Hopatcong.length] = createMarker(new GPoint(-74.66230011,40.94010162),"
Tulsa Trail Elementary School
P.o. Box 1029
Hopatcong, NJ 07843

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tulsa Trail Elementary School",'Hopatcong=' + Hopatcong.length); Stanhope[Stanhope.length] = createMarker(new GPoint(-74.70468140,40.91517639),"
Valley Road School
24 Valley Road
Stanhope, NJ 07874

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley Road School",'Stanhope=' + Stanhope.length); Vernon[Vernon.length] = createMarker(new GPoint(-74.51239777,41.18709946),"
Vernon Township High School
P.o. Box 800
Vernon, NJ 07462

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vernon Township High School",'Vernon=' + Vernon.length); Hamburg[Hamburg.length] = createMarker(new GPoint(-74.57270050,41.15359879),"
Wallkill Valley Regional High School
10 Grumm Road
Hamburg, NJ 07419

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wallkill Valley Regional High School",'Hamburg=' + Hamburg.length); Vernon[Vernon.length] = createMarker(new GPoint(-74.51239777,41.18709946),"
Walnut Ridge Elementary School
P.o. Box 190
Vernon, NJ 07462

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Ridge Elementary School",'Vernon=' + Vernon.length); Wantage[Wantage.length] = createMarker(new GPoint(-74.59349823,41.23080063),"
Wantage Elementary School
815 Route 23
Wantage, NJ 07461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wantage Elementary School",'Wantage=' + Wantage.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(Branchville); map.removeOverlays(Franklin); map.removeOverlays(Greendell); map.removeOverlays(Hamburg); map.removeOverlays(Hopatcong); map.removeOverlays(Lafayette); map.removeOverlays(Layton); map.removeOverlays(Montague); map.removeOverlays(Newton); map.removeOverlays(Ogdensburg); map.removeOverlays(Sparta); map.removeOverlays(Stanhope); map.removeOverlays(Stillwater); map.removeOverlays(Sussex); map.removeOverlays(Vernon); map.removeOverlays(Wantage); 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(Stanhope);map.removeOverlays(Branchville); map.removeOverlays(Franklin); map.removeOverlays(Greendell); map.removeOverlays(Hamburg); map.removeOverlays(Hopatcong); map.removeOverlays(Lafayette); map.removeOverlays(Layton); map.removeOverlays(Montague); map.removeOverlays(Newton); map.removeOverlays(Ogdensburg); map.removeOverlays(Sparta); map.removeOverlays(Stanhope); map.removeOverlays(Stillwater); map.removeOverlays(Sussex); map.removeOverlays(Vernon); map.removeOverlays(Wantage); map.addOverlays(Branchville); centerByArray(Branchville, false, false); cntMarker += Branchville.length; map.addOverlays(Franklin); centerByArray(Franklin, false, false); cntMarker += Franklin.length; map.addOverlays(Greendell); centerByArray(Greendell, false, false); cntMarker += Greendell.length; map.addOverlays(Hamburg); centerByArray(Hamburg, false, false); cntMarker += Hamburg.length; map.addOverlays(Hopatcong); centerByArray(Hopatcong, false, false); cntMarker += Hopatcong.length; map.addOverlays(Lafayette); centerByArray(Lafayette, false, false); cntMarker += Lafayette.length; map.addOverlays(Layton); centerByArray(Layton, false, false); cntMarker += Layton.length; map.addOverlays(Montague); centerByArray(Montague, false, false); cntMarker += Montague.length; map.addOverlays(Newton); centerByArray(Newton, false, false); cntMarker += Newton.length; map.addOverlays(Ogdensburg); centerByArray(Ogdensburg, false, false); cntMarker += Ogdensburg.length; map.addOverlays(Sparta); centerByArray(Sparta, false, false); cntMarker += Sparta.length; map.addOverlays(Stanhope); centerByArray(Stanhope, false, false); cntMarker += Stanhope.length; map.addOverlays(Stillwater); centerByArray(Stillwater, false, false); cntMarker += Stillwater.length; map.addOverlays(Sussex); centerByArray(Sussex, false, false); cntMarker += Sussex.length; map.addOverlays(Vernon); centerByArray(Vernon, false, false); cntMarker += Vernon.length; map.addOverlays(Wantage); centerByArray(Wantage, false, false); cntMarker += Wantage.length; centerByArray(Stanhope,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'); } }