function addMarkers() { mySelect = document.getElementById('selection'); West_Paris = [];Andover = [];W_Baldwin = [];Brownfield = [];Buckfield = [];Canton = [];Fryeburg = [];Cornish = [];Bethel = [];Denmark = [];Dixfield = [];Norway = [];Sumner = [];Hebron = [];Hiram = [];Oxford = [];Mexico = [];South_Paris = [];Rumford = [];Lovell = [];Otisfield = [];Peru = [];Waterford = [];Bryant_Pond = [];mySelect.options[mySelect.options.length] = new Option("Andover schools",'all=Andover'); mySelect.options[mySelect.options.length] = new Option("Bethel schools",'all=Bethel'); mySelect.options[mySelect.options.length] = new Option("Brownfield schools",'all=Brownfield'); mySelect.options[mySelect.options.length] = new Option("Bryant Pond schools",'all=Bryant_Pond'); mySelect.options[mySelect.options.length] = new Option("Buckfield schools",'all=Buckfield'); mySelect.options[mySelect.options.length] = new Option("Canton schools",'all=Canton'); mySelect.options[mySelect.options.length] = new Option("Cornish schools",'all=Cornish'); mySelect.options[mySelect.options.length] = new Option("Denmark schools",'all=Denmark'); mySelect.options[mySelect.options.length] = new Option("Dixfield schools",'all=Dixfield'); mySelect.options[mySelect.options.length] = new Option("Fryeburg schools",'all=Fryeburg'); mySelect.options[mySelect.options.length] = new Option("Hebron schools",'all=Hebron'); mySelect.options[mySelect.options.length] = new Option("Hiram schools",'all=Hiram'); mySelect.options[mySelect.options.length] = new Option("Lovell schools",'all=Lovell'); mySelect.options[mySelect.options.length] = new Option("Mexico schools",'all=Mexico'); mySelect.options[mySelect.options.length] = new Option("Norway schools",'all=Norway'); mySelect.options[mySelect.options.length] = new Option("Otisfield schools",'all=Otisfield'); mySelect.options[mySelect.options.length] = new Option("Oxford schools",'all=Oxford'); mySelect.options[mySelect.options.length] = new Option("Peru schools",'all=Peru'); mySelect.options[mySelect.options.length] = new Option("Rumford schools",'all=Rumford'); mySelect.options[mySelect.options.length] = new Option("South Paris schools",'all=South_Paris'); mySelect.options[mySelect.options.length] = new Option("Sumner schools",'all=Sumner'); mySelect.options[mySelect.options.length] = new Option("W Baldwin schools",'all=W_Baldwin'); mySelect.options[mySelect.options.length] = new Option("Waterford schools",'all=Waterford'); mySelect.options[mySelect.options.length] = new Option("West Paris schools",'all=West_Paris'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); West_Paris[West_Paris.length] = createMarker(new GPoint(-70.56958771,44.32703781),"
Agnes Gray School
170 Main Street
West Paris, ME 04289

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Agnes Gray School",'West_Paris=' + West_Paris.length); Andover[Andover.length] = createMarker(new GPoint(-70.75479126,44.63370514),"
Andover Elementary School
85 Pine St Po Box 70
Andover, ME 04216

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Andover Elementary School",'Andover=' + Andover.length); W_Baldwin[W_Baldwin.length] = createMarker(new GPoint(-70.72408295,43.80816269),"
Baldwin Consolidated School
536 Pequawket Trail
W Baldwin, ME 04091

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Baldwin Consolidated School",'W_Baldwin=' + W_Baldwin.length); Brownfield[Brownfield.length] = createMarker(new GPoint(-70.92357635,43.93516159),"
Brownfield Consolidated School
90 Main Street
Brownfield, ME 04010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brownfield Consolidated School",'Brownfield=' + Brownfield.length); Buckfield[Buckfield.length] = createMarker(new GPoint(-70.35889435,44.29531097),"
Buckfield Junior Senior High School
160 Morrill Street
Buckfield, ME 04220

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Buckfield Junior Senior High School",'Buckfield=' + Buckfield.length); Canton[Canton.length] = createMarker(new GPoint(-70.31533051,44.44054031),"
Canton Elementary School
Rte 140 Po Box 689
Canton, ME 04221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Canton Elementary School",'Canton=' + Canton.length); Fryeburg[Fryeburg.length] = createMarker(new GPoint(-70.94767761,44.00350189),"
Charles A Snow School
11 Pine Street
Fryeburg, ME 04037

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Charles A Snow School",'Fryeburg=' + Fryeburg.length); Cornish[Cornish.length] = createMarker(new GPoint(-70.80609894,43.78279877),"
Cornish Elementary School
17 School Street
Cornish, ME 04020

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cornish Elementary School",'Cornish=' + Cornish.length); Bethel[Bethel.length] = createMarker(new GPoint(-70.78464508,44.40410614),"
Crescent Park School
19 Crescent Lane
Bethel, ME 04217

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crescent Park School",'Bethel=' + Bethel.length); Denmark[Denmark.length] = createMarker(new GPoint(-70.85522461,43.96243286),"
Denmark Elementary School
637 West Main Street
Denmark, ME 04022

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Denmark Elementary School",'Denmark=' + Denmark.length); Dixfield[Dixfield.length] = createMarker(new GPoint(-70.45305634,44.54039001),"
Dirigo High School
145 Weld Street
Dixfield, ME 04224

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dirigo High School",'Dixfield=' + Dixfield.length); Dixfield[Dixfield.length] = createMarker(new GPoint(-70.45011902,44.53907394),"
Dixfield Elementary School
33 Nash Street
Dixfield, ME 04224

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dixfield Elementary School",'Dixfield=' + Dixfield.length); Norway[Norway.length] = createMarker(new GPoint(-70.53552246,44.21172714),"
Guy E Rowe School
219 Main Street
Norway, ME 04268

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Guy E Rowe School",'Norway=' + Norway.length); Sumner[Sumner.length] = createMarker(new GPoint(-70.38374329,44.36079407),"
Hartford-sumner Elementary School
145 Main Street
Sumner, ME 04292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hartford-sumner Elementary School",'Sumner=' + Sumner.length); Hebron[Hebron.length] = createMarker(new GPoint(-70.36090088,44.22364044),"
Hebron Station School
884 Station Road
Hebron, ME 04238

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hebron Station School",'Hebron=' + Hebron.length); Hiram[Hiram.length] = createMarker(new GPoint(-70.79985809,43.88111877),"
Hiram Elementary School
Po Box 293
Hiram, ME 04041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hiram Elementary School",'Hiram=' + Hiram.length); West_Paris[West_Paris.length] = createMarker(new GPoint(-70.57006073,44.32627869),"
Legion Memorial School
20 Kingsbury Street
West Paris, ME 04289

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Legion Memorial School",'West_Paris=' + West_Paris.length); Oxford[Oxford.length] = createMarker(new GPoint(-70.52537537,44.19264603),"
Madison Avenue Elementary School
5 Madison Avenue
Oxford, ME 04270

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Madison Avenue Elementary School",'Oxford=' + Oxford.length); Mexico[Mexico.length] = createMarker(new GPoint(-70.53413391,44.55569839),"
Meroby Elementary School
21 Cross Street
Mexico, ME 04257

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meroby Elementary School",'Mexico=' + Mexico.length); South_Paris[South_Paris.length] = createMarker(new GPoint(-70.51131439,44.22327423),"
Mildred M Fox School
10 East Main Street
South Paris, ME 04281

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mildred M Fox School",'South_Paris=' + South_Paris.length); Fryeburg[Fryeburg.length] = createMarker(new GPoint(-70.97095490,44.02033615),"
Molly Ockett Middle School
25 Molly Ockett Drive
Fryeburg, ME 04037

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Molly Ockett Middle School",'Fryeburg=' + Fryeburg.length); Rumford[Rumford.length] = createMarker(new GPoint(-70.55881500,44.56708145),"
Mountain Valley High School
799 Hancock Street
Rumford, ME 04276

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Valley High School",'Rumford=' + Rumford.length); Mexico[Mexico.length] = createMarker(new GPoint(-70.54484558,44.56257629),"
Mountain Valley Middle School
58 Highland Terrace
Mexico, ME 04257

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mountain Valley Middle School",'Mexico=' + Mexico.length); Lovell[Lovell.length] = createMarker(new GPoint(-70.89254761,44.12546158),"
New Suncook School
95 Main St Po Box H
Lovell, ME 04051

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Suncook School",'Lovell=' + Lovell.length); Otisfield[Otisfield.length] = createMarker(new GPoint(-70.53439331,44.06171417),"
Otisfield Community School
416 Powhattan Road
Otisfield, ME 04270

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Otisfield Community School",'Otisfield=' + Otisfield.length); Oxford[Oxford.length] = createMarker(new GPoint(-70.49355316,44.13613892),"
Oxford Elementary School
79 Pleasant St Po Box 839
Oxford, ME 04270

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oxford Elementary School",'Oxford=' + Oxford.length); South_Paris[South_Paris.length] = createMarker(new GPoint(-70.52774811,44.21279907),"
Oxford Hills Comprehensive High School
256 Main Street
South Paris, ME 04281

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oxford Hills Comprehensive High School",'South_Paris=' + South_Paris.length); South_Paris[South_Paris.length] = createMarker(new GPoint(-70.51358795,44.21972275),"
Oxford Hills Middle School
100 Pine Street
South Paris, ME 04281

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oxford Hills Middle School",'South_Paris=' + South_Paris.length); Norway[Norway.length] = createMarker(new GPoint(-70.57530212,44.22019958),"
Oxford Hills Technical - Region 11 High School
256 Main St Po Box 313
Norway, ME 04268

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oxford Hills Technical - Region 11 High School",'Norway=' + Norway.length); Peru[Peru.length] = createMarker(new GPoint(-70.46533203,44.52500153),"
Peru Elementary School
30 Main Street
Peru, ME 04290

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peru Elementary School",'Peru=' + Peru.length); Rumford[Rumford.length] = createMarker(new GPoint(-70.55413818,44.55293655),"
Rumford Elementary School
121 Lincoln Avenue
Rumford, ME 04276

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rumford Elementary School",'Rumford=' + Rumford.length); Hiram[Hiram.length] = createMarker(new GPoint(-70.87117767,43.81190872),"
Sacopee Valley Junior Senior High School
115 So Hiram Road
Hiram, ME 04041

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacopee Valley Junior Senior High School",'Hiram=' + Hiram.length); Fryeburg[Fryeburg.length] = createMarker(new GPoint(-70.95459747,44.03730011),"
Sadie F Adams School
Hc 68 Box 127a
Fryeburg, ME 04037

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sadie F Adams School",'Fryeburg=' + Fryeburg.length); Mexico[Mexico.length] = createMarker(new GPoint(-70.50602722,44.53468704),"
School Of Applied Tech-region 9
377 River Road
Mexico, ME 04257

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("School Of Applied Tech-region 9",'Mexico=' + Mexico.length); Hiram[Hiram.length] = createMarker(new GPoint(-70.86158752,43.81056213),"
South Hiram Elementary School
213 So Hiram Road
Hiram, ME 04041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Hiram Elementary School",'Hiram=' + Hiram.length); Dixfield[Dixfield.length] = createMarker(new GPoint(-70.45046234,44.54850006),"
T W Kelly Dirigo Middle School
45 Middle School Drive
Dixfield, ME 04224

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("T W Kelly Dirigo Middle School",'Dixfield=' + Dixfield.length); Bethel[Bethel.length] = createMarker(new GPoint(-70.76681519,44.41759872),"
Telstar High School
284 Walkers Mills Road
Bethel, ME 04217

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Telstar High School",'Bethel=' + Bethel.length); Bethel[Bethel.length] = createMarker(new GPoint(-70.76681519,44.41759872),"
Telstar Middle School
284 Walkers Mills Road
Bethel, ME 04217

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Telstar Middle School",'Bethel=' + Bethel.length); Rumford[Rumford.length] = createMarker(new GPoint(-70.54755402,44.53331375),"
Virginia School
750 Forest Avenue
Rumford, ME 04276

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Virginia School",'Rumford=' + Rumford.length); Waterford[Waterford.length] = createMarker(new GPoint(-70.76258087,44.22666168),"
Waterford Memorial School
148 Valley Road
Waterford, ME 04088

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Waterford Memorial School",'Waterford=' + Waterford.length); Bryant_Pond[Bryant_Pond.length] = createMarker(new GPoint(-70.64593506,44.39600372),"
Woodstock School
224 Rumford Avenue
Bryant Pond, ME 04219

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodstock School",'Bryant_Pond=' + Bryant_Pond.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(Andover); map.removeOverlays(Bethel); map.removeOverlays(Brownfield); map.removeOverlays(Bryant_Pond); map.removeOverlays(Buckfield); map.removeOverlays(Canton); map.removeOverlays(Cornish); map.removeOverlays(Denmark); map.removeOverlays(Dixfield); map.removeOverlays(Fryeburg); map.removeOverlays(Hebron); map.removeOverlays(Hiram); map.removeOverlays(Lovell); map.removeOverlays(Mexico); map.removeOverlays(Norway); map.removeOverlays(Otisfield); map.removeOverlays(Oxford); map.removeOverlays(Peru); map.removeOverlays(Rumford); map.removeOverlays(South_Paris); map.removeOverlays(Sumner); map.removeOverlays(W_Baldwin); map.removeOverlays(Waterford); map.removeOverlays(West_Paris); 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(West_Paris);map.removeOverlays(Andover); map.removeOverlays(Bethel); map.removeOverlays(Brownfield); map.removeOverlays(Bryant_Pond); map.removeOverlays(Buckfield); map.removeOverlays(Canton); map.removeOverlays(Cornish); map.removeOverlays(Denmark); map.removeOverlays(Dixfield); map.removeOverlays(Fryeburg); map.removeOverlays(Hebron); map.removeOverlays(Hiram); map.removeOverlays(Lovell); map.removeOverlays(Mexico); map.removeOverlays(Norway); map.removeOverlays(Otisfield); map.removeOverlays(Oxford); map.removeOverlays(Peru); map.removeOverlays(Rumford); map.removeOverlays(South_Paris); map.removeOverlays(Sumner); map.removeOverlays(W_Baldwin); map.removeOverlays(Waterford); map.removeOverlays(West_Paris); map.addOverlays(Andover); centerByArray(Andover, false, false); cntMarker += Andover.length; map.addOverlays(Bethel); centerByArray(Bethel, false, false); cntMarker += Bethel.length; map.addOverlays(Brownfield); centerByArray(Brownfield, false, false); cntMarker += Brownfield.length; map.addOverlays(Bryant_Pond); centerByArray(Bryant_Pond, false, false); cntMarker += Bryant_Pond.length; map.addOverlays(Buckfield); centerByArray(Buckfield, false, false); cntMarker += Buckfield.length; map.addOverlays(Canton); centerByArray(Canton, false, false); cntMarker += Canton.length; map.addOverlays(Cornish); centerByArray(Cornish, false, false); cntMarker += Cornish.length; map.addOverlays(Denmark); centerByArray(Denmark, false, false); cntMarker += Denmark.length; map.addOverlays(Dixfield); centerByArray(Dixfield, false, false); cntMarker += Dixfield.length; map.addOverlays(Fryeburg); centerByArray(Fryeburg, false, false); cntMarker += Fryeburg.length; map.addOverlays(Hebron); centerByArray(Hebron, false, false); cntMarker += Hebron.length; map.addOverlays(Hiram); centerByArray(Hiram, false, false); cntMarker += Hiram.length; map.addOverlays(Lovell); centerByArray(Lovell, false, false); cntMarker += Lovell.length; map.addOverlays(Mexico); centerByArray(Mexico, false, false); cntMarker += Mexico.length; map.addOverlays(Norway); centerByArray(Norway, false, false); cntMarker += Norway.length; map.addOverlays(Otisfield); centerByArray(Otisfield, false, false); cntMarker += Otisfield.length; map.addOverlays(Oxford); centerByArray(Oxford, false, false); cntMarker += Oxford.length; map.addOverlays(Peru); centerByArray(Peru, false, false); cntMarker += Peru.length; map.addOverlays(Rumford); centerByArray(Rumford, false, false); cntMarker += Rumford.length; map.addOverlays(South_Paris); centerByArray(South_Paris, false, false); cntMarker += South_Paris.length; map.addOverlays(Sumner); centerByArray(Sumner, false, false); cntMarker += Sumner.length; map.addOverlays(W_Baldwin); centerByArray(W_Baldwin, false, false); cntMarker += W_Baldwin.length; map.addOverlays(Waterford); centerByArray(Waterford, false, false); cntMarker += Waterford.length; map.addOverlays(West_Paris); centerByArray(West_Paris, false, false); cntMarker += West_Paris.length; centerByArray(West_Paris,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'); } }