function addMarkers(){ mySelect = document.getElementById('selection'); Brattleboro = [];Burlington = [];Bennington = [];Chelsea = [];Winooski = [];Rutland = [];East_Randolph = [];North_Bennington = [];Putney = [];Williston = [];Johnson = [];Plainfield = [];Montpelier = [];Morrisville = [];mySelect.options[mySelect.options.length] = new Option("Bennington schools",'all=Bennington'); mySelect.options[mySelect.options.length] = new Option("Brattleboro schools",'all=Brattleboro'); mySelect.options[mySelect.options.length] = new Option("Burlington schools",'all=Burlington'); mySelect.options[mySelect.options.length] = new Option("Chelsea schools",'all=Chelsea'); mySelect.options[mySelect.options.length] = new Option("East Randolph schools",'all=East_Randolph'); mySelect.options[mySelect.options.length] = new Option("Johnson schools",'all=Johnson'); mySelect.options[mySelect.options.length] = new Option("Montpelier schools",'all=Montpelier'); mySelect.options[mySelect.options.length] = new Option("Morrisville schools",'all=Morrisville'); mySelect.options[mySelect.options.length] = new Option("North Bennington schools",'all=North_Bennington'); mySelect.options[mySelect.options.length] = new Option("Plainfield schools",'all=Plainfield'); mySelect.options[mySelect.options.length] = new Option("Putney schools",'all=Putney'); mySelect.options[mySelect.options.length] = new Option("Rutland schools",'all=Rutland'); mySelect.options[mySelect.options.length] = new Option("Williston schools",'all=Williston'); mySelect.options[mySelect.options.length] = new Option("Winooski schools",'all=Winooski'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Brattleboro[Brattleboro.length] = createMarker(new GPoint(-72.57589800,42.84296600),"
Austine School For The Deaf
60 Austine Drive
Brattleboro, VT 05301
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Austine School For The Deaf",'Brattleboro=' + Brattleboro.length); Burlington[Burlington.length] = createMarker(new GPoint(-73.21448100,44.44794600),"
The Baird School
1110 Pine Street
Burlington, VT 05401
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Baird School",'Burlington=' + Burlington.length); 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); Chelsea[Chelsea.length] = createMarker(new GPoint(-72.46080000,43.99180000),"
Brewster D Martin Learning Center
Po Box 127 Main Street
Chelsea, VT 05038
All-boys school, 3-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brewster D Martin Learning Center",'Chelsea=' + Chelsea.length); Winooski[Winooski.length] = createMarker(new GPoint(-73.18887700,44.49084500),"
Centerpoint
81 West Canal Street
Winooski, VT 05404
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centerpoint",'Winooski=' + Winooski.length); Rutland[Rutland.length] = createMarker(new GPoint(-72.98180000,43.60750000),"
Creative Solutions School
Easter Seals Of Vt.
Rutland, VT 05702
All-girls school, 8-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Creative Solutions School",'Rutland=' + Rutland.length); East_Randolph[East_Randolph.length] = createMarker(new GPoint(-72.55028500,43.95227900),"
East Valley Academy
Po Box 237
East Randolph, VT 05041
Co-ed school, 2-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Valley Academy",'East_Randolph=' + East_Randolph.length); North_Bennington[North_Bennington.length] = createMarker(new GPoint(-73.24530000,42.93650000),"
Great Expectations School
Po Box 758
North Bennington, VT 05257
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Great Expectations School",'North_Bennington=' + North_Bennington.length); Putney[Putney.length] = createMarker(new GPoint(-72.55410800,42.97576400),"
The Greenwood School
14 Greenwood Lane
Putney, VT 05346
All-boys school, 4-9
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("The Greenwood School",'Putney=' + Putney.length); Burlington[Burlington.length] = createMarker(new GPoint(-73.20298800,44.48486300),"
Hull Crest School, Inc
455 North Street
Burlington, VT 05401
All-boys school, 8-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hull Crest School, Inc",'Burlington=' + Burlington.length); Williston[Williston.length] = createMarker(new GPoint(-73.11794100,44.45091000),"
Jean Garvin School
94 Harvest Lane Ste 203
Williston, VT 05495
Co-ed school, 7-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jean Garvin School",'Williston=' + Williston.length); Johnson[Johnson.length] = createMarker(new GPoint(-72.66730000,44.64660000),"
Laraway School
Po Box 621
Johnson, VT 05656
Co-ed school, 8-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Laraway School",'Johnson=' + Johnson.length); Plainfield[Plainfield.length] = createMarker(new GPoint(-72.42390000,44.28170000),"
Maplehill School
Po Box 248
Plainfield, VT 05667
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maplehill School",'Plainfield=' + Plainfield.length); Brattleboro[Brattleboro.length] = createMarker(new GPoint(-72.56044000,42.85870000),"
Meadows School
Anna Marsh Lane Box 803
Brattleboro, VT 05302
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadows School",'Brattleboro=' + Brattleboro.length); Montpelier[Montpelier.length] = createMarker(new GPoint(-72.56816300,44.25600700),"
The New School Of Montpelier
11 West Street
Montpelier, VT 05602
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The New School Of Montpelier",'Montpelier=' + Montpelier.length); Williston[Williston.length] = createMarker(new GPoint(-73.04217000,44.43423200),"
Pine Ridge School
9505 Williston Rd
Williston, VT 05495
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Ridge School",'Williston=' + Williston.length); Morrisville[Morrisville.length] = createMarker(new GPoint(-72.59397200,44.56247300),"
School The Augmentative Learning/movement Center
122 Park Street
Morrisville, VT 05661
Co-ed school, 1-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("School The Augmentative Learning/movement Center",'Morrisville=' + Morrisville.length); Rutland[Rutland.length] = createMarker(new GPoint(-72.98180000,43.60750000),"
Sheldon Academy Of Vermont Achievement Center
Po Box 6283
Rutland, VT 05702
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sheldon Academy Of Vermont Achievement Center",'Rutland=' + Rutland.length); Brattleboro[Brattleboro.length] = createMarker(new GPoint(-72.57592900,42.84303100),"
Vt Center For Deaf/hard Hearing
209 Austine Dr
Brattleboro, VT 05301
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vt Center For Deaf/hard Hearing",'Brattleboro=' + Brattleboro.length); map.removeOverlays(Bennington); map.removeOverlays(Brattleboro); map.removeOverlays(Burlington); map.removeOverlays(Chelsea); map.removeOverlays(East_Randolph); map.removeOverlays(Johnson); map.removeOverlays(Montpelier); map.removeOverlays(Morrisville); map.removeOverlays(North_Bennington); map.removeOverlays(Plainfield); map.removeOverlays(Putney); map.removeOverlays(Rutland); map.removeOverlays(Williston); map.removeOverlays(Winooski); setTimeout(function(){map.addOverlays(Bennington)},1000); setTimeout(function(){map.addOverlays(Brattleboro)},1000); setTimeout(function(){map.addOverlays(Burlington)},1000); setTimeout(function(){map.addOverlays(Chelsea)},1000); setTimeout(function(){map.addOverlays(East_Randolph)},1000); setTimeout(function(){map.addOverlays(Johnson)},1000); setTimeout(function(){map.addOverlays(Montpelier)},1000); setTimeout(function(){map.addOverlays(Morrisville)},1000); setTimeout(function(){map.addOverlays(North_Bennington)},1000); setTimeout(function(){map.addOverlays(Plainfield)},1000); setTimeout(function(){map.addOverlays(Putney)},1000); setTimeout(function(){map.addOverlays(Rutland)},1000); setTimeout(function(){map.addOverlays(Williston)},1000); setTimeout(function(){map.addOverlays(Winooski)},1000); maxLng = -72.42390000; maxLat = 44.64660000; minLng = -73.24530000; minLat = 42.84296600; 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(Bennington); map.removeOverlays(Brattleboro); map.removeOverlays(Burlington); map.removeOverlays(Chelsea); map.removeOverlays(East_Randolph); map.removeOverlays(Johnson); map.removeOverlays(Montpelier); map.removeOverlays(Morrisville); map.removeOverlays(North_Bennington); map.removeOverlays(Plainfield); map.removeOverlays(Putney); map.removeOverlays(Rutland); map.removeOverlays(Williston); map.removeOverlays(Winooski); 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(Brattleboro);map.removeOverlays(Bennington); map.removeOverlays(Brattleboro); map.removeOverlays(Burlington); map.removeOverlays(Chelsea); map.removeOverlays(East_Randolph); map.removeOverlays(Johnson); map.removeOverlays(Montpelier); map.removeOverlays(Morrisville); map.removeOverlays(North_Bennington); map.removeOverlays(Plainfield); map.removeOverlays(Putney); map.removeOverlays(Rutland); map.removeOverlays(Williston); map.removeOverlays(Winooski); map.addOverlays(Bennington); centerByArray(Bennington, false, false); cntMarker += Bennington.length; map.addOverlays(Brattleboro); centerByArray(Brattleboro, false, false); cntMarker += Brattleboro.length; map.addOverlays(Burlington); centerByArray(Burlington, false, false); cntMarker += Burlington.length; map.addOverlays(Chelsea); centerByArray(Chelsea, false, false); cntMarker += Chelsea.length; map.addOverlays(East_Randolph); centerByArray(East_Randolph, false, false); cntMarker += East_Randolph.length; map.addOverlays(Johnson); centerByArray(Johnson, false, false); cntMarker += Johnson.length; map.addOverlays(Montpelier); centerByArray(Montpelier, false, false); cntMarker += Montpelier.length; map.addOverlays(Morrisville); centerByArray(Morrisville, false, false); cntMarker += Morrisville.length; map.addOverlays(North_Bennington); centerByArray(North_Bennington, false, false); cntMarker += North_Bennington.length; map.addOverlays(Plainfield); centerByArray(Plainfield, false, false); cntMarker += Plainfield.length; map.addOverlays(Putney); centerByArray(Putney, false, false); cntMarker += Putney.length; map.addOverlays(Rutland); centerByArray(Rutland, false, false); cntMarker += Rutland.length; map.addOverlays(Williston); centerByArray(Williston, false, false); cntMarker += Williston.length; map.addOverlays(Winooski); centerByArray(Winooski, false, false); cntMarker += Winooski.length; centerByArray(Brattleboro,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///27901,27896,27943,28017,27897,27932,35726,31892,27925,28001,27917,28014,27933,27962,27908,27900,35724,27901,27896,27943,28017,27897,27904,35726,27937,32983,27998,28014,27908,/all'); //window.open('/map.php?type=2&schools=27901,27896,27943,28017,27897,27932,35726,31892,27925,28001,27917,28014,27933,27962,27908,27900,35724,27901,27896,27943,28017,27897,27904,35726,27937,32983,27998,28014,27908,&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; }