function addMarkers() { mySelect = document.getElementById('selection'); Atkins = [];Russellville = [];Dover = [];Hector = [];London = [];Pottsville = [];mySelect.options[mySelect.options.length] = new Option("Atkins schools",'all=Atkins'); mySelect.options[mySelect.options.length] = new Option("Dover schools",'all=Dover'); mySelect.options[mySelect.options.length] = new Option("Hector schools",'all=Hector'); mySelect.options[mySelect.options.length] = new Option("London schools",'all=London'); mySelect.options[mySelect.options.length] = new Option("Pottsville schools",'all=Pottsville'); mySelect.options[mySelect.options.length] = new Option("Russellville schools",'all=Russellville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Atkins[Atkins.length] = createMarker(new GPoint(-92.93903351,35.24415588),"
Atkins Elementary School
302 Avenue Two Nw
Atkins, AR 72823

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atkins Elementary School",'Atkins=' + Atkins.length); Atkins[Atkins.length] = createMarker(new GPoint(-92.94066620,35.24529266),"
Atkins High School
403 Avenue Three Nw
Atkins, AR 72823

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Atkins High School",'Atkins=' + Atkins.length); Atkins[Atkins.length] = createMarker(new GPoint(-92.93903351,35.24415588),"
Atkins Middle School
302 Avenue Two Nw
Atkins, AR 72823

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Atkins Middle School",'Atkins=' + Atkins.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.08763885,35.32860565),"
Center Valley Elementary School
5401 Sr 124
Russellville, AR 72801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Center Valley Elementary School",'Russellville=' + Russellville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.12377930,35.28727722),"
Crawford Elementary School
1116 North Parker Rd
Russellville, AR 72801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crawford Elementary School",'Russellville=' + Russellville.length); Dover[Dover.length] = createMarker(new GPoint(-93.12039948,35.41830063),"
Dover High School
Box 325
Dover, AR 72837

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dover High School",'Dover=' + Dover.length); Dover[Dover.length] = createMarker(new GPoint(-93.12039948,35.41830063),"
Dover Intermediate School
Box 325
Dover, AR 72837

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dover Intermediate School",'Dover=' + Dover.length); Dover[Dover.length] = createMarker(new GPoint(-93.12039948,35.41830063),"
Dover Middle School
Box 325
Dover, AR 72837

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dover Middle School",'Dover=' + Dover.length); Dover[Dover.length] = createMarker(new GPoint(-93.12039948,35.41830063),"
Dover Primary School
Box 325
Dover, AR 72837

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dover Primary School",'Dover=' + Dover.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.14588928,35.27998352),"
Dwight Elementary School
1300 W Second Place
Russellville, AR 72801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dwight Elementary School",'Russellville=' + Russellville.length); Hector[Hector.length] = createMarker(new GPoint(-92.97269440,35.46960449),"
Hector Elementary School
104 Sycamore St.
Hector, AR 72843

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hector Elementary School",'Hector=' + Hector.length); Hector[Hector.length] = createMarker(new GPoint(-92.97502899,35.47016907),"
Hector High School
11601 Sr 27
Hector, AR 72843

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hector High School",'Hector=' + Hector.length); London[London.length] = createMarker(new GPoint(-93.25106812,35.33108139),"
London Elementary School
154 School St
London, AR 72847

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("London Elementary School",'London=' + London.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.12963104,35.26485825),"
Oakland Heights Elementary School
1501 S Detroit
Russellville, AR 72801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakland Heights Elementary School",'Russellville=' + Russellville.length); Pottsville[Pottsville.length] = createMarker(new GPoint(-93.05059052,35.24697876),"
Pottsville Elementary School
87 South B Street
Pottsville, AR 72858

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pottsville Elementary School",'Pottsville=' + Pottsville.length); Pottsville[Pottsville.length] = createMarker(new GPoint(-93.04915619,35.24634933),"
Pottsville High School
500 Apache Drive
Pottsville, AR 72858

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pottsville High School",'Pottsville=' + Pottsville.length); Pottsville[Pottsville.length] = createMarker(new GPoint(-93.04872894,35.24730301),"
Pottsville Middle Grade
6926 Sr 247
Pottsville, AR 72858

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pottsville Middle Grade",'Pottsville=' + Pottsville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.13981500,35.26769500),"
Russellville Area Vo-tech Center
P.o. Box 928
Russellville, AR 72811

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Russellville Area Vo-tech Center",'Russellville=' + Russellville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.13159943,35.27600098),"
Russellville High School
2203 S Knoxville
Russellville, AR 72802

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Russellville High School",'Russellville=' + Russellville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.15441000,35.28991300),"
Russellville Jr. High School
2000 W Parkway Drive
Russellville, AR 72802

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Russellville Jr. High School",'Russellville=' + Russellville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.14359283,35.27496338),"
Russellville Middle School
1203 West 4th Place
Russellville, AR 72801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Russellville Middle School",'Russellville=' + Russellville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.14350891,35.27496338),"
Russellville Upper Elementary School
1201 West 4th Place
Russellville, AR 72801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Russellville Upper Elementary School",'Russellville=' + Russellville.length); Russellville[Russellville.length] = createMarker(new GPoint(-93.15079498,35.26792908),"
Sequoyah Elementary School
1601 W 12th St
Russellville, AR 72801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sequoyah Elementary School",'Russellville=' + Russellville.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(Atkins); map.removeOverlays(Dover); map.removeOverlays(Hector); map.removeOverlays(London); map.removeOverlays(Pottsville); map.removeOverlays(Russellville); 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(Atkins);map.removeOverlays(Atkins); map.removeOverlays(Dover); map.removeOverlays(Hector); map.removeOverlays(London); map.removeOverlays(Pottsville); map.removeOverlays(Russellville); map.addOverlays(Atkins); centerByArray(Atkins, false, false); cntMarker += Atkins.length; map.addOverlays(Dover); centerByArray(Dover, false, false); cntMarker += Dover.length; map.addOverlays(Hector); centerByArray(Hector, false, false); cntMarker += Hector.length; map.addOverlays(London); centerByArray(London, false, false); cntMarker += London.length; map.addOverlays(Pottsville); centerByArray(Pottsville, false, false); cntMarker += Pottsville.length; map.addOverlays(Russellville); centerByArray(Russellville, false, false); cntMarker += Russellville.length; centerByArray(Atkins,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'); } }