function addMarkers() { mySelect = document.getElementById('selection'); Osceola = [];Burdette = [];Armorel = [];Blytheville = [];Dyess = [];Gosnell = [];Keiser = [];Luxora = [];Manila = [];Wilson = [];Joiner = [];mySelect.options[mySelect.options.length] = new Option("Armorel schools",'all=Armorel'); mySelect.options[mySelect.options.length] = new Option("Blytheville schools",'all=Blytheville'); mySelect.options[mySelect.options.length] = new Option("Burdette schools",'all=Burdette'); mySelect.options[mySelect.options.length] = new Option("Dyess schools",'all=Dyess'); mySelect.options[mySelect.options.length] = new Option("Gosnell schools",'all=Gosnell'); mySelect.options[mySelect.options.length] = new Option("Joiner schools",'all=Joiner'); mySelect.options[mySelect.options.length] = new Option("Keiser schools",'all=Keiser'); mySelect.options[mySelect.options.length] = new Option("Luxora schools",'all=Luxora'); mySelect.options[mySelect.options.length] = new Option("Manila schools",'all=Manila'); mySelect.options[mySelect.options.length] = new Option("Osceola schools",'all=Osceola'); mySelect.options[mySelect.options.length] = new Option("Wilson schools",'all=Wilson'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Osceola[Osceola.length] = createMarker(new GPoint(-89.97489929,35.70412445),"
",iconBl); mySelect.options[mySelect.options.length] = new Option("Academic Center Of Excellence",'Osceola=' + Osceola.length); Burdette[Burdette.length] = createMarker(new GPoint(-89.94660400,35.81403200),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Arkansas Northeastern College Tech Center",'Burdette=' + Burdette.length); Armorel[Armorel.length] = createMarker(new GPoint(-89.79850769,35.91927719),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Armorel Elementary School",'Armorel=' + Armorel.length); Armorel[Armorel.length] = createMarker(new GPoint(-89.79850769,35.91927719),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Armorel High School",'Armorel=' + Armorel.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.92456818,35.91833878),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Blytheville Charter School",'Blytheville=' + Blytheville.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.91432953,35.93280029),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Blytheville High School",'Blytheville=' + Blytheville.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.90063477,35.93653870),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Blytheville Intermediate School",'Blytheville=' + Blytheville.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.91117096,35.92953873),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Blytheville Middle School",'Blytheville=' + Blytheville.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.91762543,35.93673706),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Blytheville=' + Blytheville.length); Dyess[Dyess.length] = createMarker(new GPoint(-90.21405029,35.59186172),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Dyess Elementary School",'Dyess=' + Dyess.length); Osceola[Osceola.length] = createMarker(new GPoint(-89.96530151,35.69903564),"",iconBl); mySelect.options[mySelect.options.length] = new Option("East Elementary School",'Osceola=' + Osceola.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.89849091,35.93471909),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Kindergarten Center",'Blytheville=' + Blytheville.length); Blytheville[Blytheville.length] = createMarker(new GPoint(-89.90106964,35.91854095),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Primary School",'Blytheville=' + Blytheville.length); Gosnell[Gosnell.length] = createMarker(new GPoint(-89.96492767,35.95993805),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gosnell Elementary School",'Gosnell=' + Gosnell.length); Gosnell[Gosnell.length] = createMarker(new GPoint(-89.96492767,35.95993805),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Gosnell High School",'Gosnell=' + Gosnell.length); Keiser[Keiser.length] = createMarker(new GPoint(-90.09429932,35.67850113),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Keiser Elementary School",'Keiser=' + Keiser.length); Luxora[Luxora.length] = createMarker(new GPoint(-89.90750122,35.76929855),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Luxora Elementary School",'Luxora=' + Luxora.length); Manila[Manila.length] = createMarker(new GPoint(-90.17939758,35.86330032),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Manila Elementary School",'Manila=' + Manila.length); Manila[Manila.length] = createMarker(new GPoint(-90.17939758,35.86330032),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Manila High School",'Manila=' + Manila.length); Osceola[Osceola.length] = createMarker(new GPoint(-89.98780823,35.70523834),"",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Osceola=' + Osceola.length); Osceola[Osceola.length] = createMarker(new GPoint(-90.01548004,35.70533752),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Osceola High School",'Osceola=' + Osceola.length); Osceola[Osceola.length] = createMarker(new GPoint(-89.97716522,35.70008469),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Osceola Junior High School",'Osceola=' + Osceola.length); Wilson[Wilson.length] = createMarker(new GPoint(-90.05237579,35.57309723),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Rivercrest High School",'Wilson=' + Wilson.length); Wilson[Wilson.length] = createMarker(new GPoint(-90.04136800,35.56881500),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Rivercrest Junior High School",'Wilson=' + Wilson.length); Joiner[Joiner.length] = createMarker(new GPoint(-90.14660645,35.50785065),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Shawnee Elementary School",'Joiner=' + Joiner.length); Osceola[Osceola.length] = createMarker(new GPoint(-89.98566437,35.70302963),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Osceola=' + Osceola.length); Wilson[Wilson.length] = createMarker(new GPoint(-90.05088806,35.56601715),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wilson Elementary School",'Wilson=' + Wilson.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(Armorel); map.removeOverlays(Blytheville); map.removeOverlays(Burdette); map.removeOverlays(Dyess); map.removeOverlays(Gosnell); map.removeOverlays(Joiner); map.removeOverlays(Keiser); map.removeOverlays(Luxora); map.removeOverlays(Manila); map.removeOverlays(Osceola); map.removeOverlays(Wilson); 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(Osceola);map.removeOverlays(Armorel); map.removeOverlays(Blytheville); map.removeOverlays(Burdette); map.removeOverlays(Dyess); map.removeOverlays(Gosnell); map.removeOverlays(Joiner); map.removeOverlays(Keiser); map.removeOverlays(Luxora); map.removeOverlays(Manila); map.removeOverlays(Osceola); map.removeOverlays(Wilson); map.addOverlays(Armorel); centerByArray(Armorel, false, false); cntMarker += Armorel.length; map.addOverlays(Blytheville); centerByArray(Blytheville, false, false); cntMarker += Blytheville.length; map.addOverlays(Burdette); centerByArray(Burdette, false, false); cntMarker += Burdette.length; map.addOverlays(Dyess); centerByArray(Dyess, false, false); cntMarker += Dyess.length; map.addOverlays(Gosnell); centerByArray(Gosnell, false, false); cntMarker += Gosnell.length; map.addOverlays(Joiner); centerByArray(Joiner, false, false); cntMarker += Joiner.length; map.addOverlays(Keiser); centerByArray(Keiser, false, false); cntMarker += Keiser.length; map.addOverlays(Luxora); centerByArray(Luxora, false, false); cntMarker += Luxora.length; map.addOverlays(Manila); centerByArray(Manila, false, false); cntMarker += Manila.length; map.addOverlays(Osceola); centerByArray(Osceola, false, false); cntMarker += Osceola.length; map.addOverlays(Wilson); centerByArray(Wilson, false, false); cntMarker += Wilson.length; centerByArray(Osceola,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'); } }