function addMarkers() { mySelect = document.getElementById('selection'); Cumming = [];Gainesville = [];Alpharetta = [];Suwanee = [];mySelect.options[mySelect.options.length] = new Option("Alpharetta schools",'all=Alpharetta'); mySelect.options[mySelect.options.length] = new Option("Cumming schools",'all=Cumming'); mySelect.options[mySelect.options.length] = new Option("Gainesville schools",'all=Gainesville'); mySelect.options[mySelect.options.length] = new Option("Suwanee schools",'all=Suwanee'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cumming[Cumming.length] = createMarker(new GPoint(-84.17687988,34.11212540),"
Big Creek Elementary School
1994 Peachtree Parkway
Cumming, GA 30041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Big Creek Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.08737946,34.23660278),"
Chattahoochee Elementary School
2800 Holtzclaw Road
Cumming, GA 30041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chattahoochee Elementary School",'Cumming=' + Cumming.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-83.77195740,34.27994156),"
Chestatee Elementary School
6945 Keith Bridge Road
Gainesville, GA 30506

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chestatee Elementary School",'Gainesville=' + Gainesville.length); Gainesville[Gainesville.length] = createMarker(new GPoint(-83.99594116,34.29566956),"
Chestatee Primary School
6945 Keithbridge Road
Gainesville, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chestatee Primary School",'Gainesville=' + Gainesville.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.10476685,34.27484131),"
Coal Mountain Elementary School
3455 Coal Mountain Drive
Cumming, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coal Mountain Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.13381195,34.21982956),"
Cumming Elementary School
540 Dahlonega Street
Cumming, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cumming Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.14057159,34.13413620),"
Daves Creek Elementary School
3740 Trammel Road
Cumming, GA 30041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Daves Creek Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.13920593,34.21564484),"
Forsyth Central High School
520 Tribble Gap Road
Cumming, GA 30040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forsyth Central High School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.18338800,34.14363400),"
Forsyth County Academy
7745 Majors Road
Cumming, GA 30041

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forsyth County Academy",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.20417023,34.29145813),"
Liberty Middle School
7465 Wallace Tatum Road
Cumming, GA 30040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Liberty Middle School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.10665131,34.16875839),"
Mashburn Elementary School
3777 Samples Road
Cumming, GA 30041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mashburn Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.20376587,34.29139709),"
Matt Elementary School
7455 Wallace Tatum Road
Cumming, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Matt Elementary School",'Cumming=' + Cumming.length); Alpharetta[Alpharetta.length] = createMarker(new GPoint(-84.23438263,34.15901566),"
Midway Elementary School
4805 Highway 9 North
Alpharetta, GA 30004

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Midway Elementary School",'Alpharetta=' + Alpharetta.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.10582733,34.27669907),"
North Forsyth High School
3635 Coal Mountain Drive
Cumming, GA 30040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Forsyth High School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.10589600,34.27671814),"
North Forsyth Middle School
3645 Coal Mountain Drive
Cumming, GA 30040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Forsyth Middle School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.13868713,34.21781158),"
Otwell Middle School
605 Tribble Gap Road
Cumming, GA 30040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Otwell Middle School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.18721771,34.17763901),"
Piedmont Learning Center
1130 Dahlonega Highway
Cumming, GA 30040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Piedmont Learning Center",'Cumming=' + Cumming.length); Suwanee[Suwanee.length] = createMarker(new GPoint(-84.10543000,34.12225400),"
Riverwatch Middle School
610 James Burgess Road
Suwanee, GA 30024

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverwatch Middle School",'Suwanee=' + Suwanee.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.17731476,34.24016571),"
Sawnee Elementary School
1616 Canton Highway
Cumming, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sawnee Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.17356873,34.24186325),"
Sawnee Primary School
1655 Spot Road Connector
Cumming, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sawnee Primary School",'Cumming=' + Cumming.length); Suwanee[Suwanee.length] = createMarker(new GPoint(-84.10232544,34.12625122),"
Settles Bridge Elementary School
600 James Burgess Road
Suwanee, GA 30024

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Settles Bridge Elementary School",'Suwanee=' + Suwanee.length); Suwanee[Suwanee.length] = createMarker(new GPoint(-84.08232117,34.08837891),"
Sharon Elementary School
1670 James Burgess Road
Suwanee, GA 30024

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sharon Elementary School",'Suwanee=' + Suwanee.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.17311096,34.14800644),"
South Forsyth High School
585 Peachtree Parkway
Cumming, GA 30041

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Forsyth High School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.15493011,34.11682510),"
South Forsyth Middle School
2865 Old Atlanta Road
Cumming, GA 30041

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Forsyth Middle School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.22265625,34.17711639),"
Vickery Creek Elementary School
6280 Post Road
Cumming, GA 30040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vickery Creek Elementary School",'Cumming=' + Cumming.length); Cumming[Cumming.length] = createMarker(new GPoint(-84.22196960,34.17787933),"
Vickery Creek Middle School
6240 Post Road
Cumming, GA 30040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Vickery Creek Middle School",'Cumming=' + Cumming.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(Alpharetta); map.removeOverlays(Cumming); map.removeOverlays(Gainesville); map.removeOverlays(Suwanee); 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(Cumming);map.removeOverlays(Alpharetta); map.removeOverlays(Cumming); map.removeOverlays(Gainesville); map.removeOverlays(Suwanee); map.addOverlays(Alpharetta); centerByArray(Alpharetta, false, false); cntMarker += Alpharetta.length; map.addOverlays(Cumming); centerByArray(Cumming, false, false); cntMarker += Cumming.length; map.addOverlays(Gainesville); centerByArray(Gainesville, false, false); cntMarker += Gainesville.length; map.addOverlays(Suwanee); centerByArray(Suwanee, false, false); cntMarker += Suwanee.length; centerByArray(Cumming,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'); } }