function addMarkers() { mySelect = document.getElementById('selection'); Castine = [];Aurora = [];Otis = [];Blue_Hill = [];Brooklin = [];Brooksville = [];Bucksport = [];Eastbrook = [];Bar_Harbor = [];Dedham = [];Deer_Isle = [];Ellsworth = [];Frenchboro = [];Winter_Harbor = [];Hancock = [];Islesford = [];Lamoine = [];Mount_Desert = [];Sullivan = [];Northeast_Hbr = [];Orland = [];Southwest_Hbr = [];Penobscot = [];Sedgwick = [];Surry = [];Swans_Island = [];Bass_Harbor = [];Trenton = [];mySelect.options[mySelect.options.length] = new Option("Aurora schools",'all=Aurora'); mySelect.options[mySelect.options.length] = new Option("Bar Harbor schools",'all=Bar_Harbor'); mySelect.options[mySelect.options.length] = new Option("Bass Harbor schools",'all=Bass_Harbor'); mySelect.options[mySelect.options.length] = new Option("Blue Hill schools",'all=Blue_Hill'); mySelect.options[mySelect.options.length] = new Option("Brooklin schools",'all=Brooklin'); mySelect.options[mySelect.options.length] = new Option("Brooksville schools",'all=Brooksville'); mySelect.options[mySelect.options.length] = new Option("Bucksport schools",'all=Bucksport'); mySelect.options[mySelect.options.length] = new Option("Castine schools",'all=Castine'); mySelect.options[mySelect.options.length] = new Option("Dedham schools",'all=Dedham'); mySelect.options[mySelect.options.length] = new Option("Deer Isle schools",'all=Deer_Isle'); mySelect.options[mySelect.options.length] = new Option("Eastbrook schools",'all=Eastbrook'); mySelect.options[mySelect.options.length] = new Option("Ellsworth schools",'all=Ellsworth'); mySelect.options[mySelect.options.length] = new Option("Frenchboro schools",'all=Frenchboro'); mySelect.options[mySelect.options.length] = new Option("Hancock schools",'all=Hancock'); mySelect.options[mySelect.options.length] = new Option("Islesford schools",'all=Islesford'); mySelect.options[mySelect.options.length] = new Option("Lamoine schools",'all=Lamoine'); mySelect.options[mySelect.options.length] = new Option("Mount Desert schools",'all=Mount_Desert'); mySelect.options[mySelect.options.length] = new Option("Northeast Hbr schools",'all=Northeast_Hbr'); mySelect.options[mySelect.options.length] = new Option("Orland schools",'all=Orland'); mySelect.options[mySelect.options.length] = new Option("Otis schools",'all=Otis'); mySelect.options[mySelect.options.length] = new Option("Penobscot schools",'all=Penobscot'); mySelect.options[mySelect.options.length] = new Option("Sedgwick schools",'all=Sedgwick'); mySelect.options[mySelect.options.length] = new Option("Southwest Hbr schools",'all=Southwest_Hbr'); mySelect.options[mySelect.options.length] = new Option("Sullivan schools",'all=Sullivan'); mySelect.options[mySelect.options.length] = new Option("Surry schools",'all=Surry'); mySelect.options[mySelect.options.length] = new Option("Swans Island schools",'all=Swans_Island'); mySelect.options[mySelect.options.length] = new Option("Trenton schools",'all=Trenton'); mySelect.options[mySelect.options.length] = new Option("Winter Harbor schools",'all=Winter_Harbor'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Castine[Castine.length] = createMarker(new GPoint(-68.79810333,44.40290070),"
Adams School
Po Box 29
Castine, ME 04421

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adams School",'Castine=' + Castine.length); Aurora[Aurora.length] = createMarker(new GPoint(-68.30781555,44.86363602),"
Airline Community School
26 Great Pond Road
Aurora, ME 04408

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Airline Community School",'Aurora=' + Aurora.length); Otis[Otis.length] = createMarker(new GPoint(-68.42050171,44.56159973),"
Beech Hill School
105 Otis Road
Otis, ME 04605

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beech Hill School",'Otis=' + Otis.length); Blue_Hill[Blue_Hill.length] = createMarker(new GPoint(-68.59069824,44.41429901),"
Blue Hill Consolidated School
60 High Street
Blue Hill, ME 04614

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blue Hill Consolidated School",'Blue_Hill=' + Blue_Hill.length); Brooklin[Brooklin.length] = createMarker(new GPoint(-68.56928253,44.26608276),"
Brooklin School
Rte 175 Po Box 120
Brooklin, ME 04616

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brooklin School",'Brooklin=' + Brooklin.length); Brooksville[Brooksville.length] = createMarker(new GPoint(-68.75670624,44.39046860),"
Brooksville Elementary School
1527 Coastal Road
Brooksville, ME 04617

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brooksville Elementary School",'Brooksville=' + Brooksville.length); Bucksport[Bucksport.length] = createMarker(new GPoint(-68.78447723,44.57627869),"
Bucksport High School
Broadway Ext Po Box 400
Bucksport, ME 04416

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bucksport High School",'Bucksport=' + Bucksport.length); Bucksport[Bucksport.length] = createMarker(new GPoint(-68.77864075,44.57559967),"
Bucksport Middle School
100 Miles Lane Po Box 910
Bucksport, ME 04416

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bucksport Middle School",'Bucksport=' + Bucksport.length); Eastbrook[Eastbrook.length] = createMarker(new GPoint(-68.24069977,44.61529922),"
Cave Hill School
1205 Eastbrook Road
Eastbrook, ME 04634

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cave Hill School",'Eastbrook=' + Eastbrook.length); Bar_Harbor[Bar_Harbor.length] = createMarker(new GPoint(-68.21614075,44.38698196),"
Conners-emerson School
11 Eagle Lake Road
Bar Harbor, ME 04609

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conners-emerson School",'Bar_Harbor=' + Bar_Harbor.length); Dedham[Dedham.length] = createMarker(new GPoint(-68.62550354,44.71789932),"
Dedham School
2065 Main Road
Dedham, ME 04429

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dedham School",'Dedham=' + Dedham.length); Deer_Isle[Deer_Isle.length] = createMarker(new GPoint(-68.68123627,44.24124908),"
Deer Isle-stonington Elementary School
249 North Deer Isle Road
Deer Isle, ME 04627

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deer Isle-stonington Elementary School",'Deer_Isle=' + Deer_Isle.length); Deer_Isle[Deer_Isle.length] = createMarker(new GPoint(-68.68153381,44.24162674),"
Deer Isle-stonington High School
251 North Deer Isle Road
Deer Isle, ME 04627

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deer Isle-stonington High School",'Deer_Isle=' + Deer_Isle.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-68.42656708,44.54804611),"
Dr Charles C Knowlton School
160 State Street
Ellsworth, ME 04605

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dr Charles C Knowlton School",'Ellsworth=' + Ellsworth.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-68.43062592,44.55421448),"
Ellsworth High School
299 State Street
Ellsworth, ME 04605

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ellsworth High School",'Ellsworth=' + Ellsworth.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-68.43333435,44.55098724),"
Ellsworth Middle School
20 Forrest Avenue
Ellsworth, ME 04605

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ellsworth Middle School",'Ellsworth=' + Ellsworth.length); Frenchboro[Frenchboro.length] = createMarker(new GPoint(-68.36250305,44.11827087),"
Frenchboro Elementary School
Main Street
Frenchboro, ME 04635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frenchboro Elementary School",'Frenchboro=' + Frenchboro.length); Bucksport[Bucksport.length] = createMarker(new GPoint(-68.79013824,44.56613922),"
G Herbert Jewett School
Bridge St Po Box 636
Bucksport, ME 04416

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("G Herbert Jewett School",'Bucksport=' + Bucksport.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-68.42575836,44.54632187),"
General Bryant E Moore School
125 State Street
Ellsworth, ME 04605

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("General Bryant E Moore School",'Ellsworth=' + Ellsworth.length); Winter_Harbor[Winter_Harbor.length] = createMarker(new GPoint(-68.06448364,44.44796371),"
Gouldsboro Grammar School
22 School St Po Box 129
Winter Harbor, ME 04693

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gouldsboro Grammar School",'Winter_Harbor=' + Winter_Harbor.length); Ellsworth[Ellsworth.length] = createMarker(new GPoint(-68.45839691,44.57621765),"
Hancock County Technical Center
112 Boggy Brook Road
Ellsworth, ME 04605

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hancock County Technical Center",'Ellsworth=' + Ellsworth.length); Hancock[Hancock.length] = createMarker(new GPoint(-68.25347137,44.52856827),"
Hancock Grammar School
Rte 1 Po Box 37
Hancock, ME 04640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hancock Grammar School",'Hancock=' + Hancock.length); Islesford[Islesford.length] = createMarker(new GPoint(-68.23429871,44.26160049),"
Islesford Elementary School
P.o. Box 8
Islesford, ME 04646

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Islesford Elementary School",'Islesford=' + Islesford.length); Lamoine[Lamoine.length] = createMarker(new GPoint(-68.34033966,44.47882462),"
Lamoine Consolidated School
53 Lamoine Beach Road
Lamoine, ME 04605

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lamoine Consolidated School",'Lamoine=' + Lamoine.length); Mount_Desert[Mount_Desert.length] = createMarker(new GPoint(-68.32663727,44.33990097),"
Longfellow School
Co Po Box 60
Mount Desert, ME 04660

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Longfellow School",'Mount_Desert=' + Mount_Desert.length); Bucksport[Bucksport.length] = createMarker(new GPoint(-68.77581787,44.58066177),"
Miles Lane School
Miles Ln Po Box 310
Bucksport, ME 04416

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miles Lane School",'Bucksport=' + Bucksport.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-68.19709015,44.52330017),"
Mountain View School
542 Bert Gray Road
Sullivan, ME 04664

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain View School",'Sullivan=' + Sullivan.length); Northeast_Hbr[Northeast_Hbr.length] = createMarker(new GPoint(-68.29206085,44.29378128),"
Mt Desert Elementary School
Joy Rd P.o. Box 308
Northeast Hbr, ME 04662

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt Desert Elementary School",'Northeast_Hbr=' + Northeast_Hbr.length); Mount_Desert[Mount_Desert.length] = createMarker(new GPoint(-68.30338287,44.36558151),"
Mt Desert Island High School
1081 Eagle Lake Rd Po Box 180
Mount Desert, ME 04660

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Desert Island High School",'Mount_Desert=' + Mount_Desert.length); Orland[Orland.length] = createMarker(new GPoint(-68.69309998,44.56869888),"
Orland Consolidated School
21 Schoolhouse Rd Po Box 9
Orland, ME 04472

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Orland Consolidated School",'Orland=' + Orland.length); Southwest_Hbr[Southwest_Hbr.length] = createMarker(new GPoint(-68.32589722,44.27967834),"
Pemetic Elementary School
Main St Po Box 255
Southwest Hbr, ME 04679

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pemetic Elementary School",'Southwest_Hbr=' + Southwest_Hbr.length); Penobscot[Penobscot.length] = createMarker(new GPoint(-68.71260071,44.46879959),"
Penobscot Elementary School
Po Box 60
Penobscot, ME 04476

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penobscot Elementary School",'Penobscot=' + Penobscot.length); Sedgwick[Sedgwick.length] = createMarker(new GPoint(-68.64920044,44.32630157),"
Sedgwick Elementary School
Rr 1 Box 4075
Sedgwick, ME 04676

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sedgwick Elementary School",'Sedgwick=' + Sedgwick.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-68.16807556,44.51147461),"
Sumner Memorial High School
2456 Us Hwy 1
Sullivan, ME 04664

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sumner Memorial High School",'Sullivan=' + Sullivan.length); Surry[Surry.length] = createMarker(new GPoint(-68.51196289,44.52716064),"
Surry Elementary School
754 N Bend Road
Surry, ME 04684

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Surry Elementary School",'Surry=' + Surry.length); Swans_Island[Swans_Island.length] = createMarker(new GPoint(-68.43319702,44.16159821),"
Swans Island Elementary School
Po Box 13
Swans Island, ME 04685

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Swans Island Elementary School",'Swans_Island=' + Swans_Island.length); Bass_Harbor[Bass_Harbor.length] = createMarker(new GPoint(-68.34220123,44.23770142),"
Tremont Consolidated School
Hc 33 Box 74
Bass Harbor, ME 04653

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tremont Consolidated School",'Bass_Harbor=' + Bass_Harbor.length); Trenton[Trenton.length] = createMarker(new GPoint(-68.36422729,44.45513535),"
Trenton Elementary School
51 School Road
Trenton, ME 04605

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trenton Elementary School",'Trenton=' + Trenton.length); Bucksport[Bucksport.length] = createMarker(new GPoint(-68.79330444,44.57609177),"
Walter H Gardner Middle School
63 Elm St Po Box 910
Bucksport, ME 04416

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Walter H Gardner Middle School",'Bucksport=' + Bucksport.length); Winter_Harbor[Winter_Harbor.length] = createMarker(new GPoint(-68.08669281,44.39146042),"
Winter Harbor Grammar School
22 School St Po Box 99
Winter Harbor, ME 04693

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Winter Harbor Grammar School",'Winter_Harbor=' + Winter_Harbor.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(Aurora); map.removeOverlays(Bar_Harbor); map.removeOverlays(Bass_Harbor); map.removeOverlays(Blue_Hill); map.removeOverlays(Brooklin); map.removeOverlays(Brooksville); map.removeOverlays(Bucksport); map.removeOverlays(Castine); map.removeOverlays(Dedham); map.removeOverlays(Deer_Isle); map.removeOverlays(Eastbrook); map.removeOverlays(Ellsworth); map.removeOverlays(Frenchboro); map.removeOverlays(Hancock); map.removeOverlays(Islesford); map.removeOverlays(Lamoine); map.removeOverlays(Mount_Desert); map.removeOverlays(Northeast_Hbr); map.removeOverlays(Orland); map.removeOverlays(Otis); map.removeOverlays(Penobscot); map.removeOverlays(Sedgwick); map.removeOverlays(Southwest_Hbr); map.removeOverlays(Sullivan); map.removeOverlays(Surry); map.removeOverlays(Swans_Island); map.removeOverlays(Trenton); map.removeOverlays(Winter_Harbor); 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(Castine);map.removeOverlays(Aurora); map.removeOverlays(Bar_Harbor); map.removeOverlays(Bass_Harbor); map.removeOverlays(Blue_Hill); map.removeOverlays(Brooklin); map.removeOverlays(Brooksville); map.removeOverlays(Bucksport); map.removeOverlays(Castine); map.removeOverlays(Dedham); map.removeOverlays(Deer_Isle); map.removeOverlays(Eastbrook); map.removeOverlays(Ellsworth); map.removeOverlays(Frenchboro); map.removeOverlays(Hancock); map.removeOverlays(Islesford); map.removeOverlays(Lamoine); map.removeOverlays(Mount_Desert); map.removeOverlays(Northeast_Hbr); map.removeOverlays(Orland); map.removeOverlays(Otis); map.removeOverlays(Penobscot); map.removeOverlays(Sedgwick); map.removeOverlays(Southwest_Hbr); map.removeOverlays(Sullivan); map.removeOverlays(Surry); map.removeOverlays(Swans_Island); map.removeOverlays(Trenton); map.removeOverlays(Winter_Harbor); map.addOverlays(Aurora); centerByArray(Aurora, false, false); cntMarker += Aurora.length; map.addOverlays(Bar_Harbor); centerByArray(Bar_Harbor, false, false); cntMarker += Bar_Harbor.length; map.addOverlays(Bass_Harbor); centerByArray(Bass_Harbor, false, false); cntMarker += Bass_Harbor.length; map.addOverlays(Blue_Hill); centerByArray(Blue_Hill, false, false); cntMarker += Blue_Hill.length; map.addOverlays(Brooklin); centerByArray(Brooklin, false, false); cntMarker += Brooklin.length; map.addOverlays(Brooksville); centerByArray(Brooksville, false, false); cntMarker += Brooksville.length; map.addOverlays(Bucksport); centerByArray(Bucksport, false, false); cntMarker += Bucksport.length; map.addOverlays(Castine); centerByArray(Castine, false, false); cntMarker += Castine.length; map.addOverlays(Dedham); centerByArray(Dedham, false, false); cntMarker += Dedham.length; map.addOverlays(Deer_Isle); centerByArray(Deer_Isle, false, false); cntMarker += Deer_Isle.length; map.addOverlays(Eastbrook); centerByArray(Eastbrook, false, false); cntMarker += Eastbrook.length; map.addOverlays(Ellsworth); centerByArray(Ellsworth, false, false); cntMarker += Ellsworth.length; map.addOverlays(Frenchboro); centerByArray(Frenchboro, false, false); cntMarker += Frenchboro.length; map.addOverlays(Hancock); centerByArray(Hancock, false, false); cntMarker += Hancock.length; map.addOverlays(Islesford); centerByArray(Islesford, false, false); cntMarker += Islesford.length; map.addOverlays(Lamoine); centerByArray(Lamoine, false, false); cntMarker += Lamoine.length; map.addOverlays(Mount_Desert); centerByArray(Mount_Desert, false, false); cntMarker += Mount_Desert.length; map.addOverlays(Northeast_Hbr); centerByArray(Northeast_Hbr, false, false); cntMarker += Northeast_Hbr.length; map.addOverlays(Orland); centerByArray(Orland, false, false); cntMarker += Orland.length; map.addOverlays(Otis); centerByArray(Otis, false, false); cntMarker += Otis.length; map.addOverlays(Penobscot); centerByArray(Penobscot, false, false); cntMarker += Penobscot.length; map.addOverlays(Sedgwick); centerByArray(Sedgwick, false, false); cntMarker += Sedgwick.length; map.addOverlays(Southwest_Hbr); centerByArray(Southwest_Hbr, false, false); cntMarker += Southwest_Hbr.length; map.addOverlays(Sullivan); centerByArray(Sullivan, false, false); cntMarker += Sullivan.length; map.addOverlays(Surry); centerByArray(Surry, false, false); cntMarker += Surry.length; map.addOverlays(Swans_Island); centerByArray(Swans_Island, false, false); cntMarker += Swans_Island.length; map.addOverlays(Trenton); centerByArray(Trenton, false, false); cntMarker += Trenton.length; map.addOverlays(Winter_Harbor); centerByArray(Winter_Harbor, false, false); cntMarker += Winter_Harbor.length; centerByArray(Castine,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'); } }