function addMarkers(){ mySelect = document.getElementById('selection'); Milford = [];Bridgeport = [];Trumbull = [];New_London = [];West_Haven = [];Bloomfield = [];Windsor = [];Stamford = [];Hartford = [];Bolton = [];West_Simsbury = [];Danbury = [];Norwalk = [];Killingworth = [];Madison = [];Putnam = [];Waterbury = [];Hamden = [];mySelect.options[mySelect.options.length] = new Option("Bloomfield schools",'all=Bloomfield'); mySelect.options[mySelect.options.length] = new Option("Bolton schools",'all=Bolton'); mySelect.options[mySelect.options.length] = new Option("Bridgeport schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Danbury schools",'all=Danbury'); mySelect.options[mySelect.options.length] = new Option("Hamden schools",'all=Hamden'); mySelect.options[mySelect.options.length] = new Option("Hartford schools",'all=Hartford'); mySelect.options[mySelect.options.length] = new Option("Killingworth schools",'all=Killingworth'); mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("New London schools",'all=New_London'); mySelect.options[mySelect.options.length] = new Option("Norwalk schools",'all=Norwalk'); mySelect.options[mySelect.options.length] = new Option("Putnam schools",'all=Putnam'); 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("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("Windsor schools",'all=Windsor'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); 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); 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); 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); 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); West_Haven[West_Haven.length] = createMarker(new GPoint(-93.01152000,34.61184000),"
Covenant Christian Academy
126 Prindle Hill Road
West Haven, CT 06516
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covenant Christian Academy",'West_Haven=' + West_Haven.length); Bloomfield[Bloomfield.length] = createMarker(new GPoint(-72.69892800,41.83539400),"
The First Academy
1151 Blue Hills Avenue
Bloomfield, CT 06002
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The First Academy",'Bloomfield=' + Bloomfield.length); Windsor[Windsor.length] = createMarker(new GPoint(-72.63876400,41.85689100),"
First Church Nursery School
107 Palisado Avenue
Windsor, CT 06095
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Church Nursery School",'Windsor=' + Windsor.length); Stamford[Stamford.length] = createMarker(new GPoint(-73.54793600,41.09218200),"
Grace Christian School
602 High Ridge Road
Stamford, CT 06905
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Stamford=' + Stamford.length); Hartford[Hartford.length] = createMarker(new GPoint(-72.68548600,41.73738000),"
Hartford Christian School
830 Maple Ave
Hartford, CT 06114
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hartford Christian School",'Hartford=' + Hartford.length); Bolton[Bolton.length] = createMarker(new GPoint(-72.44270000,41.77380000),"
The King's School
Po Box 9175 104 Notch Road
Bolton, CT 06043
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The King's School",'Bolton=' + Bolton.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); 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); Norwalk[Norwalk.length] = createMarker(new GPoint(-73.45238300,41.13320600),"
Parkway Christian Academy Happy Time Nursery
260 New Canaan Avenue
Norwalk, CT 06850
Co-ed school, 5-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parkway Christian Academy Happy Time Nursery",'Norwalk=' + Norwalk.length); Windsor[Windsor.length] = createMarker(new GPoint(-72.66820000,41.86040000),"
Praise, Power & Prayer Christian School
Po Box 474 209 Kennedy Road
Windsor, CT 06095
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Praise, Power & Prayer Christian School",'Windsor=' + Windsor.length); Killingworth[Killingworth.length] = createMarker(new GPoint(-72.57500000,41.36960000),"
Rock Christian Academy
138 Route 81
Killingworth, CT 06419
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock Christian Academy",'Killingworth=' + Killingworth.length); Madison[Madison.length] = createMarker(new GPoint(-72.63475600,41.35304600),"
The Shoreline Christian School
1185 Durham Road
Madison, CT 06443
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Shoreline Christian School",'Madison=' + Madison.length); New_London[New_London.length] = createMarker(new GPoint(-72.10597600,41.34430200),"
St Joseph School
25 Squire Street
New London, CT 06320
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph School",'New_London=' + New_London.length); Putnam[Putnam.length] = createMarker(new GPoint(-71.81783800,41.91257000),"
Tri-state Christian Academy
250 E Putnam Road
Putnam, CT 06260
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-state Christian Academy",'Putnam=' + Putnam.length); Waterbury[Waterbury.length] = createMarker(new GPoint(-73.04362600,41.55789700),"
Trinity Academy Inc
24 Central Avenue
Waterbury, CT 06702
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Academy Inc",'Waterbury=' + Waterbury.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); map.removeOverlays(Bloomfield); map.removeOverlays(Bolton); map.removeOverlays(Bridgeport); map.removeOverlays(Danbury); map.removeOverlays(Hamden); map.removeOverlays(Hartford); map.removeOverlays(Killingworth); map.removeOverlays(Madison); map.removeOverlays(Milford); map.removeOverlays(New_London); map.removeOverlays(Norwalk); map.removeOverlays(Putnam); map.removeOverlays(Stamford); map.removeOverlays(Trumbull); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.removeOverlays(West_Simsbury); map.removeOverlays(Windsor); setTimeout(function(){map.addOverlays(Bloomfield)},1000); setTimeout(function(){map.addOverlays(Bolton)},1000); setTimeout(function(){map.addOverlays(Bridgeport)},1000); setTimeout(function(){map.addOverlays(Danbury)},1000); setTimeout(function(){map.addOverlays(Hamden)},1000); setTimeout(function(){map.addOverlays(Hartford)},1000); setTimeout(function(){map.addOverlays(Killingworth)},1000); setTimeout(function(){map.addOverlays(Madison)},1000); setTimeout(function(){map.addOverlays(Milford)},1000); setTimeout(function(){map.addOverlays(New_London)},1000); setTimeout(function(){map.addOverlays(Norwalk)},1000); setTimeout(function(){map.addOverlays(Putnam)},1000); setTimeout(function(){map.addOverlays(Stamford)},1000); setTimeout(function(){map.addOverlays(Trumbull)},1000); setTimeout(function(){map.addOverlays(Waterbury)},1000); setTimeout(function(){map.addOverlays(West_Haven)},1000); setTimeout(function(){map.addOverlays(West_Simsbury)},1000); setTimeout(function(){map.addOverlays(Windsor)},1000); maxLng = -71.81783800; maxLat = 41.91257000; minLng = -93.01152000; minLat = 34.61184000; 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(Bloomfield); map.removeOverlays(Bolton); map.removeOverlays(Bridgeport); map.removeOverlays(Danbury); map.removeOverlays(Hamden); map.removeOverlays(Hartford); map.removeOverlays(Killingworth); map.removeOverlays(Madison); map.removeOverlays(Milford); map.removeOverlays(New_London); map.removeOverlays(Norwalk); map.removeOverlays(Putnam); map.removeOverlays(Stamford); map.removeOverlays(Trumbull); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.removeOverlays(West_Simsbury); map.removeOverlays(Windsor); 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(Bloomfield); map.removeOverlays(Bolton); map.removeOverlays(Bridgeport); map.removeOverlays(Danbury); map.removeOverlays(Hamden); map.removeOverlays(Hartford); map.removeOverlays(Killingworth); map.removeOverlays(Madison); map.removeOverlays(Milford); map.removeOverlays(New_London); map.removeOverlays(Norwalk); map.removeOverlays(Putnam); map.removeOverlays(Stamford); map.removeOverlays(Trumbull); map.removeOverlays(Waterbury); map.removeOverlays(West_Haven); map.removeOverlays(West_Simsbury); map.removeOverlays(Windsor); map.addOverlays(Bloomfield); centerByArray(Bloomfield, false, false); cntMarker += Bloomfield.length; map.addOverlays(Bolton); centerByArray(Bolton, false, false); cntMarker += Bolton.length; map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Danbury); centerByArray(Danbury, false, false); cntMarker += Danbury.length; map.addOverlays(Hamden); centerByArray(Hamden, false, false); cntMarker += Hamden.length; map.addOverlays(Hartford); centerByArray(Hartford, false, false); cntMarker += Hartford.length; map.addOverlays(Killingworth); centerByArray(Killingworth, false, false); cntMarker += Killingworth.length; map.addOverlays(Madison); centerByArray(Madison, false, false); cntMarker += Madison.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.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(Putnam); centerByArray(Putnam, false, false); cntMarker += Putnam.length; map.addOverlays(Stamford); centerByArray(Stamford, false, false); cntMarker += Stamford.length; map.addOverlays(Trumbull); centerByArray(Trumbull, false, false); cntMarker += Trumbull.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; map.addOverlays(Windsor); centerByArray(Windsor, false, false); cntMarker += Windsor.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///5572,31035,5402,5598,5342,5281,5301,5299,5576,5426,5324,5572,5402,5598,5342,5431,5579,5281,5503,5420,5585,5331,5299,5586,5310,5380,5576,5631,5426,/all'); //window.open('/map.php?type=2&schools=5572,31035,5402,5598,5342,5281,5301,5299,5576,5426,5324,5572,5402,5598,5342,5431,5579,5281,5503,5420,5585,5331,5299,5586,5310,5380,5576,5631,5426,&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; }