function addMarkers(){ mySelect = document.getElementById('selection'); Williston = [];East_Burke = [];Barre = [];Wolcott = [];Killington = [];Dorset = [];Montpelier = [];Vershire = [];Stowe = [];Highgate_Center = [];Ludlow = [];Lyndonville = [];Stratton_Mountain = [];Quechee = [];Chelsea = [];Jeffersonville = [];mySelect.options[mySelect.options.length] = new Option("Barre schools",'all=Barre'); mySelect.options[mySelect.options.length] = new Option("Chelsea schools",'all=Chelsea'); mySelect.options[mySelect.options.length] = new Option("Dorset schools",'all=Dorset'); mySelect.options[mySelect.options.length] = new Option("East Burke schools",'all=East_Burke'); mySelect.options[mySelect.options.length] = new Option("Highgate Center schools",'all=Highgate_Center'); mySelect.options[mySelect.options.length] = new Option("Jeffersonville schools",'all=Jeffersonville'); mySelect.options[mySelect.options.length] = new Option("Killington schools",'all=Killington'); mySelect.options[mySelect.options.length] = new Option("Ludlow schools",'all=Ludlow'); mySelect.options[mySelect.options.length] = new Option("Lyndonville schools",'all=Lyndonville'); mySelect.options[mySelect.options.length] = new Option("Montpelier schools",'all=Montpelier'); mySelect.options[mySelect.options.length] = new Option("Quechee schools",'all=Quechee'); mySelect.options[mySelect.options.length] = new Option("Stowe schools",'all=Stowe'); mySelect.options[mySelect.options.length] = new Option("Stratton Mountain schools",'all=Stratton_Mountain'); mySelect.options[mySelect.options.length] = new Option("Vershire schools",'all=Vershire'); mySelect.options[mySelect.options.length] = new Option("Williston schools",'all=Williston'); mySelect.options[mySelect.options.length] = new Option("Wolcott schools",'all=Wolcott'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Williston[Williston.length] = createMarker(new GPoint(-73.12773900,44.44724600),"
The Bellwether School
1186 South Brownell Road
Williston, VT 05495
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Bellwether School",'Williston=' + Williston.length); East_Burke[East_Burke.length] = createMarker(new GPoint(-71.91990000,44.59030000),"
Burke Mountain Academy
Po Box 78
East Burke, VT 05832
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Burke Mountain Academy",'East_Burke=' + East_Burke.length); Barre[Barre.length] = createMarker(new GPoint(-72.49760000,44.19510000),"
Central Vermont Academy
317 Vine Street - Berlin
Barre, VT 05641
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Vermont Academy",'Barre=' + Barre.length); Wolcott[Wolcott.length] = createMarker(new GPoint(-72.45820100,44.54424100),"
Green Mtn Waldorf School
28 Railroad Street
Wolcott, VT 05680
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Green Mtn Waldorf School",'Wolcott=' + Wolcott.length); Williston[Williston.length] = createMarker(new GPoint(-73.10020000,44.43970000),"
Hope Christian Academy
Po Box 608
Williston, VT 05495
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hope Christian Academy",'Williston=' + Williston.length); Killington[Killington.length] = createMarker(new GPoint(-72.79051800,43.63617300),"
Killington Mountain School
2708 Killington Road
Killington, VT 05751
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Killington Mountain School",'Killington=' + Killington.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); Montpelier[Montpelier.length] = createMarker(new GPoint(-72.58529300,44.24783400),"
Montpelier Waldorf Child's Garden
155 Northfield Street
Montpelier, VT 05602
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montpelier Waldorf Child's Garden",'Montpelier=' + Montpelier.length); Vershire[Vershire.length] = createMarker(new GPoint(-72.33613800,43.95413800),"
The Mountain School Program Of
151 Mountain School Rd
Vershire, VT 05079
Co-ed school, 11-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Mountain School Program Of",'Vershire=' + Vershire.length); Stowe[Stowe.length] = createMarker(new GPoint(-72.77538300,44.53138900),"
Mt Mansfield Winter Academy
Po Box 3269
Stowe, VT 05672
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Mansfield Winter Academy",'Stowe=' + Stowe.length); Highgate_Center[Highgate_Center.length] = createMarker(new GPoint(-72.98287300,44.96400300),"
New Testament Christian Academy
2071 Franklin Rd.
Highgate Center, VT 05459
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Testament Christian Academy",'Highgate_Center=' + Highgate_Center.length); Stowe[Stowe.length] = createMarker(new GPoint(-72.72900900,44.49002000),"
North American Hockey Academy
Po Box 1197
Stowe, VT 05672
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North American Hockey Academy",'Stowe=' + Stowe.length); Ludlow[Ludlow.length] = createMarker(new GPoint(-72.68978700,43.39683700),"
Okemo Mountain School
53 Main Street
Ludlow, VT 05149
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Okemo Mountain School",'Ludlow=' + Ludlow.length); Lyndonville[Lyndonville.length] = createMarker(new GPoint(-71.99482900,44.51348900),"
The Riverside School
30 Lily Pond Road
Lyndonville, VT 05851
Co-ed school, 2-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Riverside School",'Lyndonville=' + Lyndonville.length); Stratton_Mountain[Stratton_Mountain.length] = createMarker(new GPoint(-72.81385000,43.19177600),"
Stratton Mountain School
World Cup Circle
Stratton Mountain, VT 05155
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stratton Mountain School",'Stratton_Mountain=' + Stratton_Mountain.length); Quechee[Quechee.length] = createMarker(new GPoint(-72.42010000,43.64680000),"
Upper Valley Waldorf School
Po Box 709
Quechee, VT 05059
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upper Valley Waldorf School",'Quechee=' + Quechee.length); Chelsea[Chelsea.length] = createMarker(new GPoint(-72.46080000,43.99180000),"
Wellspring School, Inc.
Po Box 291
Chelsea, VT 05038
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wellspring School, Inc.",'Chelsea=' + Chelsea.length); Jeffersonville[Jeffersonville.length] = createMarker(new GPoint(-72.89776300,44.68820000),"
West Farm School
Po Box 228
Jeffersonville, VT 05464
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Farm School",'Jeffersonville=' + Jeffersonville.length); map.removeOverlays(Barre); map.removeOverlays(Chelsea); map.removeOverlays(Dorset); map.removeOverlays(East_Burke); map.removeOverlays(Highgate_Center); map.removeOverlays(Jeffersonville); map.removeOverlays(Killington); map.removeOverlays(Ludlow); map.removeOverlays(Lyndonville); map.removeOverlays(Montpelier); map.removeOverlays(Quechee); map.removeOverlays(Stowe); map.removeOverlays(Stratton_Mountain); map.removeOverlays(Vershire); map.removeOverlays(Williston); map.removeOverlays(Wolcott); setTimeout(function(){map.addOverlays(Barre)},1000); setTimeout(function(){map.addOverlays(Chelsea)},1000); setTimeout(function(){map.addOverlays(Dorset)},1000); setTimeout(function(){map.addOverlays(East_Burke)},1000); setTimeout(function(){map.addOverlays(Highgate_Center)},1000); setTimeout(function(){map.addOverlays(Jeffersonville)},1000); setTimeout(function(){map.addOverlays(Killington)},1000); setTimeout(function(){map.addOverlays(Ludlow)},1000); setTimeout(function(){map.addOverlays(Lyndonville)},1000); setTimeout(function(){map.addOverlays(Montpelier)},1000); setTimeout(function(){map.addOverlays(Quechee)},1000); setTimeout(function(){map.addOverlays(Stowe)},1000); setTimeout(function(){map.addOverlays(Stratton_Mountain)},1000); setTimeout(function(){map.addOverlays(Vershire)},1000); setTimeout(function(){map.addOverlays(Williston)},1000); setTimeout(function(){map.addOverlays(Wolcott)},1000); maxLng = -71.91990000; maxLat = 44.96400300; minLng = -73.12773900; minLat = 43.19177600; 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(Barre); map.removeOverlays(Chelsea); map.removeOverlays(Dorset); map.removeOverlays(East_Burke); map.removeOverlays(Highgate_Center); map.removeOverlays(Jeffersonville); map.removeOverlays(Killington); map.removeOverlays(Ludlow); map.removeOverlays(Lyndonville); map.removeOverlays(Montpelier); map.removeOverlays(Quechee); map.removeOverlays(Stowe); map.removeOverlays(Stratton_Mountain); map.removeOverlays(Vershire); map.removeOverlays(Williston); map.removeOverlays(Wolcott); 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(Williston);map.removeOverlays(Barre); map.removeOverlays(Chelsea); map.removeOverlays(Dorset); map.removeOverlays(East_Burke); map.removeOverlays(Highgate_Center); map.removeOverlays(Jeffersonville); map.removeOverlays(Killington); map.removeOverlays(Ludlow); map.removeOverlays(Lyndonville); map.removeOverlays(Montpelier); map.removeOverlays(Quechee); map.removeOverlays(Stowe); map.removeOverlays(Stratton_Mountain); map.removeOverlays(Vershire); map.removeOverlays(Williston); map.removeOverlays(Wolcott); map.addOverlays(Barre); centerByArray(Barre, false, false); cntMarker += Barre.length; map.addOverlays(Chelsea); centerByArray(Chelsea, false, false); cntMarker += Chelsea.length; map.addOverlays(Dorset); centerByArray(Dorset, false, false); cntMarker += Dorset.length; map.addOverlays(East_Burke); centerByArray(East_Burke, false, false); cntMarker += East_Burke.length; map.addOverlays(Highgate_Center); centerByArray(Highgate_Center, false, false); cntMarker += Highgate_Center.length; map.addOverlays(Jeffersonville); centerByArray(Jeffersonville, false, false); cntMarker += Jeffersonville.length; map.addOverlays(Killington); centerByArray(Killington, false, false); cntMarker += Killington.length; map.addOverlays(Ludlow); centerByArray(Ludlow, false, false); cntMarker += Ludlow.length; map.addOverlays(Lyndonville); centerByArray(Lyndonville, false, false); cntMarker += Lyndonville.length; map.addOverlays(Montpelier); centerByArray(Montpelier, false, false); cntMarker += Montpelier.length; map.addOverlays(Quechee); centerByArray(Quechee, false, false); cntMarker += Quechee.length; map.addOverlays(Stowe); centerByArray(Stowe, false, false); cntMarker += Stowe.length; map.addOverlays(Stratton_Mountain); centerByArray(Stratton_Mountain, false, false); cntMarker += Stratton_Mountain.length; map.addOverlays(Vershire); centerByArray(Vershire, false, false); cntMarker += Vershire.length; map.addOverlays(Williston); centerByArray(Williston, false, false); cntMarker += Williston.length; map.addOverlays(Wolcott); centerByArray(Wolcott, false, false); cntMarker += Wolcott.length; centerByArray(Williston,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///27909,35727,27906,27952,36120,27958,27948,32982,27991,28002,27931,27909,28019,35727,27952,34848,27969,27945,28012,27899,27927,/all'); //window.open('/map.php?type=2&schools=27909,35727,27906,27952,36120,27958,27948,32982,27991,28002,27931,27909,28019,35727,27952,34848,27969,27945,28012,27899,27927,&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; }