function addMarkers(){ mySelect = document.getElementById('selection'); Mechanicville = [];Ballston_Lake = [];Burnt_Hills = [];Clifton_Park = [];Hadley = [];Saratoga_Springs = [];Ballston_Spa = [];Waterford = [];Saratoga = [];mySelect.options[mySelect.options.length] = new Option("Ballston Lake schools",'all=Ballston_Lake'); mySelect.options[mySelect.options.length] = new Option("Ballston Spa schools",'all=Ballston_Spa'); mySelect.options[mySelect.options.length] = new Option("Burnt Hills schools",'all=Burnt_Hills'); mySelect.options[mySelect.options.length] = new Option("Clifton Park schools",'all=Clifton_Park'); mySelect.options[mySelect.options.length] = new Option("Hadley schools",'all=Hadley'); mySelect.options[mySelect.options.length] = new Option("Mechanicville schools",'all=Mechanicville'); mySelect.options[mySelect.options.length] = new Option("Saratoga schools",'all=Saratoga'); mySelect.options[mySelect.options.length] = new Option("Saratoga Springs schools",'all=Saratoga_Springs'); mySelect.options[mySelect.options.length] = new Option("Waterford schools",'all=Waterford'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mechanicville[Mechanicville.length] = createMarker(new GPoint(-73.68458200,42.90447700),"
Community Christian Academy
90 River Rd
Mechanicville, NY 12118
Co-ed school, 7-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Community Christian Academy",'Mechanicville=' + Mechanicville.length); Ballston_Lake[Ballston_Lake.length] = createMarker(new GPoint(-73.82535600,42.93748600),"
Fellowship Christian Academy
184 Eastline Road
Ballston Lake, NY 12019
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fellowship Christian Academy",'Ballston_Lake=' + Ballston_Lake.length); Burnt_Hills[Burnt_Hills.length] = createMarker(new GPoint(-73.90414000,42.90978000),"
Ketchum-grande School
322 Lake Hill Road
Burnt Hills, NY 12027
All-girls school, 8-11
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ketchum-grande School",'Burnt_Hills=' + Burnt_Hills.length); Clifton_Park[Clifton_Park.length] = createMarker(new GPoint(-73.82130100,42.86770400),"
Kindercare Learning Center
518 Vischer Ferry Road
Clifton Park, NY 12065
Co-ed school, PK-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Center",'Clifton_Park=' + Clifton_Park.length); Hadley[Hadley.length] = createMarker(new GPoint(-73.83292500,43.28459900),"
The Kings School
6087 State Route 9n
Hadley, NY 12835
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Kings School",'Hadley=' + Hadley.length); Saratoga_Springs[Saratoga_Springs.length] = createMarker(new GPoint(-73.76696000,43.08464500),"
St. Clement's Regional Catholic
231 Lake Avenue
Saratoga Springs, NY 12866
Co-ed school, NS-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Clement's Regional Catholic",'Saratoga_Springs=' + Saratoga_Springs.length); Ballston_Spa[Ballston_Spa.length] = createMarker(new GPoint(-73.85025400,43.00610500),"
St. Mary S School
40 Thompson Street
Ballston Spa, NY 12020
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary S School",'Ballston_Spa=' + Ballston_Spa.length); Waterford[Waterford.length] = createMarker(new GPoint(-73.68111000,42.79170800),"
St. Mary's School
12 6th Street
Waterford, NY 12188
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary's School",'Waterford=' + Waterford.length); Saratoga_Springs[Saratoga_Springs.length] = createMarker(new GPoint(-73.78807100,43.07271500),"
Saratoga Central Catholic High School
247 Broadway
Saratoga Springs, NY 12866
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saratoga Central Catholic High School",'Saratoga_Springs=' + Saratoga_Springs.length); Saratoga[Saratoga.length] = createMarker(new GPoint(-73.76920000,43.07630000),"
Saratoga Hansel & Gretel
66 Seward Street
Saratoga, NY 12866
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saratoga Hansel & Gretel",'Saratoga=' + Saratoga.length); Saratoga_Springs[Saratoga_Springs.length] = createMarker(new GPoint(-73.73052600,43.08520100),"
Saratoga Independent School
459 Lake Avenue
Saratoga Springs, NY 12866
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saratoga Independent School",'Saratoga_Springs=' + Saratoga_Springs.length); Ballston_Spa[Ballston_Spa.length] = createMarker(new GPoint(-73.85828600,43.02619300),"
Spa Christian School
206 Greenfield Avenue
Ballston Spa, NY 12020
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spa Christian School",'Ballston_Spa=' + Ballston_Spa.length); Saratoga_Springs[Saratoga_Springs.length] = createMarker(new GPoint(-73.78194800,43.07661900),"
Waldorf School of Saratoga Springs
122 Regent Street
Saratoga Springs, NY 12866
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Waldorf School of Saratoga Springs",'Saratoga_Springs=' + Saratoga_Springs.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(Ballston_Lake); map.removeOverlays(Ballston_Spa); map.removeOverlays(Burnt_Hills); map.removeOverlays(Clifton_Park); map.removeOverlays(Hadley); map.removeOverlays(Mechanicville); map.removeOverlays(Saratoga); map.removeOverlays(Saratoga_Springs); 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(Mechanicville);map.removeOverlays(Ballston_Lake); map.removeOverlays(Ballston_Spa); map.removeOverlays(Burnt_Hills); map.removeOverlays(Clifton_Park); map.removeOverlays(Hadley); map.removeOverlays(Mechanicville); map.removeOverlays(Saratoga); map.removeOverlays(Saratoga_Springs); map.removeOverlays(Waterford); map.addOverlays(Ballston_Lake); centerByArray(Ballston_Lake, false, false); cntMarker += Ballston_Lake.length; map.addOverlays(Ballston_Spa); centerByArray(Ballston_Spa, false, false); cntMarker += Ballston_Spa.length; map.addOverlays(Burnt_Hills); centerByArray(Burnt_Hills, false, false); cntMarker += Burnt_Hills.length; map.addOverlays(Clifton_Park); centerByArray(Clifton_Park, false, false); cntMarker += Clifton_Park.length; map.addOverlays(Hadley); centerByArray(Hadley, false, false); cntMarker += Hadley.length; map.addOverlays(Mechanicville); centerByArray(Mechanicville, false, false); cntMarker += Mechanicville.length; map.addOverlays(Saratoga); centerByArray(Saratoga, false, false); cntMarker += Saratoga.length; map.addOverlays(Saratoga_Springs); centerByArray(Saratoga_Springs, false, false); cntMarker += Saratoga_Springs.length; map.addOverlays(Waterford); centerByArray(Waterford, false, false); cntMarker += Waterford.length; centerByArray(Mechanicville,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; }