function addMarkers() { mySelect = document.getElementById('selection'); Gainesville = [];Nicholson = [];Commerce = [];Watkinsville = [];Jefferson = [];Maysville = [];Talmo = [];Athens = [];Hoschton = [];Braselton = [];mySelect.options[mySelect.options.length] = new Option("Athens schools",'all=Athens'); mySelect.options[mySelect.options.length] = new Option("Braselton schools",'all=Braselton'); mySelect.options[mySelect.options.length] = new Option("Commerce schools",'all=Commerce'); mySelect.options[mySelect.options.length] = new Option("Gainesville schools",'all=Gainesville'); mySelect.options[mySelect.options.length] = new Option("Hoschton schools",'all=Hoschton'); mySelect.options[mySelect.options.length] = new Option("Jefferson schools",'all=Jefferson'); mySelect.options[mySelect.options.length] = new Option("Maysville schools",'all=Maysville'); mySelect.options[mySelect.options.length] = new Option("Nicholson schools",'all=Nicholson'); mySelect.options[mySelect.options.length] = new Option("Talmo schools",'all=Talmo'); mySelect.options[mySelect.options.length] = new Option("Watkinsville schools",'all=Watkinsville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Gainesville[Gainesville.length] = createMarker(new GPoint(-83.82968800,34.29403800),"
Alpine Psychoeducational Program
P.o. Box 2459
Gainesville, GA 30503

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alpine Psychoeducational Program",'Gainesville=' + Gainesville.length); Nicholson[Nicholson.length] = createMarker(new GPoint(-83.43154144,34.11408997),"
Benton Elementary School
5488 U.s. Highway 441 South
Nicholson, GA 30565

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benton Elementary School",'Nicholson=' + Nicholson.length); Commerce[Commerce.length] = createMarker(new GPoint(-83.46183777,34.19609451),"
Commerce Elementary School
395 Minish Drive
Commerce, GA 30529

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Commerce Elementary School",'Commerce=' + Commerce.length); Commerce[Commerce.length] = createMarker(new GPoint(-83.46488953,34.19951248),"
Commerce High School
272 Lakeview Drive
Commerce, GA 30529

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Commerce High School",'Commerce=' + Commerce.length); Commerce[Commerce.length] = createMarker(new GPoint(-83.46264648,34.19377899),"
Commerce Middle School
7690 Jefferson Road
Commerce, GA 30529

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Commerce Middle School",'Commerce=' + Commerce.length); Watkinsville[Watkinsville.length] = createMarker(new GPoint(-83.40927400,33.86328000),"
Crossroads Alternative School
2721 Hog Mountain Road
Watkinsville, GA 30677

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crossroads Alternative School",'Watkinsville=' + Watkinsville.length); Commerce[Commerce.length] = createMarker(new GPoint(-83.50627899,34.20816040),"
East Jackson Elementary School
1531 Hoods Mill Road
Commerce, GA 30529

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Jackson Elementary School",'Commerce=' + Commerce.length); Commerce[Commerce.length] = createMarker(new GPoint(-83.47203064,34.14757156),"
East Jackson Middle School
1880 Hoods Mill Road
Commerce, GA 30529

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("East Jackson Middle School",'Commerce=' + Commerce.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.57097900,34.11865700),"
Jackson County Crossroads
441 Gordon Street
Jefferson, GA 30549

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jackson County Crossroads",'Jefferson=' + Jefferson.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.59500122,34.10230637),"
Jackson County High School
1668 Winder Highway
Jefferson, GA 30549

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jackson County High School",'Jefferson=' + Jefferson.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.58419037,34.12349319),"
Jefferson Elementary School
415 Hoschton Street
Jefferson, GA 30549

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Jefferson=' + Jefferson.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.58097076,34.12333679),"
Jefferson High School
575 Washington Street
Jefferson, GA 30549

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson High School",'Jefferson=' + Jefferson.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.58666229,34.12217331),"
Jefferson Middle School
635 Old Pendergrass Rd.
Jefferson, GA 30549

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jefferson Middle School",'Jefferson=' + Jefferson.length); Maysville[Maysville.length] = createMarker(new GPoint(-83.55760193,34.24457169),"
Maysville Elementary School
9270 Highway 82 Spur
Maysville, GA 30558

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maysville Elementary School",'Maysville=' + Maysville.length); Talmo[Talmo.length] = createMarker(new GPoint(-83.69671631,34.17799377),"
North Jackson Elementary School
8632 U.s. Highway 129 North
Talmo, GA 30575

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Jackson Elementary School",'Talmo=' + Talmo.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.56964874,34.11281586),"
Regional Evening Alternative School
441 Gordon Street
Jefferson, GA 30549

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Regional Evening Alternative School",'Jefferson=' + Jefferson.length); Athens[Athens.length] = createMarker(new GPoint(-83.49925232,34.03984833),"
South Jackson Elementary School
8144 Jefferson Road
Athens, GA 30607

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Jackson Elementary School",'Athens=' + Athens.length); Hoschton[Hoschton.length] = createMarker(new GPoint(-83.76155853,34.09663010),"
West Jackson Intermediate School
Ga Hwy 53 And West Jackson Rd.
Hoschton, GA 30548

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Jackson Intermediate School",'Hoschton=' + Hoschton.length); Jefferson[Jefferson.length] = createMarker(new GPoint(-83.68708038,34.09426117),"
West Jackson Middle School
400 Gumspring Church Road
Jefferson, GA 30549

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("West Jackson Middle School",'Jefferson=' + Jefferson.length); Braselton[Braselton.length] = createMarker(new GPoint(-83.76229095,34.10583115),"
West Jackson Primary
4825 Highway 53
Braselton, GA 30517

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Jackson Primary",'Braselton=' + Braselton.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(Athens); map.removeOverlays(Braselton); map.removeOverlays(Commerce); map.removeOverlays(Gainesville); map.removeOverlays(Hoschton); map.removeOverlays(Jefferson); map.removeOverlays(Maysville); map.removeOverlays(Nicholson); map.removeOverlays(Talmo); map.removeOverlays(Watkinsville); 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(Gainesville);map.removeOverlays(Athens); map.removeOverlays(Braselton); map.removeOverlays(Commerce); map.removeOverlays(Gainesville); map.removeOverlays(Hoschton); map.removeOverlays(Jefferson); map.removeOverlays(Maysville); map.removeOverlays(Nicholson); map.removeOverlays(Talmo); map.removeOverlays(Watkinsville); map.addOverlays(Athens); centerByArray(Athens, false, false); cntMarker += Athens.length; map.addOverlays(Braselton); centerByArray(Braselton, false, false); cntMarker += Braselton.length; map.addOverlays(Commerce); centerByArray(Commerce, false, false); cntMarker += Commerce.length; map.addOverlays(Gainesville); centerByArray(Gainesville, false, false); cntMarker += Gainesville.length; map.addOverlays(Hoschton); centerByArray(Hoschton, false, false); cntMarker += Hoschton.length; map.addOverlays(Jefferson); centerByArray(Jefferson, false, false); cntMarker += Jefferson.length; map.addOverlays(Maysville); centerByArray(Maysville, false, false); cntMarker += Maysville.length; map.addOverlays(Nicholson); centerByArray(Nicholson, false, false); cntMarker += Nicholson.length; map.addOverlays(Talmo); centerByArray(Talmo, false, false); cntMarker += Talmo.length; map.addOverlays(Watkinsville); centerByArray(Watkinsville, false, false); cntMarker += Watkinsville.length; centerByArray(Gainesville,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'); } }