function addMarkers(){ mySelect = document.getElementById('selection'); Baltic = [];Waterford = [];New_London = [];North_Stonington = [];Stonington = [];Uncasville = [];Oakdale = [];Groton = [];Norwich = [];Quaker_Hill = [];mySelect.options[mySelect.options.length] = new Option("Baltic schools",'all=Baltic'); mySelect.options[mySelect.options.length] = new Option("Groton schools",'all=Groton'); mySelect.options[mySelect.options.length] = new Option("New London schools",'all=New_London'); mySelect.options[mySelect.options.length] = new Option("North Stonington schools",'all=North_Stonington'); mySelect.options[mySelect.options.length] = new Option("Norwich schools",'all=Norwich'); mySelect.options[mySelect.options.length] = new Option("Oakdale schools",'all=Oakdale'); mySelect.options[mySelect.options.length] = new Option("Quaker Hill schools",'all=Quaker_Hill'); mySelect.options[mySelect.options.length] = new Option("Stonington schools",'all=Stonington'); mySelect.options[mySelect.options.length] = new Option("Uncasville schools",'all=Uncasville'); mySelect.options[mySelect.options.length] = new Option("Waterford schools",'all=Waterford'); 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); Waterford[Waterford.length] = createMarker(new GPoint(-72.17974800,41.40238000),"
Baptist Bible Academy
1144 Hartford Tpke
Waterford, CT 06385
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Baptist Bible Academy",'Waterford=' + Waterford.length); New_London[New_London.length] = createMarker(new GPoint(-72.11223100,41.35118600),"
Coastline Christian Academy
122 Colman Street
New London, CT 06320
Co-ed school, 10-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coastline Christian Academy",'New_London=' + New_London.length); North_Stonington[North_Stonington.length] = createMarker(new GPoint(-71.84434200,41.42919900),"
No Stonington Christian Academy
12 Stillman Rd
North Stonington, CT 06359
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("No Stonington Christian Academy",'North_Stonington=' + North_Stonington.length); Stonington[Stonington.length] = createMarker(new GPoint(-71.89402800,41.36673000),"
Pine Point School
89 Barnes Rd
Stonington, CT 06378
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Point School",'Stonington=' + Stonington.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); 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); Groton[Groton.length] = createMarker(new GPoint(-72.04675100,41.34632500),"
Stedfast Baptist Academy
1041 Poquonnock Road
Groton, CT 06340
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stedfast Baptist Academy",'Groton=' + Groton.length); North_Stonington[North_Stonington.length] = createMarker(new GPoint(-71.92594400,41.47329400),"
Stonington Institute School
75 Swantown Hill Road
North Stonington, CT 06359
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stonington Institute School",'North_Stonington=' + North_Stonington.length); Norwich[Norwich.length] = createMarker(new GPoint(-72.11240900,41.56088900),"
Thames Valley Clinical Day Programs
1 Ohio Avenue
Norwich, CT 06360
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thames Valley Clinical Day Programs",'Norwich=' + Norwich.length); Quaker_Hill[Quaker_Hill.length] = createMarker(new GPoint(-72.15310600,41.41469500),"
Waterford Country School
78 Hunts Brook Road
Quaker Hill, CT 06375
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waterford Country School",'Quaker_Hill=' + Quaker_Hill.length); New_London[New_London.length] = createMarker(new GPoint(-72.10314200,41.37646800),"
Williams School
182 Mohegan Avenue
New London, CT 06320
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Williams School",'New_London=' + New_London.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(Baltic); map.removeOverlays(Groton); map.removeOverlays(New_London); map.removeOverlays(North_Stonington); map.removeOverlays(Norwich); map.removeOverlays(Oakdale); map.removeOverlays(Quaker_Hill); map.removeOverlays(Stonington); map.removeOverlays(Uncasville); map.removeOverlays(Waterford); 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(Groton); map.removeOverlays(New_London); map.removeOverlays(North_Stonington); map.removeOverlays(Norwich); map.removeOverlays(Oakdale); map.removeOverlays(Quaker_Hill); map.removeOverlays(Stonington); map.removeOverlays(Uncasville); map.removeOverlays(Waterford); map.addOverlays(Baltic); centerByArray(Baltic, false, false); cntMarker += Baltic.length; map.addOverlays(Groton); centerByArray(Groton, false, false); cntMarker += Groton.length; map.addOverlays(New_London); centerByArray(New_London, false, false); cntMarker += New_London.length; map.addOverlays(North_Stonington); centerByArray(North_Stonington, false, false); cntMarker += North_Stonington.length; map.addOverlays(Norwich); centerByArray(Norwich, false, false); cntMarker += Norwich.length; map.addOverlays(Oakdale); centerByArray(Oakdale, false, false); cntMarker += Oakdale.length; map.addOverlays(Quaker_Hill); centerByArray(Quaker_Hill, false, false); cntMarker += Quaker_Hill.length; map.addOverlays(Stonington); centerByArray(Stonington, false, false); cntMarker += Stonington.length; map.addOverlays(Uncasville); centerByArray(Uncasville, false, false); cntMarker += Uncasville.length; map.addOverlays(Waterford); centerByArray(Waterford, false, false); cntMarker += Waterford.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////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; }