function addMarkers(){ mySelect = document.getElementById('selection'); Belleville = [];Nutley = [];Newark = [];Bloomfield = [];Verona = [];Bellville = [];Montclair = [];West_Caldwell = [];Fairfield = [];Livingston = [];Irvington = [];East_Orange = [];Orange = [];South_Orange = [];Caldwell = [];West_Orange = [];Short_Hills = [];mySelect.options[mySelect.options.length] = new Option("Belleville schools",'all=Belleville'); mySelect.options[mySelect.options.length] = new Option("Bellville schools",'all=Bellville'); mySelect.options[mySelect.options.length] = new Option("Bloomfield schools",'all=Bloomfield'); mySelect.options[mySelect.options.length] = new Option("Caldwell schools",'all=Caldwell'); mySelect.options[mySelect.options.length] = new Option("East Orange schools",'all=East_Orange'); mySelect.options[mySelect.options.length] = new Option("Fairfield schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Irvington schools",'all=Irvington'); mySelect.options[mySelect.options.length] = new Option("Livingston schools",'all=Livingston'); mySelect.options[mySelect.options.length] = new Option("Montclair schools",'all=Montclair'); mySelect.options[mySelect.options.length] = new Option("Newark schools",'all=Newark'); mySelect.options[mySelect.options.length] = new Option("Nutley schools",'all=Nutley'); mySelect.options[mySelect.options.length] = new Option("Orange schools",'all=Orange'); mySelect.options[mySelect.options.length] = new Option("Short Hills schools",'all=Short_Hills'); mySelect.options[mySelect.options.length] = new Option("South Orange schools",'all=South_Orange'); mySelect.options[mySelect.options.length] = new Option("Verona schools",'all=Verona'); mySelect.options[mySelect.options.length] = new Option("West Caldwell schools",'all=West_Caldwell'); mySelect.options[mySelect.options.length] = new Option("West Orange schools",'all=West_Orange'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Belleville[Belleville.length] = createMarker(new GPoint(-74.17675500,40.78683400),"
1st Cerebral Palsy Of Nj
7 Sanford Ave
Belleville, NJ 07109
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("1st Cerebral Palsy Of Nj",'Belleville=' + Belleville.length); Nutley[Nutley.length] = createMarker(new GPoint(-74.14212100,40.81910400),"
Abundant Life Academy
390 Washington Avenue
Nutley, NJ 07110
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Abundant Life Academy",'Nutley=' + Nutley.length); Newark[Newark.length] = createMarker(new GPoint(-74.14831800,40.73064200),"
Alpha And Omega
4 Fleming Avenue
Newark, NJ 07105
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alpha And Omega",'Newark=' + Newark.length); Newark[Newark.length] = createMarker(new GPoint(-74.19920600,40.73588300),"
Chad Science Academy
370 S 7th St
Newark, NJ 07103
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chad Science Academy",'Newark=' + Newark.length); Bloomfield[Bloomfield.length] = createMarker(new GPoint(-74.19142300,40.79039600),"
The Child Development Center
60 West St
Bloomfield, NJ 07003
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Child Development Center",'Bloomfield=' + Bloomfield.length); Verona[Verona.length] = createMarker(new GPoint(-74.22789100,40.82462000),"
The Children's Institute
1 Sunset Ave
Verona, NJ 07044
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Children's Institute",'Verona=' + Verona.length); Bellville[Bellville.length] = createMarker(new GPoint(-74.17256900,40.79437800),"
Comm Therapeutic Sch-pre School
570 Bellevile Avenue
Bellville, NJ 07109
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Comm Therapeutic Sch-pre School",'Bellville=' + Bellville.length); Montclair[Montclair.length] = createMarker(new GPoint(-74.20718300,40.81612300),"
Deron School
130 Grove Street
Montclair, NJ 07042
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deron School",'Montclair=' + Montclair.length); West_Caldwell[West_Caldwell.length] = createMarker(new GPoint(-74.30676900,40.85658600),"
Essex Valley School
1 Henderson Drive
West Caldwell, NJ 07006
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Essex Valley School",'West_Caldwell=' + West_Caldwell.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-74.28983900,40.87291800),"
The Gramon School
24 Dwight Place
Fairfield, NJ 07004
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Gramon School",'Fairfield=' + Fairfield.length); Livingston[Livingston.length] = createMarker(new GPoint(-74.34582000,40.79516400),"
Horizon School-cerebal Palsy O
51 Old Road
Livingston, NJ 07039
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Horizon School-cerebal Palsy O",'Livingston=' + Livingston.length); Montclair[Montclair.length] = createMarker(new GPoint(-74.21625300,40.81629100),"
Immaculate Conception High School
33 Cottage Place
Montclair, NJ 07042
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception High School",'Montclair=' + Montclair.length); Irvington[Irvington.length] = createMarker(new GPoint(-74.21411400,40.73919300),"
Independence High School
Po Box 369
Irvington, NJ 07111
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Independence High School",'Irvington=' + Irvington.length); East_Orange[East_Orange.length] = createMarker(new GPoint(-74.20538300,40.76518400),"
Islamic Day School
215 N Oraton Parkway
East Orange, NJ 07017
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Islamic Day School",'East_Orange=' + East_Orange.length); East_Orange[East_Orange.length] = createMarker(new GPoint(-74.22015100,40.77326200),"
Jamas Children's University
86 Washington Street
East Orange, NJ 07017
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jamas Children's University",'East_Orange=' + East_Orange.length); Montclair[Montclair.length] = createMarker(new GPoint(-74.20139000,40.84122900),"
Lacordaire Academy
155 Lorraine Avenue
Montclair, NJ 07043
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lacordaire Academy",'Montclair=' + Montclair.length); Orange[Orange.length] = createMarker(new GPoint(-74.22945700,40.77615900),"
The Lakeside School
123 Cleveland Street
Orange, NJ 07050
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Lakeside School",'Orange=' + Orange.length); Newark[Newark.length] = createMarker(new GPoint(-74.19095600,40.73010100),"
Link Community School
120 Livingston Street
Newark, NJ 07103
Co-ed school, 7-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Link Community School",'Newark=' + Newark.length); South_Orange[South_Orange.length] = createMarker(new GPoint(-74.25137700,40.75358800),"
Marylawn Of The Oranges
445 Scotland Road
South Orange, NJ 07079
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marylawn Of The Oranges",'South_Orange=' + South_Orange.length); Newark[Newark.length] = createMarker(new GPoint(-74.16937100,40.74357200),"
The Mesivta Of North Jersey
520 Broad Street 13th Floor
Newark, NJ 07102
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("The Mesivta Of North Jersey",'Newark=' + Newark.length); Livingston[Livingston.length] = createMarker(new GPoint(-74.29270200,40.79579400),"
The Milton School
346 East Mount Pleasant Avenue
Livingston, NJ 07039
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Milton School",'Livingston=' + Livingston.length); Montclair[Montclair.length] = createMarker(new GPoint(-74.21721500,40.82655500),"
The Montclair Kimberley Academy
201 Valley Road
Montclair, NJ 07042
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Montclair Kimberley Academy",'Montclair=' + Montclair.length); Caldwell[Caldwell.length] = createMarker(new GPoint(-74.26730200,40.83535500),"
Mount Saint Dominic Academy
3 Ryerson Avenue
Caldwell, NJ 07006
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Saint Dominic Academy",'Caldwell=' + Caldwell.length); Belleville[Belleville.length] = createMarker(new GPoint(-74.17793600,40.77841500),"
Mt Carmel Guild School
25 N 7th Street
Belleville, NJ 07109
Co-ed school, 5-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Carmel Guild School",'Belleville=' + Belleville.length); Newark[Newark.length] = createMarker(new GPoint(-74.19199400,40.75396500),"
New Testament Church School
511 Orange Street
Newark, NJ 07107
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Testament Church School",'Newark=' + Newark.length); Livingston[Livingston.length] = createMarker(new GPoint(-74.36136900,40.77662900),"
Newark Academy
91 South Orange Avenue
Livingston, NJ 07039
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newark Academy",'Livingston=' + Livingston.length); Nutley[Nutley.length] = createMarker(new GPoint(-74.15650000,40.81860000),"
The Phoenix Center, Inc
16 Msgr. Owens Place
Nutley, NJ 07110
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Phoenix Center, Inc",'Nutley=' + Nutley.length); Livingston[Livingston.length] = createMarker(new GPoint(-74.35974300,40.77566500),"
Rae Kushner Yeshiva High School
110 S Orange Avenue
Livingston, NJ 07039
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rae Kushner Yeshiva High School",'Livingston=' + Livingston.length); Newark[Newark.length] = createMarker(new GPoint(-74.17991500,40.73550800),"
St. Benedict's Prep School
520 Martin Luther King Jr Blvd
Newark, NJ 07102
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Benedict's Prep School",'Newark=' + Newark.length); Newark[Newark.length] = createMarker(new GPoint(-74.17958100,40.73373800),"
St. James Preparatory School
88-108 Shipman Street
Newark, NJ 07102
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. James Preparatory School",'Newark=' + Newark.length); Newark[Newark.length] = createMarker(new GPoint(-74.18668000,40.74299400),"
St. Vincent Academy
228 W Market Street
Newark, NJ 07103
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Vincent Academy",'Newark=' + Newark.length); West_Orange[West_Orange.length] = createMarker(new GPoint(-74.24722400,40.77551300),"
Seton Hall Preparatory School
120 Northfield Avenue
West Orange, NJ 07052
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Seton Hall Preparatory School",'West_Orange=' + West_Orange.length); Montclair[Montclair.length] = createMarker(new GPoint(-74.23170300,40.80595400),"
Virginia Harkness Sawtelle Lrn
208 South Mountain Avenue
Montclair, NJ 07042
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Virginia Harkness Sawtelle Lrn",'Montclair=' + Montclair.length); Short_Hills[Short_Hills.length] = createMarker(new GPoint(-74.32552800,40.73145200),"
The Winston School
100 East Lane
Short Hills, NJ 07078
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Winston School",'Short_Hills=' + Short_Hills.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/////2/' + showArray); map.removeOverlays(Belleville); map.removeOverlays(Bellville); map.removeOverlays(Bloomfield); map.removeOverlays(Caldwell); map.removeOverlays(East_Orange); map.removeOverlays(Fairfield); map.removeOverlays(Irvington); map.removeOverlays(Livingston); map.removeOverlays(Montclair); map.removeOverlays(Newark); map.removeOverlays(Nutley); map.removeOverlays(Orange); map.removeOverlays(Short_Hills); map.removeOverlays(South_Orange); map.removeOverlays(Verona); map.removeOverlays(West_Caldwell); map.removeOverlays(West_Orange); 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(Belleville);map.removeOverlays(Belleville); map.removeOverlays(Bellville); map.removeOverlays(Bloomfield); map.removeOverlays(Caldwell); map.removeOverlays(East_Orange); map.removeOverlays(Fairfield); map.removeOverlays(Irvington); map.removeOverlays(Livingston); map.removeOverlays(Montclair); map.removeOverlays(Newark); map.removeOverlays(Nutley); map.removeOverlays(Orange); map.removeOverlays(Short_Hills); map.removeOverlays(South_Orange); map.removeOverlays(Verona); map.removeOverlays(West_Caldwell); map.removeOverlays(West_Orange); map.addOverlays(Belleville); centerByArray(Belleville, false, false); cntMarker += Belleville.length; map.addOverlays(Bellville); centerByArray(Bellville, false, false); cntMarker += Bellville.length; map.addOverlays(Bloomfield); centerByArray(Bloomfield, false, false); cntMarker += Bloomfield.length; map.addOverlays(Caldwell); centerByArray(Caldwell, false, false); cntMarker += Caldwell.length; map.addOverlays(East_Orange); centerByArray(East_Orange, false, false); cntMarker += East_Orange.length; map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Irvington); centerByArray(Irvington, false, false); cntMarker += Irvington.length; map.addOverlays(Livingston); centerByArray(Livingston, false, false); cntMarker += Livingston.length; map.addOverlays(Montclair); centerByArray(Montclair, false, false); cntMarker += Montclair.length; map.addOverlays(Newark); centerByArray(Newark, false, false); cntMarker += Newark.length; map.addOverlays(Nutley); centerByArray(Nutley, false, false); cntMarker += Nutley.length; map.addOverlays(Orange); centerByArray(Orange, false, false); cntMarker += Orange.length; map.addOverlays(Short_Hills); centerByArray(Short_Hills, false, false); cntMarker += Short_Hills.length; map.addOverlays(South_Orange); centerByArray(South_Orange, false, false); cntMarker += South_Orange.length; map.addOverlays(Verona); centerByArray(Verona, false, false); cntMarker += Verona.length; map.addOverlays(West_Caldwell); centerByArray(West_Caldwell, false, false); cntMarker += West_Caldwell.length; map.addOverlays(West_Orange); centerByArray(West_Orange, false, false); cntMarker += West_Orange.length; centerByArray(Belleville,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=2&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; }