function addMarkers() { mySelect = document.getElementById('selection'); Hot_Springs = [];Jessieville = [];Pearcy = [];Mountain_Pine = [];mySelect.options[mySelect.options.length] = new Option("Hot Springs schools",'all=Hot_Springs'); mySelect.options[mySelect.options.length] = new Option("Jessieville schools",'all=Jessieville'); mySelect.options[mySelect.options.length] = new Option("Mountain Pine schools",'all=Mountain_Pine'); mySelect.options[mySelect.options.length] = new Option("Pearcy schools",'all=Pearcy'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.00205231,34.50073624),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cutter-morning Star Elementary School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.00205231,34.50073624),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Cutter-morning Star High School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.98881531,34.57072067),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fountain Lake Elementary School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.98881531,34.57072067),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Fountain Lake High School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.09140778,34.48913956),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gardner Magnet School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.06988525,34.47616196),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Hot Springs High School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.07516479,34.48726273),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Hot Springs Middle School",'Hot_Springs=' + Hot_Springs.length); Jessieville[Jessieville.length] = createMarker(new GPoint(-93.13929749,34.70209885),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Jessieville Elementary School",'Jessieville=' + Jessieville.length); Jessieville[Jessieville.length] = createMarker(new GPoint(-93.13929749,34.70209885),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Jessieville High School",'Jessieville=' + Jessieville.length); Pearcy[Pearcy.length] = createMarker(new GPoint(-93.21112823,34.44256592),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Hamilton Elementary School",'Pearcy=' + Pearcy.length); Pearcy[Pearcy.length] = createMarker(new GPoint(-93.21121979,34.44113922),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Hamilton High School",'Pearcy=' + Pearcy.length); Pearcy[Pearcy.length] = createMarker(new GPoint(-93.21106720,34.44598389),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lake Hamilton Intermediate School",'Pearcy=' + Pearcy.length); Pearcy[Pearcy.length] = createMarker(new GPoint(-93.21088409,34.44109344),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lake Hamilton Jr. High School",'Pearcy=' + Pearcy.length); Pearcy[Pearcy.length] = createMarker(new GPoint(-93.21106720,34.44635010),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lake Hamilton Middle School",'Pearcy=' + Pearcy.length); Pearcy[Pearcy.length] = createMarker(new GPoint(-93.21520996,34.44295883),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Hamilton Primary School",'Pearcy=' + Pearcy.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.99648285,34.47143555),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakeside High School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.99807739,34.47116852),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakeside Intermediate School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.99708557,34.47133636),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakeside Junior High School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.99267578,34.47213745),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakeside Middle School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.99947357,34.47093201),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakeside Primary School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.04187775,34.50456238),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Langston Magnet School",'Hot_Springs=' + Hot_Springs.length); Mountain_Pine[Mountain_Pine.length] = createMarker(new GPoint(-93.19930267,34.64659882),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain Pine Elementary School",'Mountain_Pine=' + Mountain_Pine.length); Mountain_Pine[Mountain_Pine.length] = createMarker(new GPoint(-93.19930267,34.64659882),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Pine High School",'Mountain_Pine=' + Mountain_Pine.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.05004700,34.49570000),"",iconGr); mySelect.options[mySelect.options.length] = new Option("National Park Technology Center",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.06417847,34.48396301),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Oaklawn Magnet School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.04811859,34.52755356),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Park Magnet School",'Hot_Springs=' + Hot_Springs.length); Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.07540700,34.49456600),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Summit School",'Hot_Springs=' + Hot_Springs.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(Hot_Springs); map.removeOverlays(Jessieville); map.removeOverlays(Mountain_Pine); map.removeOverlays(Pearcy); 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(Hot_Springs);map.removeOverlays(Hot_Springs); map.removeOverlays(Jessieville); map.removeOverlays(Mountain_Pine); map.removeOverlays(Pearcy); map.addOverlays(Hot_Springs); centerByArray(Hot_Springs, false, false); cntMarker += Hot_Springs.length; map.addOverlays(Jessieville); centerByArray(Jessieville, false, false); cntMarker += Jessieville.length; map.addOverlays(Mountain_Pine); centerByArray(Mountain_Pine, false, false); cntMarker += Mountain_Pine.length; map.addOverlays(Pearcy); centerByArray(Pearcy, false, false); cntMarker += Pearcy.length; centerByArray(Hot_Springs,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'); } }