function addMarkers() { mySelect = document.getElementById('selection'); Moultrie = [];Doerun = [];Funston = [];Hartsfield = [];Norman_Park = [];mySelect.options[mySelect.options.length] = new Option("Doerun schools",'all=Doerun'); mySelect.options[mySelect.options.length] = new Option("Funston schools",'all=Funston'); mySelect.options[mySelect.options.length] = new Option("Hartsfield schools",'all=Hartsfield'); mySelect.options[mySelect.options.length] = new Option("Moultrie schools",'all=Moultrie'); mySelect.options[mySelect.options.length] = new Option("Norman Park schools",'all=Norman_Park'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.76599884,31.17288017),"
Colquitt County Alternative School Program
1800 Park Avenue
Moultrie, GA 31768

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colquitt County Alternative School Program",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.76184845,31.17183685),"
Colquitt County High School
1800 Park Avenue
Moultrie, GA 31768

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colquitt County High School",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.77468872,31.16862297),"
Cox Elementary School
1003 12th Street, Se
Moultrie, GA 31768

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cox Elementary School",'Moultrie=' + Moultrie.length); Doerun[Doerun.length] = createMarker(new GPoint(-83.91951752,31.32682037),"
Doerun Elementary School
Mathis Street
Doerun, GA 31744

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Doerun Elementary School",'Doerun=' + Doerun.length); Funston[Funston.length] = createMarker(new GPoint(-83.87287903,31.20026779),"
Funston Elementary School
137 North Academy Street
Funston, GA 31753

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Funston Elementary School",'Funston=' + Funston.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.79808807,31.19075966),"
Gray Middle School
812 11th Avenue, Nw
Moultrie, GA 31768

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Gray Middle School",'Moultrie=' + Moultrie.length); Hartsfield[Hartsfield.length] = createMarker(new GPoint(-83.95415497,31.12603760),"
Hamilton Elementary School
5110 Ga Highway 111
Hartsfield, GA 31756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Elementary School",'Hartsfield=' + Hartsfield.length); Norman_Park[Norman_Park.length] = createMarker(new GPoint(-83.61572266,31.23275948),"
Norman Park Elementary School
249 W. Weeks Street
Norman Park, GA 31771

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Norman Park Elementary School",'Norman_Park=' + Norman_Park.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.66641998,31.11921310),"
Odom Elementary School
2902 Sardis Church Road
Moultrie, GA 31768

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Odom Elementary School",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.80523682,31.24714470),"
Okapilco Elementary School
3300 Ga Highway 33 North
Moultrie, GA 31768

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Okapilco Elementary School",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.76599884,31.17288017),"
Program For Exceptional Students
348 Industrial Drive
Moultrie, GA 31768

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Program For Exceptional Students",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.79025269,31.17504883),"
Stringfellow Elementary School
200 Fifth Avenue, Sw
Moultrie, GA 31768

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stringfellow Elementary School",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.79660797,31.10220146),"
Sunset Elementary School
698 U.s. Highway 319 South
Moultrie, GA 31768

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunset Elementary School",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.76599884,31.17288017),"
Vereen Multipurpose Center
60 Greenwood Avenue, Sw
Moultrie, GA 31768

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vereen Multipurpose Center",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.79525757,31.16940117),"
Willie J. Williams Middle School
1000 Stadium Drive
Moultrie, GA 31768

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Willie J. Williams Middle School",'Moultrie=' + Moultrie.length); Moultrie[Moultrie.length] = createMarker(new GPoint(-83.78878021,31.17993927),"
Wright Elementary School
1812 2nd Street, Se
Moultrie, GA 31768

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wright Elementary School",'Moultrie=' + Moultrie.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(Doerun); map.removeOverlays(Funston); map.removeOverlays(Hartsfield); map.removeOverlays(Moultrie); map.removeOverlays(Norman_Park); 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(Moultrie);map.removeOverlays(Doerun); map.removeOverlays(Funston); map.removeOverlays(Hartsfield); map.removeOverlays(Moultrie); map.removeOverlays(Norman_Park); map.addOverlays(Doerun); centerByArray(Doerun, false, false); cntMarker += Doerun.length; map.addOverlays(Funston); centerByArray(Funston, false, false); cntMarker += Funston.length; map.addOverlays(Hartsfield); centerByArray(Hartsfield, false, false); cntMarker += Hartsfield.length; map.addOverlays(Moultrie); centerByArray(Moultrie, false, false); cntMarker += Moultrie.length; map.addOverlays(Norman_Park); centerByArray(Norman_Park, false, false); cntMarker += Norman_Park.length; centerByArray(Moultrie,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'); } }