function addMarkers() { mySelect = document.getElementById('selection'); Acton = [];Aurora = [];Albion = [];Alexander = [];Alfred = [];Alton = [];Andover = [];Ashland = [];Athens = [];Auburn = [];Augusta = [];Addison = [];Anson = [];Arundel = [];mySelect.options[mySelect.options.length] = new Option("Acton schools",'all=Acton'); mySelect.options[mySelect.options.length] = new Option("Addison schools",'all=Addison'); mySelect.options[mySelect.options.length] = new Option("Albion schools",'all=Albion'); mySelect.options[mySelect.options.length] = new Option("Alexander schools",'all=Alexander'); mySelect.options[mySelect.options.length] = new Option("Alfred schools",'all=Alfred'); mySelect.options[mySelect.options.length] = new Option("Alton schools",'all=Alton'); mySelect.options[mySelect.options.length] = new Option("Andover schools",'all=Andover'); mySelect.options[mySelect.options.length] = new Option("Anson schools",'all=Anson'); mySelect.options[mySelect.options.length] = new Option("Arundel schools",'all=Arundel'); mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland'); mySelect.options[mySelect.options.length] = new Option("Athens schools",'all=Athens'); mySelect.options[mySelect.options.length] = new Option("Auburn schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Augusta schools",'all=Augusta'); mySelect.options[mySelect.options.length] = new Option("Aurora schools",'all=Aurora'); Acton[Acton.length] = createMarker(new GPoint(-70.89555359,43.50665665),"
Acton Elementary School
700 Milton Mills Road
Acton, ME 04001

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

[ View School Profile ]
",iconRd); Albion[Albion.length] = createMarker(new GPoint(-69.43910217,44.51839828),"
Albion Elementary School
20 School Street
Albion, ME 04910

[ View School Profile ]
",iconRd); Alexander[Alexander.length] = createMarker(new GPoint(-67.43305969,45.10735703),"
Alexander Elementary School
1430 Airline Road
Alexander, ME 04694

[ View School Profile ]
",iconRd); Alfred[Alfred.length] = createMarker(new GPoint(-70.71526337,43.47607040),"
Alfred Elementary School
21 Sanford Road
Alfred, ME 04002

[ View School Profile ]
",iconRd); Alton[Alton.length] = createMarker(new GPoint(-68.72373962,45.04658890),"
Alton Elementary School
22 Argyle Rd
Alton, ME 04468

[ View School Profile ]
",iconRd); 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); Ashland[Ashland.length] = createMarker(new GPoint(-68.40223694,46.62939835),"
Ashland Central School
Oak St Po Box 449
Ashland, ME 04732

[ View School Profile ]
",iconRd); Ashland[Ashland.length] = createMarker(new GPoint(-68.39550018,46.62969971),"
Ashland Community High School
46 Hayward St Po Box 369
Ashland, ME 04732

[ View School Profile ]
",iconGr); 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); Auburn[Auburn.length] = createMarker(new GPoint(-70.24866486,44.09003448),"
Auburn Middle School
38 Falcon Drive
Auburn, ME 04210

[ View School Profile ]
",iconBl); Augusta[Augusta.length] = createMarker(new GPoint(-69.77976227,44.31053162),"
Capital Area Technology Center
40 Pierce Drive
Augusta, ME 04330

[ View School Profile ]
",iconGr); Augusta[Augusta.length] = createMarker(new GPoint(-69.76576996,44.31619263),"
Cony High School
120 Cony Street
Augusta, ME 04330

[ View School Profile ]
",iconGr); Addison[Addison.length] = createMarker(new GPoint(-67.69916534,44.61925125),"
Daniel W Merritt School
518 Indian River Road
Addison, ME 04606

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.22466278,44.14563370),"
East Auburn Community School
15 Andrew Drive
Auburn, ME 04210

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.27110291,44.12788010),"
Edward Little High School
77 Harris Street
Auburn, ME 04210

[ View School Profile ]
",iconGr); Augusta[Augusta.length] = createMarker(new GPoint(-69.75775909,44.31644058),"
Ella R Hodgkins School
Malta Street
Augusta, ME 04330

[ View School Profile ]
",iconBl); Auburn[Auburn.length] = createMarker(new GPoint(-70.24343109,44.08421707),"
Fairview School
397 Minot Avenue
Auburn, ME 04210

[ View School Profile ]
",iconRd); Augusta[Augusta.length] = createMarker(new GPoint(-69.74858093,44.30619431),"
Farrington School
249 Eastern Avenue
Augusta, ME 04330

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.23221588,44.10021973),"
Franklin Alternative School
23 High Street
Auburn, ME 04210

[ View School Profile ]
",iconGr); 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); Auburn[Auburn.length] = createMarker(new GPoint(-70.23908997,44.10059738),"
Lake Street Elementary School
80 Lake Street
Auburn, ME 04210

[ View School Profile ]
",iconRd); Augusta[Augusta.length] = createMarker(new GPoint(-69.76251984,44.32096100),"
Lillian Parks Hussey School
Gedney Street
Augusta, ME 04330

[ View School Profile ]
",iconRd); Augusta[Augusta.length] = createMarker(new GPoint(-69.78644562,44.31301880),"
Lincoln School
40 Lincoln Street
Augusta, ME 04330

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.24050903,44.09537888),"
Merrill Hill Alternative School
16 Western Avenue
Auburn, ME 04210

[ View School Profile ]
",iconGr); Arundel[Arundel.length] = createMarker(new GPoint(-70.53845215,43.44473267),"
Mildred L Day School
600 Limerick Road
Arundel, ME 04046

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.22660065,44.09859848),"
Retc/sos
Po Box 800
Auburn, ME 04212

[ View School Profile ]
",iconGr); Auburn[Auburn.length] = createMarker(new GPoint(-70.22810364,44.07949829),"
Sherwood Heights Elementary School
Sherwood Drive
Auburn, ME 04210

[ View School Profile ]
",iconRd); Anson[Anson.length] = createMarker(new GPoint(-69.92939758,44.79970169),"
Starks Elementary School
Rr 1 Box 510
Anson, ME 04911

[ View School Profile ]
",iconRd); Augusta[Augusta.length] = createMarker(new GPoint(-69.78054047,44.33295822),"
Sylvio J Gilbert School
Sunset Avenue
Augusta, ME 04330

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.21879578,44.08177185),"
Walton School
92 Mary Carroll Street
Auburn, ME 04210

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.22930908,44.10732269),"
Washburn School
35 Lake Auburn Avenue
Auburn, ME 04210

[ View School Profile ]
",iconRd); Auburn[Auburn.length] = createMarker(new GPoint(-70.23143768,44.10112381),"
Webster Intermediate School
99 Hampshire Street
Auburn, ME 04210

[ View School Profile ]
",iconBl); } // 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(Acton); map.removeOverlays(Addison); map.removeOverlays(Albion); map.removeOverlays(Alexander); map.removeOverlays(Alfred); map.removeOverlays(Alton); map.removeOverlays(Andover); map.removeOverlays(Anson); map.removeOverlays(Arundel); map.removeOverlays(Ashland); map.removeOverlays(Athens); map.removeOverlays(Auburn); map.removeOverlays(Augusta); map.removeOverlays(Aurora); 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(Acton);map.removeOverlays(Acton); map.removeOverlays(Addison); map.removeOverlays(Albion); map.removeOverlays(Alexander); map.removeOverlays(Alfred); map.removeOverlays(Alton); map.removeOverlays(Andover); map.removeOverlays(Anson); map.removeOverlays(Arundel); map.removeOverlays(Ashland); map.removeOverlays(Athens); map.removeOverlays(Auburn); map.removeOverlays(Augusta); map.removeOverlays(Aurora); map.addOverlays(Acton); centerByArray(Acton, false, false); cntMarker += Acton.length; map.addOverlays(Addison); centerByArray(Addison, false, false); cntMarker += Addison.length; map.addOverlays(Albion); centerByArray(Albion, false, false); cntMarker += Albion.length; map.addOverlays(Alexander); centerByArray(Alexander, false, false); cntMarker += Alexander.length; map.addOverlays(Alfred); centerByArray(Alfred, false, false); cntMarker += Alfred.length; map.addOverlays(Alton); centerByArray(Alton, false, false); cntMarker += Alton.length; map.addOverlays(Andover); centerByArray(Andover, false, false); cntMarker += Andover.length; map.addOverlays(Anson); centerByArray(Anson, false, false); cntMarker += Anson.length; map.addOverlays(Arundel); centerByArray(Arundel, false, false); cntMarker += Arundel.length; map.addOverlays(Ashland); centerByArray(Ashland, false, false); cntMarker += Ashland.length; map.addOverlays(Athens); centerByArray(Athens, false, false); cntMarker += Athens.length; map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Augusta); centerByArray(Augusta, false, false); cntMarker += Augusta.length; map.addOverlays(Aurora); centerByArray(Aurora, false, false); cntMarker += Aurora.length; centerByArray(Acton,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'); } }