function addMarkers() { mySelect = document.getElementById('selection'); Santa_Rosa_Beach = [];Freeport = [];Defuniak_Springs = [];Paxton = [];mySelect.options[mySelect.options.length] = new Option("Defuniak Springs schools",'all=Defuniak_Springs'); mySelect.options[mySelect.options.length] = new Option("Freeport schools",'all=Freeport'); mySelect.options[mySelect.options.length] = new Option("Paxton schools",'all=Paxton'); mySelect.options[mySelect.options.length] = new Option("Santa Rosa Beach schools",'all=Santa_Rosa_Beach'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Santa_Rosa_Beach[Santa_Rosa_Beach.length] = createMarker(new GPoint(-86.11868286,30.36853981),"
Bay Early Education Center
118 Gilmore Street
Santa Rosa Beach, FL 32459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bay Early Education Center",'Santa_Rosa_Beach=' + Santa_Rosa_Beach.length); Santa_Rosa_Beach[Santa_Rosa_Beach.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Emerald Coast Middle School
6694 West Co Highway 30a
Santa Rosa Beach, FL 32459

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Emerald Coast Middle School",'Santa_Rosa_Beach=' + Santa_Rosa_Beach.length); Freeport[Freeport.length] = createMarker(new GPoint(-86.13623810,30.49809074),"
Freeport Elementary School
15381 South Highway 331
Freeport, FL 32439

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Freeport Elementary School",'Freeport=' + Freeport.length); Freeport[Freeport.length] = createMarker(new GPoint(-86.13295746,30.50243187),"
Freeport Middle School
360 Kylea Laird Drive
Freeport, FL 32439

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Freeport Middle School",'Freeport=' + Freeport.length); Freeport[Freeport.length] = createMarker(new GPoint(-86.12319183,30.53872681),"
Freeport Senior High School
12615 U.s Highway 331 South
Freeport, FL 32439

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Freeport Senior High School",'Freeport=' + Freeport.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Maude Saunders Elementary School
416 John Baldwin Road
Defuniak Springs, FL 32433

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maude Saunders Elementary School",'Defuniak_Springs=' + Defuniak_Springs.length); Paxton[Paxton.length] = createMarker(new GPoint(-86.30728149,30.98163033),"
Paxton High School
21893 U.s.highway 331 North
Paxton, FL 32538

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paxton High School",'Paxton=' + Paxton.length); Santa_Rosa_Beach[Santa_Rosa_Beach.length] = createMarker(new GPoint(-86.17739868,30.34860039),"
Seaside Neighborhood School
10 Smolian Circlebox4653
Santa Rosa Beach, FL 32459

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Seaside Neighborhood School",'Santa_Rosa_Beach=' + Santa_Rosa_Beach.length); Santa_Rosa_Beach[Santa_Rosa_Beach.length] = createMarker(new GPoint(-86.15380096,30.37879944),"
South Walton High School
645 Greenway Trail
Santa Rosa Beach, FL 32459

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Walton High School",'Santa_Rosa_Beach=' + Santa_Rosa_Beach.length); Santa_Rosa_Beach[Santa_Rosa_Beach.length] = createMarker(new GPoint(-86.26308441,30.36121750),"
Van R. Butler Elementary School
6694 W Co Highway 30a
Santa Rosa Beach, FL 32459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Van R. Butler Elementary School",'Santa_Rosa_Beach=' + Santa_Rosa_Beach.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.09555817,30.72012329),"
Walton Academy, Inc.
389 Dorsey Avenue
Defuniak Springs, FL 32435

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walton Academy, Inc.",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-82.34698600,31.21218800),"
Walton County Superintendent's Office
0145 Park Street, Suite 2
Defuniak Springs, FL 32435

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walton County Superintendent's Office",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.13046265,30.73747063),"
Walton County Vocational School
761 N 20th Street
Defuniak Springs, FL 32433

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walton County Vocational School",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.12007141,30.71289825),"
Walton Middle School
625 Park Avenue
Defuniak Springs, FL 32435

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walton Middle School",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.12243652,30.74256325),"
Walton Senior High School
555 Walton Road
Defuniak Springs, FL 32433

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walton Senior High School",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.13637543,30.72445679),"
West Defuniak Elementary School
815 W Lincoln Avenue
Defuniak Springs, FL 32435

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Defuniak Elementary School",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.15768433,30.73215294),"
Wlc Intensive Halfway House
286 Gene Hurley Road
Defuniak Springs, FL 32435

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wlc Intensive Halfway House",'Defuniak_Springs=' + Defuniak_Springs.length); Defuniak_Springs[Defuniak_Springs.length] = createMarker(new GPoint(-86.15768433,30.73215294),"
Wlc Shop (formerly Nafi Sh
286 Gene Hurley Road
Defuniak Springs, FL 32435

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wlc Shop (formerly Nafi Sh",'Defuniak_Springs=' + Defuniak_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(Defuniak_Springs); map.removeOverlays(Freeport); map.removeOverlays(Paxton); map.removeOverlays(Santa_Rosa_Beach); 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(Santa_Rosa_Beach);map.removeOverlays(Defuniak_Springs); map.removeOverlays(Freeport); map.removeOverlays(Paxton); map.removeOverlays(Santa_Rosa_Beach); map.addOverlays(Defuniak_Springs); centerByArray(Defuniak_Springs, false, false); cntMarker += Defuniak_Springs.length; map.addOverlays(Freeport); centerByArray(Freeport, false, false); cntMarker += Freeport.length; map.addOverlays(Paxton); centerByArray(Paxton, false, false); cntMarker += Paxton.length; map.addOverlays(Santa_Rosa_Beach); centerByArray(Santa_Rosa_Beach, false, false); cntMarker += Santa_Rosa_Beach.length; centerByArray(Santa_Rosa_Beach,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'); } }