function addMarkers() { mySelect = document.getElementById('selection'); New_Haven = [];Hartford = [];Bridgeport = [];Fairfield = [];New_Britain = [];Winsted = [];Hamden = [];Norwich = [];New_London = [];Manchester = [];Norwalk = [];Stamford = [];mySelect.options[mySelect.options.length] = new Option("Bridgeport charter schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Fairfield charter schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Hamden charter schools",'all=Hamden'); mySelect.options[mySelect.options.length] = new Option("Hartford charter schools",'all=Hartford'); mySelect.options[mySelect.options.length] = new Option("Manchester charter schools",'all=Manchester'); mySelect.options[mySelect.options.length] = new Option("New Britain charter schools",'all=New_Britain'); mySelect.options[mySelect.options.length] = new Option("New Haven charter schools",'all=New_Haven'); mySelect.options[mySelect.options.length] = new Option("New London charter schools",'all=New_London'); mySelect.options[mySelect.options.length] = new Option("Norwalk charter schools",'all=Norwalk'); mySelect.options[mySelect.options.length] = new Option("Norwich charter schools",'all=Norwich'); mySelect.options[mySelect.options.length] = new Option("Stamford charter schools",'all=Stamford'); mySelect.options[mySelect.options.length] = new Option("Winsted charter schools",'all=Winsted'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.90393829,41.31402588),"
Amistad Academy
407 James St.
New Haven, CT 06513

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Amistad Academy",'New_Haven=' + New_Haven.length); Hartford[Hartford.length] = createMarker(new GPoint(-72.69787598,41.74923325),"
Breakthrough Charter School
111 Hillside Avenue
Hartford, CT 06106

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Breakthrough Charter School",'Hartford=' + Hartford.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.20680237,41.21030045),"
Bridge Academy
24 Rope Ferry Road
Bridgeport, CT 06608

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bridge Academy",'Bridgeport=' + Bridgeport.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-73.23358154,41.16895676),"
Brooklawn Academy
108 Biro Street
Fairfield, CT 06432

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brooklawn Academy",'Fairfield=' + Fairfield.length); New_Britain[New_Britain.length] = createMarker(new GPoint(-72.76665497,41.66239166),"
Charter Oak Prep Academy
74 Kelsey Street
New Britain, CT 06051

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charter Oak Prep Academy",'New_Britain=' + New_Britain.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.95864868,41.33936691),"
Common Ground High School
358 Springside Ave.
New Haven, CT 06515

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Common Ground High School",'New_Haven=' + New_Haven.length); New_Haven[New_Haven.length] = createMarker(new GPoint(-72.88787800,41.29958300),"
Elm City College Preparatory School
403 James Street
New Haven, CT 06513

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elm City College Preparatory School",'New_Haven=' + New_Haven.length); Winsted[Winsted.length] = createMarker(new GPoint(-72.96150208,41.86880493),"
Explorations High School
71 Spencer Street
Winsted, CT 06098

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Explorations High School",'Winsted=' + Winsted.length); Hamden[Hamden.length] = createMarker(new GPoint(-72.92169189,41.34641647),"
Highville Mustard Seed Charter School
130 Leederhill Dr.
Hamden, CT 06517

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highville Mustard Seed Charter School",'Hamden=' + Hamden.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.07642365,41.51115036),"
Integrated Day Charter School
68 Thermos Rd.
Norwich, CT 06360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Integrated Day Charter School",'Norwich=' + Norwich.length); New_London[New_London.length] = createMarker(new GPoint(-72.10002899,41.35586166),"
Interdistrict School For Arts And Communication
3 Gavin St.
New London, CT 06320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Interdistrict School For Arts And Communication",'New_London=' + New_London.length); Hartford[Hartford.length] = createMarker(new GPoint(-72.69760895,41.79142761),"
Jumoke Academy
250 Blue Hills Ave.
Hartford, CT 06112

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jumoke Academy",'Hartford=' + Hartford.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.17936707,41.18696213),"
New Beginnings Family Academy District
510 Barnum Ave.
Bridgeport, CT 06608

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Beginnings Family Academy District",'Bridgeport=' + Bridgeport.length); Manchester[Manchester.length] = createMarker(new GPoint(-72.51741028,41.80846405),"
Odyssey Community School
579 West Middle Turnpi
Manchester, CT 06040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Odyssey Community School",'Manchester=' + Manchester.length); Norwalk[Norwalk.length] = createMarker(new GPoint(-73.42036438,41.09596252),"
Side By Side Community School
10 Chestnut St.
Norwalk, CT 06854

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Side By Side Community School",'Norwalk=' + Norwalk.length); Hartford[Hartford.length] = createMarker(new GPoint(-72.68803406,41.76810074),"
Sports Science Academy
338 Asylum Street
Hartford, CT 06105

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sports Science Academy",'Hartford=' + Hartford.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53646800,41.05933200),"
Stamford Academy
229 North Street
Stamford, CT 06092

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stamford Academy",'Stamford=' + Stamford.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53900146,41.05350113),"
Trailblazers Academy
P.o. Box 15588
Stamford, CT 06901

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Trailblazers Academy",'Stamford=' + Stamford.length); maxLng = -72.07642365; maxLat = 41.86880493; minLng = -73.53900146; minLat = 41.05350113; reCenterMap(); map.removeOverlays(Bridgeport); map.removeOverlays(Fairfield); map.removeOverlays(Hamden); map.removeOverlays(Hartford); map.removeOverlays(Manchester); map.removeOverlays(New_Britain); map.removeOverlays(New_Haven); map.removeOverlays(New_London); map.removeOverlays(Norwalk); map.removeOverlays(Norwich); map.removeOverlays(Stamford); map.removeOverlays(Winsted); setTimeout(function(){map.addOverlays(Bridgeport)},1000); setTimeout(function(){map.addOverlays(Fairfield)},1000); setTimeout(function(){map.addOverlays(Hamden)},1000); setTimeout(function(){map.addOverlays(Hartford)},1000); setTimeout(function(){map.addOverlays(Manchester)},1000); setTimeout(function(){map.addOverlays(New_Britain)},1000); setTimeout(function(){map.addOverlays(New_Haven)},1000); setTimeout(function(){map.addOverlays(New_London)},1000); setTimeout(function(){map.addOverlays(Norwalk)},1000); setTimeout(function(){map.addOverlays(Norwich)},1000); setTimeout(function(){map.addOverlays(Stamford)},1000); setTimeout(function(){map.addOverlays(Winsted)},1000); } // 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(Bridgeport); map.removeOverlays(Fairfield); map.removeOverlays(Hamden); map.removeOverlays(Hartford); map.removeOverlays(Manchester); map.removeOverlays(New_Britain); map.removeOverlays(New_Haven); map.removeOverlays(New_London); map.removeOverlays(Norwalk); map.removeOverlays(Norwich); map.removeOverlays(Stamford); map.removeOverlays(Winsted); 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(New_Haven);map.removeOverlays(Bridgeport); map.removeOverlays(Fairfield); map.removeOverlays(Hamden); map.removeOverlays(Hartford); map.removeOverlays(Manchester); map.removeOverlays(New_Britain); map.removeOverlays(New_Haven); map.removeOverlays(New_London); map.removeOverlays(Norwalk); map.removeOverlays(Norwich); map.removeOverlays(Stamford); map.removeOverlays(Winsted); map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Hamden); centerByArray(Hamden, false, false); cntMarker += Hamden.length; map.addOverlays(Hartford); centerByArray(Hartford, false, false); cntMarker += Hartford.length; map.addOverlays(Manchester); centerByArray(Manchester, false, false); cntMarker += Manchester.length; map.addOverlays(New_Britain); centerByArray(New_Britain, false, false); cntMarker += New_Britain.length; map.addOverlays(New_Haven); centerByArray(New_Haven, false, false); cntMarker += New_Haven.length; map.addOverlays(New_London); centerByArray(New_London, false, false); cntMarker += New_London.length; map.addOverlays(Norwalk); centerByArray(Norwalk, false, false); cntMarker += Norwalk.length; map.addOverlays(Norwich); centerByArray(Norwich, false, false); cntMarker += Norwich.length; map.addOverlays(Stamford); centerByArray(Stamford, false, false); cntMarker += Stamford.length; map.addOverlays(Winsted); centerByArray(Winsted, false, false); cntMarker += Winsted.length; centerByArray(New_Haven,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'); } }