function addMarkers(){ mySelect = document.getElementById('selection'); Bridgeport = [];Greenwich = [];Trumbull = [];Danbury = [];Southport = [];Easton = [];Fairfield = [];Greens_Farms = [];Cos_Cob = [];Stamford = [];New_Canaan = [];Norwalk = [];Westport = [];mySelect.options[mySelect.options.length] = new Option("Bridgeport schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Cos Cob schools",'all=Cos_Cob'); mySelect.options[mySelect.options.length] = new Option("Danbury schools",'all=Danbury'); mySelect.options[mySelect.options.length] = new Option("Easton schools",'all=Easton'); mySelect.options[mySelect.options.length] = new Option("Fairfield schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Greens Farms schools",'all=Greens_Farms'); mySelect.options[mySelect.options.length] = new Option("Greenwich schools",'all=Greenwich'); mySelect.options[mySelect.options.length] = new Option("New Canaan schools",'all=New_Canaan'); mySelect.options[mySelect.options.length] = new Option("Norwalk schools",'all=Norwalk'); mySelect.options[mySelect.options.length] = new Option("Southport schools",'all=Southport'); mySelect.options[mySelect.options.length] = new Option("Stamford schools",'all=Stamford'); mySelect.options[mySelect.options.length] = new Option("Trumbull schools",'all=Trumbull'); mySelect.options[mySelect.options.length] = new Option("Westport schools",'all=Westport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.18843000,41.16767100),"
Bridgeport International Academy
285 Lafayette Street
Bridgeport, CT 06604
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bridgeport International Academy",'Bridgeport=' + Bridgeport.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.62570100,41.03779600),"
Brunswick School
100 Maher Avenue
Greenwich, CT 06830
All-boys school, PK-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brunswick School",'Greenwich=' + Greenwich.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.31700000,41.39830000),"
Center Of Progressive Education
425 Grant Street
Bridgeport, CT 06610
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Center Of Progressive Education",'Bridgeport=' + Bridgeport.length); Trumbull[Trumbull.length] = createMarker(new GPoint(-73.18427100,41.23820700),"
Christian Heritage School
575 White Plains Rd
Trumbull, CT 06611
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Heritage School",'Trumbull=' + Trumbull.length); Danbury[Danbury.length] = createMarker(new GPoint(-73.43108100,41.43044700),"
Colonial Hills Christian Academy
40 Stadley Rough Road
Danbury, CT 06811
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colonial Hills Christian Academy",'Danbury=' + Danbury.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.69725500,41.06922700),"
Convent Of The Sacred Heart
1177 King Street
Greenwich, CT 06831
All-girls school, NS-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Convent Of The Sacred Heart",'Greenwich=' + Greenwich.length); Southport[Southport.length] = createMarker(new GPoint(-73.28342100,41.13391400),"
Eagle Hill - Southport
214 Main St
Southport, CT 06490
Co-ed school, 3-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle Hill - Southport",'Southport=' + Southport.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.63946200,41.03081400),"
Eagle Hill School
45 Glenville Road
Greenwich, CT 06831
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eagle Hill School",'Greenwich=' + Greenwich.length); Easton[Easton.length] = createMarker(new GPoint(-73.29453000,41.24963400),"
Easton Country Day School
660 Morehouse Road
Easton, CT 06612
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Easton Country Day School",'Easton=' + Easton.length); Easton[Easton.length] = createMarker(new GPoint(-73.29453000,41.24963400),"
Easton Country Day School
660 Morehouse Road
Easton, CT 06612
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Easton Country Day School",'Easton=' + Easton.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-73.25463300,41.16179100),"
Fairfield College Preparatory
1073 N Benson Road
Fairfield, CT 06824
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairfield College Preparatory",'Fairfield=' + Fairfield.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-73.29131900,41.17253700),"
Fairfield Country Day School
2970 Bronson Road
Fairfield, CT 06824
All-boys school, K-9
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairfield Country Day School",'Fairfield=' + Fairfield.length); Greens_Farms[Greens_Farms.length] = createMarker(new GPoint(-73.32013900,41.12539700),"
Greens Farms Academy
35 Beachside Avenue
Greens Farms, CT 06838
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greens Farms Academy",'Greens_Farms=' + Greens_Farms.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.62525700,41.04169300),"
Greenwich Academy
200 N Maple Avenue
Greenwich, CT 06830
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenwich Academy",'Greenwich=' + Greenwich.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.62640000,41.02540000),"
Greenwich Country Day School
Po Box 623 401 Old Church Road
Greenwich, CT 06836
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenwich Country Day School",'Greenwich=' + Greenwich.length); Cos_Cob[Cos_Cob.length] = createMarker(new GPoint(-73.58762900,41.05413000),"
Greenwich Education and Prep
PO Box 391
Cos Cob, CT 06807
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenwich Education and Prep",'Cos_Cob=' + Cos_Cob.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.66110000,41.06420000),"
The Greenwich Japanese School
15 Ridgeway
Greenwich, CT 06831
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Greenwich Japanese School",'Greenwich=' + Greenwich.length); Danbury[Danbury.length] = createMarker(new GPoint(-73.45123500,41.38050000),"
Immaculate High School
73 Southern Blvd
Danbury, CT 06810
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate High School",'Danbury=' + Danbury.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53193500,41.10922300),"
King Low Heywood Thomas School
1450 Newfield Avenue
Stamford, CT 06905
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("King Low Heywood Thomas School",'Stamford=' + Stamford.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.19631000,41.17913600),"
Kolbe Cathedral High School
33 Calhoun Place
Bridgeport, CT 06604
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kolbe Cathedral High School",'Bridgeport=' + Bridgeport.length); New_Canaan[New_Canaan.length] = createMarker(new GPoint(-73.49400000,41.14990000),"
New Canaan Country School
Po Box 997
New Canaan, CT 06840
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Canaan Country School",'New_Canaan=' + New_Canaan.length); Danbury[Danbury.length] = createMarker(new GPoint(-73.46842500,41.40946600),"
New Hope Christian Academy
18 Clapboard Ridge Road
Danbury, CT 06811
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Hope Christian Academy",'Danbury=' + Danbury.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-73.24581300,41.22338000),"
Notre Dame Catholic High School
220 Jefferson Street
Fairfield, CT 06825
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Notre Dame Catholic High School",'Fairfield=' + Fairfield.length); Norwalk[Norwalk.length] = createMarker(new GPoint(-73.41323800,41.12983800),"
Oakbridge School Community Solutions Inc
57 W Rocks Road
Norwalk, CT 06851
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oakbridge School Community Solutions Inc",'Norwalk=' + Norwalk.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53355400,41.06674600),"
Sacred Heart Academy Of Stamford
200 Strawberry Hill Avenue
Stamford, CT 06902
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sacred Heart Academy Of Stamford",'Stamford=' + Stamford.length); Trumbull[Trumbull.length] = createMarker(new GPoint(-73.16639700,41.26114000),"
St. Joseph High School
2320 Huntington Tpke
Trumbull, CT 06611
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph High School",'Trumbull=' + Trumbull.length); New_Canaan[New_Canaan.length] = createMarker(new GPoint(-73.49813100,41.19377400),"
St. Luke's School
377 North Wilton Road
New Canaan, CT 06840
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Luke's School",'New_Canaan=' + New_Canaan.length); Trumbull[Trumbull.length] = createMarker(new GPoint(-73.14637100,41.24143800),"
St. Vincent's Special Needs Ser
95 Merritt Blvd
Trumbull, CT 06611
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Vincent's Special Needs Ser",'Trumbull=' + Trumbull.length); Westport[Westport.length] = createMarker(new GPoint(-73.33094500,41.14225600),"
Seton Academy
47 Long Lots Road
Westport, CT 06880
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seton Academy",'Westport=' + Westport.length); Greenwich[Greenwich.length] = createMarker(new GPoint(-73.60428000,41.07172900),"
The Stanwich School
257 Stanwich Road
Greenwich, CT 06830
Co-ed school, K-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Stanwich School",'Greenwich=' + Greenwich.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53329700,41.09137200),"
Trinity Catholic High School
926 Newfield Avenue
Stamford, CT 06905
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Catholic High School",'Stamford=' + Stamford.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.20680000,41.21030000),"
University School
Po Box 6129
Bridgeport, CT 06606
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("University School",'Bridgeport=' + Bridgeport.length); Norwalk[Norwalk.length] = createMarker(new GPoint(-73.41323800,41.12983800),"
The Winston Preparatory School- Norwalk
57 West Rocks Road
Norwalk, CT 06851
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Winston Preparatory School- Norwalk",'Norwalk=' + Norwalk.length); Danbury[Danbury.length] = createMarker(new GPoint(-73.49546700,41.36761100),"
Wooster School
91 Miry Brook Road
Danbury, CT 06810
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wooster School",'Danbury=' + Danbury.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53487300,41.05961200),"
Yeshiva Bais Binyomin
132 Prospect Street
Stamford, CT 06901
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Yeshiva Bais Binyomin",'Stamford=' + Stamford.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(Bridgeport); map.removeOverlays(Cos_Cob); map.removeOverlays(Danbury); map.removeOverlays(Easton); map.removeOverlays(Fairfield); map.removeOverlays(Greens_Farms); map.removeOverlays(Greenwich); map.removeOverlays(New_Canaan); map.removeOverlays(Norwalk); map.removeOverlays(Southport); map.removeOverlays(Stamford); map.removeOverlays(Trumbull); map.removeOverlays(Westport); 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(Bridgeport);map.removeOverlays(Bridgeport); map.removeOverlays(Cos_Cob); map.removeOverlays(Danbury); map.removeOverlays(Easton); map.removeOverlays(Fairfield); map.removeOverlays(Greens_Farms); map.removeOverlays(Greenwich); map.removeOverlays(New_Canaan); map.removeOverlays(Norwalk); map.removeOverlays(Southport); map.removeOverlays(Stamford); map.removeOverlays(Trumbull); map.removeOverlays(Westport); map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Cos_Cob); centerByArray(Cos_Cob, false, false); cntMarker += Cos_Cob.length; map.addOverlays(Danbury); centerByArray(Danbury, false, false); cntMarker += Danbury.length; map.addOverlays(Easton); centerByArray(Easton, false, false); cntMarker += Easton.length; map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Greens_Farms); centerByArray(Greens_Farms, false, false); cntMarker += Greens_Farms.length; map.addOverlays(Greenwich); centerByArray(Greenwich, false, false); cntMarker += Greenwich.length; map.addOverlays(New_Canaan); centerByArray(New_Canaan, false, false); cntMarker += New_Canaan.length; map.addOverlays(Norwalk); centerByArray(Norwalk, false, false); cntMarker += Norwalk.length; map.addOverlays(Southport); centerByArray(Southport, false, false); cntMarker += Southport.length; map.addOverlays(Stamford); centerByArray(Stamford, false, false); cntMarker += Stamford.length; map.addOverlays(Trumbull); centerByArray(Trumbull, false, false); cntMarker += Trumbull.length; map.addOverlays(Westport); centerByArray(Westport, false, false); cntMarker += Westport.length; centerByArray(Bridgeport,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; }