function addMarkers(){ mySelect = document.getElementById('selection'); Baltic = [];Bridgeport = [];New_Milford = [];Cheshire = [];Greenwich = [];Waterbury = [];Kent = [];West_Haven = [];West_Simsbury = [];Madison = [];Uncasville = [];Stamford = [];Stratford = [];Oakdale = [];Manchester = [];Middlebury = [];mySelect.options[mySelect.options.length] = new Option("Baltic schools",'all=Baltic'); mySelect.options[mySelect.options.length] = new Option("Bridgeport schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Cheshire schools",'all=Cheshire'); mySelect.options[mySelect.options.length] = new Option("Greenwich schools",'all=Greenwich'); mySelect.options[mySelect.options.length] = new Option("Kent schools",'all=Kent'); mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison'); mySelect.options[mySelect.options.length] = new Option("Manchester schools",'all=Manchester'); mySelect.options[mySelect.options.length] = new Option("Middlebury schools",'all=Middlebury'); mySelect.options[mySelect.options.length] = new Option("New Milford schools",'all=New_Milford'); mySelect.options[mySelect.options.length] = new Option("Oakdale schools",'all=Oakdale'); mySelect.options[mySelect.options.length] = new Option("Stamford schools",'all=Stamford'); mySelect.options[mySelect.options.length] = new Option("Stratford schools",'all=Stratford'); mySelect.options[mySelect.options.length] = new Option("Uncasville schools",'all=Uncasville'); 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("West Simsbury schools",'all=West_Simsbury'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Baltic[Baltic.length] = createMarker(new GPoint(-72.08453500,41.61682500),"
Academy Of The Holy Family
54 W Main St. Box 691
Baltic, CT 06330
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Academy Of The Holy Family",'Baltic=' + Baltic.length); 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); New_Milford[New_Milford.length] = createMarker(new GPoint(-73.41263400,41.58564900),"
Canterbury School
101 Aspetuck
New Milford, CT 06776
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Canterbury School",'New_Milford=' + New_Milford.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); 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); 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); Kent[Kent.length] = createMarker(new GPoint(-73.47267400,41.72670000),"
Kent School
Po Box 2006 I Macedonia Road
Kent, CT 06757
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kent School",'Kent=' + Kent.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); West_Haven[West_Haven.length] = createMarker(new GPoint(-72.97650000,41.27690600),"
Living Word Christian Academy
225 Meloy Rd
West Haven, CT 06516
Co-ed school, NS-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Living Word Christian Academy",'West_Haven=' + West_Haven.length); West_Simsbury[West_Simsbury.length] = createMarker(new GPoint(-72.86282100,41.87716600),"
The Master's School
36 Westledge Rd
West Simsbury, CT 06092
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Master's School",'West_Simsbury=' + West_Simsbury.length); Madison[Madison.length] = createMarker(new GPoint(-72.63562900,41.27260800),"
Our Lady Of Mercy School
149 Neck Road
Madison, CT 06443
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Mercy School",'Madison=' + Madison.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.22523200,41.15631100),"
St. Ann School
521 Brewster St
Bridgeport, CT 06605
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Ann School",'Bridgeport=' + Bridgeport.length); Uncasville[Uncasville.length] = createMarker(new GPoint(-72.10283200,41.46822800),"
St. Bernard School
1593 Norwich New London Tpke
Uncasville, CT 06382
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Bernard School",'Uncasville=' + Uncasville.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.53108400,41.10015500),"
St. Cecilia Elementary School
1186 Newfield Avenue
Stamford, CT 06905
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Cecilia Elementary School",'Stamford=' + Stamford.length); Stratford[Stratford.length] = createMarker(new GPoint(-73.12985600,41.22792900),"
St. Mark Elementary School
500 Wigwam Lane
Stratford, CT 06614
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mark Elementary School",'Stratford=' + Stratford.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-73.21521300,41.17618900),"
St. Peter School
659 Beechwood Ave
Bridgeport, CT 06605
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peter School",'Bridgeport=' + Bridgeport.length); Oakdale[Oakdale.length] = createMarker(new GPoint(-72.21384900,41.51450100),"
St. Thomas More School
45 Cottage Road
Oakdale, CT 06370
All-boys school, 8-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Thomas More School",'Oakdale=' + Oakdale.length); Manchester[Manchester.length] = createMarker(new GPoint(-72.52410800,41.77045300),"
St James School
73 Park Street
Manchester, CT 06040
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St James School",'Manchester=' + Manchester.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); map.removeOverlays(Baltic); map.removeOverlays(Bridgeport); map.removeOverlays(Cheshire); map.removeOverlays(Greenwich); map.removeOverlays(Kent); map.removeOverlays(Madison); map.removeOverlays(Manchester); map.removeOverlays(Middlebury); map.removeOverlays(New_Milford); map.removeOverlays(Oakdale); map.removeOverlays(Stamford); map.removeOverlays(Stratford); map.removeOverlays(Uncasville); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.removeOverlays(West_Simsbury); setTimeout(function(){map.addOverlays(Baltic)},1000); setTimeout(function(){map.addOverlays(Bridgeport)},1000); setTimeout(function(){map.addOverlays(Cheshire)},1000); setTimeout(function(){map.addOverlays(Greenwich)},1000); setTimeout(function(){map.addOverlays(Kent)},1000); setTimeout(function(){map.addOverlays(Madison)},1000); setTimeout(function(){map.addOverlays(Manchester)},1000); setTimeout(function(){map.addOverlays(Middlebury)},1000); setTimeout(function(){map.addOverlays(New_Milford)},1000); setTimeout(function(){map.addOverlays(Oakdale)},1000); setTimeout(function(){map.addOverlays(Stamford)},1000); setTimeout(function(){map.addOverlays(Stratford)},1000); setTimeout(function(){map.addOverlays(Uncasville)},1000); setTimeout(function(){map.addOverlays(Waterbury)},1000); setTimeout(function(){map.addOverlays(West_Haven)},1000); setTimeout(function(){map.addOverlays(West_Simsbury)},1000); maxLng = -72.08453500; maxLat = 41.87716600; minLng = -73.69725500; minLat = 41.06922700; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Baltic); map.removeOverlays(Bridgeport); map.removeOverlays(Cheshire); map.removeOverlays(Greenwich); map.removeOverlays(Kent); map.removeOverlays(Madison); map.removeOverlays(Manchester); map.removeOverlays(Middlebury); map.removeOverlays(New_Milford); map.removeOverlays(Oakdale); map.removeOverlays(Stamford); map.removeOverlays(Stratford); map.removeOverlays(Uncasville); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.removeOverlays(West_Simsbury); 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(Baltic);map.removeOverlays(Baltic); map.removeOverlays(Bridgeport); map.removeOverlays(Cheshire); map.removeOverlays(Greenwich); map.removeOverlays(Kent); map.removeOverlays(Madison); map.removeOverlays(Manchester); map.removeOverlays(Middlebury); map.removeOverlays(New_Milford); map.removeOverlays(Oakdale); map.removeOverlays(Stamford); map.removeOverlays(Stratford); map.removeOverlays(Uncasville); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.removeOverlays(West_Simsbury); map.addOverlays(Baltic); centerByArray(Baltic, false, false); cntMarker += Baltic.length; map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Cheshire); centerByArray(Cheshire, false, false); cntMarker += Cheshire.length; map.addOverlays(Greenwich); centerByArray(Greenwich, false, false); cntMarker += Greenwich.length; map.addOverlays(Kent); centerByArray(Kent, false, false); cntMarker += Kent.length; map.addOverlays(Madison); centerByArray(Madison, false, false); cntMarker += Madison.length; map.addOverlays(Manchester); centerByArray(Manchester, false, false); cntMarker += Manchester.length; map.addOverlays(Middlebury); centerByArray(Middlebury, false, false); cntMarker += Middlebury.length; map.addOverlays(New_Milford); centerByArray(New_Milford, false, false); cntMarker += New_Milford.length; map.addOverlays(Oakdale); centerByArray(Oakdale, false, false); cntMarker += Oakdale.length; map.addOverlays(Stamford); centerByArray(Stamford, false, false); cntMarker += Stamford.length; map.addOverlays(Stratford); centerByArray(Stratford, false, false); cntMarker += Stratford.length; map.addOverlays(Uncasville); centerByArray(Uncasville, false, false); cntMarker += Uncasville.length; map.addOverlays(Waterbury); centerByArray(Waterbury, false, false); cntMarker += Waterbury.length; map.addOverlays(West_Haven); centerByArray(West_Haven, false, false); cntMarker += West_Haven.length; map.addOverlays(West_Simsbury); centerByArray(West_Simsbury, false, false); cntMarker += West_Simsbury.length; centerByArray(Baltic,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///5272,31035,5372,5564,5306,5368,5600,5290,5549,5472,5349,5576,5466,5538,5564,5306,5415,5491,5480,5515,5472,5380,5576,/all'); //window.open('/map.php?type=2&schools=5272,31035,5372,5564,5306,5368,5600,5290,5549,5472,5349,5576,5466,5538,5564,5306,5415,5491,5480,5515,5472,5380,5576,&school_level=&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; }