function addMarkers() { mySelect = document.getElementById('selection'); El_Dorado = [];Strong = [];Huttig = [];Junction_City = [];Mt_Holly = [];Norphlet = [];Smackover = [];mySelect.options[mySelect.options.length] = new Option("El Dorado schools",'all=El_Dorado'); mySelect.options[mySelect.options.length] = new Option("Huttig schools",'all=Huttig'); mySelect.options[mySelect.options.length] = new Option("Junction City schools",'all=Junction_City'); mySelect.options[mySelect.options.length] = new Option("Mt Holly schools",'all=Mt_Holly'); mySelect.options[mySelect.options.length] = new Option("Norphlet schools",'all=Norphlet'); mySelect.options[mySelect.options.length] = new Option("Smackover schools",'all=Smackover'); mySelect.options[mySelect.options.length] = new Option("Strong schools",'all=Strong'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.66737366,33.21456909),"
",iconBl); mySelect.options[mySelect.options.length] = new Option("Barton Junior High School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.68657684,33.21647644),"",iconGr); mySelect.options[mySelect.options.length] = new Option("El Dorado High School",'El_Dorado=' + El_Dorado.length); Strong[Strong.length] = createMarker(new GPoint(-92.35150146,33.11920166),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gardner-strong Elementary School",'Strong=' + Strong.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.66289520,33.22213745),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hugh Goodwin Elementary School",'El_Dorado=' + El_Dorado.length); Huttig[Huttig.length] = createMarker(new GPoint(-92.19409943,33.05139923),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Huttig Elementary School",'Huttig=' + Huttig.length); Huttig[Huttig.length] = createMarker(new GPoint(-92.18199921,33.05039978),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Huttig High School",'Huttig=' + Huttig.length); Junction_City[Junction_City.length] = createMarker(new GPoint(-92.77390289,33.05519867),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Junction City Elementary School",'Junction_City=' + Junction_City.length); Junction_City[Junction_City.length] = createMarker(new GPoint(-92.77390289,33.05519867),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Junction City High School",'Junction_City=' + Junction_City.length); Mt_Holly[Mt_Holly.length] = createMarker(new GPoint(-92.94774628,33.30096817),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Holly Elementary School",'Mt_Holly=' + Mt_Holly.length); Mt_Holly[Mt_Holly.length] = createMarker(new GPoint(-92.94774628,33.30096817),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Holly High School",'Mt_Holly=' + Mt_Holly.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.64052582,33.19363022),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Murmil Heights Elementary School",'El_Dorado=' + El_Dorado.length); Norphlet[Norphlet.length] = createMarker(new GPoint(-92.66300201,33.31499863),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Norphlet Elementary School",'Norphlet=' + Norphlet.length); Norphlet[Norphlet.length] = createMarker(new GPoint(-92.66300201,33.31499863),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Norphlet High School",'Norphlet=' + Norphlet.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.67446136,33.22793579),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwest Elementary School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.72213745,33.16887283),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkers Chapel Elementary School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.72213745,33.16887283),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Parkers Chapel High School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.64313507,33.21592331),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Retta Brown Elementary School",'El_Dorado=' + El_Dorado.length); Smackover[Smackover.length] = createMarker(new GPoint(-92.72904968,33.36649704),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Smackover Elementary School",'Smackover=' + Smackover.length); Smackover[Smackover.length] = createMarker(new GPoint(-92.72982025,33.36606216),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Smackover High School",'Smackover=' + Smackover.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.66554900,33.21826900),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Southark Career Center",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.66113281,33.19886780),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'El_Dorado=' + El_Dorado.length); Strong[Strong.length] = createMarker(new GPoint(-92.35150146,33.11920166),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Strong High School",'Strong=' + Strong.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.54164886,33.23326874),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Elementary School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.54164886,33.23326874),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Union High School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.64804840,33.21690369),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Middle School",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.68316650,33.22639465),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Woods Elementary Charter",'El_Dorado=' + El_Dorado.length); El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.67443848,33.20978546),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Yocum Elementary School",'El_Dorado=' + El_Dorado.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(El_Dorado); map.removeOverlays(Huttig); map.removeOverlays(Junction_City); map.removeOverlays(Mt_Holly); map.removeOverlays(Norphlet); map.removeOverlays(Smackover); map.removeOverlays(Strong); 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(El_Dorado);map.removeOverlays(El_Dorado); map.removeOverlays(Huttig); map.removeOverlays(Junction_City); map.removeOverlays(Mt_Holly); map.removeOverlays(Norphlet); map.removeOverlays(Smackover); map.removeOverlays(Strong); map.addOverlays(El_Dorado); centerByArray(El_Dorado, false, false); cntMarker += El_Dorado.length; map.addOverlays(Huttig); centerByArray(Huttig, false, false); cntMarker += Huttig.length; map.addOverlays(Junction_City); centerByArray(Junction_City, false, false); cntMarker += Junction_City.length; map.addOverlays(Mt_Holly); centerByArray(Mt_Holly, false, false); cntMarker += Mt_Holly.length; map.addOverlays(Norphlet); centerByArray(Norphlet, false, false); cntMarker += Norphlet.length; map.addOverlays(Smackover); centerByArray(Smackover, false, false); cntMarker += Smackover.length; map.addOverlays(Strong); centerByArray(Strong, false, false); cntMarker += Strong.length; centerByArray(El_Dorado,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'); } }