function addMarkers(){ mySelect = document.getElementById('selection'); Niceville = [];Fort_Walton_Beach = [];Destin = [];Crestview = [];Ft_Walton_Bch = [];mySelect.options[mySelect.options.length] = new Option("Crestview schools",'all=Crestview'); mySelect.options[mySelect.options.length] = new Option("Destin schools",'all=Destin'); mySelect.options[mySelect.options.length] = new Option("Fort Walton Beach schools",'all=Fort_Walton_Beach'); mySelect.options[mySelect.options.length] = new Option("Ft Walton Bch schools",'all=Ft_Walton_Bch'); mySelect.options[mySelect.options.length] = new Option("Niceville schools",'all=Niceville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Niceville[Niceville.length] = createMarker(new GPoint(-86.47804000,30.51854700),"
Agape Christian Academy
801 John Sims Parkway E
Niceville, FL 32578
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Agape Christian Academy",'Niceville=' + Niceville.length); Fort_Walton_Beach[Fort_Walton_Beach.length] = createMarker(new GPoint(-86.63047500,30.44220000),"
Calvary Christian Academy And Preschool
535 Clifford Street
Fort Walton Beach, FL 32547
school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian Academy And Preschool",'Fort_Walton_Beach=' + Fort_Walton_Beach.length); Fort_Walton_Beach[Fort_Walton_Beach.length] = createMarker(new GPoint(-86.60908100,30.42343100),"
Cinco Baptist School
26 Yacht Club Drive
Fort Walton Beach, FL 32548
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cinco Baptist School",'Fort_Walton_Beach=' + Fort_Walton_Beach.length); Niceville[Niceville.length] = createMarker(new GPoint(-86.39687600,30.45460100),"
Desire Street Academy
4750 Timpochee Lane
Niceville, FL 32578
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Desire Street Academy",'Niceville=' + Niceville.length); Destin[Destin.length] = createMarker(new GPoint(-86.49047400,30.39404200),"
Destin Christian Academy
201 Beach Drive
Destin, FL 32541
Co-ed school, NS-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Destin Christian Academy",'Destin=' + Destin.length); Fort_Walton_Beach[Fort_Walton_Beach.length] = createMarker(new GPoint(-86.62910000,30.44820000),"
Gulf Coast Christian School
922 Landry Street
Fort Walton Beach, FL 32547
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gulf Coast Christian School",'Fort_Walton_Beach=' + Fort_Walton_Beach.length); Fort_Walton_Beach[Fort_Walton_Beach.length] = createMarker(new GPoint(-86.59972300,30.44239300),"
Heritage Academy
428 Racetrack Road Ne
Fort Walton Beach, FL 32547
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Academy",'Fort_Walton_Beach=' + Fort_Walton_Beach.length); Crestview[Crestview.length] = createMarker(new GPoint(-86.54322200,30.75122300),"
Montessori Children's House
1374 E. Chestnut Ave
Crestview, FL 32539
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Children's House",'Crestview=' + Crestview.length); Fort_Walton_Beach[Fort_Walton_Beach.length] = createMarker(new GPoint(-86.61910000,30.41300000),"
Montessori Learning Center
204 Hospital Drive Ne
Fort Walton Beach, FL 32548
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Learning Center",'Fort_Walton_Beach=' + Fort_Walton_Beach.length); Ft_Walton_Bch[Ft_Walton_Bch.length] = createMarker(new GPoint(-86.64902400,30.44220000),"
Oak Tree Prim/small Wndrs Cdc
314 Carmel Drive
Ft Walton Bch, FL 32547
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Tree Prim/small Wndrs Cdc",'Ft_Walton_Bch=' + Ft_Walton_Bch.length); Niceville[Niceville.length] = createMarker(new GPoint(-86.46388300,30.52821000),"
Rocky Bayou Christian School
2101 Partin Drive N
Niceville, FL 32578
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rocky Bayou Christian School",'Niceville=' + Niceville.length); Fort_Walton_Beach[Fort_Walton_Beach.length] = createMarker(new GPoint(-86.61935900,30.42111300),"
St Mary School
110 Robinwood Drive Sw
Fort Walton Beach, FL 32548
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary School",'Fort_Walton_Beach=' + Fort_Walton_Beach.length); Crestview[Crestview.length] = createMarker(new GPoint(-86.56485400,30.74424500),"
Tall Pines Christian Academy
100 Duggan Ave
Crestview, FL 32536
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tall Pines Christian Academy",'Crestview=' + Crestview.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,11); /* 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/////3/' + showArray); map.removeOverlays(Crestview); map.removeOverlays(Destin); map.removeOverlays(Fort_Walton_Beach); map.removeOverlays(Ft_Walton_Bch); map.removeOverlays(Niceville); 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(Niceville);map.removeOverlays(Crestview); map.removeOverlays(Destin); map.removeOverlays(Fort_Walton_Beach); map.removeOverlays(Ft_Walton_Bch); map.removeOverlays(Niceville); map.addOverlays(Crestview); centerByArray(Crestview, false, false); cntMarker += Crestview.length; map.addOverlays(Destin); centerByArray(Destin, false, false); cntMarker += Destin.length; map.addOverlays(Fort_Walton_Beach); centerByArray(Fort_Walton_Beach, false, false); cntMarker += Fort_Walton_Beach.length; map.addOverlays(Ft_Walton_Bch); centerByArray(Ft_Walton_Bch, false, false); cntMarker += Ft_Walton_Bch.length; map.addOverlays(Niceville); centerByArray(Niceville, false, false); cntMarker += Niceville.length; centerByArray(Niceville,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'); //window.open('/map.php?type=1&schools=&school_level=3&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }