function addMarkers() { mySelect = document.getElementById('selection'); Black_Rock = [];Hoxie = [];Imboden = [];Lynn = [];Poughkeepsie = [];Strawberry = [];Walnut_Ridge = [];mySelect.options[mySelect.options.length] = new Option("Black Rock schools",'all=Black_Rock'); mySelect.options[mySelect.options.length] = new Option("Hoxie schools",'all=Hoxie'); mySelect.options[mySelect.options.length] = new Option("Imboden schools",'all=Imboden'); mySelect.options[mySelect.options.length] = new Option("Lynn schools",'all=Lynn'); mySelect.options[mySelect.options.length] = new Option("Poughkeepsie schools",'all=Poughkeepsie'); mySelect.options[mySelect.options.length] = new Option("Strawberry schools",'all=Strawberry'); mySelect.options[mySelect.options.length] = new Option("Walnut Ridge schools",'all=Walnut_Ridge'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Black_Rock[Black_Rock.length] = createMarker(new GPoint(-91.12999725,36.11669922),"
Black Rock Elementary School
Po Box 240
Black Rock, AR 72415

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Black Rock Elementary School",'Black_Rock=' + Black_Rock.length); Black_Rock[Black_Rock.length] = createMarker(new GPoint(-91.12999725,36.11669922),"
Black Rock High School
Po Box 240
Black Rock, AR 72415

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Black Rock High School",'Black_Rock=' + Black_Rock.length); Hoxie[Hoxie.length] = createMarker(new GPoint(-90.98509979,36.04600143),"
Hoxie Elementary School
P.o. Box 240
Hoxie, AR 72433

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hoxie Elementary School",'Hoxie=' + Hoxie.length); Hoxie[Hoxie.length] = createMarker(new GPoint(-90.98509979,36.04600143),"
Hoxie High School
P.o. Box 240
Hoxie, AR 72433

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hoxie High School",'Hoxie=' + Hoxie.length); Imboden[Imboden.length] = createMarker(new GPoint(-91.17240143,36.20989990),"
Imboden Area Charter School
P.o. Box 297
Imboden, AR 72434

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Imboden Area Charter School",'Imboden=' + Imboden.length); Lynn[Lynn.length] = createMarker(new GPoint(-91.25650024,35.99649811),"
Lynn Elementary School
P.o. Box 70
Lynn, AR 72440

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lynn Elementary School",'Lynn=' + Lynn.length); Lynn[Lynn.length] = createMarker(new GPoint(-91.25650024,35.99649811),"
Lynn High School
P.o. Box 70
Lynn, AR 72440

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lynn High School",'Lynn=' + Lynn.length); Poughkeepsie[Poughkeepsie.length] = createMarker(new GPoint(-91.44049835,36.07989883),"
Poughkeepsie Elementary School
Po Box 57
Poughkeepsie, AR 72569

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Poughkeepsie Elementary School",'Poughkeepsie=' + Poughkeepsie.length); Strawberry[Strawberry.length] = createMarker(new GPoint(-91.31934400,35.96825700),"
River Valley Elementary School
P.o. Box 50
Strawberry, AR 72469

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("River Valley Elementary School",'Strawberry=' + Strawberry.length); Imboden[Imboden.length] = createMarker(new GPoint(-91.17240143,36.20989990),"
Sloan-hendrix Elementary School
P.o. Box 1080
Imboden, AR 72434

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sloan-hendrix Elementary School",'Imboden=' + Imboden.length); Imboden[Imboden.length] = createMarker(new GPoint(-91.17240143,36.20989990),"
Sloan-hendrix High School
P.o. Box 1080
Imboden, AR 72434

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sloan-hendrix High School",'Imboden=' + Imboden.length); Strawberry[Strawberry.length] = createMarker(new GPoint(-91.36389923,35.97370148),"
Strawberry Elementary School
P.o. Box 50
Strawberry, AR 72469

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Strawberry Elementary School",'Strawberry=' + Strawberry.length); Walnut_Ridge[Walnut_Ridge.length] = createMarker(new GPoint(-90.95617676,36.06314850),"
Walnut Ridge Elementary School
508 E.free St.
Walnut Ridge, AR 72476

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walnut Ridge Elementary School",'Walnut_Ridge=' + Walnut_Ridge.length); Walnut_Ridge[Walnut_Ridge.length] = createMarker(new GPoint(-90.95617676,36.06314850),"
Walnut Ridge High School
508 E. Free St.
Walnut Ridge, AR 72476

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walnut Ridge High School",'Walnut_Ridge=' + Walnut_Ridge.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(Black_Rock); map.removeOverlays(Hoxie); map.removeOverlays(Imboden); map.removeOverlays(Lynn); map.removeOverlays(Poughkeepsie); map.removeOverlays(Strawberry); map.removeOverlays(Walnut_Ridge); 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(Black_Rock);map.removeOverlays(Black_Rock); map.removeOverlays(Hoxie); map.removeOverlays(Imboden); map.removeOverlays(Lynn); map.removeOverlays(Poughkeepsie); map.removeOverlays(Strawberry); map.removeOverlays(Walnut_Ridge); map.addOverlays(Black_Rock); centerByArray(Black_Rock, false, false); cntMarker += Black_Rock.length; map.addOverlays(Hoxie); centerByArray(Hoxie, false, false); cntMarker += Hoxie.length; map.addOverlays(Imboden); centerByArray(Imboden, false, false); cntMarker += Imboden.length; map.addOverlays(Lynn); centerByArray(Lynn, false, false); cntMarker += Lynn.length; map.addOverlays(Poughkeepsie); centerByArray(Poughkeepsie, false, false); cntMarker += Poughkeepsie.length; map.addOverlays(Strawberry); centerByArray(Strawberry, false, false); cntMarker += Strawberry.length; map.addOverlays(Walnut_Ridge); centerByArray(Walnut_Ridge, false, false); cntMarker += Walnut_Ridge.length; centerByArray(Black_Rock,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'); } }