function addMarkers(){ mySelect = document.getElementById('selection'); Milford = [];West_Haven = [];Hamden = [];Waterbury = [];Cheshire = [];New_Haven = [];Wallingford = [];Meriden = [];North_Haven = [];Madison = [];Orange = [];Middlebury = [];mySelect.options[mySelect.options.length] = new Option("Cheshire schools",'all=Cheshire'); mySelect.options[mySelect.options.length] = new Option("Hamden schools",'all=Hamden'); mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison'); mySelect.options[mySelect.options.length] = new Option("Meriden schools",'all=Meriden'); mySelect.options[mySelect.options.length] = new Option("Middlebury schools",'all=Middlebury'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("New Haven schools",'all=New_Haven'); mySelect.options[mySelect.options.length] = new Option("North Haven schools",'all=North_Haven'); mySelect.options[mySelect.options.length] = new Option("Orange schools",'all=Orange'); mySelect.options[mySelect.options.length] = new Option("Wallingford schools",'all=Wallingford'); mySelect.options[mySelect.options.length] = new Option("Waterbury schools",'all=Waterbury'); mySelect.options[mySelect.options.length] = new Option("West Haven schools",'all=West_Haven'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Milford[Milford.length] = createMarker(new GPoint(-73.06204500,41.22420200),"
Academy Of Our Lady Of Mercy, Lauralton Hall
200 High Street
Milford, CT 06460
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Academy Of Our Lady Of Mercy, Lauralton Hall",'Milford=' + Milford.length); West_Haven[West_Haven.length] = createMarker(new GPoint(-72.98115200,41.26943100),"
Benhaven School
67 Bull Hill Lane
West Haven, CT 06516
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Benhaven School",'West_Haven=' + West_Haven.length); Milford[Milford.length] = createMarker(new GPoint(-73.01317400,41.22669900),"
Berean Christian Academy
989 New Havenuen Avenue
Milford, CT 06460
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berean Christian Academy",'Milford=' + Milford.length); Hamden[Hamden.length] = createMarker(new GPoint(-72.91932600,41.33529400),"
Cedarhurst School
871 Prospect Street
Hamden, CT 06517
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedarhurst School",'Hamden=' + Hamden.length); Waterbury[Waterbury.length] = createMarker(new GPoint(-73.06580700,41.54737900),"
Chase Collegiate School
565 Chase Parkway
Waterbury, CT 06708
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chase Collegiate School",'Waterbury=' + Waterbury.length); Cheshire[Cheshire.length] = createMarker(new GPoint(-72.90108900,41.50066200),"
The Cheshire Academy
10 Main St
Cheshire, CT 06410
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Cheshire Academy",'Cheshire=' + Cheshire.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.92857200,41.28877400),"
Children's Community Programs Of Ct
1 Long Wharf Drive Suite 7
New Haven, CT 06511
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Children's Community Programs Of Ct",'New_Haven=' + New_Haven.length); Wallingford[Wallingford.length] = createMarker(new GPoint(-72.80751100,41.45667000),"
Choate Rosemary Hall
333 Christian Street
Wallingford, CT 06492
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Choate Rosemary Hall",'Wallingford=' + Wallingford.length); Meriden[Meriden.length] = createMarker(new GPoint(-72.80534100,41.52766100),"
Curtis School
380 Crown Street
Meriden, CT 06450
All-boys school, 5-9
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Curtis School",'Meriden=' + Meriden.length); North_Haven[North_Haven.length] = createMarker(new GPoint(-72.89800400,41.35699900),"
Elizabeth Ives School For Special Children
70 State Street
North Haven, CT 06473
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Elizabeth Ives School For Special Children",'North_Haven=' + North_Haven.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.91979200,41.32688400),"
Foote School
50 Loomis Place
New Haven, CT 06511
Co-ed school, K-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Foote School",'New_Haven=' + New_Haven.length); Milford[Milford.length] = createMarker(new GPoint(-73.02489400,41.24023200),"
The Foundation School
91 Woodmont Rd.
Milford, CT 06460
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Foundation School",'Milford=' + Milford.length); Madison[Madison.length] = createMarker(new GPoint(-72.60900000,41.30420000),"
Grove School
Box 646
Madison, CT 06443
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grove School",'Madison=' + Madison.length); Hamden[Hamden.length] = createMarker(new GPoint(-72.91285800,41.34199900),"
Hamden Hall School
1108 Whitney Ave
Hamden, CT 06517
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hamden Hall School",'Hamden=' + Hamden.length); Wallingford[Wallingford.length] = createMarker(new GPoint(-72.82335900,41.45061700),"
Heritage Baptist Academy
161 S Whittlesey Avenue
Wallingford, CT 06492
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Baptist Academy",'Wallingford=' + Wallingford.length); Wallingford[Wallingford.length] = createMarker(new GPoint(-72.80592000,41.47618700),"
High Road Student Learning Center
29 Village Lane
Wallingford, CT 06492
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("High Road Student Learning Center",'Wallingford=' + Wallingford.length); Waterbury[Waterbury.length] = createMarker(new GPoint(-73.06629500,41.53131900),"
Holy Cross High School
587 Oronoke Road
Waterbury, CT 06708
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Cross High School",'Waterbury=' + Waterbury.length); Milford[Milford.length] = createMarker(new GPoint(-104.82510000,38.78910000),"
Hope Academy
597 Naugatuck Avenue
Milford, CT 06461
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hope Academy",'Milford=' + Milford.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.97060200,41.31886600),"
Hopkins School
986 Forest Road
New Haven, CT 06515
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hopkins School",'New_Haven=' + New_Haven.length); Milford[Milford.length] = createMarker(new GPoint(-73.04951700,41.22224400),"
Milford Academy
150 Gulf St
Milford, CT 06460
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Milford Academy",'Milford=' + Milford.length); Orange[Orange.length] = createMarker(new GPoint(-73.00816800,41.29892300),"
New Haven Hebrew Day School
261 Derby Avenue
Orange, CT 06477
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Haven Hebrew Day School",'Orange=' + Orange.length); West_Haven[West_Haven.length] = createMarker(new GPoint(-72.96154500,41.28891800),"
Notre Dame High School
24 Ricardo Street
West Haven, CT 06516
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Notre Dame High School",'West_Haven=' + West_Haven.length); Hamden[Hamden.length] = createMarker(new GPoint(-72.93215300,41.36503700),"
Sacred Heart Academy
265 Benham Street
Hamden, CT 06514
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sacred Heart Academy",'Hamden=' + Hamden.length); Waterbury[Waterbury.length] = createMarker(new GPoint(-73.03798900,41.55165800),"
Sacred Heart High School
142 S Elm Street
Waterbury, CT 06706
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart High School",'Waterbury=' + Waterbury.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.92150300,41.32948800),"
St. Francis Home For Children
651 Prospect St
New Haven, CT 06511
All-boys school, 1-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Francis Home For Children",'New_Haven=' + New_Haven.length); Waterbury[Waterbury.length] = createMarker(new GPoint(-81.71043400,33.52344900),"
Stepping Stones School
63 Prospect Street
Waterbury, CT 06702
All-girls school, 8-11
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stepping Stones School",'Waterbury=' + Waterbury.length); Cheshire[Cheshire.length] = createMarker(new GPoint(-72.91581400,41.53277700),"
Webb School At Cheshire
725 Jarvis Street
Cheshire, CT 06410
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Webb School At Cheshire",'Cheshire=' + Cheshire.length); Hamden[Hamden.length] = createMarker(new GPoint(-72.89717800,41.33869200),"
West Woods Christian Academy
2105 State Street
Hamden, CT 06517
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Woods Christian Academy",'Hamden=' + Hamden.length); Middlebury[Middlebury.length] = createMarker(new GPoint(-73.12313800,41.52724400),"
Westover School
1237 Whittemore Road
Middlebury, CT 06762
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westover School",'Middlebury=' + Middlebury.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.94696000,41.31673900),"
Yeshiva Of New Haven
765 Elm Street
New Haven, CT 06511
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yeshiva Of New Haven",'New_Haven=' + New_Haven.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(Cheshire); map.removeOverlays(Hamden); map.removeOverlays(Madison); map.removeOverlays(Meriden); map.removeOverlays(Middlebury); map.removeOverlays(Milford); map.removeOverlays(New_Haven); map.removeOverlays(North_Haven); map.removeOverlays(Orange); map.removeOverlays(Wallingford); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); 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(Milford);map.removeOverlays(Cheshire); map.removeOverlays(Hamden); map.removeOverlays(Madison); map.removeOverlays(Meriden); map.removeOverlays(Middlebury); map.removeOverlays(Milford); map.removeOverlays(New_Haven); map.removeOverlays(North_Haven); map.removeOverlays(Orange); map.removeOverlays(Wallingford); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.addOverlays(Cheshire); centerByArray(Cheshire, false, false); cntMarker += Cheshire.length; map.addOverlays(Hamden); centerByArray(Hamden, false, false); cntMarker += Hamden.length; map.addOverlays(Madison); centerByArray(Madison, false, false); cntMarker += Madison.length; map.addOverlays(Meriden); centerByArray(Meriden, false, false); cntMarker += Meriden.length; map.addOverlays(Middlebury); centerByArray(Middlebury, false, false); cntMarker += Middlebury.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(New_Haven); centerByArray(New_Haven, false, false); cntMarker += New_Haven.length; map.addOverlays(North_Haven); centerByArray(North_Haven, false, false); cntMarker += North_Haven.length; map.addOverlays(Orange); centerByArray(Orange, false, false); cntMarker += Orange.length; map.addOverlays(Wallingford); centerByArray(Wallingford, false, false); cntMarker += Wallingford.length; map.addOverlays(Waterbury); centerByArray(Waterbury, false, false); cntMarker += Waterbury.length; map.addOverlays(West_Haven); centerByArray(West_Haven, false, false); cntMarker += West_Haven.length; centerByArray(Milford,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; }