function addMarkers() { mySelect = document.getElementById('selection'); Auburn = [];Poland = [];Durham = [];Mechanic_Falls = [];Lewiston = [];Greene = [];Turner = [];Leeds = [];Lisbon = [];Lisbon_Falls = [];Livermore = [];Livermore_Falls = [];Minot = [];Sabattus = [];Wales = [];mySelect.options[mySelect.options.length] = new Option("Auburn schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Durham schools",'all=Durham'); mySelect.options[mySelect.options.length] = new Option("Greene schools",'all=Greene'); mySelect.options[mySelect.options.length] = new Option("Leeds schools",'all=Leeds'); mySelect.options[mySelect.options.length] = new Option("Lewiston schools",'all=Lewiston'); mySelect.options[mySelect.options.length] = new Option("Lisbon schools",'all=Lisbon'); mySelect.options[mySelect.options.length] = new Option("Lisbon Falls schools",'all=Lisbon_Falls'); mySelect.options[mySelect.options.length] = new Option("Livermore schools",'all=Livermore'); mySelect.options[mySelect.options.length] = new Option("Livermore Falls schools",'all=Livermore_Falls'); mySelect.options[mySelect.options.length] = new Option("Mechanic Falls schools",'all=Mechanic_Falls'); mySelect.options[mySelect.options.length] = new Option("Minot schools",'all=Minot'); mySelect.options[mySelect.options.length] = new Option("Poland schools",'all=Poland'); mySelect.options[mySelect.options.length] = new Option("Sabattus schools",'all=Sabattus'); mySelect.options[mySelect.options.length] = new Option("Turner schools",'all=Turner'); mySelect.options[mySelect.options.length] = new Option("Wales schools",'all=Wales'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Auburn[Auburn.length] = createMarker(new GPoint(-70.24866486,44.09003448),"
Auburn Middle School
38 Falcon Drive
Auburn, ME 04210

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Auburn Middle School",'Auburn=' + Auburn.length); Poland[Poland.length] = createMarker(new GPoint(-70.41342926,44.07300568),"
Bruce M Whittier Middle School
1457 Maine Street
Poland, ME 04274

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bruce M Whittier Middle School",'Poland=' + Poland.length); Durham[Durham.length] = createMarker(new GPoint(-70.12807465,43.97142410),"
Durham Elementary School
654 Hallowell Road
Durham, ME 04222

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

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

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Edward Little High School",'Auburn=' + Auburn.length); Mechanic_Falls[Mechanic_Falls.length] = createMarker(new GPoint(-70.38542175,44.10531235),"
Elm Street School
129 Elm Street
Mechanic Falls, ME 04256

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elm Street School",'Mechanic_Falls=' + Mechanic_Falls.length); Auburn[Auburn.length] = createMarker(new GPoint(-70.24343109,44.08421707),"
Fairview School
397 Minot Avenue
Auburn, ME 04210

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview School",'Auburn=' + Auburn.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.19172668,44.09665680),"
Farwell Elementary School
84-110 Farwell Street
Lewiston, ME 04240

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Farwell Elementary School",'Lewiston=' + Lewiston.length); Auburn[Auburn.length] = createMarker(new GPoint(-70.23221588,44.10021973),"
Franklin Alternative School
23 High Street
Auburn, ME 04210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin Alternative School",'Auburn=' + Auburn.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.20668030,44.09443283),"
Governor James B Longley Elementary School
145 Birch Street
Lewiston, ME 04240

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Governor James B Longley Elementary School",'Lewiston=' + Lewiston.length); Greene[Greene.length] = createMarker(new GPoint(-70.14767456,44.18852615),"
Greene Central School
41 Main Street
Greene, ME 04236

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greene Central School",'Greene=' + Greene.length); Auburn[Auburn.length] = createMarker(new GPoint(-70.23908997,44.10059738),"
Lake Street Elementary School
80 Lake Street
Auburn, ME 04210

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Street Elementary School",'Auburn=' + Auburn.length); Turner[Turner.length] = createMarker(new GPoint(-70.22749329,44.26822662),"
Leavitt Area High School
21 Matthews Way
Turner, ME 04282

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Leavitt Area High School",'Turner=' + Turner.length); Leeds[Leeds.length] = createMarker(new GPoint(-70.11777496,44.29712296),"
Leeds Central School
1185 Route 106
Leeds, ME 04263

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leeds Central School",'Leeds=' + Leeds.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.19943237,44.09474182),"
Lewiston High School
156 East Avenue
Lewiston, ME 04240

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lewiston High School",'Lewiston=' + Lewiston.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.20336151,44.10240173),"
Lewiston Middle School
75 Central Avenue
Lewiston, ME 04240

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lewiston Middle School",'Lewiston=' + Lewiston.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.19943237,44.09474182),"
Lewiston Regional Technology Center
156 East Avenue
Lewiston, ME 04240

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lewiston Regional Technology Center",'Lewiston=' + Lewiston.length); Lisbon[Lisbon.length] = createMarker(new GPoint(-70.09204200,44.02244400),"
Lisbon Community School
33 Mill Street
Lisbon, ME 04250

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lisbon Community School",'Lisbon=' + Lisbon.length); Lisbon[Lisbon.length] = createMarker(new GPoint(-70.10601044,44.02788925),"
Lisbon Elementary School
19 Gartley Street
Lisbon, ME 04250

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lisbon Elementary School",'Lisbon=' + Lisbon.length); Lisbon_Falls[Lisbon_Falls.length] = createMarker(new GPoint(-70.07004547,44.00333405),"
Lisbon High School
591 Lisbon Road
Lisbon Falls, ME 04252

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lisbon High School",'Lisbon_Falls=' + Lisbon_Falls.length); Livermore[Livermore.length] = createMarker(new GPoint(-70.20127869,44.43773270),"
Livermore Elementary School
107 Gibbs Mill Road
Livermore, ME 04253

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Livermore Elementary School",'Livermore=' + Livermore.length); Livermore_Falls[Livermore_Falls.length] = createMarker(new GPoint(-70.18019104,44.47002411),"
Livermore Falls High School
25 Cedar Street
Livermore Falls, ME 04254

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livermore Falls High School",'Livermore_Falls=' + Livermore_Falls.length); Livermore_Falls[Livermore_Falls.length] = createMarker(new GPoint(-70.18091583,44.46982574),"
Livermore Falls Middle School
1 Highland Avenue
Livermore Falls, ME 04254

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Livermore Falls Middle School",'Livermore_Falls=' + Livermore_Falls.length); Lisbon_Falls[Lisbon_Falls.length] = createMarker(new GPoint(-70.05998230,44.00016785),"
Marion T Morse Elementary School
18 School Street
Lisbon Falls, ME 04252

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marion T Morse Elementary School",'Lisbon_Falls=' + Lisbon_Falls.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.20246124,44.08409119),"
Martel School
880 Lisbon Street
Lewiston, ME 04240

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

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Merrill Hill Alternative School",'Auburn=' + Auburn.length); Minot[Minot.length] = createMarker(new GPoint(-70.33243561,44.11712265),"
Minot Consolidated School
23 Shaw Hill Road
Minot, ME 04258

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Minot Consolidated School",'Minot=' + Minot.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.18717957,44.10805130),"
Montello School
407 East Avenue
Lewiston, ME 04240

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montello School",'Lewiston=' + Lewiston.length); Sabattus[Sabattus.length] = createMarker(new GPoint(-70.10815430,44.11959839),"
Oak Hill High School
E Road Ext Po Box 400
Sabattus, ME 04280

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Hill High School",'Sabattus=' + Sabattus.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.20032501,44.11213684),"
Pettingill Elementary School
409 College Street
Lewiston, ME 04240

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pettingill Elementary School",'Lewiston=' + Lewiston.length); Lisbon_Falls[Lisbon_Falls.length] = createMarker(new GPoint(-70.07213593,44.00428009),"
Philip W Sugg Middle School
567 Lisbon Road
Lisbon Falls, ME 04252

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Philip W Sugg Middle School",'Lisbon_Falls=' + Lisbon_Falls.length); Poland[Poland.length] = createMarker(new GPoint(-70.39712524,44.06385803),"
Poland Community School
1250 Maine Street
Poland, ME 04274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Poland Community School",'Poland=' + Poland.length); Poland[Poland.length] = createMarker(new GPoint(-70.41342926,44.07300568),"
Poland Regional High School
1457 Maine Street
Poland, ME 04274

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Poland Regional High School",'Poland=' + Poland.length); Auburn[Auburn.length] = createMarker(new GPoint(-70.22660065,44.09859848),"
Retc/sos
Po Box 800
Auburn, ME 04212

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Retc/sos",'Auburn=' + Auburn.length); Sabattus[Sabattus.length] = createMarker(new GPoint(-70.11248016,44.12156677),"
Sabattus Elementary School
40 Ball Park Road
Sabattus, ME 04280

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sabattus Elementary School",'Sabattus=' + Sabattus.length); Sabattus[Sabattus.length] = createMarker(new GPoint(-70.11096100,44.12173200),"
Sabattus Primary School
36 No Name Pond Road
Sabattus, ME 04280

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sabattus Primary School",'Sabattus=' + Sabattus.length); Auburn[Auburn.length] = createMarker(new GPoint(-70.22810364,44.07949829),"
Sherwood Heights Elementary School
Sherwood Drive
Auburn, ME 04210

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherwood Heights Elementary School",'Auburn=' + Auburn.length); Lewiston[Lewiston.length] = createMarker(new GPoint(-70.16178894,44.10826874),"
Thomas J Mcmahon Elementary School
151 North Temple Street
Lewiston, ME 04240

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomas J Mcmahon Elementary School",'Lewiston=' + Lewiston.length); Turner[Turner.length] = createMarker(new GPoint(-70.22574615,44.26941299),"
Tripp Middle School
65 Matthews Way
Turner, ME 04282

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tripp Middle School",'Turner=' + Turner.length); Turner[Turner.length] = createMarker(new GPoint(-70.22534180,44.27083969),"
Turner Elementary School
91 Matthews Way
Turner, ME 04282

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Turner Elementary School",'Turner=' + Turner.length); Turner[Turner.length] = createMarker(new GPoint(-70.21385956,44.27293396),"
Turner Primary School
59 Cobb Road
Turner, ME 04282

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Turner Primary School",'Turner=' + Turner.length); Wales[Wales.length] = createMarker(new GPoint(-70.06203461,44.16133118),"
Wales Central School
175 Centre Road
Wales, ME 04280

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

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

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

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Webster Intermediate School",'Auburn=' + Auburn.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(Auburn); map.removeOverlays(Durham); map.removeOverlays(Greene); map.removeOverlays(Leeds); map.removeOverlays(Lewiston); map.removeOverlays(Lisbon); map.removeOverlays(Lisbon_Falls); map.removeOverlays(Livermore); map.removeOverlays(Livermore_Falls); map.removeOverlays(Mechanic_Falls); map.removeOverlays(Minot); map.removeOverlays(Poland); map.removeOverlays(Sabattus); map.removeOverlays(Turner); map.removeOverlays(Wales); 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(Auburn);map.removeOverlays(Auburn); map.removeOverlays(Durham); map.removeOverlays(Greene); map.removeOverlays(Leeds); map.removeOverlays(Lewiston); map.removeOverlays(Lisbon); map.removeOverlays(Lisbon_Falls); map.removeOverlays(Livermore); map.removeOverlays(Livermore_Falls); map.removeOverlays(Mechanic_Falls); map.removeOverlays(Minot); map.removeOverlays(Poland); map.removeOverlays(Sabattus); map.removeOverlays(Turner); map.removeOverlays(Wales); map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Durham); centerByArray(Durham, false, false); cntMarker += Durham.length; map.addOverlays(Greene); centerByArray(Greene, false, false); cntMarker += Greene.length; map.addOverlays(Leeds); centerByArray(Leeds, false, false); cntMarker += Leeds.length; map.addOverlays(Lewiston); centerByArray(Lewiston, false, false); cntMarker += Lewiston.length; map.addOverlays(Lisbon); centerByArray(Lisbon, false, false); cntMarker += Lisbon.length; map.addOverlays(Lisbon_Falls); centerByArray(Lisbon_Falls, false, false); cntMarker += Lisbon_Falls.length; map.addOverlays(Livermore); centerByArray(Livermore, false, false); cntMarker += Livermore.length; map.addOverlays(Livermore_Falls); centerByArray(Livermore_Falls, false, false); cntMarker += Livermore_Falls.length; map.addOverlays(Mechanic_Falls); centerByArray(Mechanic_Falls, false, false); cntMarker += Mechanic_Falls.length; map.addOverlays(Minot); centerByArray(Minot, false, false); cntMarker += Minot.length; map.addOverlays(Poland); centerByArray(Poland, false, false); cntMarker += Poland.length; map.addOverlays(Sabattus); centerByArray(Sabattus, false, false); cntMarker += Sabattus.length; map.addOverlays(Turner); centerByArray(Turner, false, false); cntMarker += Turner.length; map.addOverlays(Wales); centerByArray(Wales, false, false); cntMarker += Wales.length; centerByArray(Auburn,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'); } }