function addMarkers() { mySelect = document.getElementById('selection'); Allamuchy = [];Alpha = [];Phillipsburg = [];Belvidere = [];Blairstown = [];Washington = [];Johnsonburg = [];Great_Meadows = [];Stewartsville = [];Hackettstown = [];Hope = [];Delaware = [];Port_Murray = [];Oxford = [];mySelect.options[mySelect.options.length] = new Option("Allamuchy schools",'all=Allamuchy'); mySelect.options[mySelect.options.length] = new Option("Alpha schools",'all=Alpha'); mySelect.options[mySelect.options.length] = new Option("Belvidere schools",'all=Belvidere'); mySelect.options[mySelect.options.length] = new Option("Blairstown schools",'all=Blairstown'); mySelect.options[mySelect.options.length] = new Option("Delaware schools",'all=Delaware'); mySelect.options[mySelect.options.length] = new Option("Great Meadows schools",'all=Great_Meadows'); mySelect.options[mySelect.options.length] = new Option("Hackettstown schools",'all=Hackettstown'); mySelect.options[mySelect.options.length] = new Option("Hope schools",'all=Hope'); mySelect.options[mySelect.options.length] = new Option("Johnsonburg schools",'all=Johnsonburg'); mySelect.options[mySelect.options.length] = new Option("Oxford schools",'all=Oxford'); mySelect.options[mySelect.options.length] = new Option("Phillipsburg schools",'all=Phillipsburg'); mySelect.options[mySelect.options.length] = new Option("Port Murray schools",'all=Port_Murray'); mySelect.options[mySelect.options.length] = new Option("Stewartsville schools",'all=Stewartsville'); mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Allamuchy[Allamuchy.length] = createMarker(new GPoint(-74.81050110,40.92160034),"
Allamuchy Township Consolid Elementary School
20 Johnsonburg Road
Allamuchy, NJ 07820

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Allamuchy Township Consolid Elementary School",'Allamuchy=' + Allamuchy.length); Alpha[Alpha.length] = createMarker(new GPoint(-75.16422272,40.66413879),"
Alpha Borough Elementary School
817 North Boulevard
Alpha, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alpha Borough Elementary School",'Alpha=' + Alpha.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.18126678,40.68229675),"
Andover Morris Elementary School
712 South Main Street
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Andover Morris Elementary School",'Phillipsburg=' + Phillipsburg.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16619873,40.69049835),"
Barber Elementary School
50 Sargent Street
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Barber Elementary School",'Phillipsburg=' + Phillipsburg.length); Belvidere[Belvidere.length] = createMarker(new GPoint(-75.06562042,40.82403183),"
Belvidere High School
809 Oxford Street
Belvidere, NJ 07823

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Belvidere High School",'Belvidere=' + Belvidere.length); Blairstown[Blairstown.length] = createMarker(new GPoint(-74.95534515,40.98270035),"
Blairstown Elementary School
1 Sunset Hill Road
Blairstown, NJ 07825

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blairstown Elementary School",'Blairstown=' + Blairstown.length); Washington[Washington.length] = createMarker(new GPoint(-75.00514984,40.75885010),"
Brass Castle Elementary School
16 Castle Street
Washington, NJ 07882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brass Castle Elementary School",'Washington=' + Washington.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16619873,40.69049835),"
Delaware Park School
Second Aurora Sts.
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Delaware Park School",'Phillipsburg=' + Phillipsburg.length); Washington[Washington.length] = createMarker(new GPoint(-74.99359894,40.75730133),"
Franklin Township Consolidated Elementary School
52 Asbury-broadway Road
Washington, NJ 07882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Township Consolidated Elementary School",'Washington=' + Washington.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.19411469,40.69151306),"
Freeman Elementary School
120 Fillmore Street
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Freeman Elementary School",'Phillipsburg=' + Phillipsburg.length); Johnsonburg[Johnsonburg.length] = createMarker(new GPoint(-74.87879944,40.96440125),"
Frelinghuysen Township Elementary School
780 Route 94
Johnsonburg, NJ 07846

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frelinghuysen Township Elementary School",'Johnsonburg=' + Johnsonburg.length); Great_Meadows[Great_Meadows.length] = createMarker(new GPoint(-74.91181183,40.87060165),"
Great Meadows Regional Mid School
273 Route 46
Great Meadows, NJ 07838

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Great Meadows Regional Mid School",'Great_Meadows=' + Great_Meadows.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16761780,40.68238831),"
Green Street Elementary School
1000 Green Street
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Street Elementary School",'Phillipsburg=' + Phillipsburg.length); Stewartsville[Stewartsville.length] = createMarker(new GPoint(-75.12713623,40.68538666),"
Greenwich School
101 Wyndham Farm Boulevard
Stewartsville, NJ 08886

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenwich School",'Stewartsville=' + Stewartsville.length); Hackettstown[Hackettstown.length] = createMarker(new GPoint(-74.83052063,40.84592819),"
Hackettstown High School
701 Warren Street
Hackettstown, NJ 07840

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hackettstown High School",'Hackettstown=' + Hackettstown.length); Hackettstown[Hackettstown.length] = createMarker(new GPoint(-74.82801056,40.85089874),"
Hackettstown Middle School
500 Washington Street
Hackettstown, NJ 07840

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hackettstown Middle School",'Hackettstown=' + Hackettstown.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.13986206,40.74257278),"
Harmony Township School
2551 Belvidere Road
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harmony Township School",'Phillipsburg=' + Phillipsburg.length); Hackettstown[Hackettstown.length] = createMarker(new GPoint(-74.82990265,40.86109924),"
Hatchery Hill Elementary School
Fifth Avenue
Hackettstown, NJ 07840

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hatchery Hill Elementary School",'Hackettstown=' + Hackettstown.length); Hope[Hope.length] = createMarker(new GPoint(-74.96769714,40.91109848),"
Hope Township Elementary School
P.o. Box 293
Hope, NJ 07844

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hope Township Elementary School",'Hope=' + Hope.length); Great_Meadows[Great_Meadows.length] = createMarker(new GPoint(-74.91181183,40.87060165),"
Independence Twp. Central Elementary School
281 Route 46
Great Meadows, NJ 07838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Independence Twp. Central Elementary School",'Great_Meadows=' + Great_Meadows.length); Delaware[Delaware.length] = createMarker(new GPoint(-75.06500244,40.89270020),"
Knowlton Township Elementary School
Pox 227
Delaware, NJ 07833

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Knowlton Township Elementary School",'Delaware=' + Delaware.length); Great_Meadows[Great_Meadows.length] = createMarker(new GPoint(-74.95472717,40.86944580),"
Liberty Township Elementary School
334 Mountain Lake Road
Great Meadows, NJ 07838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Township Elementary School",'Great_Meadows=' + Great_Meadows.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16619873,40.69049835),"
Lopatcong Elementary School
263 Route 57
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lopatcong Elementary School",'Phillipsburg=' + Phillipsburg.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16609955,40.69039917),"
Lopatcong Middle School
321 Stonehenge Drive
Phillipsburg, NJ 08865

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lopatcong Middle School",'Phillipsburg=' + Phillipsburg.length); Port_Murray[Port_Murray.length] = createMarker(new GPoint(-74.91401672,40.77370071),"
Mansfield Township Elementary School
50 Port Murray Road
Port Murray, NJ 07865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mansfield Township Elementary School",'Port_Murray=' + Port_Murray.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.18199158,40.68912125),"
Middle Middle School
525 Warren Street
Phillipsburg, NJ 08865

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Middle Middle School",'Phillipsburg=' + Phillipsburg.length); Blairstown[Blairstown.length] = createMarker(new GPoint(-74.95880127,40.96870041),"
N Warren Regional High School
10 Noe Rd.
Blairstown, NJ 07825

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("N Warren Regional High School",'Blairstown=' + Blairstown.length); Oxford[Oxford.length] = createMarker(new GPoint(-74.99544525,40.80308151),"
Oxford Central Elementary School
17 Kent Street
Oxford, NJ 07863

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oxford Central Elementary School",'Oxford=' + Oxford.length); Belvidere[Belvidere.length] = createMarker(new GPoint(-75.06564331,40.82403564),"
Oxford Street Middle School
807 Oxford Street
Belvidere, NJ 07823

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oxford Street Middle School",'Belvidere=' + Belvidere.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16619873,40.69049835),"
Phillipsburg Alter Sec H. S. High School
Fairview Avenue
Phillipsburg, NJ 08865

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phillipsburg Alter Sec H. S. High School",'Phillipsburg=' + Phillipsburg.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.19112396,40.69686508),"
Phillipsburg High School
200 Hillcrest Boulevard
Phillipsburg, NJ 08865

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phillipsburg High School",'Phillipsburg=' + Phillipsburg.length); Phillipsburg[Phillipsburg.length] = createMarker(new GPoint(-75.16619873,40.69049835),"
Pohatcong Township Elementary School
240 Rte. 519
Phillipsburg, NJ 08865

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pohatcong Township Elementary School",'Phillipsburg=' + Phillipsburg.length); Washington[Washington.length] = createMarker(new GPoint(-74.95507812,40.76500320),"
Port Colden Elementary School
30 Port Colden Road
Washington, NJ 07882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Port Colden Elementary School",'Washington=' + Washington.length); Blairstown[Blairstown.length] = createMarker(new GPoint(-74.96689800,40.91800200),"
Ridge And Valley Charter School
1234 State Route 94
Blairstown, NJ 07825

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ridge And Valley Charter School",'Blairstown=' + Blairstown.length); Stewartsville[Stewartsville.length] = createMarker(new GPoint(-75.10931396,40.69200516),"
Stewartsville Elementary School
642 South Main Street
Stewartsville, NJ 08886

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Stewartsville Elementary School",'Stewartsville=' + Stewartsville.length); Washington[Washington.length] = createMarker(new GPoint(-74.98084259,40.76201630),"
Taylor Street Elementary School
16-24 Taylor Street
Washington, NJ 07882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Street Elementary School",'Washington=' + Washington.length); Belvidere[Belvidere.length] = createMarker(new GPoint(-75.07900238,40.82590103),"
Third Street Elementary School
Third And Greenwich Streets
Belvidere, NJ 07823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Third Street Elementary School",'Belvidere=' + Belvidere.length); Washington[Washington.length] = createMarker(new GPoint(-74.99359894,40.75730133),"
Warren City Vocational & Technical Ins High School
1500 Route 57
Washington, NJ 07882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren City Vocational & Technical Ins High School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-74.83650970,40.85179901),"
Warren Co Spec Ser School
1500 Rte. 57, Suite 1
Washington, NJ 07882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren Co Spec Ser School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-74.98799133,40.76906967),"
Warren Hills Regional High School
41 Jackson Valley Road
Washington, NJ 07882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warren Hills Regional High School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-74.99111176,40.76089859),"
Warren Hills Regional Midd School
64-66 Carlton Avenue
Washington, NJ 07882

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Warren Hills Regional Midd School",'Washington=' + Washington.length); Washington[Washington.length] = createMarker(new GPoint(-74.99021149,40.75819778),"
Washington Memorial Elementary School
300 West Stewart Street
Washington, NJ 07882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Memorial Elementary School",'Washington=' + Washington.length); Belvidere[Belvidere.length] = createMarker(new GPoint(-75.04660034,40.83000183),"
White Township Consolidated Elementary School
565 Cr 519
Belvidere, NJ 07823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("White Township Consolidated Elementary School",'Belvidere=' + Belvidere.length); Hackettstown[Hackettstown.length] = createMarker(new GPoint(-74.81561279,40.86009979),"
Willow Grove Street Elementary School
601 Willow Grove Street
Hackettstown, NJ 07840

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Willow Grove Street Elementary School",'Hackettstown=' + Hackettstown.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(Allamuchy); map.removeOverlays(Alpha); map.removeOverlays(Belvidere); map.removeOverlays(Blairstown); map.removeOverlays(Delaware); map.removeOverlays(Great_Meadows); map.removeOverlays(Hackettstown); map.removeOverlays(Hope); map.removeOverlays(Johnsonburg); map.removeOverlays(Oxford); map.removeOverlays(Phillipsburg); map.removeOverlays(Port_Murray); map.removeOverlays(Stewartsville); map.removeOverlays(Washington); 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(Allamuchy);map.removeOverlays(Allamuchy); map.removeOverlays(Alpha); map.removeOverlays(Belvidere); map.removeOverlays(Blairstown); map.removeOverlays(Delaware); map.removeOverlays(Great_Meadows); map.removeOverlays(Hackettstown); map.removeOverlays(Hope); map.removeOverlays(Johnsonburg); map.removeOverlays(Oxford); map.removeOverlays(Phillipsburg); map.removeOverlays(Port_Murray); map.removeOverlays(Stewartsville); map.removeOverlays(Washington); map.addOverlays(Allamuchy); centerByArray(Allamuchy, false, false); cntMarker += Allamuchy.length; map.addOverlays(Alpha); centerByArray(Alpha, false, false); cntMarker += Alpha.length; map.addOverlays(Belvidere); centerByArray(Belvidere, false, false); cntMarker += Belvidere.length; map.addOverlays(Blairstown); centerByArray(Blairstown, false, false); cntMarker += Blairstown.length; map.addOverlays(Delaware); centerByArray(Delaware, false, false); cntMarker += Delaware.length; map.addOverlays(Great_Meadows); centerByArray(Great_Meadows, false, false); cntMarker += Great_Meadows.length; map.addOverlays(Hackettstown); centerByArray(Hackettstown, false, false); cntMarker += Hackettstown.length; map.addOverlays(Hope); centerByArray(Hope, false, false); cntMarker += Hope.length; map.addOverlays(Johnsonburg); centerByArray(Johnsonburg, false, false); cntMarker += Johnsonburg.length; map.addOverlays(Oxford); centerByArray(Oxford, false, false); cntMarker += Oxford.length; map.addOverlays(Phillipsburg); centerByArray(Phillipsburg, false, false); cntMarker += Phillipsburg.length; map.addOverlays(Port_Murray); centerByArray(Port_Murray, false, false); cntMarker += Port_Murray.length; map.addOverlays(Stewartsville); centerByArray(Stewartsville, false, false); cntMarker += Stewartsville.length; map.addOverlays(Washington); centerByArray(Washington, false, false); cntMarker += Washington.length; centerByArray(Allamuchy,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'); } }