function addMarkers() { mySelect = document.getElementById('selection'); Byhalia = [];Holly_Springs = [];Potts_Camp = [];mySelect.options[mySelect.options.length] = new Option("Byhalia schools",'all=Byhalia'); mySelect.options[mySelect.options.length] = new Option("Holly Springs schools",'all=Holly_Springs'); mySelect.options[mySelect.options.length] = new Option("Potts Camp schools",'all=Potts_Camp'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Byhalia[Byhalia.length] = createMarker(new GPoint(-89.67060089,34.87039948),"
Byhalia High School
Po Box 346
Byhalia, MS 38611

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Byhalia High School",'Byhalia=' + Byhalia.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.57702637,34.65747070),"
Galena Elementary School
4202 Hwy 4 West
Holly Springs, MS 38635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Galena Elementary School",'Holly_Springs=' + Holly_Springs.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.49065399,34.95508575),"
H W Byers Attendance Center
4178 Hwy 72 East
Holly Springs, MS 38635

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("H W Byers Attendance Center",'Holly_Springs=' + Holly_Springs.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.52302800,34.95592800),"
H. W. Byers Elementary (k-6)
4178 Highway 72 East
Holly Springs, MS 38635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("H. W. Byers Elementary (k-6)",'Holly_Springs=' + Holly_Springs.length); Byhalia[Byhalia.length] = createMarker(new GPoint(-89.67060089,34.87039948),"
Henry Junior High School
P. O. Box 489
Byhalia, MS 38611

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Henry Junior High School",'Byhalia=' + Byhalia.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.44856900,34.76898500),"
Holly Springs High School
165 North Walthall Street
Holly Springs, MS 38635

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holly Springs High School",'Holly_Springs=' + Holly_Springs.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.45097351,34.77319336),"
Holly Springs Intermediate School
210 W Valley Street
Holly Springs, MS 38635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Holly Springs Intermediate School",'Holly_Springs=' + Holly_Springs.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.44367981,34.76249313),"
Holly Springs Primary School
405 S Maury Street
Holly Springs, MS 38635

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Holly Springs Primary School",'Holly_Springs=' + Holly_Springs.length); Holly_Springs[Holly_Springs.length] = createMarker(new GPoint(-89.44466900,34.76943900),"
Holly Springs Voc Tech
410 East Falconer
Holly Springs, MS 38635

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holly Springs Voc Tech",'Holly_Springs=' + Holly_Springs.length); Potts_Camp[Potts_Camp.length] = createMarker(new GPoint(-89.32350159,34.63710022),"
Mary Reid School
P. O. Box 580
Potts Camp, MS 38659

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary Reid School",'Potts_Camp=' + Potts_Camp.length); Potts_Camp[Potts_Camp.length] = createMarker(new GPoint(-89.32350159,34.63710022),"
Potts Camp Attendance Center
P. O. Box 697
Potts Camp, MS 38659

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Potts Camp Attendance Center",'Potts_Camp=' + Potts_Camp.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(Byhalia); map.removeOverlays(Holly_Springs); map.removeOverlays(Potts_Camp); 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(Byhalia);map.removeOverlays(Byhalia); map.removeOverlays(Holly_Springs); map.removeOverlays(Potts_Camp); map.addOverlays(Byhalia); centerByArray(Byhalia, false, false); cntMarker += Byhalia.length; map.addOverlays(Holly_Springs); centerByArray(Holly_Springs, false, false); cntMarker += Holly_Springs.length; map.addOverlays(Potts_Camp); centerByArray(Potts_Camp, false, false); cntMarker += Potts_Camp.length; centerByArray(Byhalia,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'); } }