function addMarkers() { mySelect = document.getElementById('selection'); Sopchoppy = [];Crawfordville = [];St_Marks = [];mySelect.options[mySelect.options.length] = new Option("Crawfordville schools",'all=Crawfordville'); mySelect.options[mySelect.options.length] = new Option("Sopchoppy schools",'all=Sopchoppy'); mySelect.options[mySelect.options.length] = new Option("St Marks schools",'all=St_Marks'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Sopchoppy[Sopchoppy.length] = createMarker(new GPoint(-84.49205400,30.06139700),"
Alternative High School Program
164 Yellow Jacket Avenue
Sopchoppy, FL 32358

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative High School Program",'Sopchoppy=' + Sopchoppy.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.37519836,30.17580032),"
Crawfordville Elementary School
379 Arran Road
Crawfordville, FL 32327

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crawfordville Elementary School",'Crawfordville=' + Crawfordville.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.30306244,30.19867516),"
District Pre-k Programs
87 Andrew Hargaret Sr. Rd
Crawfordville, FL 32327

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("District Pre-k Programs",'Crawfordville=' + Crawfordville.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.38880920,30.08001328),"
Medart Elementary School
2558 Coastal Highway
Crawfordville, FL 32327

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Medart Elementary School",'Crawfordville=' + Crawfordville.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.31748962,30.21988297),"
Riversprings Middle School
800 Spring Creek Highway
Crawfordville, FL 32327

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Riversprings Middle School",'Crawfordville=' + Crawfordville.length); Sopchoppy[Sopchoppy.length] = createMarker(new GPoint(-84.49344635,30.05805969),"
Second Chance Program
P. O. Box 68
Sopchoppy, FL 32358

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Second Chance Program",'Sopchoppy=' + Sopchoppy.length); Sopchoppy[Sopchoppy.length] = createMarker(new GPoint(-84.49649811,30.04050064),"
Second Chance Program - Sopchoppy Education Center
P. O. Box 68
Sopchoppy, FL 32358

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Second Chance Program - Sopchoppy Education Center",'Sopchoppy=' + Sopchoppy.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.31858826,30.22037888),"
Shadeville Elementary School
45 Warrior Way
Crawfordville, FL 32327

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shadeville Elementary School",'Crawfordville=' + Crawfordville.length); St_Marks[St_Marks.length] = createMarker(new GPoint(-84.20666100,30.16282500),"
Wakulla Coast Charter School Of Arts Science & Tec
P.o. Box 338
St. Marks, FL 32355

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wakulla Coast Charter School Of Arts Science & Tec",'St_Marks=' + St_Marks.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.37548000,30.17627700),"
Wakulla County Superintendent's Office
5p.o. Box 100
Crawfordville, FL 32326

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wakulla County Superintendent's Office",'Crawfordville=' + Crawfordville.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.37673187,30.10992622),"
Wakulla High School
3237 Coastal Highway
Crawfordville, FL 32327

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wakulla High School",'Crawfordville=' + Crawfordville.length); Crawfordville[Crawfordville.length] = createMarker(new GPoint(-84.37082672,30.12742615),"
Wakulla Middle School
22 Jean Drive
Crawfordville, FL 32327

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wakulla Middle School",'Crawfordville=' + Crawfordville.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(Crawfordville); map.removeOverlays(Sopchoppy); map.removeOverlays(St_Marks); 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(Sopchoppy);map.removeOverlays(Crawfordville); map.removeOverlays(Sopchoppy); map.removeOverlays(St_Marks); map.addOverlays(Crawfordville); centerByArray(Crawfordville, false, false); cntMarker += Crawfordville.length; map.addOverlays(Sopchoppy); centerByArray(Sopchoppy, false, false); cntMarker += Sopchoppy.length; map.addOverlays(St_Marks); centerByArray(St_Marks, false, false); cntMarker += St_Marks.length; centerByArray(Sopchoppy,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'); } }