function addMarkers() { mySelect = document.getElementById('selection'); Adairsville = [];Acworth = [];Cartersville = [];Emerson = [];Kingston = [];Rydal = [];Taylorsville = [];White = [];mySelect.options[mySelect.options.length] = new Option("Acworth schools",'all=Acworth'); mySelect.options[mySelect.options.length] = new Option("Adairsville schools",'all=Adairsville'); mySelect.options[mySelect.options.length] = new Option("Cartersville schools",'all=Cartersville'); mySelect.options[mySelect.options.length] = new Option("Emerson schools",'all=Emerson'); mySelect.options[mySelect.options.length] = new Option("Kingston schools",'all=Kingston'); mySelect.options[mySelect.options.length] = new Option("Rydal schools",'all=Rydal'); mySelect.options[mySelect.options.length] = new Option("Taylorsville schools",'all=Taylorsville'); mySelect.options[mySelect.options.length] = new Option("White schools",'all=White'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Adairsville[Adairsville.length] = createMarker(new GPoint(-84.93721771,34.37057114),"
Adairsville Elementary School
122 King Street
Adairsville, GA 30103

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adairsville Elementary School",'Adairsville=' + Adairsville.length); Adairsville[Adairsville.length] = createMarker(new GPoint(-84.93566895,34.36833572),"
Adairsville High School
519 Old Highway 41
Adairsville, GA 30103

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Adairsville High School",'Adairsville=' + Adairsville.length); Adairsville[Adairsville.length] = createMarker(new GPoint(-84.93923950,34.36898041),"
Adairsville Middle School
116 North Franklin
Adairsville, GA 30103

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Adairsville Middle School",'Adairsville=' + Adairsville.length); Acworth[Acworth.length] = createMarker(new GPoint(-84.67690277,34.06531906),"
Allatoona Elementary School
4150 New Hope Church Road, Nw
Acworth, GA 30101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Allatoona Elementary School",'Acworth=' + Acworth.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.79154205,34.15802002),"
Bartow Crossroads Academy
1675 Cassville Road, Nw
Cartersville, GA 30120

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bartow Crossroads Academy",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.81542969,34.15111542),"
Cartersville Elementary School
340 Old Mill Road
Cartersville, GA 30120

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cartersville Elementary School",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.78845978,34.16907883),"
Cartersville High School
320 East Church Street
Cartersville, GA 30120

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cartersville High School",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.82033539,34.12806320),"
Cartersville Middle School
825 Douthit Ferry Road
Cartersville, GA 30120

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cartersville Middle School",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.80969238,34.15011597),"
Cartersville Primary School
315 Etowah Drive
Cartersville, GA 30120

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cartersville Primary School",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.81857300,34.22555161),"
Cass High School
738 Grassdale Road, Nw
Cartersville, GA 30120

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cass High School",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.86552429,34.24217606),"
Cass Middle School
195 Firetower Road
Cartersville, GA 30120

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cass Middle School",'Cartersville=' + Cartersville.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.80188000,34.19681500),"
Cloverleaf Elementary School
71 Felton Road
Cartersville, GA 30120

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cloverleaf Elementary School",'Cartersville=' + Cartersville.length); Emerson[Emerson.length] = createMarker(new GPoint(-84.75826263,34.12251663),"
Emerson Elementary School
54 Seventh Street, Se
Emerson, GA 30137

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Emerson Elementary School",'Emerson=' + Emerson.length); Kingston[Kingston.length] = createMarker(new GPoint(-84.92649078,34.14779663),"
Euharlee Elementary School
1058 Euharlee Road
Kingston, GA 30145

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Euharlee Elementary School",'Kingston=' + Kingston.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.86982727,34.22454834),"
Hamilton Crossing Elementary School
116 Hamilton Crossing Road, Nw
Cartersville, GA 30120

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Crossing Elementary School",'Cartersville=' + Cartersville.length); Kingston[Kingston.length] = createMarker(new GPoint(-84.93474579,34.21547699),"
Kingston Elementary School
240 Hardin Bridge Road, Nw
Kingston, GA 30145

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kingston Elementary School",'Kingston=' + Kingston.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.87856293,34.16163635),"
Mission Road Elementary School
1100 Mission Road, Sw
Cartersville, GA 30120

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mission Road Elementary School",'Cartersville=' + Cartersville.length); Rydal[Rydal.length] = createMarker(new GPoint(-84.77154541,34.35433578),"
Pine Log Elementary School
3370 Highway 140, Ne
Rydal, GA 30171

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Log Elementary School",'Rydal=' + Rydal.length); Emerson[Emerson.length] = createMarker(new GPoint(-84.75715637,34.12176514),"
South Central Middle School
224 Old Alabama Road
Emerson, GA 30137

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Central Middle School",'Emerson=' + Emerson.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.79154205,34.15802002),"
Stars Preschool Center
1653 Cassville Road
Cartersville, GA 30120

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stars Preschool Center",'Cartersville=' + Cartersville.length); Taylorsville[Taylorsville.length] = createMarker(new GPoint(-84.94909668,34.10868073),"
Taylorsville Elementary School
1502 Old Alabama Road, Sw
Taylorsville, GA 30178

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylorsville Elementary School",'Taylorsville=' + Taylorsville.length); White[White.length] = createMarker(new GPoint(-84.75879669,34.26819992),"
White Elementary School
1395 Cass-white Road, Ne
White, GA 30184

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("White Elementary School",'White=' + White.length); Cartersville[Cartersville.length] = createMarker(new GPoint(-84.83045959,34.11682510),"
Woodland High School
800 Old Alabama Road
Cartersville, GA 30120

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodland High School",'Cartersville=' + Cartersville.length); Kingston[Kingston.length] = createMarker(new GPoint(-84.92681885,34.14751816),"
Woodland Middle School At Euharlee
1061 Euharlee Road
Kingston, GA 30145

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Woodland Middle School At Euharlee",'Kingston=' + Kingston.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(Acworth); map.removeOverlays(Adairsville); map.removeOverlays(Cartersville); map.removeOverlays(Emerson); map.removeOverlays(Kingston); map.removeOverlays(Rydal); map.removeOverlays(Taylorsville); map.removeOverlays(White); 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(Adairsville);map.removeOverlays(Acworth); map.removeOverlays(Adairsville); map.removeOverlays(Cartersville); map.removeOverlays(Emerson); map.removeOverlays(Kingston); map.removeOverlays(Rydal); map.removeOverlays(Taylorsville); map.removeOverlays(White); map.addOverlays(Acworth); centerByArray(Acworth, false, false); cntMarker += Acworth.length; map.addOverlays(Adairsville); centerByArray(Adairsville, false, false); cntMarker += Adairsville.length; map.addOverlays(Cartersville); centerByArray(Cartersville, false, false); cntMarker += Cartersville.length; map.addOverlays(Emerson); centerByArray(Emerson, false, false); cntMarker += Emerson.length; map.addOverlays(Kingston); centerByArray(Kingston, false, false); cntMarker += Kingston.length; map.addOverlays(Rydal); centerByArray(Rydal, false, false); cntMarker += Rydal.length; map.addOverlays(Taylorsville); centerByArray(Taylorsville, false, false); cntMarker += Taylorsville.length; map.addOverlays(White); centerByArray(White, false, false); cntMarker += White.length; centerByArray(Adairsville,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'); } }