function addMarkers(){ mySelect = document.getElementById('selection'); Old_Saybrook = [];Middletown = [];Middlefield = [];Durham = [];Cromwell = [];Deep_River = [];East_Hampton = [];Westbrook = [];Killingworth = [];Portland = [];mySelect.options[mySelect.options.length] = new Option("Cromwell schools",'all=Cromwell'); mySelect.options[mySelect.options.length] = new Option("Deep River schools",'all=Deep_River'); mySelect.options[mySelect.options.length] = new Option("Durham schools",'all=Durham'); mySelect.options[mySelect.options.length] = new Option("East Hampton schools",'all=East_Hampton'); mySelect.options[mySelect.options.length] = new Option("Killingworth schools",'all=Killingworth'); mySelect.options[mySelect.options.length] = new Option("Middlefield schools",'all=Middlefield'); mySelect.options[mySelect.options.length] = new Option("Middletown schools",'all=Middletown'); mySelect.options[mySelect.options.length] = new Option("Old Saybrook schools",'all=Old_Saybrook'); mySelect.options[mySelect.options.length] = new Option("Portland schools",'all=Portland'); mySelect.options[mySelect.options.length] = new Option("Westbrook schools",'all=Westbrook'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Old_Saybrook[Old_Saybrook.length] = createMarker(new GPoint(-72.35942800,41.31866200),"
The Children's Tree Montessori School
96 Essex Road
Old Saybrook, CT 06475
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Children's Tree Montessori School",'Old_Saybrook=' + Old_Saybrook.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.60986000,41.53154000),"
Fellowship Christian Academy
30 Brooks Road
Middletown, CT 06457
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fellowship Christian Academy",'Middletown=' + Middletown.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.66984200,41.50494000),"
Gianelli's Early Learning Center
67 Round Hill Road
Middletown, CT 06457
school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gianelli's Early Learning Center",'Middletown=' + Middletown.length); Middlefield[Middlefield.length] = createMarker(new GPoint(-72.68839900,41.51028300),"
The Independent Day School
115 Laurel Brook Road
Middlefield, CT 06455
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Independent Day School",'Middlefield=' + Middlefield.length); Durham[Durham.length] = createMarker(new GPoint(-72.71088000,41.47214000),"
Lake Grove-durham School
459r Wallingford Road
Durham, CT 06422
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Grove-durham School",'Durham=' + Durham.length); Cromwell[Cromwell.length] = createMarker(new GPoint(-72.66773600,41.60227800),"
Learning Center At The Children's Home Of Cromwell
60 Hicksville Road
Cromwell, CT 06416
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Learning Center At The Children's Home Of Cromwell",'Cromwell=' + Cromwell.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.67221700,41.52578800),"
Little People's House
616 Long Hill Road
Middletown, CT 06457
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little People's House",'Middletown=' + Middletown.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.67520300,41.53135400),"
Mercy High School
1740 Randolph Road
Middletown, CT 06457
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mercy High School",'Middletown=' + Middletown.length); Deep_River[Deep_River.length] = createMarker(new GPoint(-72.42895300,41.39397800),"
Mt Saint John
135 Kirtland Street
Deep River, CT 06417
All-boys school, 8-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mt Saint John",'Deep_River=' + Deep_River.length); East_Hampton[East_Hampton.length] = createMarker(new GPoint(-72.54058200,41.56403700),"
My School
240 Middletown Ave
East Hampton, CT 06424
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("My School",'East_Hampton=' + East_Hampton.length); Cromwell[Cromwell.length] = createMarker(new GPoint(-72.66450000,41.61230000),"
Northwest Childrens Center
Po Box 131
Cromwell, CT 06416
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northwest Childrens Center",'Cromwell=' + Cromwell.length); Westbrook[Westbrook.length] = createMarker(new GPoint(-72.44295800,41.28343400),"
Oxford Academy
1393 Boston Post Road
Westbrook, CT 06498
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oxford Academy",'Westbrook=' + Westbrook.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.65262000,41.56045700),"
Roadside Academy
151 Broad Street
Middletown, CT 06457
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Roadside Academy",'Middletown=' + Middletown.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); Portland[Portland.length] = createMarker(new GPoint(-72.63765100,41.57171100),"
Rushford Academy
25 Marlborough Street
Portland, CT 06480
All-boys school, 9-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rushford Academy",'Portland=' + Portland.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.65272600,41.56630600),"
St. John School
5 St John Square
Middletown, CT 06457
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. John School",'Middletown=' + Middletown.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.64969700,41.54474100),"
St. Sebastian School
61 Durant Ter
Middletown, CT 06457
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Sebastian School",'Middletown=' + Middletown.length); Old_Saybrook[Old_Saybrook.length] = createMarker(new GPoint(-72.37891900,41.29177600),"
St John School
42 Maynard Road
Old Saybrook, CT 06475
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John School",'Old_Saybrook=' + Old_Saybrook.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.64894700,41.55496900),"
St Mary Of Czestochowa School
87 South Main Street
Middletown, CT 06457
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary Of Czestochowa School",'Middletown=' + Middletown.length); Middletown[Middletown.length] = createMarker(new GPoint(-72.62082800,41.53384600),"
Xavier High School
181 Randolph Road
Middletown, CT 06457
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Xavier High School",'Middletown=' + Middletown.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/////3/' + showArray); map.removeOverlays(Cromwell); map.removeOverlays(Deep_River); map.removeOverlays(Durham); map.removeOverlays(East_Hampton); map.removeOverlays(Killingworth); map.removeOverlays(Middlefield); map.removeOverlays(Middletown); map.removeOverlays(Old_Saybrook); map.removeOverlays(Portland); map.removeOverlays(Westbrook); 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(Old_Saybrook);map.removeOverlays(Cromwell); map.removeOverlays(Deep_River); map.removeOverlays(Durham); map.removeOverlays(East_Hampton); map.removeOverlays(Killingworth); map.removeOverlays(Middlefield); map.removeOverlays(Middletown); map.removeOverlays(Old_Saybrook); map.removeOverlays(Portland); map.removeOverlays(Westbrook); map.addOverlays(Cromwell); centerByArray(Cromwell, false, false); cntMarker += Cromwell.length; map.addOverlays(Deep_River); centerByArray(Deep_River, false, false); cntMarker += Deep_River.length; map.addOverlays(Durham); centerByArray(Durham, false, false); cntMarker += Durham.length; map.addOverlays(East_Hampton); centerByArray(East_Hampton, false, false); cntMarker += East_Hampton.length; map.addOverlays(Killingworth); centerByArray(Killingworth, false, false); cntMarker += Killingworth.length; map.addOverlays(Middlefield); centerByArray(Middlefield, false, false); cntMarker += Middlefield.length; map.addOverlays(Middletown); centerByArray(Middletown, false, false); cntMarker += Middletown.length; map.addOverlays(Old_Saybrook); centerByArray(Old_Saybrook, false, false); cntMarker += Old_Saybrook.length; map.addOverlays(Portland); centerByArray(Portland, false, false); cntMarker += Portland.length; map.addOverlays(Westbrook); centerByArray(Westbrook, false, false); cntMarker += Westbrook.length; centerByArray(Old_Saybrook,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=3&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; }