function addMarkers()
{
mySelect = document.getElementById('selection');
Winsted = [];Thomaston = [];New_Hartford = [];Barkhamsted = [];Bethlehem = [];Roxbury = [];Norfolk = [];Bridgewater = [];Litchfield = [];Colebrook = [];West_Cornwall = [];Washington = [];Torrington = [];Watertown = [];Goshen = [];Terryville = [];Harwinton = [];New_Milford = [];Falls_Village = [];Woodbury = [];Morris = [];Oakville = [];Kent = [];North_Canaan = [];Winchester = [];Plymouth = [];Lakeville = [];Sharon = [];Warren = [];Washington_Dep = [];mySelect.options[mySelect.options.length] = new Option("Barkhamsted schools",'all=Barkhamsted');
mySelect.options[mySelect.options.length] = new Option("Bethlehem schools",'all=Bethlehem');
mySelect.options[mySelect.options.length] = new Option("Bridgewater schools",'all=Bridgewater');
mySelect.options[mySelect.options.length] = new Option("Colebrook schools",'all=Colebrook');
mySelect.options[mySelect.options.length] = new Option("Falls Village schools",'all=Falls_Village');
mySelect.options[mySelect.options.length] = new Option("Goshen schools",'all=Goshen');
mySelect.options[mySelect.options.length] = new Option("Harwinton schools",'all=Harwinton');
mySelect.options[mySelect.options.length] = new Option("Kent schools",'all=Kent');
mySelect.options[mySelect.options.length] = new Option("Lakeville schools",'all=Lakeville');
mySelect.options[mySelect.options.length] = new Option("Litchfield schools",'all=Litchfield');
mySelect.options[mySelect.options.length] = new Option("Morris schools",'all=Morris');
mySelect.options[mySelect.options.length] = new Option("New Hartford schools",'all=New_Hartford');
mySelect.options[mySelect.options.length] = new Option("New Milford schools",'all=New_Milford');
mySelect.options[mySelect.options.length] = new Option("Norfolk schools",'all=Norfolk');
mySelect.options[mySelect.options.length] = new Option("North Canaan schools",'all=North_Canaan');
mySelect.options[mySelect.options.length] = new Option("Oakville schools",'all=Oakville');
mySelect.options[mySelect.options.length] = new Option("Plymouth schools",'all=Plymouth');
mySelect.options[mySelect.options.length] = new Option("Roxbury schools",'all=Roxbury');
mySelect.options[mySelect.options.length] = new Option("Sharon schools",'all=Sharon');
mySelect.options[mySelect.options.length] = new Option("Terryville schools",'all=Terryville');
mySelect.options[mySelect.options.length] = new Option("Thomaston schools",'all=Thomaston');
mySelect.options[mySelect.options.length] = new Option("Torrington schools",'all=Torrington');
mySelect.options[mySelect.options.length] = new Option("Warren schools",'all=Warren');
mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington');
mySelect.options[mySelect.options.length] = new Option("Washington Dep schools",'all=Washington_Dep');
mySelect.options[mySelect.options.length] = new Option("Watertown schools",'all=Watertown');
mySelect.options[mySelect.options.length] = new Option("West Cornwall schools",'all=West_Cornwall');
mySelect.options[mySelect.options.length] = new Option("Winchester schools",'all=Winchester');
mySelect.options[mySelect.options.length] = new Option("Winsted schools",'all=Winsted');
mySelect.options[mySelect.options.length] = new Option("Woodbury schools",'all=Woodbury');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Winsted[Winsted.length] = createMarker(new GPoint(-73.06927900,41.92109500),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Able",'Winsted=' + Winsted.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.06927900,41.92109500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Aim",'Winsted=' + Winsted.length);
Thomaston[Thomaston.length] = createMarker(new GPoint(-73.07440186,41.67385864),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative Community Education High School",'Thomaston=' + Thomaston.length);
New_Hartford[New_Hartford.length] = createMarker(new GPoint(-73.01654053,41.82966995),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ann Antolini School",'New_Hartford=' + New_Hartford.length);
New_Hartford[New_Hartford.length] = createMarker(new GPoint(-73.03349304,41.83172989),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bakerville Consolidated School",'New_Hartford=' + New_Hartford.length);
Barkhamsted[Barkhamsted.length] = createMarker(new GPoint(-72.99382782,41.91015625),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Barkhamsted Elementary School",'Barkhamsted=' + Barkhamsted.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.07567596,41.90930557),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Batcheller Elementary School",'Winsted=' + Winsted.length);
Bethlehem[Bethlehem.length] = createMarker(new GPoint(-73.19949341,41.63973999),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bethlehem Elementary School",'Bethlehem=' + Bethlehem.length);
Thomaston[Thomaston.length] = createMarker(new GPoint(-73.09296417,41.65785599),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Black Rock School",'Thomaston=' + Thomaston.length);
Roxbury[Roxbury.length] = createMarker(new GPoint(-73.30838013,41.55460358),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Booth Free School",'Roxbury=' + Roxbury.length);
Norfolk[Norfolk.length] = createMarker(new GPoint(-73.20384216,41.99477005),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Botelle Elementary School",'Norfolk=' + Norfolk.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.06927900,41.92109500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bridges 2",'Winsted=' + Winsted.length);
Barkhamsted[Barkhamsted.length] = createMarker(new GPoint(-72.99138600,41.91153200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bridges I",'Barkhamsted=' + Barkhamsted.length);
Bridgewater[Bridgewater.length] = createMarker(new GPoint(-73.36681366,41.53831863),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burnham School",'Bridgewater=' + Bridgewater.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.19580078,41.75130081),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Center School",'Litchfield=' + Litchfield.length);
Colebrook[Colebrook.length] = createMarker(new GPoint(-73.10900116,42.02109909),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Colebrook Consolidated School",'Colebrook=' + Colebrook.length);
West_Cornwall[West_Cornwall.length] = createMarker(new GPoint(-73.34190369,41.87601471),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cornwall Consolidated School",'West_Cornwall=' + West_Cornwall.length);
Washington[Washington.length] = createMarker(new GPoint(-73.30449677,41.60475159),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Childhood Education Center",'Washington=' + Washington.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.09337616,41.80926895),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("East School",'Torrington=' + Torrington.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.19747162,41.76250839),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Education Connection Headstart Elementary School",'Litchfield=' + Litchfield.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.19336900,41.74677500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Education Connection Special Education",'Litchfield=' + Litchfield.length);
Winsted[Winsted.length] = createMarker(new GPoint(-72.96150208,41.86880493),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Explorations High School",'Winsted=' + Winsted.length);
Watertown[Watertown.length] = createMarker(new GPoint(-73.13107300,41.60294724),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fletcher W. Judson School",'Watertown=' + Watertown.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.06927900,41.92109500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Flex",'Winsted=' + Winsted.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.13361359,41.81328583),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forbes School",'Torrington=' + Torrington.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.07240295,41.92935562),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gilbert School",'Winsted=' + Winsted.length);
Goshen[Goshen.length] = createMarker(new GPoint(-73.22911835,41.83580780),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Goshen Center School",'Goshen=' + Goshen.length);
Terryville[Terryville.length] = createMarker(new GPoint(-73.00575256,41.68269730),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Harry S. Fisher School",'Terryville=' + Terryville.length);
Harwinton[Harwinton.length] = createMarker(new GPoint(-73.06975555,41.76960754),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harwinton Consolidated School",'Harwinton=' + Harwinton.length);
Watertown[Watertown.length] = createMarker(new GPoint(-73.11636353,41.60389328),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Heminway Park School",'Watertown=' + Watertown.length);
New_Milford[New_Milford.length] = createMarker(new GPoint(-73.43146515,41.53449249),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hill And Plain School",'New_Milford=' + New_Milford.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.22445679,41.72695541),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Homebound",'Litchfield=' + Litchfield.length);
Falls_Village[Falls_Village.length] = createMarker(new GPoint(-73.36309814,41.95450974),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Housatonic Valley Regional High School",'Falls_Village=' + Falls_Village.length);
Norfolk[Norfolk.length] = createMarker(new GPoint(-73.19916900,41.98934900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Iep Program",'Norfolk=' + Norfolk.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-73.20208740,41.55461884),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Integrated Star Preschool Program",'Woodbury=' + Woodbury.length);
Morris[Morris.length] = createMarker(new GPoint(-73.18775177,41.68859100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("James Morris School",'Morris=' + Morris.length);
New_Milford[New_Milford.length] = createMarker(new GPoint(-73.41416168,41.56589508),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John Pettibone School",'New_Milford=' + New_Milford.length);
Oakville[Oakville.length] = createMarker(new GPoint(-73.09023285,41.60660934),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John Trumbull Primary School",'Oakville=' + Oakville.length);
Kent[Kent.length] = createMarker(new GPoint(-73.48056030,41.72417450),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kent Center School",'Kent=' + Kent.length);
Falls_Village[Falls_Village.length] = createMarker(new GPoint(-73.36309814,41.95450974),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lee H. Kellogg School",'Falls_Village=' + Falls_Village.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.06927900,41.92109500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Links",'Winsted=' + Winsted.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.19580078,41.75130081),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Litchfield High School",'Litchfield=' + Litchfield.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.19580078,41.75130081),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Litchfield Intermediate School",'Litchfield=' + Litchfield.length);
Terryville[Terryville.length] = createMarker(new GPoint(-73.00117493,41.67892075),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Main Street School",'Terryville=' + Terryville.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.07445526,41.92690659),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mary P. Hinsdale School",'Winsted=' + Winsted.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-73.20932007,41.54742813),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mitchell Elementary School",'Woodbury=' + Woodbury.length);
New_Hartford[New_Hartford.length] = createMarker(new GPoint(-72.96746826,41.87704468),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("New Hartford Elementary School",'New_Hartford=' + New_Hartford.length);
New_Milford[New_Milford.length] = createMarker(new GPoint(-73.41590881,41.56835175),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Milford High School",'New_Milford=' + New_Milford.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-73.18839264,41.55689240),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Nonnewaug High School",'Woodbury=' + Woodbury.length);
North_Canaan[North_Canaan.length] = createMarker(new GPoint(-73.33371735,42.03129578),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("North Canaan Elementary School",'North_Canaan=' + North_Canaan.length);
New_Milford[New_Milford.length] = createMarker(new GPoint(-73.39297485,41.61985779),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northville Elementary School",'New_Milford=' + New_Milford.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.04772949,41.91430283),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwestern Regional High School",'Winsted=' + Winsted.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.07530212,41.93080139),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Northwestern Regional Middle School",'Winsted=' + Winsted.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.11174774,41.81016922),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oliver Wolcott Vocational School",'Torrington=' + Torrington.length);
Winchester[Winchester.length] = createMarker(new GPoint(-73.06624603,41.92649841),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pearson Middle School",'Winchester=' + Winchester.length);
Plymouth[Plymouth.length] = createMarker(new GPoint(-73.05315399,41.67859650),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Plymouth Center School",'Plymouth=' + Plymouth.length);
Oakville[Oakville.length] = createMarker(new GPoint(-73.08544922,41.59844589),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Polk School",'Oakville=' + Oakville.length);
Terryville[Terryville.length] = createMarker(new GPoint(-73.01261902,41.67976379),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prospect Street School",'Terryville=' + Terryville.length);
Lakeville[Lakeville.length] = createMarker(new GPoint(-73.44020844,41.96386719),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Salisbury Central School",'Lakeville=' + Lakeville.length);
New_Milford[New_Milford.length] = createMarker(new GPoint(-73.41794586,41.56796265),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sarah Noble Intermediate School",'New_Milford=' + New_Milford.length);
New_Milford[New_Milford.length] = createMarker(new GPoint(-73.39279175,41.61985779),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Schaghticoke Middle School",'New_Milford=' + New_Milford.length);
Barkhamsted[Barkhamsted.length] = createMarker(new GPoint(-72.99138600,41.91153200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Shared Services Integrated Preschool",'Barkhamsted=' + Barkhamsted.length);
Sharon[Sharon.length] = createMarker(new GPoint(-73.47177100,41.88323500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sharon Center School",'Sharon=' + Sharon.length);
Washington[Washington.length] = createMarker(new GPoint(-73.30455017,41.60499573),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shepaug Valley High School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-73.30449677,41.60475159),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Shepaug Valley Middle School",'Washington=' + Washington.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.11334229,41.79378510),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southeast School",'Torrington=' + Torrington.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.13361359,41.81328583),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southwest School",'Torrington=' + Torrington.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.06927900,41.92109500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Step",'Winsted=' + Winsted.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.19336900,41.74677500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stepping Stones Preschool Program",'Litchfield=' + Litchfield.length);
Oakville[Oakville.length] = createMarker(new GPoint(-73.09254456,41.58499146),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Swift Middle School",'Oakville=' + Oakville.length);
Terryville[Terryville.length] = createMarker(new GPoint(-73.00904846,41.67949677),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Terryville High School",'Terryville=' + Terryville.length);
Thomaston[Thomaston.length] = createMarker(new GPoint(-73.07451630,41.67356110),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Thomaston Center School",'Thomaston=' + Thomaston.length);
Thomaston[Thomaston.length] = createMarker(new GPoint(-73.09631348,41.65851974),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Thomaston High School",'Thomaston=' + Thomaston.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.09237671,41.81905365),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Torringford School",'Torrington=' + Torrington.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.11119080,41.81505585),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Torrington High School",'Torrington=' + Torrington.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.07637787,41.83702850),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Torrington Middle School",'Torrington=' + Torrington.length);
Torrington[Torrington.length] = createMarker(new GPoint(-73.12245941,41.80378723),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vogel-wetmore School",'Torrington=' + Torrington.length);
Litchfield[Litchfield.length] = createMarker(new GPoint(-73.22445679,41.72695541),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wamogo Regional High School",'Litchfield=' + Litchfield.length);
Warren[Warren.length] = createMarker(new GPoint(-73.34313202,41.73044205),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Warren Elementary School",'Warren=' + Warren.length);
Washington_Dep[Washington_Dep.length] = createMarker(new GPoint(-73.31822205,41.63967896),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washington Primary School",'Washington_Dep=' + Washington_Dep.length);
Watertown[Watertown.length] = createMarker(new GPoint(-73.10175323,41.59710693),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Watertown High School",'Watertown=' + Watertown.length);
Winsted[Winsted.length] = createMarker(new GPoint(-73.06539154,41.92301941),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Winchester Alternate High School",'Winsted=' + Winsted.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-73.20993805,41.54921722),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Woodbury Middle School",'Woodbury=' + Woodbury.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,10);
/*
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(Barkhamsted);
map.removeOverlays(Bethlehem);
map.removeOverlays(Bridgewater);
map.removeOverlays(Colebrook);
map.removeOverlays(Falls_Village);
map.removeOverlays(Goshen);
map.removeOverlays(Harwinton);
map.removeOverlays(Kent);
map.removeOverlays(Lakeville);
map.removeOverlays(Litchfield);
map.removeOverlays(Morris);
map.removeOverlays(New_Hartford);
map.removeOverlays(New_Milford);
map.removeOverlays(Norfolk);
map.removeOverlays(North_Canaan);
map.removeOverlays(Oakville);
map.removeOverlays(Plymouth);
map.removeOverlays(Roxbury);
map.removeOverlays(Sharon);
map.removeOverlays(Terryville);
map.removeOverlays(Thomaston);
map.removeOverlays(Torrington);
map.removeOverlays(Warren);
map.removeOverlays(Washington);
map.removeOverlays(Washington_Dep);
map.removeOverlays(Watertown);
map.removeOverlays(West_Cornwall);
map.removeOverlays(Winchester);
map.removeOverlays(Winsted);
map.removeOverlays(Woodbury);
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(Winsted);map.removeOverlays(Barkhamsted);
map.removeOverlays(Bethlehem);
map.removeOverlays(Bridgewater);
map.removeOverlays(Colebrook);
map.removeOverlays(Falls_Village);
map.removeOverlays(Goshen);
map.removeOverlays(Harwinton);
map.removeOverlays(Kent);
map.removeOverlays(Lakeville);
map.removeOverlays(Litchfield);
map.removeOverlays(Morris);
map.removeOverlays(New_Hartford);
map.removeOverlays(New_Milford);
map.removeOverlays(Norfolk);
map.removeOverlays(North_Canaan);
map.removeOverlays(Oakville);
map.removeOverlays(Plymouth);
map.removeOverlays(Roxbury);
map.removeOverlays(Sharon);
map.removeOverlays(Terryville);
map.removeOverlays(Thomaston);
map.removeOverlays(Torrington);
map.removeOverlays(Warren);
map.removeOverlays(Washington);
map.removeOverlays(Washington_Dep);
map.removeOverlays(Watertown);
map.removeOverlays(West_Cornwall);
map.removeOverlays(Winchester);
map.removeOverlays(Winsted);
map.removeOverlays(Woodbury);
map.addOverlays(Barkhamsted);
centerByArray(Barkhamsted, false, false);
cntMarker += Barkhamsted.length;
map.addOverlays(Bethlehem);
centerByArray(Bethlehem, false, false);
cntMarker += Bethlehem.length;
map.addOverlays(Bridgewater);
centerByArray(Bridgewater, false, false);
cntMarker += Bridgewater.length;
map.addOverlays(Colebrook);
centerByArray(Colebrook, false, false);
cntMarker += Colebrook.length;
map.addOverlays(Falls_Village);
centerByArray(Falls_Village, false, false);
cntMarker += Falls_Village.length;
map.addOverlays(Goshen);
centerByArray(Goshen, false, false);
cntMarker += Goshen.length;
map.addOverlays(Harwinton);
centerByArray(Harwinton, false, false);
cntMarker += Harwinton.length;
map.addOverlays(Kent);
centerByArray(Kent, false, false);
cntMarker += Kent.length;
map.addOverlays(Lakeville);
centerByArray(Lakeville, false, false);
cntMarker += Lakeville.length;
map.addOverlays(Litchfield);
centerByArray(Litchfield, false, false);
cntMarker += Litchfield.length;
map.addOverlays(Morris);
centerByArray(Morris, false, false);
cntMarker += Morris.length;
map.addOverlays(New_Hartford);
centerByArray(New_Hartford, false, false);
cntMarker += New_Hartford.length;
map.addOverlays(New_Milford);
centerByArray(New_Milford, false, false);
cntMarker += New_Milford.length;
map.addOverlays(Norfolk);
centerByArray(Norfolk, false, false);
cntMarker += Norfolk.length;
map.addOverlays(North_Canaan);
centerByArray(North_Canaan, false, false);
cntMarker += North_Canaan.length;
map.addOverlays(Oakville);
centerByArray(Oakville, false, false);
cntMarker += Oakville.length;
map.addOverlays(Plymouth);
centerByArray(Plymouth, false, false);
cntMarker += Plymouth.length;
map.addOverlays(Roxbury);
centerByArray(Roxbury, false, false);
cntMarker += Roxbury.length;
map.addOverlays(Sharon);
centerByArray(Sharon, false, false);
cntMarker += Sharon.length;
map.addOverlays(Terryville);
centerByArray(Terryville, false, false);
cntMarker += Terryville.length;
map.addOverlays(Thomaston);
centerByArray(Thomaston, false, false);
cntMarker += Thomaston.length;
map.addOverlays(Torrington);
centerByArray(Torrington, false, false);
cntMarker += Torrington.length;
map.addOverlays(Warren);
centerByArray(Warren, false, false);
cntMarker += Warren.length;
map.addOverlays(Washington);
centerByArray(Washington, false, false);
cntMarker += Washington.length;
map.addOverlays(Washington_Dep);
centerByArray(Washington_Dep, false, false);
cntMarker += Washington_Dep.length;
map.addOverlays(Watertown);
centerByArray(Watertown, false, false);
cntMarker += Watertown.length;
map.addOverlays(West_Cornwall);
centerByArray(West_Cornwall, false, false);
cntMarker += West_Cornwall.length;
map.addOverlays(Winchester);
centerByArray(Winchester, false, false);
cntMarker += Winchester.length;
map.addOverlays(Winsted);
centerByArray(Winsted, false, false);
cntMarker += Winsted.length;
map.addOverlays(Woodbury);
centerByArray(Woodbury, false, false);
cntMarker += Woodbury.length;
centerByArray(Winsted,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');
}
}