function addMarkers(){ mySelect = document.getElementById('selection'); Bennington = [];Dorset = [];Manchester = [];Bondville = [];North_Bennington = [];mySelect.options[mySelect.options.length] = new Option("Bennington schools",'all=Bennington'); mySelect.options[mySelect.options.length] = new Option("Bondville schools",'all=Bondville'); mySelect.options[mySelect.options.length] = new Option("Dorset schools",'all=Dorset'); mySelect.options[mySelect.options.length] = new Option("Manchester schools",'all=Manchester'); mySelect.options[mySelect.options.length] = new Option("North Bennington schools",'all=North_Bennington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bennington[Bennington.length] = createMarker(new GPoint(-73.18770000,42.88580000),"
Bennington Regional Day Progra
Catamount Elementary School
Bennington, VT 05201
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bennington Regional Day Progra",'Bennington=' + Bennington.length); Bennington[Bennington.length] = createMarker(new GPoint(-73.19507200,42.87998700),"
Bennington Regional Day Program
230 School Street
Bennington, VT 05201
Co-ed school, 3-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bennington Regional Day Program",'Bennington=' + Bennington.length); Bennington[Bennington.length] = createMarker(new GPoint(-73.22031900,42.88987200),"
Bennington School Inc
192 Fairview St.
Bennington, VT 05201
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bennington School Inc",'Bennington=' + Bennington.length); Bennington[Bennington.length] = createMarker(new GPoint(-73.20412400,42.91580800),"
Forrest Ward Memorial School
404 Houghton Lanae
Bennington, VT 05201
Co-ed school, 3-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forrest Ward Memorial School",'Bennington=' + Bennington.length); Bennington[Bennington.length] = createMarker(new GPoint(-73.19729700,42.89423700),"
Grace Christian School
104 Kocher Drive
Bennington, VT 05201
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Bennington=' + Bennington.length); Bennington[Bennington.length] = createMarker(new GPoint(-73.21019400,42.93155700),"
Hiland Hall School
2196 Harwood Hill Rd.
Bennington, VT 05201
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hiland Hall School",'Bennington=' + Bennington.length); Dorset[Dorset.length] = createMarker(new GPoint(-73.09603000,43.27128600),"
Long Trail School
1045 Kirby Hollow Road
Dorset, VT 05251
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Long Trail School",'Dorset=' + Dorset.length); Manchester[Manchester.length] = createMarker(new GPoint(-73.05794800,43.16930600),"
Maple Street School
322 Maple Street
Manchester, VT 05255
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maple Street School",'Manchester=' + Manchester.length); Bondville[Bondville.length] = createMarker(new GPoint(-72.88911600,43.14445500),"
The Mountain School At Winhall
9 School Street
Bondville, VT 05340
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Mountain School At Winhall",'Bondville=' + Bondville.length); Manchester[Manchester.length] = createMarker(new GPoint(-73.07270000,43.16360000),"
Northshire Christian Academy
Po Box 1063
Manchester, VT 05254
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northshire Christian Academy",'Manchester=' + Manchester.length); Bennington[Bennington.length] = createMarker(new GPoint(-73.19461200,42.88203600),"
The School Of Sacred Heart St Francis De Sales
307 School Street
Bennington, VT 05201
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The School Of Sacred Heart St Francis De Sales",'Bennington=' + Bennington.length); North_Bennington[North_Bennington.length] = createMarker(new GPoint(-73.24530200,42.93161900),"
Southshire Community School
24 Bank Street
North Bennington, VT 05257
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southshire Community School",'North_Bennington=' + North_Bennington.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/////1/' + showArray); map.removeOverlays(Bennington); map.removeOverlays(Bondville); map.removeOverlays(Dorset); map.removeOverlays(Manchester); map.removeOverlays(North_Bennington); 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(Bennington);map.removeOverlays(Bennington); map.removeOverlays(Bondville); map.removeOverlays(Dorset); map.removeOverlays(Manchester); map.removeOverlays(North_Bennington); map.addOverlays(Bennington); centerByArray(Bennington, false, false); cntMarker += Bennington.length; map.addOverlays(Bondville); centerByArray(Bondville, false, false); cntMarker += Bondville.length; map.addOverlays(Dorset); centerByArray(Dorset, false, false); cntMarker += Dorset.length; map.addOverlays(Manchester); centerByArray(Manchester, false, false); cntMarker += Manchester.length; map.addOverlays(North_Bennington); centerByArray(North_Bennington, false, false); cntMarker += North_Bennington.length; centerByArray(Bennington,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=1&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; }