function addMarkers() { mySelect = document.getElementById('selection'); Athens = [];Skowhegan = [];Burnham = [];Canaan = [];Bingham = [];N_Anson = [];Norridgewock = [];Cornville = [];Fairfield = [];Jackman = [];Anson = [];Harmony = [];Hartland = [];Madison = [];Pittsfield = [];Palmyra = [];Rockwood = [];Smithfield = [];Solon = [];St_Albans = [];mySelect.options[mySelect.options.length] = new Option("Anson schools",'all=Anson'); mySelect.options[mySelect.options.length] = new Option("Athens schools",'all=Athens'); mySelect.options[mySelect.options.length] = new Option("Bingham schools",'all=Bingham'); mySelect.options[mySelect.options.length] = new Option("Burnham schools",'all=Burnham'); mySelect.options[mySelect.options.length] = new Option("Canaan schools",'all=Canaan'); mySelect.options[mySelect.options.length] = new Option("Cornville schools",'all=Cornville'); mySelect.options[mySelect.options.length] = new Option("Fairfield schools",'all=Fairfield'); mySelect.options[mySelect.options.length] = new Option("Harmony schools",'all=Harmony'); mySelect.options[mySelect.options.length] = new Option("Hartland schools",'all=Hartland'); mySelect.options[mySelect.options.length] = new Option("Jackman schools",'all=Jackman'); mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison'); mySelect.options[mySelect.options.length] = new Option("N Anson schools",'all=N_Anson'); mySelect.options[mySelect.options.length] = new Option("Norridgewock schools",'all=Norridgewock'); mySelect.options[mySelect.options.length] = new Option("Palmyra schools",'all=Palmyra'); mySelect.options[mySelect.options.length] = new Option("Pittsfield schools",'all=Pittsfield'); mySelect.options[mySelect.options.length] = new Option("Rockwood schools",'all=Rockwood'); mySelect.options[mySelect.options.length] = new Option("Skowhegan schools",'all=Skowhegan'); mySelect.options[mySelect.options.length] = new Option("Smithfield schools",'all=Smithfield'); mySelect.options[mySelect.options.length] = new Option("Solon schools",'all=Solon'); mySelect.options[mySelect.options.length] = new Option("St Albans schools",'all=St_Albans'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Athens[Athens.length] = createMarker(new GPoint(-69.67459869,44.92319870),"
Athens Elementary School
Main St Po Box 167
Athens, ME 04912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Athens Elementary School",'Athens=' + Athens.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.72982788,44.75331497),"
Bloomfield Elementary School
140 Academy Circle
Skowhegan, ME 04976

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bloomfield Elementary School",'Skowhegan=' + Skowhegan.length); Burnham[Burnham.length] = createMarker(new GPoint(-69.42751312,44.69253159),"
Burnham Village School
61troy Road
Burnham, ME 04922

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Burnham Village School",'Burnham=' + Burnham.length); Canaan[Canaan.length] = createMarker(new GPoint(-69.55020142,44.77080154),"
Canaan Elementary School
178 Main Street
Canaan, ME 04924

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Canaan Elementary School",'Canaan=' + Canaan.length); Bingham[Bingham.length] = createMarker(new GPoint(-69.85089874,45.13949966),"
Caratunk School
Po Box 649
Bingham, ME 04920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Caratunk School",'Bingham=' + Bingham.length); N_Anson[N_Anson.length] = createMarker(new GPoint(-69.29499817,45.84260178),"
Carrabec High School
160 N Main St Po Box 220
N Anson, ME 04958

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carrabec High School",'N_Anson=' + N_Anson.length); Norridgewock[Norridgewock.length] = createMarker(new GPoint(-69.82409668,44.70759964),"
Central Grade School
26 Mercer Rd Po Box 98
Norridgewock, ME 04957

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Grade School",'Norridgewock=' + Norridgewock.length); Cornville[Cornville.length] = createMarker(new GPoint(-69.69818115,44.89673996),"
Cornville Elementary School
1192 West Ridge Road
Cornville, ME 04976

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cornville Elementary School",'Cornville=' + Cornville.length); N_Anson[N_Anson.length] = createMarker(new GPoint(-69.96082306,44.95067978),"
Embden Elementary School
797 Embden Pond Rd Po Box 87
N Anson, ME 04958

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Embden Elementary School",'N_Anson=' + N_Anson.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-69.59940338,44.58881378),"
Fairfield Primary School
63 High Street
Fairfield, ME 04937

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairfield Primary School",'Fairfield=' + Fairfield.length); Jackman[Jackman.length] = createMarker(new GPoint(-70.26171875,45.63941956),"
Forest Hills Consolidated School
606 Main Street Po Box 239
Jackman, ME 04945

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forest Hills Consolidated School",'Jackman=' + Jackman.length); Anson[Anson.length] = createMarker(new GPoint(-69.89237976,44.79595947),"
Garret Schenck Elementary School
17 Ken Taylor St Po Box 317
Anson, ME 04911

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garret Schenck Elementary School",'Anson=' + Anson.length); Harmony[Harmony.length] = createMarker(new GPoint(-69.54560089,44.97460175),"
Harmony Elementary School
Main St Po Box 100
Harmony, ME 04942

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harmony Elementary School",'Harmony=' + Harmony.length); Hartland[Hartland.length] = createMarker(new GPoint(-69.44879913,44.87860107),"
Hartland Consolidated School
62 Elm Street
Hartland, ME 04943

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hartland Consolidated School",'Hartland=' + Hartland.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-69.60453033,44.59067154),"
Lawrence High School
9 School Street
Fairfield, ME 04937

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lawrence High School",'Fairfield=' + Fairfield.length); Fairfield[Fairfield.length] = createMarker(new GPoint(-69.60453796,44.59064102),"
Lawrence Junior High School
7 School Street
Fairfield, ME 04937

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lawrence Junior High School",'Fairfield=' + Fairfield.length); Madison[Madison.length] = createMarker(new GPoint(-69.87779999,44.80609894),"
Madison Area Memorial High School
486 Main Street
Madison, ME 04950

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madison Area Memorial High School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-69.87799835,44.80419922),"
Madison Elementary School
43 Learners Lane
Madison, ME 04950

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Elementary School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-69.87553406,44.79813004),"
Madison Junior High School
205 Main Street
Madison, ME 04950

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Madison Junior High School",'Madison=' + Madison.length); Madison[Madison.length] = createMarker(new GPoint(-69.87576294,44.79808426),"
Main Street Elementary School
189 Main Street
Madison, ME 04950

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Main Street Elementary School",'Madison=' + Madison.length); Pittsfield[Pittsfield.length] = createMarker(new GPoint(-69.38281250,44.77999878),"
Manson Park School
22 Lancey Street
Pittsfield, ME 04967

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Manson Park School",'Pittsfield=' + Pittsfield.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.71474457,44.77079391),"
Margaret Chase Smith School
40 Heselton Street
Skowhegan, ME 04976

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Margaret Chase Smith School",'Skowhegan=' + Skowhegan.length); N_Anson[N_Anson.length] = createMarker(new GPoint(-69.29499817,45.84260178),"
Mark Emery Elementary School
56 N Main St Po Box 187
N Anson, ME 04958

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mark Emery Elementary School",'N_Anson=' + N_Anson.length); Norridgewock[Norridgewock.length] = createMarker(new GPoint(-69.82409668,44.70759964),"
Mercer Elementary School
Rr 2 Box 2540
Norridgewock, ME 04957

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mercer Elementary School",'Norridgewock=' + Norridgewock.length); Bingham[Bingham.length] = createMarker(new GPoint(-69.85089874,45.13949966),"
Moscow Elementary School
Po Box 649
Bingham, ME 04920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Moscow Elementary School",'Bingham=' + Bingham.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.72380829,44.77684021),"
North Elementary School
33 Jewett Street
Skowhegan, ME 04976

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Skowhegan=' + Skowhegan.length); Palmyra[Palmyra.length] = createMarker(new GPoint(-69.35639954,44.84439850),"
Palmyra Consolidated School
Po Box 5
Palmyra, ME 04965

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Palmyra Consolidated School",'Palmyra=' + Palmyra.length); Bingham[Bingham.length] = createMarker(new GPoint(-69.88337708,45.05665970),"
Quimby Elementary School
263 Main St Po Box 649
Bingham, ME 04920

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Quimby Elementary School",'Bingham=' + Bingham.length); Rockwood[Rockwood.length] = createMarker(new GPoint(-69.73899841,45.67953873),"
Rockwood Elementary School
Rte 15 Po Box 309
Rockwood, ME 04478

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockwood Elementary School",'Rockwood=' + Rockwood.length); Pittsfield[Pittsfield.length] = createMarker(new GPoint(-69.39265500,44.78627600),"
Sad #53 Alternative Education
27 School Street
Pittsfield, ME 04967

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sad #53 Alternative Education",'Pittsfield=' + Pittsfield.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.72988129,44.74951935),"
Skowhegan Area High School
61 Academy Circle
Skowhegan, ME 04976

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Skowhegan Area High School",'Skowhegan=' + Skowhegan.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.73011780,44.75436020),"
Skowhegan Area Middle School
155 Academy Circle
Skowhegan, ME 04976

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Skowhegan Area Middle School",'Skowhegan=' + Skowhegan.length); Skowhegan[Skowhegan.length] = createMarker(new GPoint(-69.72988129,44.74951935),"
Skowhegan Regional Technical Center
61 Academy Circle
Skowhegan, ME 04976

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Skowhegan Regional Technical Center",'Skowhegan=' + Skowhegan.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-69.81439972,44.62929916),"
Smithfield Elementary School
926 Village Road
Smithfield, ME 04978

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Smithfield Elementary School",'Smithfield=' + Smithfield.length); Solon[Solon.length] = createMarker(new GPoint(-69.85984802,44.94974899),"
Solon Elementary School
76 S Main St Po Box 146
Solon, ME 04979

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Solon Elementary School",'Solon=' + Solon.length); Hartland[Hartland.length] = createMarker(new GPoint(-69.44524384,44.88570786),"
Somerset Valley Middle School
45 Blake Street
Hartland, ME 04943

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Somerset Valley Middle School",'Hartland=' + Hartland.length); St_Albans[St_Albans.length] = createMarker(new GPoint(-69.41106900,44.91141400),"
St Albans Consolidated Elementary School
129 Hartland Road
St Albans, ME 04971

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Albans Consolidated Elementary School",'St_Albans=' + St_Albans.length); Anson[Anson.length] = createMarker(new GPoint(-69.92939758,44.79970169),"
Starks Elementary School
Rr 1 Box 510
Anson, ME 04911

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Starks Elementary School",'Anson=' + Anson.length); Bingham[Bingham.length] = createMarker(new GPoint(-69.88120270,45.05788040),"
Upper Kennebec Valley Junior Senior High School
110 Meadow St Po Box 669
Bingham, ME 04920

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upper Kennebec Valley Junior Senior High School",'Bingham=' + Bingham.length); Pittsfield[Pittsfield.length] = createMarker(new GPoint(-69.39262390,44.78517914),"
Vickery School
30 School Street
Pittsfield, ME 04967

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vickery School",'Pittsfield=' + Pittsfield.length); Pittsfield[Pittsfield.length] = createMarker(new GPoint(-69.39264679,44.78552628),"
Warsaw Middle School
27 School Street
Pittsfield, ME 04967

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Warsaw Middle School",'Pittsfield=' + Pittsfield.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(Anson); map.removeOverlays(Athens); map.removeOverlays(Bingham); map.removeOverlays(Burnham); map.removeOverlays(Canaan); map.removeOverlays(Cornville); map.removeOverlays(Fairfield); map.removeOverlays(Harmony); map.removeOverlays(Hartland); map.removeOverlays(Jackman); map.removeOverlays(Madison); map.removeOverlays(N_Anson); map.removeOverlays(Norridgewock); map.removeOverlays(Palmyra); map.removeOverlays(Pittsfield); map.removeOverlays(Rockwood); map.removeOverlays(Skowhegan); map.removeOverlays(Smithfield); map.removeOverlays(Solon); map.removeOverlays(St_Albans); 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(Athens);map.removeOverlays(Anson); map.removeOverlays(Athens); map.removeOverlays(Bingham); map.removeOverlays(Burnham); map.removeOverlays(Canaan); map.removeOverlays(Cornville); map.removeOverlays(Fairfield); map.removeOverlays(Harmony); map.removeOverlays(Hartland); map.removeOverlays(Jackman); map.removeOverlays(Madison); map.removeOverlays(N_Anson); map.removeOverlays(Norridgewock); map.removeOverlays(Palmyra); map.removeOverlays(Pittsfield); map.removeOverlays(Rockwood); map.removeOverlays(Skowhegan); map.removeOverlays(Smithfield); map.removeOverlays(Solon); map.removeOverlays(St_Albans); map.addOverlays(Anson); centerByArray(Anson, false, false); cntMarker += Anson.length; map.addOverlays(Athens); centerByArray(Athens, false, false); cntMarker += Athens.length; map.addOverlays(Bingham); centerByArray(Bingham, false, false); cntMarker += Bingham.length; map.addOverlays(Burnham); centerByArray(Burnham, false, false); cntMarker += Burnham.length; map.addOverlays(Canaan); centerByArray(Canaan, false, false); cntMarker += Canaan.length; map.addOverlays(Cornville); centerByArray(Cornville, false, false); cntMarker += Cornville.length; map.addOverlays(Fairfield); centerByArray(Fairfield, false, false); cntMarker += Fairfield.length; map.addOverlays(Harmony); centerByArray(Harmony, false, false); cntMarker += Harmony.length; map.addOverlays(Hartland); centerByArray(Hartland, false, false); cntMarker += Hartland.length; map.addOverlays(Jackman); centerByArray(Jackman, false, false); cntMarker += Jackman.length; map.addOverlays(Madison); centerByArray(Madison, false, false); cntMarker += Madison.length; map.addOverlays(N_Anson); centerByArray(N_Anson, false, false); cntMarker += N_Anson.length; map.addOverlays(Norridgewock); centerByArray(Norridgewock, false, false); cntMarker += Norridgewock.length; map.addOverlays(Palmyra); centerByArray(Palmyra, false, false); cntMarker += Palmyra.length; map.addOverlays(Pittsfield); centerByArray(Pittsfield, false, false); cntMarker += Pittsfield.length; map.addOverlays(Rockwood); centerByArray(Rockwood, false, false); cntMarker += Rockwood.length; map.addOverlays(Skowhegan); centerByArray(Skowhegan, false, false); cntMarker += Skowhegan.length; map.addOverlays(Smithfield); centerByArray(Smithfield, false, false); cntMarker += Smithfield.length; map.addOverlays(Solon); centerByArray(Solon, false, false); cntMarker += Solon.length; map.addOverlays(St_Albans); centerByArray(St_Albans, false, false); cntMarker += St_Albans.length; centerByArray(Athens,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'); } }