function addMarkers() { mySelect = document.getElementById('selection'); Jonesboro = [];Bay = [];Brookland = [];Leachville = [];Monette = [];Jonesoro = [];Caraway = [];Lake_City = [];mySelect.options[mySelect.options.length] = new Option("Bay schools",'all=Bay'); mySelect.options[mySelect.options.length] = new Option("Brookland schools",'all=Brookland'); mySelect.options[mySelect.options.length] = new Option("Caraway schools",'all=Caraway'); mySelect.options[mySelect.options.length] = new Option("Jonesboro schools",'all=Jonesboro'); mySelect.options[mySelect.options.length] = new Option("Jonesoro schools",'all=Jonesoro'); mySelect.options[mySelect.options.length] = new Option("Lake City schools",'all=Lake_City'); mySelect.options[mySelect.options.length] = new Option("Leachville schools",'all=Leachville'); mySelect.options[mySelect.options.length] = new Option("Monette schools",'all=Monette'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.72776031,35.82873535),"
",iconBl); mySelect.options[mySelect.options.length] = new Option("Annie Camp Junior High School",'Jonesboro=' + Jonesboro.length); Bay[Bay.length] = createMarker(new GPoint(-90.55180359,35.74499893),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bay Elementary School",'Bay=' + Bay.length); Bay[Bay.length] = createMarker(new GPoint(-90.55180359,35.74499893),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Bay High School",'Bay=' + Bay.length); Brookland[Brookland.length] = createMarker(new GPoint(-90.57746887,35.90753555),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Brookland Elementary School",'Brookland=' + Brookland.length); Brookland[Brookland.length] = createMarker(new GPoint(-90.57746887,35.90753555),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Brookland High School",'Brookland=' + Brookland.length); Brookland[Brookland.length] = createMarker(new GPoint(-90.57724800,35.90737600),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Brookland Intermediate School",'Brookland=' + Brookland.length); Leachville[Leachville.length] = createMarker(new GPoint(-90.21569824,35.94189835),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buffalo Is. Central East Elementary School",'Leachville=' + Leachville.length); Monette[Monette.length] = createMarker(new GPoint(-90.34020233,35.91049957),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Buffalo Is. Central High School",'Monette=' + Monette.length); Leachville[Leachville.length] = createMarker(new GPoint(-90.21569824,35.94189835),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Buffalo Is. Central Junior High School",'Leachville=' + Leachville.length); Monette[Monette.length] = createMarker(new GPoint(-90.34020233,35.91049957),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buffalo Is. Central West Elementary School",'Monette=' + Monette.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.68581390,35.82473755),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Douglas Macarthur Junior High School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.71077400,35.82991900),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Early Childhood Learning Cntr",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.67797089,35.78866196),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fox Meadow Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.67831100,35.78876200),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Fox Meadow Intermediate Center",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.68762970,35.82241058),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillcrest Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.70541100,35.82469400),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Jonesboro Area Technical Center",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.70526886,35.82443619),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Jonesboro High School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.71118164,35.82873535),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Kindergarten Center",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.64929962,35.81859970),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Nettleton Central Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.64981079,35.81276321),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Nettleton High School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.70404816,35.84209061),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Nettleton Intermediate Center",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.64968109,35.81303787),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Nettleton Junior High School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.70207977,35.87900543),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Philadelphia Elementary School",'Jonesboro=' + Jonesboro.length); Jonesoro[Jonesoro.length] = createMarker(new GPoint(-90.72482300,35.87220001),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Raider Open Door Academy Charter",'Jonesoro=' + Jonesoro.length); Caraway[Caraway.length] = createMarker(new GPoint(-90.32839966,35.76079941),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside East Elementary School",'Caraway=' + Caraway.length); Lake_City[Lake_City.length] = createMarker(new GPoint(-90.44439697,35.82149887),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverside High School",'Lake_City=' + Lake_City.length); Caraway[Caraway.length] = createMarker(new GPoint(-90.32839966,35.76079941),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverside Junior High School",'Caraway=' + Caraway.length); Lake_City[Lake_City.length] = createMarker(new GPoint(-90.44439697,35.82149887),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside West Elementary School",'Lake_City=' + Lake_City.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.70182800,35.83130646),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Sixth Grade Academic Center",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.71789551,35.82416153),"",iconRd); mySelect.options[mySelect.options.length] = new Option("South Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.65432739,35.84643555),"",iconRd); mySelect.options[mySelect.options.length] = new Option("University Hgts. Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.74446106,35.77793884),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley View Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.74446106,35.77793884),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley View High School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.71899414,35.83853531),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.80888367,35.85107040),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Westside Elementary School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.80806732,35.85341644),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside High School",'Jonesboro=' + Jonesboro.length); Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.80875397,35.85146332),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Westside Middle School",'Jonesboro=' + Jonesboro.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(Bay); map.removeOverlays(Brookland); map.removeOverlays(Caraway); map.removeOverlays(Jonesboro); map.removeOverlays(Jonesoro); map.removeOverlays(Lake_City); map.removeOverlays(Leachville); map.removeOverlays(Monette); 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(Jonesboro);map.removeOverlays(Bay); map.removeOverlays(Brookland); map.removeOverlays(Caraway); map.removeOverlays(Jonesboro); map.removeOverlays(Jonesoro); map.removeOverlays(Lake_City); map.removeOverlays(Leachville); map.removeOverlays(Monette); map.addOverlays(Bay); centerByArray(Bay, false, false); cntMarker += Bay.length; map.addOverlays(Brookland); centerByArray(Brookland, false, false); cntMarker += Brookland.length; map.addOverlays(Caraway); centerByArray(Caraway, false, false); cntMarker += Caraway.length; map.addOverlays(Jonesboro); centerByArray(Jonesboro, false, false); cntMarker += Jonesboro.length; map.addOverlays(Jonesoro); centerByArray(Jonesoro, false, false); cntMarker += Jonesoro.length; map.addOverlays(Lake_City); centerByArray(Lake_City, false, false); cntMarker += Lake_City.length; map.addOverlays(Leachville); centerByArray(Leachville, false, false); cntMarker += Leachville.length; map.addOverlays(Monette); centerByArray(Monette, false, false); cntMarker += Monette.length; centerByArray(Jonesboro,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'); } }