function addMarkers(){
mySelect = document.getElementById('selection');
Amherst = [];Andover = [];North_Brookfield = [];Duxbury = [];Canton = [];Sagamore = [];Reading = [];Jamaica_Plain = [];Marblehead = [];Dover = [];Natick = [];Beverly = [];Scituate = [];North_Chelmsford = [];Boston = [];Lexington = [];Woods_Hole = [];Melrose = [];East_Longmeadow = [];Southbridge = [];Holden = [];Northampton = [];Newburyport = [];Littleton = [];Ashland = [];Springfield = [];Sandwich = [];Cambridge = [];Framingham = [];Milton = [];Vineyard_Haven = [];Newton = [];Wellesley = [];Westwood = [];Millis = [];mySelect.options[mySelect.options.length] = new Option("Amherst schools",'all=Amherst');
mySelect.options[mySelect.options.length] = new Option("Andover schools",'all=Andover');
mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland');
mySelect.options[mySelect.options.length] = new Option("Beverly schools",'all=Beverly');
mySelect.options[mySelect.options.length] = new Option("Boston schools",'all=Boston');
mySelect.options[mySelect.options.length] = new Option("Cambridge schools",'all=Cambridge');
mySelect.options[mySelect.options.length] = new Option("Canton schools",'all=Canton');
mySelect.options[mySelect.options.length] = new Option("Dover schools",'all=Dover');
mySelect.options[mySelect.options.length] = new Option("Duxbury schools",'all=Duxbury');
mySelect.options[mySelect.options.length] = new Option("East Longmeadow schools",'all=East_Longmeadow');
mySelect.options[mySelect.options.length] = new Option("Framingham schools",'all=Framingham');
mySelect.options[mySelect.options.length] = new Option("Holden schools",'all=Holden');
mySelect.options[mySelect.options.length] = new Option("Jamaica Plain schools",'all=Jamaica_Plain');
mySelect.options[mySelect.options.length] = new Option("Lexington schools",'all=Lexington');
mySelect.options[mySelect.options.length] = new Option("Littleton schools",'all=Littleton');
mySelect.options[mySelect.options.length] = new Option("Marblehead schools",'all=Marblehead');
mySelect.options[mySelect.options.length] = new Option("Melrose schools",'all=Melrose');
mySelect.options[mySelect.options.length] = new Option("Millis schools",'all=Millis');
mySelect.options[mySelect.options.length] = new Option("Milton schools",'all=Milton');
mySelect.options[mySelect.options.length] = new Option("Natick schools",'all=Natick');
mySelect.options[mySelect.options.length] = new Option("Newburyport schools",'all=Newburyport');
mySelect.options[mySelect.options.length] = new Option("Newton schools",'all=Newton');
mySelect.options[mySelect.options.length] = new Option("North Brookfield schools",'all=North_Brookfield');
mySelect.options[mySelect.options.length] = new Option("North Chelmsford schools",'all=North_Chelmsford');
mySelect.options[mySelect.options.length] = new Option("Northampton schools",'all=Northampton');
mySelect.options[mySelect.options.length] = new Option("Reading schools",'all=Reading');
mySelect.options[mySelect.options.length] = new Option("Sagamore schools",'all=Sagamore');
mySelect.options[mySelect.options.length] = new Option("Sandwich schools",'all=Sandwich');
mySelect.options[mySelect.options.length] = new Option("Scituate schools",'all=Scituate');
mySelect.options[mySelect.options.length] = new Option("Southbridge schools",'all=Southbridge');
mySelect.options[mySelect.options.length] = new Option("Springfield schools",'all=Springfield');
mySelect.options[mySelect.options.length] = new Option("Vineyard Haven schools",'all=Vineyard_Haven');
mySelect.options[mySelect.options.length] = new Option("Wellesley schools",'all=Wellesley');
mySelect.options[mySelect.options.length] = new Option("Westwood schools",'all=Westwood');
mySelect.options[mySelect.options.length] = new Option("Woods Hole schools",'all=Woods_Hole');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Amherst[Amherst.length] = createMarker(new GPoint(-72.51873100,42.33989000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Amherst Montessori School",'Amherst=' + Amherst.length);
Andover[Andover.length] = createMarker(new GPoint(-71.12565800,42.62192800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Andover School Of Montessori",'Andover=' + Andover.length);
North_Brookfield[North_Brookfield.length] = createMarker(new GPoint(-72.08316600,42.27529600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Appleseed Montessori School",'North_Brookfield=' + North_Brookfield.length);
Duxbury[Duxbury.length] = createMarker(new GPoint(-70.71789500,42.00734900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay Farm Montessori Academy",'Duxbury=' + Duxbury.length);
Canton[Canton.length] = createMarker(new GPoint(-71.11449500,42.18273300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Blue Hill Montessori School",'Canton=' + Canton.length);
Sagamore[Sagamore.length] = createMarker(new GPoint(-70.53026000,41.77061700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bridgeview Montessori School",'Sagamore=' + Sagamore.length);
Reading[Reading.length] = createMarker(new GPoint(-71.12683600,42.52777100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Children's House Montessori",'Reading=' + Reading.length);
Jamaica_Plain[Jamaica_Plain.length] = createMarker(new GPoint(-71.10206000,42.31770000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Copper Beech Montessori School",'Jamaica_Plain=' + Jamaica_Plain.length);
Marblehead[Marblehead.length] = createMarker(new GPoint(-70.86605700,42.49327600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Devereux School",'Marblehead=' + Marblehead.length);
Dover[Dover.length] = createMarker(new GPoint(-71.32602900,42.24562300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dover Montessori School",'Dover=' + Dover.length);
Natick[Natick.length] = createMarker(new GPoint(-71.31415000,42.27415000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Eliot Montessori School",'Natick=' + Natick.length);
Beverly[Beverly.length] = createMarker(new GPoint(-70.86410600,42.56523400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harborlight Montessori School",'Beverly=' + Beverly.length);
Scituate[Scituate.length] = createMarker(new GPoint(-70.75941300,42.17183700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Inly School",'Scituate=' + Scituate.length);
North_Chelmsford[North_Chelmsford.length] = createMarker(new GPoint(-71.37891900,42.63538900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Keystone Montessori School",'North_Chelmsford=' + North_Chelmsford.length);
Boston[Boston.length] = createMarker(new GPoint(-71.08230300,42.35034700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kingsley Montessori School",'Boston=' + Boston.length);
Lexington[Lexington.length] = createMarker(new GPoint(-71.21568700,42.41783100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lexington Montessori School",'Lexington=' + Lexington.length);
Woods_Hole[Woods_Hole.length] = createMarker(new GPoint(-70.66744300,41.52770000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little Harbor Montessori School",'Woods_Hole=' + Woods_Hole.length);
Melrose[Melrose.length] = createMarker(new GPoint(-71.06645500,42.45880000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Melrose Montessori School",'Melrose=' + Melrose.length);
East_Longmeadow[East_Longmeadow.length] = createMarker(new GPoint(-72.50075200,42.05645300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Children's Corner",'East_Longmeadow=' + East_Longmeadow.length);
Southbridge[Southbridge.length] = createMarker(new GPoint(-72.03500000,42.07320000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Children's House Of Southbridge",'Southbridge=' + Southbridge.length);
Holden[Holden.length] = createMarker(new GPoint(-71.84597900,42.34266700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Country Day School",'Holden=' + Holden.length);
Northampton[Northampton.length] = createMarker(new GPoint(-72.62714000,42.33176500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Montessori School Of Northampton",'Northampton=' + Northampton.length);
Natick[Natick.length] = createMarker(new GPoint(-71.31636200,42.27284900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Natick Montessori School",'Natick=' + Natick.length);
Newburyport[Newburyport.length] = createMarker(new GPoint(-70.87103500,42.81039700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Newburyport Montessori School",'Newburyport=' + Newburyport.length);
Littleton[Littleton.length] = createMarker(new GPoint(-71.44458300,42.53096400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oak Meadow Montessori School",'Littleton=' + Littleton.length);
Ashland[Ashland.length] = createMarker(new GPoint(-71.45214000,42.26974400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pincushion Hill Montessori School",'Ashland=' + Ashland.length);
Springfield[Springfield.length] = createMarker(new GPoint(-72.49729800,42.10572400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pioneer Valley Montessori School",'Springfield=' + Springfield.length);
Sandwich[Sandwich.length] = createMarker(new GPoint(-70.48488100,41.70440800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sandwich Montessori School",'Sandwich=' + Sandwich.length);
Cambridge[Cambridge.length] = createMarker(new GPoint(-71.13495500,42.38049100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spring Hill Montessori School",'Cambridge=' + Cambridge.length);
Beverly[Beverly.length] = createMarker(new GPoint(-70.84860300,42.55416500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stoneridge Children's Montessori School",'Beverly=' + Beverly.length);
Framingham[Framingham.length] = createMarker(new GPoint(-71.45108100,42.30474400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Summit Montessori School",'Framingham=' + Framingham.length);
Milton[Milton.length] = createMarker(new GPoint(-71.11849900,42.22293000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Thacher Montessori School",'Milton=' + Milton.length);
Vineyard_Haven[Vineyard_Haven.length] = createMarker(new GPoint(-70.60680000,41.43790000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vineyard Montessori School",'Vineyard_Haven=' + Vineyard_Haven.length);
Newton[Newton.length] = createMarker(new GPoint(-71.19386000,42.35669900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Walnut Park Montessori",'Newton=' + Newton.length);
Wellesley[Wellesley.length] = createMarker(new GPoint(-71.29324500,42.29210900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wellesley Montessori School",'Wellesley=' + Wellesley.length);
Westwood[Westwood.length] = createMarker(new GPoint(-71.22288500,42.22305300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Westwood Montessori School",'Westwood=' + Westwood.length);
Millis[Millis.length] = createMarker(new GPoint(-71.36623300,42.14397500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Woodside Montessori Academy",'Millis=' + Millis.length);
map.removeOverlays(Amherst);
map.removeOverlays(Andover);
map.removeOverlays(Ashland);
map.removeOverlays(Beverly);
map.removeOverlays(Boston);
map.removeOverlays(Cambridge);
map.removeOverlays(Canton);
map.removeOverlays(Dover);
map.removeOverlays(Duxbury);
map.removeOverlays(East_Longmeadow);
map.removeOverlays(Framingham);
map.removeOverlays(Holden);
map.removeOverlays(Jamaica_Plain);
map.removeOverlays(Lexington);
map.removeOverlays(Littleton);
map.removeOverlays(Marblehead);
map.removeOverlays(Melrose);
map.removeOverlays(Millis);
map.removeOverlays(Milton);
map.removeOverlays(Natick);
map.removeOverlays(Newburyport);
map.removeOverlays(Newton);
map.removeOverlays(North_Brookfield);
map.removeOverlays(North_Chelmsford);
map.removeOverlays(Northampton);
map.removeOverlays(Reading);
map.removeOverlays(Sagamore);
map.removeOverlays(Sandwich);
map.removeOverlays(Scituate);
map.removeOverlays(Southbridge);
map.removeOverlays(Springfield);
map.removeOverlays(Vineyard_Haven);
map.removeOverlays(Wellesley);
map.removeOverlays(Westwood);
map.removeOverlays(Woods_Hole);
setTimeout(function(){map.addOverlays(Amherst)},1000);
setTimeout(function(){map.addOverlays(Andover)},1000);
setTimeout(function(){map.addOverlays(Ashland)},1000);
setTimeout(function(){map.addOverlays(Beverly)},1000);
setTimeout(function(){map.addOverlays(Boston)},1000);
setTimeout(function(){map.addOverlays(Cambridge)},1000);
setTimeout(function(){map.addOverlays(Canton)},1000);
setTimeout(function(){map.addOverlays(Dover)},1000);
setTimeout(function(){map.addOverlays(Duxbury)},1000);
setTimeout(function(){map.addOverlays(East_Longmeadow)},1000);
setTimeout(function(){map.addOverlays(Framingham)},1000);
setTimeout(function(){map.addOverlays(Holden)},1000);
setTimeout(function(){map.addOverlays(Jamaica_Plain)},1000);
setTimeout(function(){map.addOverlays(Lexington)},1000);
setTimeout(function(){map.addOverlays(Littleton)},1000);
setTimeout(function(){map.addOverlays(Marblehead)},1000);
setTimeout(function(){map.addOverlays(Melrose)},1000);
setTimeout(function(){map.addOverlays(Millis)},1000);
setTimeout(function(){map.addOverlays(Milton)},1000);
setTimeout(function(){map.addOverlays(Natick)},1000);
setTimeout(function(){map.addOverlays(Newburyport)},1000);
setTimeout(function(){map.addOverlays(Newton)},1000);
setTimeout(function(){map.addOverlays(North_Brookfield)},1000);
setTimeout(function(){map.addOverlays(North_Chelmsford)},1000);
setTimeout(function(){map.addOverlays(Northampton)},1000);
setTimeout(function(){map.addOverlays(Reading)},1000);
setTimeout(function(){map.addOverlays(Sagamore)},1000);
setTimeout(function(){map.addOverlays(Sandwich)},1000);
setTimeout(function(){map.addOverlays(Scituate)},1000);
setTimeout(function(){map.addOverlays(Southbridge)},1000);
setTimeout(function(){map.addOverlays(Springfield)},1000);
setTimeout(function(){map.addOverlays(Vineyard_Haven)},1000);
setTimeout(function(){map.addOverlays(Wellesley)},1000);
setTimeout(function(){map.addOverlays(Westwood)},1000);
setTimeout(function(){map.addOverlays(Woods_Hole)},1000);
maxLng = -70.48488100;
maxLat = 42.81039700;
minLng = -72.62714000;
minLat = 41.43790000;
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(Amherst);
map.removeOverlays(Andover);
map.removeOverlays(Ashland);
map.removeOverlays(Beverly);
map.removeOverlays(Boston);
map.removeOverlays(Cambridge);
map.removeOverlays(Canton);
map.removeOverlays(Dover);
map.removeOverlays(Duxbury);
map.removeOverlays(East_Longmeadow);
map.removeOverlays(Framingham);
map.removeOverlays(Holden);
map.removeOverlays(Jamaica_Plain);
map.removeOverlays(Lexington);
map.removeOverlays(Littleton);
map.removeOverlays(Marblehead);
map.removeOverlays(Melrose);
map.removeOverlays(Millis);
map.removeOverlays(Milton);
map.removeOverlays(Natick);
map.removeOverlays(Newburyport);
map.removeOverlays(Newton);
map.removeOverlays(North_Brookfield);
map.removeOverlays(North_Chelmsford);
map.removeOverlays(Northampton);
map.removeOverlays(Reading);
map.removeOverlays(Sagamore);
map.removeOverlays(Sandwich);
map.removeOverlays(Scituate);
map.removeOverlays(Southbridge);
map.removeOverlays(Springfield);
map.removeOverlays(Vineyard_Haven);
map.removeOverlays(Wellesley);
map.removeOverlays(Westwood);
map.removeOverlays(Woods_Hole);
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(Amherst);map.removeOverlays(Amherst);
map.removeOverlays(Andover);
map.removeOverlays(Ashland);
map.removeOverlays(Beverly);
map.removeOverlays(Boston);
map.removeOverlays(Cambridge);
map.removeOverlays(Canton);
map.removeOverlays(Dover);
map.removeOverlays(Duxbury);
map.removeOverlays(East_Longmeadow);
map.removeOverlays(Framingham);
map.removeOverlays(Holden);
map.removeOverlays(Jamaica_Plain);
map.removeOverlays(Lexington);
map.removeOverlays(Littleton);
map.removeOverlays(Marblehead);
map.removeOverlays(Melrose);
map.removeOverlays(Millis);
map.removeOverlays(Milton);
map.removeOverlays(Natick);
map.removeOverlays(Newburyport);
map.removeOverlays(Newton);
map.removeOverlays(North_Brookfield);
map.removeOverlays(North_Chelmsford);
map.removeOverlays(Northampton);
map.removeOverlays(Reading);
map.removeOverlays(Sagamore);
map.removeOverlays(Sandwich);
map.removeOverlays(Scituate);
map.removeOverlays(Southbridge);
map.removeOverlays(Springfield);
map.removeOverlays(Vineyard_Haven);
map.removeOverlays(Wellesley);
map.removeOverlays(Westwood);
map.removeOverlays(Woods_Hole);
map.addOverlays(Amherst);
centerByArray(Amherst, false, false);
cntMarker += Amherst.length;
map.addOverlays(Andover);
centerByArray(Andover, false, false);
cntMarker += Andover.length;
map.addOverlays(Ashland);
centerByArray(Ashland, false, false);
cntMarker += Ashland.length;
map.addOverlays(Beverly);
centerByArray(Beverly, false, false);
cntMarker += Beverly.length;
map.addOverlays(Boston);
centerByArray(Boston, false, false);
cntMarker += Boston.length;
map.addOverlays(Cambridge);
centerByArray(Cambridge, false, false);
cntMarker += Cambridge.length;
map.addOverlays(Canton);
centerByArray(Canton, false, false);
cntMarker += Canton.length;
map.addOverlays(Dover);
centerByArray(Dover, false, false);
cntMarker += Dover.length;
map.addOverlays(Duxbury);
centerByArray(Duxbury, false, false);
cntMarker += Duxbury.length;
map.addOverlays(East_Longmeadow);
centerByArray(East_Longmeadow, false, false);
cntMarker += East_Longmeadow.length;
map.addOverlays(Framingham);
centerByArray(Framingham, false, false);
cntMarker += Framingham.length;
map.addOverlays(Holden);
centerByArray(Holden, false, false);
cntMarker += Holden.length;
map.addOverlays(Jamaica_Plain);
centerByArray(Jamaica_Plain, false, false);
cntMarker += Jamaica_Plain.length;
map.addOverlays(Lexington);
centerByArray(Lexington, false, false);
cntMarker += Lexington.length;
map.addOverlays(Littleton);
centerByArray(Littleton, false, false);
cntMarker += Littleton.length;
map.addOverlays(Marblehead);
centerByArray(Marblehead, false, false);
cntMarker += Marblehead.length;
map.addOverlays(Melrose);
centerByArray(Melrose, false, false);
cntMarker += Melrose.length;
map.addOverlays(Millis);
centerByArray(Millis, false, false);
cntMarker += Millis.length;
map.addOverlays(Milton);
centerByArray(Milton, false, false);
cntMarker += Milton.length;
map.addOverlays(Natick);
centerByArray(Natick, false, false);
cntMarker += Natick.length;
map.addOverlays(Newburyport);
centerByArray(Newburyport, false, false);
cntMarker += Newburyport.length;
map.addOverlays(Newton);
centerByArray(Newton, false, false);
cntMarker += Newton.length;
map.addOverlays(North_Brookfield);
centerByArray(North_Brookfield, false, false);
cntMarker += North_Brookfield.length;
map.addOverlays(North_Chelmsford);
centerByArray(North_Chelmsford, false, false);
cntMarker += North_Chelmsford.length;
map.addOverlays(Northampton);
centerByArray(Northampton, false, false);
cntMarker += Northampton.length;
map.addOverlays(Reading);
centerByArray(Reading, false, false);
cntMarker += Reading.length;
map.addOverlays(Sagamore);
centerByArray(Sagamore, false, false);
cntMarker += Sagamore.length;
map.addOverlays(Sandwich);
centerByArray(Sandwich, false, false);
cntMarker += Sandwich.length;
map.addOverlays(Scituate);
centerByArray(Scituate, false, false);
cntMarker += Scituate.length;
map.addOverlays(Southbridge);
centerByArray(Southbridge, false, false);
cntMarker += Southbridge.length;
map.addOverlays(Springfield);
centerByArray(Springfield, false, false);
cntMarker += Springfield.length;
map.addOverlays(Vineyard_Haven);
centerByArray(Vineyard_Haven, false, false);
cntMarker += Vineyard_Haven.length;
map.addOverlays(Wellesley);
centerByArray(Wellesley, false, false);
cntMarker += Wellesley.length;
map.addOverlays(Westwood);
centerByArray(Westwood, false, false);
cntMarker += Westwood.length;
map.addOverlays(Woods_Hole);
centerByArray(Woods_Hole, false, false);
cntMarker += Woods_Hole.length;
centerByArray(Amherst,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///12887,12888,13245,13049,12967,13104,34586,13460,13008,12906,13166,13450,13170,12984,13117,13215,13006,13150,13533,13456,13468,35077,13199,13520,12891,13100,13174,13464,30426,34769,13169,13167,13249,13517,34587,35106,34770,/all');
//window.open('/map.php?type=2&schools=12887,12888,13245,13049,12967,13104,34586,13460,13008,12906,13166,13450,13170,12984,13117,13215,13006,13150,13533,13456,13468,35077,13199,13520,12891,13100,13174,13464,30426,34769,13169,13167,13249,13517,34587,35106,34770,&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;
}